query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
e1b3010834eababa95544efc05ffca99
XXX_OneofFuncs is for the internal use of the proto package.
[ { "docid": "eebd02429c929b42e3a05eef5aeab99e", "score": "0.0", "text": "func (*ControllerGetCapabilitiesResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ControllerGetCapabilitiesResponse_OneofMarshaler, _ControllerGetCapabilitiesResponse_OneofUnmarshaler, _ControllerGetCapabilitiesResponse_OneofSizer, []interface{}{\n\t\t(*ControllerGetCapabilitiesResponse_Result_)(nil),\n\t\t(*ControllerGetCapabilitiesResponse_Error)(nil),\n\t}\n}", "title": "" } ]
[ { "docid": "cba179919fe07b348d048d5fd8c4ac85", "score": "0.89805615", "text": "func (*Event_Label) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Event_Label_OneofMarshaler, _Event_Label_OneofUnmarshaler, _Event_Label_OneofSizer, []interface{}{\n\t\t(*Event_Label_Item)(nil),\n\t\t(*Event_Label_Plus)(nil),\n\t\t(*Event_Label_Noise)(nil),\n\t}\n}", "title": "" }, { "docid": "16ad32fdcca0b1b0c9fd1c02428898c4", "score": "0.89369386", "text": "func (*ExampleTable1) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ExampleTable1_OneofMarshaler, _ExampleTable1_OneofUnmarshaler, _ExampleTable1_OneofSizer, []interface{}{\n\t\t(*ExampleTable1_TestId)(nil),\n\t\t(*ExampleTable1_TestValue)(nil),\n\t\t(*ExampleTable1_TestOutMessage)(nil),\n\t}\n}", "title": "" }, { "docid": "f3ea5135a9a3ea77117c5bc40991cfcf", "score": "0.893586", "text": "func (*RawMetricV1) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _RawMetricV1_OneofMarshaler, _RawMetricV1_OneofUnmarshaler, _RawMetricV1_OneofSizer, []interface{}{\n\t\t(*RawMetricV1_Counter)(nil),\n\t\t(*RawMetricV1_Gauge)(nil),\n\t\t(*RawMetricV1_Set)(nil),\n\t\t(*RawMetricV1_Timer)(nil),\n\t}\n}", "title": "" }, { "docid": "4fc57b0ff20b3c60feca7fa9580782aa", "score": "0.8926787", "text": "func (*Descriptor) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Descriptor_OneofMarshaler, _Descriptor_OneofUnmarshaler, _Descriptor_OneofSizer, []interface{}{\n\t\t(*Descriptor_Table)(nil),\n\t\t(*Descriptor_Database)(nil),\n\t}\n}", "title": "" }, { "docid": "4fc57b0ff20b3c60feca7fa9580782aa", "score": "0.8926787", "text": "func (*Descriptor) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Descriptor_OneofMarshaler, _Descriptor_OneofUnmarshaler, _Descriptor_OneofSizer, []interface{}{\n\t\t(*Descriptor_Table)(nil),\n\t\t(*Descriptor_Database)(nil),\n\t}\n}", "title": "" }, { "docid": "4fc57b0ff20b3c60feca7fa9580782aa", "score": "0.8926787", "text": "func (*Descriptor) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Descriptor_OneofMarshaler, _Descriptor_OneofUnmarshaler, _Descriptor_OneofSizer, []interface{}{\n\t\t(*Descriptor_Table)(nil),\n\t\t(*Descriptor_Database)(nil),\n\t}\n}", "title": "" }, { "docid": "9b5ec50a360fe5ab4cf1122695a21f20", "score": "0.8911923", "text": "func (*Field) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Field_OneofMarshaler, _Field_OneofUnmarshaler, _Field_OneofSizer, []interface{}{\n\t\t(*Field_AttrName)(nil),\n\t\t(*Field_Offset)(nil),\n\t}\n}", "title": "" }, { "docid": "186909cb0959b1c8bbefa7ed87f97078", "score": "0.88997686", "text": "func (*TlsCbKeyHandle) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TlsCbKeyHandle_OneofMarshaler, _TlsCbKeyHandle_OneofUnmarshaler, _TlsCbKeyHandle_OneofSizer, []interface{}{\n\t\t(*TlsCbKeyHandle_TlscbId)(nil),\n\t\t(*TlsCbKeyHandle_TlscbHandle)(nil),\n\t}\n}", "title": "" }, { "docid": "e80c4e81c284e48d71a555db3cb34154", "score": "0.88944924", "text": "func (*FromDataplane) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) {\n\treturn _FromDataplane_OneofMarshaler, _FromDataplane_OneofUnmarshaler, _FromDataplane_OneofSizer, []interface{}{\n\t\t(*FromDataplane_ProcessStatusUpdate)(nil),\n\t\t(*FromDataplane_HostEndpointStatusUpdate)(nil),\n\t\t(*FromDataplane_HostEndpointStatusRemove)(nil),\n\t\t(*FromDataplane_WorkloadEndpointStatusUpdate)(nil),\n\t\t(*FromDataplane_WorkloadEndpointStatusRemove)(nil),\n\t\t(*FromDataplane_WireguardStatusUpdate)(nil),\n\t}\n}", "title": "" }, { "docid": "9aa41694fcc88192eab177f43142f436", "score": "0.88903856", "text": "func (*Msg) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Msg_OneofMarshaler, _Msg_OneofUnmarshaler, _Msg_OneofSizer, []interface{}{\n\t\t(*Msg_Request)(nil),\n\t\t(*Msg_Preprepare)(nil),\n\t\t(*Msg_Prepare)(nil),\n\t\t(*Msg_Commit)(nil),\n\t\t(*Msg_ViewChange)(nil),\n\t\t(*Msg_NewView)(nil),\n\t\t(*Msg_Checkpoint)(nil),\n\t\t(*Msg_Hello)(nil),\n\t}\n}", "title": "" }, { "docid": "9aa41694fcc88192eab177f43142f436", "score": "0.88903856", "text": "func (*Msg) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Msg_OneofMarshaler, _Msg_OneofUnmarshaler, _Msg_OneofSizer, []interface{}{\n\t\t(*Msg_Request)(nil),\n\t\t(*Msg_Preprepare)(nil),\n\t\t(*Msg_Prepare)(nil),\n\t\t(*Msg_Commit)(nil),\n\t\t(*Msg_ViewChange)(nil),\n\t\t(*Msg_NewView)(nil),\n\t\t(*Msg_Checkpoint)(nil),\n\t\t(*Msg_Hello)(nil),\n\t}\n}", "title": "" }, { "docid": "9aa41694fcc88192eab177f43142f436", "score": "0.88903856", "text": "func (*Msg) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Msg_OneofMarshaler, _Msg_OneofUnmarshaler, _Msg_OneofSizer, []interface{}{\n\t\t(*Msg_Request)(nil),\n\t\t(*Msg_Preprepare)(nil),\n\t\t(*Msg_Prepare)(nil),\n\t\t(*Msg_Commit)(nil),\n\t\t(*Msg_ViewChange)(nil),\n\t\t(*Msg_NewView)(nil),\n\t\t(*Msg_Checkpoint)(nil),\n\t\t(*Msg_Hello)(nil),\n\t}\n}", "title": "" }, { "docid": "6df99f46edd8966fcf8d0239daa8884d", "score": "0.8888718", "text": "func (*Packet) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Packet_OneofMarshaler, _Packet_OneofUnmarshaler, _Packet_OneofSizer, []interface{}{\n\t\t(*Packet_BlockData)(nil),\n\t\t(*Packet_BundleData)(nil),\n\t\t(*Packet_RepData)(nil),\n\t\t(*Packet_WeakData)(nil),\n\t\t(*Packet_SanityData)(nil),\n\t\t(*Packet_InitialData)(nil),\n\t}\n}", "title": "" }, { "docid": "b448af569ae919609e1ce49b98b9763f", "score": "0.88885033", "text": "func (*Message) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Message_OneofMarshaler, _Message_OneofUnmarshaler, _Message_OneofSizer, []interface{}{\n\t\t(*Message_FloatValue)(nil),\n\t\t(*Message_StringValue)(nil),\n\t\t(*Message_BoolValue)(nil),\n\t\t(*Message_DataValue)(nil),\n\t}\n}", "title": "" }, { "docid": "a4e53bef2bc8b24fa205e33be1dba61b", "score": "0.88809806", "text": "func (*Message) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Message_OneofMarshaler, _Message_OneofUnmarshaler, _Message_OneofSizer, []interface{}{\n\t\t(*Message_Block)(nil),\n\t\t(*Message_Transaction)(nil),\n\t\t(*Message_PeerTable)(nil),\n\t}\n}", "title": "" }, { "docid": "c4f6640e1e897a593f70bf5ba538eb80", "score": "0.8876479", "text": "func (*Protocol) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) {\n\treturn _Protocol_OneofMarshaler, _Protocol_OneofUnmarshaler, _Protocol_OneofSizer, []interface{}{\n\t\t(*Protocol_Number)(nil),\n\t\t(*Protocol_Name)(nil),\n\t}\n}", "title": "" }, { "docid": "abc4e6cb4997687028d793b6350db264", "score": "0.8874849", "text": "func (*PushValue) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) {\n\treturn _PushValue_OneofMarshaler, _PushValue_OneofUnmarshaler, _PushValue_OneofSizer, []interface{}{\n\t\t(*PushValue_Stmt)(nil),\n\t\t(*PushValue_End)(nil),\n\t}\n}", "title": "" }, { "docid": "d687a444d932f7d3e25b3599fc8d4c67", "score": "0.88724464", "text": "func (*Message) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Message_OneofMarshaler, _Message_OneofUnmarshaler, _Message_OneofSizer, []interface{}{\n\t\t(*Message_Error)(nil),\n\t\t(*Message_Ping)(nil),\n\t\t(*Message_Pong)(nil),\n\t\t(*Message_Connect)(nil),\n\t\t(*Message_Connected)(nil),\n\t\t(*Message_RequestRead)(nil),\n\t\t(*Message_RequestWrite)(nil),\n\t}\n}", "title": "" }, { "docid": "8808ca0b6162d860a75cfe6ec11b37ca", "score": "0.88718826", "text": "func (*Test) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Test_OneofMarshaler, _Test_OneofUnmarshaler, _Test_OneofSizer, []interface{}{\n\t\t(*Test_Get)(nil),\n\t\t(*Test_Create)(nil),\n\t\t(*Test_Set)(nil),\n\t\t(*Test_Update)(nil),\n\t\t(*Test_UpdatePaths)(nil),\n\t\t(*Test_Delete)(nil),\n\t\t(*Test_Query)(nil),\n\t\t(*Test_Listen)(nil),\n\t}\n}", "title": "" }, { "docid": "b4f4fd675e5f40fea2c07b4bbdd7cf07", "score": "0.8867347", "text": "func (*Test) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Test_OneofMarshaler, _Test_OneofUnmarshaler, _Test_OneofSizer, []interface{}{\n\t\t(*Test_Get)(nil),\n\t\t(*Test_Create)(nil),\n\t\t(*Test_Set)(nil),\n\t\t(*Test_Update)(nil),\n\t\t(*Test_UpdatePaths)(nil),\n\t\t(*Test_Delete)(nil),\n\t}\n}", "title": "" }, { "docid": "9ab7ddb341b4fe3f7301520e9d21f8af", "score": "0.8866014", "text": "func (*Metric) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Metric_OneofMarshaler, _Metric_OneofUnmarshaler, _Metric_OneofSizer, []interface{}{\n\t\t(*Metric_StringData)(nil),\n\t\t(*Metric_Float32Data)(nil),\n\t\t(*Metric_Float64Data)(nil),\n\t\t(*Metric_Int32Data)(nil),\n\t\t(*Metric_Int64Data)(nil),\n\t\t(*Metric_BytesData)(nil),\n\t\t(*Metric_BoolData)(nil),\n\t}\n}", "title": "" }, { "docid": "8da901452ec73c166feb942cb1a1d691", "score": "0.8861439", "text": "func (*InvData) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _InvData_OneofMarshaler, _InvData_OneofUnmarshaler, _InvData_OneofSizer, []interface{}{\n\t\t(*InvData_Tx)(nil),\n\t\t(*InvData_Block)(nil),\n\t}\n}", "title": "" }, { "docid": "2f9f16836ef6e0652c62e2293fe7cb6f", "score": "0.8859219", "text": "func (*View_Tag) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _View_Tag_OneofMarshaler, _View_Tag_OneofUnmarshaler, _View_Tag_OneofSizer, []interface{}{\n\t\t(*View_Tag_Value)(nil),\n\t\t(*View_Tag_Calc)(nil),\n\t}\n}", "title": "" }, { "docid": "2f9f16836ef6e0652c62e2293fe7cb6f", "score": "0.8859219", "text": "func (*View_Tag) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _View_Tag_OneofMarshaler, _View_Tag_OneofUnmarshaler, _View_Tag_OneofSizer, []interface{}{\n\t\t(*View_Tag_Value)(nil),\n\t\t(*View_Tag_Calc)(nil),\n\t}\n}", "title": "" }, { "docid": "54184794ae54cbab752baa4021314e8e", "score": "0.8852509", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "54184794ae54cbab752baa4021314e8e", "score": "0.8852509", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "f1b280392ad1f35d378404a0d82689e4", "score": "0.88511795", "text": "func (*Validator) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Validator_OneofMarshaler, _Validator_OneofUnmarshaler, _Validator_OneofSizer, []interface{}{\n\t\t(*Validator_And_)(nil),\n\t\t(*Validator_Or_)(nil),\n\t\t(*Validator_Simple_)(nil),\n\t\t(*Validator_Constant_)(nil),\n\t}\n}", "title": "" }, { "docid": "e1dad3120c40bae6361857b821a52b8e", "score": "0.8849103", "text": "func (*StateData) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _StateData_OneofMarshaler, _StateData_OneofUnmarshaler, _StateData_OneofSizer, []interface{}{\n\t\t(*StateData_String_)(nil),\n\t\t(*StateData_Bytes)(nil),\n\t\t(*StateData_Uint64)(nil),\n\t\t(*StateData_Int64)(nil),\n\t}\n}", "title": "" }, { "docid": "ca4011fdfc45b41f2ba065ae8534053b", "score": "0.88488716", "text": "func (*ListenerConfig) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ListenerConfig_OneofMarshaler, _ListenerConfig_OneofUnmarshaler, _ListenerConfig_OneofSizer, []interface{}{\n\t\t(*ListenerConfig_Inbound)(nil),\n\t\t(*ListenerConfig_Outbound)(nil),\n\t}\n}", "title": "" }, { "docid": "9605a07680b694256146ff3ffc1bcdc1", "score": "0.8848774", "text": "func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Event_OneofMarshaler, _Event_OneofUnmarshaler, _Event_OneofSizer, []interface{}{\n\t\t(*Event_Timestamp_)(nil),\n\t\t(*Event_Label_)(nil),\n\t\t(*Event_Audio_)(nil),\n\t\t(*Event_Meta_)(nil),\n\t}\n}", "title": "" }, { "docid": "5a9d338ff532f9de837ecbba78ab61de", "score": "0.8845733", "text": "func (*Example) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Example_OneofMarshaler, _Example_OneofUnmarshaler, _Example_OneofSizer, []interface{}{\n\t\t(*Example_A)(nil),\n\t\t(*Example_BJk)(nil),\n\t}\n}", "title": "" }, { "docid": "5e2033d8a00d7b27241efed8ddbba0fa", "score": "0.88445026", "text": "func (*Metric) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Metric_OneofMarshaler, _Metric_OneofUnmarshaler, _Metric_OneofSizer, []interface{}{\n\t\t(*Metric_StringData)(nil),\n\t\t(*Metric_Float32Data)(nil),\n\t\t(*Metric_Float64Data)(nil),\n\t\t(*Metric_Int32Data)(nil),\n\t\t(*Metric_Int64Data)(nil),\n\t\t(*Metric_BytesData)(nil),\n\t}\n}", "title": "" }, { "docid": "85984dfde0bbe9df55bdf4e54cf492ba", "score": "0.8844279", "text": "func (*Datum) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Datum_OneofMarshaler, _Datum_OneofUnmarshaler, _Datum_OneofSizer, []interface{}{\n\t\t(*Datum_Empty)(nil),\n\t\t(*Datum_Blob)(nil),\n\t\t(*Datum_Error)(nil),\n\t\t(*Datum_StageRef)(nil),\n\t\t(*Datum_HttpReq)(nil),\n\t\t(*Datum_HttpResp)(nil),\n\t\t(*Datum_State)(nil),\n\t}\n}", "title": "" }, { "docid": "b831f6cebf43fb7f63f0c2c16f482402", "score": "0.88422096", "text": "func (*LoadBalancing) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _LoadBalancing_OneofMarshaler, _LoadBalancing_OneofUnmarshaler, _LoadBalancing_OneofSizer, []interface{}{\n\t\t(*LoadBalancing_Name)(nil),\n\t\t(*LoadBalancing_Custom)(nil),\n\t}\n}", "title": "" }, { "docid": "d9563752e68b50a2773db169d7b8132f", "score": "0.8841195", "text": "func (*CircuitBreaker) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _CircuitBreaker_OneofMarshaler, _CircuitBreaker_OneofUnmarshaler, _CircuitBreaker_OneofSizer, []interface{}{\n\t\t(*CircuitBreaker_SimpleCb)(nil),\n\t\t(*CircuitBreaker_Custom)(nil),\n\t}\n}", "title": "" }, { "docid": "0631f7d9f1b1a40d45c3d8a2104f3f91", "score": "0.8836588", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_Confirmation)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "0631f7d9f1b1a40d45c3d8a2104f3f91", "score": "0.8836588", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_Confirmation)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "0631f7d9f1b1a40d45c3d8a2104f3f91", "score": "0.8836588", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_Confirmation)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "0631f7d9f1b1a40d45c3d8a2104f3f91", "score": "0.8836588", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_Confirmation)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "0631f7d9f1b1a40d45c3d8a2104f3f91", "score": "0.8836588", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_Confirmation)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "0631f7d9f1b1a40d45c3d8a2104f3f91", "score": "0.8836588", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_Confirmation)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "0631f7d9f1b1a40d45c3d8a2104f3f91", "score": "0.8836588", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_Confirmation)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "0631f7d9f1b1a40d45c3d8a2104f3f91", "score": "0.8836588", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_Confirmation)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "4526a5ffeb392b99b48120cb7d6850fc", "score": "0.8836014", "text": "func (*Record) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Record_OneofMarshaler, _Record_OneofUnmarshaler, _Record_OneofSizer, []interface{}{\n\t\t(*Record_NoSessionContext)(nil),\n\t\t(*Record_SessionContext)(nil),\n\t}\n}", "title": "" }, { "docid": "0b33770122607139d3b97155fa948887", "score": "0.883542", "text": "func (*TestStreamPayload_Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TestStreamPayload_Event_OneofMarshaler, _TestStreamPayload_Event_OneofUnmarshaler, _TestStreamPayload_Event_OneofSizer, []interface{}{\n\t\t(*TestStreamPayload_Event_WatermarkEvent)(nil),\n\t\t(*TestStreamPayload_Event_ProcessingTimeEvent)(nil),\n\t\t(*TestStreamPayload_Event_ElementEvent)(nil),\n\t}\n}", "title": "" }, { "docid": "0b33770122607139d3b97155fa948887", "score": "0.883542", "text": "func (*TestStreamPayload_Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TestStreamPayload_Event_OneofMarshaler, _TestStreamPayload_Event_OneofUnmarshaler, _TestStreamPayload_Event_OneofSizer, []interface{}{\n\t\t(*TestStreamPayload_Event_WatermarkEvent)(nil),\n\t\t(*TestStreamPayload_Event_ProcessingTimeEvent)(nil),\n\t\t(*TestStreamPayload_Event_ElementEvent)(nil),\n\t}\n}", "title": "" }, { "docid": "b7e8802516205aa11abbcbd6f329a7e9", "score": "0.8834958", "text": "func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{\n\t\t(*TwoOneofs_Field1)(nil),\n\t\t(*TwoOneofs_Field2)(nil),\n\t\t(*TwoOneofs_Field3)(nil),\n\t\t(*TwoOneofs_Field34)(nil),\n\t\t(*TwoOneofs_Field35)(nil),\n\t\t(*TwoOneofs_SubMessage2)(nil),\n\t}\n}", "title": "" }, { "docid": "b7e8802516205aa11abbcbd6f329a7e9", "score": "0.8834958", "text": "func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{\n\t\t(*TwoOneofs_Field1)(nil),\n\t\t(*TwoOneofs_Field2)(nil),\n\t\t(*TwoOneofs_Field3)(nil),\n\t\t(*TwoOneofs_Field34)(nil),\n\t\t(*TwoOneofs_Field35)(nil),\n\t\t(*TwoOneofs_SubMessage2)(nil),\n\t}\n}", "title": "" }, { "docid": "b7e8802516205aa11abbcbd6f329a7e9", "score": "0.8834958", "text": "func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{\n\t\t(*TwoOneofs_Field1)(nil),\n\t\t(*TwoOneofs_Field2)(nil),\n\t\t(*TwoOneofs_Field3)(nil),\n\t\t(*TwoOneofs_Field34)(nil),\n\t\t(*TwoOneofs_Field35)(nil),\n\t\t(*TwoOneofs_SubMessage2)(nil),\n\t}\n}", "title": "" }, { "docid": "b7e8802516205aa11abbcbd6f329a7e9", "score": "0.8834958", "text": "func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{\n\t\t(*TwoOneofs_Field1)(nil),\n\t\t(*TwoOneofs_Field2)(nil),\n\t\t(*TwoOneofs_Field3)(nil),\n\t\t(*TwoOneofs_Field34)(nil),\n\t\t(*TwoOneofs_Field35)(nil),\n\t\t(*TwoOneofs_SubMessage2)(nil),\n\t}\n}", "title": "" }, { "docid": "b7e8802516205aa11abbcbd6f329a7e9", "score": "0.8834958", "text": "func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{\n\t\t(*TwoOneofs_Field1)(nil),\n\t\t(*TwoOneofs_Field2)(nil),\n\t\t(*TwoOneofs_Field3)(nil),\n\t\t(*TwoOneofs_Field34)(nil),\n\t\t(*TwoOneofs_Field35)(nil),\n\t\t(*TwoOneofs_SubMessage2)(nil),\n\t}\n}", "title": "" }, { "docid": "b7e8802516205aa11abbcbd6f329a7e9", "score": "0.8834958", "text": "func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{\n\t\t(*TwoOneofs_Field1)(nil),\n\t\t(*TwoOneofs_Field2)(nil),\n\t\t(*TwoOneofs_Field3)(nil),\n\t\t(*TwoOneofs_Field34)(nil),\n\t\t(*TwoOneofs_Field35)(nil),\n\t\t(*TwoOneofs_SubMessage2)(nil),\n\t}\n}", "title": "" }, { "docid": "b7e8802516205aa11abbcbd6f329a7e9", "score": "0.8834958", "text": "func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{\n\t\t(*TwoOneofs_Field1)(nil),\n\t\t(*TwoOneofs_Field2)(nil),\n\t\t(*TwoOneofs_Field3)(nil),\n\t\t(*TwoOneofs_Field34)(nil),\n\t\t(*TwoOneofs_Field35)(nil),\n\t\t(*TwoOneofs_SubMessage2)(nil),\n\t}\n}", "title": "" }, { "docid": "2cb2975027ca828a88e3676f97d13786", "score": "0.8830827", "text": "func (*RecordRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _RecordRequest_OneofMarshaler, _RecordRequest_OneofUnmarshaler, _RecordRequest_OneofSizer, []interface{}{\n\t\t(*RecordRequest_StreamingConfig)(nil),\n\t\t(*RecordRequest_AudioContent)(nil),\n\t}\n}", "title": "" }, { "docid": "1a468b2a26033dfdcf55c1724aa178f8", "score": "0.8829688", "text": "func (*Contract_Binding) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Contract_Binding_OneofMarshaler, _Contract_Binding_OneofUnmarshaler, _Contract_Binding_OneofSizer, []interface{}{\n\t\t(*Contract_Binding_Attachment)(nil),\n\t\t(*Contract_Binding_Reference)(nil),\n\t}\n}", "title": "" }, { "docid": "baa8d6606e4523e68a1957687ecb0eea", "score": "0.88296235", "text": "func (*ChangeDataRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ChangeDataRequest_OneofMarshaler, _ChangeDataRequest_OneofUnmarshaler, _ChangeDataRequest_OneofSizer, []interface{}{\n\t\t(*ChangeDataRequest_Register_)(nil),\n\t\t(*ChangeDataRequest_NotifyTxnStatus_)(nil),\n\t}\n}", "title": "" }, { "docid": "6bdfa8f166147ea53a72b27c6e2a7c4e", "score": "0.8828933", "text": "func (*RunnerMsg) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _RunnerMsg_OneofMarshaler, _RunnerMsg_OneofUnmarshaler, _RunnerMsg_OneofSizer, []interface{}{\n\t\t(*RunnerMsg_ResultStart)(nil),\n\t\t(*RunnerMsg_Data)(nil),\n\t\t(*RunnerMsg_Finished)(nil),\n\t}\n}", "title": "" }, { "docid": "6a680e7499e3b3e3b6913621c038c627", "score": "0.8828527", "text": "func (*BotInfo) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _BotInfo_OneofMarshaler, _BotInfo_OneofUnmarshaler, _BotInfo_OneofSizer, []interface{}{\n\t\t(*BotInfo_BotInfo)(nil),\n\t}\n}", "title": "" }, { "docid": "49bb3fe632a66c7b8c84e46ea1cc5b65", "score": "0.88281214", "text": "func (*ProxycCbKeyHandle) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ProxycCbKeyHandle_OneofMarshaler, _ProxycCbKeyHandle_OneofUnmarshaler, _ProxycCbKeyHandle_OneofSizer, []interface{}{\n\t\t(*ProxycCbKeyHandle_ProxyccbId)(nil),\n\t\t(*ProxycCbKeyHandle_ProxyccbHandle)(nil),\n\t}\n}", "title": "" }, { "docid": "13f4377bf4c755f07d34f978db4226be", "score": "0.8827457", "text": "func (*HealthCheck_Payload) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _HealthCheck_Payload_OneofMarshaler, _HealthCheck_Payload_OneofUnmarshaler, _HealthCheck_Payload_OneofSizer, []interface{}{\n\t\t(*HealthCheck_Payload_Text)(nil),\n\t\t(*HealthCheck_Payload_Binary)(nil),\n\t}\n}", "title": "" }, { "docid": "79586f02455d243c70ead0f8d042567a", "score": "0.88263047", "text": "func (*Field) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Field_OneofMarshaler, _Field_OneofUnmarshaler, _Field_OneofSizer, []interface{}{\n\t\t(*Field_DefaultString)(nil),\n\t\t(*Field_DefaultNumber)(nil),\n\t\t(*Field_DefaultBool)(nil),\n\t}\n}", "title": "" }, { "docid": "054c6e9ad7fec788620d52aa947be4fb", "score": "0.8823935", "text": "func (*EditProto) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _EditProto_OneofMarshaler, _EditProto_OneofUnmarshaler, _EditProto_OneofSizer, []interface{}{\n\t\t(*EditProto_Patch)(nil),\n\t\t(*EditProto_Template)(nil),\n\t}\n}", "title": "" }, { "docid": "62c2d66fcd58bd2761c79073a86a7a00", "score": "0.88238925", "text": "func (*PayloadConfig) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PayloadConfig_OneofMarshaler, _PayloadConfig_OneofUnmarshaler, _PayloadConfig_OneofSizer, []interface{}{\n\t\t(*PayloadConfig_BytebufParams)(nil),\n\t\t(*PayloadConfig_SimpleParams)(nil),\n\t\t(*PayloadConfig_ComplexParams)(nil),\n\t}\n}", "title": "" }, { "docid": "62c2d66fcd58bd2761c79073a86a7a00", "score": "0.88238925", "text": "func (*PayloadConfig) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PayloadConfig_OneofMarshaler, _PayloadConfig_OneofUnmarshaler, _PayloadConfig_OneofSizer, []interface{}{\n\t\t(*PayloadConfig_BytebufParams)(nil),\n\t\t(*PayloadConfig_SimpleParams)(nil),\n\t\t(*PayloadConfig_ComplexParams)(nil),\n\t}\n}", "title": "" }, { "docid": "f19e69fee95528b67f895aae1ccc8365", "score": "0.88232565", "text": "func (*RawcCbKeyHandle) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _RawcCbKeyHandle_OneofMarshaler, _RawcCbKeyHandle_OneofUnmarshaler, _RawcCbKeyHandle_OneofSizer, []interface{}{\n\t\t(*RawcCbKeyHandle_RawccbId)(nil),\n\t\t(*RawcCbKeyHandle_RawccbHandle)(nil),\n\t}\n}", "title": "" }, { "docid": "d313d303a862499896422e8681fd7ea4", "score": "0.88222396", "text": "func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Event_OneofMarshaler, _Event_OneofUnmarshaler, _Event_OneofSizer, []interface{}{\n\t\t(*Event_Register)(nil),\n\t\t(*Event_Block)(nil),\n\t\t(*Event_ChaincodeEvent)(nil),\n\t\t(*Event_Rejection)(nil),\n\t\t(*Event_Unregister)(nil),\n\t\t(*Event_FilteredBlock)(nil),\n\t}\n}", "title": "" }, { "docid": "3fb3fc4e099f55c79437832feb161821", "score": "0.88218105", "text": "func (*TypedValue) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TypedValue_OneofMarshaler, _TypedValue_OneofUnmarshaler, _TypedValue_OneofSizer, []interface{}{\n\t\t(*TypedValue_LeaflistDoubleValue)(nil),\n\t\t(*TypedValue_LeaflistIntValue)(nil),\n\t\t(*TypedValue_LeaflistUintValue)(nil),\n\t\t(*TypedValue_LeaflistSintValue)(nil),\n\t\t(*TypedValue_LeaflistBoolValue)(nil),\n\t\t(*TypedValue_LeaflistStrValue)(nil),\n\t\t(*TypedValue_LeaflistBytesValue)(nil),\n\t\t(*TypedValue_LeaflistFloatValue)(nil),\n\t}\n}", "title": "" }, { "docid": "786f8f35fe761d164d660b13ac93f529", "score": "0.8819888", "text": "func (*IpsecCbKeyHandle) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _IpsecCbKeyHandle_OneofMarshaler, _IpsecCbKeyHandle_OneofUnmarshaler, _IpsecCbKeyHandle_OneofSizer, []interface{}{\n\t\t(*IpsecCbKeyHandle_IpseccbId)(nil),\n\t\t(*IpsecCbKeyHandle_IpseccbHandle)(nil),\n\t}\n}", "title": "" }, { "docid": "c6c376e10071dcdbbc3bbd5c27fb5d35", "score": "0.88195014", "text": "func (*AnotherTestMessage) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _AnotherTestMessage_OneofMarshaler, _AnotherTestMessage_OneofUnmarshaler, _AnotherTestMessage_OneofSizer, []interface{}{\n\t\t(*AnotherTestMessage_Str)(nil),\n\t\t(*AnotherTestMessage_Int)(nil),\n\t}\n}", "title": "" }, { "docid": "498ef6fcd97b5940b63d9748f9e83bbc", "score": "0.881881", "text": "func (*PolicyUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PolicyUpdateRequest_OneofMarshaler, _PolicyUpdateRequest_OneofUnmarshaler, _PolicyUpdateRequest_OneofSizer, []interface{}{\n\t\t(*PolicyUpdateRequest_Global)(nil),\n\t\t(*PolicyUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "498ef6fcd97b5940b63d9748f9e83bbc", "score": "0.881881", "text": "func (*PolicyUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PolicyUpdateRequest_OneofMarshaler, _PolicyUpdateRequest_OneofUnmarshaler, _PolicyUpdateRequest_OneofSizer, []interface{}{\n\t\t(*PolicyUpdateRequest_Global)(nil),\n\t\t(*PolicyUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "498ef6fcd97b5940b63d9748f9e83bbc", "score": "0.881881", "text": "func (*PolicyUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PolicyUpdateRequest_OneofMarshaler, _PolicyUpdateRequest_OneofUnmarshaler, _PolicyUpdateRequest_OneofSizer, []interface{}{\n\t\t(*PolicyUpdateRequest_Global)(nil),\n\t\t(*PolicyUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "498ef6fcd97b5940b63d9748f9e83bbc", "score": "0.881881", "text": "func (*PolicyUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PolicyUpdateRequest_OneofMarshaler, _PolicyUpdateRequest_OneofUnmarshaler, _PolicyUpdateRequest_OneofSizer, []interface{}{\n\t\t(*PolicyUpdateRequest_Global)(nil),\n\t\t(*PolicyUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "498ef6fcd97b5940b63d9748f9e83bbc", "score": "0.881881", "text": "func (*PolicyUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PolicyUpdateRequest_OneofMarshaler, _PolicyUpdateRequest_OneofUnmarshaler, _PolicyUpdateRequest_OneofSizer, []interface{}{\n\t\t(*PolicyUpdateRequest_Global)(nil),\n\t\t(*PolicyUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "498ef6fcd97b5940b63d9748f9e83bbc", "score": "0.881881", "text": "func (*PolicyUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PolicyUpdateRequest_OneofMarshaler, _PolicyUpdateRequest_OneofUnmarshaler, _PolicyUpdateRequest_OneofSizer, []interface{}{\n\t\t(*PolicyUpdateRequest_Global)(nil),\n\t\t(*PolicyUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "498ef6fcd97b5940b63d9748f9e83bbc", "score": "0.881881", "text": "func (*PolicyUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PolicyUpdateRequest_OneofMarshaler, _PolicyUpdateRequest_OneofUnmarshaler, _PolicyUpdateRequest_OneofSizer, []interface{}{\n\t\t(*PolicyUpdateRequest_Global)(nil),\n\t\t(*PolicyUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "498ef6fcd97b5940b63d9748f9e83bbc", "score": "0.881881", "text": "func (*PolicyUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PolicyUpdateRequest_OneofMarshaler, _PolicyUpdateRequest_OneofUnmarshaler, _PolicyUpdateRequest_OneofSizer, []interface{}{\n\t\t(*PolicyUpdateRequest_Global)(nil),\n\t\t(*PolicyUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "3ad0898f5844ee199d54e9319c7fe50a", "score": "0.8817036", "text": "func (*BroadCastData) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _BroadCastData_OneofMarshaler, _BroadCastData_OneofUnmarshaler, _BroadCastData_OneofSizer, []interface{}{\n\t\t(*BroadCastData_Tx)(nil),\n\t\t(*BroadCastData_Block)(nil),\n\t\t(*BroadCastData_Ping)(nil),\n\t\t(*BroadCastData_Version)(nil),\n\t\t(*BroadCastData_LtTx)(nil),\n\t\t(*BroadCastData_LtBlock)(nil),\n\t\t(*BroadCastData_Query)(nil),\n\t\t(*BroadCastData_BlockRep)(nil),\n\t}\n}", "title": "" }, { "docid": "006a7c2748060f5593d47543ef982644", "score": "0.8815504", "text": "func (*Source) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Source_OneofMarshaler, _Source_OneofUnmarshaler, _Source_OneofSizer, []interface{}{\n\t\t(*Source_Nfs)(nil),\n\t}\n}", "title": "" }, { "docid": "bc45130b680867cd23eccbb681a4b5d9", "score": "0.88130814", "text": "func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Event_OneofMarshaler, _Event_OneofUnmarshaler, _Event_OneofSizer, []interface{}{\n\t\t(*Event_ExecutionEvent)(nil),\n\t\t(*Event_TendermintEventJSON)(nil),\n\t}\n}", "title": "" }, { "docid": "4b71aa6c807ade344161b4f2c678588a", "score": "0.8811614", "text": "func (*Message) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Message_OneofMarshaler, _Message_OneofUnmarshaler, _Message_OneofSizer, []interface{}{\n\t\t(*Message_MessageEmpty)(nil),\n\t\t(*Message_Message)(nil),\n\t\t(*Message_MessageService)(nil),\n\t}\n}", "title": "" }, { "docid": "151c01878049c7963466d20629ee69df", "score": "0.88116044", "text": "func (*SLInterfaceNotif) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _SLInterfaceNotif_OneofMarshaler, _SLInterfaceNotif_OneofUnmarshaler, _SLInterfaceNotif_OneofSizer, []interface{}{\n\t\t(*SLInterfaceNotif_ErrStatus)(nil),\n\t\t(*SLInterfaceNotif_Info)(nil),\n\t}\n}", "title": "" }, { "docid": "8a9222455ac9bf76ad1c5c3b50c3f5a8", "score": "0.88106006", "text": "func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Event_OneofMarshaler, _Event_OneofUnmarshaler, _Event_OneofSizer, []interface{}{\n\t\t(*Event_Register)(nil),\n\t\t(*Event_Block)(nil),\n\t\t(*Event_ChaincodeEvent)(nil),\n\t\t(*Event_Rejection)(nil),\n\t\t(*Event_Unregister)(nil),\n\t}\n}", "title": "" }, { "docid": "8a9222455ac9bf76ad1c5c3b50c3f5a8", "score": "0.88106006", "text": "func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Event_OneofMarshaler, _Event_OneofUnmarshaler, _Event_OneofSizer, []interface{}{\n\t\t(*Event_Register)(nil),\n\t\t(*Event_Block)(nil),\n\t\t(*Event_ChaincodeEvent)(nil),\n\t\t(*Event_Rejection)(nil),\n\t\t(*Event_Unregister)(nil),\n\t}\n}", "title": "" }, { "docid": "e6be48a027306025656d58596f4a87a0", "score": "0.88096297", "text": "func (*Virtual) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Virtual_OneofMarshaler, _Virtual_OneofUnmarshaler, _Virtual_OneofSizer, []interface{}{\n\t\t(*Virtual_Genesis)(nil),\n\t\t(*Virtual_Child)(nil),\n\t\t(*Virtual_Jet)(nil),\n\t\t(*Virtual_Request)(nil),\n\t\t(*Virtual_Result)(nil),\n\t\t(*Virtual_Type)(nil),\n\t\t(*Virtual_Code)(nil),\n\t\t(*Virtual_Activate)(nil),\n\t\t(*Virtual_Amend)(nil),\n\t\t(*Virtual_Deactivate)(nil),\n\t}\n}", "title": "" }, { "docid": "032bdc3052926055dd014790b8641845", "score": "0.8807839", "text": "func (*StateKey) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _StateKey_OneofMarshaler, _StateKey_OneofUnmarshaler, _StateKey_OneofSizer, []interface{}{\n\t\t(*StateKey_Runner_)(nil),\n\t\t(*StateKey_MultimapSideInput_)(nil),\n\t\t(*StateKey_BagUserState_)(nil),\n\t}\n}", "title": "" }, { "docid": "efd20cbe0828367d6868e85d992e16aa", "score": "0.8807353", "text": "func (*GossipMsg_Update) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _GossipMsg_Update_OneofMarshaler, _GossipMsg_Update_OneofUnmarshaler, _GossipMsg_Update_OneofSizer, []interface{}{\n\t\t(*GossipMsg_Update_Txs)(nil),\n\t\t(*GossipMsg_Update_State)(nil),\n\t\t(*GossipMsg_Update_TxBlock)(nil),\n\t}\n}", "title": "" }, { "docid": "5868d1e3441eeef65be973d2bbddcadf", "score": "0.88068885", "text": "func (*Data) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Data_OneofMarshaler, _Data_OneofUnmarshaler, _Data_OneofSizer, []interface{}{\n\t\t(*Data_Raw)(nil),\n\t\t(*Data_Final)(nil),\n\t}\n}", "title": "" }, { "docid": "6fb55b1ee93b66dd8b6e39e058d3d05f", "score": "0.88032615", "text": "func (*ReceivedNotifyMessage) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ReceivedNotifyMessage_OneofMarshaler, _ReceivedNotifyMessage_OneofUnmarshaler, _ReceivedNotifyMessage_OneofSizer, []interface{}{\n\t\t(*ReceivedNotifyMessage_ReceivedNotifyMessage)(nil),\n\t}\n}", "title": "" }, { "docid": "61cf73183dd6a259c4c51e440c300948", "score": "0.880323", "text": "func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Event_OneofMarshaler, _Event_OneofUnmarshaler, _Event_OneofSizer, []interface{}{\n\t\t(*Event_Error)(nil),\n\t\t(*Event_Progress)(nil),\n\t\t(*Event_Match)(nil),\n\t\t(*Event_Pagination)(nil),\n\t}\n}", "title": "" }, { "docid": "653394b51554a99776c3519e29051e8d", "score": "0.880321", "text": "func (*Wrapper) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Wrapper_OneofMarshaler, _Wrapper_OneofUnmarshaler, _Wrapper_OneofSizer, []interface{}{\n\t\t(*Wrapper_Message)(nil),\n\t\t(*Wrapper_Request)(nil),\n\t\t(*Wrapper_Response)(nil),\n\t}\n}", "title": "" }, { "docid": "39e5401b3e0ce34ba6055a7de4688a94", "score": "0.8803057", "text": "func (*ThriftFilter) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ThriftFilter_OneofMarshaler, _ThriftFilter_OneofUnmarshaler, _ThriftFilter_OneofSizer, []interface{}{\n\t\t(*ThriftFilter_Config)(nil),\n\t\t(*ThriftFilter_TypedConfig)(nil),\n\t}\n}", "title": "" }, { "docid": "18007789777f023bd3f2d0136e5b4c09", "score": "0.88025266", "text": "func (*Help_AppUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Help_AppUpdate_OneofMarshaler, _Help_AppUpdate_OneofUnmarshaler, _Help_AppUpdate_OneofSizer, []interface{}{\n\t\t(*Help_AppUpdate_HelpAppUpdate)(nil),\n\t\t(*Help_AppUpdate_HelpNoAppUpdate)(nil),\n\t}\n}", "title": "" }, { "docid": "541403ccbbce1ec3f538ecc6639e743a", "score": "0.88021845", "text": "func (*Event_Meta) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Event_Meta_OneofMarshaler, _Event_Meta_OneofUnmarshaler, _Event_Meta_OneofSizer, []interface{}{\n\t\t(*Event_Meta_Confidence_)(nil),\n\t}\n}", "title": "" }, { "docid": "ce8301a8684bf5c5dd9238a2e4932fb5", "score": "0.8801571", "text": "func (*FetchRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _FetchRequest_OneofMarshaler, _FetchRequest_OneofUnmarshaler, _FetchRequest_OneofSizer, []interface{}{\n\t\t(*FetchRequest_TagMatchers)(nil),\n\t}\n}", "title": "" }, { "docid": "3019eca637431573ddfc775ec732bb86", "score": "0.8799516", "text": "func (*RawWriteRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _RawWriteRequest_OneofMarshaler, _RawWriteRequest_OneofUnmarshaler, _RawWriteRequest_OneofSizer, []interface{}{\n\t\t(*RawWriteRequest_Meta)(nil),\n\t\t(*RawWriteRequest_Batch)(nil),\n\t}\n}", "title": "" }, { "docid": "a94c4a3a07ba238347409591062d5a8f", "score": "0.87989146", "text": "func (*DocumentAttribute) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _DocumentAttribute_OneofMarshaler, _DocumentAttribute_OneofUnmarshaler, _DocumentAttribute_OneofSizer, []interface{}{\n\t\t(*DocumentAttribute_DocumentAttributeImageSize)(nil),\n\t\t(*DocumentAttribute_DocumentAttributeAnimated)(nil),\n\t\t(*DocumentAttribute_DocumentAttributeSticker)(nil),\n\t\t(*DocumentAttribute_DocumentAttributeVideo)(nil),\n\t\t(*DocumentAttribute_DocumentAttributeAudio)(nil),\n\t\t(*DocumentAttribute_DocumentAttributeFilename)(nil),\n\t\t(*DocumentAttribute_DocumentAttributeHasStickers)(nil),\n\t}\n}", "title": "" }, { "docid": "57b289b80cac31e1eecea9bacc98faaf", "score": "0.8797861", "text": "func (*FieldData) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _FieldData_OneofMarshaler, _FieldData_OneofUnmarshaler, _FieldData_OneofSizer, []interface{}{\n\t\t(*FieldData_ValueBin)(nil),\n\t\t(*FieldData_ValueInt)(nil),\n\t}\n}", "title": "" }, { "docid": "02dc21121840776e63aa67162c0187b6", "score": "0.8797488", "text": "func (*EventMessage) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _EventMessage_OneofMarshaler, _EventMessage_OneofUnmarshaler, _EventMessage_OneofSizer, []interface{}{\n\t\t(*EventMessage_Submitted)(nil),\n\t\t(*EventMessage_Queued)(nil),\n\t\t(*EventMessage_Leased)(nil),\n\t\t(*EventMessage_LeaseExpired)(nil),\n\t\t(*EventMessage_Pending)(nil),\n\t\t(*EventMessage_Running)(nil),\n\t\t(*EventMessage_UnableToSchedule)(nil),\n\t\t(*EventMessage_Failed)(nil),\n\t\t(*EventMessage_Succeeded)(nil),\n\t\t(*EventMessage_Reprioritized)(nil),\n\t\t(*EventMessage_Cancelling)(nil),\n\t\t(*EventMessage_Cancelled)(nil),\n\t\t(*EventMessage_Terminated)(nil),\n\t}\n}", "title": "" }, { "docid": "153faf3ce1240345b83c76156debdad9", "score": "0.87974304", "text": "func (*CdnFileHash) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _CdnFileHash_OneofMarshaler, _CdnFileHash_OneofUnmarshaler, _CdnFileHash_OneofSizer, []interface{}{\n\t\t(*CdnFileHash_CdnFileHash)(nil),\n\t}\n}", "title": "" }, { "docid": "c1dcb6996e18f98d1348edfe39713d4d", "score": "0.87972635", "text": "func (*StateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _StateRequest_OneofMarshaler, _StateRequest_OneofUnmarshaler, _StateRequest_OneofSizer, []interface{}{\n\t\t(*StateRequest_Get)(nil),\n\t\t(*StateRequest_Append)(nil),\n\t\t(*StateRequest_Clear)(nil),\n\t}\n}", "title": "" } ]
7054f11eeccd88eaea7ee682af3538ef
SetSchoolNumber sets the schoolNumber property value. School Number.
[ { "docid": "6446f3c5545a06a886994ced503b5b83", "score": "0.8111977", "text": "func (m *EducationSchool) SetSchoolNumber(value *string)() {\n m.schoolNumber = value\n}", "title": "" } ]
[ { "docid": "734e7d0ba6b81849505bf60f74ca5990", "score": "0.5904451", "text": "func (m *EducationSchool) GetSchoolNumber()(*string) {\n return m.schoolNumber\n}", "title": "" }, { "docid": "34bd3f664cdb70d757d070a26a22ecbd", "score": "0.5610049", "text": "func (m *StudentMutation) SetSchoolname(s string) {\n\tm.schoolname = &s\n}", "title": "" }, { "docid": "5d1582418339581c2e2850266d4223c4", "score": "0.51436603", "text": "func (m *BranchMutation) SetStreetNumber(s string) {\n\tm.streetNumber = &s\n}", "title": "" }, { "docid": "ea8ac6f6c4d802f9f0965d03a05771ea", "score": "0.511093", "text": "func (b *Build) SetNumber(v int) {\n\t// return if Build type is nil\n\tif b == nil {\n\t\treturn\n\t}\n\n\tb.Number = &v\n}", "title": "" }, { "docid": "3881b9064fe6875a1e44d7562e287989", "score": "0.5109613", "text": "func (i *LDAP) UpdateEducationSchool(ctx context.Context, numberOrID string, school libregraph.EducationSchool) (*libregraph.EducationSchool, error) {\n\tlogger := i.logger.SubloggerWithRequestID(ctx)\n\tlogger.Debug().Str(\"backend\", \"ldap\").Msg(\"UpdateEducationSchool\")\n\tif !i.writeEnabled {\n\t\treturn nil, ErrReadOnly\n\t}\n\n\te, err := i.getSchoolByNumberOrID(numberOrID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcurrentSchool := i.createSchoolModelFromLDAP(e)\n\tswitch i.UpdateEducationSchoolOperation(school, *currentSchool) {\n\tcase tooManyValues:\n\t\treturn nil, fmt.Errorf(\"school name and school number cannot be updated in the same request\")\n\tcase schoolUnchanged:\n\t\tlogger.Debug().Str(\"backend\", \"ldap\").Msg(\"UpdateEducationSchool: Nothing changed\")\n\t\treturn currentSchool, nil\n\tcase schoolRenamed:\n\t\tif err := i.updateDisplayName(ctx, e.DN, school.GetDisplayName()); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase schoolPropertiesUpdated:\n\t\tif err := i.updateSchoolProperties(ctx, e.DN, *currentSchool, school); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Read\tback school from LDAP\n\te, err = i.getSchoolByNumberOrID(i.getID(e))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn i.createSchoolModelFromLDAP(e), nil\n}", "title": "" }, { "docid": "d90fe27b178f1cf3b2c0651f713252b4", "score": "0.50902706", "text": "func (m *RoutingNumberMutation) SetNumber(s string) {\n\tm.number = &s\n}", "title": "" }, { "docid": "f778ab55c0cad06e8f8c01319ca13c9a", "score": "0.50756663", "text": "func (o *BankingInformationDto) SetRoutingNumber(v string) {\n\to.RoutingNumber = &v\n}", "title": "" }, { "docid": "137bfb5dfa2400e2a19d60f4140a1a07", "score": "0.50545627", "text": "func (i *LDAP) updateSchoolProperties(ctx context.Context, dn string, currentSchool, updatedSchool libregraph.EducationSchool) error {\n\tlogger := i.logger.SubloggerWithRequestID(ctx)\n\n\tmr := ldap.NewModifyRequest(dn, nil)\n\tif updatedSchoolNumber, ok := updatedSchool.GetSchoolNumberOk(); ok {\n\t\tif *updatedSchoolNumber != \"\" && currentSchool.GetSchoolNumber() != *updatedSchoolNumber {\n\t\t\t_, err := i.getSchoolByNumberOrID(*updatedSchoolNumber)\n\t\t\tif err == nil {\n\t\t\t\terrmsg := fmt.Sprintf(\"school number '%s' already exists\", *updatedSchoolNumber)\n\t\t\t\terr = fmt.Errorf(errmsg)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tmr.Replace(i.educationConfig.schoolAttributeMap.schoolNumber, []string{*updatedSchoolNumber})\n\t\t}\n\t}\n\n\tif updatedTerminationDate, ok := updatedSchool.GetTerminationDateOk(); ok {\n\t\tif updatedTerminationDate == nil && currentSchool.HasTerminationDate() {\n\t\t\t// Delete the termination date\n\t\t\tmr.Delete(i.educationConfig.schoolAttributeMap.terminationDate, []string{})\n\t\t}\n\t\tif updatedTerminationDate != nil && *updatedTerminationDate != currentSchool.GetTerminationDate() {\n\t\t\tldapDateTime := updatedTerminationDate.UTC().Format(ldapDateFormat)\n\t\t\tmr.Replace(i.educationConfig.schoolAttributeMap.terminationDate, []string{ldapDateTime})\n\t\t}\n\t}\n\n\tif err := i.conn.Modify(mr); err != nil {\n\t\tvar lerr *ldap.Error\n\t\tlogger.Debug().Err(err).Msg(\"error updating school number\")\n\t\tif errors.As(err, &lerr) {\n\t\t\tif lerr.ResultCode == ldap.LDAPResultEntryAlreadyExists {\n\t\t\t\terr = errorcode.New(errorcode.NameAlreadyExists, lerr.Error())\n\t\t\t}\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "14b178dbdc354951f5be0d4a9daf5987", "score": "0.5021009", "text": "func (bc *BranchCreate) SetStreetNumber(s string) *BranchCreate {\n\tbc.mutation.SetStreetNumber(s)\n\treturn bc\n}", "title": "" }, { "docid": "9b83f8f095de7848bdae7db5fd612244", "score": "0.49748382", "text": "func (o *ProjectSearchParams) SetNumber(number *string) {\n\to.Number = number\n}", "title": "" }, { "docid": "361e8b578b42904108bcfd7594a85298", "score": "0.4949901", "text": "func (s *spiConfig) SetBusNumber(bus int) {\n\ts.bus = bus\n}", "title": "" }, { "docid": "6bc601dfbd9aa992777544ce518cf1b9", "score": "0.49324137", "text": "func School(name string) int {\n\tname = strings.ToLower(name)\n\t// 0 is considered none and so whatewer is inputted that is not contained in map will be none\n\treturn map[string]int{\n\t\t\"elementary-middle\": 1,\n\t\t\"high\": 2,\n\t\t\"university\": 3,\n\t}[name]\n}", "title": "" }, { "docid": "ea2c041c2359f0ba0bb7cc24f9d24ebe", "score": "0.48869616", "text": "func (m *AccountMutation) SetNumber(s string) {\n\tm.number = &s\n}", "title": "" }, { "docid": "fd71f6ab1021bed475df2ec21aa1ef8e", "score": "0.48223275", "text": "func (o *BankTransferUser) SetRoutingNumber(v string) {\n\to.RoutingNumber = &v\n}", "title": "" }, { "docid": "d0c0e386830f11591dd91c397d669cfb", "score": "0.47956455", "text": "func (obj *PDFobj) SetNumber(number int) {\n\tobj.number = number\n}", "title": "" }, { "docid": "91ce3ba468e638c6660848ee0ace998d", "score": "0.47708577", "text": "func (o *LedgerVoucherSendToLedgerSendToLedgerParams) SetNumber(number *int32) {\n\to.Number = number\n}", "title": "" }, { "docid": "46de3a7ecf70f7fa18afa7eb86fa5ab3", "score": "0.47559485", "text": "func (o *BankTransferMigrateAccountRequest) SetRoutingNumber(v string) {\n\to.RoutingNumber = v\n}", "title": "" }, { "docid": "d6ea7b9efc6623e837c1b970dece0c7f", "score": "0.47241086", "text": "func (m *CardMutation) SetNumber(s string) {\n\tm.number = &s\n}", "title": "" }, { "docid": "d6ea7b9efc6623e837c1b970dece0c7f", "score": "0.47241086", "text": "func (m *CardMutation) SetNumber(s string) {\n\tm.number = &s\n}", "title": "" }, { "docid": "41a0320b7594e53d3bea1bd5510ca5b7", "score": "0.4700471", "text": "func (s *CreateTrafficMirrorFilterRuleInput) SetRuleNumber(v int64) *CreateTrafficMirrorFilterRuleInput {\n\ts.RuleNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "80cfd3b8bda760228e66ed975e65c996", "score": "0.46969742", "text": "func (s *Network) SetASNumber(v int64) *Network {\n\ts.ASNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "aa498d6a8254520f193bb7a340c5ba9b", "score": "0.4693892", "text": "func (s *ModifyTrafficMirrorFilterRuleInput) SetRuleNumber(v int64) *ModifyTrafficMirrorFilterRuleInput {\n\ts.RuleNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "f8fd959bfbbc8f0300fd5cbd77fcf1b9", "score": "0.4690083", "text": "func (o *PutLedgerVoucherIDSendToLedgerParams) SetNumber(number *int32) {\n\to.Number = number\n}", "title": "" }, { "docid": "e088885c2e7cfe25da45a058684ef2a1", "score": "0.46691403", "text": "func (su *SalaryUpdate) SetAccountNumber(s string) *SalaryUpdate {\n\tsu.mutation.SetAccountNumber(s)\n\treturn su\n}", "title": "" }, { "docid": "7d9b697f28ec189d9188134330220d61", "score": "0.46640512", "text": "func (s *TrafficMirrorFilterRule) SetRuleNumber(v int64) *TrafficMirrorFilterRule {\n\ts.RuleNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "5d8b330544119a7869c89c411441f84c", "score": "0.46609455", "text": "func (h *Hook) SetNumber(v int) {\n\t// return if Hook type is nil\n\tif h == nil {\n\t\treturn\n\t}\n\n\th.Number = &v\n}", "title": "" }, { "docid": "7f97f091dcd1285fe09998abc1b7d2e2", "score": "0.46505582", "text": "func (u RatingUpdater) SetRatingNumber(ratingNumber int64) RatingUpdater {\n\tu.fields[string(RatingDBSchema.RatingNumber)] = ratingNumber\n\treturn u\n}", "title": "" }, { "docid": "893c37dfedf6e63969556814c7cc6ea1", "score": "0.4631901", "text": "func (cuo *CardUpdateOne) SetNumber(s string) *CardUpdateOne {\n\tcuo.number = &s\n\treturn cuo\n}", "title": "" }, { "docid": "b13b94155e44bea0326714cc0b874f27", "score": "0.4611232", "text": "func (o *EntityDocument) SetNumber(v string) {\n\to.Number = v\n}", "title": "" }, { "docid": "db2886735e9632fdc46bd2e1e9717131", "score": "0.46087447", "text": "func (s *ImpactedLocation) SetASNumber(v int64) *ImpactedLocation {\n\ts.ASNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "755e1e461e3a96e858470469d1738f7a", "score": "0.45816916", "text": "func (cu *CardUpdate) SetNumber(s string) *CardUpdate {\n\tcu.number = &s\n\treturn cu\n}", "title": "" }, { "docid": "523a39c4295cb3d260621a52c8108e68", "score": "0.45664597", "text": "func (suo *SalaryUpdateOne) SetAccountNumber(s string) *SalaryUpdateOne {\n\tsuo.mutation.SetAccountNumber(s)\n\treturn suo\n}", "title": "" }, { "docid": "4dd921a04eec301c938422d64812fb5e", "score": "0.45652235", "text": "func (i *LDAP) CreateEducationSchool(ctx context.Context, school libregraph.EducationSchool) (*libregraph.EducationSchool, error) {\n\tlogger := i.logger.SubloggerWithRequestID(ctx)\n\tlogger.Debug().Str(\"backend\", \"ldap\").Msg(\"CreateEducationSchool\")\n\tif !i.writeEnabled {\n\t\treturn nil, ErrReadOnly\n\t}\n\n\t// Here we should verify that the school number is not already used\n\n\tattributeTypeAndValue := ldap.AttributeTypeAndValue{\n\t\tType: i.educationConfig.schoolAttributeMap.displayName,\n\t\tValue: school.GetDisplayName(),\n\t}\n\n\tdn := fmt.Sprintf(\"%s,%s\",\n\t\tattributeTypeAndValue.String(),\n\t\ti.educationConfig.schoolBaseDN,\n\t)\n\tar := ldap.NewAddRequest(dn, nil)\n\tar.Attribute(i.educationConfig.schoolAttributeMap.displayName, []string{school.GetDisplayName()})\n\tar.Attribute(i.educationConfig.schoolAttributeMap.schoolNumber, []string{school.GetSchoolNumber()})\n\tif !i.useServerUUID {\n\t\tar.Attribute(i.educationConfig.schoolAttributeMap.id, []string{uuid.Must(uuid.NewV4()).String()})\n\t}\n\tobjectClasses := []string{\"organizationalUnit\", i.educationConfig.schoolObjectClass, \"top\"}\n\tar.Attribute(\"objectClass\", objectClasses)\n\n\tif err := i.conn.Add(ar); err != nil {\n\t\tvar lerr *ldap.Error\n\t\tlogger.Debug().Err(err).Msg(\"error adding school\")\n\t\tif errors.As(err, &lerr) {\n\t\t\tif lerr.ResultCode == ldap.LDAPResultEntryAlreadyExists {\n\t\t\t\terr = errorcode.New(errorcode.NameAlreadyExists, lerr.Error())\n\t\t\t}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\t// Read\tback school from LDAP to get the generated UUID\n\te, err := i.getSchoolByDN(ar.DN)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn i.createSchoolModelFromLDAP(e), nil\n}", "title": "" }, { "docid": "a2eb71df0f5b143dfc34338f07263349", "score": "0.45561683", "text": "func (s *DeleteNetworkAclEntryInput) SetRuleNumber(v int64) *DeleteNetworkAclEntryInput {\n\ts.RuleNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "9c9157861b4664f6e3bda3e05f72c994", "score": "0.4538557", "text": "func (s *AnalysisAclRule) SetRuleNumber(v int64) *AnalysisAclRule {\n\ts.RuleNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "401e884615dda33811c2e86beef3a00a", "score": "0.45296496", "text": "func (s *ReplaceNetworkAclEntryInput) SetRuleNumber(v int64) *ReplaceNetworkAclEntryInput {\n\ts.RuleNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "5f12ca0bb98b4a284009b93df470da47", "score": "0.4525331", "text": "func (o *PostPatchPanelPortsPatchPanelIDParams) SetNumber(number string) {\n\to.Number = number\n}", "title": "" }, { "docid": "d6d286cbba6b2d1902bf4e4551c30245", "score": "0.45235848", "text": "func (o *BankTransferMigrateAccountRequest) SetWireRoutingNumber(v string) {\n\to.WireRoutingNumber = &v\n}", "title": "" }, { "docid": "62b73a08a720811b01a788dbda4a9df3", "score": "0.4504874", "text": "func (o *ActivitySearchParams) SetNumber(number *string) {\n\to.Number = number\n}", "title": "" }, { "docid": "09a291868cb97e96cd6f2b1f89e6cbc5", "score": "0.4500167", "text": "func (s *spiConfig) SetChipNumber(chip int) {\n\ts.chip = chip\n}", "title": "" }, { "docid": "bdfacaf6e0f72f9b869862ded9889652", "score": "0.44950593", "text": "func (s *CreateNetworkAclEntryInput) SetRuleNumber(v int64) *CreateNetworkAclEntryInput {\n\ts.RuleNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "d11fad1b7d688792e04e5e8d641398f8", "score": "0.44921345", "text": "func AddSchool(c *gin.Context) {\n\tdb, ok := c.Keys[\"db\"].(*gorm.DB) // Get database variable from context\n\tif !ok {\n\t\tc.JSON(500, gin.H{\"error\": \"internal error\"})\n\t\tpanic(\"no database variable in context\")\n\t}\n\n\tuser, ok := c.Keys[\"usr\"].(*m.User) // Get the user to whom the school belongs\n\tif !ok {\n\t\tc.JSON(500, gin.H{\"error\": \"internal error\"})\n\t\tpanic(\"no user variable in context\")\n\t}\n\n\tif !user.Has(m.Headmaster) { // Teachers and students cant add schools\n\t\tc.JSON(403, gin.H{\"error\": \"insufficient permissions\"})\n\t\treturn\n\t}\n\n\tnewSchool := new(m.NewSchool) // Placeholder\n\terr := json.NewDecoder(c.Request.Body).Decode(newSchool)\n\tif err != nil {\n\t\tc.JSON(400, gin.H{\"error\": \"invalid data\"})\n\t\treturn\n\t}\n\n\tcode, resp := newSchool.Add(db, user) // Call function\n\tc.JSON(code, resp)\n}", "title": "" }, { "docid": "6f04f929ae44bcd8ee07c66323eea8df", "score": "0.44857043", "text": "func (o *InlineObject879) SetNumber(v AnyOfobject) {\n\to.Number = &v\n}", "title": "" }, { "docid": "df9a4888c2d8c06739d33aa9e67c7c4f", "score": "0.447616", "text": "func (s *NetworkAclEntry) SetRuleNumber(v int64) *NetworkAclEntry {\n\ts.RuleNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "66a4ae07c050971d351872c1cb4440e3", "score": "0.4461389", "text": "func (r *RSAKey) SetKeyNumber(number int) {\n\tr.keyName.KeyNumber = number\n}", "title": "" }, { "docid": "ec05cac5d2f61db53c6e7ab8c6c7349a", "score": "0.44532087", "text": "func (m *StudentMutation) ResetSchoolname() {\n\tm.schoolname = nil\n}", "title": "" }, { "docid": "9d138795a3e540da9813d58f1fab3a57", "score": "0.445155", "text": "func (o *WatchlistScreeningRequestSearchTerms) SetDocumentNumber(v string) {\n\to.DocumentNumber = &v\n}", "title": "" }, { "docid": "6bbd66ebdd1ab831b94d0375c5b946d5", "score": "0.44372895", "text": "func (_RandomNumber *RandomNumberTransactor) SetRandomNumber(opts *bind.TransactOpts, _randomNumber *big.Int) (*types.Transaction, error) {\n\treturn _RandomNumber.contract.Transact(opts, \"setRandomNumber\", _randomNumber)\n}", "title": "" }, { "docid": "af6f522ed15d9636b5b1dd52a7d803ab", "score": "0.44308704", "text": "func (m *SalesInvoice) SetNumber(value *string)() {\n err := m.GetBackingStore().Set(\"number\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e2da86b58f09abe08474a485dc6f31e1", "score": "0.44277036", "text": "func (m *EducationClass) SetSchools(value []EducationSchoolable)() {\n err := m.GetBackingStore().Set(\"schools\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9aefc1cb5efbdac1b894f9c31a43e62c", "score": "0.44002053", "text": "func (m *inboundSmsRule) SetDedicatedNumber(val *string) {\n\tm.dedicatedNumberField = val\n}", "title": "" }, { "docid": "c5b89a066b899b30c06301fef642b267", "score": "0.4389604", "text": "func (m *GoogleCloudResourceEvidence) SetProjectNumber(value *int64)() {\n err := m.GetBackingStore().Set(\"projectNumber\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "338c82dd82b1f69abf24163bfe5b68c7", "score": "0.43759048", "text": "func (s *TransitGatewayPolicyTableEntry) SetPolicyRuleNumber(v string) *TransitGatewayPolicyTableEntry {\n\ts.PolicyRuleNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "e0eeaa23a38f64b70008aef121cd2d28", "score": "0.43684223", "text": "func (o *TaxInformationCreateUpdate) SetDocumentNumber(v string) {\n\to.DocumentNumber = v\n}", "title": "" }, { "docid": "e43e9b09fc28d2fd46f863abec6d4288", "score": "0.4342477", "text": "func DeleteSchool(c *gin.Context) {\n\tdb, ok := c.Keys[\"db\"].(*gorm.DB) // Database from context\n\tif !ok {\n\t\tc.JSON(500, gin.H{\"error\": \"internal error\"})\n\t\tpanic(\"no database variable in context\")\n\t}\n\n\tuser, ok := c.Keys[\"usr\"].(*m.User) // User from context\n\tif !ok {\n\t\tc.JSON(500, gin.H{\"error\": \"internal error\"})\n\t\tpanic(\"no user variable in context\")\n\t}\n\n\tif !user.Has(m.Headmaster) { // Teachers and students cant delete schools\n\t\tc.JSON(403, gin.H{\"error\": \"insufficient permissions\"})\n\t\treturn\n\t}\n\n\tdeleteSchool := new(m.DeleteSchool) // Placeholder\n\tdeleteSchool.ID = c.Query(\"id\") // Get schoold ID from query\n\n\tcode, resp := deleteSchool.Delete(db, user) // Call function\n\tc.JSON(code, resp)\n}", "title": "" }, { "docid": "366a1e236afc669fc227771eb5397744", "score": "0.43194404", "text": "func (evb *EnumValueBuilder) SetNumber(number int32) *EnumValueBuilder {\n\tevb.number = number\n\tevb.numberSet = true\n\treturn evb\n}", "title": "" }, { "docid": "b1fda495481abc474538f196b1c02234", "score": "0.42765594", "text": "func (g Graph) PostEducationSchoolClass(w http.ResponseWriter, r *http.Request) {\n\tlogger := g.logger.SubloggerWithRequestID(r.Context())\n\n\tschoolID := chi.URLParam(r, \"schoolID\")\n\tlogger.Info().Str(\"schoolID\", schoolID).Msg(\"Calling post school class\")\n\tschoolID, err := url.PathUnescape(schoolID)\n\tif err != nil {\n\t\tlogger.Debug().\n\t\t\tErr(err).\n\t\t\tStr(\"id\", schoolID).\n\t\t\tMsg(\"could not add class to school: unescaping school id failed\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"unescaping school id failed\")\n\t\treturn\n\t}\n\n\tif schoolID == \"\" {\n\t\tlogger.Debug().Msg(\"could not add school class: missing school id\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"missing school id\")\n\t\treturn\n\t}\n\tmemberRef := libregraph.NewMemberReference()\n\terr = StrictJSONUnmarshal(r.Body, memberRef)\n\tif err != nil {\n\t\tlogger.Debug().\n\t\t\tErr(err).\n\t\t\tInterface(\"body\", r.Body).\n\t\t\tMsg(\"could not add school class: invalid request body\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, fmt.Sprintf(\"invalid request body: %s\", err.Error()))\n\t\treturn\n\t}\n\tmemberRefURL, ok := memberRef.GetOdataIdOk()\n\tif !ok {\n\t\tlogger.Debug().Msg(\"could not add school class: @odata.id reference is missing\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"@odata.id reference is missing\")\n\t\treturn\n\t}\n\tmemberType, id, err := g.parseMemberRef(*memberRefURL)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Msg(\"could not add school class: error parsing @odata.id url\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"Error parsing @odata.id url\")\n\t\treturn\n\t}\n\t// The MS Graph spec allows \"directoryObject\", \"user\", \"school\" and \"organizational Contact\"\n\t// we restrict this to users for now. Might add Schools as members later\n\tif memberType != \"classes\" {\n\t\tlogger.Debug().Str(\"type\", memberType).Msg(\"could not add school class: Only classes are allowed as school members\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"Only classes are allowed as school members\")\n\t\treturn\n\t}\n\n\tlogger.Debug().Str(\"memberType\", memberType).Str(\"id\", id).Msg(\"calling add class on backend\")\n\terr = g.identityEducationBackend.AddClassesToEducationSchool(r.Context(), schoolID, []string{id})\n\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Msg(\"could not add school class: backend error\")\n\t\terrorcode.RenderError(w, r, err)\n\t\treturn\n\t}\n\n\t/* TODO requires reva changes\n\te := events.SchoolMemberAdded{SchoolID: schoolID, UserID: id}\n\tif currentUser, ok := ctxpkg.ContextGetUser(r.Context()); ok {\n\t\te.Executant = currentUser.GetId()\n\t}\n\tg.publishEvent(e)\n\t*/\n\n\trender.Status(r, http.StatusNoContent)\n\trender.NoContent(w, r)\n}", "title": "" }, { "docid": "60bd580f7a5bc7998245c124c8f70057", "score": "0.42562908", "text": "func (o *GetCustomerOrdersParams) SetNumber(number *string) {\n\to.Number = number\n}", "title": "" }, { "docid": "dabcb627b8b6c8797e8d2c6b43b82811", "score": "0.4218591", "text": "func (m *StudentMutation) Schoolname() (r string, exists bool) {\n\tv := m.schoolname\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "1557c9660eff292911a036f6182747e1", "score": "0.4213783", "text": "func (o *Workflow) SetPipelineNumber(v int64) {\n\to.PipelineNumber = v\n}", "title": "" }, { "docid": "91aaa77ad20c0bccfdaa196d6f07d247", "score": "0.42130914", "text": "func (o *HyperflexDriveAllOf) SetModelNumber(v string) {\n\to.ModelNumber = &v\n}", "title": "" }, { "docid": "9c163b5eb69e71781c670a054682d9cc", "score": "0.41859275", "text": "func (m *ItemPatent) SetNumber(value *string)() {\n err := m.GetBackingStore().Set(\"number\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0a794433cbb6510eb38725783c4a41be", "score": "0.41735435", "text": "func (el *RepeatCount) SetNumber(number RepeatCount) {\n\t*el = number\n}", "title": "" }, { "docid": "55c0568b9013375d9c6f37c5075e453c", "score": "0.41705474", "text": "func (p *PinKey) SetKeyNumber(number int) {\n\tp.keyName.KeyNumber = number\n}", "title": "" }, { "docid": "0de24093ab47585e9da2bd5274785f1b", "score": "0.4162209", "text": "func (i *LDAP) GetEducationSchoolClasses(ctx context.Context, schoolNumberOrID string) ([]*libregraph.EducationClass, error) {\n\tlogger := i.logger.SubloggerWithRequestID(ctx)\n\tlogger.Debug().Str(\"backend\", \"ldap\").Msg(\"GetEducationSchoolClasses\")\n\n\tentries, err := i.getEducationSchoolEntries(\n\t\tschoolNumberOrID, i.groupFilter, i.educationConfig.classObjectClass, i.groupBaseDN, i.groupScope, i.getEducationClassAttrTypes(false), logger,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclasses := make([]*libregraph.EducationClass, 0, len(entries))\n\n\tfor _, e := range entries {\n\t\tclass := i.createEducationClassModelFromLDAP(e)\n\t\t// Skip invalid LDAP classes\n\t\tif class == nil {\n\t\t\tcontinue\n\t\t}\n\t\tclasses = append(classes, class)\n\t}\n\treturn classes, nil\n}", "title": "" }, { "docid": "f70fe1e276525afbb02a257856f380b6", "score": "0.414885", "text": "func (i *LDAP) GetEducationSchool(ctx context.Context, numberOrID string) (*libregraph.EducationSchool, error) {\n\tlogger := i.logger.SubloggerWithRequestID(ctx)\n\tlogger.Debug().Str(\"backend\", \"ldap\").Msg(\"GetEducationSchool\")\n\te, err := i.getSchoolByNumberOrID(numberOrID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn i.createSchoolModelFromLDAP(e), nil\n}", "title": "" }, { "docid": "fd34044602db793f5691c1ab106186d2", "score": "0.41415828", "text": "func (item *SchoolItem) GetSchoolName() string {\n\treturn item.Cells[1].String()\n}", "title": "" }, { "docid": "a661952ca124dbac56ec7c6ee43b978f", "score": "0.4120218", "text": "func (m *HardwareInformation) SetOsBuildNumber(value *string)() {\n err := m.GetBackingStore().Set(\"osBuildNumber\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a5d39732838bbd52246fc390b3d55fca", "score": "0.41197693", "text": "func (m *SalesInvoice) SetExternalDocumentNumber(value *string)() {\n err := m.GetBackingStore().Set(\"externalDocumentNumber\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "09696587270ab0ad6c907ed6f0f5f3d0", "score": "0.41124672", "text": "func (o *IosLobApp) SetBuildNumber(v string) {\n\to.BuildNumber = &v\n}", "title": "" }, { "docid": "12b734223eb30c244f368ae2527007a7", "score": "0.40932795", "text": "func (m *PatientInfoMutation) SetCardNumber(s string) {\n\tm.cardNumber = &s\n}", "title": "" }, { "docid": "83608ee5f7049a25c04df8b969c63fbb", "score": "0.409109", "text": "func (g Graph) PostEducationSchool(w http.ResponseWriter, r *http.Request) {\n\tlogger := g.logger.SubloggerWithRequestID(r.Context())\n\tlogger.Info().Msg(\"calling post school\")\n\tschool := libregraph.NewEducationSchool()\n\terr := StrictJSONUnmarshal(r.Body, school)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Interface(\"body\", r.Body).Msg(\"could not create school: invalid request body\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, fmt.Sprintf(\"invalid request body: %s\", err.Error()))\n\t\treturn\n\t}\n\n\t// Disallow user-supplied IDs. It's supposed to be readonly. We're either\n\t// generating them in the backend ourselves or rely on the Backend's\n\t// storage (e.g. LDAP) to provide a unique ID.\n\tif _, ok := school.GetIdOk(); ok {\n\t\tlogger.Debug().Msg(\"could not create school: id is a read-only attribute\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"school id is a read-only attribute\")\n\t\treturn\n\t}\n\n\tif _, ok := school.GetDisplayNameOk(); !ok {\n\t\tlogger.Debug().Interface(\"school\", school).Msg(\"could not create school: missing required attribute\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"Missing Required Attribute\")\n\t\treturn\n\t}\n\n\tif _, ok := school.GetSchoolNumberOk(); !ok {\n\t\tlogger.Debug().Interface(\"school\", school).Msg(\"could not create school: missing required attribute\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"Missing Required Attribute\")\n\t\treturn\n\t}\n\n\t// validate terminationDate attribute, needs to be \"far enough\" in the future, terminationDate can be nil (means\n\t// termination date is to be deleted\n\tif terminationDate, ok := school.GetTerminationDateOk(); ok && terminationDate != nil {\n\t\terr = g.validateTerminationDate(*terminationDate)\n\t\tif err != nil {\n\t\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tif school, err = g.identityEducationBackend.CreateEducationSchool(r.Context(), *school); err != nil {\n\t\tlogger.Debug().Err(err).Interface(\"school\", school).Msg(\"could not create school: backend error\")\n\t\terrorcode.RenderError(w, r, err)\n\t\treturn\n\t}\n\n\t/* TODO requires reva changes\n\tif school != nil && school.Id != nil {\n\t\te := events.SchoolCreated{SchoolID: *school.Id}\n\t\tif currentUser, ok := ctxpkg.ContextGetUser(r.Context()); ok {\n\t\t\te.Executant = currentUser.GetId()\n\t\t}\n\t\tg.publishEvent(e)\n\t}\n\t*/\n\n\trender.Status(r, http.StatusCreated)\n\trender.JSON(w, r, school)\n}", "title": "" }, { "docid": "8abfcbe51f4d02937a5e08e4a9b0f553", "score": "0.40831035", "text": "func (_RandomNumber *RandomNumberTransactorSession) SetRandomNumber(_randomNumber *big.Int) (*types.Transaction, error) {\n\treturn _RandomNumber.Contract.SetRandomNumber(&_RandomNumber.TransactOpts, _randomNumber)\n}", "title": "" }, { "docid": "bb3387ba8fc7be75d7cbb329b038f12f", "score": "0.40791017", "text": "func (m *SalesInvoice) SetOrderNumber(value *string)() {\n err := m.GetBackingStore().Set(\"orderNumber\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "addc0896c80d79af51562faa92765034", "score": "0.40777636", "text": "func (g *getTasksFilter) SetPageNumber(number int) *getTasksFilter {\n\t(*g)[\"page[number]\"] = strconv.Itoa(number)\n\treturn g\n}", "title": "" }, { "docid": "2cc15cd8319c4d856cfd4e7ea1978374", "score": "0.40661833", "text": "func (i *LDAP) UpdateEducationSchoolOperation(\n\tschoolUpdate libregraph.EducationSchool,\n\tcurrentSchool libregraph.EducationSchool,\n) schoolUpdateOperation {\n\n\tprovidedDisplayName, displayNameIsSet := schoolUpdate.GetDisplayNameOk()\n\tif displayNameIsSet {\n\t\tif *providedDisplayName == \"\" || *providedDisplayName == currentSchool.GetDisplayName() {\n\t\t\t// The school name hasn't changed\n\t\t\tdisplayNameIsSet = false\n\t\t}\n\t}\n\n\tvar propertiesUpdated bool\n\n\tswitch {\n\tcase schoolUpdate.HasSchoolNumber():\n\t\tif schoolUpdate.GetSchoolNumber() != \"\" && schoolUpdate.GetSchoolNumber() != currentSchool.GetSchoolNumber() {\n\t\t\tpropertiesUpdated = true\n\t\t}\n\tcase schoolUpdate.HasTerminationDate():\n\t\tif schoolUpdate.GetTerminationDate() != currentSchool.GetTerminationDate() {\n\t\t\tpropertiesUpdated = true\n\t\t}\n\t}\n\n\tif propertiesUpdated && displayNameIsSet {\n\t\treturn tooManyValues\n\t}\n\n\tif displayNameIsSet {\n\t\treturn schoolRenamed\n\t}\n\n\tif propertiesUpdated {\n\t\treturn schoolPropertiesUpdated\n\t}\n\n\treturn schoolUnchanged\n}", "title": "" }, { "docid": "47d9fdd7598062ead3343d97e1562f1c", "score": "0.40635172", "text": "func (_RandomNumber *RandomNumberSession) SetRandomNumber(_randomNumber *big.Int) (*types.Transaction, error) {\n\treturn _RandomNumber.Contract.SetRandomNumber(&_RandomNumber.TransactOpts, _randomNumber)\n}", "title": "" }, { "docid": "fdb1c0948c01f9ec2d91d06632017bc3", "score": "0.40582237", "text": "func (g Graph) PostEducationSchoolUser(w http.ResponseWriter, r *http.Request) {\n\tlogger := g.logger.SubloggerWithRequestID(r.Context())\n\n\tschoolID := chi.URLParam(r, \"schoolID\")\n\tlogger.Info().Str(\"schoolID\", schoolID).Msg(\"Calling post school user\")\n\tschoolID, err := url.PathUnescape(schoolID)\n\tif err != nil {\n\t\tlogger.Debug().\n\t\t\tErr(err).\n\t\t\tStr(\"id\", schoolID).\n\t\t\tMsg(\"could not add user to school: unescaping school id failed\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"unescaping school id failed\")\n\t\treturn\n\t}\n\n\tif schoolID == \"\" {\n\t\tlogger.Debug().Msg(\"could not add school user: missing school id\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"missing school id\")\n\t\treturn\n\t}\n\tmemberRef := libregraph.NewMemberReference()\n\terr = StrictJSONUnmarshal(r.Body, memberRef)\n\tif err != nil {\n\t\tlogger.Debug().\n\t\t\tErr(err).\n\t\t\tInterface(\"body\", r.Body).\n\t\t\tMsg(\"could not add school user: invalid request body\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, fmt.Sprintf(\"invalid request body: %s\", err.Error()))\n\t\treturn\n\t}\n\tmemberRefURL, ok := memberRef.GetOdataIdOk()\n\tif !ok {\n\t\tlogger.Debug().Msg(\"could not add school user: @odata.id reference is missing\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"@odata.id reference is missing\")\n\t\treturn\n\t}\n\tmemberType, id, err := g.parseMemberRef(*memberRefURL)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Msg(\"could not add school user: error parsing @odata.id url\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"Error parsing @odata.id url\")\n\t\treturn\n\t}\n\t// The MS Graph spec allows \"directoryObject\", \"user\", \"school\" and \"organizational Contact\"\n\t// we restrict this to users for now. Might add Schools as members later\n\tif memberType != \"users\" {\n\t\tlogger.Debug().Str(\"type\", memberType).Msg(\"could not add school user: Only users are allowed as school members\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"Only users are allowed as school members\")\n\t\treturn\n\t}\n\n\tlogger.Debug().Str(\"memberType\", memberType).Str(\"id\", id).Msg(\"calling add user on backend\")\n\terr = g.identityEducationBackend.AddUsersToEducationSchool(r.Context(), schoolID, []string{id})\n\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Msg(\"could not add school user: backend error\")\n\t\terrorcode.RenderError(w, r, err)\n\t\treturn\n\t}\n\n\t/* TODO requires reva changes\n\te := events.SchoolMemberAdded{SchoolID: schoolID, UserID: id}\n\tif currentUser, ok := ctxpkg.ContextGetUser(r.Context()); ok {\n\t\te.Executant = currentUser.GetId()\n\t}\n\tg.publishEvent(e)\n\t*/\n\n\trender.Status(r, http.StatusNoContent)\n\trender.NoContent(w, r)\n}", "title": "" }, { "docid": "fa8ff178ded45136fffd7d8411632514", "score": "0.40570006", "text": "func (g Graph) PatchEducationSchool(w http.ResponseWriter, r *http.Request) {\n\tlogger := g.logger.SubloggerWithRequestID(r.Context())\n\tschoolID := chi.URLParam(r, \"schoolID\")\n\tlogger.Info().Str(\"schoolID\", schoolID).Msg(\"calling patch school\")\n\tschoolID, err := url.PathUnescape(schoolID)\n\tif err != nil {\n\t\tlogger.Debug().Str(\"id\", schoolID).Msg(\"could not update school: unescaping school id failed\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"unescaping school id failed\")\n\t\treturn\n\t}\n\n\tif schoolID == \"\" {\n\t\tlogger.Debug().Msg(\"could not update school: missing school id\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"missing school id\")\n\t\treturn\n\t}\n\n\tschool := libregraph.NewEducationSchool()\n\terr = StrictJSONUnmarshal(r.Body, school)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Interface(\"body\", r.Body).Msg(\"could not update school: invalid request body\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, fmt.Sprintf(\"invalid request body: %s\", err.Error()))\n\t\treturn\n\t}\n\n\t// validate terminationDate attribute, needs to be \"far enough\" in the future, terminationDate can be nil (means\n\t// termination date is to be deleted\n\tif terminationDate, ok := school.GetTerminationDateOk(); ok && terminationDate != nil {\n\t\terr = g.validateTerminationDate(*terminationDate)\n\t\tif err != nil {\n\t\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())\n\t\t\treturn\n\t\t}\n\t}\n\n\tif school, err = g.identityEducationBackend.UpdateEducationSchool(r.Context(), schoolID, *school); err != nil {\n\t\tlogger.Debug().Err(err).Interface(\"school\", school).Msg(\"could not update school: backend error\")\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\t/* TODO requires reva changes\n\te := events.SchoolFeatureChanged{SchoolID: schoolID}\n\tif currentUser, ok := ctxpkg.ContextGetUser(r.Context()); ok {\n\t\te.Executant = currentUser.GetId()\n\t}\n\tg.publishEvent(e)\n\t*/\n\n\trender.Status(r, http.StatusOK)\n\trender.JSON(w, r, school)\n}", "title": "" }, { "docid": "d128ea06338315ef8149caeb2ad92fb6", "score": "0.40552986", "text": "func (pu *PaymentUpdate) SetAccountNumber(s string) *PaymentUpdate {\n\tpu.mutation.SetAccountNumber(s)\n\treturn pu\n}", "title": "" }, { "docid": "f1e0db2097d7747f4fa9da8b25d514ec", "score": "0.40400717", "text": "func (s *SMFWriter) SequenceNumber(no uint16) error {\n\t_, err := s.wr.Write(meta.SequenceNumber(no))\n\treturn err\n}", "title": "" }, { "docid": "f9a9b76a04da7f782e598af8478e7500", "score": "0.40333983", "text": "func (g Graph) GetEducationSchool(w http.ResponseWriter, r *http.Request) {\n\tlogger := g.logger.SubloggerWithRequestID(r.Context())\n\tschoolID := chi.URLParam(r, \"schoolID\")\n\tlogger.Info().Str(\"schoolID\", schoolID).Msg(\"calling get school\")\n\tschoolID, err := url.PathUnescape(schoolID)\n\tif err != nil {\n\t\tlogger.Debug().Str(\"id\", schoolID).Msg(\"could not get school: unescaping school id failed\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"unescaping school id failed\")\n\t}\n\n\tif schoolID == \"\" {\n\t\tlogger.Debug().Msg(\"could not get school: missing school id\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"missing school id\")\n\t\treturn\n\t}\n\n\tlogger.Debug().\n\t\tStr(\"id\", schoolID).\n\t\tInterface(\"query\", r.URL.Query()).\n\t\tMsg(\"calling get school on backend\")\n\tschool, err := g.identityEducationBackend.GetEducationSchool(r.Context(), schoolID)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Msg(\"could not get school: backend error\")\n\t\terrorcode.RenderError(w, r, err)\n\t\treturn\n\t}\n\n\trender.Status(r, http.StatusOK)\n\trender.JSON(w, r, school)\n}", "title": "" }, { "docid": "9af01335ba7fbfa7386d06ded9222cd8", "score": "0.4011129", "text": "func (i *LDAP) RemoveClassFromEducationSchool(ctx context.Context, schoolNumberOrID string, memberID string) error {\n\tlogger := i.logger.SubloggerWithRequestID(ctx)\n\tlogger.Debug().Str(\"backend\", \"ldap\").Msg(\"RemoveClassFromEducationSchool\")\n\n\tschoolEntry, err := i.getSchoolByNumberOrID(schoolNumberOrID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif schoolEntry == nil {\n\t\treturn ErrNotFound\n\t}\n\n\tschoolID := schoolEntry.GetEqualFoldAttributeValue(i.educationConfig.schoolAttributeMap.id)\n\tclass, err := i.getEducationClassByID(memberID, false)\n\tif err != nil {\n\t\ti.logger.Warn().Str(\"userid\", memberID).Msg(\"Class does not exist\")\n\t\treturn err\n\t}\n\tcurrentSchools := class.GetEqualFoldAttributeValues(i.educationConfig.memberOfSchoolAttribute)\n\tfor _, currentSchool := range currentSchools {\n\t\tif currentSchool == schoolID {\n\t\t\tmr := ldap.ModifyRequest{DN: class.DN}\n\t\t\tmr.Delete(i.educationConfig.memberOfSchoolAttribute, []string{schoolID})\n\t\t\tif err := i.conn.Modify(&mr); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "80693d809d4bee07a5d6eeb5ba2f2bcb", "score": "0.39917162", "text": "func (file *SchoolList) PrintCount() {\n\tsheet := file.Sheet()\n\tfmt.Printf(\"Schools count %d\\n\", len(sheet.Rows))\n}", "title": "" }, { "docid": "fd238ee11791936580b858cd06a18d3b", "score": "0.39893898", "text": "func (i *LDAP) RemoveUserFromEducationSchool(ctx context.Context, schoolNumberOrID string, memberID string) error {\n\tlogger := i.logger.SubloggerWithRequestID(ctx)\n\tlogger.Debug().Str(\"backend\", \"ldap\").Msg(\"RemoveUserFromEducationSchool\")\n\n\tschoolEntry, err := i.getSchoolByNumberOrID(schoolNumberOrID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif schoolEntry == nil {\n\t\treturn ErrNotFound\n\t}\n\n\tschoolID := schoolEntry.GetEqualFoldAttributeValue(i.educationConfig.schoolAttributeMap.id)\n\tuser, err := i.getEducationUserByNameOrID(memberID)\n\tif err != nil {\n\t\ti.logger.Warn().Str(\"userid\", memberID).Msg(\"User does not exist\")\n\t\treturn err\n\t}\n\tcurrentSchools := user.GetEqualFoldAttributeValues(i.educationConfig.memberOfSchoolAttribute)\n\tfor _, currentSchool := range currentSchools {\n\t\tif currentSchool == schoolID {\n\t\t\tmr := ldap.ModifyRequest{DN: user.DN}\n\t\t\tmr.Delete(i.educationConfig.memberOfSchoolAttribute, []string{schoolID})\n\t\t\tif err := i.conn.Modify(&mr); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1068b6c6d28d06d50c1fa54b3b39f019", "score": "0.39835733", "text": "func (puo *PaymentUpdateOne) SetAccountNumber(s string) *PaymentUpdateOne {\n\tpuo.mutation.SetAccountNumber(s)\n\treturn puo\n}", "title": "" }, { "docid": "8aa653572ade72d74bb4f0f739d3472b", "score": "0.39834186", "text": "func GetSchool(c *gin.Context) {\n\tdb, ok := c.Keys[\"db\"].(*gorm.DB)\n\tif !ok {\n\t\tc.JSON(500, gin.H{\"error\": \"internal error\"})\n\t\tpanic(\"no database variable in context\")\n\t}\n\n\tuser, ok := c.Keys[\"usr\"].(*m.User)\n\tif !ok {\n\t\tc.JSON(500, gin.H{\"error\": \"internal error\"})\n\t\tpanic(\"no user variable in context\")\n\t}\n\n\tschoolGetInfo := new(m.GetSchoolInfo)\n\tschoolGetInfo.ID = c.Query(\"id\") // Get variable from query\n\n\tcode, resp := schoolGetInfo.GetInfo(db, user)\n\tc.JSON(code, resp)\n}", "title": "" }, { "docid": "b58a10b7358fcc6c45477f1c239ad1bd", "score": "0.3978607", "text": "func (o *AdditionalPropertiesClass) SetMapNumber(v map[string]float32) {\n\to.MapNumber = &v\n}", "title": "" }, { "docid": "85fed91487cc175c1d20f031481ad807", "score": "0.39670184", "text": "func (g Graph) DeleteEducationSchool(w http.ResponseWriter, r *http.Request) {\n\tlogger := g.logger.SubloggerWithRequestID(r.Context())\n\tschoolID := chi.URLParam(r, \"schoolID\")\n\tlogger.Info().Str(\"schoolID\", schoolID).Msg(\"calling delete school\")\n\tschoolID, err := url.PathUnescape(schoolID)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Str(\"id\", schoolID).Msg(\"could not delete school: unescaping school id failed\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"unescaping school id failed\")\n\t\treturn\n\t}\n\n\tif schoolID == \"\" {\n\t\tlogger.Debug().Msg(\"could not delete school: missing school id\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"missing school id\")\n\t\treturn\n\t}\n\n\t// Read school and check if termination date is set\n\tschool, err := g.identityEducationBackend.GetEducationSchool(r.Context(), schoolID)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Msg(\"could not get school: backend error\")\n\t\terrorcode.RenderError(w, r, err)\n\t\treturn\n\t}\n\ttermination, ok := school.GetTerminationDateOk()\n\tif !ok {\n\t\tlogger.Debug().Msg(\"cannot delete school: not termination date set\")\n\t\terrorcode.NotAllowed.Render(w, r, http.StatusMethodNotAllowed, \"no termination date set\")\n\t\treturn\n\t}\n\n\tif time.Now().Before(*termination) {\n\t\tlogger.Debug().Time(\"terminationDate\", *termination).Msg(\"cannot delete school: termination date not reached\")\n\t\terrorcode.NotAllowed.Render(w, r, http.StatusMethodNotAllowed, \"can't delete school before termination date\")\n\t\treturn\n\t}\n\n\tlogger.Debug().Str(\"schoolID\", schoolID).Msg(\"Getting users of school\")\n\tusers, err := g.identityEducationBackend.GetEducationSchoolUsers(r.Context(), schoolID)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Msg(\"could not get school users: backend error\")\n\t\terrorcode.RenderError(w, r, err)\n\t\treturn\n\t}\n\n\tfor _, user := range users {\n\t\tlogger.Debug().Str(\"schoolID\", schoolID).Str(\"userID\", *user.Id).Msg(\"calling delete member on backend\")\n\t\tif err := g.identityEducationBackend.RemoveUserFromEducationSchool(r.Context(), schoolID, *user.Id); err != nil {\n\t\t\tif errors.Is(err, identity.ErrNotFound) {\n\t\t\t\tlogger.Debug().Str(\"schoolID\", schoolID).Str(\"userID\", *user.Id).Msg(\"user not found\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlogger.Debug().Err(err).Msg(\"could not delete school member: backend error\")\n\t\t\terrorcode.RenderError(w, r, err)\n\t\t\t// TODO Do we need return right hear?\n\t\t}\n\t}\n\n\tlogger.Debug().Str(\"id\", schoolID).Msg(\"calling delete school on backend\")\n\terr = g.identityEducationBackend.DeleteEducationSchool(r.Context(), schoolID)\n\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Msg(\"could not delete school: backend error\")\n\t\terrorcode.RenderError(w, r, err)\n\t\treturn\n\t}\n\n\t/* TODO requires reva changes\n\te := events.SchoolDeleted{SchoolID: schoolID}\n\tif currentUser, ok := ctxpkg.ContextGetUser(r.Context()); ok {\n\t\te.Executant = currentUser.GetId()\n\t}\n\tg.publishEvent(e)\n\t*/\n\n\trender.Status(r, http.StatusNoContent)\n\trender.NoContent(w, r)\n}", "title": "" }, { "docid": "bbe52fa00b7e123a7559176ad0b5260f", "score": "0.39397636", "text": "func (m *UserExperienceAnalyticsAppHealthOSVersionPerformance) SetOsBuildNumber(value *string)() {\n err := m.GetBackingStore().Set(\"osBuildNumber\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "634b7b6b77976221a0e43db009b786bc", "score": "0.39389476", "text": "func (m *EducationSchool) SetHighestGrade(value *string)() {\n m.highestGrade = value\n}", "title": "" }, { "docid": "e08ba5fd772e9a635b450a426edfd633", "score": "0.3937601", "text": "func (suo *ScholarshipUpdateOne) SetSemesterID(s *Semester) *ScholarshipUpdateOne {\n\treturn suo.SetSemesterIDID(s.ID)\n}", "title": "" }, { "docid": "0d5387adf59a1f6a4a5f9eb499f1a902", "score": "0.393256", "text": "func (o *MicrosoftGraphEducationRoot) SetSchools(v []MicrosoftGraphEducationSchool) {\n\to.Schools = &v\n}", "title": "" }, { "docid": "a0145b7ed947b7c29052ad230b175092", "score": "0.39222547", "text": "func (trx *BaseTransaction) SetAccountNumber(number string) Transaction {\n\ttrx.AccountNumber = number\n\treturn trx\n}", "title": "" }, { "docid": "1e9460df3df28603e406b78260d4349f", "score": "0.3918279", "text": "func (o *ApprovalRequestResponseApprovalRequest) SetApplicationNumber(v string) {\n\to.ApplicationNumber = v\n}", "title": "" }, { "docid": "733bd7319c3dc9a8115afc155f9037a3", "score": "0.39120954", "text": "func (e *Environment) SetNumberVariable(name string, value decimal.Decimal) error {\n\treturn e.DeclareVariable(name, value)\n}", "title": "" }, { "docid": "6509026141e6ae37317130f9551059b8", "score": "0.38891613", "text": "func (m *TransactionMutation) SetCheckNumber(s string) {\n\tm.checkNumber = &s\n}", "title": "" }, { "docid": "26c10eda55ba221f99c74c7ae24b8dff", "score": "0.38829842", "text": "func NewSchoolService(schoolRepo repository.SchoolRepository, classRepo repository.ClassRepository) service.SchoolService {\n\treturn &schoolService{\n\t\tschoolRepo: schoolRepo,\n\t\tclassRepo: classRepo,\n\t}\n}", "title": "" }, { "docid": "82735b1d9788a598632bbea7e407626d", "score": "0.38815746", "text": "func (regIdentity *RegisteredIdentity) SetDssKey(dssSigningKey *ecdsa.PublicKey) {\n\tregIdentity.dssPubKey = dssSigningKey\n}", "title": "" }, { "docid": "e56aea15c7560aa85867c8ed51ce1e85", "score": "0.38692382", "text": "func (s *DeleteLaunchTemplateVersionsResponseSuccessItem) SetVersionNumber(v int64) *DeleteLaunchTemplateVersionsResponseSuccessItem {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" } ]
fb2176528a6299856af160313d482cd4
var ( val int )
[ { "docid": "9d9f40a121881d8157e9a9e34b1114b8", "score": "0.0", "text": "func FizzBuzz(n int) []string {\n\tvar fizzbuzz []string\n\n\tfor i := 1; i <= n; i++ {\n\t\tif i%3 == 0 && i%5 == 0 {\n\t\t\tfizzbuzz = append(fizzbuzz, \"FizzBuzz\")\n\t\t} else if i%3 == 0 {\n\t\t\tfizzbuzz = append(fizzbuzz, \"Fizz\")\n\t\t} else if i%5 == 0 {\n\t\t\tfizzbuzz = append(fizzbuzz, \"Buzz\")\n\t\t} else {\n\t\t\tfizzbuzz = append(fizzbuzz, strconv.Itoa(i))\n\t\t}\n\t}\n\n\treturn fizzbuzz\n}", "title": "" } ]
[ { "docid": "2ab72f2a520899f9174e2dcd5dd813fb", "score": "0.6860169", "text": "func (c *Constructor[_]) IntVar(ptr *int, name string, value int, help string) {\n\t*ptr = value\n\tc.define(name, paramInt, help).intptr = ptr\n}", "title": "" }, { "docid": "75a0402c18f875f9ee39b767058e68e6", "score": "0.6557798", "text": "func IntVar(p *int, name string, value int, usage string) {\n\tadd(name, newIntValue(value, p), usage)\n}", "title": "" }, { "docid": "e6dfd3835a273abc8e08dd6afadc850a", "score": "0.64375526", "text": "func varInt(s *testing.State, name string, defaultVal int) int {\n\tif str, ok := s.Var(name); ok {\n\t\tval, err := strconv.Atoi(str)\n\t\tif err == nil {\n\t\t\treturn val\n\t\t}\n\t\ts.Logf(\"Cannot parse argument %s %s: %v\", name, str, err)\n\t}\n\treturn defaultVal\n}", "title": "" }, { "docid": "737bd2642093dd623c731fd336c060a3", "score": "0.618886", "text": "func IntVar(p *int, name string, value int, usage string) {\n\tex.FlagSet.IntVar(p, name, value, usage)\n}", "title": "" }, { "docid": "8a82306113b12230d3029b476ba960b8", "score": "0.6159868", "text": "func Int(v *Value, def int) int {\n\ti, err := v.Int()\n\tif err != nil {\n\t\treturn def\n\t}\n\treturn i\n}", "title": "" }, { "docid": "42df58cdec435b8be8d097754c6188e5", "score": "0.6080236", "text": "func IntVar(pv *int, flag string, value int, description string) {\n\tshort, long, err := parseSingleFlag(flag)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t*pv = value\n\tflags = append(flags, &optionInt{\n\t\tdescription: description,\n\t\tlong: long,\n\t\tshort: short,\n\t\tpv: pv,\n\t\tdef: value,\n\t})\n}", "title": "" }, { "docid": "8132760eb6395b2d5c9f93228426892c", "score": "0.60571295", "text": "func Int(name string, value int, usage string) *int {\n\tp := new(int);\n\tIntVar(p, name, value, usage);\n\treturn p;\n}", "title": "" }, { "docid": "c281c4c4f9b8108a3d8c9b01835fd73b", "score": "0.6004573", "text": "func Int(name string, value int) *int {\n\tp := new(int)\n\tIntVar(p, name, value)\n\treturn p\n}", "title": "" }, { "docid": "ec6a35f1ee017edfd0b1f2afefea5faa", "score": "0.5987229", "text": "func (a *api) DefineVar(name string, x *big.Int) {\n\ta.Printf(\"var %s = %s\", a.Name(name), a.Type())\n\ta.ByteArrayValue(bigint.BytesLittleEndian(x))\n}", "title": "" }, { "docid": "06467372516cb735ea32c0ea9d917655", "score": "0.59813523", "text": "func Int64Var(p *int64, name string, value int64, usage string) {\n\tadd(name, newInt64Value(value, p), usage)\n}", "title": "" }, { "docid": "9e792be887e62530fc7bea99f1b515e3", "score": "0.5918301", "text": "func IntArgVar(register Register, p *int, name string, options ...ArgOptionApplyer) error {\n\treturn ArgVar(register, newIntValue(p), name, options...)\n}", "title": "" }, { "docid": "7d230a9dd7d9776f06d47877feba35b0", "score": "0.5916736", "text": "func IntVar(p *int, name string, value int) {\n\t*p = value\n\tfuncs = append(funcs, func() bool {\n\t\tif s := os.Getenv(name); s != \"\" {\n\t\t\tv, err := strconv.Atoi(s)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(name, err)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\t*p = v\n\t\t}\n\t\treturn true\n\t})\n}", "title": "" }, { "docid": "89ce302ce689161349933b5754b75e50", "score": "0.5887909", "text": "func (pc *programCode) setVar(name string, val int64) {\n\tcode := \"\"\n\tstrVal := strconv.FormatInt(val, 10)\n\tcode += \"\\tmov rax, \" + strVal + \"\\t;set \" + name + \" to \" + strVal + \"\\n\"\n\tcode += \"\\tmov [\" + name + \"], rax \\n\"\n\tpc.appendCode(code)\n}", "title": "" }, { "docid": "d64be928a8bb456619a2562967e928b7", "score": "0.5886058", "text": "func (t *Target) Var(value usm.Value) usm.Register {\n\tt.Registers++\n\n\tt.WriteStatement(\"var v%v = %v\\n\", t.Registers, value)\n\n\treturn t.Registers\n}", "title": "" }, { "docid": "7c5544eaeb63466d1ed0dbe61f1f51d7", "score": "0.5876616", "text": "func (*Base) Var(p ASTPass, node *ast.Var, ctx Context) {\n}", "title": "" }, { "docid": "72a93b537a930c4c7bce5f793609286f", "score": "0.58756006", "text": "func Var(value Value, name string, usage string) {\n\tCommandLine.VarP(value, name, \"\", usage)\n}", "title": "" }, { "docid": "e9ec231cb7e9cac4524d2faa3bd98dd1", "score": "0.58717346", "text": "func (f *FlagSet) Var(value Value, name string, usage string) {\n\tf.VarP(value, name, \"\", usage)\n}", "title": "" }, { "docid": "8b9bc488f7ded02525a4abd461d207bf", "score": "0.5821256", "text": "func zeroval(ival int) {\n\tival = 0\n}", "title": "" }, { "docid": "8b9bc488f7ded02525a4abd461d207bf", "score": "0.5821256", "text": "func zeroval(ival int) {\n\tival = 0\n}", "title": "" }, { "docid": "8b9bc488f7ded02525a4abd461d207bf", "score": "0.5821256", "text": "func zeroval(ival int) {\n\tival = 0\n}", "title": "" }, { "docid": "8b9bc488f7ded02525a4abd461d207bf", "score": "0.5821256", "text": "func zeroval(ival int) {\n\tival = 0\n}", "title": "" }, { "docid": "e96fdcae8ffe00adcb4ad0f6a4f9f6bf", "score": "0.58182657", "text": "func vararg(i Instruction, ls *LuaState) {\n\ta, b, _ := i.ABC()\n\ta += 1\n\n\tif b != 1 { // b==0 or b>1\n\t\tls.loadVararg(b - 1)\n\t\t_popResults(a, b, ls)\n\t}\n}", "title": "" }, { "docid": "890879a2529031dddfb010511d2b70c3", "score": "0.58091074", "text": "func AutoVar(v *ssa.Value) (*Node, int64)", "title": "" }, { "docid": "5fafe27e1c36d1edf76f4fc3e260a243", "score": "0.5783781", "text": "func Int64Var(p *int64, name string, value int64, usage string) {\n\tex.FlagSet.Int64Var(p, name, value, usage)\n}", "title": "" }, { "docid": "c2747151528e3ebea7fe4873b1b71ca2", "score": "0.5769684", "text": "func Int(flag string, value int, description string) *int {\n\tvar v int\n\tIntVar(&v, flag, value, description)\n\treturn &v\n}", "title": "" }, { "docid": "95f4abeabade1834d0df42a41ee63d91", "score": "0.5753493", "text": "func VarInt(i uint64) []byte {\n\tb := make([]byte, 9)\n\tif i < 0xfd {\n\t\tb[0] = byte(i)\n\t\treturn b[:1]\n\t}\n\tif i < 0x10000 {\n\t\tb[0] = 0xfd\n\t\tbinary.LittleEndian.PutUint16(b[1:3], uint16(i))\n\t\treturn b[:3]\n\t}\n\tif i < 0x100000000 {\n\t\tb[0] = 0xfe\n\t\tbinary.LittleEndian.PutUint32(b[1:5], uint32(i))\n\t\treturn b[:5]\n\t}\n\tb[0] = 0xff\n\tbinary.LittleEndian.PutUint64(b[1:9], i)\n\treturn b\n}", "title": "" }, { "docid": "605488387d5d0f5d96158f3582f45caf", "score": "0.5751546", "text": "func (r *Decoder) VarInt() uint64 {\n\tn := uint64(0)\n\tfor shift := uint(0); shift < 64; shift += 7 {\n\t\tb := r.Uint8()\n\t\tn = n | (uint64(b&0x7f) << shift)\n\t\tif b&0x80 == 0 {\n\t\t\treturn n\n\t\t}\n\t}\n\treturn n\n}", "title": "" }, { "docid": "b45805bdb038472078462bf6383d3c6c", "score": "0.57440126", "text": "func Varint(buf []byte) (int64, int) {\n\tux, n := Uvarint(buf) // ok to continue in presence of error\n\tx := int64(ux >> 1)\n\tif ux&1 != 0 {\n\t\tx = ^x\n\t}\n\treturn x, n\n}", "title": "" }, { "docid": "b45805bdb038472078462bf6383d3c6c", "score": "0.57440126", "text": "func Varint(buf []byte) (int64, int) {\n\tux, n := Uvarint(buf) // ok to continue in presence of error\n\tx := int64(ux >> 1)\n\tif ux&1 != 0 {\n\t\tx = ^x\n\t}\n\treturn x, n\n}", "title": "" }, { "docid": "79c0757106aa8c98a2241f0f3d255802", "score": "0.57407516", "text": "func (a *Arg) Int(def int) int {\n\tif a.value == \"\" {\n\t\treturn def\n\t}\n\ti, err := strconv.Atoi(a.value)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn i\n}", "title": "" }, { "docid": "1d005edd0092846b6afe34311093cb89", "score": "0.5715369", "text": "func Var(p flag.Value, name string, usage string) {\n\tex.FlagSet.Var(p, name, usage)\n}", "title": "" }, { "docid": "15cef5b988ce4a4f187a043c48a71e6b", "score": "0.5670419", "text": "func setUpval(i Instruction, vm LuaVM) {\n\ta, b, _ := i.ABC()\n\ta += 1\n\tb += 1\n\n\tvm.Copy(a, LuaUpvalueIndex(b))\n}", "title": "" }, { "docid": "80137d6b92da2b923211bee8693d893d", "score": "0.5636362", "text": "func (v Value10) Int() int { return int(v) }", "title": "" }, { "docid": "6ecb0aef124f26cc13b668cc20374cf3", "score": "0.56339675", "text": "func NewVar(val interface{}) *Var {\n\treturn &Var{val: val}\n}", "title": "" }, { "docid": "5854f4b95f44b0fc476f4e0acc7090a3", "score": "0.56161606", "text": "func IntegerValue(i int) Value { return Value{Typ: ':', IntegerV: i} }", "title": "" }, { "docid": "c763107745d8d30c54cb525fbeb184b9", "score": "0.56109583", "text": "func (c *Constructor[_]) Int(name string, value int, help string) *int {\n\tp := new(int)\n\tc.IntVar(p, name, value, help)\n\treturn p\n}", "title": "" }, { "docid": "2b81c378388cd4d9ad9403d49ef16d8f", "score": "0.5610343", "text": "func (r *Encoder) VarInt(u uint64) {\n\tbytes := make([]byte, 0, 1)\n\tfor {\n\t\tb := uint8(u & 0x7f)\n\t\tu = u >> 7\n\t\tif u > 0 {\n\t\t\tbytes = append(bytes, b|0x80)\n\t\t} else {\n\t\t\t// this is the most significant byte\n\t\t\tbytes = append(bytes, b)\n\t\t\tr.Bytes(bytes)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ab35b751e5f6ae06b2388a9aef8e9473", "score": "0.56073636", "text": "func Int64Var(p *int64, name string, alias rune, value int64, usage string, fn Callback) {\n\tCommandLine.Var(newInt64Value(value, p), name, alias, usage, fn)\n}", "title": "" }, { "docid": "affbc0e28dbabd45e761b897e1e16277", "score": "0.5601511", "text": "func (this *parameter) Int() int {\n\tif this.Values == nil {\n\t\treturn 0\n\t} else {\n\t\treturn reflekt.AsInt(this.Values[0])\n\t}\n}", "title": "" }, { "docid": "231adb2f29e1c40e965554a8fe41d97d", "score": "0.55710286", "text": "func (s *Smpval) Int() int64 {\n\treturn s.i\n}", "title": "" }, { "docid": "9a4f59a5a63c3e6cf1201115829fcdac", "score": "0.5554899", "text": "func Int32ArgVar(register Register, p *int32, name string, options ...ArgOptionApplyer) error {\n\treturn ArgVar(register, newInt32Value(p), name, options...)\n}", "title": "" }, { "docid": "eebbe2207e1f7bbd497407c16109a163", "score": "0.5534984", "text": "func (vars *vars) litValue(l lit) int {\n\tval, ok := vars.all[l.v]\n\tif !ok {\n\t\tval = len(vars.all) + 1\n\t\tvars.all[l.v] = val\n\t\tvars.pb[l.v] = val\n\t}\n\tif l.signed {\n\t\treturn -val\n\t}\n\treturn val\n}", "title": "" }, { "docid": "6ac0221dbbfe28d07043e77198acd1a3", "score": "0.55268246", "text": "func intSmpval(val reflect.Value) *Smpval {\n\treturn &Smpval{i: val.Int(), flag: Int, val: val}\n}", "title": "" }, { "docid": "b6073525d448251699fd28ef32dfaa7a", "score": "0.55263525", "text": "func eeNumInt(v int) (n eeNum) {\r\n\t*n.int() = v\r\n\treturn\r\n}", "title": "" }, { "docid": "46151468256e52ef7bb99baba1fbfd79", "score": "0.5514192", "text": "func (s *state) setVar(n int, value reflect.Value) {\n\ts.vars[len(s.vars)-n].value = value\n}", "title": "" }, { "docid": "ea62df02461d97d74312be9b6bf9d303", "score": "0.55116934", "text": "func IntValue(n int64) Value {\n\treturn Value{iface: n}\n}", "title": "" }, { "docid": "e3a0d11719c5a3f36702faa0702c9586", "score": "0.5507308", "text": "func (pc *programCode) addVar(name string, val int64) {\n\t// the following line checks if an element exists inside the map element.\n\tif _, ok := pc.intMap[name]; ok {\n\t\tpc.setVar(name, val)\n\t} else {\n\t\tpc.intMap[name] = val\n\t}\n\n}", "title": "" }, { "docid": "54a9476716a05109b2fb9581b3dd0065", "score": "0.5494144", "text": "func (v Value2) Int() int { return int(v) }", "title": "" }, { "docid": "127174d2504cf0975f2109a76adc3d0f", "score": "0.5491371", "text": "func BoundIntVar(p *int, name string, value, min, max int, usage string) {\n\tflag.Var(newBoundIntValue(value, p, min, max), name, usage)\n}", "title": "" }, { "docid": "bd3b55253df6f6580aa2c3230a2c65ad", "score": "0.5475776", "text": "func IntVarP(pv *int, short rune, long string, value int, description string) {\n\tif err := parseShortAndLongFlag(short, long); err != nil {\n\t\tpanic(err)\n\t}\n\t*pv = value\n\tflags = append(flags, &optionInt{\n\t\tdescription: description,\n\t\tlong: long,\n\t\tshort: short,\n\t\tpv: pv,\n\t\tdef: value,\n\t})\n}", "title": "" }, { "docid": "2aa82af786f271ceeff026de47f14bd6", "score": "0.5471266", "text": "func Int64Var(pv *int64, flag string, value int64, description string) {\n\tshort, long, err := parseSingleFlag(flag)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t*pv = value\n\tflags = append(flags, &optionInt64{\n\t\tdescription: description,\n\t\tlong: long,\n\t\tshort: short,\n\t\tpv: pv,\n\t\tdef: value,\n\t})\n}", "title": "" }, { "docid": "f77c83f652d4ccc2f7bcc99f419c5ef9", "score": "0.54575586", "text": "func (i GinBindType) IntValue() int {\n\treturn int(i)\n}", "title": "" }, { "docid": "f3e50f3ec9b74ddcceca6f521a4713db", "score": "0.54460937", "text": "func VarInt(input []byte) int {\n\tvar v int\n\tswitch len(input) {\n\tcase 1:\n\t\tv = int(input[0])\n\tcase 3:\n\t\tr := bytes.NewReader(input[:2])\n\t\tvar i uint16\n\t\tif err := binary.Read(r, binary.BigEndian, &i); err != nil {\n\t\t\tlog.Printf(\"VariableInt Count Error 3: %v\\n\", err)\n\t\t\tbreak\n\t\t}\n\t\tv = int(i)\n\tcase 5:\n\t\tr := bytes.NewReader(input[:4])\n\t\tvar i uint32\n\t\tif err := binary.Read(r, binary.BigEndian, &i); err != nil {\n\t\t\tlog.Printf(\"VariableInt Count Error 5: %v\\n\", err)\n\t\t\tbreak\n\t\t}\n\t\tv = int(i)\n\tcase 9:\n\t\tr := bytes.NewReader(input[:8])\n\t\tvar i uint64\n\t\tif err := binary.Read(r, binary.BigEndian, &i); err != nil {\n\t\t\tlog.Printf(\"VariableInt Count Error 9: %v\\n\", err)\n\t\t\tbreak\n\t\t}\n\t\tv = int(i)\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "ccdaadcfa80dcb117d50838467c4768b", "score": "0.5434397", "text": "func (conf blah) Intval(key string) int {\n\treturn viper.GetInt(key)\n}", "title": "" }, { "docid": "630259dbf2088bb2ff397a38660586c2", "score": "0.5426572", "text": "func newVar(v interface{}) (*interface{}, error) {\n\tx := interface{}(v)\n\treturn &x, nil\n}", "title": "" }, { "docid": "226d62be300b46a328d1a9ad0c94d40b", "score": "0.5425609", "text": "func number(context interface{}, value string) (int, error) {\n\ti, err := strconv.Atoi(value)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Parameter %q is not a number\", value)\n\t\tlog.Error(context, \"varLookup\", err, \"Index conversion\")\n\t\treturn 0, err\n\t}\n\treturn i, nil\n}", "title": "" }, { "docid": "2be10facaa075c97e45c0fdc5d87d7ac", "score": "0.5423268", "text": "func Intval(s string) int {\n\n\tif s == \"\" {\n\t\treturn 0\n\t}\n\n\ti, err := strconv.Atoi(s)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn i\n}", "title": "" }, { "docid": "3c6f6860f57e11ae61bce780849fbc31", "score": "0.54232174", "text": "func change(val *int) {\n\t*val = 55\n}", "title": "" }, { "docid": "df56431af85a6f27a1c8b1a59cd11d8f", "score": "0.5422497", "text": "func main() {\n\t// To declare and assign a value within a function\n\t// use the short declaration operator.\n\tv := 2\n\n\tfmt.Println(o, v)\n}", "title": "" }, { "docid": "9462dcfa80e74b2e923ca20dc03d420d", "score": "0.5421654", "text": "func (ExprValue) Int() int { return intResult }", "title": "" }, { "docid": "ad75ed592c4ba337d9cb48958dfb28c6", "score": "0.5410391", "text": "func NewVarFromInt(t token.Token, value int) *VarLiteral {\n\treturn &VarLiteral{\n\t\tToken: t,\n\t\tTypeOf: NewVarType(NewIntType()),\n\t\tValue: value,\n\t}\n}", "title": "" }, { "docid": "3038baf94e583a3586c18a2c3c7d87d1", "score": "0.54089326", "text": "func Int(name string, val int) Field {\n\treturn Field(zap.Int(name, val))\n}", "title": "" }, { "docid": "ddc1a23ba3066de1b28926dfba4cd07e", "score": "0.54087627", "text": "func (c *Configurator) Var(value Value, name string, usage string) {\n\tc.env().Var(value, name, usage)\n\tc.flag().Var(value, name, usage)\n}", "title": "" }, { "docid": "960ac26171e68fb0fd290771d2233933", "score": "0.53921324", "text": "func UintVar(p *uint, name string, value uint, usage string) {\n\tex.FlagSet.UintVar(p, name, value, usage)\n}", "title": "" }, { "docid": "20a3df3fb2da0254a5644bc97d1dd182", "score": "0.5387164", "text": "func (pc *programCode) initVar(s, k string) {\n\tpc.code += \"\\tmov rax, \" + k + \"\\t; newVar \\n\\tmov [\" + s + \"], rax\\n\" // start with these instructions\n}", "title": "" }, { "docid": "b163205c8f38f8395303b7c574292172", "score": "0.5384626", "text": "func Var(name string) Formula {\n\treturn pbVar(name)\n}", "title": "" }, { "docid": "2fecddecbaf5bfda8e42e1fef594b3ce", "score": "0.5382151", "text": "func (ctb *CreateTableBuilder) Var(arg interface{}) string {\n\treturn ctb.args.Add(arg)\n}", "title": "" }, { "docid": "bc22884816e77fae4533799294ad5a95", "score": "0.5373028", "text": "func Int(key string, val int) Tag {\n\treturn Int64(key, int64(val))\n}", "title": "" }, { "docid": "03fa56684b239ca08145f6af72101eaf", "score": "0.53622735", "text": "func Int(f string) Interface {\n\treturn &valueType{\n\t\tname: f,\n\t\tempty: 0,\n\t\tget: func(g Getter) interface{} {\n\t\t\treturn g.GetInt(f)\n\t\t},\n\t}\n}", "title": "" }, { "docid": "746644c9fb503f10a9c588072b267d7d", "score": "0.53224576", "text": "func Int(name string, defs ...int) int {\n\tvar def int\n\tfor _, d := range defs {\n\t\tdef = d\n\t\tbreak\n\t}\n\tv := Raw(name)\n\ti, err := strconv.Atoi(v)\n\tif err != nil {\n\t\treturn def\n\t}\n\treturn i\n}", "title": "" }, { "docid": "ae11fc2a2fb9c72c93d82278023b8d9f", "score": "0.5321034", "text": "func (s *state) varValue(name string) reflect.Value {\n\tfor i := s.mark() - 1; i >= 0; i-- {\n\t\tif s.vars[i].name == name {\n\t\t\treturn s.vars[i].value\n\t\t}\n\t}\n\ts.errorf(\"undefined variable: %s\", name)\n\treturn zero\n}", "title": "" }, { "docid": "5b7bbde05cbc0c8c2e31241b75bb4432", "score": "0.5307919", "text": "func (v *Value) Int() int {\n return Util.ToInt(v.data)\n}", "title": "" }, { "docid": "9ffcc703726f6007c4627f79deffacec", "score": "0.53066707", "text": "func (f *FlagSet) Int64Var(p *int64, name string, alias rune, value int64, usage string, fn Callback) {\n\tf.Var(newInt64Value(value, p), name, alias, usage, fn)\n}", "title": "" }, { "docid": "422dfc7c18b69f664f9da52a7ceb23af", "score": "0.53044415", "text": "func (b *BrainFuck) val() int {\n\treturn b.memory.cell[b.cur()]\n}", "title": "" }, { "docid": "8558dc5892edb332f5d91ecde3800007", "score": "0.528789", "text": "func Make_Tv_Int(val int) *vector_tile.Tile_Value {\n\ttv := new(vector_tile.Tile_Value)\n\tt := int64(val)\n\ttv.SintValue = &t\n\treturn tv\n}", "title": "" }, { "docid": "8558dc5892edb332f5d91ecde3800007", "score": "0.528789", "text": "func Make_Tv_Int(val int) *vector_tile.Tile_Value {\n\ttv := new(vector_tile.Tile_Value)\n\tt := int64(val)\n\ttv.SintValue = &t\n\treturn tv\n}", "title": "" }, { "docid": "6fee410f4c4c20e7ae956b52d74e9b22", "score": "0.5278026", "text": "func (ev binlogEvent) IntVar(f BinlogFormat) (byte, uint64, error) {\n\tdata := ev.Bytes()[f.HeaderLength:]\n\n\ttyp := data[0]\n\tif typ != IntVarLastInsertID && typ != IntVarInsertID {\n\t\treturn 0, 0, vterrors.Errorf(vtrpc.Code_INTERNAL, \"invalid IntVar ID: %v\", data[0])\n\t}\n\n\tvalue := binary.LittleEndian.Uint64(data[1 : 1+8])\n\treturn typ, value, nil\n}", "title": "" }, { "docid": "9718790039651071db109dd6bb542d1e", "score": "0.52683026", "text": "func FlagVar(r *image.Rectangle, name string, def image.Rectangle, usage string) {\n\tdefineFlag(nil, r, name, def, usage)\n}", "title": "" }, { "docid": "fa24f8c675bc963a288ee2bdbc3c88c7", "score": "0.5262462", "text": "func UintVar(p *uint, name string, value uint, usage string) {\n\tCommandLine.VarP(newUintValue(value, p), name, \"\", usage)\n}", "title": "" }, { "docid": "fd47814877a423f606f5e80a087461fc", "score": "0.52551156", "text": "func (ds Dataset) Var(name string) (v Var, err error) {\n\tcname := C.CString(name)\n\tdefer C.free(unsafe.Pointer(cname))\n\tvar id C.int\n\terr = newError(C.nc_inq_varid(C.int(ds), cname, &id))\n\tv = Var{ds, id}\n\treturn\n}", "title": "" }, { "docid": "54040e82ac06cf3886b78a0d067c0f1f", "score": "0.52507925", "text": "func main() {\n\tvar x = 10 //Integer\n\tfmt.Println(x)\n\n\t//y = 20 // Static Programming Language\n\n\t// The var keyword can be used outside the main function but in case of the short decalaration we cant use outside the main.\n\t//The scope of the var is all through the program.\n\tfmt.Println(y)\n\tfmt.Printf(\"%T\\n\", y)\n\tfmt.Println(z1)\n\tfmt.Println(z2)\n\tfmt.Println(z3)\n\n\tb = 11\n\tfmt.Println(b)\n\tfmt.Printf(\"%T\\n\", b)\n\n\tz1 = int(b) //Conversion or Casting both are same\n}", "title": "" }, { "docid": "d492688f92f9701e469a19954090da3a", "score": "0.52400506", "text": "func main(){\n\tx := 0\n\tchangeXVal(x)//Send value of x\n\tfmt.Println(\"x =\", x)\n}", "title": "" }, { "docid": "420acf674cd7b6abae64fb4160af0ee9", "score": "0.52379674", "text": "func RestIntsVar(register Register, p *[]int, name string, options ...RestOptionApplyer) error {\n\treturn RestVar(register, newIntValues(p), name, options...)\n}", "title": "" }, { "docid": "99228464f6725911caea4eb4158b7973", "score": "0.5233766", "text": "func (fi *funcInfo) emitVararg(line, a, n int) {\r\n\tfi.emitABC(line, OP_VARARG, a, n+1, 0)\r\n}", "title": "" }, { "docid": "954ef035c0f98e65255fc24dec3ca228", "score": "0.52330154", "text": "func declaringvars(){\n\t// Declaring int variable\n\tvar x int\n\tx=20\n\n\t// Declare and Initialize variable\n\tvar y int = 50\t// Declaration & Initialization\n\tvar z=55\t// No explicit type declaration\n\tyz := 60\t// Declare and Initialize without using 'var' keyword\n\n\t// Multiple values to multiple variables\n\tvar a,b = 70,\"Rakesh\"\n\n\tfmt.Println(\"x = \",x,\" y = \",y,\" z = \",z,\" yz = \",yz,\" a = \",a,\" b = \",b)\n}", "title": "" }, { "docid": "69baabe7e03d9789e374775980c05878", "score": "0.5227348", "text": "func (fn *formulaFuncs) VAR(argsList *list.List) formulaArg {\n\treturn fn.vars(\"VAR\", argsList)\n}", "title": "" }, { "docid": "ac7a4d0d70b2c08d13f52a2139f35d03", "score": "0.52250826", "text": "func checkVal2(x int) {\n\tswitch 10 {\n\tcase x:\n\t\tfmt.Println(\"x = 10\")\n\tdefault:\n\t\tfmt.Println(\"x does not equal 10\")\n\t}\n}", "title": "" }, { "docid": "32ecdb1c221689560a39e8849f7cd17e", "score": "0.52110934", "text": "func UintVar(p *uint, name string, value uint, usage string) {\n\tadd(name, newUintValue(value, p), usage)\n}", "title": "" }, { "docid": "3a975a0dc05099668e2b30f5f9dd283a", "score": "0.5209286", "text": "func (v *Validator) Var(value, tag string) (bool, error) {\n\tif err := v.Validate.Var(value, tag); err != nil {\n\t\treturn false, fmt.Errorf(\"invalid variable: %w\", fmt.Errorf(\"invalid validation on value %s using tag %s\", value, tag))\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "dad9337f9c3c5b1ec43f0e60a05b4776", "score": "0.52067655", "text": "func Val(value byte, bit byte) byte {\n\treturn (value >> bit) & 1\n}", "title": "" }, { "docid": "a34d6a1695d9c49eed98a1438e49118e", "score": "0.52060944", "text": "func Int() int {\n\treturn 111\n}", "title": "" }, { "docid": "bc2f9dc0800cb09d68756b3cc420266e", "score": "0.5202269", "text": "func Int64(name string, value int64, usage string) *int64 {\n\tp := new(int64);\n\tInt64Var(p, name, value, usage);\n\treturn p;\n}", "title": "" }, { "docid": "0b64efa27ac21d5d2df900ee152b2a91", "score": "0.5200149", "text": "func (v *ValueGetter) Int(defVal ...int) int {\n\tdef := 0\n\tif len(defVal) == 1 {\n\t\tdef = defVal[0]\n\t}\n\n\tif v.Value == nil || v.Arrayed {\n\t\treturn def\n\t}\n\n\tif str, ok := v.Value.(string); ok {\n\t\tval, err := strconv.Atoi(str)\n\t\tif err != nil {\n\t\t\treturn val\n\t\t}\n\t}\n\n\treturn def\n}", "title": "" }, { "docid": "b0812d1077e451f83d916f1a373d342b", "score": "0.51981086", "text": "func (v Value2) Get() any { return int(v) }", "title": "" }, { "docid": "db8239595be597c1ad4ca5236f17405d", "score": "0.51933014", "text": "func (p *Parser) varset(tokens []obj.Token) {\n\tvar (\n\t\tenumVal *oop.Val\n\t\tselections interface{}\n\t\tvalTokens []obj.Token\n\t\tsetter obj.Token\n\t)\n\tbraceCount := 0\n\tlastOpenBrace := -1\n\tfor i, tk := range tokens {\n\t\tif tk.Type == fract.Brace {\n\t\t\tswitch tk.Val {\n\t\t\tcase \"[\":\n\t\t\t\tbraceCount++\n\t\t\t\tif braceCount == 1 {\n\t\t\t\t\tlastOpenBrace = i\n\t\t\t\t}\n\t\t\tcase \"]\":\n\t\t\t\tbraceCount--\n\t\t\t}\n\t\t}\n\t\tif braceCount > 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif tk.Type == fract.Operator && tk.Val[len(tk.Val)-1] == '=' {\n\t\t\tsetter = tk\n\t\t\tif lastOpenBrace == -1 {\n\t\t\t\tenumVal = p.processValuePart(valuePartInfo{mut: true, tokens: tokens[:i]})\n\t\t\t\tvalTokens = tokens[i+1:]\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tenumVal = p.processValuePart(valuePartInfo{mut: true, tokens: tokens[:lastOpenBrace]})\n\t\t\tvalTokens = tokens[lastOpenBrace+1 : i-1]\n\t\t\t// Index value is empty?\n\t\t\tif len(valTokens) == 0 {\n\t\t\t\tfract.IPanic(setter, obj.SyntaxPanic, \"Index is not given!\")\n\t\t\t}\n\t\t\tselections = enumerableSelections(*enumVal, *p.processValTokens(valTokens), setter)\n\t\t\tvalTokens = tokens[i+1:]\n\t\t\tbreak\n\t\t}\n\t}\n\tif len(valTokens) == 0 {\n\t\tfract.IPanicC(setter.File, setter.Line, setter.Column+len(setter.Val), obj.SyntaxPanic, \"Value is not given!\")\n\t}\n\t// Check const state.\n\tif enumVal.Const {\n\t\tfract.IPanic(setter, obj.SyntaxPanic, \"Values is cannot changed of constant defines!\")\n\t}\n\tval := *p.processValTokens(valTokens)\n\tif val.Data == nil {\n\t\tfract.IPanic(setter, obj.ValuePanic, \"Invalid value!\")\n\t}\n\toperator := obj.Token{Val: string(setter.Val[:len(setter.Val)-1])}\n\tif selections == nil {\n\t\tswitch setter.Val {\n\t\tcase \"=\": // =\n\t\t\t*enumVal = val\n\t\tdefault: // Other assignments.\n\t\t\t*enumVal = arithmeticProcess{\n\t\t\t\toperator: operator,\n\t\t\t\tleft: tokens,\n\t\t\t\tleftVal: *enumVal,\n\t\t\t\tright: []obj.Token{setter},\n\t\t\t\trightVal: val,\n\t\t\t}.solve()\n\t\t}\n\t\treturn\n\t}\n\tswitch enumVal.Type {\n\tcase oop.Map:\n\t\tm := enumVal.Data.(oop.MapModel)\n\t\tswitch setter.Val {\n\t\tcase \"=\":\n\t\t\tswitch t := selections.(type) {\n\t\t\tcase oop.ListModel:\n\t\t\t\tfor _, key := range t.Elems {\n\t\t\t\t\tm.Map[key] = val\n\t\t\t\t}\n\t\t\tcase oop.Val:\n\t\t\t\tm.Map[t] = val\n\t\t\t}\n\t\tdefault: // Other assignments.\n\t\t\tswitch t := selections.(type) {\n\t\t\tcase oop.ListModel:\n\t\t\t\tfor _, key := range t.Elems {\n\t\t\t\t\tv, ok := m.Map[key]\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\tm.Map[key] = val\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tm.Map[key] = arithmeticProcess{\n\t\t\t\t\t\toperator: operator,\n\t\t\t\t\t\tleft: tokens,\n\t\t\t\t\t\tleftVal: v,\n\t\t\t\t\t\tright: []obj.Token{setter},\n\t\t\t\t\t\trightVal: val,\n\t\t\t\t\t}.solve()\n\t\t\t\t}\n\t\t\tcase oop.Val:\n\t\t\t\td, ok := m.Map[t]\n\t\t\t\tif !ok {\n\t\t\t\t\tm.Map[t] = val\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tm.Map[t] = arithmeticProcess{\n\t\t\t\t\toperator: operator,\n\t\t\t\t\tleft: tokens,\n\t\t\t\t\tleftVal: d,\n\t\t\t\t\tright: []obj.Token{setter},\n\t\t\t\t\trightVal: val,\n\t\t\t\t}.solve()\n\t\t\t}\n\t\t}\n\tcase oop.List:\n\t\tfor _, i := range selections.([]int) {\n\t\t\tswitch setter.Val {\n\t\t\tcase \"=\":\n\t\t\t\tenumVal.Data.(*oop.ListModel).Elems[i] = val\n\t\t\tdefault: // Other assignments.\n\t\t\t\tenumVal.Data.(*oop.ListModel).Elems[i] = arithmeticProcess{\n\t\t\t\t\toperator: operator,\n\t\t\t\t\tleft: tokens,\n\t\t\t\t\tleftVal: enumVal.Data.(*oop.ListModel).Elems[i],\n\t\t\t\t\tright: []obj.Token{setter},\n\t\t\t\t\trightVal: val,\n\t\t\t\t}.solve()\n\t\t\t}\n\t\t}\n\tcase oop.String:\n\t\tfor _, i := range selections.([]int) {\n\t\t\tswitch setter.Val {\n\t\t\tcase \"=\":\n\t\t\t\tif val.Type != oop.String {\n\t\t\t\t\tfract.IPanic(setter, obj.ValuePanic, \"Value type is not string!\")\n\t\t\t\t} else if len(val.String()) > 1 {\n\t\t\t\t\tfract.IPanic(setter, obj.ValuePanic, \"Value length is should be maximum one!\")\n\t\t\t\t}\n\t\t\t\tbytes := []byte(enumVal.String())\n\t\t\t\tif val.Data == \"\" {\n\t\t\t\t\tbytes[i] = 0\n\t\t\t\t} else {\n\t\t\t\t\tbytes[i] = val.String()[0]\n\t\t\t\t}\n\t\t\t\tenumVal.Data = string(bytes)\n\t\t\tdefault: // Other assignments.\n\t\t\t\tval = arithmeticProcess{\n\t\t\t\t\toperator: operator,\n\t\t\t\t\tleft: tokens,\n\t\t\t\t\tleftVal: oop.Val{Data: enumVal.Data.(string)[i], Type: oop.Int},\n\t\t\t\t\tright: []obj.Token{setter},\n\t\t\t\t\trightVal: val,\n\t\t\t\t}.solve()\n\t\t\t\tif val.Type != oop.String {\n\t\t\t\t\tfract.IPanic(setter, obj.ValuePanic, \"Value type is not string!\")\n\t\t\t\t} else if len(val.String()) > 1 {\n\t\t\t\t\tfract.IPanic(setter, obj.ValuePanic, \"Value length is should be maximum one!\")\n\t\t\t\t}\n\t\t\t\tbytes := []byte(enumVal.String())\n\t\t\t\tif val.Data == \"\" {\n\t\t\t\t\tbytes[i] = 0\n\t\t\t\t} else {\n\t\t\t\t\tbytes[i] = val.String()[0]\n\t\t\t\t}\n\t\t\t\tenumVal.Data = string(bytes)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "586f991156443cf7f395bb7c455d5253", "score": "0.5180353", "text": "func (cpu *CPU) v(i *Insn, v int4) (val int32) {\r\n\tif v == 3 {\r\n\t\tval = int32(i.cg2v())\r\n\t} else {\r\n\t\tval = int32(cpu.regs[v])\r\n\t}\r\n\r\n\treturn\r\n}", "title": "" }, { "docid": "7fe8946cd233c38386dc97da7bc85104", "score": "0.5177098", "text": "func Var(props *VarProps, children ...Element) *VarElem {\n\trProps := &_VarProps{\n\t\tBasicHTMLElement: newBasicHTMLElement(),\n\t}\n\n\tif props != nil {\n\t\tprops.assign(rProps)\n\t}\n\n\treturn &VarElem{\n\t\tElement: createElement(\"var\", rProps, children...),\n\t}\n}", "title": "" }, { "docid": "d0dddfb3e2fb01a3b5b46e4f7657f101", "score": "0.5170009", "text": "func (ds Dataset) VarN(id int) Var {\n\treturn Var{ds, C.int(id)}\n}", "title": "" }, { "docid": "071d743014d65b462c90ce0bd77b48d4", "score": "0.51691633", "text": "func importvar(pos src.XPos, s *types.Sym, t *types.Type) *ir.Name {\n\treturn importobj(pos, s, ir.ONAME, ir.PEXTERN, t)\n}", "title": "" }, { "docid": "ed4b5573ac185b3c23d12be4e9b0668a", "score": "0.51678866", "text": "func (n name) readVarint(off int) (int, int) {\n\tv := 0\n\tfor i := 0; ; i++ {\n\t\tx := *n.data(off+i, \"read varint\")\n\t\tv += int(x&0x7f) << (7 * i)\n\t\tif x&0x80 == 0 {\n\t\t\treturn i + 1, v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "38b7e87d8eb981097341b368c5adf5dc", "score": "0.5167366", "text": "func (i *MyInt) set(x int) {\n\t*i = MyInt(x)\n}", "title": "" } ]
55faf7192a30606d454eebe89e90c59c
Create creates a match in the database
[ { "docid": "4e15c33e2b0355b45d352533f4d3380d", "score": "0.684373", "text": "func (c Match) Create(gid, id int, datePlayed time.Time) revel.Result {\n\tusername, _ := c.Session.Get(\"user\")\n\n\tc.Validation.Required(datePlayed).Message(\"Must have a date played\")\n\n\tc.Validation.Required(username != nil).Message(\"You must be signed in to create a match\")\n\n\tif c.Validation.HasErrors() {\n\t\tc.Validation.Keep()\n\t\tc.FlashParams()\n\t\treturn c.Redirect(Match.New, gid, id)\n\t}\n\n\tif username != nil {\n\t\tif ok, match := models.CreateMatch(id, gid, username.(string), datePlayed); ok {\n\t\t\treturn c.Redirect(Match.Show, match.ID)\n\t\t}\n\t}\n\n\tc.FlashParams()\n\treturn c.Redirect(Match.New, gid, id)\n}", "title": "" } ]
[ { "docid": "b8becccadaecb4051081d9187afee895", "score": "0.6471104", "text": "func (m *MatchData) Create(userid int64, team1id int64, team2id int64, team1string string, team2string string, maxmaps int, skipveto bool, title string, vetomappool string, serverid int64) *MatchData {\n\tm.UserID = userid\n\tm.Team1ID = team1id\n\tm.Team2ID = team2id\n\tm.SkipVeto = skipveto\n\tm.Title = title\n\tm.VetoMapPool = vetomappool // array...?\n\tm.ServerID = serverid\n\tm.MaxMaps = maxmaps\n\tm.APIKey = \"\" //random?\n\treturn m // TODO\n}", "title": "" }, { "docid": "84d99a99d059ce2b9156cd48323f8e44", "score": "0.6164434", "text": "func (gws *GameWebsocket) createMatch() error {\n\t// game, err := gws.gameService.Create()\n\t// if err != nil {\n\t// \treturn err\n\t// }\n\n\t// gameJson, err := json.Marshal(game)\n\t// if err != nil {\n\t// \treturn err\n\t// }\n\n\t//gws.write(string(gameJson))\n\treturn nil\n}", "title": "" }, { "docid": "5a848acda1ccdb996f933610551aa111", "score": "0.6060328", "text": "func (m *Match) Insert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif m._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.matches (` +\n\t\t`id, user_1_id, created_at, updated_at` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4` +\n\t\t`) RETURNING user_2_id`\n\n\t// run query\n\tXOLog(sqlstr, m.ID, m.User1ID, m.CreatedAt, m.UpdatedAt)\n\terr = db.QueryRow(sqlstr, m.ID, m.User1ID, m.CreatedAt, m.UpdatedAt).Scan(&m.User2ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\tm._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "8fdd3326717bc4c1406aaf90a98a14f5", "score": "0.5956956", "text": "func (m *Match) Save(db XODB) error {\n\tif m.Exists() {\n\t\treturn m.Update(db)\n\t}\n\n\treturn m.Insert(db)\n}", "title": "" }, { "docid": "53fc0a8fdbc102c700ce7f4facd9ff75", "score": "0.5906272", "text": "func (m *BattleModel) Create(player1ID, player1BoardID, player2ID int, secretTurn string) (int, error) {\n\tvar rowid int = 0\n\tvar battleID int = 0\n\t\n\t//fmt.Println(\"Currently, only one game per challenger/challengee pair is supported at a time.\")\n\t//fmt.Println(\"Checking to see if there is already a challenge out there...\")\n\tstmt := `SELECT rowid FROM Battles WHERE player1ID = ? AND player2ID = ? LIMIT 0, 1`\n\trows, err := m.DB.Query(stmt, player1ID, player2ID)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\terr := rows.Scan(&rowid)\n\t\tif err != nil {\n\t\t\t//fmt.Println(\"ERROR - While retrieving battleID:\", err)\n\t\t} else {\n\t\t\t//fmt.Println(\"INFO - Found a pre-existing battle for this challenger/challengee pair...\")\n\t\t\tbattleID = int(rowid)\n\t\t}\n\t}\n\tif battleID > 0 {\n\t\tstmt = `UPDATE Battles SET player1BoardID = ? WHERE player1ID = ? AND rowid = ?`\n\t\t_, err := m.DB.Exec(stmt, player1BoardID, player1ID, battleID)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\t//fmt.Println(\"INFO - Battle has been updated with fresh information...\")\n\t\treturn int(battleID), nil\n\t} else {\n\t\t//fmt.Println(\"Battle between these two players was not found.\")\n\t\t//fmt.Println(\"Creating new battle...\")\n\t\tstmt = `INSERT INTO Battles (player1ID, player1Accepted, player1BoardID, player2ID, player2Accepted, turn, secretTurn) VALUES (?, ?, ?, ?, ?, ?, ?)`\n\t\t// The opponent will always go first\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\t\n\t\tresult, err := m.DB.Exec(stmt, player1ID, 1, player1BoardID, player2ID, 0, player2ID, secretTurn)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tbattleID, err := result.LastInsertId()\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\treturn int(battleID), nil\n\t}\n}", "title": "" }, { "docid": "633d810be3a61d61f3858b23420195c1", "score": "0.572697", "text": "func (r *HousingTransfer) Create(db *sql.DB) error {\n\treturn db.QueryRow(`INSERT INTO housing_transfer(name) VALUES($1) RETURNING id`,\n\t\t&r.Name).Scan(&r.ID)\n}", "title": "" }, { "docid": "cee042c1ec058be88b21d1fd1219e135", "score": "0.5707371", "text": "func (adb AssignersDB) Create(a assigners.Assigner) (newA assigners.Assigner, err error) {\n\tquery := `\n\t\tINSERT INTO\n\t\t\tassignments(investment, success)\n\t\tVALUES\n\t\t\t($1, $2)\n\t\tRETURNING\n\t\t\tid, investment, success\n\t`\n\n\tstmt, err := adb.DB.Prepare(query)\n\tif err != nil {\n\t\terr = errorPrepare(err)\n\t\treturn\n\t}\n\tdefer stmt.Close()\n\n\terr = stmt.QueryRow(\n\t\ta.Investment,\n\t\ta.Success,\n\t).Scan(\n\t\t&newA.ID,\n\t\t&newA.Investment,\n\t\t&newA.Success,\n\t)\n\tif err != nil {\n\t\terr = errorQuery(err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "690395570d3631a25e075bcad5c97377", "score": "0.56901854", "text": "func (g *GroupsRepo) Create(group *models.Group) (*models.Group, error) {\n _, err := g.DB.Model(group).Returning(\"*\").Insert()\n return group, err\n}", "title": "" }, { "docid": "fff3b10a6dc182f8fa07a2f0be8080ee", "score": "0.5619595", "text": "func (s *MatchService) AddMatches(matches []models.Match) error {\n\ts.log.Infof(\"adding %d matches\", len(matches))\n\tvar err error\n\tvar rikishis map[string]models.Rikishi\n\tif rikishis, err = s.rikishiService.GetRikishiMappedByName(); err != nil {\n\t\ts.log.Errorf(\"error getting rikishis by name: %s\", err)\n\t\treturn err\n\t}\n\tvar tournaments map[string]models.Tournament\n\tif tournaments, err = s.tournamentService.GetTournamentsByName(); err != nil {\n\t\ts.log.Errorf(\"error getting tournaments by name: %s\", err)\n\t\treturn err\n\t}\n\tif err = s.db.Create(matches).Error; err != nil {\n\t\ts.log.Errorf(\"error creating matches: %s\", err)\n\t\treturn err\n\t}\n\n\tfor _, match := range matches {\n\t\tif tournament, ok := tournaments[match.Tournament]; !ok {\n\t\t\ts.log.Infof(\"unknown tournament '%s'\", match.Tournament)\n\t\t} else {\n\t\t\ts.log.Infof(\"binding tournament %s to match\", match.Tournament)\n\t\t\ts.db.Model(&tournament).Association(\"Matches\").Append(&match)\n\t\t}\n\t\tif match.Winner != \"\" {\n\t\t\tif rikishi, ok := rikishis[match.Winner]; !ok {\n\t\t\t\ts.log.Infof(\"unknown winning rikishi '%d' for match\", match.Winner)\n\t\t\t} else {\n\t\t\t\ts.log.Infof(\"binding winning rikishi '%d' for match\", rikishi.ID)\n\t\t\t\tmatch.WinnerID = rikishi.ID\n\t\t\t\tif err = s.db.Save(&match).Error; err != nil {\n\t\t\t\t\ts.log.Errorf(\"error saving match: %s\", err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif rikishi, ok := rikishis[match.East]; !ok {\n\t\t\ts.log.Infof(\"unknown east rikishi '%s' for match\", match.East)\n\t\t} else {\n\t\t\ts.log.Infof(\"binding east rikishi '%s' to match\", match.East)\n\t\t\tif err = s.db.Model(&rikishi).Association(\"EastMatches\").Append(&match); err != nil {\n\t\t\t\ts.log.Errorf(\"error while binding east rikishi '%s' to match: %s\", match.East, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif rikishi, ok := rikishis[match.West]; !ok {\n\t\t\ts.log.Infof(\"unknown west rikishi '%s' for match\", match.West)\n\t\t} else {\n\t\t\ts.log.Infof(\"binding west rikishi '%s' to match\", match.West)\n\t\t\tif err = s.db.Model(&rikishi).Association(\"WestMatches\").Append(&match); err != nil {\n\t\t\t\ts.log.Errorf(\"error while binding west rikishi '%s' to match: %s\", match.West, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, tournament := range tournaments {\n\t\tif err = s.db.Save(&tournament).Error; err != nil {\n\t\t\ts.log.Errorf(\"error while saving tournament updates: %s\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\tfor _, rikishi := range rikishis {\n\t\tif err = s.db.Save(&rikishi).Error; err != nil {\n\t\t\ts.log.Errorf(\"error while saving rikishi updates: %s\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\ts.log.Infof(\"successfully added %d matches\", len(matches))\n\treturn nil\n}", "title": "" }, { "docid": "f1b079c7c80fe20757b9ca8cd417abe4", "score": "0.56065255", "text": "func createMatchIndex(stub shim.ChaincodeStubInterface, match Match) error {\n\tlogger.Debug(\"createIndex(MatchID=\" + match.ID + \") : calling method -\")\n\tindexActiveKey, err := stub.CreateCompositeKey(indexMatch, []string{match.DocType, match.ID})\n\tif err != nil {\n\t\tlogger.Error(err.Error())\n\t\treturn err\n\t}\n\tstub.PutState(indexActiveKey, []byte{0x00})\n\treturn nil\n}", "title": "" }, { "docid": "d240da110ec4b68774f437bff3420536", "score": "0.5601426", "text": "func (v TeamsResource) Create(c buffalo.Context) error {\n\tif helpers.IsSuperAdminOrRedirect(c) != nil {\n\t\treturn nil\n\t}\n\n\t// Allocate an empty Team\n\tteam := &models.Team{}\n\n\t// Bind team to the html form elements\n\tif err := c.Bind(team); 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(team)\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, team))\n\t}\n\n\t// If there are no errors set a success message\n\tc.Flash().Add(\"success\", \"Team was created successfully\")\n\n\t// and redirect to the teams index page\n\treturn c.Render(200, r.Auto(c, team))\n}", "title": "" }, { "docid": "67e54eec6ee779fa46a7b69a81e607aa", "score": "0.5559922", "text": "func (dao *StringModelDAO) Create(m *StringModel) {\n dao.db.Create(m)\n}", "title": "" }, { "docid": "c50f025b5a56df92a86647b7c63adc69", "score": "0.5553759", "text": "func (handler *OfferHandler) InsertOfferMatch(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\t// Gets offer id\n\tofferid := vars[\"offerid\"]\n\t// Gets user id\n\tidStr := vars[\"userid\"]\n\n\tuid64, err := strconv.ParseInt(idStr, 10, 32)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Errorf(\"%s:%s\", errors.QueryParameterError, err.Error()).Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tuserid := int(uid64)\n\n\terr = handler.offerController.InsertOfferMatch(userid, offerid)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Errorf(\"%s:%s\", errors.DBQueryError, err.Error()).Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "3d1b2264e8360bf8021ea7ac691450e6", "score": "0.5551349", "text": "func putPurchaseMatchRecord(c *datastore.Client, r *PurchaseMatchRecord) (err error) {\n\tctx := context.Background()\n\tkey, err := getOrMakeKey(ctx, c, kindPurchaseMatchRecord, r.ID, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.ID = key.Name\n\tif _, err = c.Put(ctx, key, r); err != nil {\n\t\tlog.Error(err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "72085245f7beeca289b50115c9d884f2", "score": "0.55338055", "text": "func CreateNew(golfer string) string {\n\tnewID := bson.NewObjectId()\n\tcurrentdate := time.Now().Format(\"2006-01-02\")\n\tplayerone := &Person{ID: newID, Date: currentdate, Name: golfer, CurHole: \"Hole 1\"}\n\tif err := moncol.Insert(playerone); err != nil {\n\t\tlog.Fatalf(\"Couldn't Create new round for %v\", golfer)\n\t}\n\treturn newID.Hex()\n}", "title": "" }, { "docid": "0de47ce80d85fb035043170b4d3bfed3", "score": "0.55209106", "text": "func (i *Invite) Create() error {\n\treturn dbmap.Insert(i)\n}", "title": "" }, { "docid": "73c49aa8a03e55ab3cb1e1a28e344988", "score": "0.54808104", "text": "func CreateGameHandler(w http.ResponseWriter, r *http.Request) {\n var game Game\n defer r.Body.Close()\n err := json.NewDecoder(r.Body).Decode(&game)\n if err != nil {\n w.WriteHeader(http.StatusBadRequest)\n json.NewEncoder(w).Encode(\n &JsonErr{Error: \"unable to create game, please check your data\"},\n )\n return\n }\n\n var lastInsertId int\n err = db.QueryRow(\n \"INSERT INTO games(title, console, rating, complete, created, updated) VALUES($1, $2, $3, $4, $5, $5) returning id\",\n game.Title,\n game.Console,\n game.Rating,\n game.Complete,\n time.Now(),\n ).Scan(&lastInsertId)\n if err != nil {\n w.WriteHeader(http.StatusBadRequest)\n json.NewEncoder(w).Encode(\n &JsonErr{Error: \"unable to write to database: \" + err.Error()},\n )\n return\n }\n\n game = Game{}\n db.QueryRow(\"SELECT * FROM games g WHERE g.id = $1\", lastInsertId).Scan(\n &game.ID,\n &game.Title,\n &game.Console,\n &game.Rating,\n &game.Complete,\n &game.Created,\n &game.Updated,\n )\n\n w.WriteHeader(http.StatusCreated)\n json.NewEncoder(w).Encode(&game)\n}", "title": "" }, { "docid": "08bd9f016ac18a496d1b5d7ca5be1ee8", "score": "0.5423308", "text": "func (m *BoardModel) Create(rowid int, boardName string) (int, error) {\n\tvar boardID int64\n\t// first check to make sure a board with the same name doesn't already exist\n\tstmt := `SELECT rowid FROM Boards WHERE boardName = ? AND playerID = ?`\n\terr := m.DB.QueryRow(stmt, boardName, rowid).Scan(boardID)\n\tif err != nil && err.Error() != \"sql: no rows in result set\" {\n\t\tfmt.Println(\"[ERROR] Error encountered, returning to calling func:\", err.Error())\n\t\treturn 0, err\n\t} else if boardID > 0 {\n\t\tfmt.Println(\"Found existing board, returning its id\")\n\t\treturn int(boardID), nil\n\t}\n\tfmt.Println(\"Creating new board...\")\n\tstmt = `INSERT INTO Boards (boardName, playerID) VALUES (?, ?)`\n\tresult, err := m.DB.Exec(stmt, boardName, rowid)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tboardID, err = result.LastInsertId() // confirmed! sqlite3 driver has this functionality!\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn int(boardID), nil\n}", "title": "" }, { "docid": "48da5d1c2be8af0687d2e3806618c90f", "score": "0.53959554", "text": "func NewMatch(column string) *Match {\n\treturn &Match{\n\t\tcolumn: column,\n\t}\n}", "title": "" }, { "docid": "93ae38989717f13feaba4c86ff8782e7", "score": "0.53843796", "text": "func (p *Plan) Create(db *sql.DB) (err error) {\n\terr = db.QueryRow(`INSERT INTO plan (name, descript,first_year,last_year) \n\tVALUES($1,$2,$3,$4) RETURNING id`, p.Name, p.Descript, p.FirstYear, p.LastYear).Scan(&p.ID)\n\treturn err\n}", "title": "" }, { "docid": "8dd5c0f10e0a382cc3e9b806ce6b62c6", "score": "0.5382937", "text": "func (repository *VehicleRepository) Create(vehicle *pb.Vehicle) error {\n\t_, err := repository.collection.InsertOne(context.TODO(), vehicle)\n\treturn err\n}", "title": "" }, { "docid": "2a62f0348431acf3fb827611f4b94f5d", "score": "0.53406405", "text": "func (r repository) Create(ctx context.Context, short entity.Short) error {\n\treturn r.db.With(ctx).Model(&short).Insert()\n}", "title": "" }, { "docid": "6c6f4222b56c76e65590f097393e67e4", "score": "0.5334646", "text": "func (u *Rider) Create() error {\n\tstmt, err := db.Prepare(`INSERT INTO rider (id, fullname, email, \n\t\tphonenumber, password_, paymentmethod, isactive) VALUES($1,$2,$3,$4,$5,$6,$7)`)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = stmt.Exec(u.ID, u.FullName, u.Email, u.Phonenumber, u.Password, u.PaymentMethod, u.IsActive)\n\treturn err\n}", "title": "" }, { "docid": "62a0bf6c0def2332f216590e88b8cd03", "score": "0.5321991", "text": "func (h *Handler) Create(w http.ResponseWriter, r *http.Request) {\n\tvar act types.Activity\n\n\tif err := json.NewDecoder(r.Body).Decode(&act); err != nil {\n\t\tif err == io.EOF {\n\t\t\trespond.Error(w, errors.New(\"Invalid request method\"), http.StatusMethodNotAllowed)\n\t\t\treturn\n\t\t}\n\t\trespond.Error(w, err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tdefer r.Body.Close()\n\n\tif id, err := h.srv.Create(r.Context(), act); err != nil {\n\t\trespond.Error(w, err, http.StatusInternalServerError)\n\t\treturn\n\t} else {\n\t\tact.ID = id\n\t}\n\n\trespond.JSON(w, http.StatusCreated, map[string]string{\"id\": act.ID})\n}", "title": "" }, { "docid": "ac54ff68e61cc715e9645baf1634884b", "score": "0.53081757", "text": "func NewMatch(dataStorage *module.DataStorage) module.Match {\n\treturn &Match{\n\t\tdb: dataStorage.DB,\n\t\tcache: dataStorage.Cache,\n\t}\n}", "title": "" }, { "docid": "6d06b15b44e32a1df9049476268d9ecc", "score": "0.5292429", "text": "func (v RoutesResource) Create(c buffalo.Context) error {\n\t// Allocate an empty Route\n\troute := &models.Route{}\n\n\t// Bind route to the html form elements\n\tif err := c.Bind(route); err != nil {\n\t\treturn err\n\t}\n\n\tuser := currentUser(c)\n\troute.UserID = user.ID\n\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\t// Validate the data from the html form\n\tverrs, err := tx.ValidateAndCreate(route)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif verrs.HasAny() {\n\t\treturn c.Render(http.StatusUnprocessableEntity, r.JSON(verrs))\n\t}\n\n\treturn c.Render(http.StatusCreated, r.JSON(route))\n}", "title": "" }, { "docid": "4f6186a77e4c788d87ab4a49e02bd61d", "score": "0.5283403", "text": "func (*TalkRegistrationController) Create(writer http.ResponseWriter, request *http.Request) {\n\ttalkRegistrationToCreate := model.NewTalkRegistration()\n\n\tdecoder := json.NewDecoder(request.Body)\n\terr := decoder.Decode(&talkRegistrationToCreate)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\texists, err := checkIfRegistrationExists(talkRegistrationToCreate)\n\tif err != nil {\n\t\tutil.ErrHandler(err, writer, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tinstance, err := database.GetTalkDatabaseManagerInstance()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif exists {\n\n\t\terr = instance.CreateTemporaryTalkRegistrationChange(talkRegistrationToCreate)\n\t\tif err != nil {\n\t\t\tutil.ErrHandler(err, writer, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\terr = sendEmailForTalkRegistrationReplacementConfirmation(talkRegistrationToCreate)\n\t\twriter.WriteHeader(http.StatusOK)\n\t} else {\n\t\ttalkRegistrationLogToCreate := model.NewTalkRegistrationLogWithTalkRegistration(talkRegistrationToCreate, 0)\n\n\t\tinstance.SaveTalkRegistration(talkRegistrationToCreate)\n\t\tinstance.SaveTalkRegistrationLog(talkRegistrationLogToCreate)\n\t\twriter.WriteHeader(http.StatusCreated)\n\t}\n\n}", "title": "" }, { "docid": "d934276cc6b3e06603dc28906a5e35d3", "score": "0.52803135", "text": "func (q *Query) Create(values ...interface{}) (*types.Result, error) {\n\tif q.err != nil {\n\t\treturn nil, q.err\n\t}\n\n\tvar model Model\n\tif len(values) > 0 {\n\t\tmodel = Scan(values...)\n\t} else {\n\t\tmodel = q.model\n\t}\n\n\treturn q.db.Query(model, insertQuery{Query: q}, q.model)\n}", "title": "" }, { "docid": "448de836893a0f254e2c9a64c1287cf0", "score": "0.5268531", "text": "func (o *Database) Create() (*restapi.StringResponse, error) {\n\tvar queryArg = make(map[string]interface{})\n\tqueryArg, err := generateRequestMap(o)\n\tif err != nil {\n\t\tlogger.Errorf(err.Error())\n\t\treturn nil, err\n\t}\n\n\tlogger.Debugf(\"Generated Map for Create(): %+v\", queryArg)\n\tresp, err := o.client.CallStringAPI(o.apiCreate, queryArg)\n\tif err != nil {\n\t\tlogger.Errorf(err.Error())\n\t\treturn nil, err\n\t}\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\t// Assign ID after successful creation so that the same object can be used for subsequent update operation\n\to.ID = resp.Result\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "fd755e67eae858aa388e0acabc5066b4", "score": "0.525835", "text": "func Create(v interface{}) error {\n\treturn WithinTransaction(func(tx *gorm.DB) (err error) {\n\t\t// check new object\n\t\tif !cgorm.DBManager().NewRecord(v) {\n\t\t\treturn err\n\t\t}\n\t\tif err = tx.Create(v).Error; err != nil {\n\t\t\ttx.Rollback() // rollback\n\t\t\treturn err\n\t\t}\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "4513b0ab30713c7d43f8ba3f0ae168f0", "score": "0.52485543", "text": "func (*Fruits) Create(fruit *Fruits) (int64, error) {\n\n\tstmt, err := db.Prepare(\n\t\t\"insert into fruits (name, harvest, initials, date_created) \" +\n\t\t\t\"values ($1, $2, $3, now()) returning id\")\n\n\tif err != nil {\n\t\tlog.Println(\"(CreateFruit:Prepare)\", err)\n\t\treturn -1, err\n\t}\n\n\tdefer stmt.Close()\n\n\terr = stmt.QueryRow(fruit.Name,\n\t\tfruit.Harvest,\n\t\tfruit.Initials).Scan(&fruit.ID)\n\n\tif err != nil {\n\t\tlog.Println(\"(CreateFruit:Exec)\", err)\n\t\treturn -1, err\n\t}\n\n\treturn fruit.ID, nil\n\n}", "title": "" }, { "docid": "2eea6f39b97530fc749a037e5dc308bd", "score": "0.52397454", "text": "func (b *BasicCraftsman) Create(craftsman *data.Craftsman) error {\n\treturn nil\n}", "title": "" }, { "docid": "c9d314c87c95eca4e884c401ee6820d9", "score": "0.523884", "text": "func (r *teamRepository) CreateTeam(ctx context.Context, team *v1.Team) (string, error) {\n // prepare sql statements for teams, skills, members\n teamStmt := `INSERT INTO teams (leader, team_name, open_roles, size, last_active) VALUES(?, ?, ?, ?, ?)`\n memberStmt := `INSERT INTO members (user_id, member_email, team_id, member_role) VALUES %s`\n skillStmt := `INSERT INTO skills (skill_name, team_id) VALUES %s`\n\n //\n\n // start transaction\n tx, err := r.db.BeginTx(ctx, &sql.TxOptions{})\n if err != nil {\n return \"transaction begin\", err\n }\n\n // insert team into teams table capturing the id\n result, err := tx.Exec(teamStmt, team.Leader, team.Name, team.OpenRoles, team.Size, team.LastActive)\n if err != nil {\n tx.Rollback()\n return \"Exec team stmt\", err\n }\n // gather the id of the inserted team\n teamId, err := result.LastInsertId()\n if err != nil {\n tx.Rollback()\n return \"team insertId()\", err\n }\n\n // decide whether to add owner to member list in initial creation\n if len(team.Members) > 0 {\n // create bulk array insert values.\n memberStrings := []string{}\n memberArgs := []interface{}{}\n // iterate over each member and construct sql arguments\n for _, w := range team.Members {\n memberStrings = append(memberStrings, \"(?, ?, ?, ?)\")\n\n memberArgs = append(memberArgs, w.Id)\n memberArgs = append(memberArgs, w.Email)\n memberArgs = append(memberArgs, teamId)\n memberArgs = append(memberArgs, w.Role)\n }\n\n // create member sql statement\n memberStmt = fmt.Sprintf(memberStmt, strings.Join(memberStrings, \",\"))\n\n fmt.Fprintf(os.Stderr, \"memberStmt in CreateTeam: %v\\n\", memberStmt)\n\n // insert members into members table including team_id field\n _, err = tx.Exec(memberStmt, memberArgs...)\n if err != nil {\n tx.Rollback()\n return \"Exec member stmt\", err\n }\n }\n\n // create bulk array insert values.\n skillStrings := []string{}\n skillArgs := []interface{}{}\n for _, w := range team.Skills {\n skillStrings = append(skillStrings, \"(?, ?)\")\n\n skillArgs = append(skillArgs, w)\n skillArgs = append(skillArgs, teamId)\n }\n\n // create skill sql statement\n skillStmt = fmt.Sprintf(skillStmt, strings.Join(skillStrings, \",\"))\n\n // insert skills into skills table including team_id field\n _, err = tx.Exec(skillStmt, skillArgs...)\n if err != nil {\n tx.Rollback()\n return \"Exec skill stmt\", err\n }\n\n // commit transaction\n err = tx.Commit()\n if err != nil {\n return \"Commit()\", err\n }\n\n // return id of newly inserted team and no error\n return strconv.FormatInt(teamId, 10), nil\n}", "title": "" }, { "docid": "d14e73325ea69ffb3760a011f7d63d3c", "score": "0.5232142", "text": "func TestCreate_Success(t *testing.T) {\n\tdb, mock, err := sqlmock.New()\n\tif err != nil {\n\t\tt.Fatalf(\"an error '%s' was not expected when opening a stub database connection\", err)\n\t}\n\tdefer db.Close()\n\n\t// mocking for delete statement\n\tmock.ExpectExec(constants.EmployeeManagerMappingDeleteQuery).WillReturnResult(sqlmock.NewResult(0, 0))\n\n\t// mocking for insert statement\n\tmock.ExpectPrepare(regexp.QuoteMeta(constants.EmployeeManagerMappingInsertQuery)).ExpectExec().WillReturnResult(sqlmock.NewResult(0, 0))\n\n\temployeeManagerMapRepository := NewEmployeeManagerMapRepository(db)\n\tcntx := context.Background()\n\temployeeManagerMap := getTestEmployeeManagerMap()\n\n\t_, err = employeeManagerMapRepository.Create(cntx, *employeeManagerMap)\n\n\tassert.Nil(t, err)\n}", "title": "" }, { "docid": "288b7a6ce1a1ea1bd86d1ce6b7a57cb9", "score": "0.522859", "text": "func (h *Handler) Create(ctx context.Context, r *pb.Recipe) (*pb.Response, error) {\n\tres := pb.Response{}\n\n\t// create recipe in db\n\terr := DB.Insert(r)\n\tif err != nil {\n\t\tres.Errors = append(res.Errors, fmt.Sprintf(\"unable to create new recipe: %s\", err.Error()))\n\t\treturn &res, nil\n\t}\n\n\t// set res.Recipe to created recipe and return res\n\tres.Recipe = r\n\treturn &res, nil\n}", "title": "" }, { "docid": "852ce2b348e29af1ce9af0dff531cb36", "score": "0.5226648", "text": "func (s *Step) Create(db *sql.DB) (err error) {\n\terr = db.QueryRow(\"INSERT INTO step (name) VALUES($1) RETURNING id\",\n\t\ts.Name).Scan(&s.ID)\n\treturn err\n}", "title": "" }, { "docid": "d8662b65917374520a2cd3bd350b749b", "score": "0.52230406", "text": "func CreateTweet(r render.Render, db gorm.DB, tweet Tweet){\n\tdb.Create(&tweet)\n\tdb.Find(&tweet.Bot, tweet.BotID)\n\tr.JSON(201, tweet)\n}", "title": "" }, { "docid": "78428ccc9eb115da6fe0bd15267b0d62", "score": "0.5211997", "text": "func CreateGame(\n\tdb DB,\n\tpublicID, name string,\n\tlevels, metadata map[string]interface{},\n\tminLevelAccept, minLevelCreate, minLevelRemove,\n\tminOffsetRemove, minOffsetPromote, minOffsetDemote, maxMembers,\n\tmaxClans, cooldownAfterDeny, cooldownAfterDelete, cooldownBeforeApply,\n\tcooldownBeforeInvite, maxPendingInvites int, upsert bool,\n\tclanUpdateMetadataFieldsHookTriggerWhitelist string,\n\tplayerUpdateMetadataFieldsHookTriggerWhitelist string,\n) (*Game, error) {\n\tlevelsJSON, err := json.Marshal(levels)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmetadataJSON, err := json.Marshal(metadata)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsortedLevels := util.SortLevels(levels)\n\tminMembershipLevel := sortedLevels[0].Value\n\tmaxMembershipLevel := sortedLevels[len(sortedLevels)-1].Value\n\n\tquery := `\n\t\t\tINSERT INTO games(\n\t\t\t\tpublic_id,\n\t\t\t\tname,\n\t\t\t\tmin_level_to_accept_application,\n\t\t\t\tmin_level_to_create_invitation,\n\t\t\t\tmin_level_to_remove_member,\n\t\t\t\tmin_level_offset_to_remove_member,\n\t\t\t\tmin_level_offset_to_promote_member,\n\t\t\t\tmin_level_offset_to_demote_member,\n\t\t\t\tmax_members,\n\t\t\t\tmax_clans_per_player,\n\t\t\t\tmembership_levels,\n\t\t\t\tmetadata,\n\t\t\t\tcooldown_after_delete,\n\t\t\t\tcooldown_after_deny,\n\t\t\t\tcooldown_before_apply,\n\t\t\t\tcooldown_before_invite,\n\t\t\t\tmin_membership_level,\n\t\t\t\tmax_membership_level,\n\t\t\t\tmax_pending_invites,\n\t\t\t\tclan_metadata_fields_whitelist,\n\t\t\t\tplayer_metadata_fields_whitelist,\n\t\t\t\tcreated_at,\n\t\t\t\tupdated_at\n\t\t\t)\n\t\t\tVALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $22)%s`\n\tonConflict := ` ON CONFLICT (public_id)\n\t\t\tDO UPDATE set\n\t\t\t\tname=$2,\n\t\t\t\tmin_level_to_accept_application=$3,\n\t\t\t\tmin_level_to_create_invitation=$4,\n\t\t\t\tmin_level_to_remove_member=$5,\n\t\t\t\tmin_level_offset_to_remove_member=$6,\n\t\t\t\tmin_level_offset_to_promote_member=$7,\n\t\t\t\tmin_level_offset_to_demote_member=$8,\n\t\t\t\tmax_members=$9,\n\t\t\t\tmax_clans_per_player=$10,\n\t\t\t\tmembership_levels=$11,\n\t\t\t\tmetadata=$12,\n\t\t\t\tcooldown_after_delete=$13,\n\t\t\t\tcooldown_after_deny=$14,\n\t\t\t\tcooldown_before_apply=$15,\n\t\t\t\tcooldown_before_invite=$16,\n\t\t\t\tmin_membership_level=$17,\n\t\t\t\tmax_membership_level=$18,\n\t\t\t\tmax_pending_invites=$19,\n\t\t\t\tclan_metadata_fields_whitelist=$20,\n\t\t\t\tplayer_metadata_fields_whitelist=$21,\n\t\t\t\tupdated_at=$22\n\t\t\tWHERE games.public_id=$1`\n\n\tif upsert {\n\t\tquery = fmt.Sprintf(query, onConflict)\n\t} else {\n\t\tquery = fmt.Sprintf(query, \"\")\n\t}\n\n\t_, err = db.Exec(query,\n\t\tpublicID, // $1\n\t\tname, // $2\n\t\tminLevelAccept, // $3\n\t\tminLevelCreate, // $4\n\t\tminLevelRemove, // $5\n\t\tminOffsetRemove, // $6\n\t\tminOffsetPromote, // $7\n\t\tminOffsetDemote, // $8\n\t\tmaxMembers, // $9\n\t\tmaxClans, // $10\n\t\tlevelsJSON, // $11\n\t\tmetadataJSON, // $12\n\t\tcooldownAfterDelete, // $13\n\t\tcooldownAfterDeny, // $14\n\t\tcooldownBeforeApply, // $15\n\t\tcooldownBeforeInvite, // $16\n\t\tminMembershipLevel, // $17\n\t\tmaxMembershipLevel, // $18\n\t\tmaxPendingInvites, // $19\n\t\tclanUpdateMetadataFieldsHookTriggerWhitelist, // $20\n\t\tplayerUpdateMetadataFieldsHookTriggerWhitelist, // $21\n\t\tutil.NowMilli(), // $22\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn GetGameByPublicID(db, publicID)\n}", "title": "" }, { "docid": "6566aeb7190a889a7a638e103757b006", "score": "0.52102745", "text": "func (c campaignRepository) Create(m web.RequestCampaign, userID string) (web.Campaign, error) {\n\tuuid := uuid.New()\n\tinseretCampaign := `\n\t\tINSERT INTO campaign \n\t\t\t(guid, name, status, created_on, updated_on, message_guid, userID)\n\t\tVALUES \n\t\t\t($1, $2, $3, $4, $5, $6, $7);`\n\n\tinseretSegmentation := `\n\t\tINSERT INTO segmentation \n\t\t\t(address, age, campaign_id)\n\t\tVALUES \n\t\t\t($1, $2, $3);`\n\n\tcreatedOn := c.clock.Now().UTC()\n\ttx, _ := c.db.Begin()\n\t_, err := tx.Exec(inseretCampaign, uuid, m.Name, \"draft\", createdOn, createdOn, m.MessageGUID, userID)\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn web.Campaign{}, err\n\t}\n\t_, err = tx.Exec(inseretSegmentation, m.Segmentation.Address, m.Segmentation.Age, uuid)\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn web.Campaign{}, err\n\t}\n\n\ttx.Commit()\n\n\treturn web.Campaign{\n\t\tGUID: uuid.String(),\n\t\tName: m.Name,\n\t\tStatus: \"draft\",\n\t\tSegmentation: web.Segmentation{\n\t\t\tAddress: m.Segmentation.Address,\n\t\t\tAge: m.Segmentation.Age,\n\t\t},\n\t\tCreatedOn: createdOn,\n\t\tUpdatedOn: createdOn,\n\t\tMessageGUID: m.MessageGUID,\n\t\tUserID: userID,\n\t}, err\n}", "title": "" }, { "docid": "4a74a2167cf4c86bcadf236a0093b575", "score": "0.5206751", "text": "func CreatePost(post *Post) error {\n result := db.Create(post)\n return result.Error\n}", "title": "" }, { "docid": "6b77bea1b34b8f4d56b4f2c3aaba1acd", "score": "0.5189541", "text": "func Create(id int, state string, capacity int, venueid int) error {\n\tdb, err := sql.Open(\"mysql\", constants.DB_USER+\":\"+constants.DB_PASSWORD+\"@tcp(\"+constants.DB_HOSTIP+\":\"+constants.DB_PORT+\")/\"+constants.DB_NAME)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\t//\twe need to close the db handle\n\tdefer db.Close()\n\n\t//\tInsert the new entry into the database\n\ttable := Table{\n\t\tID: id, State: state, Capacity: capacity, VenueID: venueid,\n\t}\n\n\t_, err = db.Query(\"INSERT into \"+DB_TABLE+\"(id, state, capacity, venueid) VALUES (:id, :state, :capacity, :venueid)\", table)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6db27462391c18ffb6f48af379759288", "score": "0.51788014", "text": "func (tr *TokenRepository) Create(token string) error {\n\tstmt, err := tr.db.Prepare(\"INSERT INTO tokens(token, created) values(?,?);\")\n\tcheckDatabaseErr(err)\n\n\ttodayDate := time.Now().Local().Format(\"2006-01-02\")\n\t_, err = stmt.Exec(token, todayDate)\n\n\treturn err\n}", "title": "" }, { "docid": "9023d2378b19e1bf455884ae4881671f", "score": "0.5170423", "text": "func BooksCreate(w http.ResponseWriter, r *http.Request){\n\tdb, err = gorm.Open(\"sqlite3\", \"test.db\")\n\tif err !=nil{\n\t\tfmt.Println(err.Error())\n\t\tpanic(\"Failed toconnect to database \")\n\t}\n\n\tdefer db.Close()\n\n\ttitle := chi.URLParam(r, \"title\")\n\tauthor := chi.URLParam(r, \"author\")\n\ttime := t\n\n\tdb.Create(&Bookstruct.Book{Title:title, Author:author, Time:time})\n\n\tfmt.Fprintf(w, \"New Book Successfull Created\")\n\n}", "title": "" }, { "docid": "d0c847932ed7f7b8a1cf26b0dbba89f0", "score": "0.5161798", "text": "func (v RecruitersResource) Create(c buffalo.Context) error {\n\t// Allocate an empty Recruiter\n\trecruiter := &models.Recruiter{}\n\n\t// Bind recruiter to the html form elements\n\tif err := c.Bind(recruiter); 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(recruiter)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif verrs.HasAny() {\n\t\t// Render errors as JSON\n\t\treturn c.Render(400, r.JSON(verrs))\n\t}\n\n\treturn c.Render(201, r.JSON(recruiter))\n}", "title": "" }, { "docid": "1bb65cf7f0e30b85e69f3bb946136d6d", "score": "0.5155324", "text": "func (post *Post) create() (err error) {\n\tstatement := \"INSERT INTO ms_trail_category (trail_name) VALUES ($1) RETURNING trail_category_id\"\n\tstmt, err := Db.Prepare(statement)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer stmt.Close()\n\terr = stmt.QueryRow(post.Trail_name).Scan(&post.Trail_category_id)\n\treturn\n}", "title": "" }, { "docid": "73aa0ff9a617d860a98311d7ea09b12d", "score": "0.5148916", "text": "func (prr *PasswordRecoveryRequest) Create(db *sql.DB) error {\n\trecoveryString, err := generateRecoveryString()\n\tif err != nil {\n\t\treturn err\n\t}\n\tprr.RecoveryString = recoveryString\n\trecoveryCode, err := generateRecoveryCode()\n\tif err != nil {\n\t\treturn err\n\t}\n\tprr.RecoveryCode = recoveryCode\n\n\tstatement := \"INSERT INTO password_recovery_requests (user_id, \" +\n\t\t\"recovery_string, recovery_code, is_valid) VALUES ($1, $2, $3, true)\"\n\t_, err = db.Exec(statement, prr.User.ID, prr.RecoveryString,\n\t\tprr.RecoveryCode)\n\n\treturn err\n}", "title": "" }, { "docid": "abfacf34ada878679e636c51057ae770", "score": "0.51285505", "text": "func CreatePerson(w http.ResponseWriter, r *http.Request, db *gorm.DB) error {\n\tparams := mux.Vars(r)\n\tvar person Person\n\tvar personList []Person\n\n\t_ = json.NewDecoder(r.Body).Decode(&person)\n\n\tid, err := strconv.Atoi(params[\"id\"])\n\n\tif err == nil {\n\t\tperson.ID = id\n\n\t\tdb.Create(&person)\n\t\tdb.Find(&personList)\n\n\t\tw.Header().Add(\"Content-Type\", \"application/json\")\n\t\terr = json.NewEncoder(w).Encode(personList)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "7a27a9cbba256db750fe4623c176a348", "score": "0.5126561", "text": "func (r *Relationship) create(db *system.DB) (err error) {\n\n\tif err = r.validateCreate(); err != nil {\n\t\treturn err\n\t}\n\n\ttx, err := db.Begin()\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn\n\t\t}\n\n\t\tif err = tx.Commit(); err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn\n\t\t}\n\n\t\tNotify(db, r.FollowerID, r.FollowedID, VERB_FOLLOWED, r.FollowerID, OBJECT_USER)\n\t}()\n\n\tif err != nil {\n\t\tlog.Println(\"Relationship.Create() Error -> \", err)\n\t\treturn\n\t}\n\n\tr.CreatedAt = time.Now()\n\tr.UpdatedAt = time.Now()\n\n\terr = tx.QueryRow(\n\t\tr.queryCreate(),\n\t\tr.FollowedID,\n\t\tr.FollowerID,\n\t\tr.RelationShipType,\n\t\tr.IsActive,\n\t\tr.CreatedAt,\n\t\tr.UpdatedAt).Scan(&r.ID)\n\n\tif err != nil {\n\t\tlog.Printf(\"Relationship.Create() Follower_id -> %v Followed_id -> %v RelationshipType -> %v QueryRow() -> %v Error -> %v\", r.FollowerID, r.FollowedID, r.RelationShipType, r.queryCreate(), err)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "16c7615980200ed62c73136fe43e0daa", "score": "0.5119836", "text": "func (repo *TrophyRepository) Create(trophy *model.Trophy) error {\n\tif err := repo.db.Create(&trophy).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9d3982b0588af8e14f57ac2043ac7361", "score": "0.5116869", "text": "func (c *Client) Create(req *CreateReq) error {\n\terr := req.validate()\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = c.sqlDB.NamedExecContext(c.ctx, insertStatement, req)\n\tif err != nil {\n\t\treturn errSQL.WithError(err).Annotate(\"failed to insertStatement\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6221991369fca0b2e379197cdc955e90", "score": "0.51151896", "text": "func (repo CharacterRepository) Create(character models.Character) (int64, error) {\n\tsql := `\n\t\tINSERT INTO characters(name, attack, defense, speed, life) \n\t\t\tVALUES($1, $2, $3, $4, $5) RETURNING id\n\t`\n\tvar id int64\n\terr := repo.DB.QueryRow(sql, character.Name,\n\t\tcharacter.Attack, character.Defense,\n\t\tcharacter.Speed, character.Life).Scan(&id)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn id, nil\n}", "title": "" }, { "docid": "6a72e12476d7109e556a35874b8dd204", "score": "0.51142716", "text": "func (mdb *MongoDB) Create(data interface{}) error {\n\treturn nil\n}", "title": "" }, { "docid": "ab3fe22823350dc886a8f5bb59cf5789", "score": "0.5113001", "text": "func Create(name string) Team {\n\tif name == \"\" {\n\t\treturn Team{name: \"\"}\n\t}\n\n\treturn Team{name: name}\n}", "title": "" }, { "docid": "95b80316267a54939b8e3729db33a49f", "score": "0.5111634", "text": "func (m *NotificationsRepo) Create(notification *models.Notification) (*models.Notification, error) {\n _, err := m.DB.Model(notification).Returning(\"*\").Insert()\n return notification, err\n}", "title": "" }, { "docid": "579ebf7a97ecc5232b78b76c5b5291cc", "score": "0.5106922", "text": "func CreateNewGame(db *sql.DB, firstUser int, secondUser int) int {\n\n\tvar gameID int\n\n\trow := db.QueryRow(`\n\t\tINSERT INTO GAMES (player1, player2) \n\t\tVALUES ($1, $2) RETURNING Id`,\n\t\tfirstUser, secondUser)\n\terr := row.Scan(&gameID)\n\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t\treturn -1\n\t}\n\n\treturn gameID\n}", "title": "" }, { "docid": "9a5f2c22b91653a611ec3d1d000f65bb", "score": "0.5102259", "text": "func (pr *PlayerRouter) CreateHandler(w http.ResponseWriter, r *http.Request) {\n\tvar p player.Player\n\terr := json.NewDecoder(r.Body).Decode(&p)\n\tif err != nil {\n\t\tresponse.HTTPError(w, r, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tdefer r.Body.Close()\n\n\tctx := r.Context()\n\terr = pr.Repository.Create(ctx, &p)\n\tif err != nil {\n\t\tresponse.HTTPError(w, r, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tresponse.JSON(w, r, http.StatusCreated, response.Map{\"player\": p})\n}", "title": "" }, { "docid": "034e4d463fbe4e4bd3287405ba9044e5", "score": "0.5099694", "text": "func (dao PersonImpl) Create(p *models.Person) error {\n\tclient, personsCollection := dao.initDb()\n\tdefer client.Disconnect(context.TODO())\n\t_, err := personsCollection.InsertOne(context.TODO(), p)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed75f70e23646fc4d819a01b9d423e6f", "score": "0.5098131", "text": "func (rep *repository) Create(value interface{}) *gorm.DB {\n\treturn rep.db.Create(value)\n}", "title": "" }, { "docid": "403f36c06f301bd16f2611340a511805", "score": "0.5092937", "text": "func (c *cardRepository) Create(card *model.Card) (*model.Card, error) {\n\tif err := c.db.Create(card).Error; err != nil {\n\t\treturn nil, err\n\t}\n\treturn card, nil\n}", "title": "" }, { "docid": "82204645748265b275124f8346ba4c19", "score": "0.5092021", "text": "func (g *GoalsController) Create(c *gin.Context) {\n\tc.JSON(http.StatusCreated, gin.H{\"message\": \"Create a new goal\"})\n}", "title": "" }, { "docid": "4990136132bb4c7ace309209a92ec5e4", "score": "0.50918627", "text": "func (c *Scheduler) Create(db interfaces.DB) (err error) {\n\t_, err = db.Query(c, `INSERT INTO schedulers (name, game, yaml, state, state_last_changed_at, version)\n\tVALUES (?name, ?game, ?yaml, ?state, ?state_last_changed_at, ?version)\n\tRETURNING id`, c)\n\treturn err\n}", "title": "" }, { "docid": "1b24880039b7524de480e80a300cb4db", "score": "0.5090763", "text": "func CreateGameHanlder(w http.ResponseWriter, req *http.Request) {\n\tgame := models.Game{}\n\tbody, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tjson.Unmarshal(body, &game)\n\tcreatedGame, err := firebaseclients.PushGame(game)\n\tif err != nil {\n\t\tw.WriteHeader(400)\n\t\treturn\n\t}\n\tarena.MakeNewTableAndStart(createdGame)\n\tcreateGameJSON, jsonError := json.Marshal(createdGame)\n\tif jsonError != nil {\n\t\tpanic(jsonError)\n\t}\n\tw.Write(createGameJSON)\n}", "title": "" }, { "docid": "a9c69c723442c8a301071c7720561a42", "score": "0.5087887", "text": "func (c Match) New(gid, id int) revel.Result {\n\tok, game := models.FindGame(id)\n\tif ok {\n\t\treturn c.Render(game, gid)\n\t}\n\treturn c.RenderText(fmt.Sprintf(\"Couldn't find a game with that id! (%d)\", id))\n}", "title": "" }, { "docid": "2ff419eaff5ee8d1dd57a0dea2879b8d", "score": "0.5085983", "text": "func (service groupMembershipService) Create(groupID int64, userID int64) (int64, error) {\n\t// p := neoism.Props{\n\t// \t\"name\": group.Name,\n\t// \t\"description\": group.Description,\n\t// \t\"avatar\": group.Avatar,\n\t// }\n\tstmt := `\n\t\t\tMATCH(u:User) WHERE ID(u) = {userID}\n\t\t\tMATCH(g:Group) WHERE ID(g) = {groupID}\n\t\t\tCREATE (g)<-[r:JOIN]-(u)\n\t\t\tSET r.created_at = TIMESTAMP(),\n\t\t\t\t\tr += CASE g.privacy WHEN 1 THEN {status: 1, role: 1}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHEN 2 THEN {status: 0}\n\t\t\t\t\t\t\t END,\n\t\t\t\t\tg.members = CASE g.privacy WHEN 1 THEN g.members+1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ELSE g.members\n\t\t\t\t\t\t\t\t\t\t\tEND,\n\t\t\t\t\tg.pending_requests = CASE g.privacy WHEN 2 THEN g.pending_requests+1\n\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tELSE g.pending_requests\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t END\n\t\t\tRETURN ID(r) as id\n\t\t\t`\n\tparams := map[string]interface{}{\n\t\t\"userID\": userID,\n\t\t\"groupID\": groupID,\n\t}\n\tres := []struct {\n\t\tID int64 `json:\"id\"`\n\t}{}\n\tcq := neoism.CypherQuery{\n\t\tStatement: stmt,\n\t\tParameters: params,\n\t\tResult: &res,\n\t}\n\terr := conn.Cypher(&cq)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\tif len(res) > 0 {\n\t\tif res[0].ID >= 0 {\n\t\t\treturn res[0].ID, nil\n\t\t}\n\t}\n\treturn -1, nil\n}", "title": "" }, { "docid": "aee7b72f8387e244ff63a6920dba70ed", "score": "0.5085238", "text": "func CreateStar(c *gin.Context) {\n\tdb := InitDb()\n\tdefer db.Close()\n\n\tvar star models.Star\n\tvar res models.Response\n\n\tc.Bind(&star)\n\n\tif err := db.Create(&star).Error; err != nil {\n\t\tc.AbortWithStatus(404)\n\t\tfmt.Println(err)\n\t} else {\n\t\tres.Code = \"200\"\n\t\tres.Message = \"Post Success!\"\n\t\tc.JSON(200, res)\n\t}\n}", "title": "" }, { "docid": "9c30616c93324ce0d19ac8af6152e80e", "score": "0.50835764", "text": "func RecipeCreate(w http.ResponseWriter, r *http.Request) {\n\tvar rdata Recipe\n\tvar res Response\n\n\tif err := Decode(w, r, &rdata); err != nil {\n\t\tif *Debug {\n\t\t\tfmt.Println(\"Erreeeer\")\n\t\t}\n\t\tres.Content = \"Invalid JSON format recieved!\"\n\t\tRespond(w, res, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tquery := fmt.Sprintf(\"INSERT INTO recipe (user_id, recipe_name, recipe_description, recipe_instructions, image_url, calories, prep_time, cook_time, total_time, servings, upvotes, downvotes, made)\\nVALUES (\\\"%d\\\", \\\"%s\\\", \\\"%s\\\", \\\"%s\\\", \\\"%s\\\", \\\"%d\\\", \\\"%d\\\", \\\"%d\\\", \\\"%d\\\", \\\"%d\\\", \\\"%d\\\", \\\"%d\\\", \\\"%d\\\")\", rdata.UserID, rdata.RecipeName, rdata.RecipeDescription, rdata.RecipeInstructions, rdata.ImageURL, rdata.Calories, rdata.PrepTime, rdata.CookTime, rdata.TotalTime, rdata.Servings, rdata.Upvotes, rdata.Downvotes, rdata.Made)\n\tresult, err := db.Connection.Exec(query)\n\tif err != nil {\n\t\tif *Debug {\n\t\t\tfmt.Println(\"Recipe Creation Failed: \", err.Error())\n\t\t}\n\t\tres.Content = fmt.Sprintf(\"Recipe Creation Failed: %s\", err.Error())\n\t\tRespond(w, res, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\trid, iderr := result.LastInsertId()\n\tif iderr != nil {\n\t\tif *Debug {\n\t\t\tfmt.Println(\"Problem retrieving ID: \", iderr.Error())\n\t\t}\n\t\tres.Content = fmt.Sprintf(\"Problem retrieving ID: %s\", iderr.Error())\n\t\tRespond(w, res, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\trdata.RecipeID = int(rid)\n\n\t//Adds the tags to the tag table\n\tif rdata.TagsIn != \"\" {\n\t\tlist := strings.Split(rdata.TagsIn, \"\\n\")\n\t\ttquery := fmt.Sprintf(\"INSERT INTO tag (recipe_id, tag)\\nVALUES \")\n\t\tfor i := 0; i < len(list); i++ {\n\t\t\ttquery += fmt.Sprintf(\"(\\\"%d\\\", \\\"%s\\\")\", rdata.RecipeID, list[i])\n\t\t\tif i != len(list)-1 {\n\t\t\t\ttquery += \",\"\n\t\t\t}\n\t\t}\n\t\ttresult, terr := db.Connection.Exec(tquery)\n\t\tif terr != nil {\n\t\t\tif *Debug {\n\t\t\t\tfmt.Println(\"Tags Insertion Failed: \", terr.Error())\n\t\t\t}\n\t\t\tres.Content = fmt.Sprintf(\"Tags Insertion Failed: %s\", terr.Error())\n\t\t\tRespond(w, tresult, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\n\t//Adds the ingredients to the ingredient table\n\tif rdata.IngredientsIn != \"\" {\n\t\tlist := strings.Split(rdata.IngredientsIn, \"\\n\")\n\t\tiquery := fmt.Sprintf(\"INSERT INTO ingredient (recipe_id, ingredient)\\nVALUES \")\n\t\tfor i := 0; i < len(list); i++ {\n\t\t\tiquery += fmt.Sprintf(\"(\\\"%d\\\", \\\"%s\\\")\", rdata.RecipeID, list[i])\n\t\t\tif i != len(list)-1 {\n\t\t\t\tiquery += \",\"\n\t\t\t}\n\t\t}\n\t\tiresult, ierr := db.Connection.Exec(iquery)\n\t\tif ierr != nil {\n\t\t\tif *Debug {\n\t\t\t\tfmt.Println(\"Ingredients Insertion Failed: \", ierr.Error())\n\t\t\t}\n\t\t\tres.Content = fmt.Sprintf(\"Ingredients Insertion Failed: %s\", ierr.Error())\n\t\t\tRespond(w, iresult, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Increment recipe count in stats\n\tif uperr := StatUpdate(1, 0); uperr != nil {\n\t\tRespond(w, res, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tRespond(w, rdata, http.StatusOK)\n}", "title": "" }, { "docid": "850fc0bd448013a9234cf871520f5a0a", "score": "0.50808716", "text": "func (db *mockDB) Create(user uuid.UUID, news uuid.UUID, body string) (*Comment, error) {\n\tcomment := db.push(user, news, body)\n\treturn comment, nil\n}", "title": "" }, { "docid": "0bd4d644c0c9c3de0fbbcc4c6c2b6c44", "score": "0.5079141", "text": "func (dbc *Connection) Create(object DatabaseMapped) error {\n\treturn dbc.Invoke(dbc.Background()).Create(object)\n}", "title": "" }, { "docid": "352dbfa351b63ac59e0202dbdf18e815", "score": "0.5077445", "text": "func Create() error {\n\tdb := dbConn()\n\tquery := \"CREATE TABLE IF NOT EXISTS Persons(id int primary key auto_increment, first_name varchar(50), last_name varchar(50), age int, blood_group varchar(50))\"\n\tres, err := db.Exec(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\trowsaffected, err := res.RowsAffected()\n\tt := strconv.FormatInt(rowsaffected, 10)\n\tlog.Printf(t)\n\tdefer db.Close()\n\treturn nil\n}", "title": "" }, { "docid": "3b6521d107e7ef2c2992f87e929b83a5", "score": "0.5072797", "text": "func CreateMatchExpression(op MatchOp, values ...string) (*MatchExpression, error) {\n\tm := newMatchExpression(op, values...)\n\treturn m, m.Validate()\n}", "title": "" }, { "docid": "ea3584068957a715710bcd8526fdb305", "score": "0.5072473", "text": "func CreatePatrol(w http.ResponseWriter, r *http.Request) {\n\n\tvar patrol models.Patrol\n\n\terr := json.NewDecoder(r.Body).Decode(&patrol)\n\n\tif err != nil {\n\n\t\tpanic(\"Unable to decode the request body.\")\n\n\t}\n\n\tinsertID := insertPatrol(patrol)\n\n\tres := response{\n\t\tID: insertID,\n\t\tMessage: \"Patrol created successfully\",\n\t}\n\tjson.NewEncoder(w).Encode(res)\n}", "title": "" }, { "docid": "6f7357f3a2d343ae1f9f0dfca67c4092", "score": "0.5069395", "text": "func Createnews(w http.ResponseWriter, r *http.Request) {\r\n\tdefer r.Body.Close()\r\n\tvar news models.News\r\n\tif err := json.NewDecoder(r.Body).Decode(&news); err != nil {\r\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\r\n\t\treturn\r\n\t}\r\n\tnews.ID = bson.NewObjectId()\r\n\tif err := mdao.Insert(news); err != nil {\r\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\r\n\t\treturn\r\n\t}\r\n\trespondWithJson(w, http.StatusCreated, news)\r\n}", "title": "" }, { "docid": "a43fc7d3851e306d823ae7001edd33b4", "score": "0.5065116", "text": "func (r *NotepadsRepo) Create(n domain.Notepad) (domain.Notepad, error) {\n\terr := transact(r.db, func(tx *gorm.DB) (err error) {\n\t\tif err = tx.Create(&n).Error; err != nil {\n\t\t\treturn errors.Wrap(err, \"query error\")\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn domain.Notepad{}, err\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "5873849e781e99e904691adfb81b2417", "score": "0.5064956", "text": "func CreateCandidate(c *gin.Context) {\n\tc.JSON(http.StatusForbidden, gin.H{\"error\": \"Cannot create candidates at this time\"})\n\treturn\n\t/*\n\t\tvar candidate Candidate\n\n\t\tname, exists := c.GetPostForm(\"name\")\n\t\tif !exists {\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"Did not specify name for candidate\"})\n\t\t\treturn\n\t\t}\n\n\t\turl, exists := c.GetPostForm(\"url\")\n\t\tif !exists {\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"Did not specify url for candidate\"})\n\t\t\treturn\n\t\t}\n\n\t\tdb.Where(\"name = ?\", name).First(&candidate)\n\t\tif candidate.ID != 0 {\n\t\t\tc.JSON(http.StatusConflict, gin.H{\"error\": \"Candidate by that name already exists\"})\n\t\t\treturn\n\t\t}\n\n\t\tcandidate = Candidate{Name: name, Url: url}\n\t\tdb.Save(&candidate)\n\t\tc.JSON(http.StatusCreated, gin.H{})\n\t*/\n}", "title": "" }, { "docid": "440a1775773388733cfe91e593bacb7b", "score": "0.506038", "text": "func (r *MongoRepository) Insert(ctx context.Context, match types.Match) error {\n\t_, err := r.collection().InsertOne(context.TODO(), match)\n\treturn err\n}", "title": "" }, { "docid": "f2c8a9a586e4f307cb72ed6cd59d29a9", "score": "0.5056428", "text": "func (o *Rating) Create(db *gorm.DB) error {\n\treturn db.Create(o).Error\n}", "title": "" }, { "docid": "c854280d3371c4e049f47c92b51b85f6", "score": "0.50531125", "text": "func (pl *ProgressLesson) Create(userID, lessonID, quantityDay string) map[string]interface{} {\n\tdb, logs := helper.InitDB()\n\tif logs[\"status\"] != \"1\" {\n\t\treturn logs\n\t}\n\n\tquantityDayInt, err := strconv.ParseInt(quantityDay, 10, 64)\n\tif err != nil {\n\t\tlog := helper.ErrorHandle(err)\n\t\treturn log\n\t}\n\n\tprogressLesson := entities.TBL_ProgressLesson{\n\t\tUserID: userID,\n\t\tLessonID: lessonID,\n\t\tQuantityDay: quantityDayInt,\n\t}\n\n\terr = db.Clauses(clause.OnConflict{DoNothing: true}).Create(&progressLesson).Error\n\tif err != nil {\n\t\tlog := helper.ErrorHandle(err)\n\t\treturn log\n\t}\n\n\tlogs = make(map[string]interface{})\n\tlogs[\"status\"] = \"1\"\n\tlogs[\"msg\"] = \"\"\n\tlogs[\"result\"] = \"\"\n\treturn logs\n}", "title": "" }, { "docid": "841ed3b0f86fd30826861e52302cee76", "score": "0.50516886", "text": "func (r repository) Create(ctx context.Context, account entity.AccountRequest) error {\n\treturn r.db.With(ctx).Model(&account).Insert()\n}", "title": "" }, { "docid": "d5532008ed73ac21dba96a8c9a130262", "score": "0.50503486", "text": "func (ser *MediaService) Create(md *models.Media, tx db.Tx) (int, error) {\n\treturn tx.Database().Create(md, ser, tx)\n}", "title": "" }, { "docid": "66660fb5eb1df2fef59c833d019b24bb", "score": "0.50424904", "text": "func (m *Place) Create() error {\n\treturn Db().Create(m).Error\n}", "title": "" }, { "docid": "159b79e658f1722208c61de33674842d", "score": "0.50422966", "text": "func (r *repository) Create(ctx context.Context, item *model.FormationTemplateConstraintReference) error {\n\tif item == nil {\n\t\treturn apperrors.NewInternalError(\"model can not be empty\")\n\t}\n\n\tlog.C(ctx).Debugf(\"Converting FormationTemplateConstraintReference with formationTemplate ID: %q and formationConstraint ID: %q to entity\", item.FormationTemplateID, item.ConstraintID)\n\tentity := r.conv.ToEntity(item)\n\n\tlog.C(ctx).Debugf(\"Persisting FormationTemplateConstraintReference with formationTemplate ID: %q and formationConstraint ID: %q to the DB\", item.FormationTemplateID, item.ConstraintID)\n\treturn r.creator.Create(ctx, entity)\n}", "title": "" }, { "docid": "1de0f4b460f6c028add44953cae5d8a9", "score": "0.50413173", "text": "func (v WaypointsResource) Create(c buffalo.Context) error {\n\t// Allocate an empty Waypoint\n\twaypoint := &models.Waypoint{}\n\n\t// Bind waypoint to the html form elements\n\tif err := c.Bind(waypoint); err != nil {\n\t\treturn 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 fmt.Errorf(\"no transaction found\")\n\t}\n\n\t// Validate the data from the html form\n\tverrs, err := tx.ValidateAndCreate(waypoint)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif verrs.HasAny() {\n\t\treturn responder.Wants(\"html\", func(c buffalo.Context) error {\n\t\t\t// Make the errors available inside the html template\n\t\t\tc.Set(\"errors\", verrs)\n\n\t\t\t// Render again the new.html template that the user can\n\t\t\t// correct the input.\n\t\t\tc.Set(\"waypoint\", waypoint)\n\n\t\t\treturn c.Render(http.StatusUnprocessableEntity, r.HTML(\"/waypoints/new.plush.html\"))\n\t\t}).Wants(\"json\", func(c buffalo.Context) error {\n\t\t\treturn c.Render(http.StatusUnprocessableEntity, r.JSON(verrs))\n\t\t}).Wants(\"xml\", func(c buffalo.Context) error {\n\t\t\treturn c.Render(http.StatusUnprocessableEntity, r.XML(verrs))\n\t\t}).Respond(c)\n\t}\n\n\treturn responder.Wants(\"html\", func(c buffalo.Context) error {\n\n\t\t// and redirect to the show page\n\t\treturn c.Redirect(http.StatusSeeOther, \"/waypoints/%v\", waypoint.ID)\n\t}).Wants(\"json\", func(c buffalo.Context) error {\n\t\treturn c.Render(http.StatusCreated, r.JSON(waypoint))\n\t}).Wants(\"xml\", func(c buffalo.Context) error {\n\t\treturn c.Render(http.StatusCreated, r.XML(waypoint))\n\t}).Respond(c)\n}", "title": "" }, { "docid": "2db738b8dad85f01addbae1d615d03c1", "score": "0.50381047", "text": "func (work *AcceptedWork) Create(db *bolt.DB) error {\n\terr := db.Update(func(tx *bolt.Tx) error {\n\t\tbkt, err := fetchWorkBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Do not persist already existing accepted work.\n\t\tid := []byte(work.UUID)\n\t\tv := bkt.Get(id)\n\t\tif v != nil {\n\t\t\tdesc := fmt.Sprintf(\"work %s already exists\", work.UUID)\n\t\t\treturn MakeError(ErrWorkExists, desc, nil)\n\t\t}\n\n\t\tworkBytes, err := json.Marshal(work)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn bkt.Put(id, workBytes)\n\t})\n\treturn err\n}", "title": "" }, { "docid": "ffd64db8275a55bf93e4dc66e5b8915f", "score": "0.503762", "text": "func (mg *MessageGorm) Create(m *Message) error {\n\treturn mg.DB.Create(m).Error\n}", "title": "" }, { "docid": "ec65f5c4c590cdffefe72a34fdb1e20b", "score": "0.50288707", "text": "func (store *noSQLStore) CreateMovie(movie *structs.Movie) error {\n\tclient, err := mongo.Connect(context.TODO(), store.clientOptions)\n choices := client.Database(\"indecision\").Collection(\"choices\")\n\t_,err=choices.InsertOne(context.TODO(), movie)\n if err != nil {\n return err\n }\n\treturn nil\n}", "title": "" }, { "docid": "1da5c56f3d9e8176067c517a252a6d9f", "score": "0.5019121", "text": "func (r *Rate) Create(params models.Rate) (models.Rate, error) {\n\tif err := r.DB.Create(&params).Error; err != nil {\n\t\treturn params, err\n\t}\n\treturn params, nil\n}", "title": "" }, { "docid": "f96997d0c0edf233239e114670881170", "score": "0.50147015", "text": "func CreateParticipantEndPoint(w http.ResponseWriter, r *http.Request) {\r\n\tdefer r.Body.Close()\r\n\tvar participant Participant\r\n\tif err := json.NewDecoder(r.Body).Decode(&participant); err != nil {\r\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\r\n\t\treturn\r\n\t}\r\n\tparticipant.ID = bson.NewObjectId()\r\n\tif err := participantsconn.Insert(participant); err != nil {\r\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\r\n\t\treturn\r\n\t}\r\n\trespondWithJson(w, http.StatusCreated, participant)\r\n}", "title": "" }, { "docid": "e2ade69a8b2cace916602b454d045306", "score": "0.50128835", "text": "func (h *TagsHandler) Create(w http.ResponseWriter, r *http.Request) {\n\tTags := new(domain.Tags)\n\terrs := binding.Bind(r, Tags)\n\tif errs.Handle(w) {\n\t\treturn\n\t}\n\n\t//validate data\n\tvalidateData := Tags.Validate(r, errs)\n\tif validateData.Error() != \"\" {\n\t\tdomain.RespondWithError(w, http.StatusInternalServerError, validateData.Error())\n\t\treturn\n\t}\n\n\t//send to useCase\n\tres, err := h.TagsUsecase.Store(*Tags)\n\tif err != nil {\n\t\tdomain.RespondWithError(w, http.StatusInternalServerError, err.Error())\n\t}\n\n\tTags.ID = res\n\tdomain.RespondwithJSON(w, http.StatusOK, Tags)\n}", "title": "" }, { "docid": "4600e53723e0c80215c819be41542b9b", "score": "0.50092614", "text": "func (rs *ArticleRoute) Create(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tvar article Models.Article\n\n\t// body, _ := ioutil.ReadAll(r.Body)\n\t// fmt.Println(\"Received packet: \", string(body))\n\n\tif err := json.NewDecoder(r.Body).Decode(&article); err != nil {\n\t\trs.RI.Responser.ResponseWithError(w, r, http.StatusExpectationFailed, map[string]string{\n\t\t\t\"error\": \"Invalid request payload!\",\n\t\t\t\"errorCode\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tartic, err := rs.DAO.InsertDb(article)\n\tif err != nil {\n\t\trs.RI.Responser.ResponseWithError(w, r, http.StatusInternalServerError, map[string]string{\n\t\t\t\"error\": \"Not insert to database! Please contact with adminitstration\",\n\t\t\t\"errorCode\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\trs.RI.Responser.ResponseWithJSON(w, r, http.StatusOK, artic)\n}", "title": "" }, { "docid": "c28a5d7e2521aa94d3532168abc1d91c", "score": "0.5005782", "text": "func (db *DB) CreateTag(tagCreate *TagCreate) (int, error) {\n sqlStatement := `\n INSERT INTO tags\n (tag_name)\n VALUES\n ($1)\n RETURNING\n tag_id\n `\n row := db.QueryRow(sqlStatement, tagCreate.TagName)\n\n var tagID int\n err := row.Scan(&tagID)\n if err != nil {\n return 0, err\n }\n\n return tagID, nil\n}", "title": "" }, { "docid": "3f872f20d5a4bdeaad5c64b87b78fdf4", "score": "0.50057423", "text": "func (m *Mysql) Create(param *domain.Param) error {\n\tstmt, err := m.DB.Prepare(mysqlInsert)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer stmt.Close()\n\n\tparam.ParamID = strings.ToLower(param.ParamID)\n\tparam.Active = 1\n\tnow := utils.Now()\n\terr = mysql.ExecAffectingOneRow(\n\t\tstmt,\n\t\tparam.ParamID,\n\t\tparam.Name,\n\t\tparam.Value,\n\t\tparam.Active,\n\t\tparam.InsUserID,\n\t\tnow[\"date\"], now[\"time\"], now[\"unix\"],\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "061d7d55409d62dbdc43622701b14be6", "score": "0.500529", "text": "func (g Gophers) Create(req requests.CreateGopher) (responses.CreateGopher, error) {\n\tvar gopher entities.Gopher\n\tif err := gopher.Validate(req); err != nil {\n\t\treturn responses.CreateGopher{}, err\n\t}\n\n\tgopher.ID = g.getFreeKey()\n\tgopher.Name = req.Name\n\tgopher.Age = req.Age\n\tg.burrow[gopher.ID] = gopher\n\n\treturn responses.CreateGopher{ID: gopher.ID}, nil\n}", "title": "" }, { "docid": "39fadb9340b54f686df55f20d9b63165", "score": "0.49857205", "text": "func TestParlour_createRoomHandler(t *testing.T) {\n\troomID := \"ABCD\"\n\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\troomRepository := NewMockRoomRepository(ctrl)\n\troomRepository.EXPECT().Save(gomock.Any()).DoAndReturn(func(room *Room) error {\n\t\troom.ID = roomID\n\t\treturn nil\n\t})\n\n\tgin.SetMode(gin.TestMode)\n\trouter := gin.Default()\n\tparlour := New(roomRepository, memstore.NewStore())\n\tparlour.configure(router)\n\n\tw := httptest.NewRecorder()\n\treq, _ := http.NewRequest(http.MethodPost, \"/rooms\", strings.NewReader(\"name=alice\"))\n\treq.Header.Set(\"content-type\", \"application/x-www-form-urlencoded\")\n\trouter.ServeHTTP(w, req)\n\n\tassert.Equal(t, http.StatusCreated, w.Code)\n\tassert.Equal(t, roomID, w.Body.String())\n}", "title": "" }, { "docid": "502ec71e1d4a4456436c3adedd6e95b3", "score": "0.49850723", "text": "func (b *Beneficiary) Create(db *sql.DB) error {\n\treturn db.QueryRow(`INSERT INTO beneficiary(code,name) VALUES($1,$2)\n\tRETURNING ID`, b.Code, b.Name).Scan(&b.ID)\n}", "title": "" }, { "docid": "9023c651c673bca7ed2470a7fefa8e05", "score": "0.49844775", "text": "func (g *Grotto) createRow(c echo.Context) error {\n table, err := tableFromContext(c)\n if err != nil {\n return err\n }\n\n r := c.Request()\n data, err := ioutil.ReadAll(r.Body)\n if err != nil {\n return err\n }\n err = resources.Create(g.DB, table, string(data))\n if err != nil {\n return echo.NewHTTPError(http.StatusBadRequest, err)\n }\n return c.NoContent(http.StatusOK)\n}", "title": "" }, { "docid": "0b0ed4ef69527da255ee95ba743bf670", "score": "0.49807444", "text": "func (c *CmaHandler) Create(w http.ResponseWriter, r *http.Request) {\n\tcma := models.CmaJSON{}\n\tif err := json.NewDecoder(r.Body).Decode(&cma); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tif err := c.mongo.DB(\"pingo\").C(\"cma\").Remove(bson.M{\"identifier\": cma.Identifier}); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tcma.ID = bson.NewObjectId()\n\tif err := c.mongo.DB(\"pingo\").C(\"cma\").Insert(cma); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tcmaj, err := json.Marshal(cma)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tlog.Println(\"Salvo com sucesso\")\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated)\n\tw.Write(cmaj)\n}", "title": "" }, { "docid": "361738d5dae404fbc0b57e377a251681", "score": "0.4978566", "text": "func (api *TargetAPI) CreateHanler(rw http.ResponseWriter, req *http.Request) {\n\tvar target entities.Target\n\n\terr := json.NewDecoder(req.Body).Decode(&target)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tapi.data.Target.Create(target.URL, target.Emails)\n\n\trw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "3e597252bdc8f43580a7e256b473be09", "score": "0.49780485", "text": "func (s *Server) Create(c *gin.Context) {\r\n\tvar item entities.Place\r\n\r\n\tif err := c.ShouldBindWith(&item, binding.JSON); err != nil {\r\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\r\n\t\treturn\r\n\t}\r\n\r\n\titem.Id = bson.NewObjectId()\r\n\r\n\tres, err := s.PlacesUsecase.Create(&item)\r\n\tif err != nil {\r\n\t\tif err != errors.New(entities.ErrNotFound) {\r\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\r\n\t\t\treturn\r\n\t\t}\r\n\t\tc.JSON(http.StatusNotFound, gin.H{\"error\": err.Error()})\r\n\t\treturn\r\n\t}\r\n\tc.JSON(http.StatusOK, res)\r\n}", "title": "" }, { "docid": "ff0218e6bcc80f940d99bcf145ce6e3c", "score": "0.49756983", "text": "func (m *Location) Create() error {\n\treturn Db().Create(m).Error\n}", "title": "" }, { "docid": "fcb98be819de0176c792a1a9d273a7f9", "score": "0.4975167", "text": "func Create(params map[string]string) (int64, error) {\n\n\t// Check params for invalid values\n\terr := validateParams(params, true)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Update date params\n\tparams[\"created_at\"] = query.TimeString(time.Now().UTC())\n\tparams[\"updated_at\"] = query.TimeString(time.Now().UTC())\n\n\treturn Query().Insert(params)\n}", "title": "" } ]
341b3533a7b7c9cea749c8145eb3d740
/ GetWorkflowCatalogList Read a 'workflow.Catalog' resource.
[ { "docid": "11f337a54ebd6f6a46d49e8629087cb1", "score": "0.82390785", "text": "func (a *WorkflowApiService) GetWorkflowCatalogList(ctx _context.Context) ApiGetWorkflowCatalogListRequest {\n\treturn ApiGetWorkflowCatalogListRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" } ]
[ { "docid": "cc75a440d21711aed1c148858a3f9933", "score": "0.6787556", "text": "func (a *WorkflowApiService) GetWorkflowCatalogListExecute(r ApiGetWorkflowCatalogListRequest) (WorkflowCatalogResponse, *_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 WorkflowCatalogResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"WorkflowApiService.GetWorkflowCatalogList\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/workflow/Catalogs\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.filter != nil {\n\t\tlocalVarQueryParams.Add(\"$filter\", parameterToString(*r.filter, \"\"))\n\t}\n\tif r.orderby != nil {\n\t\tlocalVarQueryParams.Add(\"$orderby\", parameterToString(*r.orderby, \"\"))\n\t}\n\tif r.top != nil {\n\t\tlocalVarQueryParams.Add(\"$top\", parameterToString(*r.top, \"\"))\n\t}\n\tif r.skip != nil {\n\t\tlocalVarQueryParams.Add(\"$skip\", parameterToString(*r.skip, \"\"))\n\t}\n\tif r.select_ != nil {\n\t\tlocalVarQueryParams.Add(\"$select\", parameterToString(*r.select_, \"\"))\n\t}\n\tif r.expand != nil {\n\t\tlocalVarQueryParams.Add(\"$expand\", parameterToString(*r.expand, \"\"))\n\t}\n\tif r.apply != nil {\n\t\tlocalVarQueryParams.Add(\"$apply\", parameterToString(*r.apply, \"\"))\n\t}\n\tif r.count != nil {\n\t\tlocalVarQueryParams.Add(\"$count\", parameterToString(*r.count, \"\"))\n\t}\n\tif r.inlinecount != nil {\n\t\tlocalVarQueryParams.Add(\"$inlinecount\", parameterToString(*r.inlinecount, \"\"))\n\t}\n\tif r.at != nil {\n\t\tlocalVarQueryParams.Add(\"at\", parameterToString(*r.at, \"\"))\n\t}\n\tif r.tags != nil {\n\t\tlocalVarQueryParams.Add(\"tags\", parameterToString(*r.tags, \"\"))\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\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 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\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\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": "dd6368a581af51599ce9883f7fdb727c", "score": "0.6598263", "text": "func ListCatalogs(w http.ResponseWriter, r *http.Request) {\n\tapiContext := api.GetApiContext(r)\n\n\tcatalogs := manager.ListAllCatalogs()\n\tresp := manager.CatalogCollection{}\n\n\tfor _, value := range catalogs {\n\t\tif value.Links == nil {\n\t\t\tvalue.Links = map[string]string{}\n\t\t}\n\n\t\tvalue.Links[\"templates\"] = URLEncoded(apiContext.UrlBuilder.ReferenceByIdLink(\"catalog\", value.CatalogLink))\n\t\tvalue.Links[\"self\"] = URLEncoded(apiContext.UrlBuilder.ReferenceByIdLink(\"catalog\", value.Id))\n\t\tresp.Data = append(resp.Data, value)\n\t}\n\n\tapiContext.Write(&resp)\n}", "title": "" }, { "docid": "15e398083c455c170d1508a4028b26b9", "score": "0.6363354", "text": "func (r *CatalogsService) List() *CatalogsListCall {\n\tc := &CatalogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\treturn c\n}", "title": "" }, { "docid": "096aac2e14d05684c9a0c01649e7d0b7", "score": "0.62686056", "text": "func (c *Controller) SnapshotCatalogList(ctx context.Context, args *pstore.SnapshotCatalogListArgs) (pstore.SnapshotCatalogIterator, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "8a2296b9858c17f64b0335386ef82224", "score": "0.5995077", "text": "func GetCatalog(board string) (Catalog, error) {\n\tif len(board) == 0 {\n\t\treturn nil, fmt.Errorf(\"api: GetCatalog: No board name given\")\n\t}\n\tvar c catalog\n\terr := getDecode(APIURL, fmt.Sprintf(\"/%s/catalog.json\", board), &c, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcat := make(Catalog, len(c))\n\tfor i, page := range c {\n\t\textracted := struct {\n\t\t\tPage int\n\t\t\tThreads []*Thread\n\t\t}{page.Page, make([]*Thread, len(page.Threads))}\n\t\tfor j, post := range page.Threads {\n\t\t\tthread := &Thread{Posts: make([]*Post, 1), Board: board}\n\t\t\tpost := json_to_native(post, thread)\n\t\t\tthread.Posts[0] = post\n\t\t\textracted.Threads[j] = thread\n\t\t\tif thread.OP == nil {\n\t\t\t\tthread.OP = thread.Posts[0]\n\t\t\t}\n\t\t}\n\t\tcat[i] = extracted\n\t}\n\treturn cat, nil\n}", "title": "" }, { "docid": "a13075792cfe6ee2b0633c99370911a5", "score": "0.59205914", "text": "func (c *CatalogClient) GetCatalog() (*brokerapi.Catalog, error) {\n\treturn c.RetCatalog, c.RetErr\n}", "title": "" }, { "docid": "f4add6080027602ef904fd56b0195afe", "score": "0.5883136", "text": "func (s *server) GetCatalog(w http.ResponseWriter, req *http.Request) {\n\tresponse, err := s.Controller.GetCatalog()\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tif err != nil {\n\t\tjson.NewEncoder(w).Encode(err)\n\t\treturn\n\t}\n\tjson.NewEncoder(w).Encode(response)\n}", "title": "" }, { "docid": "d7bc62e0928cf7f6fd214606d10fe659", "score": "0.5862765", "text": "func (mo *LocalizationManager) Catalog() ([]*LocalizationManagerMessageCatalog, error) {\n\tp, err := mo.currentProperty(\"catalog\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif p != nil {\n\t\treturn p.([]*LocalizationManagerMessageCatalog), nil\n\t}\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "b8908d6d558096e733237cbc66dcbf2e", "score": "0.5779865", "text": "func List(client *occlient.Client) ([]string, error) {\n\tvar catalogList []string\n\timageStreams, err := getDefaultBuilderImages(client)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get image streams\")\n\t}\n\tcatalogList = append(catalogList, imageStreams...)\n\n\t// TODO: uncomment when component create supports template creation\n\t//clusterServiceClasses, err := client.GetClusterServiceClassExternalNames()\n\t//if err != nil {\n\t//\treturn nil, errors.Wrap(err, \"unable to get cluster service classes\")\n\t//}\n\t//catalogList = append(catalogList, clusterServiceClasses...)\n\n\treturn catalogList, nil\n}", "title": "" }, { "docid": "2eb025a782d67e47b0a581c6026b4992", "score": "0.5775866", "text": "func ListWorkflows(cmd *cobra.Command, args []string) error {\n\n\tclient, err := auth.GetClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Parse all flags\n\n\tvar countDefault int32\n\tcount := &countDefault\n\terr = flags.ParseFlag(cmd.Flags(), \"count\", &count)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"count\": ` + err.Error())\n\t}\n\tvar filter string\n\terr = flags.ParseFlag(cmd.Flags(), \"filter\", &filter)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"filter\": ` + err.Error())\n\t}\n\tvar offsetDefault int32\n\toffset := &offsetDefault\n\terr = flags.ParseFlag(cmd.Flags(), \"offset\", &offset)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"offset\": ` + err.Error())\n\t}\n\tvar orderby []string\n\terr = flags.ParseFlag(cmd.Flags(), \"orderby\", &orderby)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"orderby\": ` + err.Error())\n\t}\n\t// Form query params\n\tgenerated_query := model.ListWorkflowsQueryParams{}\n\tgenerated_query.Count = count\n\tgenerated_query.Filter = filter\n\tgenerated_query.Offset = offset\n\tgenerated_query.Orderby = orderby\n\n\t// Silence Usage\n\tcmd.SilenceUsage = true\n\n\tresp, err := client.CatalogService.ListWorkflows(&generated_query)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsonx.Pprint(cmd, resp)\n\treturn nil\n}", "title": "" }, { "docid": "bfd0132c789c19671073517dfa6b801a", "score": "0.54255074", "text": "func (a *WorkflowApiService) GetWorkflowCatalogByMoid(ctx _context.Context, moid string) ApiGetWorkflowCatalogByMoidRequest {\n\treturn ApiGetWorkflowCatalogByMoidRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "title": "" }, { "docid": "6b60e7cd1e6b658d95318a91427153a0", "score": "0.5379141", "text": "func ReadCatalog(r io.Reader) (c *Catalog, err error) {\n\tbytes, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcatalog := new(Catalog)\n\terr = json.Unmarshal(bytes, catalog)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn catalog, nil\n}", "title": "" }, { "docid": "2fd79e9e03da074f8803269e98668ca7", "score": "0.53785133", "text": "func List(client *occlient.Client) ([]CatalogImage, error) {\n\n\tcatalogList, err := getDefaultBuilderImages(client)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get image streams\")\n\t}\n\n\tif len(catalogList) == 0 {\n\t\treturn nil, errors.New(\"unable to retrieve any catalog images from the OpenShift cluster\")\n\t}\n\n\treturn catalogList, nil\n}", "title": "" }, { "docid": "a05e85322d3dd2ddf5f8571d2d054254", "score": "0.53743345", "text": "func (m *AccessPackage) GetCatalog()(AccessPackageCatalogable) {\n val, err := m.GetBackingStore().Get(\"catalog\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(AccessPackageCatalogable)\n }\n return nil\n}", "title": "" }, { "docid": "0bacb3b580e69028e3a44fd7870a25e4", "score": "0.5370378", "text": "func (c *Controller) SnapshotCatalogGet(ctx context.Context, args *pstore.SnapshotCatalogGetArgs) (*pstore.SnapshotCatalogEntry, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "17975c5437f7a867090b4f9df3e22dce", "score": "0.5293308", "text": "func GetDataCatalog(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *DataCatalogState, opts ...pulumi.ResourceOption) (*DataCatalog, error) {\n\tvar resource DataCatalog\n\terr := ctx.ReadResource(\"aws:athena/dataCatalog:DataCatalog\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "c228e9be0be1d0a7f065ac64ffc0f82b", "score": "0.52712643", "text": "func (s *Service) ListWorkflows(query *ListWorkflowsQueryParams, resp ...*http.Response) ([]Workflow, error) {\n\tvalues := util.ParseURLParams(query)\n\tu, err := s.Client.BuildURLFromPathParams(values, serviceCluster, `/catalog/v2beta1/workflows`, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse, err := s.Client.Get(services.RequestParams{URL: u})\n\tif response != nil {\n\t\tdefer response.Body.Close()\n\n\t\t// populate input *http.Response if provided\n\t\tif len(resp) > 0 && resp[0] != nil {\n\t\t\t*resp[0] = *response\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar rb []Workflow\n\terr = util.ParseResponse(&rb, response)\n\treturn rb, err\n}", "title": "" }, { "docid": "185668588bf484e6405fa49184f42ad0", "score": "0.52705777", "text": "func (a *Client) ListImageCatalogsByWorkspace(params *ListImageCatalogsByWorkspaceParams) (*ListImageCatalogsByWorkspaceOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListImageCatalogsByWorkspaceParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"listImageCatalogsByWorkspace\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v3/{workspaceId}/imagecatalogs\",\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: &ListImageCatalogsByWorkspaceReader{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.(*ListImageCatalogsByWorkspaceOK), nil\n\n}", "title": "" }, { "docid": "48cdacbf116e52d5f15864e8b298e01f", "score": "0.5225274", "text": "func (f Cataloger) List() ([]*framework.Service, error) {\n\treturn f.Services, nil\n}", "title": "" }, { "docid": "144710fe206dd400f9df37354f44ded7", "score": "0.5196146", "text": "func (s *APISurface) GetCatalogHandler(w http.ResponseWriter, r *http.Request) {\n\tversion := getBrokerAPIVersionFromRequest(r)\n\tif err := s.BusinessLogic.ValidateBrokerAPIVersion(version); err != nil {\n\t\twriteError(w, err, http.StatusPreconditionFailed)\n\t\treturn\n\t}\n\n\tresponse, err := s.BusinessLogic.GetCatalog(w, r)\n\tif err != nil {\n\t\twriteError(w, err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\twriteResponse(w, http.StatusOK, response)\n}", "title": "" }, { "docid": "474f85295a2e48ef7d6b5699b767bec6", "score": "0.51807314", "text": "func (a *Client) GetImageCatalogInWorkspace(params *GetImageCatalogInWorkspaceParams) (*GetImageCatalogInWorkspaceOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetImageCatalogInWorkspaceParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getImageCatalogInWorkspace\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v3/{workspaceId}/imagecatalogs/{name}\",\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: &GetImageCatalogInWorkspaceReader{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.(*GetImageCatalogInWorkspaceOK), nil\n\n}", "title": "" }, { "docid": "54f4811f2c6bda650b2bbc7cf761f1ef", "score": "0.51745325", "text": "func (o *OsConfigurationFileAllOf) GetCatalog() OsCatalogRelationship {\n\tif o == nil || o.Catalog == nil {\n\t\tvar ret OsCatalogRelationship\n\t\treturn ret\n\t}\n\treturn *o.Catalog\n}", "title": "" }, { "docid": "4d8f22c6dac5ab023ac27ff90632ea92", "score": "0.5173768", "text": "func ListWorkflows(cmd *cobra.Command, args []string) error {\n\n\tclient, err := auth.GetClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Silence Usage\n\tcmd.SilenceUsage = true\n\n\tresp, err := client.MachineLearningService.ListWorkflows()\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsonx.Pprint(cmd, resp)\n\treturn nil\n}", "title": "" }, { "docid": "c70c3c2f5824694c75ce6789b469bf77", "score": "0.5161229", "text": "func (o *ForecastDefinition) GetCatalog() ForecastCatalogRelationship {\n\tif o == nil || o.Catalog == nil {\n\t\tvar ret ForecastCatalogRelationship\n\t\treturn ret\n\t}\n\treturn *o.Catalog\n}", "title": "" }, { "docid": "dea390d654b70f0acc429eecb160fac9", "score": "0.5157416", "text": "func (b *Betting) ListMarketCatalogue(filter Filter) (marketCatalogue []MarketCatalogue, err error) {\n\terr = b.Request(&marketCatalogue, b.BettingURL, \"listMarketCatalogue\", &filter)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "505d53e6bab6a03461132691d35d1cd3", "score": "0.514291", "text": "func Catalog(src string) (res []string, err error) {\n\treg, err := name.NewRegistry(src)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tn := 100\n\tlast := \"\"\n\tfor {\n\t\tpage, err := remote.CatalogPage(reg, last, n, remote.WithAuthFromKeychain(authn.DefaultKeychain))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif len(page) > 0 {\n\t\t\tlast = page[len(page)-1]\n\t\t\tres = append(res, page...)\n\t\t}\n\n\t\tif len(page) < n {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "3369d9706f11d193f9d3ff754e7b580d", "score": "0.51050895", "text": "func ListWorkflowRuns(cmd *cobra.Command, args []string) error {\n\n\tclient, err := auth.GetClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Parse all flags\n\n\tvar countDefault int32\n\tcount := &countDefault\n\terr = flags.ParseFlag(cmd.Flags(), \"count\", &count)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"count\": ` + err.Error())\n\t}\n\tvar filter string\n\terr = flags.ParseFlag(cmd.Flags(), \"filter\", &filter)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"filter\": ` + err.Error())\n\t}\n\tvar offsetDefault int32\n\toffset := &offsetDefault\n\terr = flags.ParseFlag(cmd.Flags(), \"offset\", &offset)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"offset\": ` + err.Error())\n\t}\n\tvar orderby []string\n\terr = flags.ParseFlag(cmd.Flags(), \"orderby\", &orderby)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"orderby\": ` + err.Error())\n\t}\n\tvar workflowbuildid string\n\terr = flags.ParseFlag(cmd.Flags(), \"workflowbuildid\", &workflowbuildid)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"workflowbuildid\": ` + err.Error())\n\t}\n\tvar workflowid string\n\terr = flags.ParseFlag(cmd.Flags(), \"workflowid\", &workflowid)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"workflowid\": ` + err.Error())\n\t}\n\t// Form query params\n\tgenerated_query := model.ListWorkflowRunsQueryParams{}\n\tgenerated_query.Count = count\n\tgenerated_query.Filter = filter\n\tgenerated_query.Offset = offset\n\tgenerated_query.Orderby = orderby\n\n\t// Silence Usage\n\tcmd.SilenceUsage = true\n\n\tresp, err := client.CatalogService.ListWorkflowRuns(workflowid, workflowbuildid, &generated_query)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsonx.Pprint(cmd, resp)\n\treturn nil\n}", "title": "" }, { "docid": "69b6f51e264069a02af5d22b0bc2f46a", "score": "0.5104738", "text": "func NewListCatalogParams() *ListCatalogParams {\n\treturn &ListCatalogParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "c1ac00d805266434bdc23b6cd0b02f62", "score": "0.5095052", "text": "func (registry *Registry) Catalog(ctx context.Context, u string) ([]string, error) {\n\tif u == \"\" {\n\t\tu = \"/v2/_catalog\"\n\t}\n\turi := registry.url(u)\n\tregistry.Logf(\"registry.catalog url=%s\", uri)\n\n\tvar response catalogResponse\n\tresp, err := registry.getJSON(ctx, uri, &response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tfor _, l := range link.ParseHeader(resp.Header) {\n\t\tif l.Rel == \"next\" {\n\t\t\tunescaped, _ := url.QueryUnescape(l.URI)\n\t\t\trepos, err := registry.Catalog(ctx, unescaped)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresponse.Repositories = append(response.Repositories, repos...)\n\t\t}\n\t}\n\n\treturn response.Repositories, nil\n}", "title": "" }, { "docid": "ffb297900cb6310761d6f3615577c836", "score": "0.50771934", "text": "func (p *PostgresStorage) GetServicesCatalog() ([]osb.Service, error) {\n\tservices := make([]osb.Service, 0)\n\n\trows, err := p.db.Query(servicesQuery)\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"GetServiceCatalog: Unable to get services: \" + err.Error())\n\t\t// glog.Error(msg)\n\t\treturn nil, errors.New(msg)\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar serviceID, serviceName string\n\t\tvar serviceDescription, serviceHumanName, serviceCatagories, serviceImage sql.NullString\n\n\t\terr = rows.Scan(&serviceID, &serviceName, &serviceHumanName, &serviceDescription, &serviceCatagories, &serviceImage)\n\t\tif err != nil {\n\t\t\t// glog.Errorf(\"Unable to get services: %s\\n\", err.Error())\n\t\t\treturn nil, errors.New(\"Unable to scan services: \" + err.Error())\n\t\t}\n\n\t\tplans, err := getCatalogPlans(p.db, serviceID)\n\t\tif err != nil {\n\t\t\t// glog.Errorf(\"Unable to get plans for %s: %s\\n\", serviceName, err.Error())\n\t\t\treturn nil, errors.New(\"Unable to get plans for \" + serviceName + \": \" + err.Error())\n\t\t}\n\n\t\tosbPlans := make([]osb.Plan, 0)\n\t\tfor _, plan := range plans {\n\t\t\tosbPlans = append(osbPlans, plan)\n\t\t}\n\n\t\tservices = append(services, osb.Service{\n\t\t\tName: serviceName,\n\t\t\tID: serviceID,\n\t\t\tDescription: nullStringValue(serviceDescription),\n\t\t\tBindable: true,\n\t\t\tBindingsRetrievable: true,\n\t\t\tPlanUpdatable: &falseVal,\n\t\t\tTags: strings.Split(nullStringValue(serviceCatagories), \",\"),\n\t\t\tMetadata: map[string]interface{}{\n\t\t\t\t\"name\": nullStringValue(serviceHumanName),\n\t\t\t\t\"displayName\": nullStringValue(serviceHumanName),\n\t\t\t\t\"longDescription\": nullStringValue(serviceDescription),\n\t\t\t\t\"imageUrl\": nullStringValue(serviceImage),\n\t\t\t},\n\t\t\tPlans: osbPlans,\n\t\t})\n\t}\n\treturn services, nil\n}", "title": "" }, { "docid": "968c697a44445dfa688384c6a3d97df3", "score": "0.50173515", "text": "func ListConnectors(cmd *cobra.Command, args []string) error {\n\n\tclient, err := auth.GetClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Silence Usage\n\tcmd.SilenceUsage = true\n\n\tresp, err := client.StreamsService.ListConnectors()\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsonx.Pprint(cmd, resp)\n\treturn nil\n}", "title": "" }, { "docid": "09377510b8f31c33aa839f1c7e037d1f", "score": "0.5012424", "text": "func (a *Client) GetNodesIdentifierCatalogs(params *GetNodesIdentifierCatalogsParams, authInfo runtime.ClientAuthInfoWriter) (*GetNodesIdentifierCatalogsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetNodesIdentifierCatalogsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetNodesIdentifierCatalogs\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/nodes/{identifier}/catalogs\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/x-gzip\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetNodesIdentifierCatalogsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetNodesIdentifierCatalogsOK), nil\n}", "title": "" }, { "docid": "509080f6f765bc6d740a70fa4edbbca8", "score": "0.50093824", "text": "func (m *AccessPackageCatalog) GetResourceRoles()([]AccessPackageResourceRoleable) {\n val, err := m.GetBackingStore().Get(\"resourceRoles\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]AccessPackageResourceRoleable)\n }\n return nil\n}", "title": "" }, { "docid": "77e8b7d3883df7a78cf99bfcaf83b7bb", "score": "0.49869135", "text": "func XCatalogsByMasterCatalogID(db XODB, masterCatalogID sql.NullInt64) ([]*XCatalog, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, name, display_name, seq_num, type_cd, par_catalog_id, master_catalog_id, active_flag, att_id, demo_id, org_id, created_by, updated_by, created_at, updated_at ` +\n\t\t`FROM x_showroom.x_catalog ` +\n\t\t`WHERE master_catalog_id = ?`\n\n\t// run query\n\tXOLog(sqlstr, masterCatalogID)\n\tq, err := db.Query(sqlstr, masterCatalogID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*XCatalog{}\n\tfor q.Next() {\n\t\txc := XCatalog{\n\t\t\t_exists: true,\n\t\t}\n\n\t\t// scan\n\t\terr = q.Scan(&xc.ID, &xc.Name, &xc.DisplayName, &xc.SeqNum, &xc.TypeCd, &xc.ParCatalogID, &xc.MasterCatalogID, &xc.ActiveFlag, &xc.AttID, &xc.DemoID, &xc.OrgID, &xc.CreatedBy, &xc.UpdatedBy, &xc.CreatedAt, &xc.UpdatedAt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &xc)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "96c4c52affbfc089abdc8198f6ef0523", "score": "0.4960183", "text": "func (o *ListCatalogParams) WithHTTPClient(client *http.Client) *ListCatalogParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "7d3c59bc41874c9159d49c9dbcfcf313", "score": "0.49542502", "text": "func (server *Server) QueryCatalogs(certname string) (*CatalogWireFormat, error) {\n\turl := fmt.Sprintf(\"pdb/query/v4/catalogs/%v\", certname)\n\tbody, err := server.Query(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar catalog CatalogWireFormat\n\tjson.Unmarshal(body, &catalog)\n\n\treturn &catalog, err\n}", "title": "" }, { "docid": "1947e19961fb25245ba286a2a9943887", "score": "0.49404323", "text": "func CatalogSource() *apiextensionsv1.CustomResourceDefinition {\n\treturn getCRD(\"operators.coreos.com_catalogsources.yaml\").DeepCopy()\n}", "title": "" }, { "docid": "b4eec86d1df4631760a2a9703c2cde7c", "score": "0.4933949", "text": "func (s resourceCompositionNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceComposition, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.ResourceComposition))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "848f7ea5e27c718742258b1d9fe14b3e", "score": "0.49162886", "text": "func ListWorkflowBuilds(cmd *cobra.Command, args []string) error {\n\n\tclient, err := auth.GetClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Parse all flags\n\n\tvar countDefault int32\n\tcount := &countDefault\n\terr = flags.ParseFlag(cmd.Flags(), \"count\", &count)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"count\": ` + err.Error())\n\t}\n\tvar filter string\n\terr = flags.ParseFlag(cmd.Flags(), \"filter\", &filter)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"filter\": ` + err.Error())\n\t}\n\tvar offsetDefault int32\n\toffset := &offsetDefault\n\terr = flags.ParseFlag(cmd.Flags(), \"offset\", &offset)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"offset\": ` + err.Error())\n\t}\n\tvar orderby []string\n\terr = flags.ParseFlag(cmd.Flags(), \"orderby\", &orderby)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"orderby\": ` + err.Error())\n\t}\n\tvar workflowid string\n\terr = flags.ParseFlag(cmd.Flags(), \"workflowid\", &workflowid)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"workflowid\": ` + err.Error())\n\t}\n\t// Form query params\n\tgenerated_query := model.ListWorkflowBuildsQueryParams{}\n\tgenerated_query.Count = count\n\tgenerated_query.Filter = filter\n\tgenerated_query.Offset = offset\n\tgenerated_query.Orderby = orderby\n\n\t// Silence Usage\n\tcmd.SilenceUsage = true\n\n\tresp, err := client.CatalogService.ListWorkflowBuilds(workflowid, &generated_query)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsonx.Pprint(cmd, resp)\n\treturn nil\n}", "title": "" }, { "docid": "920f922eb12ce88def37fff21406d27f", "score": "0.49120122", "text": "func (org *Org) GetCatalogAccessControl(ctx context.Context, catalogIdentifier string, useTenantContext bool) (*types.ControlAccessParams, error) {\n\tcatalog, err := org.GetCatalogByNameOrId(ctx, catalogIdentifier, true)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error retrieving catalog %s: %s\", catalogIdentifier, err)\n\t}\n\treturn catalog.GetAccessControl(ctx, useTenantContext)\n}", "title": "" }, { "docid": "f49d555fb0eb00a118e8115f44a4b4c9", "score": "0.49110124", "text": "func (org *AdminOrg) GetCatalogAccessControl(ctx context.Context, catalogIdentifier string, useTenantContext bool) (*types.ControlAccessParams, error) {\n\tcatalog, err := org.GetAdminCatalogByNameOrId(ctx, catalogIdentifier, true)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error retrieving catalog %s: %s\", catalogIdentifier, err)\n\t}\n\treturn catalog.GetAccessControl(ctx, useTenantContext)\n}", "title": "" }, { "docid": "9e7b6fe28792756670397c8ac3c2ff87", "score": "0.49100214", "text": "func getServiceCatalogClusterRoles() []rbac.ClusterRole {\n\treturn []rbac.ClusterRole{\n\t\t{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: \"system:openshift:service-catalog:aggregate-to-admin\",\n\t\t\t\tLabels: map[string]string{\"rbac.authorization.k8s.io/aggregate-to-admin\": \"true\"},\n\t\t\t},\n\t\t\tRules: []rbac.PolicyRule{\n\t\t\t\trbac.NewRule(\"create\", \"update\", \"delete\", \"get\", \"list\", \"watch\", \"patch\").Groups(\"servicecatalog.k8s.io\").Resources(\"serviceinstances\", \"servicebindings\").RuleOrDie(),\n\t\t\t\trbac.NewRule(\"create\", \"update\", \"delete\", \"get\", \"list\", \"watch\").Groups(\"settings.k8s.io\").Resources(\"podpresets\").RuleOrDie(),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: \"system:openshift:service-catalog:aggregate-to-edit\",\n\t\t\t\tLabels: map[string]string{\"rbac.authorization.k8s.io/aggregate-to-edit\": \"true\"},\n\t\t\t},\n\t\t\tRules: []rbac.PolicyRule{\n\t\t\t\trbac.NewRule(\"create\", \"update\", \"delete\", \"get\", \"list\", \"watch\", \"patch\").Groups(\"servicecatalog.k8s.io\").Resources(\"serviceinstances\", \"servicebindings\").RuleOrDie(),\n\t\t\t\trbac.NewRule(\"create\", \"update\", \"delete\", \"get\", \"list\", \"watch\").Groups(\"settings.k8s.io\").Resources(\"podpresets\").RuleOrDie(),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: \"system:openshift:service-catalog:aggregate-to-view\",\n\t\t\t\tLabels: map[string]string{\"rbac.authorization.k8s.io/aggregate-to-view\": \"true\"},\n\t\t\t},\n\t\t\tRules: []rbac.PolicyRule{\n\t\t\t\trbac.NewRule(\"get\", \"list\", \"watch\").Groups(\"servicecatalog.k8s.io\").Resources(\"serviceinstances\", \"servicebindings\").RuleOrDie(),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: \"system:openshift:clusterservicebroker-client\",\n\t\t\t},\n\t\t\tRules: []rbac.PolicyRule{\n\t\t\t\trbac.NewRule(\"create\", \"update\", \"delete\", \"get\", \"list\", \"watch\", \"patch\").Groups(\"servicecatalog.k8s.io\").Resources(\"clusterservicebrokers\").RuleOrDie(),\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "7f2c83b2edc87b2b2faeb315bf863a58", "score": "0.49050072", "text": "func (c *Firewall) GetList(vsys string) ([]string, error) {\n\tans := c.container()\n\treturn c.ns.Listing(util.Get, c.pather(vsys), ans)\n}", "title": "" }, { "docid": "7f2c83b2edc87b2b2faeb315bf863a58", "score": "0.49050072", "text": "func (c *Firewall) GetList(vsys string) ([]string, error) {\n\tans := c.container()\n\treturn c.ns.Listing(util.Get, c.pather(vsys), ans)\n}", "title": "" }, { "docid": "dfa298a1a126d02db3643a1942138aab", "score": "0.4896773", "text": "func (r *Registry) Catalog(ctx context.Context, u string) ([]string, error) {\n\tif u == \"\" {\n\t\tu = \"/v2/_catalog\"\n\t}\n\turi := r.url(u)\n\tr.Logf(\"registry.catalog url=%s\", uri)\n\n\tvar response catalogResponse\n\th, err := r.getJSON(ctx, uri, &response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\to, err := url.Parse(uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlast := o.Query().Get(\"last\")\n\tfor i := 0; i < len(response.Repositories); i++ {\n\t\tif !strings.HasPrefix(response.Repositories[i], last) {\n\t\t\tresponse.Repositories = append([]string{}, response.Repositories[:i]...)\n\t\t\treturn response.Repositories, nil\n\t\t}\n\t}\n\n\tfor _, l := range link.ParseHeader(h) {\n\t\tif l.Rel == \"next\" {\n\t\t\tunescaped, _ := url.QueryUnescape(l.URI)\n\t\t\trepos, err := r.Catalog(ctx, unescaped)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresponse.Repositories = append(response.Repositories, repos...)\n\t\t}\n\t}\n\n\treturn response.Repositories, nil\n}", "title": "" }, { "docid": "89540561f407d7929c665e5b87fb4e75", "score": "0.48965284", "text": "func (c *CloudflowApplicationClient) List() (*domain.CloudflowApplicationList, error) {\n\tresult := domain.CloudflowApplicationList{}\n\terr := c.restClient.\n\t\tGet().\n\t\tResource(\"cloudflowapplications\").\n\t\tDo().\n\t\tInto(&result)\n\n\treturn &result, err\n}", "title": "" }, { "docid": "0f3917c72aa2d5fb374feb9a60b1ee82", "score": "0.48898384", "text": "func (o *ListCatalogParams) WithTimeout(timeout time.Duration) *ListCatalogParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "57dfed82fcde561decd9b099dd468db9", "score": "0.48720843", "text": "func (a *CatalogApiService) GetCatalogItems(ctx _context.Context) ApiGetCatalogItemsRequest {\n\treturn ApiGetCatalogItemsRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "3023ab2016c6007410f49cd3d7d1102e", "score": "0.4871699", "text": "func consulCatalog(server string) (*consul.Catalog, error) {\n\t// Create Consul Client\n\tconfig := consul.DefaultConfig()\n\tconfig.Address = server\n\tclient, err := consul.NewClient(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.Catalog(), nil\n}", "title": "" }, { "docid": "a6000b2ad21038b6af298a77d9aea686", "score": "0.4861024", "text": "func (c *Cataloger) Catalog(resolver source.FileResolver) ([]pkg.Package, error) {\n\tdbFileMatches, err := resolver.FilesByGlob(pkg.DpkgDBGlob)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to find dpkg status files's by glob: %w\", err)\n\t}\n\n\tvar results []pkg.Package\n\tvar pkgs []pkg.Package\n\tfor _, dbLocation := range dbFileMatches {\n\t\tdbContents, err := resolver.FileContentsByLocation(dbLocation)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpkgs, err = parseDpkgStatus(dbContents)\n\t\tinternal.CloseAndLogError(dbContents, dbLocation.VirtualPath)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to catalog dpkg package=%+v: %w\", dbLocation.RealPath, err)\n\t\t}\n\n\t\tfor i := range pkgs {\n\t\t\tp := &pkgs[i]\n\t\t\tp.FoundBy = c.Name()\n\t\t\tp.Locations = []source.Location{dbLocation}\n\n\t\t\t// the current entry only has what may have been listed in the status file, however, there are additional\n\t\t\t// files that are listed in multiple other locations. We should retrieve them all and merge the file lists\n\t\t\t// together.\n\t\t\tmergeFileListing(resolver, dbLocation, p)\n\n\t\t\t// fetch additional data from the copyright file to derive the license information\n\t\t\taddLicenses(resolver, dbLocation, p)\n\t\t}\n\n\t\tresults = append(results, pkgs...)\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "404863a3ccd0f597a59446f4ee5fd74f", "score": "0.48533648", "text": "func NewCatalog() *Catalog {\n\treturn &Catalog{\n\t\tDatabases: Databases{},\n\t\tFunctionRegistry: NewFunctionRegistry(),\n\t}\n}", "title": "" }, { "docid": "b41dea7e3ac5c3236e74624eb1545482", "score": "0.485074", "text": "func (r *CatalogsService) Get(name string) *CatalogsGetCall {\n\tc := &CatalogsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "title": "" }, { "docid": "87281454d6cd6e978fe8aaf8ca469853", "score": "0.4850154", "text": "func New() (*Catalog, error) {\n\tc := &Catalog{}\n\tresp, err := http.Get(catalogURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tif err = json.NewDecoder(resp.Body).Decode(c); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "0d432842a264b7a6da217fc5e76e9943", "score": "0.48421898", "text": "func NewCatalog(pkgs ...Package) *Catalog {\n\tcatalog := Catalog{\n\t\tbyID: make(map[ID]*Package),\n\t\tidsByType: make(map[Type][]ID),\n\t\tidsByPath: make(map[string][]ID),\n\t}\n\n\tfor _, p := range pkgs {\n\t\tcatalog.Add(p)\n\t}\n\n\treturn &catalog\n}", "title": "" }, { "docid": "3f2851fd8c4433a99dbb2629f47d1a5a", "score": "0.48370174", "text": "func GetServiceCatalogClusterRoles() []rbac.ClusterRole {\n\treturn []rbac.ClusterRole{\n\t\t{\n\t\t\tObjectMeta: v1.ObjectMeta{\n\t\t\t\tName: \"system:openshift:service-catalog:aggregate-to-admin\",\n\t\t\t\tLabels: map[string]string{\"rbac.authorization.k8s.io/aggregate-to-admin\": \"true\"},\n\t\t\t},\n\t\t\tRules: []rbac.PolicyRule{\n\t\t\t\trbac.NewRule(\"create\", \"update\", \"delete\", \"get\", \"list\", \"watch\", \"patch\").Groups(\"servicecatalog.k8s.io\").Resources(\"serviceinstances\", \"servicebindings\").RuleOrDie(),\n\t\t\t\trbac.NewRule(\"create\", \"update\", \"delete\", \"get\", \"list\", \"watch\").Groups(\"settings.k8s.io\").Resources(\"podpresets\").RuleOrDie(),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tObjectMeta: v1.ObjectMeta{\n\t\t\t\tName: \"system:openshift:service-catalog:aggregate-to-edit\",\n\t\t\t\tLabels: map[string]string{\"rbac.authorization.k8s.io/aggregate-to-edit\": \"true\"},\n\t\t\t},\n\t\t\tRules: []rbac.PolicyRule{\n\t\t\t\trbac.NewRule(\"create\", \"update\", \"delete\", \"get\", \"list\", \"watch\", \"patch\").Groups(\"servicecatalog.k8s.io\").Resources(\"serviceinstances\", \"servicebindings\").RuleOrDie(),\n\t\t\t\trbac.NewRule(\"create\", \"update\", \"delete\", \"get\", \"list\", \"watch\").Groups(\"settings.k8s.io\").Resources(\"podpresets\").RuleOrDie(),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tObjectMeta: v1.ObjectMeta{\n\t\t\t\tName: \"system:openshift:service-catalog:aggregate-to-view\",\n\t\t\t\tLabels: map[string]string{\"rbac.authorization.k8s.io/aggregate-to-view\": \"true\"},\n\t\t\t},\n\t\t\tRules: []rbac.PolicyRule{\n\t\t\t\trbac.NewRule(\"get\", \"list\", \"watch\").Groups(\"servicecatalog.k8s.io\").Resources(\"serviceinstances\", \"servicebindings\").RuleOrDie(),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tObjectMeta: v1.ObjectMeta{\n\t\t\t\tName: ClusterServiceBrokerAdminRoleName,\n\t\t\t},\n\t\t\tRules: []rbac.PolicyRule{\n\t\t\t\trbac.NewRule(\"create\", \"update\", \"delete\", \"get\", \"list\", \"watch\", \"patch\").Groups(\"servicecatalog.k8s.io\").Resources(\"clusterservicebrokers\").RuleOrDie(),\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "019d91f6bd7b6d8457d7fa77cf5ae8bf", "score": "0.48367983", "text": "func (s *resourceCompositionLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceComposition, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.ResourceComposition))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "fcfd2a3efafa6aee227a851a89ebf362", "score": "0.48278505", "text": "func (wr *Wrangler) ListActiveWorkflows(ctx context.Context, keyspace string) ([]string, error) {\n\treturn wr.ListAllWorkflows(ctx, keyspace, true)\n}", "title": "" }, { "docid": "5883d0c9b22f3d2bb2315243762f613b", "score": "0.4815455", "text": "func XCatalogsByOrgID(db XODB, orgID uint) ([]*XCatalog, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, name, display_name, seq_num, type_cd, par_catalog_id, master_catalog_id, active_flag, att_id, demo_id, org_id, created_by, updated_by, created_at, updated_at ` +\n\t\t`FROM x_showroom.x_catalog ` +\n\t\t`WHERE org_id = ?`\n\n\t// run query\n\tXOLog(sqlstr, orgID)\n\tq, err := db.Query(sqlstr, orgID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*XCatalog{}\n\tfor q.Next() {\n\t\txc := XCatalog{\n\t\t\t_exists: true,\n\t\t}\n\n\t\t// scan\n\t\terr = q.Scan(&xc.ID, &xc.Name, &xc.DisplayName, &xc.SeqNum, &xc.TypeCd, &xc.ParCatalogID, &xc.MasterCatalogID, &xc.ActiveFlag, &xc.AttID, &xc.DemoID, &xc.OrgID, &xc.CreatedBy, &xc.UpdatedBy, &xc.CreatedAt, &xc.UpdatedAt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &xc)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "856d0cc3e9a37f55b6965f4fa981424c", "score": "0.48000255", "text": "func XCatalogsByParCatalogID(db XODB, parCatalogID sql.NullInt64) ([]*XCatalog, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, name, display_name, seq_num, type_cd, par_catalog_id, master_catalog_id, active_flag, att_id, demo_id, org_id, created_by, updated_by, created_at, updated_at ` +\n\t\t`FROM x_showroom.x_catalog ` +\n\t\t`WHERE par_catalog_id = ?`\n\n\t// run query\n\tXOLog(sqlstr, parCatalogID)\n\tq, err := db.Query(sqlstr, parCatalogID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*XCatalog{}\n\tfor q.Next() {\n\t\txc := XCatalog{\n\t\t\t_exists: true,\n\t\t}\n\n\t\t// scan\n\t\terr = q.Scan(&xc.ID, &xc.Name, &xc.DisplayName, &xc.SeqNum, &xc.TypeCd, &xc.ParCatalogID, &xc.MasterCatalogID, &xc.ActiveFlag, &xc.AttID, &xc.DemoID, &xc.OrgID, &xc.CreatedBy, &xc.UpdatedBy, &xc.CreatedAt, &xc.UpdatedAt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &xc)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "e3739e82beb5007272ae2fb2620f1fe6", "score": "0.47985634", "text": "func (c *Client) PluginCatalog() PluginCatalogInterface {\n\treturn newPluginCatalog(c)\n}", "title": "" }, { "docid": "96a71dcde38a2df0590fbc6138f1ce55", "score": "0.47946465", "text": "func (a *WorkflowApiService) GetWorkflowCatalogByMoidExecute(r ApiGetWorkflowCatalogByMoidRequest) (WorkflowCatalog, *_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 WorkflowCatalog\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"WorkflowApiService.GetWorkflowCatalogByMoid\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/workflow/Catalogs/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", _neturl.PathEscape(parameterToString(r.moid, \"\")), -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\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 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\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\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": "685e34ca8d1e96085c016ec749fb5605", "score": "0.47792506", "text": "func (m *AccessPackageCatalog) GetResources()([]AccessPackageResourceable) {\n val, err := m.GetBackingStore().Get(\"resources\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]AccessPackageResourceable)\n }\n return nil\n}", "title": "" }, { "docid": "b333d4c9d5ac5365b229bb551987817e", "score": "0.47640002", "text": "func catalogEndpoint() string {\n\treturn \"/v1/catalogs\"\n}", "title": "" }, { "docid": "1c36000aafee8b7a7a2b990702b9af5c", "score": "0.47520858", "text": "func catalog(b Broker, req *restful.Request) *Response {\n\treturn b.Catalog()\n}", "title": "" }, { "docid": "f0092e9bdae01f8e61626980114b208e", "score": "0.47508827", "text": "func getTestCatalog() *brokerapi.Catalog {\n\treturn &brokerapi.Catalog{\n\t\tServices: []*brokerapi.Service{\n\t\t\t{\n\t\t\t\tName: testServiceClassName,\n\t\t\t\tID: serviceClassGUID,\n\t\t\t\tDescription: \"a test service\",\n\t\t\t\tBindable: true,\n\t\t\t\tPlans: []brokerapi.ServicePlan{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: testPlanName,\n\t\t\t\t\t\tFree: true,\n\t\t\t\t\t\tID: planGUID,\n\t\t\t\t\t\tDescription: \"a test plan\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "8227b5df6953b9b3420d12362e3d0b08", "score": "0.47470415", "text": "func (c *deploymentsClass) getList(ns string, listOptions meta.ListOptions) (*kext.DeploymentList, error) {\n\treturn c.rk.clientset.Extensions().Deployments(ns).List(listOptions)\n}", "title": "" }, { "docid": "74dce9e8c8b61c549d18b88fff6ce049", "score": "0.4741416", "text": "func (c *Catalog) Resources() ([]Resource, error) {\n\tvar resources []Resource\n\n\tfor name, schema := range c.definitions() {\n\t\tdesc, err := ParseDescription(name)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"parse description for %s\", name)\n\t\t}\n\n\t\tcomponent, err := NewComponent(schema)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tprops, err := c.extractFn(c, schema.Properties)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"extract propererties from %s\", name)\n\t\t}\n\n\t\tkind := NewResource(name, schema.Description, desc.Group, *component, props)\n\n\t\tresources = append(resources, kind)\n\t}\n\n\treturn resources, nil\n}", "title": "" }, { "docid": "0c724c9b2716d03f2ab7ae97501f4c3c", "score": "0.4729037", "text": "func (wc *WorkflowClient) ListOpenWorkflow(ctx context.Context, request *workflowservice.ListOpenWorkflowExecutionsRequest) (*workflowservice.ListOpenWorkflowExecutionsResponse, error) {\n\tif request.GetNamespace() == \"\" {\n\t\trequest.Namespace = wc.namespace\n\t}\n\tgrpcCtx, cancel := newGRPCContext(ctx, defaultGrpcRetryParameters(ctx))\n\tdefer cancel()\n\tresponse, err := wc.workflowService.ListOpenWorkflowExecutions(grpcCtx, request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "e1f0e44d05d9e7c383441aa91a2dae61", "score": "0.4720376", "text": "func (a AssetController) List(ctx context.Context, pred *store.SelectionPredicate) ([]corev2.Resource, error) {\n\t// Fetch from store\n\tresults, err := a.store.GetAssets(ctx, pred)\n\tif err != nil {\n\t\treturn nil, NewError(InternalErr, err)\n\t}\n\n\tresources := make([]corev2.Resource, len(results))\n\tfor i, v := range results {\n\t\tresources[i] = corev2.Resource(v)\n\t}\n\n\treturn resources, nil\n}", "title": "" }, { "docid": "0ee8af131f6874230c3171da8f3f0d7b", "score": "0.47187608", "text": "func GetCatalogTable(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *CatalogTableState, opts ...pulumi.ResourceOption) (*CatalogTable, error) {\n\tvar resource CatalogTable\n\terr := ctx.ReadResource(\"aws:glue/catalogTable:CatalogTable\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "3de4ef4d45e0fb0640e44dbe14ebe92c", "score": "0.47024095", "text": "func (c *Cataloger) Catalog(resolver source.FileResolver) ([]pkg.Package, error) {\n\tpkgs := make([]pkg.Package, 0)\n\tfileMatches, err := resolver.FilesByMIMEType(mimeTypes...)\n\tif err != nil {\n\t\treturn pkgs, fmt.Errorf(\"failed to find bin by mime types: %w\", err)\n\t}\n\n\tfor _, location := range fileMatches {\n\t\tr, err := resolver.FileContentsByLocation(location)\n\t\tif err != nil {\n\t\t\treturn pkgs, fmt.Errorf(\"failed to resolve file contents by location: %w\", err)\n\t\t}\n\n\t\tgoPkgs, err := parseGoBin(location, r)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"could not parse possible go binary: %+v\", err)\n\t\t}\n\n\t\tr.Close()\n\t\tpkgs = append(pkgs, goPkgs...)\n\t}\n\n\treturn pkgs, nil\n}", "title": "" }, { "docid": "af30bae000601c7b39a16a036b38f573", "score": "0.46978948", "text": "func (in *CamelCatalogList) DeepCopy() *CamelCatalogList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CamelCatalogList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ad30cc309936a58be764edc3c0bd9c90", "score": "0.46957392", "text": "func catalogSource(namespace, name string) *v1alpha1.CatalogSource {\n\treturn &v1alpha1.CatalogSource{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: namespace,\n\t\t\tName: name,\n\t\t\tSelfLink: clientfake.BuildSelfLink(v1alpha1.SchemeGroupVersion.String(), \"catalogsources\", namespace, name),\n\t\t\tUID: types.UID(name),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "ed699667bbcd86a7c341005290f8a5ba", "score": "0.46885517", "text": "func (r *AccessPackageCatalogRequest) Get(ctx context.Context) (resObj *AccessPackageCatalog, 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": "f6538116aae9b15788aa6680f323adb7", "score": "0.46880943", "text": "func ExampleADCOperationsClient_List() {\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 := armdatacatalog.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewADCOperationsClient().List(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.OperationEntityListResult = armdatacatalog.OperationEntityListResult{\n\t// \tValue: []*armdatacatalog.OperationEntity{\n\t// \t\t{\n\t// \t\t\tName: to.Ptr(\"Microsoft.DataCatalog/catalogs/read\"),\n\t// \t\t\tDisplay: &armdatacatalog.OperationDisplayInfo{\n\t// \t\t\t\tDescription: to.Ptr(\"Get properties for catalog or catalogs under subscription or resource group.\"),\n\t// \t\t\t\tOperation: to.Ptr(\"Catalog Read Or List\"),\n\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Data Catalog\"),\n\t// \t\t\t\tResource: to.Ptr(\"Catalog\"),\n\t// \t\t\t},\n\t// \t\t},\n\t// \t\t{\n\t// \t\t\tName: to.Ptr(\"Microsoft.DataCatalog/catalogs/write\"),\n\t// \t\t\tDisplay: &armdatacatalog.OperationDisplayInfo{\n\t// \t\t\t\tDescription: to.Ptr(\"Creates catalog or updates the tags and properties for the catalog.\"),\n\t// \t\t\t\tOperation: to.Ptr(\"Create Or Update Catalog\"),\n\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Data Catalog\"),\n\t// \t\t\t\tResource: to.Ptr(\"Catalog\"),\n\t// \t\t\t},\n\t// \t\t},\n\t// \t\t{\n\t// \t\t\tName: to.Ptr(\"Microsoft.DataCatalog/catalogs/delete\"),\n\t// \t\t\tDisplay: &armdatacatalog.OperationDisplayInfo{\n\t// \t\t\t\tDescription: to.Ptr(\"Deletes the catalog.\"),\n\t// \t\t\t\tOperation: to.Ptr(\"Delete Catalog\"),\n\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Data Catalog\"),\n\t// \t\t\t\tResource: to.Ptr(\"Catalog\"),\n\t// \t\t\t},\n\t// \t\t},\n\t// \t\t{\n\t// \t\t\tName: to.Ptr(\"Microsoft.DataCatalog/operations/read\"),\n\t// \t\t\tDisplay: &armdatacatalog.OperationDisplayInfo{\n\t// \t\t\t\tDescription: to.Ptr(\"Lists operations available on Microsoft.DataCatalog resource provider.\"),\n\t// \t\t\t\tOperation: to.Ptr(\"List Available Catalog Operations\"),\n\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Data Catalog\"),\n\t// \t\t\t\tResource: to.Ptr(\"Available Catalog Operations\"),\n\t// \t\t\t},\n\t// \t}},\n\t// }\n}", "title": "" }, { "docid": "ae496eb0be6035edd0c691fc9e0839a7", "score": "0.46860373", "text": "func (o *ListCatalogParams) WithCursor(cursor *string) *ListCatalogParams {\n\to.SetCursor(cursor)\n\treturn o\n}", "title": "" }, { "docid": "be7fe99a23f128ffcd09e2d03bb49def", "score": "0.46809393", "text": "func (s *LibraryService) ListSharedResources() (*LibraryListSharedResourcesResponse, *http.Response, error) {\n\tencodedResponse := make(map[string]interface{})\n\tdecodedResponse := new(LibraryListSharedResourcesResponse)\n\tapiError := new(APIError)\n\n\tresp, err := s.sling.New().Get(\"library/acl\").Receive(&encodedResponse, apiError)\n\tif err := relevantError(err, apiError); err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\tif err := mapstructure.Decode(encodedResponse, &decodedResponse.SharedResources); err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn decodedResponse, resp, nil\n}", "title": "" }, { "docid": "c045a75ef29d27b5a2f13242bc599e0e", "score": "0.46658263", "text": "func List(ctx context.Context, svc iaas.Service) (list []abstract.ClusterIdentity, xerr fail.Error) {\n\tvar emptyList []abstract.ClusterIdentity\n\n\tif ctx == nil {\n\t\treturn emptyList, fail.InvalidParameterCannotBeNilError(\"ctx\")\n\t}\n\tif svc == nil {\n\t\treturn emptyList, fail.InvalidParameterCannotBeNilError(\"svc\")\n\t}\n\n\tinstance, xerr := New(svc)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\tlist = []abstract.ClusterIdentity{}\n\txerr = instance.Browse(ctx, func(hc *abstract.ClusterIdentity) fail.Error {\n\t\tlist = append(list, *hc)\n\t\treturn nil\n\t})\n\treturn list, xerr\n}", "title": "" }, { "docid": "718e037f554e5fd5d336b30a4a009dad", "score": "0.46598434", "text": "func NewWorkflow_connect_Results_List(s *capnp.Segment, sz int32) (Workflow_connect_Results_List, error) {\n\tl, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz)\n\treturn Workflow_connect_Results_List{l}, err\n}", "title": "" }, { "docid": "5b1c48d24fca01a0cc650efed121ed7a", "score": "0.4655404", "text": "func (c *connect) GetConnectors() (*GetAllConnectorsResponse, error) {\n\t// get connectors\n\tresponse := new(GetAllConnectorsResponse)\n\tresp, err := c.client.NewRequest().\n\t\tSetResult(&response).\n\t\tGet(\"connectors/\")\n\n\tif err != nil {\n\t\tlogger.Errorf(\"Could not get connectors %v\", err.Error())\n\t\treturn nil, err\n\t}\n\tif resp.StatusCode() >= 400 {\n\t\tlogger.Errorf(\"Get connectors failed with status code: %v\", resp.StatusCode())\n\t\treturn nil, errors.Errorf(\"get connectors error: %v\", resp.String())\n\t}\n\tresponse.Code = resp.StatusCode()\n\treturn response, nil\n}", "title": "" }, { "docid": "093bbc0bedeea0ba9aa40c1a62f3f737", "score": "0.4642758", "text": "func (a RoleBindingController) List(ctx context.Context, pred *store.SelectionPredicate) ([]corev2.Resource, error) {\n\t// Fetch from store\n\tresults, err := a.store.ListRoleBindings(ctx, pred)\n\tif err != nil {\n\t\treturn nil, NewError(InternalErr, err)\n\t}\n\n\tresources := make([]corev2.Resource, len(results))\n\tfor i, v := range results {\n\t\tresources[i] = corev2.Resource(v)\n\t}\n\n\treturn resources, nil\n}", "title": "" }, { "docid": "f6c4fcf76c2dd5cdfb8c6267979e1beb", "score": "0.46361157", "text": "func GetScCategories(db XODB) ([]*ScCategory, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`* ` +\n\t\t`FROM sc_category`\n\n\t// run query\n\tXOLog(sqlstr)\n\tq, err := db.Query(sqlstr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*ScCategory{}\n\tfor q.Next() {\n\t\tsc := ScCategory{}\n\n\t\t// scan\n\t\terr = q.Scan(&sc.ID, &sc.CategoryName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &sc)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "4c5c88ce5e984e5c04ca86c750b36e4b", "score": "0.46359393", "text": "func (sd *ShopifyDownloader) GetListSmartCollection(query map[string]string) (ShopifySmartCollections, error) {\n\tpath := \"/admin/smart_collections.json\"\n\turl, err := sd.BuildURL(path, query)\n\n\tdata, err := RequestAndRead(sd.NetClient, url)\n\n\tvar ssc ShopifySmartCollections\n\tjson.Unmarshal(data, &ssc)\n\tif err != nil {\n\t\treturn ssc, nil\n\t}\n\treturn ssc, nil\n}", "title": "" }, { "docid": "c3e2620b068ff0b3857db5677a678e0a", "score": "0.46313503", "text": "func NewCatalog(apiSpec *spec.Swagger, opts ...CatalogOpt) (*Catalog, error) {\n\tif apiSpec == nil {\n\t\treturn nil, errors.New(\"apiSpec is nil\")\n\t}\n\n\tc := &Catalog{\n\t\tapiSpec: apiSpec,\n\t\textractFn: extractProperties,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(c)\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "3f97a30997d334f6ae9e2a9eabe60439", "score": "0.4625516", "text": "func (c *Cluster) ClientServiceCatalog(res string) (dynamic.NamespaceableResourceInterface, error) {\n\tgvr := schema.GroupVersionResource{\n\t\tGroup: \"servicecatalog.k8s.io\",\n\t\tVersion: \"v1beta1\",\n\t\tResource: res,\n\t}\n\n\tdynamicClient, err := dynamic.NewForConfig(c.RestConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn dynamicClient.Resource(gvr), nil\n}", "title": "" }, { "docid": "9c695cb049cd2ddb7b742dfdf4f0418e", "score": "0.46129516", "text": "func (m *AccessPackageCatalog) GetCatalogType()(*AccessPackageCatalogType) {\n val, err := m.GetBackingStore().Get(\"catalogType\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*AccessPackageCatalogType)\n }\n return nil\n}", "title": "" }, { "docid": "793db15e85a388900b31da83e82c91a6", "score": "0.4602279", "text": "func LoadCatalog(f string) map[string]string {\n\n\tjsonFile, err := os.Open(f)\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to open %s file. %s\", jsonFile, err)\n\t}\n\n\tvar catalog UrlsCatalog\n\tbytes, _ := ioutil.ReadAll(jsonFile)\n\terr = json.Unmarshal(bytes, &catalog)\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to load json. %s\", err)\n\t}\n\tlog.Println(\"JSON FILE LOADED !!\")\n\tmapa := make(map[string]string)\n\tfor _, u := range catalog.Catalog {\n\t\tmapa[u.ShortName] = u.Url\n\t}\n\treturn mapa\n}", "title": "" }, { "docid": "837f896d1e861d7ec62b022df0cd584d", "score": "0.45841965", "text": "func XCatalogsByAttID(db XODB, attID sql.NullInt64) ([]*XCatalog, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, name, display_name, seq_num, type_cd, par_catalog_id, master_catalog_id, active_flag, att_id, demo_id, org_id, created_by, updated_by, created_at, updated_at ` +\n\t\t`FROM x_showroom.x_catalog ` +\n\t\t`WHERE att_id = ?`\n\n\t// run query\n\tXOLog(sqlstr, attID)\n\tq, err := db.Query(sqlstr, attID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*XCatalog{}\n\tfor q.Next() {\n\t\txc := XCatalog{\n\t\t\t_exists: true,\n\t\t}\n\n\t\t// scan\n\t\terr = q.Scan(&xc.ID, &xc.Name, &xc.DisplayName, &xc.SeqNum, &xc.TypeCd, &xc.ParCatalogID, &xc.MasterCatalogID, &xc.ActiveFlag, &xc.AttID, &xc.DemoID, &xc.OrgID, &xc.CreatedBy, &xc.UpdatedBy, &xc.CreatedAt, &xc.UpdatedAt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &xc)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "6ab66e5ea8755310777c0bb258aa1774", "score": "0.45740646", "text": "func (d *ReaderDefaultImpl) Catalog() *Catalog {\n\treturn d.catalog\n}", "title": "" }, { "docid": "f2393da9cbf6941f3837358cacf297ca", "score": "0.4569202", "text": "func CatalogByRegex(network *net.Network, regex string) ([]models.CatalogItemSummary, error) {\n\turl := fmt.Sprintf(\"/v1/catalog/applications/?regex=%s&allVersions=false\", regex)\n\tvar response []models.CatalogItemSummary\n\tbody, err := network.SendGetRequest(url)\n\tif err != nil {\n\t\treturn response, err\n\t}\n\terr = json.Unmarshal(body, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "9735b517c4c7022d791a0163ed83e775", "score": "0.45485497", "text": "func (c *PluginCatalog) List(ctx context.Context) ([]string, error) {\n\tc.lock.RLock()\n\tdefer c.lock.RUnlock()\n\n\t// Collect keys for external plugins in the barrier.\n\tkeys, err := logical.CollectKeys(ctx, c.catalogView)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get the keys for builtin plugins\n\tbuiltinKeys := builtinplugins.Keys()\n\n\t// Use a map to unique the two lists\n\tmapKeys := make(map[string]bool)\n\n\tfor _, plugin := range keys {\n\t\tmapKeys[plugin] = true\n\t}\n\n\tfor _, plugin := range builtinKeys {\n\t\tmapKeys[plugin] = true\n\t}\n\n\tretList := make([]string, len(mapKeys))\n\ti := 0\n\tfor k := range mapKeys {\n\t\tretList[i] = k\n\t\ti++\n\t}\n\t// sort for consistent ordering of builtin plugins\n\tsort.Strings(retList)\n\n\treturn retList, nil\n}", "title": "" }, { "docid": "3aab005c6c25511b2b43b561c0d394c3", "score": "0.45376724", "text": "func (s *StoreToWorkflowLister) List() (workflows api.WorkflowList, err error) {\n\tfor i := range s.Store.List() {\n\t\tw, ok := s.Store.List()[i].(*wapi.Workflow)\n\t\tif !ok {\n\t\t\tglog.Errorf(\"Expected Workflow type. Unexpected object of type: %v %#v\", reflect.TypeOf(w), w)\n\t\t\tcontinue\n\t\t}\n\t\tworkflows.Items = append(workflows.Items, *w)\n\t}\n\treturn workflows, nil\n}", "title": "" }, { "docid": "4ed33cb3c9129b5dc5d81e29ad0afb46", "score": "0.45351186", "text": "func (o *ForecastDefinition) GetCatalogOk() (*ForecastCatalogRelationship, bool) {\n\tif o == nil || o.Catalog == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Catalog, true\n}", "title": "" }, { "docid": "b95f3bba3a97264ed42ff8ef971bb44c", "score": "0.45267522", "text": "func (svc *CompanyDomService) GetList(ctx context.Context, f []*filters.Filter) ([]*domain.Company, error) {\n\treturn svc.store.Company.GetList(ctx, f)\n}", "title": "" }, { "docid": "5545f173c962196f6ae6cab599daf9a9", "score": "0.45226747", "text": "func NewCatalog(coll *mongo.Collection) *MongoCatalog {\n\treturn &MongoCatalog{\n\t\tcollection: coll,\n\t}\n}", "title": "" }, { "docid": "54adbcd44d13e12387206822577a17b7", "score": "0.45219305", "text": "func ListWorkflowTemplate(ctx context.Context, projectID string) ([]*model.ManifestTemplate, error) {\n\ttemplates, err := dbSchemaWorkflowTemplate.GetTemplatesByProjectID(ctx, projectID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar templateList []*model.ManifestTemplate\n\n\tfor _, template := range templates {\n\t\ttemplateList = append(templateList, template.GetManifestTemplateOutput())\n\t}\n\treturn templateList, err\n}", "title": "" }, { "docid": "efdb5b2968d9024d384505ae838a6ad6", "score": "0.45014215", "text": "func (service Service) GetList(pagination entity.Pagination) (asset []entity.Asset, count int, err error) {\n\tasset, count, err = service.repository.GetList(pagination)\n\treturn\n}", "title": "" }, { "docid": "050f39d877d27889943991a237d3e922", "score": "0.44991016", "text": "func (s resourceCompositionNamespaceLister) Get(name string) (*v1alpha1.ResourceComposition, 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(\"resourcecomposition\"), name)\n\t}\n\treturn obj.(*v1alpha1.ResourceComposition), nil\n}", "title": "" }, { "docid": "07ede463d8ff5e0b7cf43202033c80c7", "score": "0.4492639", "text": "func (dbctrl *Controller) LoadCatalog(catalogName api.CatalogName) (api.Catalog, error) {\n\tcatalogNameChunks := strings.Split(string(catalogName), \"/\")\n\tcatalogPath := filepath.Join(append([]string{dbctrl.BasePath}, catalogNameChunks...)...)\n\n\tf, err := os.OpenFile(filepath.Join(catalogPath, \"catalog.json\"), os.O_RDONLY, 0)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn api.Catalog{}, Errorf(ErrNotFound, \"no catalog named %q in db\", catalogName)\n\t\t}\n\t\treturn api.Catalog{}, Recategorize(ErrIO, err)\n\t}\n\tdefer f.Close()\n\n\tvar catalog api.Catalog\n\terr = json.NewUnmarshallerAtlased(f, api.HitchAtlas).\n\t\tUnmarshal(&catalog)\n\treturn catalog, Recategorize(ErrStorageCorrupt, err)\n}", "title": "" }, { "docid": "7d7d75704f79d318755c89e3c8ef1b44", "score": "0.448848", "text": "func transformResourceviewsCatalogViewToCatalog(v *resourceviews.CatalogView) *Catalog {\n\tres := &Catalog{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tType: *v.Type,\n\t\tURL: *v.URL,\n\t\tProvider: *v.Provider,\n\t}\n\n\treturn res\n}", "title": "" } ]
f11fbebcd0781f122d4dd08c33dda742
Take forbids other readers to read this book
[ { "docid": "8fed2bb6a4952ab17e0f9b64c37219fe", "score": "0.5376335", "text": "func (b *Book) Take() {\n\tb.mu.Lock()\n\tb.isTaken = true\n\tb.mu.Unlock()\n}", "title": "" } ]
[ { "docid": "e7ee562e454cc3fd694dbea2bee4211f", "score": "0.5381363", "text": "func (me TxsdCitetitlePubwork) IsBook() bool { return me == \"book\" }", "title": "" }, { "docid": "f5bac4347dae4ea2e4dc9c49ec10c336", "score": "0.51723033", "text": "func (p *p4ProtectLine) affectsReadAccess() bool {\n\treturn (p.isExclusion && p.revokesReadAccess()) ||\n\t\t(!p.isExclusion && p.grantsReadAccess())\n}", "title": "" }, { "docid": "31c6fff12321a8a28ce318d82ba7e63f", "score": "0.51557255", "text": "func (C *character) spellBook(sort string, rang int) {\n\tfor i := 0; i < len(C.skill); i++ {\n\t}\n\tC.skill = append(C.skill, sort)\n\tprintln(\"Vous avez appris un nouveau sort\")\n\tC.removestuff(rang)\n}", "title": "" }, { "docid": "2b43abddbf4d1110cbec5f2c6346c039", "score": "0.5145404", "text": "func validateBook(book Book) string {\n\tvar msgs []string\n\tif msg := checkRequiredString(\"Title\", book.Title); msg != \"\" {\n\t\tmsgs = append(msgs, msg)\n\t}\n\tif msg := checkRequiredString(\"Author\", book.Author); msg != \"\" {\n\t\tmsgs = append(msgs, msg)\n\t}\n\tif msg := checkRequiredString(\"Publisher\", book.Publisher); msg != \"\" {\n\t\tmsgs = append(msgs, msg)\n\t}\n\tif msg := checkValidDate(\"Publish Date\", book.PublishDate); msg != \"\" {\n\t\tmsgs = append(msgs, msg)\n\t}\n\tif msg := checkRangedInt(\"Rating\", book.Rating, 1, 3); msg != \"\" {\n\t\tmsgs = append(msgs, msg)\n\t}\n\tif msg := checkEnumeratedString(\"Status\", book.Status, []string{\"CheckedIn\", \"CheckedOut\"}); msg != \"\" {\n\t\tmsgs = append(msgs, msg)\n\t}\n\tif len(msgs) > 0 {\n\t\treturn strings.Join(msgs, \"; \")\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "2dc68015809a9029798fcbea086ddac8", "score": "0.5114185", "text": "func (b *Book) IsTaken() bool {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\treturn b.isTaken\n}", "title": "" }, { "docid": "a6753645e8c305cef5dfddea6435324c", "score": "0.50069994", "text": "func (m *AuthorMutation) BooksCleared() bool {\n\treturn m.clearedbooks\n}", "title": "" }, { "docid": "4f88cc3a3a8b04de3afe55e48da7a226", "score": "0.499771", "text": "func checkForHowEarlyToBook(n *nomad) {\n\t/* Define a handful of static locations to use as reference points */\n\t/* That's about 500 Requests, this should happen infrequently, like each month */\n\tfrom := []string{\"CLE\", \"CVG\", \"PIT\"}\n\tto := []string{\"DEN\", \"PIE\", \"LAX\"}\n\tbase := time.Now()\n\n\tscrape := n.bots[0]\n\n\tfor _, F := range from {\n\t\tfor _, T := range to {\n\t\t\tscrape.AToBDuring(F, T, base, base.AddDate(0, 1, 0)) // 0-30d\n\t\t\tscrape.AToBDuring(F, T, base.AddDate(0, 0, 6*7), base.AddDate(0, 0, 7*7)) // Buddy said 6 Weeks in the best, so let's check that\n\t\t\tscrape.AToBNearDate(F, T, base.AddDate(0, 2, 0)) // 60-65d\n\t\t\tscrape.AToBNearDate(F, T, base.AddDate(0, 6, 0)) // 180-185d\n\t\t}\n\t}\n\t/* TODO: Consider reducing data here into a selection of the answer to the question named by the method header */\n}", "title": "" }, { "docid": "76f04bebd762e0d7463950865c8362c6", "score": "0.49824798", "text": "func (p *p4ProtectLine) revokesReadAccess() bool {\n\t_, canRevokeReadAccess := map[string]struct{}{\n\t\t\"list\": {},\n\t\t\"read\": {},\n\t\t\"=read\": {},\n\t\t\"open\": {},\n\t\t\"write\": {},\n\t\t\"review\": {},\n\t\t\"owner\": {},\n\t\t\"admin\": {},\n\t\t\"super\": {},\n\t}[p.level]\n\treturn canRevokeReadAccess\n}", "title": "" }, { "docid": "f0fcbeb4c807ea3d8c0196ba19379661", "score": "0.4943449", "text": "func (self *qbsWrappedUdid) AllowRead(pb PBundle) bool {\n\tallow, ok := self.index.(AllowReader)\n\tif !ok {\n\t\treturn true\n\t}\n\treturn allow.AllowRead(pb)\n}", "title": "" }, { "docid": "a8314f36269aaf6770f6f937065438e8", "score": "0.4933283", "text": "func (tr *Reader) skipUnread() {\n\tnr := tr.nb + tr.pad;\t// number of bytes to skip\n\n\tif sr, ok := tr.r.(io.Seeker); ok {\n\t\t_, tr.err = sr.Seek(nr, 1)\n\t} else {\n\t\t_, tr.err = io.Copyn(ignoreWriter{}, tr.r, nr)\n\t}\n\ttr.nb, tr.pad = 0, 0;\n}", "title": "" }, { "docid": "00617a359e4a2af69ecca0d5cc658288", "score": "0.4839961", "text": "func (self *qbsWrapped) AllowRead(pb PBundle) bool {\n\tallow, ok := self.index.(AllowReader)\n\tif !ok {\n\t\treturn true\n\t}\n\treturn allow.AllowRead(pb)\n}", "title": "" }, { "docid": "5fd9243685324bc0f1e769c4c8a3a9a3", "score": "0.4838468", "text": "func (m *AuthorMutation) ClearBooks() {\n\tm.clearedbooks = true\n}", "title": "" }, { "docid": "c2a46d27c9989bc796e3ebedacf0ee7d", "score": "0.48150197", "text": "func validateBookAvailable(s *pgService, p *domain.BorrowRecord) error {\n\tif err := s.db.Where(\"book_id = ?\", p.BookID).Find(&domain.BorrowRecord{}).Error; err != nil {\n\t\tif err == gorm.ErrRecordNotFound {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\treturn ErrBookNotAvailable\n}", "title": "" }, { "docid": "142169481267d04f3105386b4fadeed6", "score": "0.48126298", "text": "func (tr *Reader) skipUnread() {\n\tnr := tr.nb // number of bytes to skip\n\tif tr.pad {\n\t\tnr += int64(1)\n\t\ttr.pad = false\n\t}\n\ttr.nb = 0\n\tif sr, ok := tr.r.(io.Seeker); ok {\n\t\tif _, err := sr.Seek(nr, os.SEEK_CUR); err == nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\t_, tr.err = io.CopyN(ioutil.Discard, tr.r, nr)\n}", "title": "" }, { "docid": "ad86a5412b921be753653d3af6900233", "score": "0.47998214", "text": "func markBrowsed(session *Session, storyid int64) {\n\n\t// We are about to access stories\n\tstories.mutex.RLock()\n\tdefer stories.mutex.RUnlock()\n\n\tif storyid < stories.start || storyid < session.haveBrowsed {\n\t\tconfig.Debug(\"Not marking browsed \", storyid, \", \",\n\t\t\tstories.start, \", \", session.haveBrowsed)\n\t\tsession.filtered = session.filtered[0:0]\n\t\tsession.unfiltered = session.unfiltered[0:0]\n\t\treturn\n\t}\n\n\tif storyid > stories.end {\n\t\tlog.Println(\"User has browsed past the last story\", storyid, \">\", stories.end)\n\t\tsession.filtered = session.filtered[0:0]\n\t\tsession.unfiltered = session.unfiltered[0:0]\n\t\treturn\n\t}\n\n\t// Loop through the filtered and unfiltered stories and mark \n\t// the unread ones as uninteresting\n\tfor _, s := range session.filtered {\n\t\ti := s.Id\n\t\tif i < session.haveBrowsed {\n\t\t\tconfig.Debug(\"Not uninteresting: \", i)\n\t\t\tcontinue\n\t\t}\n\t\tif !session.haveRead[i] && !session.haveIgnored[i] {\n\t\t\tsession.classifyStory(i, Uninteresting)\n\t\t\tsession.haveIgnored[i] = true\n\t\t}\n\t}\n\n\tfor _, s := range session.unfiltered {\n\t\ti := s.Id\n\t\tif i < session.haveBrowsed {\n\t\t\tconfig.Debug(\"Not uninteresting: \", i)\n\t\t\tcontinue\n\t\t}\n\t\tif !session.haveRead[i] && !session.haveIgnored[i] {\n\t\t\tsession.classifyStory(i, Uninteresting)\n\t\t}\n\t}\n\n\t// Clear the filtered and unfiltered stories\n\tsession.filtered = session.filtered[0:0]\n\tsession.unfiltered = session.unfiltered[0:0]\n\n\t// Keep track of how far the user has browsed\n\tsession.haveBrowsed = storyid - 1\n}", "title": "" }, { "docid": "7847ea159e519d183c24b9c7fcf04c4b", "score": "0.47899196", "text": "func (s *Scanner) unread() { _ = s.r.UnreadRune() }", "title": "" }, { "docid": "7847ea159e519d183c24b9c7fcf04c4b", "score": "0.47899196", "text": "func (s *Scanner) unread() { _ = s.r.UnreadRune() }", "title": "" }, { "docid": "7847ea159e519d183c24b9c7fcf04c4b", "score": "0.47899196", "text": "func (s *Scanner) unread() { _ = s.r.UnreadRune() }", "title": "" }, { "docid": "7847ea159e519d183c24b9c7fcf04c4b", "score": "0.47899196", "text": "func (s *Scanner) unread() { _ = s.r.UnreadRune() }", "title": "" }, { "docid": "cf20b42ccc1394332e25c069318a6341", "score": "0.47621635", "text": "func (s *scanner) unread() { _ = s.r.UnreadRune() }", "title": "" }, { "docid": "499dd62c7b18a78a6ecad58f36d349f4", "score": "0.47450924", "text": "func CompleteBookCollection(book *Book) {\n\n}", "title": "" }, { "docid": "4717b2860244540cfe85c9e3679134ef", "score": "0.47385615", "text": "func TestERSPromoteRdonly(t *testing.T) {\n\tdefer cluster.PanicHandler(t)\n\tsetupReparentCluster(t)\n\tdefer teardownCluster()\n\tvar err error\n\n\terr = clusterInstance.VtctlclientProcess.ExecuteCommand(\"ChangeTabletType\", tab2.Alias, \"rdonly\")\n\trequire.NoError(t, err)\n\n\terr = clusterInstance.VtctlclientProcess.ExecuteCommand(\"ChangeTabletType\", tab3.Alias, \"rdonly\")\n\trequire.NoError(t, err)\n\n\tconfirmReplication(t, tab1, []*cluster.Vttablet{tab2, tab3, tab4})\n\n\t// Make the current primary agent and database unavailable.\n\tstopTablet(t, tab1, true)\n\n\t// We expect this one to fail because we have ignored all the replicas and have only the rdonly's which should not be promoted\n\tout, err := ersIgnoreTablet(nil, \"30s\", \"30s\", []*cluster.Vttablet{tab4}, false)\n\trequire.NotNil(t, err, out)\n\n\tout, err = clusterInstance.VtctlclientProcess.ExecuteCommandWithOutput(\"GetShard\", keyspaceShard)\n\trequire.NoError(t, err)\n\trequire.Contains(t, out, `\"uid\": 101`, \"the primary should still be 101 in the shard info\")\n}", "title": "" }, { "docid": "8e3b9c346b7d2010df8b5372f54c0b87", "score": "0.4733906", "text": "func (self *viewPostPage) checkForSameAuthor() {\n\tif !self.addedNav {\n\t\tif self.admin || self.myid == self.authorid {\n\t\t\tself.StandardPage.AddLeftNav(shared.URLGen.PostEdit(self.id),\n\t\t\t\t\"Edit #\"+fmt.Sprint(self.id), false)\n\t\t\tself.addedNav = true\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aef8f1f06813259940596d9771709cbb", "score": "0.4705281", "text": "func (m *BookMutation) OldAuthor(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldAuthor is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldAuthor requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldAuthor: %w\", err)\n\t}\n\treturn oldValue.Author, nil\n}", "title": "" }, { "docid": "b963376259eea580efa3b0bff4d590b3", "score": "0.46838176", "text": "func RemoveBook(isbn, reason string) error {\n\tvar err error\n\terr = ISBNValidate(isbn) //check whether given ISBN is valid(13 bit)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbook, ok := FindBook(isbn) //check whether this book exist\n\tif ok == false {\n\t\treturn fmt.Errorf(\"book(isbn=%s) not exist.\", isbn)\n\t}\n\tsqls := fmt.Sprintf(\"delete from books where isbn=%s;\", isbn)\n\tSelectDatabase()\n\t_, err = db.Exec(sqls) //remove data from books table\n\tif err != nil {\n\t\treturn fmt.Errorf(\"RemoveBook-delete %s:%v\", isbn, err)\n\t}\n\trawsql := \"insert into rmrec values(%s,%q,%q,%q,%q)\"\n\tnow := time.Now().Format(TimeFormat)\n\tsqls = fmt.Sprintf(rawsql, book.ISBN, book.Title, book.Author, now, reason)\n\tSelectDatabase()\n\t_, err = db.Exec(sqls) //insert data into remove records table\n\tif err != nil {\n\t\treturn fmt.Errorf(\"RemoveBook-insert %s:%v\", isbn, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "13a1ea1c17c6d86370c0c09e4201de81", "score": "0.46735725", "text": "func ExReader() {\n\tfmt.Println(\"Please read and implement :)\")\n}", "title": "" }, { "docid": "966e4c37b7f13630275c4a4b7d55fd61", "score": "0.4669673", "text": "func (m *BookMutation) OldAuthor(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, errors.New(\"OldAuthor is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, errors.New(\"OldAuthor requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldAuthor: %w\", err)\n\t}\n\treturn oldValue.Author, nil\n}", "title": "" }, { "docid": "998b66767c0e501f7f6462b6f048a0fc", "score": "0.4666747", "text": "func (csp *impl) ReadOnly() bool {\n\treturn false\n}", "title": "" }, { "docid": "3ab91d7ad5b90f70d3d3d8f67ccafc54", "score": "0.46620014", "text": "func (me TxsdBibliorelationClass) IsIsbn() bool { return me == \"isbn\" }", "title": "" }, { "docid": "31f7387806576a3dd743e00433c1d189", "score": "0.4656485", "text": "func (b *ReadOnly) HashOnRead(bool) {\n\t// TODO: implement before the final release?\n}", "title": "" }, { "docid": "927f3d8350b417c1b528929d2be1cd48", "score": "0.46441066", "text": "func (s *Lexer) unread() { _ = s.r.UnreadRune() }", "title": "" }, { "docid": "337c8449f0d9012b7ccfe2d3d03226f9", "score": "0.46392035", "text": "func (w *WeightedBaseManaVector) Book(txInfo *TxInfo) {\n\tw.Lock()\n\tdefer w.Unlock()\n\t// first, revoke mana from previous owners\n\tfor _, inputInfo := range txInfo.InputInfos {\n\t\t// which node did the input pledge mana to?\n\t\tpledgeNodeID := inputInfo.PledgeID[w.target]\n\t\t// can't revoke from genesis\n\t\t//emptyID := identity.ID{}\n\t\t//if pledgeNodeID == emptyID {\n\t\t//\tcontinue\n\t\t//}\n\t\tif _, exist := w.vector[pledgeNodeID]; !exist {\n\t\t\t// first time we see this node\n\t\t\tw.vector[pledgeNodeID] = NewWeightedMana(w.weight)\n\t\t}\n\t\t// save old mana\n\t\toldMana := *w.vector[pledgeNodeID]\n\t\t// revoke BM1\n\t\terr := w.vector[pledgeNodeID].revoke(inputInfo.Amount, txInfo.TimeStamp)\n\t\tswitch err {\n\t\tcase ErrBaseManaNegative:\n\t\t\tpanic(fmt.Sprintf(\"Revoking %f base mana 1 from node %s results in negative balance\", inputInfo.Amount, pledgeNodeID.String()))\n\t\tcase ErrEffBaseManaNegative:\n\t\t\tpanic(fmt.Sprintf(\"Revoking (%f) eff base mana 1 from node %s results in negative balance\", inputInfo.Amount, pledgeNodeID.String()))\n\t\t}\n\t\t// trigger events\n\t\tEvents().Revoked.Trigger(&RevokedEvent{pledgeNodeID, inputInfo.Amount, txInfo.TimeStamp, w.Type(), txInfo.TransactionID, inputInfo.InputID})\n\t\tEvents().Updated.Trigger(&UpdatedEvent{pledgeNodeID, &oldMana, w.vector[pledgeNodeID], w.Type()})\n\t}\n\tpledgeNodeID := txInfo.PledgeID[w.Target()]\n\tif _, exist := w.vector[pledgeNodeID]; !exist {\n\t\t// first time we see this node\n\t\tw.vector[pledgeNodeID] = NewWeightedMana(w.weight)\n\t}\n\t// save it for proper event trigger\n\toldMana := *w.vector[pledgeNodeID]\n\t// actually pledge and update\n\tpledged := w.vector[pledgeNodeID].pledge(txInfo)\n\n\t// trigger events\n\tEvents().Pledged.Trigger(&PledgedEvent{\n\t\tNodeID: pledgeNodeID,\n\t\tAmount: pledged,\n\t\tTime: txInfo.TimeStamp,\n\t\tManaType: w.Type(),\n\t\tTransactionID: txInfo.TransactionID,\n\t})\n\tEvents().Updated.Trigger(&UpdatedEvent{\n\t\tNodeID: pledgeNodeID,\n\t\tOldMana: &oldMana,\n\t\tNewMana: w.vector[pledgeNodeID],\n\t\tManaType: w.Type(),\n\t})\n}", "title": "" }, { "docid": "c176e607894d39f0f8a6670a8e9befa6", "score": "0.4607222", "text": "func sanitizeSynopsis(f *doc.Func) string {\n\tsynopsis := doc.Synopsis(f.Doc)\n\n\t// If the synopsis begins with the function name, remove it. This is done to\n\t// not repeat the text.\n\t// From:\n\t// clean\tClean removes the temporarily generated files\n\t// To:\n\t// clean \tremoves the temporarily generated files\n\tif syns := strings.Split(synopsis, \" \"); strings.EqualFold(f.Name, syns[0]) {\n\t\treturn strings.Join(syns[1:], \" \")\n\t}\n\n\treturn synopsis\n}", "title": "" }, { "docid": "09718cb3c6b6dad3eb58d8a59729b1ed", "score": "0.46070915", "text": "func PermitRead(perm Permission) bool {\n\treturn (perm & PermRead) == PermRead\n}", "title": "" }, { "docid": "b9d4bfbbf8b6341b2e5093e7b2612c58", "score": "0.46033713", "text": "func markRead(sessionid string, storyid int64) {\n\tsession, ok := sessionAsync(sessionid)\n\tif !ok {\n\t\treturn\n\t}\n\tdefer session.release()\n\n\tif !session.haveRead[storyid] {\n\t\tsession.classifyStory(storyid, Interesting)\n\t\tsession.haveRead[storyid] = true\n\t\tsession.haveClassified = 0\n\t\tif session.haveIgnored[storyid] {\n\t\t\tdelete(session.haveIgnored, storyid)\n\t\t}\n\t\tdb.MarkRead(sessionid, storyid)\n\t}\n}", "title": "" }, { "docid": "5c7e5fe7cd4a6ca8c1f436c7af39466e", "score": "0.46006355", "text": "func (m *BookMutation) AuthorCleared() bool {\n\treturn m.clearedauthor\n}", "title": "" }, { "docid": "663b16c24fadff66a69bc292cb6c1a72", "score": "0.45774284", "text": "func (p *Person) canBeGrader() bool {\n\treturn true\n}", "title": "" }, { "docid": "a6194dc34709defb0a21e765f3024e74", "score": "0.4566057", "text": "func validate(b Book) error {\n\tvar fieldErrors []string\n\n\tif matchedISBN := isbnPattern.MatchString(b.ISBN); !matchedISBN {\n\t\tfieldErrors = append(fieldErrors, \" isbn \")\n\t}\n\tif matchedTitle := titlePattern.MatchString(b.Title); !matchedTitle {\n\t\tfieldErrors = append(fieldErrors, \" title \")\n\t}\n\tif matchedFirstName := firstNamePattern.MatchString(b.Author.FirstName); !matchedFirstName {\n\t\tfieldErrors = append(fieldErrors, \" authors firstname \")\n\t}\n\tif matchedLastName := LastNamePattern.MatchString(b.Author.LastName); !matchedLastName {\n\t\tfieldErrors = append(fieldErrors, \" authors lastname \")\n\t}\n\tif matchedPublisher := publisherPattern.MatchString(b.Publisher); !matchedPublisher {\n\t\tfieldErrors = append(fieldErrors, \" Publishers name\")\n\t}\n\n\tif len(fieldErrors) != 0 {\n\t\treturn fmt.Errorf(\"validation failed, field error(s):%v. Fix these error before proceeding\",\n\t\t\tstrings.Join(fieldErrors, \", \"))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aa3e097f5e44cbd926fe0d83ef8a79be", "score": "0.45195475", "text": "func checkReader(L *lua.LState) *Reader {\n\tud := L.CheckUserData(1)\n\tif v, ok := ud.Value.(*Reader); ok {\n\t\treturn v\n\t}\n\tL.ArgError(1, \"person expected\")\n\treturn nil\n}", "title": "" }, { "docid": "bcea0ed5408f50aa9665097073f5085c", "score": "0.45160523", "text": "func (myPermission *Permission) Reader() (param bool) {\n\treturn myPermission.Readervar\n}", "title": "" }, { "docid": "ee5a8491dce88d394c81a5426b2998f1", "score": "0.4509759", "text": "func HaveReadStories(w http.ResponseWriter, req *http.Request) *StoryIndex {\n\n\tret := NewStoryIndex()\n\n\tsession, ok := getSession(w, req)\n\tif !ok {\n\t\treturn ret\n\t}\n\n\tdefer session.release()\n\n\t// Get the read stories from the db\n\tread := db.AllRead(session.id)\n\n\tfor _, s := range read {\n\t\tret.Unfiltered = append(ret.Unfiltered, s)\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "fa8b833301f9335208626cd5b71efa01", "score": "0.4496138", "text": "func (u User) ReadingShelf() Shelf {\n\tfor _, shelf := range u.Shelves {\n\t\tif shelf.Name == \"currently-reading\" {\n\t\t\treturn shelf\n\t\t}\n\t}\n\n\treturn Shelf{}\n}", "title": "" }, { "docid": "15b0072f6b5c99a36aff3a995ac1d6ce", "score": "0.4483147", "text": "func (s *Store) consistentRead() error {\n\tfuture := s.raft.VerifyLeader()\n\tif err := future.Error(); err != nil {\n\t\treturn err //fail fast if leader verification fails\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3f03f4b5bd1a65b5635b75b08897e3e7", "score": "0.4479536", "text": "func (me TxsdArticleClass) IsWhitepaper() bool { return me == \"whitepaper\" }", "title": "" }, { "docid": "d543e7b4134133e37398f2b9158e1a19", "score": "0.4478642", "text": "func (Book) IsLinkable() {}", "title": "" }, { "docid": "cf966d19c19757d438d13fcdbfbeabef", "score": "0.4458907", "text": "func (m *AuthorMutation) ResetBooks() {\n\tm.books = nil\n\tm.clearedbooks = false\n\tm.removedbooks = nil\n}", "title": "" }, { "docid": "45ca83bfd09aac2eb0b791c5dc705856", "score": "0.44587588", "text": "func (b Book) Author() Author {\n\treturn b.Authors[0]\n}", "title": "" }, { "docid": "8ddceb370b25dd00f806088e6088089f", "score": "0.44558808", "text": "func (r *SearchMessages) RawBookmarkedOnly() string {\n\treturn r.rawBookmarkedOnly\n}", "title": "" }, { "docid": "c752d800f83b8966fb74be56ef400676", "score": "0.44390383", "text": "func readarrCheckBook(r *http.Request) (int, interface{}) {\n\tgrid := mux.Vars(r)[\"grid\"]\n\n\tm, err := getReadarr(r).GetBook(grid)\n\tif err != nil {\n\t\treturn http.StatusServiceUnavailable, fmt.Errorf(\"checking book: %w\", err)\n\t} else if len(m) > 0 {\n\t\treturn http.StatusConflict, readarrData(m[0])\n\t}\n\n\treturn http.StatusOK, http.StatusText(http.StatusNotFound)\n}", "title": "" }, { "docid": "68be7c747fee00e1ada33c08cbc77de1", "score": "0.4437272", "text": "func (m *BookMutation) ResetAuthor() {\n\tm.author = nil\n}", "title": "" }, { "docid": "402745ce4b9f28b52f2653dc9d354672", "score": "0.4435519", "text": "func (me TxsdCitetitlePubwork) IsChapter() bool { return me == \"chapter\" }", "title": "" }, { "docid": "1d0cd5c8a051d6a719fc6d04955ee32d", "score": "0.44348657", "text": "func isRead(title string) bool {\n\treturn cacheMap[hashTitle(title)]\n}", "title": "" }, { "docid": "b443d772bd725e49a6d081ba80c4ec0d", "score": "0.44157666", "text": "func noteUnfindable(b []byte) error {\n\treturn storeDB(b, []byte{})\n}", "title": "" }, { "docid": "c2dc5ad9965a09058245e531f3c98a26", "score": "0.44124845", "text": "func AuthorNotIn(vs ...string) predicate.Book {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldAuthor), v...))\n\t})\n}", "title": "" }, { "docid": "dd5f236eb5f5e6b65217c422b540d969", "score": "0.4408181", "text": "func (m *BookMutation) ResetAuthor() {\n\tm.author = nil\n\tm.clearedauthor = false\n\tm.removedauthor = nil\n}", "title": "" }, { "docid": "d10e54438bec091c9ad76b2a92aa3a62", "score": "0.4406328", "text": "func MarkRead(w http.ResponseWriter, req *http.Request, storyid int64) {\n\n\tsessid, ok := sessionCookie(w, req)\n\tif ok {\n\t\treadCh <- userStory{sessionid: sessid, storyid: storyid}\n\t}\n}", "title": "" }, { "docid": "f1f31b3be671a1fcae44ff9422726c06", "score": "0.44005668", "text": "func (rm *resourceManager) requiredFieldsMissingFromReadManyInput(\n\tr *resource,\n) bool {\n\treturn false\n}", "title": "" }, { "docid": "dc07f3f223a7db472cd2f61507731fee", "score": "0.43934986", "text": "func (me TxsdBibliorelationClass) IsIssn() bool { return me == \"issn\" }", "title": "" }, { "docid": "13d1cb3f3638e5334aa2fdf231ff99e1", "score": "0.43905678", "text": "func (c *Corpus) RLock() { c.mu.RLock() }", "title": "" }, { "docid": "d7938113a4d9cacbfd491fa0b3c57a5b", "score": "0.4388683", "text": "func readKeep(answerMap map[int]string, max int) []string {\n\tvar (\n\t\tparsed []int\n\t\tres []string\n\t\tok bool\n\t)\n\n\tfmt.Println(\"Which one of these should we keep? (eg: 1 2 3, 2-3)\")\n\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor !ok {\n\t\tscanner.Scan()\n\t\ts := scanner.Text()\n\t\tif s == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\tparsed, ok = parseRead(s, max)\n\t\tif !ok {\n\t\t\tfmt.Print(\"again: \")\n\t\t\tcontinue\n\t\t}\n\n\t\tif !allParsedFound(parsed, answerMap) {\n\t\t\tok = false\n\t\t\tcontinue\n\t\t}\n\t}\n\n\tfor _, v := range parsed {\n\t\t_, ok := answerMap[v-1]\n\t\tif !ok {\n\t\t\tfmt.Print(\"again: \")\n\t\t\tcontinue\n\t\t}\n\n\t\tdelete(answerMap, v-1)\n\t}\n\n\tfor _, f := range answerMap {\n\t\tres = append(res, f)\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "86828d124846884f06957876193fe771", "score": "0.4387846", "text": "func Inhibit() {\n\tmu.Lock()\n\tinhibited = true\n\tif used {\n\t\tpanic(\"calling Inhibit() while files were already opened\")\n\t}\n\tmu.Unlock()\n}", "title": "" }, { "docid": "ad6ed9aaa2e7d467c71b6a0394d48fc3", "score": "0.4387453", "text": "func (m *BookMutation) ClearAuthor() {\n\tm.clearedauthor = true\n}", "title": "" }, { "docid": "0a6e93d56f0987273aa4f404603b76e0", "score": "0.43844303", "text": "func (s Sequence) Reducible() bool {\n\treturn true\n}", "title": "" }, { "docid": "c8426856023a289b6b48d99b36586f26", "score": "0.43844113", "text": "func (lr *LeftRightPrimitive) readerArrive() int {\n\tidx := atomic.LoadInt32(lr.versionIndex)\n\tlr.readIndicators[idx].arrive()\n\treturn int(idx)\n}", "title": "" }, { "docid": "7ea3a33a2c52e5115f9081e6617453c2", "score": "0.43833578", "text": "func (b *Book) Put() {\n\tb.mu.Lock()\n\tb.isTaken = false\n\tb.mu.Unlock()\n}", "title": "" }, { "docid": "9afbc27998346b00b05fd857ab92c0a2", "score": "0.43822342", "text": "func calculateReadability(syllables int, words int, sentences int) float32 {\n\treturn 206.84 - 60.0*(float32(syllables)/float32(words)) - 102.0*(float32(sentences)/float32(words))\n}", "title": "" }, { "docid": "af24a342deda3332e11cc9bedab7f8b4", "score": "0.43729416", "text": "func (m *BookMutation) ResetAuthor() {\n\tm._Author = nil\n}", "title": "" }, { "docid": "1622ab88fb61c0925e0f52403f72d30a", "score": "0.4366669", "text": "func (m *BookMutation) Author() (r string, exists bool) {\n\tv := m._Author\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "24fd3ff2ead8aa3c9706ea06c39020a3", "score": "0.43615344", "text": "func (m *BookMutation) Author() (r string, exists bool) {\n\tv := m.author\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "d9e87ae5d51d2f7e4972db57033fcb19", "score": "0.43576545", "text": "func (r *repository) ReadBook() (*[]presenter.Book, error) {\n\tvar books []presenter.Book\n\tcursor, err := r.Collection.Find(context.Background(), bson.D{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor cursor.Next(context.TODO()) {\n\t\tvar book presenter.Book\n\t\t_ = cursor.Decode(&book)\n\t\tbooks = append(books, book)\n\t}\n\treturn &books, nil\n}", "title": "" }, { "docid": "0edd20ba759008d095399c6ebf36759d", "score": "0.4356145", "text": "func privCheck(reason string) {\n}", "title": "" }, { "docid": "919a08b26707a1e6bab8df3b45bb2dfc", "score": "0.43467185", "text": "func (s *svc) Unprotected() []string {\n\treturn []string{}\n}", "title": "" }, { "docid": "fb729c5dfcddc8444f41a2e7788fa135", "score": "0.43464917", "text": "func (s *State) processIllegalEvidence(payloadData interfaces.Payload,\n\theight uint32) {\n\t// Get illegal producers from evidence.\n\tvar illegalProducers [][]byte\n\tswitch p := payloadData.(type) {\n\tcase *payload.DPOSIllegalProposals:\n\t\tillegalProducers = [][]byte{p.Evidence.Proposal.Sponsor}\n\n\tcase *payload.DPOSIllegalVotes:\n\t\tillegalProducers = [][]byte{p.Evidence.Vote.Signer}\n\n\tcase *payload.DPOSIllegalBlocks:\n\t\tsigners := make(map[string]interface{})\n\t\tfor _, pk := range p.Evidence.Signers {\n\t\t\tsigners[hex.EncodeToString(pk)] = nil\n\t\t}\n\n\t\tfor _, pk := range p.CompareEvidence.Signers {\n\t\t\tkey := hex.EncodeToString(pk)\n\t\t\tif _, ok := signers[key]; ok {\n\t\t\t\tillegalProducers = append(illegalProducers, pk)\n\t\t\t}\n\t\t}\n\n\tcase *payload.SidechainIllegalData:\n\t\tillegalProducers = [][]byte{p.IllegalSigner}\n\n\tdefault:\n\t\treturn\n\t}\n\n\tcrMembersMap := s.getClaimedCRMemberDPOSPublicKeyMap()\n\tillegalPenalty := s.getIllegalPenaltyByHeight(height)\n\n\t// Set illegal producers to FoundBad state\n\tfor _, pk := range illegalProducers {\n\t\tif cr, ok := crMembersMap[hex.EncodeToString(pk)]; ok {\n\t\t\tif len(cr.DPOSPublicKey) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\toriState := cr.MemberState\n\t\t\ts.History.Append(height, func() {\n\t\t\t\ts.tryUpdateCRMemberIllegal(cr.Info.DID, height, illegalPenalty)\n\t\t\t}, func() {\n\t\t\t\ts.tryRevertCRMemberIllegal(cr.Info.DID, oriState, height, illegalPenalty)\n\t\t\t})\n\t\t}\n\t\tkey, ok := s.NodeOwnerKeys[hex.EncodeToString(pk)]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tif producer, ok := s.ActivityProducers[key]; ok {\n\t\t\toriPenalty := producer.penalty\n\t\t\toriState := producer.state\n\t\t\toriIllegalHeight := producer.illegalHeight\n\t\t\ts.History.Append(height, func() {\n\t\t\t\tproducer.state = Illegal\n\t\t\t\tproducer.illegalHeight = height\n\t\t\t\ts.IllegalProducers[key] = producer\n\t\t\t\tproducer.activateRequestHeight = math.MaxUint32\n\t\t\t\tif height >= s.ChainParams.CRConfiguration.ChangeCommitteeNewCRHeight {\n\t\t\t\t\tproducer.penalty += illegalPenalty\n\t\t\t\t}\n\t\t\t\tdelete(s.ActivityProducers, key)\n\t\t\t}, func() {\n\t\t\t\tproducer.state = oriState\n\t\t\t\tproducer.penalty = oriPenalty\n\t\t\t\tproducer.illegalHeight = oriIllegalHeight\n\t\t\t\ts.ActivityProducers[key] = producer\n\t\t\t\tproducer.activateRequestHeight = math.MaxUint32\n\t\t\t\tdelete(s.IllegalProducers, key)\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tif producer, ok := s.InactiveProducers[key]; ok {\n\t\t\toriPenalty := producer.penalty\n\t\t\toriState := producer.state\n\t\t\toriIllegalHeight := producer.illegalHeight\n\t\t\ts.History.Append(height, func() {\n\t\t\t\tproducer.state = Illegal\n\t\t\t\tproducer.illegalHeight = height\n\t\t\t\ts.IllegalProducers[key] = producer\n\t\t\t\tproducer.activateRequestHeight = math.MaxUint32\n\t\t\t\tif height >= s.ChainParams.CRConfiguration.ChangeCommitteeNewCRHeight {\n\t\t\t\t\tproducer.penalty += illegalPenalty\n\t\t\t\t}\n\t\t\t\tdelete(s.InactiveProducers, key)\n\t\t\t}, func() {\n\t\t\t\tproducer.state = oriState\n\t\t\t\tproducer.penalty = oriPenalty\n\t\t\t\tproducer.illegalHeight = oriIllegalHeight\n\t\t\t\ts.InactiveProducers[key] = producer\n\t\t\t\tproducer.activateRequestHeight = math.MaxUint32\n\t\t\t\tdelete(s.IllegalProducers, key)\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tif producer, ok := s.IllegalProducers[key]; ok {\n\t\t\toriPenalty := producer.penalty\n\t\t\toriIllegalHeight := producer.illegalHeight\n\t\t\ts.History.Append(height, func() {\n\t\t\t\tproducer.illegalHeight = height\n\t\t\t\tproducer.activateRequestHeight = math.MaxUint32\n\t\t\t\tif height >= s.ChainParams.CRConfiguration.ChangeCommitteeNewCRHeight {\n\t\t\t\t\tproducer.penalty += illegalPenalty\n\t\t\t\t}\n\t\t\t}, func() {\n\t\t\t\tproducer.penalty = oriPenalty\n\t\t\t\tproducer.illegalHeight = oriIllegalHeight\n\t\t\t\tproducer.activateRequestHeight = math.MaxUint32\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tif producer, ok := s.CanceledProducers[key]; ok {\n\t\t\toriPenalty := producer.penalty\n\t\t\toriState := producer.state\n\t\t\ts.History.Append(height, func() {\n\t\t\t\tproducer.state = Illegal\n\t\t\t\tproducer.illegalHeight = height\n\t\t\t\ts.IllegalProducers[key] = producer\n\t\t\t\tif height >= s.ChainParams.CRConfiguration.ChangeCommitteeNewCRHeight {\n\t\t\t\t\tproducer.penalty += illegalPenalty\n\t\t\t\t}\n\t\t\t\tdelete(s.CanceledProducers, key)\n\t\t\t}, func() {\n\t\t\t\tproducer.state = oriState\n\t\t\t\tproducer.illegalHeight = 0\n\t\t\t\tproducer.penalty = oriPenalty\n\t\t\t\ts.CanceledProducers[key] = producer\n\t\t\t\tdelete(s.IllegalProducers, key)\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7d340772177578e89760e402824c450c", "score": "0.43451163", "text": "func (_m *OVNNotifier) Stolen(_a0 []interface{}) {\n\t_m.Called(_a0)\n}", "title": "" }, { "docid": "dc0347135209e9818c379501b74a808d", "score": "0.43394423", "text": "func (l *lexer) ignorePrior() {\n\tl.backup()\n\tl.ignore()\n\tl.next()\n}", "title": "" }, { "docid": "238d5087f7d9c6be3a95e645cb614fd8", "score": "0.43393126", "text": "func (s *scanner) unread() {\n\ts.tmpc = s.c\n}", "title": "" }, { "docid": "d19aa7f568fcd8ddc2e0d34d8304ab38", "score": "0.43361276", "text": "func (v *Validator) LicReferences() bool {\n\tr := true\n\tfor k, m := range v.licUsed {\n\t\t_, ok := v.licDefined[k]\n\t\tif !ok {\n\t\t\tv.addErr(\"Licence reference \\\"%s\\\" used but not defined.\", m, k)\n\t\t\tr = false\n\t\t} else {\n\t\t\tdelete(v.licDefined, k)\n\t\t}\n\t}\n\tfor k, m := range v.licDefined {\n\t\t_, ok := v.licUsed[k]\n\t\tif !ok {\n\t\t\tv.addWarn(\"Licence reference \\\"%s\\\" defined but not used.\", m, k)\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "b9c465651a1f31af18c2c1b4b0f7a064", "score": "0.4332042", "text": "func (l lazyVendor) LegitimateInterestStrict(purposeID consentconstants.Purpose) (hasLegitimateInterest bool) {\n\treturn idExists(l, int(purposeID), \"legIntPurposes\")\n}", "title": "" }, { "docid": "26f841161baaaa3a8b4a05e41059ae51", "score": "0.4331171", "text": "func (o *orderbookManager) stopFetchingBook(pair currency.Pair) error {\n\to.Lock()\n\tdefer o.Unlock()\n\tstate, ok := o.state[pair.Base][pair.Quote][asset.Spot]\n\tif !ok {\n\t\treturn fmt.Errorf(\"could not match pair %s and asset type %s in hash table\",\n\t\t\tpair,\n\t\t\tasset.Spot)\n\t}\n\tif !state.fetchingBook {\n\t\treturn fmt.Errorf(\"fetching book already set to false for %s %s\",\n\t\t\tpair,\n\t\t\tasset.Spot)\n\t}\n\tstate.fetchingBook = false\n\treturn nil\n}", "title": "" }, { "docid": "329ade90dc8306b0614b9cf14b3cc21b", "score": "0.4317068", "text": "func ReturnBook(id, isbn string) error {\n\tvar err error\n\terr = IDValidate(id) //check whether ID is valid(11 bit)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = ISBNValidate(isbn) //check whether ISBN is valid(13 bit)\n\tif err != nil {\n\t\treturn err\n\t}\n\tborrec, ok := FindBorRec(id, isbn) //call the function to find the corresponding borrow record\n\tif ok == false {\n\t\treturn fmt.Errorf(\"ReturnBook(id:%s,isbn:%s):cannot find such BorRec.\", id, isbn)\n\t}\n\tsqls := fmt.Sprintf(\"delete from borrec where id=%s and isbn=%s;\", id, isbn)\n\tSelectDatabase()\n\t_, err = db.Exec(sqls) //delete data from borrow records table\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ReturnBook(id:%s,isbn:%s):%v\", id, isbn, err)\n\t}\n\trawsql := \"insert into retrec(id,isbn,bortime,rettime) values (%s,%s,%q,%q);\"\n\tsqls = fmt.Sprintf(rawsql, id, isbn, borrec.BorTime.Format(TimeFormat), time.Now().Format(TimeFormat))\n\tSelectDatabase()\n\t_, err = db.Exec(sqls) //insert data from returned records table\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ReturnBook(id:%s,isbn:%s):%v\", id, isbn, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7b1137bf28a46f535b519afdc3dd5edb", "score": "0.43143922", "text": "func (c *Corpus) RUnlock() { c.mu.RUnlock() }", "title": "" }, { "docid": "e57d448c22cabe35b593230b747db9c8", "score": "0.4309733", "text": "func (l *Scanner) ignore() {\n\tl.start = l.pos\n\tl.word = nil\n}", "title": "" }, { "docid": "03dcc1ab8caaa940ceea01314c7af60b", "score": "0.43081954", "text": "func TestRead_missingTag(t *testing.T) {\n\tf, err := os.Open(path.Join(\"test\", \"testdata\", \"fedWireMessage-MissingRequiredTag.txt\"))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer f.Close()\n\tr := NewReader(f)\n\n\t_, err = r.Read()\n\n\trequire.EqualError(t, err, \"file validation failed: FIBeneficiaryAdvice is a required field\")\n}", "title": "" }, { "docid": "16d4437fc53fe75950760ba219d04bef", "score": "0.43069395", "text": "func (c *recorder) removeRetained(topic string) error {\n\terr := c.db.BucketDelete(common.BucketNameDotRetained, []byte(topic))\n\tif err != nil {\n\t\tc.log.WithError(err).Errorf(\"failed to remove retain message: topic=%s\", topic)\n\t\treturn fmt.Errorf(\"failed to remove retain message: %s\", err.Error())\n\t}\n\tc.log.Debugf(\"retain message removed: topic=%s\", topic)\n\treturn nil\n}", "title": "" }, { "docid": "9f1ce2a2c3c63147443b30c69bf73e0e", "score": "0.43018213", "text": "func (c card) Lear() string {\n\treturn c.lear\n}", "title": "" }, { "docid": "b876c78175149a6f7d14e91e9b5c9d1f", "score": "0.4296598", "text": "func (r *RAM) ReadAllowed(actor *Competitor) bool {\n\tif r.readPublic {\n\t\treturn true\n\t}\n\treturn r.userBasedAccess(actor, RAMAccessR)\n}", "title": "" }, { "docid": "e0109ee04e3577cf5fbdbca4bdf3e8c2", "score": "0.42950588", "text": "func (m *BookBorrowMutation) ClearBOOK() {\n\tm.cleared_BOOK = true\n}", "title": "" }, { "docid": "092ed38586ac28f66a3fbb1be1652ed6", "score": "0.42940754", "text": "func newBadReader(data string) *badReader {\n\treturn &badReader{data: []byte(data)}\n}", "title": "" }, { "docid": "643dc087856740ed290b0ba3d691035f", "score": "0.42899588", "text": "func (m *BookBorrowMutation) PURPOSECleared() bool {\n\treturn m.cleared_PURPOSE\n}", "title": "" }, { "docid": "cfb41ae7bfa9038c730408e1ab3c495f", "score": "0.42853713", "text": "func (s *Scanner) unread() {\n\t_ = s.r.UnreadRune()\n\tif s.last == eol {\n\t\ts.line--\n\t\ts.pos = s.prevPos\n\t} else {\n\t\ts.pos--\n\t}\n}", "title": "" }, { "docid": "d139fd76b65eea99f03d6bbf81ee0635", "score": "0.4280873", "text": "func GetBook(isbn string) (Book, error) {\n\n\tbook := loadBook(isbn)\n\n\tif book.Isbn != \"\" {\n\n\t\t// Complete missing picture\n\t\tif book.PictureURL == \"\" {\n\t\t\tbooksToComplete <- &book\n\t\t}\n\n\t\treturn book, nil\n\t}\n\n\treturn book, errors.New(\"No book found for isbn \" + isbn)\n}", "title": "" }, { "docid": "4d088362786076d1327b33313119ffe1", "score": "0.42798766", "text": "func Reader(r kcd.Reader) kcd.Reader { return &locker{rd: r} }", "title": "" }, { "docid": "7f69b0592d592f039dbd0efdc6b2c15e", "score": "0.4279847", "text": "func (m *Message) Unread() bool {\n\treturn !m.IsFlagged(\"S\")\n}", "title": "" }, { "docid": "e525e65d94e8f8f7822f76cd3831d8ed", "score": "0.42764875", "text": "func (r *Reader) StopReading() {\n\tr.active = false\n}", "title": "" }, { "docid": "b01de5cce1f95a3f10a3b273f3772acb", "score": "0.42744863", "text": "func (m *AuthorMutation) RemovedBooksIDs() (ids []int) {\n\tfor id := range m.removedbooks {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "0e7a3c3c668289dee749dac6c28a5505", "score": "0.42681018", "text": "func (me TxsdOrderedlistInheritnum) IsIgnore() bool { return me == \"ignore\" }", "title": "" }, { "docid": "2e259f9d0aaba3e61aca79ef26677f73", "score": "0.42617834", "text": "func (e ZitadelDocsValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "7e936c3e8c954624cc602efbafbbbfdf", "score": "0.4261577", "text": "func (ch Chan) RecvOnly() RecvOnly { return RecvOnly{ch} }", "title": "" }, { "docid": "276b216a4742a87cbf913e4b848fa7b9", "score": "0.4259747", "text": "func (rp *retryPublisher) discard(pub broker.Publisher) {\n\trp.l.Lock()\n\tdefer rp.l.Unlock()\n\n\tif pub == nil {\n\t\treturn\n\t}\n\n\tpub.Close()\n\tif pub == rp.pub {\n\t\trp.pub = nil\n\t}\n}", "title": "" }, { "docid": "ce5749e33a5c16e24d733cc284185bb1", "score": "0.4256743", "text": "func (r *Reader) Guarantee(collID flow.Identifier) (*flow.CollectionGuarantee, error) {\n\tvar collection flow.CollectionGuarantee\n\terr := r.db.View(r.lib.RetrieveGuarantee(collID, &collection))\n\treturn &collection, err\n}", "title": "" } ]
9c694df718dc954233a71a02d83d8563
ListByBillingProfile lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. Parameters: billingAccountName the ID that uniquely identifies a billing account. billingProfileName the ID that uniquely identifies a billing profile. search used for searching customers by their name. Any customer with name containing the search text will be included in the response filter may be used to filter the list of customers.
[ { "docid": "5895ffa14edce15a5f97854663318330", "score": "0.829712", "text": "func (client CustomersClient) ListByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string, search string, filter string) (result CustomerListResultPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/CustomersClient.ListByBillingProfile\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.clr.Response.Response != nil {\n\t\t\t\tsc = result.clr.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listByBillingProfileNextResults\n\treq, err := client.ListByBillingProfilePreparer(ctx, billingAccountName, billingProfileName, search, filter)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.CustomersClient\", \"ListByBillingProfile\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListByBillingProfileSender(req)\n\tif err != nil {\n\t\tresult.clr.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"billing.CustomersClient\", \"ListByBillingProfile\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.clr, err = client.ListByBillingProfileResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.CustomersClient\", \"ListByBillingProfile\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.clr.hasNextLink() && result.clr.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" } ]
[ { "docid": "a6acb717d8b0e44f226f562edb797fc2", "score": "0.74527913", "text": "func (client ProductsClient) ListByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string, filter string) (result ProductsListResultPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProductsClient.ListByBillingProfile\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.plr.Response.Response != nil {\n\t\t\t\tsc = result.plr.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listByBillingProfileNextResults\n\treq, err := client.ListByBillingProfilePreparer(ctx, billingAccountName, billingProfileName, filter)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.ProductsClient\", \"ListByBillingProfile\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListByBillingProfileSender(req)\n\tif err != nil {\n\t\tresult.plr.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"billing.ProductsClient\", \"ListByBillingProfile\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.plr, err = client.ListByBillingProfileResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.ProductsClient\", \"ListByBillingProfile\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.plr.hasNextLink() && result.plr.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "92677ce57c25d803cd6f35602963f0e8", "score": "0.70168453", "text": "func (client CustomersClient) ListByBillingProfileComplete(ctx context.Context, billingAccountName string, billingProfileName string, search string, filter string) (result CustomerListResultIterator, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/CustomersClient.ListByBillingProfile\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response().Response.Response != nil {\n\t\t\t\tsc = result.page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.page, err = client.ListByBillingProfile(ctx, billingAccountName, billingProfileName, search, filter)\n\treturn\n}", "title": "" }, { "docid": "807effede259b15f6416e6b8097d4294", "score": "0.69713724", "text": "func (client InvoicesClient) ListByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string, periodStartDate string, periodEndDate string) (result InvoiceListResultPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/InvoicesClient.ListByBillingProfile\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.ilr.Response.Response != nil {\n\t\t\t\tsc = result.ilr.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listByBillingProfileNextResults\n\treq, err := client.ListByBillingProfilePreparer(ctx, billingAccountName, billingProfileName, periodStartDate, periodEndDate)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.InvoicesClient\", \"ListByBillingProfile\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListByBillingProfileSender(req)\n\tif err != nil {\n\t\tresult.ilr.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"billing.InvoicesClient\", \"ListByBillingProfile\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.ilr, err = client.ListByBillingProfileResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.InvoicesClient\", \"ListByBillingProfile\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.ilr.hasNextLink() && result.ilr.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "96b3a85c4808c0cbb3e3d1e872d39728", "score": "0.6712135", "text": "func (client CustomersClient) ListByBillingProfilePreparer(ctx context.Context, billingAccountName string, billingProfileName string, search string, filter string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"billingAccountName\": autorest.Encode(\"path\", billingAccountName),\n\t\t\"billingProfileName\": autorest.Encode(\"path\", billingProfileName),\n\t}\n\n\tconst APIVersion = \"2020-05-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\tif len(search) > 0 {\n\t\tqueryParameters[\"$search\"] = autorest.Encode(\"query\", search)\n\t}\n\tif len(filter) > 0 {\n\t\tqueryParameters[\"$filter\"] = autorest.Encode(\"query\", filter)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "8183fd92aa317bdca52ec18360ac1a36", "score": "0.6533183", "text": "func (client ProductsClient) ListByBillingProfileComplete(ctx context.Context, billingAccountName string, billingProfileName string, filter string) (result ProductsListResultIterator, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProductsClient.ListByBillingProfile\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response().Response.Response != nil {\n\t\t\t\tsc = result.page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.page, err = client.ListByBillingProfile(ctx, billingAccountName, billingProfileName, filter)\n\treturn\n}", "title": "" }, { "docid": "4a075ab0d8e3e8e17b15c71682a132b9", "score": "0.6361639", "text": "func (client RoleAssignmentsClient) ListByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string) (result RoleAssignmentListResultPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/RoleAssignmentsClient.ListByBillingProfile\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.ralr.Response.Response != nil {\n\t\t\t\tsc = result.ralr.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listByBillingProfileNextResults\n\treq, err := client.ListByBillingProfilePreparer(ctx, billingAccountName, billingProfileName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.RoleAssignmentsClient\", \"ListByBillingProfile\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListByBillingProfileSender(req)\n\tif err != nil {\n\t\tresult.ralr.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"billing.RoleAssignmentsClient\", \"ListByBillingProfile\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.ralr, err = client.ListByBillingProfileResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.RoleAssignmentsClient\", \"ListByBillingProfile\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.ralr.hasNextLink() && result.ralr.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "58397e3dee2666ffec80e57ee244a4d6", "score": "0.63538134", "text": "func (client InvoicesClient) ListByBillingProfileComplete(ctx context.Context, billingAccountName string, billingProfileName string, periodStartDate string, periodEndDate string) (result InvoiceListResultIterator, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/InvoicesClient.ListByBillingProfile\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response().Response.Response != nil {\n\t\t\t\tsc = result.page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.page, err = client.ListByBillingProfile(ctx, billingAccountName, billingProfileName, periodStartDate, periodEndDate)\n\treturn\n}", "title": "" }, { "docid": "eef721c895b26018714845fdf84df21c", "score": "0.6348886", "text": "func (client *ReservationTransactionsClient) NewListByBillingProfilePager(billingAccountID string, billingProfileID string, options *ReservationTransactionsClientListByBillingProfileOptions) *runtime.Pager[ReservationTransactionsClientListByBillingProfileResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ReservationTransactionsClientListByBillingProfileResponse]{\n\t\tMore: func(page ReservationTransactionsClientListByBillingProfileResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ReservationTransactionsClientListByBillingProfileResponse) (ReservationTransactionsClientListByBillingProfileResponse, 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.listByBillingProfileCreateRequest(ctx, billingAccountID, billingProfileID, 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 ReservationTransactionsClientListByBillingProfileResponse{}, 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 ReservationTransactionsClientListByBillingProfileResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ReservationTransactionsClientListByBillingProfileResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listByBillingProfileHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "7c717f5d87009d01aad0904a334a6cb6", "score": "0.61863285", "text": "func (client ProductsClient) ListByBillingProfilePreparer(ctx context.Context, billingAccountName string, billingProfileName string, filter string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"billingAccountName\": autorest.Encode(\"path\", billingAccountName),\n\t\t\"billingProfileName\": autorest.Encode(\"path\", billingProfileName),\n\t}\n\n\tconst APIVersion = \"2020-05-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\tif len(filter) > 0 {\n\t\tqueryParameters[\"$filter\"] = autorest.Encode(\"query\", filter)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/products\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "7b6d5f71b8c03509234409c16ce18529", "score": "0.6179284", "text": "func (s *Storer) ListByProfile(_ context.Context, profileID string) ([]accounts.Account, error) {\n\ttxn := s.db.Txn(false)\n\tvar accts []accounts.Account\n\tacctIter, err := txn.Get(\"account\", \"profileID\", profileID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor {\n\t\tacct := acctIter.Next()\n\t\tif acct == nil {\n\t\t\tbreak\n\t\t}\n\t\tres, ok := acct.(*accounts.Account)\n\t\tif !ok || res == nil {\n\t\t\treturn nil, fmt.Errorf(\"unexpected response type %T\", acct) //nolint:goerr113 // no handling to do, just for display\n\t\t}\n\t\taccts = append(accts, *res)\n\t}\n\taccounts.ByLastUsedDesc(accts)\n\treturn accts, nil\n}", "title": "" }, { "docid": "94012e966f0a5ebb0faabaa83845f8b8", "score": "0.60667706", "text": "func (client *ReservationTransactionsClient) listByBillingProfileCreateRequest(ctx context.Context, billingAccountID string, billingProfileID string, options *ReservationTransactionsClientListByBillingProfileOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.Consumption/reservationTransactions\"\n\tif billingAccountID == \"\" {\n\t\treturn nil, errors.New(\"parameter billingAccountID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{billingAccountId}\", url.PathEscape(billingAccountID))\n\tif billingProfileID == \"\" {\n\t\treturn nil, errors.New(\"parameter billingProfileID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{billingProfileId}\", url.PathEscape(billingProfileID))\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\", \"2021-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "db9f157225d07c27a3d897c07d63eea6", "score": "0.6051304", "text": "func (client CustomersClient) ListByBillingAccount(ctx context.Context, billingAccountName string, search string, filter string) (result CustomerListResultPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/CustomersClient.ListByBillingAccount\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.clr.Response.Response != nil {\n\t\t\t\tsc = result.clr.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listByBillingAccountNextResults\n\treq, err := client.ListByBillingAccountPreparer(ctx, billingAccountName, search, filter)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.CustomersClient\", \"ListByBillingAccount\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListByBillingAccountSender(req)\n\tif err != nil {\n\t\tresult.clr.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"billing.CustomersClient\", \"ListByBillingAccount\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.clr, err = client.ListByBillingAccountResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.CustomersClient\", \"ListByBillingAccount\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.clr.hasNextLink() && result.clr.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "269b70a21f6c14e296a6871d2f1e8701", "score": "0.6034593", "text": "func (client InvoicesClient) ListByBillingProfilePreparer(ctx context.Context, billingAccountName string, billingProfileName string, periodStartDate string, periodEndDate string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"billingAccountName\": autorest.Encode(\"path\", billingAccountName),\n\t\t\"billingProfileName\": autorest.Encode(\"path\", billingProfileName),\n\t}\n\n\tconst APIVersion = \"2020-05-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t\t\"periodEndDate\": autorest.Encode(\"query\", periodEndDate),\n\t\t\"periodStartDate\": autorest.Encode(\"query\", periodStartDate),\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "0bf0d685c205df01e7907b98870a818b", "score": "0.59057045", "text": "func (client CustomersClient) ListByBillingProfileSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "8cdddff07fb84e7fa1cb4f93b19512c1", "score": "0.58045006", "text": "func (client InvoicesClient) ListByBillingProfileSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "403d8d1406c978780ac05d0a7bad2ce4", "score": "0.5710506", "text": "func (client ProductsClient) ListByBillingProfileSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "2a97b1fc49269d0255d56e5113556aaa", "score": "0.56108624", "text": "func (client RoleAssignmentsClient) ListByBillingProfileComplete(ctx context.Context, billingAccountName string, billingProfileName string) (result RoleAssignmentListResultIterator, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/RoleAssignmentsClient.ListByBillingProfile\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response().Response.Response != nil {\n\t\t\t\tsc = result.page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.page, err = client.ListByBillingProfile(ctx, billingAccountName, billingProfileName)\n\treturn\n}", "title": "" }, { "docid": "de329aa0acb25b300e7f1a02a4273e74", "score": "0.5591048", "text": "func (client CustomersClient) ListByBillingProfileResponder(resp *http.Response) (result CustomerListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "dfff13d15cd060a6f6d3a3a0e0a81920", "score": "0.5512713", "text": "func (client CustomersClient) ListByBillingAccountComplete(ctx context.Context, billingAccountName string, search string, filter string) (result CustomerListResultIterator, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/CustomersClient.ListByBillingAccount\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response().Response.Response != nil {\n\t\t\t\tsc = result.page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.page, err = client.ListByBillingAccount(ctx, billingAccountName, search, filter)\n\treturn\n}", "title": "" }, { "docid": "17636b37799e3a73998e249970f22b8e", "score": "0.54547244", "text": "func (client ProductsClient) ListByBillingAccount(ctx context.Context, billingAccountName string, filter string) (result ProductsListResultPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProductsClient.ListByBillingAccount\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.plr.Response.Response != nil {\n\t\t\t\tsc = result.plr.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listByBillingAccountNextResults\n\treq, err := client.ListByBillingAccountPreparer(ctx, billingAccountName, filter)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.ProductsClient\", \"ListByBillingAccount\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListByBillingAccountSender(req)\n\tif err != nil {\n\t\tresult.plr.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"billing.ProductsClient\", \"ListByBillingAccount\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.plr, err = client.ListByBillingAccountResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.ProductsClient\", \"ListByBillingAccount\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.plr.hasNextLink() && result.plr.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "70f5ae6522dd0a11c6093a9a9623e354", "score": "0.5433657", "text": "func (client RoleAssignmentsClient) ListByBillingProfilePreparer(ctx context.Context, billingAccountName string, billingProfileName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"billingAccountName\": autorest.Encode(\"path\", billingAccountName),\n\t\t\"billingProfileName\": autorest.Encode(\"path\", billingProfileName),\n\t}\n\n\tconst APIVersion = \"2020-05-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "71fca602290d3be4d35b6fa2c271b19e", "score": "0.5419579", "text": "func (client CustomersClient) listByBillingProfileNextResults(ctx context.Context, lastResults CustomerListResult) (result CustomerListResult, err error) {\n\treq, err := lastResults.customerListResultPreparer(ctx)\n\tif err != nil {\n\t\treturn result, autorest.NewErrorWithError(err, \"billing.CustomersClient\", \"listByBillingProfileNextResults\", nil, \"Failure preparing next results request\")\n\t}\n\tif req == nil {\n\t\treturn\n\t}\n\tresp, err := client.ListByBillingProfileSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\treturn result, autorest.NewErrorWithError(err, \"billing.CustomersClient\", \"listByBillingProfileNextResults\", resp, \"Failure sending next results request\")\n\t}\n\tresult, err = client.ListByBillingProfileResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.CustomersClient\", \"listByBillingProfileNextResults\", resp, \"Failure responding to next results request\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "f435ca719591a872c8469675f8ecca5d", "score": "0.53828436", "text": "func listProfile(ctx sdk.Context, k Keeper) ([]byte, error) {\n\tvar profileList []types.Profile\n\tstore := ctx.KVStore(k.storeKey)\n\titerator := sdk.KVStorePrefixIterator(store, []byte(types.ProfilePrefix))\n\tfor ; iterator.Valid(); iterator.Next() {\n\t\tvar profile types.Profile\n\t\tk.cdc.MustUnmarshalBinaryLengthPrefixed(store.Get(iterator.Key()), &profile)\n\t\tprofileList = append(profileList, profile)\n\t}\n\tres := codec.MustMarshalJSONIndent(k.cdc, profileList)\n\treturn res, nil\n}", "title": "" }, { "docid": "11b8f5ca7f55929038785f963f496da5", "score": "0.5175207", "text": "func (client InvoicesClient) ListByBillingProfileResponder(resp *http.Response) (result InvoiceListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "c7fd92a286d36605ce9b54f989e56e2d", "score": "0.515396", "text": "func (client InvoicesClient) listByBillingProfileNextResults(ctx context.Context, lastResults InvoiceListResult) (result InvoiceListResult, err error) {\n\treq, err := lastResults.invoiceListResultPreparer(ctx)\n\tif err != nil {\n\t\treturn result, autorest.NewErrorWithError(err, \"billing.InvoicesClient\", \"listByBillingProfileNextResults\", nil, \"Failure preparing next results request\")\n\t}\n\tif req == nil {\n\t\treturn\n\t}\n\tresp, err := client.ListByBillingProfileSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\treturn result, autorest.NewErrorWithError(err, \"billing.InvoicesClient\", \"listByBillingProfileNextResults\", resp, \"Failure sending next results request\")\n\t}\n\tresult, err = client.ListByBillingProfileResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.InvoicesClient\", \"listByBillingProfileNextResults\", resp, \"Failure responding to next results request\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "64475a7d306b95a581f1225d8698f889", "score": "0.5119771", "text": "func (p *ProfileServiceClient) SearchProfiles(optionMap map[string]int64, keyMap map[string]string, timestamp int64, pagesize int64) (r string, err error) {\n\tif err = p.sendSearchProfiles(optionMap, keyMap, timestamp, pagesize); err != nil {\n\t\treturn\n\t}\n\treturn p.recvSearchProfiles()\n}", "title": "" }, { "docid": "4513af69e3a287b3997bb876fd3390a1", "score": "0.5084384", "text": "func (client ProductsClient) ListByBillingProfileResponder(resp *http.Response) (result ProductsListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "bd2dd3bf56ff8974661bcd61388063a7", "score": "0.50800335", "text": "func (client ProductsClient) ListByBillingAccountComplete(ctx context.Context, billingAccountName string, filter string) (result ProductsListResultIterator, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProductsClient.ListByBillingAccount\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response().Response.Response != nil {\n\t\t\t\tsc = result.page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.page, err = client.ListByBillingAccount(ctx, billingAccountName, filter)\n\treturn\n}", "title": "" }, { "docid": "a3295b12ad2989dd45f3904618904af1", "score": "0.50577843", "text": "func listProfiles(cmd *cobra.Command) error {\n\tok, err := cmd.Flags().GetBool(FlagProfileVerbose)\n\tif err != nil {\n\t\treturn err\n\t}\n\tprofileController, err := GetProfileController()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !ok {\n\t\treturn displayProfileNames(profileController)\n\t}\n\treturn displayCompleteProfiles(profileController)\n}", "title": "" }, { "docid": "d0fb0370e128026bd65dce3f1f6f27c4", "score": "0.5021238", "text": "func GetFilteredProfiles(parameters map[string][]string) (*models.ProfileList, error) {\n\tlimit_param, ok := parameters[\"limit\"]\n\n\tif !ok {\n\t\tlimit_param = []string{\"0\"}\n\t}\n\n\tlimit, err := strconv.Atoi(limit_param[0])\n\n\tif err != nil {\n\t\treturn nil, errors.New(\"Could not convert 'limit' to int.\")\n\t}\n\n\t// Remove \"limit\" from parameters before querying db\n\tdelete(parameters, \"limit\")\n\n\tquery, err := database.CreateFilterQuery(parameters, models.Profile{})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprofiles := []models.Profile{}\n\terr = db.FindAll(\"profiles\", query, &profiles)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO: add some kind of recommendation sort/metric here\n\n\tif limit > 0 {\n\t\tlimit = utils.Min(limit, len(profiles))\n\t\tprofiles = profiles[:limit]\n\t}\n\n\tprofile_list := models.ProfileList{\n\t\tProfiles: profiles,\n\t}\n\n\treturn &profile_list, nil\n}", "title": "" }, { "docid": "c75044f7217ec2d89babbfdbd08cf21f", "score": "0.5009168", "text": "func (client OnboardingClient) listProfiles(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/profiles\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListProfilesResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"https://docs.oracle.com/iaas/api/#/en/osmh/20220901/Profile/ListProfiles\"\n\t\terr = common.PostProcessServiceError(err, \"Onboarding\", \"ListProfiles\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "0dab378c4221ab7c8c74e884b6a7df88", "score": "0.50091517", "text": "func (client CustomersClient) ListByBillingAccountPreparer(ctx context.Context, billingAccountName string, search string, filter string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"billingAccountName\": autorest.Encode(\"path\", billingAccountName),\n\t}\n\n\tconst APIVersion = \"2020-05-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\tif len(search) > 0 {\n\t\tqueryParameters[\"$search\"] = autorest.Encode(\"query\", search)\n\t}\n\tif len(filter) > 0 {\n\t\tqueryParameters[\"$filter\"] = autorest.Encode(\"query\", filter)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "72535881b7a3fdaaeb0678c3309d8ab6", "score": "0.49662602", "text": "func (client DimensionsClient) ListByBillingAccount(ctx context.Context, billingAccountID string, filter string, expand string, skiptoken string, top *int32) (result DimensionsListResult, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/DimensionsClient.ListByBillingAccount\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: top,\n\t\t\tConstraints: []validation.Constraint{{Target: \"top\", Name: validation.Null, Rule: false,\n\t\t\t\tChain: []validation.Constraint{{Target: \"top\", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil},\n\t\t\t\t\t{Target: \"top\", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},\n\t\t\t\t}}}}}); err != nil {\n\t\treturn result, validation.NewError(\"costmanagement.DimensionsClient\", \"ListByBillingAccount\", err.Error())\n\t}\n\n\treq, err := client.ListByBillingAccountPreparer(ctx, billingAccountID, filter, expand, skiptoken, top)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"costmanagement.DimensionsClient\", \"ListByBillingAccount\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListByBillingAccountSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"costmanagement.DimensionsClient\", \"ListByBillingAccount\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.ListByBillingAccountResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"costmanagement.DimensionsClient\", \"ListByBillingAccount\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "fa4deb5f4342222f85df20593afe2264", "score": "0.49427092", "text": "func (client RoleAssignmentsClient) ListByBillingProfileSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "839c4e85f0a634aee6878d4115326bc2", "score": "0.49234328", "text": "func (o *GetBillingZoneitemsParams) SetBillingProfileID(billingProfileID string) {\n\to.BillingProfileID = billingProfileID\n}", "title": "" }, { "docid": "dcb6a05484075d5b4607ca6c403fb391", "score": "0.49000123", "text": "func (client InvoicesClient) ListByBillingSubscription(ctx context.Context, periodStartDate string, periodEndDate string) (result InvoiceListResultPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/InvoicesClient.ListByBillingSubscription\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.ilr.Response.Response != nil {\n\t\t\t\tsc = result.ilr.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listByBillingSubscriptionNextResults\n\treq, err := client.ListByBillingSubscriptionPreparer(ctx, periodStartDate, periodEndDate)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.InvoicesClient\", \"ListByBillingSubscription\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListByBillingSubscriptionSender(req)\n\tif err != nil {\n\t\tresult.ilr.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"billing.InvoicesClient\", \"ListByBillingSubscription\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.ilr, err = client.ListByBillingSubscriptionResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.InvoicesClient\", \"ListByBillingSubscription\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.ilr.hasNextLink() && result.ilr.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "388d26a2716a179febe87a52f32c4951", "score": "0.48978046", "text": "func (m *MockRepository) ListProfiles(ctx context.Context, firstNamePrefix, lastNamePrefix string, limit int) ([]entity.Profile, bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListProfiles\", ctx, firstNamePrefix, lastNamePrefix, limit)\n\tret0, _ := ret[0].([]entity.Profile)\n\tret1, _ := ret[1].(bool)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "f6ab6d63fd1fc4b8ff6cbf27ee997812", "score": "0.48728088", "text": "func (client ProductsClient) listByBillingProfileNextResults(ctx context.Context, lastResults ProductsListResult) (result ProductsListResult, err error) {\n\treq, err := lastResults.productsListResultPreparer(ctx)\n\tif err != nil {\n\t\treturn result, autorest.NewErrorWithError(err, \"billing.ProductsClient\", \"listByBillingProfileNextResults\", nil, \"Failure preparing next results request\")\n\t}\n\tif req == nil {\n\t\treturn\n\t}\n\tresp, err := client.ListByBillingProfileSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\treturn result, autorest.NewErrorWithError(err, \"billing.ProductsClient\", \"listByBillingProfileNextResults\", resp, \"Failure sending next results request\")\n\t}\n\tresult, err = client.ListByBillingProfileResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.ProductsClient\", \"listByBillingProfileNextResults\", resp, \"Failure responding to next results request\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "52d7fa9d048f3715cee70502cc29e7f9", "score": "0.484603", "text": "func (client InvoicesClient) ListByBillingAccount(ctx context.Context, billingAccountName string, periodStartDate string, periodEndDate string) (result InvoiceListResultPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/InvoicesClient.ListByBillingAccount\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.ilr.Response.Response != nil {\n\t\t\t\tsc = result.ilr.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listByBillingAccountNextResults\n\treq, err := client.ListByBillingAccountPreparer(ctx, billingAccountName, periodStartDate, periodEndDate)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.InvoicesClient\", \"ListByBillingAccount\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListByBillingAccountSender(req)\n\tif err != nil {\n\t\tresult.ilr.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"billing.InvoicesClient\", \"ListByBillingAccount\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.ilr, err = client.ListByBillingAccountResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.InvoicesClient\", \"ListByBillingAccount\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.ilr.hasNextLink() && result.ilr.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7f01793e58315700680fd7a7de243382", "score": "0.48403254", "text": "func (c *Client) ListBillingUsers(ctx context.Context, opts ...ListOption) (\n\t*pb.ListBillingUsersResponse, error) {\n\targs := &listOptions{}\n\tfor _, opt := range opts {\n\t\topt(args)\n\t}\n\treturn c.c.ListBillingUsers(ctx, &pb.ListBillingUsersRequest{\n\t\tOffset: args.offset,\n\t\tLimit: args.limit,\n\t})\n}", "title": "" }, { "docid": "4111aea4771a3cfb8bd9e91d6ffd0cdf", "score": "0.4808208", "text": "func (client InvoicesClient) ListByBillingAccountComplete(ctx context.Context, billingAccountName string, periodStartDate string, periodEndDate string) (result InvoiceListResultIterator, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/InvoicesClient.ListByBillingAccount\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response().Response.Response != nil {\n\t\t\t\tsc = result.page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.page, err = client.ListByBillingAccount(ctx, billingAccountName, periodStartDate, periodEndDate)\n\treturn\n}", "title": "" }, { "docid": "edfec074bbc0194dcd80b415de503655", "score": "0.48066732", "text": "func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {\n\turl := listURL(c)\n\tif opts != nil {\n\t\tquery, err := opts.ToBillingListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\treturn pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn BillingPage{pagination.SinglePageBase(r)}\n\t})\n}", "title": "" }, { "docid": "902959296ab9b55164b7447735c8a5f2", "score": "0.47683907", "text": "func (client *FlipClient) ListProfiles(argsMap cli.FlagMap) {\n\n\topts, pageErr := getPageOpt(&argsMap)\n\tif pageErr != nil {\n\n\t\tclient.output.printError(\"ListProfiles\", pageErr)\n\t\treturn\n\t}\n\n\tprofilesCollection, _, err := client.client.FlipApi.Profiles(client.ctx, *argsMap[\"factory_id\"].Value,\n\t\topts)\n\n\tcolNames := []interface{}{\"NAME\", \" ID\", \"CREATED_AT\", \"FORMATS\", \"SIZE\", \"VIDEO_BITRATE\", \"AUDIO_BITRATE\"}\n\trows := [][]interface{}{}\n\n\tif nil == err {\n\n\t\tfor _, profile := range profilesCollection.Profiles {\n\n\t\t\tvBitrate := fmt.Sprint(profile.VideoBitrate)\n\t\t\taBitrate := fmt.Sprint(profile.AudioBitrate)\n\n\t\t\tif \"0\" == vBitrate {\n\t\t\t\tvBitrate = \"auto\"\n\t\t\t}\n\n\t\t\tif \"0\" == aBitrate {\n\t\t\t\taBitrate = \"auto\"\n\t\t\t}\n\n\t\t\trows = append(rows, []interface{}{profile.Name, profile.Id, profile.CreatedAt, profile.Title + \" \" + profile.AudioCodec,\n\t\t\t\tfmt.Sprint(profile.Width) + \"x\" + fmt.Sprint(profile.Height), aBitrate, vBitrate})\n\t\t}\n\n\t\tclient.output.printTable(colNames, rows)\n\n\t} else {\n\n\t\tclient.output.printError(\"ListProfiles\", err)\n\t}\n}", "title": "" }, { "docid": "5f45f7820bfd69f57b9dc160bc47e2e5", "score": "0.4763301", "text": "func (ar *AzureReader) ListProfiles(ctx context.Context) ([]network.Profile, error) {\n\tclient := network.NewProfilesClient(ar.config.SubscriptionID)\n\tclient.Authorizer = ar.authorizer\n\n\toutput, err := client.List(ctx, ar.GetResourceGroupName())\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to list network.Profile from Azure APIs\")\n\t}\n\n\tresources := make([]network.Profile, 0)\n\tfor output.NotDone() {\n\n\t\tfor _, res := range output.Values() {\n\t\t\tresources = append(resources, res)\n\t\t}\n\n\t\tif err := output.NextWithContext(ctx); err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn resources, nil\n\n}", "title": "" }, { "docid": "5f45f7820bfd69f57b9dc160bc47e2e5", "score": "0.4763301", "text": "func (ar *AzureReader) ListProfiles(ctx context.Context) ([]network.Profile, error) {\n\tclient := network.NewProfilesClient(ar.config.SubscriptionID)\n\tclient.Authorizer = ar.authorizer\n\n\toutput, err := client.List(ctx, ar.GetResourceGroupName())\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to list network.Profile from Azure APIs\")\n\t}\n\n\tresources := make([]network.Profile, 0)\n\tfor output.NotDone() {\n\n\t\tfor _, res := range output.Values() {\n\t\t\tresources = append(resources, res)\n\t\t}\n\n\t\tif err := output.NextWithContext(ctx); err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn resources, nil\n\n}", "title": "" }, { "docid": "cb91a7c04046fb11bab6e735c2dca589", "score": "0.47347808", "text": "func (mr *MockRepositoryMockRecorder) ListProfiles(ctx, firstNamePrefix, lastNamePrefix, limit interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListProfiles\", reflect.TypeOf((*MockRepository)(nil).ListProfiles), ctx, firstNamePrefix, lastNamePrefix, limit)\n}", "title": "" }, { "docid": "9def9e26047548eea707039d6e6ae76a", "score": "0.47259676", "text": "func (mr *MockServiceProfileClientMockRecorder) ListServiceProfile(arg0 interface{}, arg1 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0}, arg1...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListServiceProfile\", reflect.TypeOf((*MockServiceProfileClient)(nil).ListServiceProfile), varargs...)\n}", "title": "" }, { "docid": "204f22e754ad53f3336ff249840092a7", "score": "0.4714813", "text": "func (m *MockServiceProfileClient) ListServiceProfile(arg0 context.Context, arg1 ...client.ListOption) (*v1alpha2.ServiceProfileList, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0}\n\tfor _, a := range arg1 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListServiceProfile\", varargs...)\n\tret0, _ := ret[0].(*v1alpha2.ServiceProfileList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8f1c90dba8c64ec4946a318c446fdcb8", "score": "0.47089347", "text": "func (client OnboardingClient) ListProfiles(ctx context.Context, request ListProfilesRequest) (response ListProfilesResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.DefaultRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.listProfiles, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = ListProfilesResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListProfilesResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListProfilesResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListProfilesResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "8574ed72e901c2f6978a9f64216eb0b2", "score": "0.46801555", "text": "func (client InvoicesClient) ListByBillingSubscriptionComplete(ctx context.Context, periodStartDate string, periodEndDate string) (result InvoiceListResultIterator, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/InvoicesClient.ListByBillingSubscription\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response().Response.Response != nil {\n\t\t\t\tsc = result.page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.page, err = client.ListByBillingSubscription(ctx, periodStartDate, periodEndDate)\n\treturn\n}", "title": "" }, { "docid": "b696effabcfde7763506dfeb6d8638f6", "score": "0.4634329", "text": "func (ps *ProfilesService) List(ctx context.Context, opts *ProfileListOptions) (\n\tres *Response,\n\tpl *ProfileList,\n\terr error,\n) {\n\tres, err = ps.client.get(ctx, \"v2/profiles\", opts)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif err = json.Unmarshal(res.content, &pl); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a436d34a62eb38ad350e854cc1293ac9", "score": "0.4606916", "text": "func (m *Manager) Search(catalogClient CatalogClient, searchName string) ([]profilesv1.ProfileCatalogEntry, error) {\n\tvar data []byte\n\tvar statusCode int\n\tvar err error\n\n\tif searchName == \"\" {\n\t\tdata, statusCode, err = catalogClient.DoRequest(\"/profiles\", nil)\n\t} else {\n\t\tq := map[string]string{\n\t\t\t\"name\": searchName,\n\t\t}\n\t\tdata, statusCode, err = catalogClient.DoRequest(\"/profiles\", q)\n\t}\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to fetch catalog: %w\", err)\n\t}\n\n\tif statusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"failed to fetch profile from catalog, status code %d\", statusCode)\n\t}\n\tvar profiles protos.GRPCProfileCatalogEntryList\n\tif err := json.Unmarshal(data, &profiles); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse catalog: %w\", err)\n\t}\n\n\treturn profiles.Items, nil\n}", "title": "" }, { "docid": "0cae10c158b9669cf9e5b20b142053a1", "score": "0.45979953", "text": "func (in *BillingProfile) DeepCopy() *BillingProfile {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BillingProfile)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "dd0fa1a5087d3f6b0d8e3db48c5c68b2", "score": "0.45646453", "text": "func (client ProductsClient) ListByBillingAccountPreparer(ctx context.Context, billingAccountName string, filter string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"billingAccountName\": autorest.Encode(\"path\", billingAccountName),\n\t}\n\n\tconst APIVersion = \"2020-05-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\tif len(filter) > 0 {\n\t\tqueryParameters[\"$filter\"] = autorest.Encode(\"query\", filter)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "8b75d8908b295e3928622401ef36d97b", "score": "0.4561978", "text": "func (q *Query) SetProfile(profile string) {\n\tq.Profile = profile\n}", "title": "" }, { "docid": "8a357a6007d095c0e83c37de1598616f", "score": "0.45557997", "text": "func (client *ReservationTransactionsClient) listByBillingProfileHandleResponse(resp *http.Response) (ReservationTransactionsClientListByBillingProfileResponse, error) {\n\tresult := ReservationTransactionsClientListByBillingProfileResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ModernReservationTransactionsListResult); err != nil {\n\t\treturn ReservationTransactionsClientListByBillingProfileResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "e8bf31333e70a2be6f846ef98016584e", "score": "0.4552716", "text": "func (client *ContactProfilesClient) listBySubscriptionCreateRequest(ctx context.Context, options *ContactProfilesClientListBySubscriptionOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/contactProfiles\"\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\", \"2022-11-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\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "5a6a226582893a787862bfb65d398965", "score": "0.4514678", "text": "func (c *Client) ListProfiles(ctx context.Context) (fargateProfileNames []string, err error) {\n\trequest := &eks.ListFargateProfilesInput{\n\t\tClusterName: &c.clusterName,\n\t}\n\tvar out *eks.ListFargateProfilesOutput\n\tfor out, err = c.sendListRequestOnce(ctx, request); err == nil; out, err = c.sendListRequestOnce(ctx, request) {\n\t\tfargateProfileNames = append(fargateProfileNames, out.FargateProfileNames...)\n\n\t\tif request.NextToken = out.NextToken; request.NextToken == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlogger.Debug(\"Fargate profile: list request: received a total of %v profile(s)\", len(fargateProfileNames))\n\treturn fargateProfileNames, nil\n}", "title": "" }, { "docid": "e0c901af0dd2cd5fb8f921fcbeb69606", "score": "0.44947925", "text": "func (o *PeoplePersonOfPeople) SetProfile(v string) {\n\to.Profile = &v\n}", "title": "" }, { "docid": "ea9077a024a92d8b2b2b990de04ba5eb", "score": "0.44884247", "text": "func (r *Client) ListFirewallProfile() (objs []*security.FirewallProfile, err error) {\n\topts := api.ListWatchOptions{ObjectMeta: api.ObjectMeta{Tenant: globals.DefaultTenant}}\n\n\tfor _, restcl := range r.restcls {\n\t\tobjs, err = restcl.SecurityV1().FirewallProfile().List(r.ctx, &opts)\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn objs, err\n}", "title": "" }, { "docid": "12d57a78d622fe474d6343e8a5842d57", "score": "0.4475481", "text": "func (p *VnicProfilesService) List() *VnicProfilesServiceListRequest {\n\treturn &VnicProfilesServiceListRequest{VnicProfilesService: p}\n}", "title": "" }, { "docid": "a629cb59efbe149b0adb561e4a553759", "score": "0.44612083", "text": "func ListProfiles(miniHome ...string) (validPs []*Profile, inValidPs []*Profile, err error) {\n\tpDirs, err := profileDirs(miniHome...)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tfor _, n := range pDirs {\n\t\tp, err := loadProfile(n, miniHome...)\n\t\tif err != nil {\n\t\t\tinValidPs = append(inValidPs, p)\n\t\t\tcontinue\n\t\t}\n\t\tif !p.isValid() {\n\t\t\tinValidPs = append(inValidPs, p)\n\t\t\tcontinue\n\t\t}\n\t\tvalidPs = append(validPs, p)\n\t}\n\treturn validPs, inValidPs, nil\n}", "title": "" }, { "docid": "b953e151fd6f476fbb4941734b88c59f", "score": "0.4444338", "text": "func ListOfProfiles(api restapi.API) {\n\t// try to read list of configuration profiles and display error when\n\t// something wrong happens\n\tprofiles, err := api.ReadListOfConfigurationProfiles()\n\tif err != nil {\n\t\t// in case of error just print the error message\n\t\tfmt.Println(colorizer.Red(ErrorReadingListOfConfigurationProfiles))\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\t// REST API call returns data\n\tfmt.Println(colorizer.Magenta(\"List of configuration profiles\"))\n\tfmt.Printf(\"%4s %4s %-20s %-20s %s\\n\", \"#\", \"ID\", changedAt, changedBy, \"Description\")\n\n\t// list all profiles\n\tfor i, profile := range profiles {\n\t\t// update timestamps not to contain irrelevant parts\n\t\tchangedAt := profile.ChangedAt[0:19]\n\t\tfmt.Printf(\"%4d %4d %-20s %-20s %-s\\n\", i, profile.ID, changedAt, profile.ChangedBy, profile.Description)\n\t}\n}", "title": "" }, { "docid": "ea46139cb4de3e78ece3eb6efba8e464", "score": "0.4431291", "text": "func (s *ProfileService) List(ctx context.Context, r ProfileListRequest) (*ProfileListResponse, error) {\n\trequestBodyBytes, err := json.Marshal(r)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"ProfileService.List: marshal ProfileListRequest\")\n\t}\n\turl := s.client.RemoteHost + \"ProfileService.List\"\n\ts.client.Debug(fmt.Sprintf(\"POST %s\", url))\n\ts.client.Debug(fmt.Sprintf(\">> %s\", string(requestBodyBytes)))\n\treq, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(requestBodyBytes))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"ProfileService.List: NewRequest\")\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Accept-Encoding\", \"gzip\")\n\treq = req.WithContext(ctx)\n\tif s.client.BeforeRequest != nil {\n\t\terr = s.client.BeforeRequest(req)\n\t\tif err != nil {\n\t\t\t// don't wrap this error, it belongs to the user\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tresp, err := s.client.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"ProfileService.List\")\n\t}\n\tdefer resp.Body.Close()\n\tvar response struct {\n\t\tProfileListResponse\n\t\tError string\n\t}\n\tvar bodyReader io.Reader = resp.Body\n\tif strings.Contains(resp.Header.Get(\"Content-Encoding\"), \"gzip\") {\n\t\tdecodedBody, err := gzip.NewReader(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"ProfileService.List: new gzip reader\")\n\t\t}\n\t\tdefer decodedBody.Close()\n\t\tbodyReader = decodedBody\n\t}\n\trespBodyBytes, err := ioutil.ReadAll(bodyReader)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"ProfileService.List: read response body\")\n\t}\n\tif err := json.Unmarshal(respBodyBytes, &response); err != nil {\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\treturn nil, errors.Errorf(\"ProfileService.List: (%d) %v\", resp.StatusCode, string(respBodyBytes))\n\t\t}\n\t\treturn nil, err\n\t}\n\tif response.Error != \"\" {\n\t\treturn nil, errors.New(response.Error)\n\t}\n\treturn &response.ProfileListResponse, nil\n}", "title": "" }, { "docid": "b766baeb3d28bae69df1cac687fc4e7e", "score": "0.44250512", "text": "func (c *Config) ListProfiles() []string {\n\tif c.Profiles == nil {\n\t\treturn nil\n\t}\n\tvar list []string\n\n\tfor k := range c.Profiles {\n\t\tlist = append(list, k)\n\t}\n\n\treturn list\n}", "title": "" }, { "docid": "dc873720d74fa9722983387715750edd", "score": "0.44129092", "text": "func (r *EndpointsSecurityV1RestClient) AutoListFirewallProfile(ctx context.Context, options *api.ListWatchOptions) (*FirewallProfileList, error) {\n\tpath := makeURISecurityV1AutoListFirewallProfileListOper(options)\n\tif r.bufferId != \"\" {\n\t\tpath = strings.Replace(path, \"/configs\", \"/staging/\"+r.bufferId, 1)\n\t}\n\treq, err := r.getHTTPRequest(ctx, options, \"GET\", path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := r.client.Do(req.WithContext(ctx))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"request failed (%s)\", err)\n\t}\n\tdefer resp.Body.Close()\n\tret, err := decodeHTTPrespSecurityV1AutoListFirewallProfile(ctx, resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ret.(*FirewallProfileList), err\n}", "title": "" }, { "docid": "18a8eef262980ec89065ae3cbeaf6be5", "score": "0.4396514", "text": "func (client RoleAssignmentsClient) GetByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string) (result RoleAssignment, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/RoleAssignmentsClient.GetByBillingProfile\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.GetByBillingProfilePreparer(ctx, billingAccountName, billingProfileName, billingRoleAssignmentName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.RoleAssignmentsClient\", \"GetByBillingProfile\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetByBillingProfileSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"billing.RoleAssignmentsClient\", \"GetByBillingProfile\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetByBillingProfileResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.RoleAssignmentsClient\", \"GetByBillingProfile\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "1f0a1fddd18c633d66fe85cbbc767e9c", "score": "0.43938962", "text": "func (client InvoicesClient) ListByBillingAccountPreparer(ctx context.Context, billingAccountName string, periodStartDate string, periodEndDate string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"billingAccountName\": autorest.Encode(\"path\", billingAccountName),\n\t}\n\n\tconst APIVersion = \"2020-05-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t\t\"periodEndDate\": autorest.Encode(\"query\", periodEndDate),\n\t\t\"periodStartDate\": autorest.Encode(\"query\", periodStartDate),\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "c150675007d7f59271210709cfa689c0", "score": "0.4392278", "text": "func (client RoleAssignmentsClient) listByBillingProfileNextResults(ctx context.Context, lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) {\n\treq, err := lastResults.roleAssignmentListResultPreparer(ctx)\n\tif err != nil {\n\t\treturn result, autorest.NewErrorWithError(err, \"billing.RoleAssignmentsClient\", \"listByBillingProfileNextResults\", nil, \"Failure preparing next results request\")\n\t}\n\tif req == nil {\n\t\treturn\n\t}\n\tresp, err := client.ListByBillingProfileSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\treturn result, autorest.NewErrorWithError(err, \"billing.RoleAssignmentsClient\", \"listByBillingProfileNextResults\", resp, \"Failure sending next results request\")\n\t}\n\tresult, err = client.ListByBillingProfileResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.RoleAssignmentsClient\", \"listByBillingProfileNextResults\", resp, \"Failure responding to next results request\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "f2cec5257b3ace0f149e5facb9e3bf5a", "score": "0.435237", "text": "func (fs *FileStore) listProfiles(id string) ([]string, error) {\n\tpart := fs.dir + \"/profiles/*.\" + id + \".v*.profile.json\"\n\tfiles, err := filepath.Glob(part)\n\treturn files, err\n}", "title": "" }, { "docid": "3ff5d09f6b6af96fe56e5fb43f149134", "score": "0.4351206", "text": "func (d *DeviceClient) DevicesForProfileByName(profileName string) ([]models.Device, error) {\n\treq, err := http.NewRequest(\"GET\", d.url+\"/profilename/\"+url.QueryEscape(profileName), nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn []models.Device{}, err\n\t}\n\n\t// Make the request and get response\n\tresp, err := makeRequest(req)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn []models.Device{}, err\n\t}\n\tif resp == nil {\n\t\tfmt.Println(ErrResponseNil)\n\t\treturn []models.Device{}, ErrResponseNil\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\t// Get the response body\n\t\tbodyBytes, err := getBody(resp)\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\treturn []models.Device{}, err\n\t\t}\n\t\tbodyString := string(bodyBytes)\n\n\t\treturn []models.Device{}, errors.New(bodyString)\n\t}\n\treturn d.decodeDeviceSlice(resp)\n}", "title": "" }, { "docid": "872f30ed1e3ccfce8d1dd04d7290c7a7", "score": "0.4349763", "text": "func (client InvoicesClient) ListByBillingSubscriptionSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "5e72d7b8e37ace8d767b9d9949eb391b", "score": "0.43427742", "text": "func (e EndpointsSecurityV1Client) AutoListFirewallProfile(ctx context.Context, in *api.ListWatchOptions) (*FirewallProfileList, error) {\n\tresp, err := e.AutoListFirewallProfileEndpoint(ctx, in)\n\tif err != nil {\n\t\treturn &FirewallProfileList{}, err\n\t}\n\treturn resp.(*FirewallProfileList), nil\n}", "title": "" }, { "docid": "6c7f95080ea3ac23d061052e262e0a88", "score": "0.43336833", "text": "func (client InvoicesClient) ListByBillingSubscriptionPreparer(ctx context.Context, periodStartDate string, periodEndDate string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-05-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t\t\"periodEndDate\": autorest.Encode(\"query\", periodEndDate),\n\t\t\"periodStartDate\": autorest.Encode(\"query\", periodStartDate),\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "baf66fc36f31b269fac3931812f205b4", "score": "0.4332284", "text": "func (client RoleAssignmentsClient) ListByBillingProfileResponder(resp *http.Response) (result RoleAssignmentListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "e1738ed5dc36d2ef1100961c7a359b3a", "score": "0.43309686", "text": "func (p *CpuProfilesService) List() *CpuProfilesServiceListRequest {\n\treturn &CpuProfilesServiceListRequest{CpuProfilesService: p}\n}", "title": "" }, { "docid": "133bfb9650ae71ae083ee24a2619d02f", "score": "0.43265706", "text": "func ValidateProfile(profile string) (*ErrValidateProfile, bool) {\n\n\tvalidProfiles, invalidProfiles, err := config.ListProfiles()\n\tif err != nil {\n\t\tout.FailureT(err.Error())\n\t}\n\n\t// handling invalid profiles\n\tfor _, invalidProf := range invalidProfiles {\n\t\tif profile == invalidProf.Name {\n\t\t\treturn &ErrValidateProfile{Name: profile, Msg: fmt.Sprintf(\"%q is an invalid profile\", profile)}, false\n\t\t}\n\t}\n\n\tprofileFound := false\n\t// valid profiles if found, setting profileFound to trueexpectedMsg\n\tfor _, prof := range validProfiles {\n\t\tif prof.Name == profile {\n\t\t\tprofileFound = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !profileFound {\n\t\treturn &ErrValidateProfile{Name: profile, Msg: fmt.Sprintf(\"profile %q not found\", profile)}, false\n\t}\n\treturn nil, true\n}", "title": "" }, { "docid": "7becd9f511654dcc4682301f85411b82", "score": "0.43243256", "text": "func (client RoleAssignmentsClient) ListByBillingAccount(ctx context.Context, billingAccountName string) (result RoleAssignmentListResultPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/RoleAssignmentsClient.ListByBillingAccount\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.ralr.Response.Response != nil {\n\t\t\t\tsc = result.ralr.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listByBillingAccountNextResults\n\treq, err := client.ListByBillingAccountPreparer(ctx, billingAccountName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.RoleAssignmentsClient\", \"ListByBillingAccount\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListByBillingAccountSender(req)\n\tif err != nil {\n\t\tresult.ralr.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"billing.RoleAssignmentsClient\", \"ListByBillingAccount\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.ralr, err = client.ListByBillingAccountResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"billing.RoleAssignmentsClient\", \"ListByBillingAccount\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.ralr.hasNextLink() && result.ralr.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "abbfa0252a1ef731afd130696f0c8031", "score": "0.43242887", "text": "func (o *GetBillingZoneitemsParams) WithBillingProfileID(billingProfileID string) *GetBillingZoneitemsParams {\n\to.SetBillingProfileID(billingProfileID)\n\treturn o\n}", "title": "" }, { "docid": "cac346b19ca8461a8f6fd8325cb359ae", "score": "0.4322697", "text": "func ExampleAFDEndpointsClient_NewListByProfilePager() {\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 := armcdn.NewAFDEndpointsClient(\"subid\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListByProfilePager(\"RG\",\n\t\t\"profile1\",\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": "a311b38d34647002c4fdd2f2ff43e592", "score": "0.43107083", "text": "func SetProfile(profileName string) {\n\tprofile = Profile(profileName)\n}", "title": "" }, { "docid": "ecb773ba956c7c2c25541b32f73a6105", "score": "0.4288575", "text": "func (client ShareSubscriptionsClient) ListByAccountComplete(ctx context.Context, resourceGroupName string, accountName string, skipToken string, filter string, orderby string) (result ShareSubscriptionListIterator, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ShareSubscriptionsClient.ListByAccount\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response().Response.Response != nil {\n\t\t\t\tsc = result.page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.page, err = client.ListByAccount(ctx, resourceGroupName, accountName, skipToken, filter, orderby)\n\treturn\n}", "title": "" }, { "docid": "c9cf55ce9eb6c9c48f81e634378e60b3", "score": "0.4287979", "text": "func (r *BillingAccountsService) List() *BillingAccountsListCall {\n\tc := &BillingAccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\treturn c\n}", "title": "" }, { "docid": "c9cf55ce9eb6c9c48f81e634378e60b3", "score": "0.4287979", "text": "func (r *BillingAccountsService) List() *BillingAccountsListCall {\n\tc := &BillingAccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\treturn c\n}", "title": "" }, { "docid": "87c56bc02f4bd858c305b67644e1ee35", "score": "0.42581668", "text": "func (c *Controller) enqueueProfileUpdates() error {\n\tprofileList, err := c.listers.TunedProfiles.List(labels.Everything())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to list Tuned Profiles: %v\", err)\n\t}\n\tfor _, profile := range profileList {\n\t\t// Enqueue Profile updates into the operator's workqueue\n\t\tc.workqueue.AddRateLimited(wqKey{kind: wqKindProfile, namespace: ntoconfig.WatchNamespace(), name: profile.Name})\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "23991a7237505f4ce878bc99401cad1b", "score": "0.4255549", "text": "func (client OnboardingClient) deleteProfile(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/profiles/{profileId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteProfileResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"https://docs.oracle.com/iaas/api/#/en/osmh/20220901/Profile/DeleteProfile\"\n\t\terr = common.PostProcessServiceError(err, \"Onboarding\", \"DeleteProfile\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "75e5f16ce93afca8e89f61db3440f397", "score": "0.42381102", "text": "func (client RoleAssignmentsClient) ListByBillingAccountComplete(ctx context.Context, billingAccountName string) (result RoleAssignmentListResultIterator, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/RoleAssignmentsClient.ListByBillingAccount\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response().Response.Response != nil {\n\t\t\t\tsc = result.page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.page, err = client.ListByBillingAccount(ctx, billingAccountName)\n\treturn\n}", "title": "" }, { "docid": "69eabcb34196653a3b939a7fb59bb8e1", "score": "0.42366853", "text": "func (client BackupsClient) ListByDevice(ctx context.Context, deviceName string, resourceGroupName string, managerName string, filter string) (result BackupListPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/BackupsClient.ListByDevice\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.bl.Response.Response != nil {\n\t\t\t\tsc = result.bl.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: managerName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"managerName\", Name: validation.MaxLength, Rule: 50, Chain: nil},\n\t\t\t\t{Target: \"managerName\", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"storsimple.BackupsClient\", \"ListByDevice\", err.Error())\n\t}\n\n\tresult.fn = client.listByDeviceNextResults\n\treq, err := client.ListByDevicePreparer(ctx, deviceName, resourceGroupName, managerName, filter)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"storsimple.BackupsClient\", \"ListByDevice\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListByDeviceSender(req)\n\tif err != nil {\n\t\tresult.bl.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"storsimple.BackupsClient\", \"ListByDevice\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.bl, err = client.ListByDeviceResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"storsimple.BackupsClient\", \"ListByDevice\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9d54da4e13a83d50ac2c64e974b95bdf", "score": "0.4234879", "text": "func (c *Client) AlertProfileList() ([]*AlertProfileStruct, error) {\n\tvar err error\n\tvar result []*AlertProfileStruct\n\tobj, err := c.executeListAndReturnResults(\"/alert/profile\")\n\tfor _, i := range obj {\n\t\tresult = append(result, i.(*AlertProfileStruct))\n\t}\n\treturn result, err\n}", "title": "" }, { "docid": "df9711825384a8448f2682c23e2e96a8", "score": "0.422952", "text": "func (client CustomersClient) ListByBillingAccountSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "66fa266b80edbef49dfe4240ed4688fc", "score": "0.42053255", "text": "func (d *DeviceClient) DevicesForProfile(profileId string) ([]models.Device, error) {\n\treq, err := http.NewRequest(\"GET\", d.url+\"/profile/\"+profileId, nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn []models.Device{}, err\n\t}\n\n\t// Make the request and get response\n\tresp, err := makeRequest(req)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn []models.Device{}, err\n\t}\n\tif resp == nil {\n\t\tfmt.Println(ErrResponseNil)\n\t\treturn []models.Device{}, ErrResponseNil\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\t// Get the response body\n\t\tbodyBytes, err := getBody(resp)\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\treturn []models.Device{}, err\n\t\t}\n\t\tbodyString := string(bodyBytes)\n\n\t\treturn []models.Device{}, errors.New(bodyString)\n\t}\n\treturn d.decodeDeviceSlice(resp)\n}", "title": "" }, { "docid": "459dc2617aa09a4b28cf7a583df54576", "score": "0.42015305", "text": "func (srv *Server) ReadProfiles(ctx context.Context, in *stats.Query) (*stats.Profile, error) {\n\tvar profile stats.Profile\n\tif in.Size == 0 {\n\t\tin.Size = 10000\n\t}\n\n\tformattedFilters, err := relaxting.FilterByProjects(ctx, formatFilters(in.Filters))\n\tif err != nil {\n\t\treturn nil, errorutils.FormatErrorMsg(err, in.Id)\n\t}\n\n\tif in.Id != \"\" {\n\t\tif in.Type == \"\" {\n\t\t\treturn nil, status.Error(codes.InvalidArgument, fmt.Sprintf(\"Type must be specified when requesting specific profile information. Please specify type 'summary' or 'controls'\"))\n\t\t}\n\t\tif in.Type == \"summary\" {\n\t\t\tprofileSummary, err := srv.es.GetProfileSummaryByProfileId(in.Id, formattedFilters)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errorutils.FormatErrorMsg(err, \"\")\n\t\t\t}\n\t\t\tprofile.ProfileSummary = profileSummary\n\t\t}\n\t\tif in.Type == \"controls\" {\n\t\t\tfrom, perPage, sort, order, err := validatePaginationAndSorting(in)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, status.Error(codes.InvalidArgument, err.Error())\n\t\t\t}\n\t\t\tcontrolStats, err := srv.es.GetControlListStatsByProfileID(in.Id, int(from), int(perPage), formattedFilters, sort, order)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errorutils.FormatErrorMsg(err, \"\")\n\t\t\t}\n\t\t\tprofile.ControlStats = controlStats\n\t\t}\n\t} else {\n\t\tprofileList, err := srv.es.GetProfileListWithAggregatedComplianceSummaries(formattedFilters, in.Size)\n\t\tif err != nil {\n\t\t\treturn nil, errorutils.FormatErrorMsg(err, \"\")\n\t\t}\n\t\tprofile.ProfileList = profileList\n\t}\n\treturn &profile, nil\n}", "title": "" }, { "docid": "b4ad59487bee62483a16f0298ac920f4", "score": "0.4196234", "text": "func (s *storageProfileLister) List(selector labels.Selector) (ret []*v1beta1.StorageProfile, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1beta1.StorageProfile))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "6ab13078274aab15fff6e6283bb9c59b", "score": "0.41910145", "text": "func (od *OnDemand) Profile(symbols []string, fields []string) (Profile, error) {\n\tprofile := Profile{}\n\n\t_symbols := strings.ToUpper(strings.Join(symbols, \",\"))\n\t_fields := \"\"\n\n\tif fields != nil {\n\t\t_fields = strings.Join(fields, \",\")\n\t}\n\n\t_, err := od.Request(\"getProfile.json\", fmt.Sprintf(\"symbols=%v&fields=%s\", _symbols, _fields), &profile)\n\treturn profile, err\n}", "title": "" }, { "docid": "4ca5f1aec70882f74e8bb8d5ae2bf688", "score": "0.41878298", "text": "func (p *DiskProfilesService) List() *DiskProfilesServiceListRequest {\n\treturn &DiskProfilesServiceListRequest{DiskProfilesService: p}\n}", "title": "" }, { "docid": "696804004ffed7e9af5298ccb2c778e2", "score": "0.41613725", "text": "func loadProfile(profileNames []string, profiles []Profile,\n\tprocessedProfiles []string, included bool) ([]Profile, []string) {\n\tfor _, name := range profileNames {\n\t\tname = strings.Trim(name, \" \")\n\n\t\tprocessedProfiles = append(processedProfiles, name)\n\n\t\tconfig, err := loadConfigData(name)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Failed to loadConfigData\")\n\t\t\tcontinue\n\t\t}\n\t\tprofile := Create(name, name, config)\n\n\t\tprofiles = append(profiles, profile)\n\t\tif profile.options != nil {\n\t\t\tif profile.options.HasKey(\"include\") {\n\t\t\t\tinclude, _ := profile.options.GetKey(\"include\")\n\t\t\t\tnames := make([]string, 0)\n\t\t\t\tnames = append(names, strings.Split(include.Value(), \",\")...)\n\t\t\t\tprofiles, processedProfiles = loadProfile(names, profiles, processedProfiles, true)\n\t\t\t}\n\t\t}\n\t\tprofile.included = included\n\t}\n\n\treturn profiles, processedProfiles\n}", "title": "" }, { "docid": "184b63da5248eedc793d77b00bd6fd9f", "score": "0.4155576", "text": "func (d *DB) GetAllProfiles() ([]models.Profile, error) {\n\t// TODO: use limit\n\tsqlStatement := fmt.Sprint(`SELECT * FROM contacts`)\n\tvar allProfiles []models.Profile\n\tvar person models.Profile\n\trows, err := d.Query(sqlStatement)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tif err := rows.Scan(&person.ID, &person.DOB, &person.FirstName, &person.LastName, &person.Email, &person.Phone); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tallProfiles = append(allProfiles, person)\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn allProfiles, nil\n}", "title": "" }, { "docid": "1e94ec0b42459b92c86c958ea955f698", "score": "0.41442376", "text": "func (o *ListTeamMemberBookingProfilesParams) WithLimit(limit *int64) *ListTeamMemberBookingProfilesParams {\n\to.SetLimit(limit)\n\treturn o\n}", "title": "" }, { "docid": "2e03a42c589434e52f2d13c2f59f09f7", "score": "0.41409764", "text": "func (client ShareSubscriptionsClient) ListByAccount(ctx context.Context, resourceGroupName string, accountName string, skipToken string, filter string, orderby string) (result ShareSubscriptionListPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ShareSubscriptionsClient.ListByAccount\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.ssl.Response.Response != nil {\n\t\t\t\tsc = result.ssl.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listByAccountNextResults\n\treq, err := client.ListByAccountPreparer(ctx, resourceGroupName, accountName, skipToken, filter, orderby)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"datashare.ShareSubscriptionsClient\", \"ListByAccount\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListByAccountSender(req)\n\tif err != nil {\n\t\tresult.ssl.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"datashare.ShareSubscriptionsClient\", \"ListByAccount\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.ssl, err = client.ListByAccountResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"datashare.ShareSubscriptionsClient\", \"ListByAccount\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.ssl.hasNextLink() && result.ssl.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a6c767d689152e3677361c556ea38d5c", "score": "0.4135431", "text": "func ValidateProfile(profile *param.Profile) error {\n\tif profile == nil {\n\t\treturn errors.New(\"Profile must be non-nil\")\n\t}\n\tif err := ValidateCredentials(&profile.Credential); err != nil {\n\t\treturn err\n\t}\n\tswitch profile.Location.Type {\n\tcase crv1alpha1.LocationTypeS3Compliant:\n\tcase crv1alpha1.LocationTypeGCS:\n\tcase crv1alpha1.LocationTypeAzure:\n\tdefault:\n\t\treturn errors.New(\"Location type not supported\")\n\t}\n\treturn nil\n}", "title": "" } ]
8e2c8a0d3c7ea189836e6d001ba9fab8
OperatorSourceTestGroup creates an OperatorSource and then runs a series of test suites that rely on this resource.
[ { "docid": "f419b9a61c9ea89e63c81dd165b72ca5", "score": "0.83743143", "text": "func OperatorSourceTestGroup(t *testing.T) {\n\t// Create a ctx that is used to delete the OperatorSource at the completion of this function.\n\tctx := test.NewTestCtx(t)\n\tdefer ctx.Cleanup()\n\n\t// Get test namespace.\n\tnamespace, err := ctx.GetNamespace()\n\trequire.NoError(t, err, \"Could not get namespace\")\n\n\t// Create the OperatorSource.\n\terr = helpers.CreateRuntimeObject(test.Global.Client, ctx, helpers.CreateOperatorSourceDefinition(helpers.TestOperatorSourceName, namespace))\n\trequire.NoError(t, err, \"Could not create OperatorSource\")\n\n\t// Run the test suites.\n\tt.Run(\"opsrc-creation-test-suite\", testsuites.OpSrcCreation)\n\tt.Run(\"csc-target-namespace-test-suite\", testsuites.CscTargetNamespace)\n\tt.Run(\"packages-test-suite\", testsuites.PackageTests)\n}", "title": "" } ]
[ { "docid": "0c60ec6596050c8778e48352d5f2566f", "score": "0.6467241", "text": "func SetupOperatorSource() (o operator.Operator, src ops.ImageSource) {\n\to = operator.MakeDefault(512*1024*1024, \"/tmp/RIC_testimagecache\", tokens)\n\tsrc = ops.MakeImageSource()\n\tsrc.AddRoot(\"./\")\n\treturn\n}", "title": "" }, { "docid": "133002f02d7338b7c00bc39fc0df8c54", "score": "0.568192", "text": "func (t *Test) StartOperator() error {\n\tif t.operatorRunning == true {\n\t\treturn fmt.Errorf(\"operator already started\")\n\t}\n\terr := startOperator(t.harness.Options, t.harness.Sinks, t.envs)\n\tif err == nil {\n\t\tt.operatorRunning = true\n\t}\n\treturn err\n}", "title": "" }, { "docid": "fa917b178c8a6545c5f773318120edbd", "score": "0.559311", "text": "func RunOperator(mgr manager.Manager) chan struct{} {\n\tstopChan := make(chan struct{})\n\tgo func() {\n\t\tdefer GinkgoRecover()\n\t\terr := mgr.Start(stopChan)\n\t\tExpect(err).NotTo(HaveOccurred())\n\t}()\n\treturn stopChan\n}", "title": "" }, { "docid": "d992ead5c9cd9f08b19b3d523106f609", "score": "0.53982943", "text": "func NewOperator(kubeconfigPath string, wakeupInterval time.Duration, operatorNamespace string, watchedNamespaces ...string) (*Operator, error) {\n\t// Default to watching all namespaces.\n\tif watchedNamespaces == nil {\n\t\twatchedNamespaces = []string{metav1.NamespaceAll}\n\t}\n\n\t// Create a new client for ALM types (CRs)\n\tcrClient, err := client.NewClient(kubeconfigPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsharedInformerFactory := externalversions.NewSharedInformerFactory(crClient, wakeupInterval)\n\n\t// Create an informer for each namespace.\n\tipSharedIndexInformers := []cache.SharedIndexInformer{}\n\tsubSharedIndexInformers := []cache.SharedIndexInformer{}\n\tfor _, namespace := range watchedNamespaces {\n\t\tnsInformerFactory := externalversions.NewFilteredSharedInformerFactory(crClient, wakeupInterval, namespace, nil)\n\t\tipSharedIndexInformers = append(ipSharedIndexInformers, nsInformerFactory.Installplan().V1alpha1().InstallPlans().Informer())\n\t\tsubSharedIndexInformers = append(subSharedIndexInformers, nsInformerFactory.Subscription().V1alpha1().Subscriptions().Informer())\n\t}\n\n\t// Create a new queueinformer-based operator.\n\tqueueOperator, err := queueinformer.NewOperator(kubeconfigPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Allocate the new instance of an Operator.\n\top := &Operator{\n\t\tOperator: queueOperator,\n\t\tclient: crClient,\n\t\tnamespace: operatorNamespace,\n\t\tsources: make(map[string]registry.Source),\n\t}\n\t// Register CatalogSource informers.\n\tcatsrcQueue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), \"catalogsources\")\n\tcatsrcQueueInformer := queueinformer.New(\n\t\tcatsrcQueue,\n\t\t[]cache.SharedIndexInformer{\n\t\t\tsharedInformerFactory.Catalogsource().V1alpha1().CatalogSources().Informer(),\n\t\t},\n\t\top.syncCatalogSources,\n\t\tnil,\n\t)\n\tfor _, informer := range catsrcQueueInformer {\n\t\top.RegisterQueueInformer(informer)\n\t}\n\n\t// Register InstallPlan informers.\n\tipQueue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), \"installplans\")\n\tipQueueInformers := queueinformer.New(\n\t\tipQueue,\n\t\tipSharedIndexInformers,\n\t\top.syncInstallPlans,\n\t\tnil,\n\t)\n\tfor _, informer := range ipQueueInformers {\n\t\top.RegisterQueueInformer(informer)\n\t}\n\n\t// Register Subscription informers.\n\tsubscriptionQueue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), \"subscriptions\")\n\tsubscriptionQueueInformers := queueinformer.New(\n\t\tsubscriptionQueue,\n\t\tsubSharedIndexInformers,\n\t\top.syncSubscriptions,\n\t\tnil,\n\t)\n\tfor _, informer := range subscriptionQueueInformers {\n\t\top.RegisterQueueInformer(informer)\n\t}\n\n\treturn op, nil\n}", "title": "" }, { "docid": "58e2a09739a97bcdfdf126f931ab6d90", "score": "0.53555185", "text": "func RunOperator(ctx context.Context, controllerContext *controllercmd.ControllerContext) error {\n\tkubeClient, err := kubernetes.NewForConfig(controllerContext.ProtoKubeConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconfigClient, err := configclient.NewForConfig(controllerContext.KubeConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tauthOperatorClient, err := operatorclient.NewForConfig(controllerContext.KubeConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tkubeInformersForNamespaces := v1helpers.NewKubeInformersForNamespaces(\n\t\tkubeClient,\n\t\t\"default\",\n\t\t\"openshift-authentication\",\n\t\t\"openshift-config\",\n\t\t\"openshift-config-managed\",\n\t\t\"openshift-oauth-apiserver\",\n\t\t\"openshift-authentication-operator\",\n\t\t\"\", // an informer for non-namespaced resources\n\t\t\"kube-system\",\n\t\tlibgoetcd.EtcdEndpointNamespace,\n\t)\n\n\t// short resync period as this drives the check frequency when checking the .well-known endpoint. 20 min is too slow for that.\n\toperatorConfigInformers := operatorinformer.NewSharedInformerFactory(authOperatorClient, time.Second*30)\n\n\toperatorClient := &OperatorClient{\n\t\toperatorConfigInformers,\n\t\tauthOperatorClient.OperatorV1(),\n\t}\n\n\tresourceSyncer := resourcesynccontroller.NewResourceSyncController(\n\t\toperatorClient,\n\t\tkubeInformersForNamespaces,\n\t\tv1helpers.CachedSecretGetter(kubeClient.CoreV1(), kubeInformersForNamespaces),\n\t\tv1helpers.CachedConfigMapGetter(kubeClient.CoreV1(), kubeInformersForNamespaces),\n\t\tcontrollerContext.EventRecorder,\n\t)\n\n\tversionRecorder := status.NewVersionGetter()\n\tclusterOperator, err := configClient.ConfigV1().ClusterOperators().Get(ctx, \"authentication\", metav1.GetOptions{})\n\tif err != nil && !errors.IsNotFound(err) {\n\t\treturn err\n\t}\n\t// perform version changes to the version getter prior to tying it up in the status controller\n\t// via change-notification channel so that it only updates operator version in status once\n\t// either of the workloads synces\n\tfor _, version := range clusterOperator.Status.Versions {\n\t\tversionRecorder.SetVersion(version.Name, version.Version)\n\t}\n\tversionRecorder.SetVersion(\"operator\", os.Getenv(\"OPERATOR_IMAGE_VERSION\"))\n\n\toperatorCtx := &operatorContext{}\n\toperatorCtx.versionRecorder = versionRecorder\n\toperatorCtx.kubeClient = kubeClient\n\toperatorCtx.configClient = configClient\n\toperatorCtx.kubeInformersForNamespaces = kubeInformersForNamespaces\n\toperatorCtx.resourceSyncController = resourceSyncer\n\toperatorCtx.operatorClient = operatorClient\n\toperatorCtx.operatorInformer = operatorConfigInformers\n\toperatorCtx.operatorConfigInformer = configinformer.NewSharedInformerFactoryWithOptions(configClient, resync)\n\n\tif err := prepareOauthOperator(ctx, controllerContext, operatorCtx); err != nil {\n\t\treturn err\n\t}\n\n\tif err := prepareOauthAPIServerOperator(ctx, controllerContext, operatorCtx); err != nil {\n\t\treturn err\n\t}\n\n\tconfigOverridesController := unsupportedconfigoverridescontroller.NewUnsupportedConfigOverridesController(operatorCtx.operatorClient, controllerContext.EventRecorder)\n\tlogLevelController := loglevel.NewClusterOperatorLoggingController(operatorCtx.operatorClient, controllerContext.EventRecorder)\n\n\toperatorCtx.informersToRunFunc = append(operatorCtx.informersToRunFunc,\n\t\tkubeInformersForNamespaces.Start,\n\t\toperatorConfigInformers.Start,\n\t\toperatorCtx.operatorConfigInformer.Start,\n\t)\n\toperatorCtx.controllersToRunFunc = append(operatorCtx.controllersToRunFunc, resourceSyncer.Run, configOverridesController.Run, logLevelController.Run)\n\n\tfor _, informerToRunFn := range operatorCtx.informersToRunFunc {\n\t\tinformerToRunFn(ctx.Done())\n\t}\n\tfor _, controllerRunFn := range operatorCtx.controllersToRunFunc {\n\t\tgo controllerRunFn(ctx, 1)\n\t}\n\n\t<-ctx.Done()\n\treturn nil\n}", "title": "" }, { "docid": "897927670ecd4ae071bb2991b1f7119c", "score": "0.5301578", "text": "func TestOperatorInit(t *testing.T) {\n\tgoldenFilepath := filepath.Join(operatorRootDir, \"cmd/mesh/testdata/operator/output/operator-init.yaml\")\n\trootArgs := &RootArgs{}\n\toiArgs := &operatorInitArgs{\n\t\tcommon: operatorCommonArgs{\n\t\t\thub: \"foo.io/istio\",\n\t\t\ttag: \"1.2.3\",\n\t\t\toperatorNamespace: \"operator-test-namespace\",\n\t\t\twatchedNamespaces: \"istio-test-namespace1,istio-test-namespace2\",\n\t\t\tmanifestsPath: string(snapshotCharts),\n\t\t},\n\t}\n\n\tl := clog.NewConsoleLogger(os.Stdout, os.Stderr, installerScope)\n\t_, gotYAML, err := renderOperatorManifest(rootArgs, &oiArgs.common)\n\tif err != nil {\n\t\tl.LogAndFatal(err)\n\t}\n\n\tif refreshGoldenFiles() {\n\t\tt.Logf(\"Refreshing golden file for %s\", goldenFilepath)\n\t\tif err := os.WriteFile(goldenFilepath, []byte(gotYAML), 0o644); err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}\n\n\twantYAML, err := readFile(goldenFilepath)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif diff := util.YAMLDiff(wantYAML, gotYAML); diff != \"\" {\n\t\tt.Fatalf(\"diff: %s\", diff)\n\t}\n}", "title": "" }, { "docid": "8a7e6aba720e14bdc2606e5adce6556c", "score": "0.5259227", "text": "func (k TestKubernetes) RunOperator(namespace, crdsPath string) context.CancelFunc {\n\tk.installCRD(crdsPath + \"infinispan.org_infinispans.yaml\")\n\tk.installCRD(crdsPath + \"infinispan.org_caches.yaml\")\n\tk.installCRD(crdsPath + \"infinispan.org_backups.yaml\")\n\tk.installCRD(crdsPath + \"infinispan.org_restores.yaml\")\n\tk.installCRD(crdsPath + \"infinispan.org_batches.yaml\")\n\tctx, cancel := context.WithCancel(context.Background())\n\tgo runOperatorLocally(ctx, namespace)\n\treturn cancel\n}", "title": "" }, { "docid": "125300ada31d5907c66b5a12c342c575", "score": "0.51462865", "text": "func (s *BaseTealListener) EnterOperatorComparison(ctx *OperatorComparisonContext) {}", "title": "" }, { "docid": "977ebee6a455f26988360e7ec5421243", "score": "0.5071456", "text": "func TestApp_MultipleOperators(t *testing.T) {\n\tdoneChan := setDoneListener()\n\tdefer func() {\n\t\tdone = func() {}\n\t}()\n\n\tvehicleID := uuid.NewV4().String()\n\n\tsessionCookie, err := newSessionCookie(vehicleID)\n\trequire.NoError(t, err)\n\tsessionHeader := http.Header{}\n\tsessionHeader.Add(\"Cookie\", sessionCookie.String())\n\tvehicleConn, err := dialWS(wsServer.URL, fmt.Sprintf(\"/api/v1/ws/vehicle/%s/register\", vehicleID), sessionHeader)\n\trequire.NoError(t, err)\n\tdefer vehicleConn.Close()\n\t<-doneChan\n\n\tcameraID := \"front\"\n\toperatorConn1, err := dialWS(wsServer.URL, fmt.Sprintf(\"/api/v1/ws/vehicle/%s/camera/%s/subscribe\", sessionCookie.Value, cameraID), authHeader)\n\trequire.NoError(t, err)\n\tdefer operatorConn1.Close()\n\t<-doneChan\n\n\toperatorConn2, err := dialWS(wsServer.URL, fmt.Sprintf(\"/api/v1/ws/vehicle/%s/camera/%s/subscribe\", sessionCookie.Value, cameraID), authHeader)\n\trequire.NoError(t, err)\n\tdefer operatorConn2.Close()\n\t<-doneChan\n\n\torig := makeFrame(\"orig\", cameraID)\n\n\terr = SendProto(vehicleConn, orig)\n\trequire.NoError(t, err)\n\t<-doneChan\n\t<-doneChan\n\t<-doneChan\n\n\tsample := new(teleop.CameraSample)\n\terr = RecvJSON(operatorConn1, sample)\n\trequire.NoError(t, err)\n\tassert.Contains(t, string(sample.Image.Content), \"orig\")\n\n\terr = RecvJSON(operatorConn2, sample)\n\trequire.NoError(t, err)\n\tassert.Contains(t, string(sample.Image.Content), \"orig\")\n}", "title": "" }, { "docid": "7c372be49b9fefe27f19ca13cfa0d793", "score": "0.50576234", "text": "func TestSourceStore(t *testing.T) {\n\tc, err := NewTestClient()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer c.Close()\n\n\ts := c.SourcesStore\n\n\tsrcs := []chronograf.Source{\n\t\tchronograf.Source{\n\t\t\tName: \"Of Truth\",\n\t\t\tType: \"influx\",\n\t\t\tUsername: \"marty\",\n\t\t\tPassword: \"I❤️ jennifer parker\",\n\t\t\tURL: \"toyota-hilux.lyon-estates.local\",\n\t\t\tDefault: true,\n\t\t\tOrganization: \"1337\",\n\t\t\tDefaultRP: \"pineapple\",\n\t\t},\n\t\tchronograf.Source{\n\t\t\tName: \"HipToBeSquare\",\n\t\t\tType: \"influx\",\n\t\t\tUsername: \"calvinklein\",\n\t\t\tPassword: \"chuck b3rry\",\n\t\t\tURL: \"toyota-hilux.lyon-estates.local\",\n\t\t\tDefault: true,\n\t\t\tOrganization: \"1337\",\n\t\t},\n\t\tchronograf.Source{\n\t\t\tName: \"HipToBeSquare\",\n\t\t\tType: \"influx\",\n\t\t\tUsername: \"calvinklein\",\n\t\t\tPassword: \"chuck b3rry\",\n\t\t\tURL: \"https://toyota-hilux.lyon-estates.local\",\n\t\t\tInsecureSkipVerify: true,\n\t\t\tDefault: false,\n\t\t\tOrganization: \"1337\",\n\t\t},\n\t}\n\n\tctx := context.Background()\n\t// Add new srcs.\n\tfor i, src := range srcs {\n\t\tif srcs[i], err = s.Add(ctx, src); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\t// Confirm first src in the store is the same as the original.\n\t\tif actual, err := s.Get(ctx, srcs[i].ID); err != nil {\n\t\t\tt.Fatal(err)\n\t\t} else if !reflect.DeepEqual(actual, srcs[i]) {\n\t\t\tt.Fatalf(\"source loaded is different then source saved; actual: %v, expected %v\", actual, srcs[i])\n\t\t}\n\t}\n\n\t// Update source.\n\tsrcs[0].Username = \"calvinklein\"\n\tsrcs[1].Name = \"Enchantment Under the Sea Dance\"\n\tsrcs[2].DefaultRP = \"cubeapple\"\n\tmustUpdateSource(t, s, srcs[0])\n\tmustUpdateSource(t, s, srcs[1])\n\tmustUpdateSource(t, s, srcs[2])\n\n\t// Confirm sources have updated.\n\tif src, err := s.Get(ctx, srcs[0].ID); err != nil {\n\t\tt.Fatal(err)\n\t} else if src.Username != \"calvinklein\" {\n\t\tt.Fatalf(\"source 0 update error: got %v, expected %v\", src.Username, \"calvinklein\")\n\t}\n\tif src, err := s.Get(ctx, srcs[1].ID); err != nil {\n\t\tt.Fatal(err)\n\t} else if src.Name != \"Enchantment Under the Sea Dance\" {\n\t\tt.Fatalf(\"source 1 update error: got %v, expected %v\", src.Name, \"Enchantment Under the Sea Dance\")\n\t}\n\tif src, err := s.Get(ctx, srcs[2].ID); err != nil {\n\t\tt.Fatal(err)\n\t} else if src.DefaultRP != \"cubeapple\" {\n\t\tt.Fatalf(\"source 2 update error: got %v, expected %v\", src.DefaultRP, \"cubeapple\")\n\t}\n\n\t// Attempt to make two default sources\n\tsrcs[0].Default = true\n\tsrcs[1].Default = true\n\tmustUpdateSource(t, s, srcs[0])\n\tmustUpdateSource(t, s, srcs[1])\n\n\tif actual, err := s.Get(ctx, srcs[0].ID); err != nil {\n\t\tt.Fatal(err)\n\t} else if actual.Default {\n\t\tt.Fatal(\"Able to set two default sources when only one should be permitted\")\n\t}\n\n\t// Attempt to add a new default source\n\tsrcs = append(srcs, chronograf.Source{\n\t\tName: \"Biff Tannen\",\n\t\tType: \"influx\",\n\t\tUsername: \"HELLO\",\n\t\tPassword: \"MCFLY\",\n\t\tURL: \"anybody.in.there.local\",\n\t\tDefault: true,\n\t\tOrganization: \"1892\",\n\t})\n\n\tsrcs[3] = mustAddSource(t, s, srcs[3])\n\tif srcs, err := s.All(ctx); err != nil {\n\t\tt.Fatal(err)\n\t} else {\n\t\tdefaults := 0\n\t\tfor _, src := range srcs {\n\t\t\tif src.Default {\n\t\t\t\tdefaults++\n\t\t\t}\n\t\t}\n\n\t\tif defaults != 1 {\n\t\t\tt.Fatal(\"Able to add more than one default source\")\n\t\t}\n\t}\n\n\t// Delete an source.\n\tif err := s.Delete(ctx, srcs[0]); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Confirm source has been deleted.\n\tif _, err := s.Get(ctx, srcs[0].ID); err != chronograf.ErrSourceNotFound {\n\t\tt.Fatalf(\"source delete error: got %v, expected %v\", err, chronograf.ErrSourceNotFound)\n\t}\n\n\t// Delete the other source we created\n\tif err := s.Delete(ctx, srcs[3]); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif bsrcs, err := s.All(ctx); err != nil {\n\t\tt.Fatal(err)\n\t} else if len(bsrcs) != 3 {\n\t\tt.Fatalf(\"After delete All returned incorrect number of srcs; got %d, expected %d\", len(bsrcs), 3)\n\t} else if !reflect.DeepEqual(bsrcs[0], srcs[1]) {\n\t\tt.Fatalf(\"After delete All returned incorrect source; got %v, expected %v\", bsrcs[0], srcs[1])\n\t}\n\n\t// Delete the final sources\n\tif err := s.Delete(ctx, srcs[1]); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := s.Delete(ctx, srcs[2]); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := s.Delete(ctx, *bolt.DefaultSource); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Try to add one source as a non-default and ensure that it becomes a\n\t// default\n\tsrc := mustAddSource(t, s, chronograf.Source{\n\t\tName: \"Biff Tannen\",\n\t\tType: \"influx\",\n\t\tUsername: \"HELLO\",\n\t\tPassword: \"MCFLY\",\n\t\tURL: \"anybody.in.there.local\",\n\t\tDefault: false,\n\t\tOrganization: \"1234\",\n\t})\n\n\tif actual, err := s.Get(ctx, src.ID); err != nil {\n\t\tt.Fatal(err)\n\t} else if !actual.Default {\n\t\tt.Fatal(\"Expected first source added to be default but wasn't\")\n\t}\n}", "title": "" }, { "docid": "c67c4486af645621b92d1e46d233ab01", "score": "0.49525857", "text": "func SourceStatusTestHelperWithComponentsTestRunner(\n\tt *testing.T,\n\tcomponentsTestRunner testlib.ComponentsTestRunner,\n\toptions ...testlib.SetupClientOption,\n) {\n\ttable := []struct {\n\t\tname string\n\t\tfeature testlib.Feature\n\t\t// Sources report success via either a Ready condition or a Succeeded condition\n\t\twant apis.ConditionType\n\t}{\n\t\t{\n\t\t\tname: \"Long living sources have Ready status condition\",\n\t\t\tfeature: testlib.FeatureLongLiving,\n\t\t\twant: apis.ConditionReady,\n\t\t},\n\t\t{\n\t\t\tname: \"Batch sources have Succeeded status condition\",\n\t\t\tfeature: testlib.FeatureBatch,\n\t\t\twant: apis.ConditionSucceeded,\n\t\t},\n\t}\n\n\tfor _, tc := range table {\n\t\tn := tc.name\n\t\tf := tc.feature\n\t\tw := tc.want\n\t\tt.Run(n, func(t *testing.T) {\n\t\t\tcomponentsTestRunner.RunTestsWithComponentOptions(t, f, true,\n\t\t\t\tfunc(st *testing.T, source metav1.TypeMeta,\n\t\t\t\t\tcomponentOptions ...testlib.SetupClientOption) {\n\t\t\t\t\tst.Log(\"About to setup client\")\n\t\t\t\t\toptions = append(options, componentOptions...)\n\t\t\t\t\tclient := testlib.Setup(st, true, options...)\n\t\t\t\t\tdefer testlib.TearDown(client)\n\t\t\t\t\tvalidateSourceStatus(st, client, source, w)\n\t\t\t\t})\n\t\t})\n\t}\n}", "title": "" }, { "docid": "5f8b27c4c55f86487517b73fb25e7dc8", "score": "0.49478123", "text": "func (e *Environment) StartOperator() error {\n\tmgr, err := e.setupOperator()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te.StartManager(mgr)\n\treturn nil\n}", "title": "" }, { "docid": "6eb4d7e4ab42a89300e12ca9f7ef781b", "score": "0.4858848", "text": "func TestOperators(t *testing.T) {\n\thm := host.New(1 << 40)\n\tgm := guest.New(1<<40, hm)\n\tproc := process.New(gm)\n\t{\n\t\tproc.Id = \"0\"\n\t\tproc.Lim.Size = 10 << 32\n\t\tproc.Lim.BatchRows = 10 << 32\n\t\tproc.Lim.PartitionRows = 10 << 32\n\t\tproc.Refer = make(map[string]uint64)\n\t}\n\te, err := testutil.NewTestEngine()\n\trequire.NoError(t, err)\n\n\tsrv, err := testutil.NewTestServer(e, proc)\n\trequire.NoError(t, err)\n\tgo srv.Run()\n\tdefer srv.Stop()\n\n\ttype testCase struct {\n\t\tid\tint\n\t\tsql string\n\t\texpectedError error\n\t}\n\n\ttestCases := []testCase{\n\t\t{0, \"create database testoperators;\", nil},\n\t\t{1, \"create table iis (i1 tinyint, i2 smallint, i3 int, i4 bigint);\", nil},\n\t\t{2, \"create table ffs (f1 float, f2 double);\", nil},\n\t\t{3, \"create table uus (u1 tinyint unsigned, u2 smallint unsigned, u3 int unsigned, u4 bigint unsigned);\", nil},\n\t\t{4, \"insert into iis values (1, 11, 111, 1111);\", nil},\n\t\t{5, \"insert into ffs values (22.2, 222.222);\", nil},\n\t\t{6, \"insert into uus values (3, 33, 333, 3333);\", nil},\n\t\t// operator between same types.\n\t\t// test int\n\t\t{7, \"select i1 + i1, i1 - i1, i1 / i1, i1 * i1, i2 + i2, i2 - i2, i2 / i2, i2 * i2 from iis;\", nil},\n\t\t{8, \"select i3 + i3, i3 - i3, i3 / i3, i3 * i3, i4 + i4, i4 - i4, i4 / i4, i4 * i4 from iis;\", nil},\n\t\t{9, \"select -i1, -i2, -i3, -i4 from iis;\", nil},\n\t\t{10, \"select * from iis where i1 = i1 and i2 = i2 and i3 = i3 and i4 = i4;\", nil},\n\t\t{11, \"select CAST(i1 AS FLOAT(1)) ci1f1, CAST(i1 AS DOUBLE) ci1f2, CAST(i1 AS CHAR(2)) ci1c2 from iis;\", nil},\n\t\t// test float\n\t\t{12, \"select f1 + f1, f1 - f1, f1 * f1, f1 / f1 from ffs;\", nil},\n\t\t{13, \"select f2 + f2, f2 - f2, f2 * f2, f2 / f2 from ffs;\", nil},\n\t\t{14, \"select -f1, -f2 from ffs;\", nil},\n\t\t{15, \"select * from ffs where f1 = f1 or f2 = f2;\", nil},\n\t\t{16, \"select * from ffs where f1 > f1 and f2 <= f2;\", nil},\n\t\t// test uint\n\t\t{17, \"select u1 + u1, u1 - u1, u1 * u1, u1 % u1, u1 / u1 from uus;\", nil},\n\t\t{18, \"select u2 + u2, u2 - u2, u2 * u2, u2 % u2, u2 / u2 from uus;\", nil},\n\t\t{19, \"select u3 + u3, u3 - u3, u3 * u3, u3 % u3, u3 / u3 from uus;\", nil},\n\t\t{20, \"select u4 - u4, u4 + u4, u4 / u4, u4 * u4, u4 % u4 from uus;\", nil},\n\t\t// test char, varchar // TODO: should add limit for char while cast ?\n\t\t{21, \"create table ccs (c1 char(10), c2 varchar(20));\", nil},\n\t\t{22, \"select cast(c2 AS char) cc2c1 from ccs;\", nil},\n\t}\n\n\tfor i, tc := range testCases {\n\t\tsql := tc.sql\n\t\texpected := tc.expectedError\n\n\t\tc := compile.New(\"testoperators\", sql, \"admin\", e, proc)\n\t\tes, err := c.Build()\n\t\trequire.NoError(t, err)\n\t\tprintln(i)\n\t\tfor _, e := range es {\n\t\t\terr := e.Compile(nil, Print)\n\t\t\tif expected == nil {\n\t\t\t\trequire.NoError(t, err)\n\t\t\t} else {\n\t\t\t\trequire.EqualError(t, err, expected.Error())\n\t\t\t\tbreak\n\t\t\t}\n\t\t\terr = e.Run(1)\n\t\t\tif expected == nil {\n\t\t\t\trequire.NoError(t, err)\n\t\t\t} else {\n\t\t\t\trequire.EqualError(t, err, expected.Error())\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "be979a86587558519c160489a192bef4", "score": "0.48456797", "text": "func newSDKOperatorGroup(namespace string, opts ...func(*operatorsv1.OperatorGroup)) *operatorsv1.OperatorGroup {\n\tog := &operatorsv1.OperatorGroup{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: operatorsv1.SchemeGroupVersion.String(),\n\t\t\tKind: operatorsv1.OperatorGroupKind,\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: sdkOperatorGroupName,\n\t\t\tNamespace: namespace,\n\t\t},\n\t}\n\tfor _, opt := range opts {\n\t\topt(og)\n\t}\n\treturn og\n}", "title": "" }, { "docid": "53423a9004265cfc62835ca9adcfa6b8", "score": "0.4841412", "text": "func TestRenter(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\n\t// Create a group for the subtests\n\tgroupParams := siatest.GroupParams{\n\t\tHosts: 5,\n\t\tRenters: 1,\n\t\tMiners: 1,\n\t}\n\ttg, err := siatest.NewGroupFromTemplate(groupParams)\n\tif err != nil {\n\t\tt.Fatal(\"Failed to create group: \", err)\n\t}\n\tdefer func() {\n\t\tif err := tg.Close(); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\n\t// Specify subtests to run\n\tsubTests := []struct {\n\t\tname string\n\t\ttest func(*testing.T, *siatest.TestGroup)\n\t}{\n\t\t{\"UploadDownload\", testUploadDownload},\n\t}\n\t// Run subtests\n\tfor _, subtest := range subTests {\n\t\tt.Run(subtest.name, func(t *testing.T) {\n\t\t\tsubtest.test(t, tg)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "c822e953853fc73b76db961f5a936bd7", "score": "0.48350003", "text": "func TestXorshift_SourceInterface(t *testing.T) {\n\tvar _ rand.Source = (*xorshiftSource)(nil)\n}", "title": "" }, { "docid": "e253ce6258be167bd725c9a947843791", "score": "0.48192295", "text": "func SourceTest(appTestName string, sourceType string, source string) {\n\t// checking for source-type in dc\n\tgetDc := runCmd(\"oc get dc wildfly-\" + appTestName + \" -o go-template='{{index .metadata.annotations \\\"app.kubernetes.io/component-source-type\\\"}}'\")\n\tExpect(getDc).To(ContainSubstring(sourceType))\n\n\t// checking for source in dc\n\tgetDc = runCmd(\"oc get dc wildfly-\" + appTestName + \" -o go-template='{{index .metadata.annotations \\\"app.kubernetes.io/url\\\"}}'\")\n\tExpect(getDc).To(ContainSubstring(source))\n}", "title": "" }, { "docid": "56f36dd3cc8044076d2529adea8654cf", "score": "0.48122567", "text": "func TestManagedUpgradeOperator(t *testing.T) {\n\tRegisterFailHandler(Fail)\n\n\tsuiteConfig, reporterConfig := GinkgoConfiguration()\n\treporterConfig.JUnitReport = filepath.Join(testResultsDirectory, jUnitOutputFilename)\n\tRunSpecs(t, \"Managed Upgrade Operator\", suiteConfig, reporterConfig)\n\n}", "title": "" }, { "docid": "1f5bf3fa8237032bd69e5bf2c79d497e", "score": "0.47871506", "text": "func StartOperator(\n\tmgr manager.Manager, namespace string, requeueAfter time.Duration,\n\tdiscoveryCtrl *discovery.Controller, kubeconfigPath string) {\n\tconfig, err := crdclient.NewKubeconfig(kubeconfigPath, &discoveryv1alpha1.GroupVersion, nil)\n\tif err != nil {\n\t\tklog.Error(err, \"unable to get kube config\")\n\t\tos.Exit(1)\n\t}\n\tdiscoveryClient, err := crdclient.NewFromConfig(config)\n\tif err != nil {\n\t\tklog.Error(err, \"unable to create crd client\")\n\t\tos.Exit(1)\n\t}\n\tlocalclusterID, err := clusterid.NewClusterID(kubeconfigPath)\n\tif err != nil {\n\t\tklog.Error(err, \"unable to get clusterid\")\n\t\tos.Exit(1)\n\t}\n\n\tadvClient, err := advtypes.CreateAdvertisementClient(kubeconfigPath, nil, true, nil)\n\tif err != nil {\n\t\tklog.Error(err, \"unable to create local client for Advertisement\")\n\t\tos.Exit(1)\n\t}\n\n\tnetworkClient, err := nettypes.CreateTunnelEndpointClient(kubeconfigPath)\n\tif err != nil {\n\t\tklog.Error(err, \"unable to create local client for Networking\")\n\t\tos.Exit(1)\n\t}\n\n\tif err = (getFCReconciler(\n\t\tmgr.GetScheme(),\n\t\tnamespace,\n\t\tdiscoveryClient,\n\t\tadvClient,\n\t\tnetworkClient,\n\t\tlocalclusterID,\n\t\trequeueAfter,\n\t\tdiscoveryCtrl,\n\t)).SetupWithManager(mgr); err != nil {\n\t\tklog.Error(err, \"unable to create controller\", \"controller\", \"ForeignCluster\")\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "d3b60be178da394a2a144a9e547e3f63", "score": "0.47500014", "text": "func (t *Framework) Setup() error {\n\tif e := t.createTestNamespace(); e != nil {\n\t\treturn e\n\t}\n\treturn t.setupOperator()\n}", "title": "" }, { "docid": "29d556753ee8e2fdb88f1d94ee0ef056", "score": "0.4747566", "text": "func SourceCRDRBACTestHelperWithComponentsTestRunner(\n\tt *testing.T,\n\tsourceTestRunner testlib.ComponentsTestRunner,\n\toptions ...testlib.SetupClientOption,\n) {\n\n\tsourceTestRunner.RunTests(t, testlib.FeatureBasic, func(st *testing.T, source metav1.TypeMeta) {\n\t\tclient := testlib.Setup(st, true, options...)\n\t\tdefer testlib.TearDown(client)\n\n\t\t// From spec:\n\t\t// Each source MUST have the following:\n\t\t// kind: ClusterRole\n\t\t// apiVersion: rbac.authorization.k8s.io/v1\n\t\t// metadata:\n\t\t// name: foos-source-observer\n\t\t// labels:\n\t\t// duck.knative.dev/source: \"true\"\n\t\t// rules:\n\t\t// - apiGroups:\n\t\t// - example.com\n\t\t// resources:\n\t\t// - foos\n\t\t// verbs:\n\t\t// - get\n\t\t// - list\n\t\t// - watch\n\t\tst.Run(\"Source CRD has source observer cluster role\", func(t *testing.T) {\n\t\t\tValidateRBAC(st, client, source)\n\t\t})\n\n\t})\n}", "title": "" }, { "docid": "2f3f737b43c7e59e35ed51b5c048f137", "score": "0.4744126", "text": "func TestInteropt(t *testing.T) {\n\tif os.Getenv(\"TEST_WORKSPACE\") != \"io_kythe\" {\n\t\t// Skip test since it requires the C++ oracle program to be put inside this\n\t\t// test's Bazel RUNFILES_DIR.\n\t\tt.Skip(\"Skipping test outside of Bazel build\")\n\t}\n\ttests := []*cpb.MarkedSource{{\n\t\tKind: cpb.MarkedSource_IDENTIFIER,\n\t\tPreText: \"hello\",\n\t\tPostText: \" world\",\n\t}, {\n\t\tKind: cpb.MarkedSource_BOX,\n\t\tChild: []*cpb.MarkedSource{{\n\t\t\tKind: cpb.MarkedSource_IDENTIFIER,\n\t\t\tPreText: \"ident\",\n\t\t}},\n\t}, {\n\t\tKind: cpb.MarkedSource_PARAMETER,\n\t\tChild: []*cpb.MarkedSource{{\n\t\t\tKind: cpb.MarkedSource_IDENTIFIER,\n\t\t\tPreText: \"parameter\",\n\t\t}},\n\t}, {\n\t\tKind: cpb.MarkedSource_BOX,\n\t\tChild: []*cpb.MarkedSource{{\n\t\t\tKind: cpb.MarkedSource_CONTEXT,\n\t\t\tPreText: \"context\",\n\t\t\tPostText: \".\",\n\t\t\tChild: []*cpb.MarkedSource{{\n\t\t\t\tKind: cpb.MarkedSource_IDENTIFIER,\n\t\t\t\tPreText: \"funcName\",\n\t\t\t}},\n\t\t}, {\n\t\t\tKind: cpb.MarkedSource_PARAMETER,\n\t\t\tChild: []*cpb.MarkedSource{{\n\t\t\t\tKind: cpb.MarkedSource_IDENTIFIER,\n\t\t\t\tPreText: \"paramA\",\n\t\t\t}, {\n\t\t\t\tKind: cpb.MarkedSource_IDENTIFIER,\n\t\t\t\tPreText: \"paramB\",\n\t\t\t}},\n\t\t}},\n\t}, {\n\t\tKind: cpb.MarkedSource_BOX,\n\t\tChild: []*cpb.MarkedSource{{\n\t\t\tKind: cpb.MarkedSource_TYPE,\n\t\t\tChild: []*cpb.MarkedSource{{\n\t\t\t\tKind: cpb.MarkedSource_IDENTIFIER,\n\t\t\t\tPreText: \"int \",\n\t\t\t}},\n\t\t}, {\n\t\t\tKind: cpb.MarkedSource_CONTEXT,\n\t\t\tPostChildText: \".\",\n\t\t\tAddFinalListToken: true,\n\t\t\tChild: []*cpb.MarkedSource{{\n\t\t\t\tKind: cpb.MarkedSource_IDENTIFIER,\n\t\t\t\tPreText: \"pkg\",\n\t\t\t}, {\n\t\t\t\tKind: cpb.MarkedSource_IDENTIFIER,\n\t\t\t\tPreText: \"Files\",\n\t\t\t}},\n\t\t}, {\n\t\t\tKind: cpb.MarkedSource_IDENTIFIER,\n\t\t\tPreText: \"CONSTANT\",\n\t\t}},\n\t}, {\n\t\tKind: cpb.MarkedSource_PARAMETER,\n\t\tChild: []*cpb.MarkedSource{{\n\t\t\tKind: cpb.MarkedSource_TYPE,\n\t\t\tPreText: \"*pkg.receiver\",\n\t\t}, {\n\t\t\tKind: cpb.MarkedSource_BOX,\n\t\t\tPostChildText: \" \",\n\t\t\tChild: []*cpb.MarkedSource{{\n\t\t\t\tKind: cpb.MarkedSource_BOX,\n\t\t\t\tChild: []*cpb.MarkedSource{{\n\t\t\t\t\tKind: cpb.MarkedSource_CONTEXT,\n\t\t\t\t\tPreText: \"pkg\",\n\t\t\t\t}, {\n\t\t\t\t\tKind: cpb.MarkedSource_IDENTIFIER,\n\t\t\t\t\tPreText: \"param\",\n\t\t\t\t}},\n\t\t\t}, {\n\t\t\t\tKind: cpb.MarkedSource_TYPE,\n\t\t\t\tPreText: \"string\",\n\t\t\t}},\n\t\t}},\n\t}}\n\n\tfor i, test := range tests {\n\t\tt.Run(strconv.Itoa(i), func(t *testing.T) {\n\t\t\toracle := runOracle(t, test)\n\t\t\tif ident := RenderSimpleIdentifier(test, PlaintextContent, nil); oracle.SimpleIdentifier != ident {\n\t\t\t\tt.Errorf(\"RenderSimpleIdentifier({%+v}): expected: %q; found %q\", test, oracle.SimpleIdentifier, ident)\n\t\t\t}\n\t\t\tparams := RenderSimpleParams(test, PlaintextContent, nil)\n\t\t\tif len(params) != len(oracle.SimpleParams) {\n\t\t\t\tt.Errorf(\"RenderSimpleParams({%+v}); expected: %#v; found: %#v\", test, oracle.SimpleParams, params)\n\t\t\t} else {\n\t\t\t\tfor i, expected := range oracle.SimpleParams {\n\t\t\t\t\tif expected != params[i] {\n\t\t\t\t\t\tt.Errorf(\"RenderSimpleParams({%+v})[%d]; expected: %#v; found: %#v\", test, i, expected, params[i])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "1b988b327b3bcaa1956f7095397288a1", "score": "0.4730013", "text": "func TestImageLayers(t *testing.T) {\n\ttmpDir, err := ioutil.TempDir(\"\", \"image-registry-test-integration-\")\n\tif err != nil {\n\t\tt.Fatalf(\"failed to create temporary directory: %s\", err)\n\t}\n\tdefer os.RemoveAll(tmpDir)\n\n\tconfigDir := path.Join(tmpDir, \"config\")\n\tadminKubeConfigPath := path.Join(configDir, \"master\", \"admin.kubeconfig\")\n\n\tmasterContainer, err := testframework.StartMasterContainer(configDir)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer func() {\n\t\tif err := masterContainer.Stop(); err != nil {\n\t\t\tt.Log(err)\n\t\t}\n\t}()\n\n\tclusterAdminClientConfig, err := testframework.ConfigFromFile(adminKubeConfigPath)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tnamespace := \"image-registry-test-integration\"\n\timageStreamName := \"test-imagelayers\"\n\tuser := \"testuser\"\n\tpassword := \"testp@ssw0rd\"\n\n\tif err := testframework.CreateProject(clusterAdminClientConfig, namespace, user); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttoken, err := tokencmd.RequestToken(clusterAdminClientConfig, nil, user, password)\n\tif err != nil {\n\t\tt.Fatalf(\"error requesting token: %v\", err)\n\t}\n\n\tregistryAddr, err := testframework.StartTestRegistry(t, adminKubeConfigPath)\n\tif err != nil {\n\t\tt.Fatalf(\"start registry: %v\", err)\n\t}\n\n\tcreds := registrytest.NewBasicCredentialStore(user, token)\n\n\tbaseURL := \"http://\" + registryAddr\n\trepoName := fmt.Sprintf(\"%s/%s\", namespace, imageStreamName)\n\n\tschema1Tag := \"schema1\"\n\tschema2Tag := \"schema2\"\n\n\ttransport, err := registrytest.NewTransport(baseURL, repoName, creds)\n\tif err != nil {\n\t\tt.Fatalf(\"get transport: %v\", err)\n\t}\n\n\tctx := context.Background()\n\n\trepo, err := registrytest.NewRepository(ctx, repoName, baseURL, transport)\n\tif err != nil {\n\t\tt.Fatalf(\"get repository: %v\", err)\n\t}\n\n\tif err := uploadImageWithSchema2Manifest(ctx, repo, schema2Tag); err != nil {\n\t\tt.Fatalf(\"upload image with schema 2 manifest: %v\", err)\n\t}\n\n\t// get the schema2 image's manifest downconverted to a schema 1 manifest\n\tschema1Manifest, err := getSchema1Manifest(transport, baseURL, repoName, schema2Tag)\n\tif err != nil {\n\t\tt.Fatalf(\"get schema 1 manifest for image schema2: %v\", err)\n\t}\n\n\tif err := registrytest.UploadManifest(ctx, repo, schema1Tag, schema1Manifest); err != nil {\n\t\tt.Fatalf(\"upload schema 1 manifest: %v\", err)\n\t}\n\n\timageClient := imagev1.NewForConfigOrDie(clusterAdminClientConfig)\n\n\tschema1ISTag, err := imageClient.ImageStreamTags(namespace).Get(imageStreamName+\":\"+schema1Tag, metav1.GetOptions{})\n\tif err != nil {\n\t\tt.Fatalf(\"get image stream tag %s:%s: %v\", imageStreamName, schema1Tag, err)\n\t}\n\n\tschema2ISTag, err := imageClient.ImageStreamTags(namespace).Get(imageStreamName+\":\"+schema2Tag, metav1.GetOptions{})\n\tif err != nil {\n\t\tt.Fatalf(\"get image stream tag %s:%s: %v\", imageStreamName, schema1Tag, err)\n\t}\n\n\tif schema1ISTag.Image.DockerImageManifestMediaType == schema2ISTag.Image.DockerImageManifestMediaType {\n\t\tt.Errorf(\"expected different media types, but got %q\", schema1ISTag.Image.DockerImageManifestMediaType)\n\t}\n\n\timage1LayerOrder := schema1ISTag.Image.Annotations[imageapi.DockerImageLayersOrderAnnotation]\n\timage2LayerOrder := schema2ISTag.Image.Annotations[imageapi.DockerImageLayersOrderAnnotation]\n\tif image1LayerOrder != image2LayerOrder {\n\t\tt.Errorf(\"the layer order annotations are different: schema1=%q, schema2=%q\", image1LayerOrder, image2LayerOrder)\n\t} else if image1LayerOrder == \"\" {\n\t\tt.Errorf(\"the layer order annotation is empty or not present\")\n\t}\n\n\timage1Layers := schema1ISTag.Image.DockerImageLayers\n\timage2Layers := schema2ISTag.Image.DockerImageLayers\n\tif len(image1Layers) != len(image2Layers) {\n\t\tt.Errorf(\"layers are different: schema1=%#+v, schema2=%#+v\", image1Layers, image2Layers)\n\t} else {\n\t\tfor i := range image1Layers {\n\t\t\tif image1Layers[i].Name != image2Layers[i].Name {\n\t\t\t\tt.Errorf(\"different names for the layer #%d: schema1=%#+v, schema2=%#+v\", i, image1Layers[i], image2Layers[i])\n\t\t\t}\n\t\t\tif image1Layers[i].LayerSize != image2Layers[i].LayerSize {\n\t\t\t\tt.Errorf(\"different sizes for the layer #%d: schema1=%#+v, schema2=%#+v\", i, image1Layers[i], image2Layers[i])\n\t\t\t} else if image1Layers[i].LayerSize <= 0 {\n\t\t\t\tt.Errorf(\"unexpected size for the layer #%d: %d\", i, image1Layers[i].LayerSize)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c5abb41dfd05aff3dd18038538d474eb", "score": "0.47122148", "text": "func TestAllCases(t *testing.T) {\n\tfor _, tc := range testCases {\n\t\th := &fakeHandler{\n\t\t\t//handler: tc.sink,\n\t\t\thandler: sinkAccepted, // No tests expect the sink to do anything interesting\n\t\t}\n\t\tsinkServer := httptest.NewServer(h)\n\t\tdefer sinkServer.Close()\n\n\t\tra, err := New(sinkServer.URL, testOwnerRepo)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tt.Run(tc.name, tc.runner(t, *ra))\n\t}\n}", "title": "" }, { "docid": "b80be42a472823e5c63844ea48c9b2d1", "score": "0.4704417", "text": "func (node *SourceNode) addSource(source string, operator SourceOperatorInfo) bool {\n\tif node == nil {\n\t\tfmt.Println(source)\n\t\treturn false\n\t}\n\tcompare := strings.Compare(node.sourceName, source)\n\tif compare == -1 {\n\t\tif node.leftSource == nil {\n\t\t\tnode.leftSource = &SourceNode{\n\t\t\t\tsourceName: source,\n\t\t\t\toperatorTreeRoot: &OperatorNode{\n\t\t\t\t\tsourceOperatorInfo: operator,\n\t\t\t\t},\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\treturn node.leftSource.addSource(source, operator)\n\t} else if compare == 1 {\n\t\tif node.rightSource == nil {\n\t\t\tnode.rightSource = &SourceNode{\n\t\t\t\tsourceName: source,\n\t\t\t\toperatorTreeRoot: &OperatorNode{\n\t\t\t\t\tsourceOperatorInfo: operator,\n\t\t\t\t},\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\treturn node.rightSource.addSource(source, operator)\n\t} else {\n\t\treturn node.operatorTreeRoot.addOperator(operator)\n\t}\n}", "title": "" }, { "docid": "868c3c6e2e3209de57391abc4e2946f5", "score": "0.4696519", "text": "func TestCachesAuthorizedOperators(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, remotePeerAddress := newPeer(t, localChain)\n\n\tlocalChain.AuthorizeOperator(remotePeerAddress)\n\n\tpolicy.Validate(key.NetworkKeyToECDSAKey(remotePeerPublicKey))\n\n\tif !policy.authorizedOperatorsCache.Has(remotePeerID.String()) {\n\t\tt.Errorf(\"should cache operator with no authorization\")\n\t}\n\tif policy.nonAuthorizedOperatorsCache.Has(remotePeerID.String()) {\n\t\tt.Errorf(\"should not cache operator with no authorization\")\n\t}\n}", "title": "" }, { "docid": "3ecc8b7f9c71f05f38ce2b052a86c92d", "score": "0.46601534", "text": "func SuiteFromString(c *oscar.Context, name, source string) (oscar.Suite, error) {\n\tif len(name) == 0 {\n\t\treturn nil, errors.New(\"empty suite name\")\n\t}\n\n\t// Building Lua state\n\tL := lua.NewState()\n\n\t// Building test suite\n\ts := &testSuite{\n\t\tid: id(),\n\t\tname: name,\n\t\tstate: L,\n\t}\n\n\tregistered := map[string]int{}\n\n\tctx := c.Fork(s.id)\n\tctx.Register(func(emitted *events.Emitted) {\n\t\tif b, ok := emitted.Data.(events.RegistrationBegin); ok {\n\t\t\tregistered[b.Name] = b.ID\n\t\t}\n\t})\n\t// Injecting module into Lua runtime\n\tinjectModule(s, ctx, L)\n\n\t// Emitting registration start event\n\tctx.Emit(events.RegistrationBegin{Type: \"TestSuite\", ID: s.id, Name: s.name})\n\n\t// Loading Lua sources\n\tif err := L.DoString(source); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Resolving dependencies\n\tfor _, tc := range s.cases {\n\t\tif len(tc.deps) > 0 {\n\t\t\tfor _, dep := range tc.deps {\n\t\t\t\tf, ok := registered[dep]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, errors.New(\"unable to find dependency \" + dep + \" for \" + tc.name)\n\t\t\t\t}\n\t\t\t\ttc.dep = append(tc.dep, f)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Emitting registration done event\n\tctx.Emit(events.RegistrationEnd{Type: \"TestSuite\", Name: s.name})\n\n\treturn s, nil\n}", "title": "" }, { "docid": "2340c6d2d454e67a482a33db612e074c", "score": "0.464116", "text": "func WebServerSourcesBasicTest(t *testing.T, imageStreamName string, gitURL string, testURI string) {\n\ttestContext, framework := webServerTestSetup(t)\n\n\twebServer := makeSourcesWebServer(namespace, name, imageStreamName, namespace, gitURL, 1)\n\n\twebServerBasicTest(t, framework, testContext, webServer, testURI)\n\n\ttestContext.Cleanup()\n}", "title": "" }, { "docid": "5dcd3eccf1b446b99f6202d7760a5a33", "score": "0.46066543", "text": "func (suite *TestBuilderSuite) SetupSuite() {\n\tdao.PrepareTestForPostgresSQL()\n\tsuite.all = []*selector.Candidate{\n\t\t{\n\t\t\tNamespaceID: 1,\n\t\t\tNamespace: \"library\",\n\t\t\tRepository: \"harbor\",\n\t\t\tKind: \"image\",\n\t\t\tTags: []string{\"latest\"},\n\t\t\tDigest: \"latest\",\n\t\t\tPushedTime: time.Now().Unix(),\n\t\t\tLabels: []string{\"L1\", \"L2\"},\n\t\t},\n\t\t{\n\t\t\tNamespaceID: 1,\n\t\t\tNamespace: \"library\",\n\t\t\tRepository: \"harbor\",\n\t\t\tKind: \"image\",\n\t\t\tTags: []string{\"dev\"},\n\t\t\tDigest: \"dev\",\n\t\t\tPushedTime: time.Now().Unix(),\n\t\t\tLabels: []string{\"L3\"},\n\t\t},\n\t}\n\n\tindex2.Register(index2.AlgorithmOR, or.New)\n\tindex.Register(doublestar.Kind, []string{\n\t\tdoublestar.Matches,\n\t\tdoublestar.Excludes,\n\t\tdoublestar.RepoMatches,\n\t\tdoublestar.RepoExcludes,\n\t\tdoublestar.NSMatches,\n\t\tdoublestar.NSExcludes,\n\t}, doublestar.New)\n\tindex.Register(label.Kind, []string{label.With, label.Without}, label.New)\n\tindex3.Register(action.Retain, action.NewRetainAction)\n\n\tsuite.oldClient = dep.DefaultClient\n\tdep.DefaultClient = &fakeRetentionClient{}\n}", "title": "" }, { "docid": "7b5734417f89b029bbe2e1374c87fd6d", "score": "0.45896325", "text": "func getSourceExecutor(stg newPeg.SourceJob)pipeline.Executor{\n\tvar exec pipeline.Executor\n\tswitch stg.Type {\n\tcase newPeg.FILEJOB:\n\n\t\tparams := stg.OperateOn.(newPeg.SrcFile)\n\t\tfileName := params.FileName\n\t\tf, err := os.Open(fileName)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t\tlog.Printf(\"[INFO] %s file opened as source.\", fileName)\n\t\texec = sources.NewCsvReader(f, -1)\n\t\texec.SetName(\"file\")\n\n\tcase newPeg.FAKEJOB:\n\t\tparams := stg.OperateOn.(newPeg.SrcFake)\n\t\tnumData := params.Number\n\t\tlog.Printf(\"[INFO] Generating %d fake data\", numData)\n\t\texec = canalSrc.NewFaker(numData, nil)\n\t\texec.SetName(\"fake\")\n\n\tcase newPeg.LIFTREADER:\n\t\tparams := stg.OperateOn.(newPeg.LiftReader)\n\t\tfullIp :=params.Ip\n\t\tsplittedIp := strings.Split(fullIp,\":\")\n\t\tip:= splittedIp[0]+\":\"\n\t\tport,_ := strconv.Atoi(splittedIp[1])\n\t\tstreamName := params.StreamName\n\t\t//streamSubject := params.StreamSubject\n\t\texec = canalSrc.NewLiftBridgeReader(streamName,canalSrc.RECENT,time.Now(),int64(1),ip,port)\n\t\texec.SetName(\"LiftBridgeReader\")\n\t}\n\treturn exec\n}", "title": "" }, { "docid": "6dddab73afccacb9d406aa289fc3304e", "score": "0.4589594", "text": "func TestFileSystemSourceProvider_GetSources(t *testing.T) { //nolint\n\ttype fields struct {\n\t\tpath string\n\t\texcludes map[string][]os.FileInfo\n\t}\n\ttype args struct {\n\t\tctx context.Context\n\t\tqueryName string\n\t\textensions model.Extensions\n\t\tsink Sink\n\t\tresolverSink ResolverSink\n\t}\n\ttests := []struct {\n\t\tname string\n\t\tfields fields\n\t\targs args\n\t\twantErr bool\n\t}{\n\t\t{\n\t\t\tname: \"get_sources\",\n\t\t\tfields: fields{\n\t\t\t\tpath: \"../../../assets/queries\",\n\t\t\t\texcludes: map[string][]os.FileInfo{},\n\t\t\t},\n\t\t\targs: args{\n\t\t\t\tctx: nil,\n\t\t\t\textensions: model.Extensions{\n\t\t\t\t\t\".dockerfile\": dockerParser.Parser{},\n\t\t\t\t},\n\t\t\t\tsink: mockSink,\n\t\t\t\tresolverSink: mockErrResolverSink,\n\t\t\t},\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"error_sink\",\n\t\t\tfields: fields{\n\t\t\t\tpath: \"../../../assets/queries\",\n\t\t\t\texcludes: map[string][]os.FileInfo{},\n\t\t\t},\n\t\t\targs: args{\n\t\t\t\tctx: nil,\n\t\t\t\textensions: model.Extensions{\n\t\t\t\t\t\".dockerfile\": dockerParser.Parser{},\n\t\t\t\t},\n\t\t\t\tsink: mockErrSink,\n\t\t\t\tresolverSink: mockErrResolverSink,\n\t\t\t},\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"get_sources_file\",\n\t\t\tfields: fields{\n\t\t\t\tpath: \"../../../assets/queries/dockerfile/add_instead_of_copy/test/positive.dockerfile\",\n\t\t\t\texcludes: map[string][]os.FileInfo{},\n\t\t\t},\n\t\t\targs: args{\n\t\t\t\tctx: nil,\n\t\t\t\textensions: model.Extensions{\n\t\t\t\t\t\".dockerfile\": dockerParser.Parser{},\n\t\t\t\t},\n\t\t\t\tsink: mockSink,\n\t\t\t\tresolverSink: mockResolverSink,\n\t\t\t},\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"error_not_suported_extension\",\n\t\t\tfields: fields{\n\t\t\t\tpath: \"../../../assets/queries/template/test/positive.tf\",\n\t\t\t\texcludes: map[string][]os.FileInfo{},\n\t\t\t},\n\t\t\targs: args{\n\t\t\t\tctx: nil,\n\t\t\t\textensions: model.Extensions{\n\t\t\t\t\t\".dockerfile\": dockerParser.Parser{},\n\t\t\t\t},\n\t\t\t\tsink: mockSink,\n\t\t\t\tresolverSink: mockResolverSink,\n\t\t\t},\n\t\t\twantErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"new_filesystem_source_provider_error\",\n\t\t\tfields: fields{\n\t\t\t\tpath: \"./no-path\",\n\t\t\t\texcludes: map[string][]os.FileInfo{},\n\t\t\t},\n\t\t\targs: args{\n\t\t\t\tctx: nil,\n\t\t\t\tqueryName: \"alb_protocol_is_http\",\n\t\t\t\textensions: nil,\n\t\t\t\tsink: mockSink,\n\t\t\t\tresolverSink: mockResolverSink,\n\t\t\t},\n\t\t\twantErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"err_resolver_sink\",\n\t\t\tfields: fields{\n\t\t\t\tpath: \"../../assets/queries/template/test/positive.tf\",\n\t\t\t\texcludes: map[string][]os.FileInfo{},\n\t\t\t},\n\t\t\targs: args{\n\t\t\t\tctx: nil,\n\t\t\t\tqueryName: \"template\",\n\t\t\t\textensions: model.Extensions{\n\t\t\t\t\t\".dockerfile\": dockerParser.Parser{},\n\t\t\t\t},\n\t\t\t\tsink: mockSink,\n\t\t\t\tresolverSink: mockErrResolverSink,\n\t\t\t},\n\t\t\twantErr: true,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ts := &FileSystemSourceProvider{\n\t\t\t\tpath: tt.fields.path,\n\t\t\t\texcludes: tt.fields.excludes,\n\t\t\t}\n\t\t\tif err := s.GetSources(tt.args.ctx, tt.args.extensions, tt.args.sink, tt.args.resolverSink); (err != nil) != tt.wantErr {\n\t\t\t\tt.Errorf(\"FileSystemSourceProvider.GetSources() error = %v, wantErr %v\", err, tt.wantErr)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "522af985a3ede9a5d16f070e37170d44", "score": "0.45868257", "text": "func New(options ...Option) *Operator {\n\top := &Operator{\n\t\tupdates: make(chan Resource),\n\t\tretries: make(chan string),\n\t\tstop: make(chan struct{}),\n\t\tretrySchedules: make(map[string]retrySchedule),\n\t}\n\tfor _, option := range options {\n\t\toption(op)\n\t}\n\tif op.resource.Resource == \"\" {\n\t\tpanic(\"skop: no resource configured\")\n\t}\n\tif op.config == nil {\n\t\tpanic(\"skop: no config configured\")\n\t}\n\tif op.reconciler == nil {\n\t\tpanic(\"skop: no reconciler configured\")\n\t}\n\tif op.logger == nil {\n\t\top.logger = log.NewLogfmtLogger(log.StdlibWriter{})\n\t}\n\treturn op\n}", "title": "" }, { "docid": "abb018ef4240c8e0d1dc117bcbb6f833", "score": "0.45785487", "text": "func (s *OshinkoUnitTestSuite) SetUpSuite(c *check.C) {}", "title": "" }, { "docid": "bfd4d8fef4e52d6ff815b6f405e67262", "score": "0.4575905", "text": "func (t *Test) StopOperator() {\n\tif t.operatorRunning {\n\t\tstopOperator(t.harness.Options, t.harness.Sinks, t.envs)\n\t\tt.operatorRunning = false\n\t}\n}", "title": "" }, { "docid": "dbef25ded4c8fb0fa684d5d663741950", "score": "0.45601618", "text": "func TestOperatorRecreatesItsClusterOperator(t *testing.T) {\n\tcl, err := getClient()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tco := &configv1.ClusterOperator{}\n\tif err := cl.Get(context.TODO(), opName, co); err != nil {\n\t\tt.Fatalf(\"failed to get clusteroperator %q: %v\", opName.Name, err)\n\t}\n\tif err := cl.Delete(context.TODO(), co); err != nil {\n\t\tt.Fatalf(\"failed to delete clusteroperator %q: %v\", opName.Name, err)\n\t}\n\terr = wait.PollImmediate(1*time.Second, 30*time.Second, func() (bool, error) {\n\t\tif err := cl.Get(context.TODO(), opName, co); err != nil {\n\t\t\tt.Logf(\"failed to get clusteroperator %q: %v\", opName.Name, err)\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"failed to observe recreation of clusteroperator %q: %v\", opName.Name, err)\n\t}\n}", "title": "" }, { "docid": "cc43581c3c6250fe452bc49ffb58bf21", "score": "0.4522617", "text": "func apperatorAppTest(t *testing.T, namespace string, f *framework.Framework, ctx *framework.TestCtx) {\n\tvar name = \"app\"\n\tvar replicas int32 = 1\n\tvar matchLabels = map[string]string{\"app\": \"apperator\"}\n\tvar err error\n\n\tt.Log(\"Starting Operator Tests...\")\n\n\tdeploymentSpecObj := appsv1.DeploymentSpec{\n\t\tReplicas: &replicas,\n\t\tSelector: &metav1.LabelSelector{\n\t\t\tMatchLabels: matchLabels,\n\t\t},\n\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tLabels: matchLabels,\n\t\t\t},\n\t\t\tSpec: corev1.PodSpec{\n\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\tcorev1.Container{\n\t\t\t\t\t\tName: name,\n\t\t\t\t\t\tImage: \"busybox:latest\",\n\t\t\t\t\t\tArgs: []string{\"sleep\", \"60\"},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tapperatorAppObj := &v1alpha1.ApperatorApp{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"ApperatorApp\",\n\t\t\tAPIVersion: \"apperator.otaviof.github.io/v1alpha1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tSpec: v1alpha1.ApperatorAppSpec{\n\t\t\tDeployment: v1alpha1.ApperatorAppDeploymentSpec{\n\t\t\t\tSpec: deploymentSpecObj,\n\t\t\t},\n\t\t\tEnvs: []string{},\n\t\t\tInitContainers: []string{},\n\t\t\tProbes: []string{},\n\t\t\tSidecars: []string{},\n\t\t\tVault: []string{},\n\t\t},\n\t}\n\n\tt.Logf(\"Creating apperator object '%s' (namespace: '%s')\", name, namespace)\n\t// creating apperator object\n\terr = f.Client.Create(context.TODO(), apperatorAppObj, &framework.CleanupOptions{\n\t\tTestContext: ctx,\n\t\tRetryInterval: retryInterval,\n\t\tTimeout: timeout,\n\t})\n\t// should not return errors when creating the apperator object\n\tassert.Nil(t, err)\n\n\tt.Log(\"Waiting for deployment produced from ApperatorApp...\")\n\t// waiting for deployment to reach one replica\n\terr = e2eutil.WaitForDeployment(t, f.KubeClient, namespace, name, 1, retryInterval, timeout)\n\t// should not have errors on waiting for deployment, the deployment must be successful\n\tassert.Nil(t, err)\n\n\t// retrieving deployment object\n\tdeployment := &appsv1.Deployment{}\n\tmeta := types.NamespacedName{Name: name, Namespace: namespace}\n\terr = f.Client.Get(context.TODO(), meta, deployment)\n\tassert.Nil(t, err)\n\n\t// checking if original values have been kept in deployment\n\tassert.Equal(t, corev1.DNSPolicy(\"ClusterFirst\"), deployment.Spec.Template.Spec.DNSPolicy)\n}", "title": "" }, { "docid": "a004a62949ba1d1210c39c7ec0c579c5", "score": "0.4514739", "text": "func getTestGroupState() loader.StateReader {\n\tsp := loader.NewState()\n\tprevss := loader.NewSampleSet()\n\n\tcursamp := loader.NewSample()\n\tsp.GetCurrentWriter().SetSample(`status`, cursamp)\n\n\tprevsamp := loader.NewSample()\n\tprevss.SetSample(`status`, prevsamp)\n\tsp.SetPrevious(prevss)\n\n\tcursamp.Data[`connections`] = `15`\n\tprevsamp.Data[`connections`] = `10`\n\n\tcursamp.Data[`threads_connect`] = `4`\n\tprevsamp.Data[`threads_connect`] = `3`\n\n\treturn sp\n}", "title": "" }, { "docid": "8dae74ff5bad936ddfd3c68780dbea53", "score": "0.44989133", "text": "func (s *BaseActionListener) EnterComparisonOperator(ctx *ComparisonOperatorContext) {}", "title": "" }, { "docid": "a7f2db37ad1c1aa25fdc50c67bdda375", "score": "0.4488465", "text": "func RunTests(t *testing.T, poolCtor PoolCtor, teardown func()) {\n\tfor _, tf := range []func(*testing.T, PoolCtor){TestGetChannel} {\n\t\ttf(t, poolCtor)\n\t\tteardown()\n\t}\n}", "title": "" }, { "docid": "cbfb79917d1c0ff55b19381193568d7d", "score": "0.44727686", "text": "func (c *Compiler) CompileTests() error {\n\tdir, err := os.Getwd()\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\n\tname := harness.GetProjectName()\n\n\te2eBinary := name + \"-e2e\"\n\te2eDir := filepath.Join(dir, \"integration\")\n\tc.logger.Log(\"info\", \"Compiling binary \"+e2eBinary)\n\tif err := c.compileTests(e2eBinary, e2eDir); err != nil {\n\t\tc.logger.Log(\"info\", \"error compiling binary \"+e2eBinary)\n\t\treturn microerror.Mask(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "83ffb59c521d38d98f69a252ad755222", "score": "0.4471385", "text": "func CLITestSuite(\n\tctx context.Context, tswg *sync.WaitGroup, testSuites chan *junitxml.TestSuite,\n\tlogger *log.Logger, testSuiteRegex, testCaseRegex *regexp.Regexp,\n\ttestProjectConfig *testconfig.Project) {\n\n\ttestTypes := []e2e.CLITestType{\n\t\te2e.Wrapper,\n\t\te2e.GcloudBetaProdWrapperLatest,\n\t\te2e.GcloudBetaLatestWrapperLatest,\n\t\te2e.GcloudGaLatestWrapperRelease,\n\t}\n\n\ttestsMap := map[e2e.CLITestType]map[*junitxml.TestCase]func(\n\t\tcontext.Context, *junitxml.TestCase, *log.Logger, *testconfig.Project, e2e.CLITestType){}\n\n\tfor _, testType := range testTypes {\n\t\timageImportDataDiskTestCase := junitxml.NewTestCase(\n\t\t\ttestSuiteName, fmt.Sprintf(\"[%v][CLI] %v\", testType, \"Import data disk\"))\n\t\timageImportOSTestCase := junitxml.NewTestCase(\n\t\t\ttestSuiteName, fmt.Sprintf(\"[%v][CLI] %v\", testType, \"Import OS\"))\n\t\timageImportOSFromImageTestCase := junitxml.NewTestCase(\n\t\t\ttestSuiteName, fmt.Sprintf(\"[%v][CLI] %v\", testType, \"Import OS from image\"))\n\t\timageImportWithRichParamsTestCase := junitxml.NewTestCase(\n\t\t\ttestSuiteName, fmt.Sprintf(\"[%v][CLI] %v\", testType, \"Import with rich params\"))\n\t\timageImportWithDifferentNetworkParamStylesTestCase := junitxml.NewTestCase(\n\t\t\ttestSuiteName, fmt.Sprintf(\"[%v][CLI] %v\", testType, \"Import with different network param styles\"))\n\t\timageImportWithSubnetWithoutNetworkSpecifiedTestCase := junitxml.NewTestCase(\n\t\t\ttestSuiteName, fmt.Sprintf(\"[%v][CLI] %v\", testType, \"Import with subnet but without network\"))\n\t\timageImportShadowDiskCleanedUpWhenMainInflaterFails := junitxml.NewTestCase(\n\t\t\ttestSuiteName, fmt.Sprintf(\"[%v][CLI] %v\", testType, \"Import shadow disk is cleaned up when main inflater fails\"))\n\n\t\ttestsMap[testType] = map[*junitxml.TestCase]func(\n\t\t\tcontext.Context, *junitxml.TestCase, *log.Logger, *testconfig.Project, e2e.CLITestType){}\n\t\ttestsMap[testType][imageImportDataDiskTestCase] = runImageImportDataDiskTest\n\t\ttestsMap[testType][imageImportOSTestCase] = runImageImportOSTest\n\t\ttestsMap[testType][imageImportOSFromImageTestCase] = runImageImportOSFromImageTest\n\t\ttestsMap[testType][imageImportWithRichParamsTestCase] = runImageImportWithRichParamsTest\n\t\ttestsMap[testType][imageImportWithDifferentNetworkParamStylesTestCase] = runImageImportWithDifferentNetworkParamStyles\n\t\ttestsMap[testType][imageImportWithSubnetWithoutNetworkSpecifiedTestCase] = runImageImportWithSubnetWithoutNetworkSpecified\n\t\ttestsMap[testType][imageImportShadowDiskCleanedUpWhenMainInflaterFails] = runImageImportShadowDiskCleanedUpWhenMainInflaterFails\n\t}\n\te2e.CLITestSuite(ctx, tswg, testSuites, logger, testSuiteRegex, testCaseRegex,\n\t\ttestProjectConfig, testSuiteName, testsMap)\n}", "title": "" }, { "docid": "d40e127f0bffa5d6095f2c7076313182", "score": "0.4469377", "text": "func (s *BaseprologListener) EnterOperator_(ctx *Operator_Context) {}", "title": "" }, { "docid": "df159c467aaa86d1c281e88c45d30ab8", "score": "0.44670638", "text": "func operateSourceFunc(cmd *cobra.Command, _ []string) error {\n\tprintSampleConfig, err := cmd.Flags().GetBool(\"print-sample-config\")\n\tif err != nil {\n\t\tcommon.PrintLinesf(\"error in parse `--print-sample-config`\")\n\t\treturn err\n\t}\n\n\tif printSampleConfig {\n\t\tfmt.Println(config.SampleConfigFile)\n\t\treturn nil\n\t}\n\n\tif len(cmd.Flags().Args()) < 1 {\n\t\tcmd.SetOut(os.Stdout)\n\t\tcommon.PrintCmdUsage(cmd)\n\t\treturn errors.New(\"please check output to see error\")\n\t}\n\n\tcmdType := cmd.Flags().Arg(0)\n\top := convertCmdType(cmdType)\n\tif op == pb.SourceOp_InvalidSourceOp {\n\t\tcommon.PrintLinesf(\"invalid operate '%s' on worker\", cmdType)\n\t\treturn errors.New(\"please check output to see error\")\n\t}\n\tif op != pb.SourceOp_ShowSource && len(cmd.Flags().Args()) == 1 {\n\t\tcommon.PrintLinesf(\"operate-source create/update/stop should specify config-file(s)\")\n\t\treturn errors.New(\"please check output to see error\")\n\t}\n\n\tcontents := make([]string, 0, len(cmd.Flags().Args())-1)\n\tsourceID := make([]string, 0, len(cmd.Flags().Args())-1)\n\tsources, err := common.GetSourceArgs(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsourceID = append(sourceID, sources...)\n\n\tfor i := 1; i < len(cmd.Flags().Args()); i++ {\n\t\targ := cmd.Flags().Arg(i)\n\t\tvar content []byte\n\t\tcontent, err = common.GetFileContent(arg)\n\t\tif err != nil {\n\t\t\tif op == pb.SourceOp_StopSource {\n\t\t\t\tsourceID = append(sourceID, arg)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\t// If source is configured with tls certificate related content\n\t\t// the contents of the certificate need to be read and transferred to the dm-master\n\t\tcfg, yamlErr := config.ParseYaml(string(content))\n\t\tif yamlErr != nil {\n\t\t\treturn yamlErr\n\t\t}\n\t\tif cfg.From.Security != nil {\n\t\t\tloadErr := cfg.From.Security.LoadTLSContent()\n\t\t\tif loadErr != nil {\n\t\t\t\tlog.L().Warn(\"load tls content failed\", zap.Error(terror.ErrCtlLoadTLSCfg.Generate(loadErr)))\n\t\t\t}\n\t\t\tyamlStr, yamlErr := cfg.Yaml()\n\t\t\tif yamlErr != nil {\n\t\t\t\treturn yamlErr\n\t\t\t}\n\t\t\tcontent = []byte(yamlStr)\n\t\t}\n\t\tcontents = append(contents, string(content))\n\t}\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\tresp := &pb.OperateSourceResponse{}\n\terr = common.SendRequest(\n\t\tctx,\n\t\t\"OperateSource\",\n\t\t&pb.OperateSourceRequest{\n\t\t\tConfig: contents,\n\t\t\tOp: op,\n\t\t\tSourceID: sourceID,\n\t\t},\n\t\t&resp,\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcommon.PrettyPrintResponse(resp)\n\treturn nil\n}", "title": "" }, { "docid": "51915753e4030cddb02b5b7b3c1aa39a", "score": "0.446661", "text": "func New(cfg *config.Config, clientset blended.Interface) *Operator {\n\tt := defaultSyncTime\n\tif cfg.SyncSec > 30 {\n\t\tt = time.Second * time.Duration(cfg.SyncSec)\n\t}\n\to := &Operator{cfg: cfg, clientset: clientset}\n\to.informer = blendedinformers.NewSharedInformerFactory(clientset, t)\n\to.pool = pool.NewController(clientset, o.informer.Inwinstack().V1().Pools())\n\to.ip = ip.NewController(clientset, o.informer.Inwinstack().V1().IPs())\n\treturn o\n}", "title": "" }, { "docid": "56db3c08b4bd2c9bdab98d767ad4b7bf", "score": "0.44544736", "text": "func RunTest(t *testing.T, apps []SourceCode, test KfAcceptanceTest) {\n\tt.Helper()\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tintegration.CancelOnSignal(ctx, cancel, t)\n\n\tif ShouldSkipAcceptance(t) {\n\t\treturn\n\t}\n\n\t// We fetch the source code early (before compiling or checking the\n\t// cluster) in case the operation is only to save a copy of the source\n\t// code to the cache.\n\tappSourceLocations := fetchApps(ctx, t, apps)\n\n\tctx = integration.ContextWithStackdriverOutput(ctx)\n\n\tkfPath := integration.CompileKf(ctx, t)\n\n\t// Ensure the cluster is healthy\n\tintegration.CheckCluster(ctx, integration.NewKf(t, kfPath))\n\n\tfor name, dir := range appSourceLocations {\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\t// We want a new kf for each one so that it uses the\n\t\t\t// correct 't'.\n\t\t\tkf := integration.NewKf(t, kfPath)\n\n\t\t\t// Create the space\n\t\t\tspaceName, _ := kf.CreateSpace(ctx)\n\n\t\t\tctx = integration.ContextWithSpace(ctx, spaceName)\n\t\t\tctx, cancel := context.WithCancel(ctx)\n\t\t\tdefer cancel()\n\n\t\t\t// Wait for space to become ready\n\t\t\ttestutil.AssertRetrySucceeds(ctx, t, -1, time.Second, func() error {\n\t\t\t\tfor _, s := range kf.Spaces(ctx) {\n\t\t\t\t\tif strings.HasPrefix(s, spaceName) &&\n\t\t\t\t\t\t// Ensure space is marked \"Ready True\"\n\t\t\t\t\t\tregexp.MustCompile(`\\sTrue\\s`).MatchString(s) {\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn fmt.Errorf(\"%s-> did not find space %s\", t.Name(), spaceName)\n\t\t\t})\n\t\t\ttest(ctx, t, kf, dir)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "c06bc9d98dde4c09d85f0df9a5ec8bd4", "score": "0.4453676", "text": "func init() {\n\t// Label the unary operators.\n\tfor op, overloads := range UnaryOps {\n\t\tif int(op) >= len(unaryOpName) || unaryOpName[op] == \"\" {\n\t\t\tpanic(fmt.Sprintf(\"missing name for operator %q\", op.String()))\n\t\t}\n\t\topName := unaryOpName[op]\n\t\tfor _, impl := range overloads {\n\t\t\to := impl.(*UnaryOp)\n\t\t\to.counter = sqltelemetry.UnaryOpCounter(opName, o.Typ.String())\n\t\t}\n\t}\n\n\t// Label the comparison operators.\n\tfor op, overloads := range CmpOps {\n\t\tif int(op) >= len(comparisonOpName) || comparisonOpName[op] == \"\" {\n\t\t\tpanic(fmt.Sprintf(\"missing name for operator %q\", op.String()))\n\t\t}\n\t\topName := comparisonOpName[op]\n\t\tfor _, impl := range overloads {\n\t\t\to := impl.(*CmpOp)\n\t\t\tlname := o.LeftType.String()\n\t\t\trname := o.RightType.String()\n\t\t\to.counter = sqltelemetry.CmpOpCounter(opName, lname, rname)\n\t\t}\n\t}\n\n\t// Label the binary operators.\n\tfor op, overloads := range BinOps {\n\t\tif int(op) >= len(binaryOpName) || binaryOpName[op] == \"\" {\n\t\t\tpanic(fmt.Sprintf(\"missing name for operator %q\", op.String()))\n\t\t}\n\t\topName := binaryOpName[op]\n\t\tfor _, impl := range overloads {\n\t\t\to := impl.(*BinOp)\n\t\t\tlname := o.LeftType.String()\n\t\t\trname := o.RightType.String()\n\t\t\to.counter = sqltelemetry.BinOpCounter(opName, lname, rname)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "95e7a1b393cd977cfbf5b499fffa912c", "score": "0.44510648", "text": "func (o *OperatorGetAllOperatorsParams) WithHTTPClient(client *http.Client) *OperatorGetAllOperatorsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "746f713567795e83947b3afa09f3a746", "score": "0.44378823", "text": "func (tc TestCase) Runner(v interface{}) func(*testing.T) {\n\treturn func(t *testing.T) {\n\t\tfor _, op := range tc.Ops {\n\t\t\tt.Logf(\"start %T\", op)\n\t\t\top.Do(t, v)\n\t\t\tt.Logf(\"done %T\", op)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6bf958cf8adf3d94773e94cdcc2ab025", "score": "0.44378716", "text": "func main() {\n\tvar err error\n\n\tnamespace := helper.GetTestNamespace()\n\tvalues := helper.OperatorValues{}\n\tmgr, err := fakes.NewFakeManager()\n\tpanicIfErr(err)\n\n\tchartDir, err := helper.FindOperatorHelmChartDir()\n\tpanicIfErr(err)\n\n\tvf := helper.GetTestManifestValuesFileName()\n\tif vf != \"\" {\n\t\terr = values.LoadFromYaml(vf)\n\t\tpanicIfErr(err)\n\t} else {\n\t\terr = values.LoadFromYaml(chartDir + string(os.PathSeparator) + \"values.yaml\")\n\t\tpanicIfErr(err)\n\t}\n\n\thelm, err := fakes.NewFakeHelm(mgr, nil, nil, namespace)\n\tpanicIfErr(err)\n\tresult, err := helm.FakeOperatorHelmInstall(mgr, namespace, values)\n\tpanicIfErr(err)\n\n\tfilterGlobal := func(o runtime.Object) bool {\n\t\tkind := o.GetObjectKind().GroupVersionKind().Kind\n\t\treturn kind == \"ClusterRole\" || kind == \"ClusterRoleBinding\"\n\t}\n\n\tfilterNamespaced := func(o runtime.Object) bool {\n\t\treturn !filterGlobal(o)\n\t}\n\n\tfilterLocal := func(o runtime.Object) bool {\n\t\tkind := o.GetObjectKind().GroupVersionKind().Kind\n\t\treturn kind != \"Deployment\" && filterNamespaced(o)\n\t}\n\n\tnamespacedName, err := helper.GetTestManifestFileName()\n\tpanicIfErr(err)\n\n\tlocalName, err := helper.GetTestLocalManifestFileName()\n\tpanicIfErr(err)\n\n\tglobalName, err := helper.GetTestGlobalManifestFileName()\n\tpanicIfErr(err)\n\n\tnamespacedFile, err := os.Create(namespacedName)\n\tpanicIfErr(err)\n\tdefer closeFile(namespacedFile)\n\n\tlocalFile, err := os.Create(localName)\n\tpanicIfErr(err)\n\tdefer closeFile(localFile)\n\n\tglobalFile, err := os.Create(globalName)\n\tpanicIfErr(err)\n\tdefer closeFile(globalFile)\n\n\terr = result.ToString(filterLocal, localFile)\n\tpanicIfErr(err)\n\n\terr = result.ToString(filterNamespaced, namespacedFile)\n\tpanicIfErr(err)\n\n\terr = result.ToString(filterGlobal, globalFile)\n\tpanicIfErr(err)\n\n\tcrds, err := helper.FindCrdDir()\n\tpanicIfErr(err)\n\tcrdFiles, err := ioutil.ReadDir(crds)\n\tpanicIfErr(err)\n\n\tfor _, file := range crdFiles {\n\t\tif strings.HasSuffix(file.Name(), \"_crd.yaml\") {\n\t\t\t_, err = globalFile.WriteString(\"\\n---\\n\")\n\t\t\tpanicIfErr(err)\n\t\t\tdata, err := ioutil.ReadFile(crds + string(os.PathSeparator) + file.Name())\n\t\t\tpanicIfErr(err)\n\t\t\t_, err = globalFile.Write(data)\n\t\t\tpanicIfErr(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6bf4b4961f46faea7530f7227e38167d", "score": "0.4425375", "text": "func (s *BaseTealListener) EnterOperatorBitwise(ctx *OperatorBitwiseContext) {}", "title": "" }, { "docid": "51b40ad70813a91f6058d3d319a44f5c", "score": "0.44210815", "text": "func runOperatorLocally(ctx context.Context, namespace string) {\n\t_ = os.Setenv(\"WATCH_NAMESPACE\", namespace)\n\t_ = os.Setenv(\"KUBECONFIG\", kube.FindKubeConfig())\n\t_ = os.Setenv(\"OSDK_FORCE_RUN_MODE\", \"local\")\n\t_ = os.Setenv(\"OPERATOR_NAME\", OperatorName)\n\tlauncher.Launch(launcher.Parameters{Ctx: ctx})\n}", "title": "" }, { "docid": "e307dd38849f0bc73c0e3e6347db15a0", "score": "0.44209275", "text": "func NewOperator(mgr ctrl.Manager, fs filesys.FileSystem, execStrategy executor.ExecutionStrategy) (*operatorv1.CompositeOperator, error) {\n\t// Create the operands.\n\tconfigmapOp := NewConfigmapOperand(\"configmap-operand\", mgr.GetClient(), []string{}, operand.RequeueOnError, fs)\n\n\t// Create and return CompositeOperator.\n\treturn operatorv1.NewCompositeOperator(\n\t\toperatorv1.WithEventRecorder(mgr.GetEventRecorderFor(\"game-controller\")),\n\t\toperatorv1.WithExecutionStrategy(execStrategy),\n\t\toperatorv1.WithOperands(configmapOp),\n\t)\n}", "title": "" }, { "docid": "017597622aa08cbfb1840d9d3e20b6fa", "score": "0.44202575", "text": "func InstallOperator(namespace, subscriptionName, channel string, catalog operatorCatalog) error {\n\tGetLogger(namespace).Infof(\"Subscribing to %s operator from source %s on channel %s\", subscriptionName, catalog.source, channel)\n\tif _, err := CreateOperatorGroupIfNotExists(namespace, namespace); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := CreateNamespacedSubscriptionIfNotExist(namespace, subscriptionName, subscriptionName, catalog, channel); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "686ceb5bb50b6ea2e374720fb7db5514", "score": "0.4414969", "text": "func (s *BaseSQLParserListener) EnterTarget_operator(ctx *Target_operatorContext) {}", "title": "" }, { "docid": "3c6e49b65cf1f06ee49eaeed3dbb25e4", "score": "0.44109136", "text": "func NewConsoleOperator(\n\t// informers\n\tconsoles consoleinformers.ConsoleInformer,\n\tcoreV1 corev1.Interface,\n\tdeployments appsinformersv1.DeploymentInformer,\n\troutes routesinformersv1.RouteInformer,\n\toauthClients oauthinformersv1.OAuthClientInformer,\n\t// clients\n\toperatorClient v1alpha1.ConsolesGetter,\n\tcorev1Client coreclientv1.CoreV1Interface,\n\tdeploymentClient appsv1.DeploymentsGetter,\n\troutev1Client routeclientv1.RoutesGetter,\n\toauthv1Client oauthclientv1.OAuthClientsGetter,\n\t// recorder\n\trecorder events.Recorder,\n) operator.Runner {\n\tc := &consoleOperator{\n\t\t// operator\n\t\toperatorClient: operatorClient.Consoles(api.TargetNamespace),\n\t\t// core kube\n\t\tsecretsClient: corev1Client,\n\t\tconfigMapClient: corev1Client,\n\t\tserviceClient: corev1Client,\n\t\tdeploymentClient: deploymentClient,\n\t\t// openshift\n\t\trouteClient: routev1Client,\n\t\toauthClient: oauthv1Client,\n\t\t// recorder\n\t\trecorder: recorder,\n\t}\n\n\tsecretsInformer := coreV1.Secrets()\n\tconfigMapInformer := coreV1.ConfigMaps()\n\tserviceInformer := coreV1.Services()\n\n\treturn operator.New(controllerName, c,\n\t\toperator.WithInformer(consoles, operator.FilterByNames(api.ResourceName)),\n\t\toperator.WithInformer(deployments, operator.FilterByNames(api.OpenShiftConsoleName)),\n\t\toperator.WithInformer(configMapInformer, operator.FilterByNames(configmap.ConsoleConfigMapName, configmap.ServiceCAConfigMapName)),\n\t\toperator.WithInformer(secretsInformer, operator.FilterByNames(deployment.ConsoleOauthConfigName)),\n\t\toperator.WithInformer(routes, operator.FilterByNames(api.OpenShiftConsoleShortName)),\n\t\toperator.WithInformer(serviceInformer, operator.FilterByNames(api.OpenShiftConsoleShortName)),\n\t\toperator.WithInformer(oauthClients, operator.FilterByNames(api.OAuthClientName)),\n\t)\n}", "title": "" }, { "docid": "f7cc3b97edf46989bfa9edda421a1e5f", "score": "0.44094142", "text": "func TestBasicXTest(t *testing.T) { testAllOrModulesParallel(t, testBasicXTest) }", "title": "" }, { "docid": "9028ce02153f39405f6507baa29c7473", "score": "0.44076934", "text": "func (s *BaseTealListener) EnterOperatorOr(ctx *OperatorOrContext) {}", "title": "" }, { "docid": "17e1d20efb28a7e3ef49dc9b30a09c21", "score": "0.4404052", "text": "func (i ToolImplementationTest) Run(tool Tool, sourceDir string) ([]Issue, error) {\n\tissue := testIssue()\n\treturn []Issue{issue}, nil\n}", "title": "" }, { "docid": "83360d778bb52391a36f157477e367b0", "score": "0.44015184", "text": "func TestMultipleTrafficTargets(t *testing.T) {\n\t// We setup traffic to be 60/40...\n\tfoobarA := buildTrafficTarget(\n\t\tshippertesting.TestApp, \"foobar-a\",\n\t\tmap[string]uint32{clusterA: 60},\n\t)\n\tfoobarB := buildTrafficTarget(\n\t\tshippertesting.TestApp, \"foobar-b\",\n\t\tmap[string]uint32{clusterA: 40},\n\t)\n\n\tclusterObjects := []runtime.Object{\n\t\tbuildService(shippertesting.TestApp),\n\t\tbuildEndpoints(shippertesting.TestApp),\n\t}\n\n\t// ... giving the same capacity to both releases in the cluster ...\n\tpodCount := 5\n\tclusterObjects = addPodsToList(clusterObjects,\n\t\tbuildPods(shippertesting.TestApp,\n\t\t\tfoobarA.Name, podCount, noTraffic))\n\n\tclusterObjects = addPodsToList(clusterObjects,\n\t\tbuildPods(shippertesting.TestApp,\n\t\t\tfoobarB.Name, podCount, noTraffic))\n\n\t// ... and we expect foobar-a to have 5 pods with traffic (even though\n\t// the spec says it should have 6: there's just not enough capacity),\n\t// while foobar-b has 4.\n\tpodsForFoobarA := podStatus{withTraffic: 5}\n\tpodsForFoobarB := podStatus{withTraffic: 4, withoutTraffic: 1}\n\n\t// Since it's impossible to actually achieve 60/40 in this scenario,\n\t// the status needs to reflect the actual achieved weight. It should\n\t// still be Ready, though, as we've applied the optimal weights under\n\t// the circumstances.\n\tfoobarAStatus := buildSuccessStatus(foobarA.Spec.Clusters)\n\tfoobarAStatus.Clusters[0].AchievedTraffic = 50\n\tfoobarBStatus := buildSuccessStatus(foobarB.Spec.Clusters)\n\tfoobarBStatus.Clusters[0].AchievedTraffic = 40\n\n\trunTrafficControllerTest(t,\n\t\tmap[string][]runtime.Object{clusterA: clusterObjects},\n\t\t[]trafficTargetTestExpectation{\n\t\t\t{\n\t\t\t\ttrafficTarget: foobarA,\n\t\t\t\tstatus: foobarAStatus,\n\t\t\t\tpodsByCluster: map[string]podStatus{\n\t\t\t\t\tclusterA: podsForFoobarA,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\ttrafficTarget: foobarB,\n\t\t\t\tstatus: foobarBStatus,\n\t\t\t\tpodsByCluster: map[string]podStatus{\n\t\t\t\t\tclusterA: podsForFoobarB,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n}", "title": "" }, { "docid": "2ec9d1a420b7512b54f1feee080977fd", "score": "0.4393217", "text": "func TestReconcile_NotConfigured_NewCatalogConfigSourceObjectCreated(t *testing.T) {\n\tcontroller := gomock.NewController(t)\n\tdefer controller.Finish()\n\n\tnextPhaseWant := &phase.NextPhase{\n\t\tPhase: v1alpha1.OperatorSourcePhaseSucceeded,\n\t\tMessage: v1alpha1.GetOperatorSourcePhaseMessage(v1alpha1.OperatorSourcePhaseSucceeded),\n\t}\n\n\tdatastore := mocks.NewDatastoreWriter(controller)\n\tkubeclient := mocks.NewKubeClient(controller)\n\n\treconciler := phase.NewConfiguringReconciler(helperGetContextLogger(), datastore, kubeclient)\n\n\tctx := context.TODO()\n\topsrcIn := helperNewOperatorSource(\"marketplace\", \"foo\", v1alpha1.OperatorSourcePhaseConfiguring)\n\n\t// We expect that the given CatalogConfigSource object does not exist.\n\tcscGet := helperNewCatalogSourceConfig(opsrcIn.Namespace, getExpectedCatalogSourceConfigName(opsrcIn.Name))\n\tkubeClientErr := k8s_errors.NewNotFound(schema.GroupResource{}, \"CatalogSourceConfig not found\")\n\tkubeclient.EXPECT().Get(cscGet).Return(kubeClientErr)\n\n\tpackages := \"a,b,c\"\n\tdatastore.EXPECT().GetPackageIDs().Return(packages)\n\n\ttrueVar := true\n\tcscWant := cscGet.DeepCopy()\n\tcscWant.ObjectMeta.OwnerReferences = []metav1.OwnerReference{\n\t\tmetav1.OwnerReference{\n\t\t\tAPIVersion: opsrcIn.APIVersion,\n\t\t\tKind: opsrcIn.Kind,\n\t\t\tName: opsrcIn.Name,\n\t\t\tUID: opsrcIn.UID,\n\t\t\tController: &trueVar,\n\t\t},\n\t}\n\tcscWant.Spec = v1alpha1.CatalogSourceConfigSpec{\n\t\tTargetNamespace: opsrcIn.Namespace,\n\t\tPackages: packages,\n\t}\n\tkubeclient.EXPECT().Create(cscWant).Return(nil)\n\n\topsrcGot, nextPhaseGot, errGot := reconciler.Reconcile(ctx, opsrcIn)\n\n\tassert.NoError(t, errGot)\n\tassert.Equal(t, opsrcIn, opsrcGot)\n\tassert.Equal(t, nextPhaseWant, nextPhaseGot)\n}", "title": "" }, { "docid": "13dffb8bbb1cc1d9357ce815b8e52e87", "score": "0.43917978", "text": "func TestAuditLogsSource(t *testing.T) {\n\tcancel := logstream.Start(t)\n\tdefer cancel()\n\tAuditLogsSourceWithTestImpl(t)\n}", "title": "" }, { "docid": "7d1a3a3e5c51334614b2ec15e5983349", "score": "0.43909356", "text": "func main() {\n\thostPtr := flag.String(\"host\", Host, \"Server host, the default is localhost.\")\n\tportPtr := flag.Int(\"port\", Port, \"Server port, the default is 45940.\")\n\trunCount := flag.Int(\"runCount\", suiteRunCount, \"The number of times to run each test, the default is 55, minimum is 6.\")\n\tmemProfile := flag.Bool(\"memProfile\", false, \"Enables memory profiling.\")\n\trunLevel := flag.String(\"runLevel\", \"smoke\", \"The test suite to run: smoke, full, or pooling, the default is smoke\")\n\n\tflag.Usage = func() {\n\t\tfmt.Fprintf(flag.CommandLine.Output(), usage)\n\t\tflag.PrintDefaults()\n\t}\n\n\tflag.Parse()\n\tfmt.Println(\"===== RUNNING PERFORMANCE TEST SUITE ON THE GRATEFUL GRAPH =====\")\n\tif *runLevel == \"pooling\" {\n\t\tfor _, size := range poolSize {\n\n\t\t\t// Create a graph traversal source object, after which we are ready to submit queries.\n\t\t\tg, drc, err := createConnection(*hostPtr, *portPtr, size, poolingBufferSize)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Error creating the connection - program terminating\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfmt.Printf(\"===== Running connection pooling test with %d pools =====\\n\", size)\n\t\t\tfor _, queryCount := range poolQueryCount {\n\t\t\t\trunPerformancePooling(\"poolingTraversal\", g, *runCount, queryCount, *memProfile)\n\t\t\t\tfmt.Printf(\"Connection pooling test completed running %d queries in %d pools with %d run.\\n\",\n\t\t\t\t\tqueryCount, size, *runCount)\n\t\t\t\tfmt.Println(\"================================================\")\n\t\t\t}\n\t\t\tdrc.Close()\n\t\t}\n\t} else {\n\t\t// Create a graph traversal source object, after which we are ready to submit queries.\n\t\tg, drc, err := createConnection(*hostPtr, *portPtr, 2, bufferSize)\n\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error creating the connection - program terminating\", err)\n\t\t\treturn\n\t\t}\n\n\t\trun(g, *runCount, *runLevel, *memProfile)\n\t\tfmt.Println(\"================================================\")\n\n\t\tdrc.Close()\n\t}\n}", "title": "" }, { "docid": "deb4608d28f9fe26cc6c0f1bdac9454b", "score": "0.4389188", "text": "func TestSelectStandaloneNetworkSharedMultiSource(t *testing.T) {\n\tassert := assert.New(t)\n\ttl := testutils.NewTestLogger(t)\n\tdefer tl.Flush()\n\tfc := &fake.Client{}\n\tclObj := &models.Cluster{\n\t\tClusterAllOf0: models.ClusterAllOf0{\n\t\t\tMeta: &models.ObjMeta{\n\t\t\t\tID: \"CLUSTER-1\",\n\t\t\t},\n\t\t},\n\t}\n\tla, err := layout.FindAlgorithm(layout.AlgorithmStandaloneNetworkedShared)\n\tassert.NoError(err)\n\tassert.NotNil(la)\n\targs := &ClusterStateArgs{\n\t\tLog: tl.Logger(),\n\t\tOCrud: fc,\n\t\tCluster: clObj,\n\t\tLayoutAlgorithms: []*layout.Algorithm{la},\n\t}\n\tcs := NewClusterState(args)\n\tctx := context.Background()\n\n\tpsb := int64(units.Gibibyte)\n\tasb := int64(500 * units.Gibibyte)\n\tcst := &models.CSPStorageType{\n\t\tName: \"Amazon gp2\",\n\t\tPreferredAllocationSizeBytes: swag.Int64(asb),\n\t\tParcelSizeBytes: swag.Int64(psb),\n\t}\n\tcs.pCache[\"SP-1\"] = cst // test with cached CST\n\n\tavailBytes1 := int64(20) * psb // 20 parcels\n\tsObj1 := &models.Storage{\n\t\tStorageAllOf0: models.StorageAllOf0{\n\t\t\tMeta: &models.ObjMeta{ID: \"STORAGE-1\", Version: 2},\n\t\t\tCspStorageType: \"Amazon gp2\",\n\t\t\tPoolID: \"SP-1\",\n\t\t\tSizeBytes: swag.Int64(asb),\n\t\t},\n\t\tStorageMutable: models.StorageMutable{\n\t\t\tAvailableBytes: swag.Int64(availBytes1),\n\t\t\tParcelSizeBytes: swag.Int64(psb),\n\t\t\tTotalParcelCount: swag.Int64(499),\n\t\t\tShareableStorage: true,\n\t\t\tStorageState: &models.StorageStateMutable{\n\t\t\t\tAttachedNodeID: \"NODE-1\",\n\t\t\t\tAttachedNodeDevice: \"/dev/xvdba\",\n\t\t\t\tDeviceState: \"OPEN\",\n\t\t\t\tMediaState: \"FORMATTED\",\n\t\t\t\tAttachmentState: \"ATTACHED\",\n\t\t\t},\n\t\t},\n\t}\n\tcs.Storage[\"STORAGE-1\"] = sObj1\n\tsObj2 := sClone(sObj1)\n\tsObj2.Meta.ID = models.ObjID(\"STORAGE-2\")\n\tsObj2.StorageState.AttachedNodeID = models.ObjIDMutable(\"NODE-2\")\n\tcs.Storage[\"STORAGE-2\"] = sObj2\n\n\tcdSR1 := &ClaimData{\n\t\tStorageRequest: &models.StorageRequest{\n\t\t\tStorageRequestAllOf0: models.StorageRequestAllOf0{\n\t\t\t\tMeta: &models.ObjMeta{ID: \"SR-1\", Version: 2},\n\t\t\t},\n\t\t},\n\t\tPoolID: \"SP-1\",\n\t\tNodeID: \"NODE-1\",\n\t\tRemainingBytes: availBytes1,\n\t\tVSRClaims: []VSRClaim{\n\t\t\t{RequestID: \"OTHER-VSR\", SizeBytes: asb - availBytes1, Annotation: \"OTHER-VSR-0\"},\n\t\t},\n\t}\n\tcs.StorageRequests[\"SR-1\"] = cdSR1\n\tcdSR2 := claimClone(cdSR1)\n\tcdSR2.StorageRequest.Meta.ID = \"SR-2\"\n\tcdSR2.NodeID = \"NODE-2\"\n\tcs.StorageRequests[\"SR-2\"] = cdSR2\n\n\tnObj1 := &models.Node{\n\t\tNodeAllOf0: models.NodeAllOf0{\n\t\t\tMeta: &models.ObjMeta{ID: \"NODE-1\", Version: 2},\n\t\t},\n\t\tNodeMutable: models.NodeMutable{\n\t\t\tName: \"Node1\",\n\t\t\tService: &models.NuvoService{\n\t\t\t\tServiceState: models.ServiceState{\n\t\t\t\t\tState: \"READY\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tcs.Nodes[\"NODE-1\"] = &NodeData{\n\t\tNode: nObj1,\n\t\tAttachedStorage: []string{\"STORAGE-1\"},\n\t}\n\tnObj2 := nodeClone(nObj1)\n\tnObj2.Meta.ID = models.ObjID(\"NODE-2\")\n\tnObj2.Name = \"Node2\"\n\tcs.Nodes[\"NODE-2\"] = &NodeData{\n\t\tNode: nObj2,\n\t\tAttachedStorage: []string{\"STORAGE-2\"},\n\t}\n\n\tvsObj := &models.VolumeSeries{\n\t\tVolumeSeriesAllOf0: models.VolumeSeriesAllOf0{\n\t\t\tMeta: &models.ObjMeta{\n\t\t\t\tID: \"VS-1\",\n\t\t\t\tVersion: 1,\n\t\t\t},\n\t\t},\n\t\tVolumeSeriesMutable: models.VolumeSeriesMutable{\n\t\t\tVolumeSeriesMutableAllOf0: models.VolumeSeriesMutableAllOf0{\n\t\t\t\tVolumeSeriesState: \"NEW\",\n\t\t\t},\n\t\t\tVolumeSeriesCreateMutable: models.VolumeSeriesCreateMutable{\n\t\t\t\tSizeBytes: swag.Int64(int64(1 * units.GiB)),\n\t\t\t},\n\t\t},\n\t}\n\tvsrObj := &models.VolumeSeriesRequest{\n\t\tVolumeSeriesRequestAllOf0: models.VolumeSeriesRequestAllOf0{\n\t\t\tMeta: &models.ObjMeta{\n\t\t\t\tID: \"VSR-1\",\n\t\t\t},\n\t\t},\n\t\tVolumeSeriesRequestCreateOnce: models.VolumeSeriesRequestCreateOnce{\n\t\t\tClusterID: \"CLUSTER-1\",\n\t\t},\n\t\tVolumeSeriesRequestMutable: models.VolumeSeriesRequestMutable{\n\t\t\tVolumeSeriesRequestMutableAllOf0: models.VolumeSeriesRequestMutableAllOf0{\n\t\t\t\tVolumeSeriesRequestState: \"PLACEMENT\",\n\t\t\t\tStoragePlan: &models.StoragePlan{\n\t\t\t\t\tStorageLayout: models.StorageLayoutStandalone,\n\t\t\t\t\tStorageElements: []*models.StoragePlanStorageElement{\n\t\t\t\t\t\t&models.StoragePlanStorageElement{\n\t\t\t\t\t\t\tPoolID: \"SP-1\",\n\t\t\t\t\t\t\tStorageParcels: map[string]models.StorageParcelElement{\n\t\t\t\t\t\t\t\t\"STORAGE\": models.StorageParcelElement{\n\t\t\t\t\t\t\t\t\tSizeBytes: swag.Int64(0 * asb), // actually ignored\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\tVolumeSeriesRequestCreateMutable: models.VolumeSeriesRequestCreateMutable{\n\t\t\t\tNodeID: \"NODE-1\",\n\t\t\t\tVolumeSeriesID: \"VS-1\",\n\t\t\t},\n\t\t},\n\t}\n\tvs := vsClone(vsObj)\n\tvsr := vsrClone(vsrObj)\n\tssa := &SelectStorageArgs{\n\t\tVSR: vsr,\n\t\tVS: vs,\n\t}\n\n\ttl.Logger().Infof(\"Case: select with multiple sources available\")\n\tvsr.StoragePlan.StorageElements[0].SizeBytes = swag.Int64(int64(5) * availBytes1)\n\texpItems := []StorageItem{\n\t\t{SizeBytes: availBytes1, ShareableStorage: true, NumParcels: 20, Storage: sObj1, PoolID: \"SP-1\", MinSizeBytes: asb, RemainingSizeBytes: 0, NodeID: \"NODE-1\"},\n\t\t{SizeBytes: availBytes1, ShareableStorage: true, NumParcels: 20, StorageRequestID: \"SR-1\", PoolID: \"SP-1\", MinSizeBytes: asb, RemainingSizeBytes: 0, NodeID: \"NODE-1\"},\n\t\t{SizeBytes: availBytes1, ShareableStorage: true, NumParcels: 20, Storage: sObj2, PoolID: \"SP-1\", MinSizeBytes: asb, RemainingSizeBytes: 0, NodeID: \"NODE-2\"},\n\t\t{SizeBytes: availBytes1, ShareableStorage: true, NumParcels: 20, StorageRequestID: \"SR-2\", PoolID: \"SP-1\", MinSizeBytes: asb, RemainingSizeBytes: 0, NodeID: \"NODE-2\"},\n\t\t{SizeBytes: int64(20) * psb, ShareableStorage: true, NumParcels: 20, PoolID: \"SP-1\", MinSizeBytes: asb, RemainingSizeBytes: asb - int64(21)*psb, NodeID: \"NODE-1\"},\n\t}\n\tresp, err := cs.SelectStorage(ctx, ssa)\n\tassert.NoError(err)\n\tassert.NotNil(resp)\n\tassert.Len(resp.Elements, 1)\n\ttl.Logger().Debugf(\"[0] %v\", resp.Elements[0])\n\tassert.Len(resp.Elements[0].Items, len(expItems))\n\ttl.Logger().Debugf(\"[0] Items %v\", resp.Elements[0].Items)\n\tassert.Equal(expItems, resp.Elements[0].Items)\n\ttl.Flush()\n}", "title": "" }, { "docid": "409a6f747378d2fa12fe5533b20b4428", "score": "0.438805", "text": "func processOpSrc(client wrapper.Client, def v1.OperatorSource, disable bool) error {\n\t// Get OperatorSource on the cluster\n\tcluster := &v1.OperatorSource{}\n\terr := client.Get(context.TODO(), wrapper.ObjectKey{\n\t\tName: def.Name,\n\t\tNamespace: def.Namespace},\n\t\tcluster)\n\tif err != nil && !k8sErrors.IsNotFound(err) {\n\t\tlogrus.Errorf(\"[defaults] Error getting OperatorSource %s - %v\", def.Name, err)\n\t\treturn err\n\t}\n\n\tif disable {\n\t\terr = ensureOpsrcAbsent(client, def, cluster)\n\t} else {\n\t\terr = ensureOpsrcPresent(client, def, cluster)\n\t}\n\n\tif err != nil {\n\t\tlogrus.Errorf(\"[defaults] Error processing OperatorSource %s - %v\", def.Name, err)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "fb62ca37c428ab3ba0beb98a32959da5", "score": "0.43842041", "text": "func init() { //nolint\n\ttestSample := TestCase{\n\t\tName: \" should perform a scan and create a result and payload file [E2E-CLI-033]\",\n\t\tArgs: args{\n\t\t\tArgs: []cmdArgs{\n\t\t\t\t[]string{\"scan\",\n\t\t\t\t\t\"--output-path\", \"output\",\n\t\t\t\t\t\"--output-name\", \"E2E_CLI_033_RESULT\",\n\t\t\t\t\t\"--report-formats\", \"json,sarif,glsast\",\n\t\t\t\t\t\"--payload-path\", \"output/E2E_CLI_033_PAYLOAD.json\",\n\t\t\t\t\t\"-q\", \"../assets/queries\", \"-p\", \"fixtures/samples/terraform-single.tf\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tExpectedResult: []ResultsValidation{\n\t\t\t\t{\n\t\t\t\t\tResultsFile: \"E2E_CLI_033_RESULT\",\n\t\t\t\t\tResultsFormats: []string{\"json\", \"sarif\", \"glsast\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\tExpectedPayload: []string{\n\t\t\t\t\"E2E_CLI_033_PAYLOAD.json\",\n\t\t\t},\n\t\t},\n\t\tWantStatus: []int{40},\n\t}\n\n\tTests = append(Tests, testSample)\n}", "title": "" }, { "docid": "b76837b5eddbc42189f181732d31f2b9", "score": "0.4381972", "text": "func TestAll(t *testing.T) {\n\tserver, err := test.NewServer()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\trunsc, err := testutil.FindFile(\"runsc/runsc\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tbuilder := config.Builder{}\n\tif err := builder.LoadAllPoints(runsc); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tbuilder.AddSink(seccheck.SinkConfig{\n\t\tName: \"remote\",\n\t\tConfig: map[string]any{\n\t\t\t\"endpoint\": server.Endpoint,\n\t\t},\n\t})\n\n\tcfgFile, err := os.CreateTemp(testutil.TmpDir(), \"config\")\n\tif err != nil {\n\t\tt.Fatalf(\"error creating tmp file: %v\", err)\n\t}\n\tdefer cfgFile.Close()\n\tif err := builder.WriteInitConfig(cfgFile); err != nil {\n\t\tt.Fatalf(\"writing config file: %v\", err)\n\t}\n\n\tworkload, err := testutil.FindFile(\"test/trace/workload/workload\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// No trace point should have a time lesser than this.\n\tcutoffTime = time.Now()\n\tcmd := exec.Command(\n\t\trunsc,\n\t\t\"--debug\", \"--alsologtostderr\", // Debug logging for troubleshooting\n\t\t\"--rootless\", \"--network=none\", \"--TESTONLY-unsafe-nonroot\", // Disable features that we don't care\n\t\t\"--pod-init-config\", cfgFile.Name(),\n\t\t\"do\", workload)\n\tout, err := cmd.CombinedOutput()\n\tt.Log(string(out))\n\tif err != nil {\n\t\tt.Fatalf(\"runsc do: %v\", err)\n\t}\n\n\t// Wait until the sandbox disconnects to ensure all points were gathered.\n\tserver.WaitForNoClients()\n\n\tmatchers := matchPoints(t, server.GetPoints())\n\textraMatchers(t, server.GetPoints(), matchers)\n\tvalidatePoints(t, server.GetPoints(), matchers)\n}", "title": "" }, { "docid": "bef3dfc9b2e240f932156702cc8ccd9c", "score": "0.438031", "text": "func TestSchedulerWithTargetTestImpl(t *testing.T) {\n\tcancel := logstream.Start(t)\n\tdefer cancel()\n\tSchedulerWithTargetTestImpl(t)\n}", "title": "" }, { "docid": "e3c669d32299f8e17d845d0f091559fe", "score": "0.43773785", "text": "func (s *BaseTealListener) ExitOperatorComparison(ctx *OperatorComparisonContext) {}", "title": "" }, { "docid": "371b5c3b67b1653d57d6d72c8e27b115", "score": "0.43742758", "text": "func createExecutionSetup() {\n\tctx = testutils.Ctx\n\tmockClient = testutils.MockClient\n\t// TODO: migrate to new command context from testutils\n\tcmdCtx = cmdCore.NewCommandContext(mockClient, testutils.MockOutStream)\n\tsortedListLiteralType := core.Variable{\n\t\tType: &core.LiteralType{\n\t\t\tType: &core.LiteralType_CollectionType{\n\t\t\t\tCollectionType: &core.LiteralType{\n\t\t\t\t\tType: &core.LiteralType_Simple{\n\t\t\t\t\t\tSimple: core.SimpleType_INTEGER,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tvariableMap := map[string]*core.Variable{\n\t\t\"sorted_list1\": &sortedListLiteralType,\n\t\t\"sorted_list2\": &sortedListLiteralType,\n\t}\n\n\ttask1 := &admin.Task{\n\t\tId: &core.Identifier{\n\t\t\tName: \"task1\",\n\t\t\tVersion: \"v2\",\n\t\t},\n\t\tClosure: &admin.TaskClosure{\n\t\t\tCreatedAt: &timestamppb.Timestamp{Seconds: 1, Nanos: 0},\n\t\t\tCompiledTask: &core.CompiledTask{\n\t\t\t\tTemplate: &core.TaskTemplate{\n\t\t\t\t\tInterface: &core.TypedInterface{\n\t\t\t\t\t\tInputs: &core.VariableMap{\n\t\t\t\t\t\t\tVariables: variableMap,\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\tmockClient.OnGetTaskMatch(ctx, mock.Anything).Return(task1, nil)\n\tparameterMap := map[string]*core.Parameter{\n\t\t\"numbers\": {\n\t\t\tVar: &core.Variable{\n\t\t\t\tType: &core.LiteralType{\n\t\t\t\t\tType: &core.LiteralType_CollectionType{\n\t\t\t\t\t\tCollectionType: &core.LiteralType{\n\t\t\t\t\t\t\tType: &core.LiteralType_Simple{\n\t\t\t\t\t\t\t\tSimple: core.SimpleType_INTEGER,\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\t\"numbers_count\": {\n\t\t\tVar: &core.Variable{\n\t\t\t\tType: &core.LiteralType{\n\t\t\t\t\tType: &core.LiteralType_Simple{\n\t\t\t\t\t\tSimple: core.SimpleType_INTEGER,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"run_local_at_count\": {\n\t\t\tVar: &core.Variable{\n\t\t\t\tType: &core.LiteralType{\n\t\t\t\t\tType: &core.LiteralType_Simple{\n\t\t\t\t\t\tSimple: core.SimpleType_INTEGER,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tBehavior: &core.Parameter_Default{\n\t\t\t\tDefault: &core.Literal{\n\t\t\t\t\tValue: &core.Literal_Scalar{\n\t\t\t\t\t\tScalar: &core.Scalar{\n\t\t\t\t\t\t\tValue: &core.Scalar_Primitive{\n\t\t\t\t\t\t\t\tPrimitive: &core.Primitive{\n\t\t\t\t\t\t\t\t\tValue: &core.Primitive_Integer{\n\t\t\t\t\t\t\t\t\t\tInteger: 10,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tlaunchPlan1 := &admin.LaunchPlan{\n\t\tId: &core.Identifier{\n\t\t\tName: \"core.advanced.run_merge_sort.merge_sort\",\n\t\t\tVersion: \"v3\",\n\t\t},\n\t\tSpec: &admin.LaunchPlanSpec{\n\t\t\tDefaultInputs: &core.ParameterMap{\n\t\t\t\tParameters: parameterMap,\n\t\t\t},\n\t\t},\n\t\tClosure: &admin.LaunchPlanClosure{\n\t\t\tCreatedAt: &timestamppb.Timestamp{Seconds: 0, Nanos: 0},\n\t\t\tExpectedInputs: &core.ParameterMap{\n\t\t\t\tParameters: parameterMap,\n\t\t\t},\n\t\t},\n\t}\n\tobjectGetRequest := &admin.ObjectGetRequest{\n\t\tId: &core.Identifier{\n\t\t\tResourceType: core.ResourceType_LAUNCH_PLAN,\n\t\t\tProject: config.GetConfig().Project,\n\t\t\tDomain: config.GetConfig().Domain,\n\t\t\tName: \"core.advanced.run_merge_sort.merge_sort\",\n\t\t\tVersion: \"v3\",\n\t\t},\n\t}\n\tmockClient.OnGetLaunchPlanMatch(ctx, objectGetRequest).Return(launchPlan1, nil)\n}", "title": "" }, { "docid": "c93894166c3f4852c847d4ee37ea66ea", "score": "0.43739232", "text": "func newTestScheduler() (alloc *testAlloc, config flow.EvalConfig, done func()) {\n\talloc = new(testAlloc)\n\talloc.Have.Scale(testutil.Resources, 2.0)\n\talloc.Repo = testutil.NewInmemoryRepository()\n\talloc.Init()\n\n\tsched := sched.New()\n\tsched.Transferer = testutil.Transferer\n\tsched.Repository = alloc.Repo\n\tsched.Cluster = alloc\n\tsched.MinAlloc = reflow.Resources{}\n\tctx, cancel := context.WithCancel(context.Background())\n\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tdone = func() {\n\t\tcancel()\n\t\twg.Wait()\n\t}\n\tgo func() {\n\t\tsched.Do(ctx)\n\t\twg.Done()\n\t}()\n\n\tvar out *log.Logger // = log.New(golog.New(os.Stderr, \"\", golog.LstdFlags), log.DebugLevel)\n\tconfig = flow.EvalConfig{\n\t\tRepository: sched.Repository,\n\t\tScheduler: sched,\n\t\tLog: out,\n\t\tTrace: out,\n\t}\n\treturn\n}", "title": "" }, { "docid": "441c88e94b57ef3075ace72580caefa7", "score": "0.43702343", "text": "func setupSuite() {\n\t// Run only on Ginkgo node 1\n\n\tc, err := framework.LoadClientset()\n\tif err != nil {\n\t\tklog.Fatal(\"Error loading client: \", err)\n\t}\n\n\t// Delete any namespaces except those created by the system. This ensures no\n\t// lingering resources are left over from a previous test run.\n\tif framework.TestContext.CleanStart {\n\t\tdeleted, err := framework.DeleteNamespaces(c, nil, /* deleteFilter */\n\t\t\t[]string{\n\t\t\t\tmetav1.NamespaceSystem,\n\t\t\t\tmetav1.NamespaceDefault,\n\t\t\t\tmetav1.NamespacePublic,\n\t\t\t\tv1.NamespaceNodeLease,\n\t\t\t\t// kind local path provisioner namespace since 0.7.0\n\t\t\t\t// https://github.com/kubernetes-sigs/kind/blob/v0.7.0/pkg/build/node/storage.go#L35\n\t\t\t\t\"local-path-storage\",\n\t\t\t})\n\t\tif err != nil {\n\t\t\tframework.Failf(\"Error deleting orphaned namespaces: %v\", err)\n\t\t}\n\t\tklog.Infof(\"Waiting for deletion of the following namespaces: %v\", deleted)\n\t\tif err := framework.WaitForNamespacesDeleted(c, deleted, namespaceCleanupTimeout); err != nil {\n\t\t\tframework.Failf(\"Failed to delete orphaned namespaces %v: %v\", deleted, err)\n\t\t}\n\t}\n\n\t// In large clusters we may get to this point but still have a bunch\n\t// of nodes without Routes created. Since this would make a node\n\t// unschedulable, we need to wait until all of them are schedulable.\n\tframework.ExpectNoError(e2enode.WaitForAllNodesSchedulable(c, framework.TestContext.NodeSchedulableTimeout))\n\n\t//// If NumNodes is not specified then auto-detect how many are scheduleable and not tainted\n\t//if framework.TestContext.CloudConfig.NumNodes == framework.DefaultNumNodes {\n\t//\tframework.TestContext.CloudConfig.NumNodes = len(framework.GetReadySchedulableNodesOrDie(c).Items)\n\t//}\n\n\t// Ensure all pods are running and ready before starting tests (otherwise,\n\t// cluster infrastructure pods that are being pulled or started can block\n\t// test pods from running, and tests that ensure all pods are running and\n\t// ready will fail).\n\tpodStartupTimeout := framework.TestContext.SystemPodsStartupTimeout\n\t// TODO: In large clusters, we often observe a non-starting pods due to\n\t// #41007. To avoid those pods preventing the whole test runs (and just\n\t// wasting the whole run), we allow for some not-ready pods (with the\n\t// number equal to the number of allowed not-ready nodes).\n\tif err := e2epod.WaitForPodsRunningReady(c, metav1.NamespaceSystem, int32(framework.TestContext.MinStartupPods), int32(framework.TestContext.AllowedNotReadyNodes), podStartupTimeout, map[string]string{}); err != nil {\n\t\te2edebug.DumpAllNamespaceInfo(c, metav1.NamespaceSystem)\n\t\te2ekubectl.LogFailedContainers(c, metav1.NamespaceSystem, framework.Logf)\n\t\tframework.Failf(\"Error waiting for all pods to be running and ready: %v\", err)\n\t}\n\n\t//if err := framework.WaitForDaemonSets(c, metav1.NamespaceSystem, int32(framework.TestContext.AllowedNotReadyNodes), framework.TestContext.SystemDaemonsetStartupTimeout); err != nil {\n\t//\tframework.Logf(\"WARNING: Waiting for all daemonsets to be ready failed: %v\", err)\n\t//}\n\n\tdc := c.DiscoveryClient\n\n\tserverVersion, serverErr := dc.ServerVersion()\n\tif serverErr != nil {\n\t\tframework.Logf(\"Unexpected server error retrieving version: %v\", serverErr)\n\t}\n\tif serverVersion != nil {\n\t\tframework.Logf(\"kube-apiserver version: %s\", serverVersion.GitVersion)\n\t}\n}", "title": "" }, { "docid": "1e55fb8959fd52d23834b5b8729ee6bc", "score": "0.43679765", "text": "func setupSuite() {\n\t// Run only on Ginkgo node 1\n\tc, err := framework.LoadClientset()\n\tif err != nil {\n\t\tklog.Fatal(\"Error loading client: \", err)\n\t}\n\n\t// Delete any namespaces except those created by the system. This ensures no\n\t// lingering resources are left over from a previous test run.\n\tif framework.TestContext.CleanStart {\n\t\tdeleted, err := framework.DeleteNamespaces(c, nil, /* deleteFilter */\n\t\t\t[]string{\n\t\t\t\tmetav1.NamespaceSystem,\n\t\t\t\tmetav1.NamespaceDefault,\n\t\t\t\tmetav1.NamespacePublic,\n\t\t\t\tv1.NamespaceNodeLease,\n\t\t\t})\n\t\tif err != nil {\n\t\t\tframework.Failf(\"Error deleting orphaned namespaces: %v\", err)\n\t\t}\n\t\tklog.Infof(\"Waiting for deletion of the following namespaces: %v\", deleted)\n\t\tif err := framework.WaitForNamespacesDeleted(c, deleted, framework.NamespaceCleanupTimeout); err != nil {\n\t\t\tframework.Failf(\"Failed to delete orphaned namespaces %v: %v\", deleted, err)\n\t\t}\n\t}\n\n\t// In large clusters we may get to this point but still have a bunch\n\t// of nodes without Routes created. Since this would make a node\n\t// unschedulable, we need to wait until all of them are schedulable.\n\tframework.ExpectNoError(framework.WaitForAllNodesSchedulable(c, framework.TestContext.NodeSchedulableTimeout))\n\n\t// Ensure all pods are running and ready before starting tests (otherwise,\n\t// cluster infrastructure pods that are being pulled or started can block\n\t// test pods from running, and tests that ensure all pods are running and\n\t// ready will fail).\n\tpodStartupTimeout := framework.TestContext.SystemPodsStartupTimeout\n\t// TODO: In large clusters, we often observe a non-starting pods due to\n\t// #41007. To avoid those pods preventing the whole test runs (and just\n\t// wasting the whole run), we allow for some not-ready pods (with the\n\t// number equal to the number of allowed not-ready nodes).\n\tif err := e2epod.WaitForPodsRunningReady(c, metav1.NamespaceSystem, int32(framework.TestContext.MinStartupPods), int32(framework.TestContext.AllowedNotReadyNodes), podStartupTimeout, map[string]string{}); err != nil {\n\t\tframework.DumpAllNamespaceInfo(c, metav1.NamespaceSystem)\n\t\t//e2ekubectl.LogFailedContainers(c, metav1.NamespaceSystem, framework.Logf)\n\t\tframework.Failf(\"Error waiting for all pods to be running and ready: %v\", err)\n\t}\n\n\tdc := c.DiscoveryClient\n\n\tserverVersion, serverErr := dc.ServerVersion()\n\tif serverErr != nil {\n\t\tframework.Logf(\"Unexpected server error retrieving version: %v\", serverErr)\n\t}\n\tif serverVersion != nil {\n\t\tframework.Logf(\"kube-apiserver version: %s\", serverVersion.GitVersion)\n\t}\n\n\tif framework.TestContext.NodeKiller.Enabled {\n\t\tnodeKiller := framework.NewNodeKiller(framework.TestContext.NodeKiller, c, framework.TestContext.Provider)\n\t\tgo nodeKiller.Run(framework.TestContext.NodeKiller.NodeKillerStopCh)\n\t}\n}", "title": "" }, { "docid": "92c718831d7c05e80b1c24cf0166877d", "score": "0.43676394", "text": "func Test2(t *testing.T) {\n\tsegmentA1 := Segment{{Short: \"a1\", Long: \"a1\"}}\n\tsegmentA2 := Segment{{Short: \"a2\", Long: \"a2\"}}\n\tsegmentB1 := Segment{{Short: \"b1\", Long: \"b1\"}}\n\tsegmentB2 := Segment{{Short: \"b2\", Long: \"b2\"}}\n\tgroupA := Group{\n\t\t[]Segment{segmentA1, segmentA2},\n\t\tfalse,\n\t}\n\tgroupB := Group{\n\t\t[]Segment{segmentB1, segmentB2},\n\t\tfalse,\n\t}\n\tsuites := []Suite{Suite{groupA, groupB}}\n\texpected := `\nalias ka1='kubectl a1'\nalias ka1b1='kubectl a1 b1'\nalias ka1b2='kubectl a1 b2'\nalias ka2='kubectl a2'\nalias ka2b1='kubectl a2 b1'\nalias ka2b2='kubectl a2 b2'\n`\n\ttest(t, suites, expected)\n}", "title": "" }, { "docid": "aa94207c363db6c8358bc4739c38e8c8", "score": "0.43602067", "text": "func TestPlan_Insert_inputs(t *testing.T) {\n\tassert := assert.New(t)\n\tplan := NewTestPlan1(t)\n\texpr := plan.insertEquivalent(\n\t\tNewExpr(&testOp{str: \"Join\"},\n\t\t\tNewExpr(&testOp{str: \"Scan A\"}), // Existing group (1)\n\t\t\tNewExpr(&testOp{str: \"Scan C\"}), // New group (5)\n\t\t\tplan.groups()[1]), // Existing group (2)\n\t\tplan.root.Exprs[0])\n\tassert.Equal(\"Join [1 5 2]\", expr.String())\n\tassert.Equal(plan.root, expr.Group)\n\tassert.Len(plan.groups(), 5)\n\tassert.Len(expr.Inputs[1].Exprs, 1)\n\tassert.Equal(\"Scan A\", expr.Inputs[0].Exprs[0].String())\n\tassert.Equal(\"Scan C\", expr.Inputs[1].Exprs[0].String())\n\tassert.Equal(\"Scan B\", expr.Inputs[2].Exprs[0].String())\n}", "title": "" }, { "docid": "df87d49c2d615822b28714f205b657b9", "score": "0.43564788", "text": "func TestSkylinkDataSource(t *testing.T) {\n\tt.Parallel()\n\tt.Run(\"small\", testSkylinkDataSourceSmallFile)\n\tt.Run(\"large\", testSkylinkDataSourceLargeFile)\n}", "title": "" }, { "docid": "42f22555c8ae14eb9d9441513df131c8", "score": "0.4354875", "text": "func (p *Parser) parseWindowOperator(tok Token, pos Pos, lit string, instruction *Instruction, hasSampling bool) (*Instruction, error) {\n\top := &FrameworkStatement{}\n\top.pos = pos\n\top.operator = tok\n\top.attributes = make(map[PrefixAttributes]InternalField)\n\top.unNamedAttributes = make(map[int]InternalField)\n\n\tparamsField := map[int][]InternalField{}\n\tindex := 0\n\n\tif tok == JOIN {\n\t\tparamsField[index] = []InternalField{{tokenType: STRING}}\n\t\tindex++\n\t}\n\n\tif tok == PERCENTILE {\n\t\tparamsField[index] = []InternalField{{tokenType: INTEGER}, {tokenType: NUMBER}}\n\t\tindex++\n\t}\n\n\taddedParams := index\n\n\t// Load first window field\n\tzeroFields := []InternalField{\n\t\t{tokenType: INTEGER, prefixName: MapperPre, hasPrefixName: true},\n\t\t{tokenType: DURATIONVAL, prefixName: MapperPre, hasPrefixName: true},\n\t\t{tokenType: DURATIONVAL, prefixName: MapperSampling, hasPrefixName: true},\n\t\t{tokenType: INTEGER},\n\t\t{tokenType: DURATIONVAL}}\n\n\tparamsField[index] = zeroFields\n\tindex++\n\n\toneFields := []InternalField{\n\t\t{tokenType: INTEGER, prefixName: MapperPost, hasPrefixName: true},\n\t\t{tokenType: DURATIONVAL, prefixName: MapperPost, hasPrefixName: true},\n\t\t{tokenType: INTEGER},\n\t\t{tokenType: DURATIONVAL}}\n\n\tparamsField[index] = oneFields\n\n\t// Load expected fields\n\tfields, err := p.ParseFields(tok.String(), paramsField, len(paramsField))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(fields) == addedParams {\n\t\tlitPre := \"1\"\n\t\tif tok == FINITE {\n\t\t\tlitPre = \"0\"\n\t\t}\n\t\top.attributes[MapperPre] = InternalField{tokenType: INTEGER, prefixName: MapperPre, hasPrefixName: true, lit: litPre}\n\t}\n\n\t// In case of duration window\n\tif len(fields) == addedParams+1 {\n\n\t\tfield := fields[addedParams]\n\n\t\tif field.tokenType != DURATIONVAL {\n\t\t\terrMessage := fmt.Sprintf(\"The %q function expects one a sampler (duration) parameter or two a %q and a %q parameters\", tok.String(), MapperPre.String(), MapperPost.String())\n\t\t\treturn nil, p.NewTslError(errMessage, pos)\n\t\t}\n\t\tif !field.hasPrefixName {\n\t\t\tfield.prefixName = MapperSampling\n\t\t\tfield.hasPrefixName = true\n\t\t}\n\t\top.attributes[field.prefixName] = field\n\n\t\t// Add a default sampler\n\t\tif !hasSampling {\n\t\t\tsampler := &FrameworkStatement{}\n\t\t\tsampler.pos = pos\n\t\t\tsampler.operator = SAMPLEBY\n\t\t\tsampler.attributes = make(map[PrefixAttributes]InternalField)\n\t\t\tsampler.attributes[SampleAggregator] = InternalField{lit: LAST.String()}\n\t\t\tsampler.attributes[SampleSpan] = InternalField{lit: \"1m\"}\n\n\t\t\tinstruction.selectStatement.frameworks = append(instruction.selectStatement.frameworks, *sampler)\n\t\t}\n\t}\n\n\tisduration := false\n\t// Validate all received fields\n\tfor index, field := range fields {\n\n\t\tif index < addedParams && addedParams == 1 {\n\n\t\t\tif tok == PERCENTILE {\n\t\t\t\tif field.tokenType == NUMBER {\n\t\t\t\t\tnumberLit, err := strconv.ParseFloat(field.lit, 10)\n\n\t\t\t\t\tif err != nil || numberLit >= 100.0 || numberLit < 0 {\n\t\t\t\t\t\terrMessage := fmt.Sprintf(\"In %q method expects percentile parameter to be included in [0.0, 100.0[\", tok.String())\n\t\t\t\t\t\treturn nil, p.NewTslError(errMessage, pos)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif field.tokenType == INTEGER {\n\t\t\t\t\tnumberLit, err := strconv.Atoi(field.lit)\n\n\t\t\t\t\tif err != nil || numberLit >= 100 || numberLit < 0 {\n\t\t\t\t\t\terrMessage := fmt.Sprintf(\"In %q method expects percentile parameter to be included in [0, 100[\", tok.String())\n\t\t\t\t\t\treturn nil, p.NewTslError(errMessage, pos)\n\t\t\t\t\t}\n\t\t\t\t\tfield.lit += \".0\"\n\t\t\t\t\tfield.tokenType = NUMBER\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tfield.prefixName = MapperValue\n\t\t\tfield.hasPrefixName = true\n\t\t\top.attributes[field.prefixName] = field\n\t\t\tcontinue\n\t\t}\n\n\t\tif index < addedParams {\n\t\t\top.unNamedAttributes[index] = field\n\t\t\tcontinue\n\t\t}\n\n\t\tif field.tokenType == DURATIONVAL {\n\t\t\tisduration = true\n\t\t}\n\n\t\tif !field.hasPrefixName && index == addedParams {\n\t\t\tfield.prefixName = MapperPre\n\t\t\tfield.hasPrefixName = true\n\t\t} else if !field.hasPrefixName && index == addedParams+1 {\n\t\t\tfield.prefixName = MapperPost\n\t\t\tfield.hasPrefixName = true\n\t\t}\n\t\top.attributes[field.prefixName] = field\n\t}\n\n\tif isduration && !hasSampling {\n\t\tsampler := &FrameworkStatement{}\n\t\tsampler.pos = pos\n\t\tsampler.operator = SAMPLEBY\n\t\tsampler.attributes = make(map[PrefixAttributes]InternalField)\n\t\tsampler.attributes[SampleAggregator] = InternalField{lit: LAST.String()}\n\t\tsampler.attributes[SampleSpan] = InternalField{lit: \"1m\"}\n\n\t\tinstruction.selectStatement.frameworks = append(instruction.selectStatement.frameworks, *sampler)\n\t}\n\n\tinstruction.selectStatement.frameworks = append(instruction.selectStatement.frameworks, *op)\n\treturn instruction, nil\n}", "title": "" }, { "docid": "b2bab328d3e9888557c728e88da48b8b", "score": "0.43489745", "text": "func processOpSrc(client wrapper.Client, def v1.OperatorSource, disable bool) error {\n\t// Get OperatorSource on the cluster\n\tcluster := &v1.OperatorSource{}\n\terr := client.Get(context.TODO(), wrapper.ObjectKey{\n\t\tName: def.Name,\n\t\tNamespace: def.Namespace},\n\t\tcluster)\n\tif err != nil && !errors.IsNotFound(err) {\n\t\tlogrus.Errorf(\"[defaults] Error getting OperatorSource %s - %v\", def.Name, err)\n\t\treturn err\n\t}\n\n\tif disable {\n\t\terr = ensureAbsent(client, def, cluster)\n\t} else {\n\t\terr = ensurePresent(client, def, cluster)\n\t}\n\n\tif err != nil {\n\t\tlogrus.Errorf(\"[defaults] Error processing OperatorSource %s - %v\", def.Name, err)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "7680a20f70e829c2be1409df4ebf99d4", "score": "0.43427446", "text": "func (s *BaseTealListener) EnterOperatorAddSub(ctx *OperatorAddSubContext) {}", "title": "" }, { "docid": "1e402128d0f6e547a08bfbb6580a7cf0", "score": "0.43359002", "text": "func (suite *TestDbNqmSuite) TestTriggersOfFiltersForPingTask(c *C) {\n\ttestedCases := []*struct {\n\t\tsqls []string\n\t\texpectedNumberOfIspFilters int\n\t\texpectedNumberOfProvinceFilters int\n\t\texpectedNumberOfCityFilters int\n\t\texpectedNumberOfNameTagFilters int\n\t\texpectedNumberOfGroupTagFilters int\n\t}{\n\t\t{ // Tests the trigger of insertion for filters\n\t\t\t[]string{\n\t\t\t\t`INSERT INTO nqm_pt_target_filter_name_tag(tfnt_pt_id, tfnt_nt_id) VALUES(9201, 3071), (9201, 3072)`,\n\t\t\t\t`INSERT INTO nqm_pt_target_filter_isp(tfisp_pt_id, tfisp_isp_id) VALUES(9201, 2), (9201, 3)`,\n\t\t\t\t`INSERT INTO nqm_pt_target_filter_province(tfpv_pt_id, tfpv_pv_id) VALUES(9201, 6), (9201, 7)`,\n\t\t\t\t`INSERT INTO nqm_pt_target_filter_city(tfct_pt_id, tfct_ct_id) VALUES(9201, 16), (9201, 17)`,\n\t\t\t\t`INSERT INTO nqm_pt_target_filter_group_tag(tfgt_pt_id, tfgt_gt_id) VALUES(9201, 70021), (9201, 70022)`,\n\t\t\t},\n\t\t\t2, 2, 2, 2, 2,\n\t\t},\n\t\t{ // Tests the trigger of deletion for filters\n\t\t\t[]string{\n\t\t\t\t`DELETE FROM nqm_pt_target_filter_name_tag WHERE tfnt_pt_id = 9201`,\n\t\t\t\t`DELETE FROM nqm_pt_target_filter_isp WHERE tfisp_pt_id = 9201`,\n\t\t\t\t`DELETE FROM nqm_pt_target_filter_province WHERE tfpv_pt_id = 9201`,\n\t\t\t\t`DELETE FROM nqm_pt_target_filter_city WHERE tfct_pt_id = 9201`,\n\t\t\t\t`DELETE FROM nqm_pt_target_filter_group_tag WHERE tfgt_pt_id = 9201`,\n\t\t\t},\n\t\t\t0, 0, 0, 0, 0,\n\t\t},\n\t}\n\n\tfor _, testCase := range testedCases {\n\t\t/**\n\t\t * Executes INSERT/DELETE statements\n\t\t */\n\t\tDbFacade.SqlDbCtrl.InTx(commonDb.BuildTxForSqls(testCase.sqls...))\n\t\t// :~)\n\n\t\tnumberOfRows := 0\n\t\tDbFacade.SqlDbCtrl.QueryForRow(\n\t\t\tcommonDb.RowCallbackFunc(func(row *sql.Row) {\n\t\t\t\tnumberOfRows++\n\n\t\t\t\tvar numberOfIspFilters int\n\t\t\t\tvar numberOfProvinceFilters int\n\t\t\t\tvar numberOfCityFilters int\n\t\t\t\tvar numberOfNameTagFilters int\n\t\t\t\tvar numberOfGroupTagFilters int\n\n\t\t\t\trow.Scan(\n\t\t\t\t\t&numberOfIspFilters,\n\t\t\t\t\t&numberOfProvinceFilters,\n\t\t\t\t\t&numberOfCityFilters,\n\t\t\t\t\t&numberOfNameTagFilters,\n\t\t\t\t\t&numberOfGroupTagFilters,\n\t\t\t\t)\n\n\t\t\t\t/**\n\t\t\t\t * Asserts the cached value for number of filters\n\t\t\t\t */\n\t\t\t\tc.Assert(numberOfIspFilters, Equals, testCase.expectedNumberOfIspFilters)\n\t\t\t\tc.Assert(numberOfProvinceFilters, Equals, testCase.expectedNumberOfProvinceFilters)\n\t\t\t\tc.Assert(numberOfCityFilters, Equals, testCase.expectedNumberOfCityFilters)\n\t\t\t\tc.Assert(numberOfNameTagFilters, Equals, testCase.expectedNumberOfNameTagFilters)\n\t\t\t\tc.Assert(numberOfGroupTagFilters, Equals, testCase.expectedNumberOfGroupTagFilters)\n\t\t\t\t// :~)\n\t\t\t}),\n\t\t\t`\n\t\t\tSELECT\n\t\t\t\tpt_number_of_isp_filters,\n\t\t\t\tpt_number_of_province_filters,\n\t\t\t\tpt_number_of_city_filters,\n\t\t\t\tpt_number_of_name_tag_filters,\n\t\t\t\tpt_number_of_group_tag_filters\n\t\t\tFROM nqm_ping_task WHERE pt_id = 9201\n\t\t\t`,\n\t\t)\n\n\t\t// Ensures that the row is effective\n\t\tc.Assert(numberOfRows, Equals, 1)\n\t}\n}", "title": "" }, { "docid": "aa445605a30c8a8c81e33ba97f1ff587", "score": "0.433504", "text": "func TestBasic(t *testing.T) {\n\tannotateTest(testSrc1, t)\n}", "title": "" }, { "docid": "83962cdc1a23d68c53f25ad73439cb02", "score": "0.43322247", "text": "func fakeFactoryOperator(strategyToUse string) Operator {\n\tswitch strategyToUse {\n\tcase \"screen\":\n\t\treturn new(strategies.OutputScreen)\n\tcase \"file\":\n\t\treturn new(strategies.OutputFile)\n\tdefault:\n\t\treturn new(strategies.OutputScreen)\n\t}\n}", "title": "" }, { "docid": "3bb73a656691e4102c3998d5d243e338", "score": "0.43264917", "text": "func TestRunConsulWorkflowPackageTests(t *testing.T) {\n\tcfg := testutil.SetupTestConfig(t)\n\tsrv, client := testutil.NewTestConsulInstance(t, &cfg)\n\tdefer func() {\n\t\tsrv.Stop()\n\t\tos.RemoveAll(cfg.WorkingDirectory)\n\t}()\n\n\tt.Run(\"groupWorkflow\", func(t *testing.T) {\n\n\t\tt.Run(\"testMetrics\", func(t *testing.T) {\n\t\t\ttestMetrics(t, client)\n\t\t})\n\t\tt.Run(\"testRunStep\", func(t *testing.T) {\n\t\t\ttestRunStep(t, srv, client)\n\t\t})\n\t\tt.Run(\"testInlineWorkflow\", func(t *testing.T) {\n\t\t\ttestInlineWorkflow(t, srv, client)\n\t\t})\n\t\tt.Run(\"testDeleteExecutionTreeSamePrefix\", func(t *testing.T) {\n\t\t\ttestDeleteExecutionTreeSamePrefix(t, client)\n\t\t})\n\t\tt.Run(\"testDeleteTaskExecutionSamePrefix\", func(t *testing.T) {\n\t\t\ttestDeleteTaskExecutionSamePrefix(t, client)\n\t\t})\n\t\tt.Run(\"testDispatcherRun\", func(t *testing.T) {\n\t\t\ttestDispatcherRun(t, srv, client)\n\t\t})\n\t\tt.Run(\"testWorkflowInputs\", func(t *testing.T) {\n\t\t\ttestWorkflowInputs(t, srv, client)\n\t\t})\n\t\tt.Run(\"testWorkflowOutputs\", func(t *testing.T) {\n\t\t\ttestWorkflowOutputs(t, srv, client)\n\t\t})\n\t})\n\n\tpopulateKV(t, srv)\n\tt.Run(\"groupWorker\", func(t *testing.T) {\n\t\tt.Run(\"TestRunQueryInfraUsage\", func(t *testing.T) {\n\t\t\ttestRunQueryInfraUsage(t, srv, client)\n\t\t})\n\t\tt.Run(\"TestRunPurge\", func(t *testing.T) {\n\t\t\ttestRunPurge(t, srv, client)\n\t\t})\n\t\tt.Run(\"TestRunPurgeFails\", func(t *testing.T) {\n\t\t\ttestRunPurgeFails(t, srv, client)\n\t\t})\n\t\tt.Run(\"TestRunWorkflowStepReplay\", func(t *testing.T) {\n\t\t\ttestRunWorkflowStepReplay(t, srv, client)\n\t\t})\n\t})\n}", "title": "" }, { "docid": "a5d616b14a7add90a9f0daa03e4dfa5a", "score": "0.43194038", "text": "func (o *Operator) Run(ctx context.Context) error {\n\tgo o.informer.Start(ctx.Done())\n\tif err := o.pool.Run(ctx, o.cfg.Threads); err != nil {\n\t\treturn fmt.Errorf(\"failed to run the pool controller: %s\", err.Error())\n\t}\n\tif err := o.ip.Run(ctx, o.cfg.Threads); err != nil {\n\t\treturn fmt.Errorf(\"failed to run the ip controller: %s\", err.Error())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6b669393a69f5f13b3592bd6a4363683", "score": "0.43173444", "text": "func New() *Operator {\n\t// extract logger\n\to := new(Operator)\n\n\to.concurrency = 1\n\to.output = make(chan interface{}, 1024)\n\n\treturn o\n}", "title": "" }, { "docid": "ef7f67a9ab5b9971e149b86aeaad965f", "score": "0.43114713", "text": "func TestTransformationSuite(t *testing.T) {\n\tsuite.Run(t, new(TransformationSuite))\n}", "title": "" }, { "docid": "d52b41582b62da6029f17e1905e66fef", "score": "0.43099982", "text": "func (t TargetsAndRulesTest) TestResources(stop <-chan struct{}, log logrus.FieldLogger, namespace string) error {\n\tlog.Println(\"checking that monitoring pods are ready\")\n\tif err := t.testPodsAreReady(); err != nil {\n\t\treturn err\n\t}\n\tlog.Println(\"checking that all targets are healthy after upgrade\")\n\tif err := t.testTargetsAreHealthy(); err != nil {\n\t\treturn err\n\t}\n\tlog.Println(\"checking that all scrape pools have active targets after upgrade\")\n\tif err := t.checkScrapePools(); err != nil {\n\t\treturn err\n\t}\n\tlog.Println(\"checking that all rules are healthy after upgrade\")\n\tif err := t.testRulesAreHealthy(); err != nil {\n\t\treturn err\n\t}\n\tlog.Println(\"checking that no alerts are firing after upgrade\")\n\tif err := t.checkAlerts(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b83861ec177ff25a85b06dde5a6b3ae4", "score": "0.4306757", "text": "func NewOperator(ws *websocket.Conn, server *Server) *Operator {\n\n\tif ws == nil {\n\t\tpanic(\"ws cannot be nil\")\n\t}\n\n\tif server == nil {\n\t\tpanic(\"server cannot be nil\")\n\t}\n\n\trooms := make(map[int]*Room)\n\tch := make(chan ResponseMessage, channelBufSize)\n\tdoneCh := make(chan bool)\n\taddToRoomCh := make(chan *Room, channelBufSize)\n\n\treturn &Operator{0, ws, server, rooms, ch, doneCh, addToRoomCh, \" \", \" \"}\n}", "title": "" }, { "docid": "178de6375dc68124dac2c6da2059aec9", "score": "0.43049374", "text": "func WorkshopOperatorsCatalog(spec workshopv1alpha1.WorkshopSpec) []*marketplacev2.CatalogSourceConfig {\n\tvar cscs = []*marketplacev2.CatalogSourceConfig{}\n\n\t//RedHat Operators\n\tvar redhatOperatorPkgs []string\n\n\tfor _, p := range spec.Stack.RedHat {\n\t\tredhatOperatorPkgs = append(redhatOperatorPkgs, p.Operator)\n\t}\n\tcscs = append(cscs, &marketplacev2.CatalogSourceConfig{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: RHPackagesCSC,\n\t\t\tNamespace: CSCNS,\n\t\t},\n\t\tSpec: marketplacev2.CatalogSourceConfigSpec{\n\t\t\tTargetNamespace: \"openshift-operators\",\n\t\t\tSource: \"redhat-operators\",\n\t\t\tPackages: strings.Join(redhatOperatorPkgs, \",\"),\n\t\t},\n\t})\n\n\tvar communityOperatorPkgs []string\n\tfor _, p := range spec.Stack.Community {\n\t\tcommunityOperatorPkgs = append(communityOperatorPkgs, p.Operator)\n\t}\n\n\t//Community Operators\n\tcscs = append(cscs, &marketplacev2.CatalogSourceConfig{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: CommunityPackagesCSC,\n\t\t\tNamespace: CSCNS,\n\t\t},\n\t\tSpec: marketplacev2.CatalogSourceConfigSpec{\n\t\t\tTargetNamespace: \"openshift-operators\",\n\t\t\tSource: \"community-operators\",\n\t\t\tPackages: strings.Join(communityOperatorPkgs, \",\"),\n\t\t},\n\t})\n\n\treturn cscs\n}", "title": "" }, { "docid": "480f9bedf3099f430dfc7b26d2a8677b", "score": "0.43020886", "text": "func TestGroupParamSuite(t *testing.T) {\n\tsuite.Run(t, new(GroupParamSuite))\n}", "title": "" }, { "docid": "57cf40587d201d1c0d55206b6312473e", "score": "0.42955965", "text": "func New() *Operator {\n\t// extract logger\n\to := new(Operator)\n\to.concurrency = 1\n\to.output = make(chan interface{}, 1024)\n\treturn o\n}", "title": "" }, { "docid": "52fd766bfcde320d26101d507a631fdf", "score": "0.42939404", "text": "func TestAll(t *testing.T, provider spi.Provider, opts ...TestOption) {\n\t// Run this first so the store count is predictable.\n\tt.Run(\"Provider: GetOpenStores\", func(t *testing.T) {\n\t\tTestProviderGetOpenStores(t, provider)\n\t})\n\tt.Run(\"Provider: open store and set/get config\", func(t *testing.T) {\n\t\tTestProviderOpenStoreSetGetConfig(t, provider)\n\t})\n\tt.Run(\"Store\", func(t *testing.T) {\n\t\tt.Run(\"Put and Get\", func(t *testing.T) {\n\t\t\tTestPutGet(t, provider)\n\t\t})\n\t\tt.Run(\"GetTags\", func(t *testing.T) {\n\t\t\tTestStoreGetTags(t, provider)\n\t\t})\n\t\tt.Run(\"GetBulk\", func(t *testing.T) {\n\t\t\tTestStoreGetBulk(t, provider)\n\t\t})\n\t\tt.Run(\"Delete\", func(t *testing.T) {\n\t\t\tTestStoreDelete(t, provider)\n\t\t})\n\t\tt.Run(\"Query\", func(t *testing.T) {\n\t\t\tTestStoreQuery(t, provider, opts...)\n\t\t\tTestStoreQueryWithSortingAndInitialPageOptions(t, provider, opts...)\n\t\t})\n\t\tt.Run(\"Batch\", func(t *testing.T) {\n\t\t\tTestStoreBatch(t, provider)\n\t\t})\n\t\tt.Run(\"Flush\", func(t *testing.T) {\n\t\t\tTestStoreFlush(t, provider)\n\t\t})\n\t\tt.Run(\"Close\", func(t *testing.T) {\n\t\t\tTestStoreClose(t, provider)\n\t\t})\n\t})\n\t// Run this last since it may render the provider object unusable afterwards, depending on the implementation.\n\tt.Run(\"Provider: close\", func(t *testing.T) {\n\t\tTestProviderClose(t, provider)\n\t})\n}", "title": "" }, { "docid": "b41dfcc35df5d32f7c10e33063a11aa1", "score": "0.42865193", "text": "func generateAndCompileJUnitRunner() {\n\t// determines if JUnitRunner has been already compiled by checking\n\t// the existence of its src (with version) directory.\n\tdPrintf(\"oakSrcPathWithVersion=%q\\n\", oakSrcPathWithVersion)\n\t_, err := os.Stat(oakSrcPathWithVersion)\n\tif err == nil {\n\t\treturn\n\t}\n\n\tsrc := generateJUnitRunnerSource()\n\n\t// save the current directory\n\tcwd := getCWD()\n\n\tchangeDirectoryTo(oakSrcPathWithVersion)\n\tcompileAsTest(\"\", src)\n\n\t// restore to the original directory\n\tchangeDirectoryTo(cwd)\n}", "title": "" }, { "docid": "e07b235a8d4f9538b24c32c9cab9da39", "score": "0.42863286", "text": "func NewK8sSetUp() K8sSetUp {\n\timpl := &k8sSetUpImpl{\n\t\tpsqlOperatorRepo: zalandoPsqlOperator,\n\t}\n\timpl.executeCommand = impl.defaultExecuteCommand\n\n\treturn impl\n}", "title": "" }, { "docid": "c7942276c8b752d28b6779b06b0ba4c4", "score": "0.42799613", "text": "func TestMain(m *testing.M) {\n\tbase.RunBasicTopologyTests(m, base.BasicTopologySetup{\n\t\tTestRunner: testRunner,\n\t\tNamespaceId: \"acceptance\",\n\t\tPreSkupperSetup: func(testRunner *base.ClusterTestRunnerBase) error {\n\t\t\t// Annotated resource test needs resources deployed before Skupper network is created\n\t\t\tif err := annotation.DeployResources(testRunner); err != nil {\n\t\t\t\tlog.Printf(\"error deploying annotated resources before creating the skupper network\")\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t})\n}", "title": "" }, { "docid": "79343fdba7726e832a26ebc494d83894", "score": "0.42731267", "text": "func New(kubeClient *kube.Clientset, chopClient *chopclientset.Clientset, initCHOpConfigFilePath string) {\n\t// Create operator instance\n\tchop = NewCHOp(version.Version, version.GitSHA, version.BuiltAt, kubeClient, chopClient, initCHOpConfigFilePath)\n\tif err := chop.Init(); err != nil {\n\t\tlog.F().Fatal(\"Unable to init CHOP instance %v\", err)\n\t\tos.Exit(1)\n\t}\n\tchop.SetupLog()\n}", "title": "" }, { "docid": "9ffeb5254ac31878f0c6a307076f1f25", "score": "0.4263108", "text": "func NewOperatorGetAllOperatorsParamsWithHTTPClient(client *http.Client) *OperatorGetAllOperatorsParams {\n\n\treturn &OperatorGetAllOperatorsParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "6874c74d758d075b03bb7299475ea340", "score": "0.42629948", "text": "func (g *Generator) Generate(examples ...*linker.LinkedExample) []*Suite {\n\tvar result []*Suite\n\tvar tests = map[string][]*Test{}\n\tvar index = map[string]*Suite{}\n\tmoduleName := moduleName(g.conf.OutputDir)\n\tfor _, e := range examples {\n\t\tif e.IsLeaf() {\n\t\t\t_, name := path.Split(e.Name)\n\t\t\tfor _, parent := range e.Parents {\n\t\t\t\ttests[parent.Name] = append(tests[parent.Name], &Test{\n\t\t\t\t\tDir: e.Dir,\n\t\t\t\t\tName: strings.Title(nameRegex.ReplaceAllString(name, \"_\")),\n\t\t\t\t\tCleanup: e.Cleanup,\n\t\t\t\t\tRun: e.Run,\n\t\t\t\t})\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tvar deps = Dependencies([]Dependency{Dependency(g.conf.BasePkg)})\n\t\tdeps = append(deps, normalizeDeps(moduleName, e.Dependencies())...)\n\n\t\tresult = append(result, &Suite{\n\t\t\tDir: e.Dir,\n\t\t\tLocation: filepath.Join(g.conf.OutputDir, strings.ToLower(e.Name), \"suite.gen.go\"),\n\t\t\tDependency: Dependency(path.Join(g.conf.OutputDir, strings.ToLower(e.Name))),\n\t\t\tCleanup: e.Cleanup,\n\t\t\tRun: e.Run,\n\t\t\tDeps: deps,\n\t\t})\n\n\t\tindex[e.Name] = result[len(result)-1]\n\t}\n\n\tfor k, v := range tests {\n\t\tindex[k].Tests = append(index[k].Tests, v...)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "6084be637b2e12d7a21ba84bf93b537f", "score": "0.42608234", "text": "func RunTests(ctx context.Context, testWorkflows []*TestWorkflow, outPath, project, zone string, parallelCount int) ([]byte, error) {\n\tvar err error\n\tclient, err = storage.NewClient(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to set up storage client: %v\", err)\n\t}\n\tbucket, err := daisyBucket(ctx, client, project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfinalizeWorkflows(testWorkflows, zone, project, bucket)\n\n\ttestResults := make(chan testResult, len(testWorkflows))\n\ttestchan := make(chan *TestWorkflow, len(testWorkflows))\n\n\tvar wg sync.WaitGroup\n\tfor i := 0; i < parallelCount; i++ {\n\t\twg.Add(1)\n\t\tgo func(id int) {\n\t\t\tdefer wg.Done()\n\t\t\tfor test := range testchan {\n\t\t\t\ttestResults <- runTestWorkflow(ctx, test)\n\t\t\t}\n\t\t}(i)\n\t}\n\tfor _, ts := range testWorkflows {\n\t\ttestchan <- ts\n\t}\n\tclose(testchan)\n\twg.Wait()\n\n\tvar suites testSuites\n\tfor i := 0; i < len(testWorkflows); i++ {\n\t\tsuites.TestSuite = append(suites.TestSuite, parseResult(<-testResults))\n\t}\n\n\tbytes, err := xml.MarshalIndent(suites, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshall result: %v\", err)\n\t}\n\toutFile, err := os.Create(outPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create output file: %v\", err)\n\t}\n\tdefer outFile.Close()\n\n\toutFile.Write(bytes)\n\toutFile.Write([]byte{'\\n'})\n\n\treturn bytes, nil\n}", "title": "" }, { "docid": "cd522bcccfa21ec0468a19de5970ebea", "score": "0.42568213", "text": "func TestOperatorDump(t *testing.T) {\n\tgoldenFilepath := filepath.Join(env.IstioSrc, \"operator/cmd/mesh/testdata/operator/output/operator-dump.yaml\")\n\n\todArgs := &operatorDumpArgs{\n\t\tcommon: operatorCommonArgs{\n\t\t\thub: \"foo.io/istio\",\n\t\t\ttag: \"1.2.3\",\n\t\t\timagePullSecrets: []string{\"imagePullSecret1,imagePullSecret2\"},\n\t\t\toperatorNamespace: \"operator-test-namespace\",\n\t\t\twatchedNamespaces: \"istio-test-namespace1,istio-test-namespace2\",\n\t\t},\n\t}\n\n\tcmd := \"operator dump --hub \" + odArgs.common.hub\n\tcmd += \" --tag \" + odArgs.common.tag\n\tcmd += \" --imagePullSecrets \" + strings.Join(odArgs.common.imagePullSecrets, \",\")\n\tcmd += \" --operatorNamespace \" + odArgs.common.operatorNamespace\n\tcmd += \" --watchedNamespaces \" + odArgs.common.watchedNamespaces\n\tcmd += \" --manifests=\" + string(snapshotCharts)\n\n\tgotYAML, err := runCommand(cmd)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif refreshGoldenFiles() {\n\t\tt.Logf(\"Refreshing golden file for %s\", goldenFilepath)\n\t\tif err := os.WriteFile(goldenFilepath, []byte(gotYAML), 0o644); err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}\n\n\twantYAML, err := readFile(goldenFilepath)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif diff := util.YAMLDiff(wantYAML, gotYAML); diff != \"\" {\n\t\tt.Fatalf(\"diff: %s\", diff)\n\t}\n}", "title": "" }, { "docid": "01ca8b3bb07671424b3340480c01a533", "score": "0.4252732", "text": "func TestWorkerProviderTestSuite(t *testing.T) {\n\tsuite.Run(t, new(WorkerProviderTestSuite))\n}", "title": "" } ]
143fe93dd9aac102751e70b4f0bd7b91
OCD is the most verbose logging level, use this if your printing information in like a tight loop, or something else that would similaraly clog logs
[ { "docid": "2682d80135f48045f9164fecdc63c54a", "score": "0.7005137", "text": "func OCD(v ...interface{}) {\n\tif level <= ocd {\n\t\tjLog(\"OCD\", v...)\n\t}\n}", "title": "" } ]
[ { "docid": "3b85c96a8606bc97d3d3bc8c07a456b2", "score": "0.6675956", "text": "func MyLog(message string) {\r\n\tif Verbose {\r\n\t\tfmt.Println(message)\r\n\t}\r\n}", "title": "" }, { "docid": "4462d6ed66e5f02f636321ff18490d82", "score": "0.6360986", "text": "func (l NoiseLevel) Verbose(msg string) {\n\tif l >= NoiseLevelVerbose {\n\t\tlog.Print(msg)\n\t}\n}", "title": "" }, { "docid": "fdcf9ec1947fe6df1ce2fa301ea2bb35", "score": "0.6322448", "text": "func IsVerbose() bool { return logging == LoggingVerbose }", "title": "" }, { "docid": "31c5ef40e7543cdfd09c6d042cd9aeb8", "score": "0.62904185", "text": "func (l *BasicLogger) CdLog(calldepth int, logLevel LogLevel, args ...interface{}) {\n\tif logLevel <= l.logLevel || logLevel <= LogLevelFatal {\n\t\tmsg := l.Sprint(args...)\n\t\tl.CdLogStrNoPrefix(calldepth+1, logLevel, msg)\n\t}\n}", "title": "" }, { "docid": "70c0bdf81c98a2a0eee3273475409e04", "score": "0.62596333", "text": "func VerboseLog() {\n\tlog.Level = logrus.DebugLevel\n}", "title": "" }, { "docid": "c69fb7be88cbb30497dfcd710894a6a8", "score": "0.62216115", "text": "func (cm *ConsensusModule) dlog(format string, args ...interface{}) {\n\tif DebugCM > 0 {\n\t\tformat = fmt.Sprintf(\"[%d] \", cm.id) + format\n\t\tlog.Printf(format, args...)\n\t}\n}", "title": "" }, { "docid": "73a083ad6033b6ab64b7c1d9948ec01b", "score": "0.6192895", "text": "func Log(v ...interface{}) {\n\tif *debug == true {\n\t\tret := fmt.Sprint(v)\n\t\tlog.Printf(\"escpos: %s\\n\", ret)\n\t}\n}", "title": "" }, { "docid": "e13083ab5bad3ec522de04e160b45fe7", "score": "0.61524826", "text": "func log(message string) {\n\tif *VERBOSE {\n\t\tfmt.Println(message)\n\t}\n}", "title": "" }, { "docid": "5e8219ead678fb0fc60dac80912faec9", "score": "0.610326", "text": "func Infoc(ctx context.Context, format string, args ...interface{}) {\n\tlogDepth(ctx, 1, InfoLog, format, args)\n}", "title": "" }, { "docid": "adb5ad13c0fab4b34a9fc40d1c3f9fc9", "score": "0.6099417", "text": "func ClogCallback(level, format string, v ...interface{}) string {\n\tswitch level {\n\tcase \"ERRO\", \"FATA\", \"CRIT\":\n\t\tlogTo(context.TODO(), LevelError, KeyAll, KeyDCP.String()+\": \"+format, v...)\n\tcase \"WARN\":\n\t\t// TODO: cbgt currently logs a lot of what we'd consider info as WARN,\n\t\t// (i.e. diagnostic information that's not actionable by users), so\n\t\t// routing to Info pending potential enhancements on cbgt side.\n\t\tlogTo(context.TODO(), LevelInfo, KeyDCP, format, v...)\n\tcase \"INFO\":\n\t\t// TODO: cbgt currently logs a lot of what we'd consider debug as INFO,\n\t\t// (i.e. janitor work and partition status), so\n\t\t// routing to Debug pending potential enhancements on cbgt side.\n\t\tlogTo(context.TODO(), LevelDebug, KeyDCP, format, v...)\n\tcase \"DEBU\":\n\t\tlogTo(context.TODO(), LevelDebug, KeyDCP, format, v...)\n\tcase \"TRAC\":\n\t\tlogTo(context.TODO(), LevelTrace, KeyDCP, format, v...)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "7211c5632838532af810e0a264af076e", "score": "0.6074194", "text": "func (sl *ServiceLogger) Criticalln(v ...interface{}) {\n\tsl.doPrintln(\"CRITICAL\", v...)\n}", "title": "" }, { "docid": "ef1667a6f90d98bfbff288fec8121688", "score": "0.6061663", "text": "func (logger *Logger) Verbose() bool {\n\treturn true\n}", "title": "" }, { "docid": "5dc07efe1208a5c75c3f651ac6766be8", "score": "0.6017401", "text": "func (c *common) Log(args ...interface{}) { c.log(fmt.Sprintln(args...)) }", "title": "" }, { "docid": "cd34fda87d812f1301bff7201dd218fb", "score": "0.59981775", "text": "func verbose(f string, a ...interface{}) {\n\tif *printVerbose || *printDebug {\n\t\tlog.Printf(f, a...)\n\t}\n}", "title": "" }, { "docid": "0e19f6e742ee3eeeb04bc977e1587d4e", "score": "0.5990363", "text": "func (l *BasicLogger) CdPrint(calldepth int, args ...interface{}) {\n\tl.CdRawOutput(calldepth+1, l.Sprint(args...))\n}", "title": "" }, { "docid": "c50627941bfe3bd23bc3af55634f5087", "score": "0.5985689", "text": "func PrintCurLog() {\n\tVeryVerbose.Printf(\"%+v\\n\", CurLog)\n}", "title": "" }, { "docid": "baaf1cb51e892f4c02aa530539ec992b", "score": "0.59755784", "text": "func Devlog(text string) {\n\tif isVerbose {\n\t\tcolor.Blue(\"[DEVLOG] %s\", text)\n\t}\n}", "title": "" }, { "docid": "b62dcdeb034672706b16792f8d754ad1", "score": "0.59495556", "text": "func (l *Logger) print(precedency int, v ...interface{}) {\n\tif precedency <= l.Precedency {\n\t\tl.setFullPrefix(precedency)\n\t\tl.logger.Print(v...)\n\t}\n}", "title": "" }, { "docid": "a8afb4fce304c5758ca907b45bd8af40", "score": "0.5908228", "text": "func Verbose() {\n\tlogging = LoggingVerbose\n\treplaceLogger(VerboseLogConfig)\n}", "title": "" }, { "docid": "3b95eb3a44580db3380880ae65bfb93b", "score": "0.59074533", "text": "func printVerbose(msg string) {\n\tif Verbose {\n\t\tfmt.Println(fmt.Sprintf(\"VERBOSE %s: %s\", getFormattedTime(), msg))\n\t}\n}", "title": "" }, { "docid": "a2a5d2b93d26e0a51fb71c1311061e85", "score": "0.58297825", "text": "func etcdClientDebugLevel() zapcore.Level {\n\tenvLevel := os.Getenv(\"ETCD_CLIENT_DEBUG\")\n\tif envLevel == \"\" || envLevel == \"true\" {\n\t\treturn zapcore.InfoLevel\n\t}\n\tvar l zapcore.Level\n\tif err := l.Set(envLevel); err != nil {\n\t\tlog.Warning(\"Invalid value for environment variable 'ETCD_CLIENT_DEBUG'. Using default level: 'info'\")\n\t\treturn zapcore.InfoLevel\n\t}\n\treturn l\n}", "title": "" }, { "docid": "fba6d7ed56f098ccefde129ca8ffb662", "score": "0.5799566", "text": "func msg(v ...interface{}) {\n\tif settings.Debug {\n\t\tfmt.Println(v)\n\t}\n}", "title": "" }, { "docid": "2e4a52a9ff6de9d4779303cc8822d95b", "score": "0.5791293", "text": "func Verbose(verbose bool) {\n\tif verbose {\n\t\tlogDebugExtract = log.New(os.Stdout, \"DEBUG: \", log.Ldate|log.Ltime|log.Lshortfile)\n\t\t//logInfoExtract = log.New(os.Stdout, \"INFO: \", log.Ldate|log.Ltime|log.Lshortfile)\n\t} else {\n\t\tlogDebugExtract = log.New(ioutil.Discard, \"DEBUG: \", log.Ldate|log.Ltime|log.Lshortfile)\n\t\t//logInfoExtract = log.New(ioutil.Discard, \"INFO: \", log.Ldate|log.Ltime|log.Lshortfile)\n\t}\n}", "title": "" }, { "docid": "f5f3680d6de7acaca0da738ccda38355", "score": "0.5768628", "text": "func (cnsl *Console) Info(msg string) {\n\tif cnsl.minLevel > logging.Info {\n\t\treturn\n\t}\n\tfmt.Println(cnsl.getTime(), format[logging.Info], msg)\n}", "title": "" }, { "docid": "5458aeae8cfd83e2476cac37bd20de53", "score": "0.57505697", "text": "func Verbose(message string) {\n\tfmt.Println(message)\n}", "title": "" }, { "docid": "851313beb1c5c740870b30dc66a691f1", "score": "0.5747975", "text": "func autoLevel(v string) string {\n\te := strings.ToLower(os.Getenv(\"SHYNC_LOGLEVEL\"))\n\tif e == \"debug\" || e == \"info\" || e == \"error\" {\n\t\treturn e\n\t}\n\tif v == \"debug\" || v == \"info\" || v == \"error\" {\n\t\treturn v\n\t}\n\te = \"info\"\n\treturn e\n}", "title": "" }, { "docid": "7427844d12ac8e737b41c84f7ec3bc2b", "score": "0.5742916", "text": "func Verbose() {\n\tverboseMode = true\n}", "title": "" }, { "docid": "1fbd37f4daa8f37aca0d6a01d38e309a", "score": "0.5721518", "text": "func (cnsl *Console) Log(msg string) {\n\tif cnsl.defaultLevel < cnsl.minLevel {\n\t\treturn\n\t}\n\tif cnsl.defaultLevel == logging.Unknown {\n\t\treturn\n\t}\n\t// date := cnsl.getTime()\n\t// msgBytes := []byte(strings.Join([]string{date, format[cnsl.defaultLevel], msg}, \" \"))\n\tfmt.Println(cnsl.getTime(), format[cnsl.defaultLevel], msg)\n\t// os.Stdout.Write(msgBytes)\n\t// os.Stdout.Write([]byte(\"\\n\"))\n}", "title": "" }, { "docid": "cc2ad005d41e46730f6558af655bfdac", "score": "0.57177585", "text": "func VerboseMode(cmd *cobra.Command) {\n\tenableVerbose, err := cmd.PersistentFlags().GetBool(\"verbose\")\n\tif err != nil {\n\t\tlog.Fatal(\"Verbose flag broke.\", err)\n\t}\n\tif enableVerbose == true {\n\t\tlog.SetLevel(log.TraceLevel)\n\t}\n}", "title": "" }, { "docid": "5bcf86f0b0c665b8a6c2b4e27d76b18d", "score": "0.57094425", "text": "func Critical(args ...interface{}) {\n\tlog.Debug(args...)\n}", "title": "" }, { "docid": "30cb2ccf29248dfb4daa71e2a542ba01", "score": "0.57010996", "text": "func logStabilityLevel(logger *zap.Logger, sl component.StabilityLevel) {\n\tif sl >= component.StabilityLevelAlpha {\n\t\tlogger.Debug(sl.LogMessage())\n\t} else {\n\t\tlogger.Info(sl.LogMessage())\n\t}\n}", "title": "" }, { "docid": "177f2fffa947bf8a958e6bc4da56e92f", "score": "0.56979465", "text": "func (l *Logger) println(precedency int, v ...interface{}) {\n\tif precedency <= l.Precedency {\n\t\tl.setFullPrefix(precedency)\n\t\tl.logger.Println(v...)\n\t}\n}", "title": "" }, { "docid": "59e914addb11f5fa853902291ee28928", "score": "0.5697511", "text": "func goLog(level int, message string) {\n\tif level <= LogLevel {\n\t\tfmt.Printf(\"[%s] %s\\n\", LogLevels[level], message)\n\t}\n}", "title": "" }, { "docid": "f958cac96beb36c82a0c868a9ec0d9e0", "score": "0.5686977", "text": "func (l NoiseLevel) Short(msg string) {\n\tif l >= NoiseLevelShort {\n\t\tlog.Print(msg)\n\t}\n}", "title": "" }, { "docid": "83e0af3280c82d38034184272c5b16b2", "score": "0.56868476", "text": "func verb(msg ...interface{}) {\n\tif verbose {\n\t\tlog.Println(msg...)\n\t}\n}", "title": "" }, { "docid": "44ee2e1891cfe8b633b039827647b24e", "score": "0.5679179", "text": "func (c Context) Verbosity() int { return c.verbose }", "title": "" }, { "docid": "098c926a61e5dfbb6391ded34b96ab9f", "score": "0.56734794", "text": "func (l *BasicLogger) CdLogNoPrefix(calldepth int, logLevel LogLevel, args ...interface{}) {\n\tif logLevel <= l.logLevel || logLevel <= LogLevelFatal {\n\t\tmsg := fmt.Sprint(args...)\n\t\tif logLevel >= LogLevelPanic {\n\t\t\tl.CdRawOutput(calldepth+1, msg)\n\t\t}\n\t\tif logLevel == LogLevelFatal {\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif logLevel == LogLevelPanic {\n\t\t\tpanic(msg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e046bb453d160220125a809be06b1d98", "score": "0.5667892", "text": "func (r *RedigoServer) RedigoLog(level int, fm string, objs ...interface{}) {\n\tif level >= r.Verbosity {\n\t\tif level&REDIS_LOG_RAW > 0 {\n\t\t\tflags := log.Flags()\n\t\t\tlog.SetFlags(0)\n\t\t\tlog.Printf(fm+\"\\n\", objs...)\n\t\t\tlog.SetFlags(flags)\n\t\t} else {\n\t\t\tlog.Printf(fm+\"\\n\", objs...)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "16a146d7317760c65258fc7de03cfca7", "score": "0.5655361", "text": "func (l *wlogger) Debug(str string) {\r\n\tif l.logLevel <= DebugLevel {\r\n\t\tl.logger.Printf(\"[DEUBG] %s\", str)\r\n\t}\r\n}", "title": "" }, { "docid": "7114311c50fd7e59abebf5a10a07c4dc", "score": "0.5653759", "text": "func Infoln(v ...interface{}) {\n\tif Severity > InfoLevel {\n\t\treturn\n\t}\n\tInfoLogger.Output(2, fmt.Sprintln(v...))\n}", "title": "" }, { "docid": "ffb74dad30fac94de560b60e6bcc44d5", "score": "0.56414133", "text": "func (l NoiseLevel) Info(msg string) {\n\tif l >= NoiseLevelNormal {\n\t\tlog.Print(msg)\n\t}\n}", "title": "" }, { "docid": "4617b8dcf57874f890f10daac5485cc5", "score": "0.563843", "text": "func (log Logger) Debug(msg string) { Debug(msg); }", "title": "" }, { "docid": "d6f7fc8689fd859fa011ec0a1d865f0d", "score": "0.5629699", "text": "func initLogging(verbose bool) {\n // Only log the warning severity or above.\n if verbose {\n\t\tlog.SetLevel(log.DEBUG)\n\t}\n}", "title": "" }, { "docid": "084e4ae61f4a49ea304b18edc33a1bf7", "score": "0.5629048", "text": "func debug_print(message string) {\r\n\r\n\tif debug_mode {\r\n\t\tfmt.Printf(\"<H3>DEBUG : %s</H3>\\n\",message)\r\n\t}\r\n\r\n\treturn\r\n}", "title": "" }, { "docid": "18a59920378622477f00b1ad129cf17c", "score": "0.5627615", "text": "func Info(format string, v ...interface{}) {\n\tif verbosity <= DEFAULT {\n\t\tfmt.Printf(format, v...)\n\t}\n}", "title": "" }, { "docid": "41fe6939818d19c26b32fd0050a407f4", "score": "0.5624395", "text": "func (l *geroLogger) V(verbosity int) bool {\n\treturn true\n}", "title": "" }, { "docid": "2f941cefe64cde533be079d43c24d192", "score": "0.562102", "text": "func (c *StatusController) LogInfo(v ...interface{}) {\n\ta := fmt.Sprint(v)\n\tlogger.Info(\"StatusController: \", a[1:len(a)-1])\n}", "title": "" }, { "docid": "6b79b7e60b63ae28f4113a1f34d60596", "score": "0.5620637", "text": "func Verbose(s string) {\n\tif verbose {\n\t\tlogger.Output(2, s)\n\t}\n}", "title": "" }, { "docid": "d8fe9b81ba1b6f0daa2efb04e3471c71", "score": "0.5597163", "text": "func DebugLogging() {\n\t// // // // // \tlog.SetLevel(log.DebugLevel)\n}", "title": "" }, { "docid": "ce5ac15b7712394511925e249487bfad", "score": "0.55920607", "text": "func (v *vpconnect) configCharonLogLevel() {\n\tprint(&msg{Message: \"v.configCharonLogLevel(): Entering\", LogLevel: \"debug\"})\n\tdefer print(&msg{Message: \"v.configCharonLogLevel(): Returning\", LogLevel: \"debug\"})\n\n\t// Set charon log level based on debug.\n\tswitch debug {\n\tcase true:\n\t\tv.charonLogLevel = 3\n\n\tdefault:\n\t\tv.charonLogLevel = 1\n\t}\n\n\tprint(&msg{Message: fmt.Sprintf(\"v.configCharonLogLevel(): Charon Log Level set to %d\", v.charonLogLevel), LogLevel: \"info\"})\n}", "title": "" }, { "docid": "543cc88184b1b153d0de84bf93493304", "score": "0.5581251", "text": "func Verbose() {\n\tverbose = MODE_VERBOSE\n}", "title": "" }, { "docid": "7b7def13a72cfc4e6d82f2f037437c71", "score": "0.5580619", "text": "func (cnsl *Console) Debug(msg string) {\n\tif cnsl.minLevel > logging.Debug {\n\t\treturn\n\t}\n\tdate := cnsl.getTime()\n\tprintln(date, format[logging.Debug], msg)\n}", "title": "" }, { "docid": "7a577d99ab0c817f0f9597bf624ac579", "score": "0.55734885", "text": "func UseVerboseLog() {\n\tLogger.Level = dlog.DebugLevel\n\tlog.Debug(\"use debug logging\")\n}", "title": "" }, { "docid": "6de1e018ee3842ea513d7c19d38a883f", "score": "0.555906", "text": "func (l Logger) Debug(msg string, args ...interface{}) {}", "title": "" }, { "docid": "ca95a4959792aea56f6ad92bd63f211c", "score": "0.5558695", "text": "func (sl *ServiceLogger) doPrint(level string, v ...interface{}) {\n\tif sl.logLevel >= levelMap[level] {\n\t\tsl.Output(3, sl.prefixString(level)+fmt.Sprint(v...))\n\t}\n}", "title": "" }, { "docid": "7594d38cb20c0d43a6e9bfc8c9fcff1d", "score": "0.55554676", "text": "func Log(args ...interface{}) {\n\tif isVerbose(os.Args) {\n\t\tfmt.Print(args...)\n\t}\n}", "title": "" }, { "docid": "948b40e95755874375cd2c7317f2afaf", "score": "0.55487", "text": "func (NoLogger) Debug(msg string) {}", "title": "" }, { "docid": "896237806f40cb1021b50ffe3638a59c", "score": "0.55481625", "text": "func Verbose(verbose bool) {\n\n\tif verbose {\n\t\t//logDebugValidate = log.New(os.Stdout, \"DEBUG: \", log.Ldate|log.Ltime|log.Lshortfile)\n\t\tlogInfoValidate = log.New(os.Stdout, \"INFO: \", log.Ldate|log.Ltime|log.Lshortfile)\n\t} else {\n\t\t//logDebugValidate = log.New(ioutil.Discard, \"DEBUG: \", log.Ldate|log.Ltime|log.Lshortfile)\n\t\tlogInfoValidate = log.New(ioutil.Discard, \"INFO: \", log.Ldate|log.Ltime|log.Lshortfile)\n\t}\n}", "title": "" }, { "docid": "d5029c9a8ceeec55c5186ee10a5bef03", "score": "0.5547756", "text": "func (g *GLogger) V(l int) bool {\n\treturn l <= g.Verbosity\n}", "title": "" }, { "docid": "7035288db70d07631864a16347765543", "score": "0.554608", "text": "func debugPrint(message string) {\n\tif Debug {\n\t\tfmt.Println(\"[DEBUG] \" + message)\n\t}\n}", "title": "" }, { "docid": "ba219162430a5aef1c32badfa20b1962", "score": "0.55449504", "text": "func (n *nilLogger) Debug(message string) {}", "title": "" }, { "docid": "c31c17a6ad34b0865f9a243df15cc757", "score": "0.55438536", "text": "func Ldbg(format string, v ...interface{}) {\n\tif Verbosity >= DbgVerbosity {\n\t\tlog.Printf(\"[DEBUG] \"+format, v...)\n\t}\n}", "title": "" }, { "docid": "f0c842832b59c62fdc39b1ec61c6358b", "score": "0.5536958", "text": "func Info(format string, v ...interface{}) {\n\tif LogLevel < LevelInfo {\n\t\treturn\n\t}\n\tgolog.Printf(format, v...)\n}", "title": "" }, { "docid": "9165aff44aba617daaa1931f4d1773cd", "score": "0.5534314", "text": "func Debug() {\n\tlog.SetLevel(log.ALL)\n}", "title": "" }, { "docid": "5d59d7da45770d28fbf2f9247aca05fc", "score": "0.55254763", "text": "func (stat *l0Stat) print() {\n\tif stat.l0.allow && stat.l0.teo.param.ShowClientsStatF {\n\t\tfmt.Print(stat.sprint())\n\t}\n}", "title": "" }, { "docid": "a7847d819d73f27ed5dd18c5837f7dbf", "score": "0.54901934", "text": "func Info(v ...interface{}) {\n\tif LEVEL <= INFO {\n\t\tPrint(\"[INFO]\", v...)\n\t}\n}", "title": "" }, { "docid": "9ea51703d9c3b85409d1b759786df1ed", "score": "0.548284", "text": "func debug(str string, param ...interface{}) {\n\tif LogLevel <= LOG_DEBUG {\n\t\tlog.Printf(\"DEBUG \"+str, param...)\n\t}\n}", "title": "" }, { "docid": "cdaef36d1bdd93317acf951c61b16d6a", "score": "0.5475074", "text": "func (l *Clogger) Print(msg string) {\r\n\tmsg = fmt.Sprintf(\"[%s] %s\", strings.ToUpper(l.Name), msg)\r\n\tif LogToSyslog && l.Logger != nil {\r\n\t\tl.Logger.Print(msg)\r\n\t}\r\n\tif LogToStdOut && LogLevel <= l.LogLevel {\r\n\t\tl.PrintStdOut(msg)\r\n\t}\r\n}", "title": "" }, { "docid": "e3e52b2651a3aec3acc9dead9cd2e467", "score": "0.5473242", "text": "func verboseLogging(v bool) option {\n\treturn func(r *radroach) {\n\t\tr.verbose = v\n\t}\n}", "title": "" }, { "docid": "33e4418629daf9a3f29c7893f24e7a1f", "score": "0.5473034", "text": "func (s *ScopedLogger) Debug(v ...interface{}) {\n\tif Dbg < s.GetLogLevel() {\n\t\treturn\n\t}\n\ts.writef(Dbg, fmt.Sprint(v...))\n}", "title": "" }, { "docid": "69fef58c259c05484cb4448e84312a9a", "score": "0.5469201", "text": "func (l *BasicLogger) Print(args ...interface{}) {\n\tl.CdPrint(2, args...)\n}", "title": "" }, { "docid": "d76c41207d2fa1fdd90642a5ed372d3f", "score": "0.546637", "text": "func ColorfulPrintFunc(b Bough) {\n\tprefixPrinter := fmt.Sprintf\n\tswitch {\n\tcase b.Level == 0:\n\t\tprefixPrinter = color.YellowString\n\tcase b.Level > 0:\n\t\tprefixPrinter = color.RedString\n\tcase b.Level == -1:\n\t\tprefixPrinter = color.BlueString\n\t}\n\n\tfmt.Fprintf(os.Stderr, \"[%s] %s %s\\n\", time.Now().Format(time.Stamp), prefixPrinter(b.Prefix), b.Message)\n}", "title": "" }, { "docid": "f109beb8e99b90612538749018a8865d", "score": "0.5465853", "text": "func Criticalf(message string, args ...interface{}) {\n\tlog.Debugf(message, args...)\n}", "title": "" }, { "docid": "d5b1389bdd817f961ab14591f52b0ec0", "score": "0.54593736", "text": "func verbose(levelSet int, format string, args ...interface{}) {\n\tif Opts.Verbose >= levelSet {\n\t\tfmt.Fprintf(os.Stderr, \"[\"+progname+\"] \"+format+\"\\n\", args...)\n\t}\n}", "title": "" }, { "docid": "90bbdd7686b4a6eb1f27ed6913732f5b", "score": "0.5457129", "text": "func Debug(msg ...interface{}) {\n\t// TODO: only send these if filtered logging allows\n\tflogger.SetPrefix(\"DEBUG:\\t\")\n\tflogger.Println(msg)\n\n\tstdlogger.SetPrefix(\"DEBUG:\\t\")\n\tstdlogger.Println(msg)\n}", "title": "" }, { "docid": "8354345f7a5efd97ef007c8990157487", "score": "0.5456092", "text": "func Log(mode ModeFlag, p ...interface{}) {\n\tif mode == Normal || mode == Mode {\n\t\tif len(p) == 0 {\n\t\t\tlog.Println(\"No message\")\n\t\t} else {\n\t\t\tlog.Printf(p[0].(string), p[1:]...)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "489d9538ce00a9d1df4d484aef226efe", "score": "0.54529387", "text": "func logDepth(ctx context.Context, depth int, sev Severity, format string, args []interface{}) {\n\t// TODO(tschottdorf): logging hooks should have their entry point here.\n\taddStructured(ctx, sev, depth+1, format, args)\n}", "title": "" }, { "docid": "89f1d733f94623aaa0d9e4d586330599", "score": "0.54429394", "text": "func (l *SubsystemLogger) Debug(v ...interface{}) {\n\tif l.filter(DebugLvl) {\n\t\treturn\n\t}\n\tl.log.Debug(l.addPrefixArg(v)...)\n}", "title": "" }, { "docid": "21b133a7ff1a6a88861261495f536f46", "score": "0.5441468", "text": "func Warningc(ctx context.Context, format string, args ...interface{}) {\n\tlogDepth(ctx, 1, WarningLog, format, args)\n}", "title": "" }, { "docid": "3f1385aa6c656f8baf836b8d61311853", "score": "0.5438778", "text": "func Debug(v ...interface{}) {\n\tif Settings.verbose { log.Println(v...) }\n}", "title": "" }, { "docid": "5e06f554db28f0695eb6f2e6b26d3306", "score": "0.5429178", "text": "func (l *Log) Debug(format string, v ...interface{}) {\n\tif LevelDebug > l.level {\n\t\tfmt.Printf(\"LevelDebug:%d,l.level:%d\\n\",LevelDebug,l.level)\n\t\treturn\n\t}\n\tl.writeMsg(LevelDebug, format, v...)\n}", "title": "" }, { "docid": "263f00c0321b5d9fafc158c4fdb75ed1", "score": "0.54288566", "text": "func (l *Logger) Print(v ...interface{}) { l.Output(2, fmt.Sprint(v...)) }", "title": "" }, { "docid": "15d9583499498ff492f6af18003b4dee", "score": "0.54253024", "text": "func (sl *ServiceLogger) doPrintln(level string, v ...interface{}) {\n\tif sl.logLevel >= levelMap[level] {\n\t\tsl.Output(3, sl.prefixString(level)+fmt.Sprintln(v...))\n\t}\n}", "title": "" }, { "docid": "b69dabbee733758534c6d16ff2c52829", "score": "0.5424595", "text": "func LogInfo(message string) {\n\tfmt.Println(ColorInfo(message))\n}", "title": "" }, { "docid": "4bf6ec3f98e9a27cbf9b757e10a9a61b", "score": "0.54157007", "text": "func (l *wlogger) Info(str string) {\r\n\tif l.logLevel <= InfoLevel {\r\n\t\tl.logger.Printf(\"[INFO] %s\", str)\r\n\t}\r\n}", "title": "" }, { "docid": "ab862263d52443e9202ce541b70e284d", "score": "0.5410523", "text": "func TestVerbosity(t *testing.T) {\n\tInfo = MakeLogger(\"I\", os.Stderr, nil)\n\n\tVerbosity = 0\n\tif l := V(1); l.String() != NilLogger().String() {\n\t\tt.Errorf(\"got %q want %q for V(1) with Verbosity = %d\", l, NilLogger(), Verbosity)\n\t}\n\n\tVerbosity = 1\n\tif l := V(1); l.String() != Info.String() {\n\t\tt.Errorf(\"got %q want %q for V(1) with Verbosity = %d\", l, Info, Verbosity)\n\t}\n\n\tVerbosity = 2\n\tif l := V(1); l.String() != Info.String() {\n\t\tt.Errorf(\"got %q want %q for V(1) with Verbosity = %d\", l, Info, Verbosity)\n\t}\n}", "title": "" }, { "docid": "cf9e854e2410d345d7ab9e9cb4020f38", "score": "0.5410398", "text": "func printIfVerbose(format string, a ...interface{}) {\n\tif !verbose {\n\t\treturn\n\t}\n\n\tfmt.Printf(format, a...)\n}", "title": "" }, { "docid": "726b1822285fa6fddd3e62f571a05c17", "score": "0.54067296", "text": "func (l *logger) Print(v ...interface{}) {\n\tg := globals()\n\n\tif l.level < g.currentLevel {\n\t\treturn // Don't log at lower levels.\n\t}\n\tif g.external != nil {\n\t\tg.external.Log(l.level, fmt.Sprint(v...))\n\t}\n\tif g.defaultLogger != nil {\n\t\tg.defaultLogger.Print(v...)\n\t}\n}", "title": "" }, { "docid": "d5fe8c31c3dfd52b0d968a993387d332", "score": "0.54063976", "text": "func Infoln(v ...interface{}) {\n\tloggerInstance.doPrintln(INFO, v...)\n}", "title": "" }, { "docid": "aa5eacfdde42811f6a6f9b99142e84bb", "score": "0.5403046", "text": "func (l *BasicLogger) CdPrintf(calldepth int, f string, args ...interface{}) {\n\tl.CdRawOutput(calldepth+1, l.Sprintf(f, args...))\n}", "title": "" }, { "docid": "d98647611f4d0aeb2b08a52e5b797d5d", "score": "0.53991985", "text": "func TestLogging ( t *testing.T) {\n lvl := LogLevel(ctx)\n if lvl != None {\n t.Errorf(\"Expected default log level to be '%d', but got '%d'\", None, lvl)\n }\n SetLogLevel(ctx,Error)\n lvl = LogLevel(ctx)\n if lvl != Error {\n t.Errorf(\"Expected default log level to be '%d', but got '%d'\", Error, lvl)\n }\n SetLogLevel(ctx,Debug)\n lvl = LogLevel(ctx)\n if lvl != Debug {\n t.Errorf(\"Expected default log level to be '%d', but got '%d'\", Debug, lvl)\n }\n SetLogLevel(ctx,Trace)\n lvl = LogLevel(ctx)\n if lvl != Trace {\n t.Errorf(\"Expected default log level to be '%d', but got '%d'\", Trace, lvl)\n }\n SetLogLevel(ctx,None)\n}", "title": "" }, { "docid": "ccf80c31f2345beafa3d8e197c760b35", "score": "0.53951526", "text": "func (l *Logger) Print(v ...interface{}) { l.Log.Output(2, fmt.Sprint(v...)) }", "title": "" }, { "docid": "eab9d199c7a083adb5bdaa5812fd6f7a", "score": "0.53922886", "text": "func V(l int) bool {\n\treturn Logger.V(l)\n\t//return grpclog.Logger.V(l)\n}", "title": "" }, { "docid": "5a0186b1f07be75d6075422e93eea5f0", "score": "0.53912896", "text": "func Debug(v ...interface{}) {\n\tif Verbose {\n\t\tlog.Print(v...)\n\t}\n}", "title": "" }, { "docid": "c477dc9283038671c92c8e632a0fbbfc", "score": "0.5389065", "text": "func (l *Logger) printf(precedency int, format string, v ...interface{}) {\n\tif precedency <= l.Precedency {\n\t\tl.setFullPrefix(precedency)\n\t\tl.logger.Printf(format, v...)\n\t}\n}", "title": "" }, { "docid": "1eccff58e7d0a898a18781e04e00e801", "score": "0.53868437", "text": "func logsEtcdOpertor() {\n\tlogPodGarden(\"etcd-operator\", \"kube-system\")\n}", "title": "" }, { "docid": "6fe648db3e2cc1629252831362d6b418", "score": "0.5385458", "text": "func init() {\n\tlog.SetFlags(log.LstdFlags | log.Lmicroseconds | log.Lshortfile)\n\tlog.SetOutput(os.Stdout)\n}", "title": "" }, { "docid": "9c22e414c097bfe9ea24fb33818c1466", "score": "0.5382325", "text": "func VerboseF(format string, args ...interface{}) {\n\tlog.Info(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "0bd5d2e30ba378958507e2cf3afe6aa3", "score": "0.5372501", "text": "func tracec(from int, nb int, format string, a ...interface{}) {\n\treturn\n\tif traceOn == false {\n\t\treturn\n\t}\n\tci := traceCallers(from, nb)\n\tm := fmt.Sprintf(format, a...)\n\tif m[len(m)-1] == '\\n' { // Already terminated with a \\n.\n\t\tfmt.Fprintf(os.Stderr, \"%s:%s\", ci, m)\n\t} else {\n\t\tfmt.Fprintf(os.Stderr, \"%s:%s\\n\", ci, m)\n\t}\n}", "title": "" }, { "docid": "9d5449299cc4c850f8c9305a84af6afe", "score": "0.5371847", "text": "func Debug(v ...interface{}) {\n\tif LEVEL <= DEBUG {\n\t\tPrint(\"[DEBUG]\", v...)\n\t}\n}", "title": "" } ]
03f93c2a9d1e603b31fef5aa1d1eae95
Sink retry count. Type: integer (or Expression with resultType integer).
[ { "docid": "722167849c9c92631c0d36a12ba27dd1", "score": "0.7724593", "text": "func (o SqlServerSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlServerSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" } ]
[ { "docid": "70b7f30a4ebfa1a08f2a1a9692adfe4d", "score": "0.78438395", "text": "func (o CosmosDbSqlApiSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbSqlApiSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "2d17dc3023b77a82dd51273de4fbd57d", "score": "0.7818682", "text": "func (o RestSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v RestSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "bd2c8abcd09844c30f9f62bf68216272", "score": "0.7793174", "text": "func (o SqlSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "5c019858192bba9050678d8ddd4bcc96", "score": "0.7777853", "text": "func (o AzurePostgreSqlSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzurePostgreSqlSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "f9b28c1385adf32c59c01933ff5b0cfe", "score": "0.774746", "text": "func (o CosmosDbMongoDbApiSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbMongoDbApiSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "23102cb4c2fb87dfc479dcf2f012a570", "score": "0.7739354", "text": "func (o AzureSqlSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureSqlSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "185607cbb9fafea5bfbd38e1a955c828", "score": "0.77104604", "text": "func (o AvroSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AvroSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "e857ac1e838bcfca10a6a7bdb6e8f7b1", "score": "0.77059776", "text": "func (o OdbcSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v OdbcSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "4bbd7e8911562e66a3bab2b29bae36c0", "score": "0.7676605", "text": "func (o OracleSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v OracleSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "c06f81fb54b3bfc947fd74ddedeed6ed", "score": "0.76766014", "text": "func (o AzureTableSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureTableSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "087612e364219c6f1e1e27cb55921974", "score": "0.76660424", "text": "func (o AzureDataExplorerSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDataExplorerSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "3641220fe5eacb8ca8612c638cf94c9d", "score": "0.7657485", "text": "func (o JsonSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v JsonSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "1227e35c76be110e4dff3ac26f968e5c", "score": "0.76529515", "text": "func (o SqlMISinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlMISink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "b7b1b00ac8fcafd5278820600e80c617", "score": "0.7652081", "text": "func (o BlobSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v BlobSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "93f6621b06b7adb7170b22d7d7979832", "score": "0.76382315", "text": "func (o SqlDWSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlDWSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "e2ad67b68a594540ea614ce94d333653", "score": "0.76347214", "text": "func (o MongoDbV2SinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v MongoDbV2Sink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "7c2e7e47d5ba4946f380078ae1315d80", "score": "0.76341903", "text": "func (o AzurePostgreSqlSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzurePostgreSqlSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "7ecc5c31b3432630c957df9052330884", "score": "0.763331", "text": "func (o InformixSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v InformixSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "8ce700dfd072df31bdbf0e0d8925e641", "score": "0.7630336", "text": "func (o AzureDataLakeStoreSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDataLakeStoreSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "0d90148c887747dcdb26031c0fe7b5b8", "score": "0.7626461", "text": "func (o SalesforceSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SalesforceSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "0a7158bb7b16922e5829786e5c27bd63", "score": "0.7623795", "text": "func (o RestSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v RestSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "3333b8b5f14d9c543f491c8e8bbb314f", "score": "0.76236475", "text": "func (o SqlSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "7fca70e0f59d7fe5526aa8811244d01d", "score": "0.7617765", "text": "func (o CosmosDbSqlApiSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbSqlApiSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "9e6243f94042f7b5379ede10740bac68", "score": "0.7601182", "text": "func (o AzureMySqlSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureMySqlSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "81adf753ea5b8b2902dcae5238f19f02", "score": "0.75995725", "text": "func (o OrcSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v OrcSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "f4404e315531925eb37ed66d86f2fe98", "score": "0.7591331", "text": "func (o AzureSqlSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureSqlSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "e4fb07146a4e2e9cd4e2337a432c2071", "score": "0.7583656", "text": "func (o MicrosoftAccessSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v MicrosoftAccessSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "69b3fbca05895d8bdae151c2da9c40f4", "score": "0.7582982", "text": "func (o BinarySinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v BinarySink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "5dac06aea7bd9e0bb1e96cbdeca62366", "score": "0.7578953", "text": "func (o SnowflakeSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SnowflakeSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "f6c4ce90dc14d667a08ed6de51905f63", "score": "0.75788814", "text": "func (o CosmosDbMongoDbApiSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbMongoDbApiSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "63454089c954a5ffdbba99a755148090", "score": "0.7578383", "text": "func (o FileSystemSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v FileSystemSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "18c298b4118c6527ac30331801410658", "score": "0.75761324", "text": "func (o SalesforceServiceCloudSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SalesforceServiceCloudSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "33828e55b81b3d5d5b7ec1cdf5d63366", "score": "0.75697976", "text": "func (o AzureQueueSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureQueueSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "4cc3c967735cac7da76854f27cbe0a05", "score": "0.75596935", "text": "func (o SqlServerSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlServerSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "b5042f6682d4f84c503f0e660654a38e", "score": "0.75572777", "text": "func (o AzureBlobFSSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobFSSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "b794d3ad4d161d940f7396142366c03b", "score": "0.7545833", "text": "func (o OdbcSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v OdbcSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "48c4d0e7d0213f6b371af2d52f428782", "score": "0.75409", "text": "func (o OracleSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v OracleSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "e2ebc0e8b63793b9fef15c5fede0f4af", "score": "0.7538606", "text": "func (o SqlMISinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlMISinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "8f220d02af0f046338f0556f23dc034c", "score": "0.75369406", "text": "func (o AvroSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AvroSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "35b7923204b98c1ba7bf030f741efec6", "score": "0.75256354", "text": "func (o AzureTableSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureTableSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "cfdc7116cf5e127bc12ff62eaa2128ee", "score": "0.7519562", "text": "func (o JsonSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v JsonSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "8bffd4c71e75728f41834e7ec8b74ba7", "score": "0.7518215", "text": "func (o AzureDataExplorerSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDataExplorerSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "34a6e11b9fc53e38ac7df4bccd6286b2", "score": "0.75114053", "text": "func (o DynamicsSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v DynamicsSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "f0c861672ea161c6f831b2e33eb40621", "score": "0.75067157", "text": "func (o AzureMySqlSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureMySqlSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "dd7e79651e7039ede61455ecabf8068b", "score": "0.7502442", "text": "func (o SqlDWSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlDWSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "dbb8606a9a6ddf78dc7f745fb525221d", "score": "0.7499288", "text": "func (o AzureDataLakeStoreSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDataLakeStoreSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "a2a9a8f0e8f9adde9ad34c57d44069c3", "score": "0.7491294", "text": "func (o MongoDbV2SinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v MongoDbV2SinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "cb8a5f8555e93b59fda8318e36a42277", "score": "0.7488207", "text": "func (o BlobSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v BlobSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "13e165ca19d1f25543f5ea1ffc1566e7", "score": "0.74859804", "text": "func (o ParquetSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v ParquetSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "aabd58bd3127a4e8a3db3c1ac6fc4aa5", "score": "0.7477343", "text": "func (o FileSystemSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v FileSystemSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "9fec0ed7ea9cb50d12982289f5a756d7", "score": "0.7467581", "text": "func (o OrcSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v OrcSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "22cf7f193ad5c6f2bcdf6ff5c9ef259f", "score": "0.74649775", "text": "func (o BinarySinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v BinarySinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "cdb894d08672fbcc339174f246f3138d", "score": "0.74560845", "text": "func (o InformixSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v InformixSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "a9493bdf4cfcbc8948eeb9a8b6db3fba", "score": "0.74522436", "text": "func (o SalesforceSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SalesforceSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "f605780b88237324e698c95c84d18906", "score": "0.74516183", "text": "func (o AzureQueueSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureQueueSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "5719470a2a31929166dc0ec1293ac6b5", "score": "0.74508756", "text": "func (o MicrosoftAccessSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v MicrosoftAccessSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "13ad41ba11b23d54e2aa16cce1558722", "score": "0.74457973", "text": "func (o AzureSearchIndexSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureSearchIndexSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "8f9ae8a493a21d26f40398a6f6735720", "score": "0.7441585", "text": "func (o DynamicsCrmSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v DynamicsCrmSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "c06e645b3ad71fd7a5f18e60d451cef5", "score": "0.74347305", "text": "func (o SalesforceServiceCloudSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SalesforceServiceCloudSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "8354b1c02a801e14dea81dda525bde56", "score": "0.74244434", "text": "func (o DelimitedTextSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v DelimitedTextSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "2095fdd8b84b5caa33d81214ad54fdfc", "score": "0.74177027", "text": "func (o DynamicsSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v DynamicsSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "1d664c9750ef16693f27d054d103bd76", "score": "0.7411516", "text": "func (o DocumentDbCollectionSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v DocumentDbCollectionSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "4536ab963f2b86a12deb65029e19710e", "score": "0.74104714", "text": "func (o CommonDataServiceForAppsSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CommonDataServiceForAppsSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "367789108ced13669e309830baab8813", "score": "0.7408562", "text": "func (o MongoDbAtlasSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v MongoDbAtlasSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "a4ad2e8fbe160cea51d4603f37196f86", "score": "0.74070877", "text": "func (o AzureBlobFSSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobFSSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "11af929249c22f9594571697b80423cd", "score": "0.73913354", "text": "func (o AzureDatabricksDeltaLakeSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDatabricksDeltaLakeSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "a214dd903a47e8e39b49da0d34222f3b", "score": "0.7366065", "text": "func (o ParquetSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v ParquetSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "d8b67d3dc50ae0cdc348818a230c1bfd", "score": "0.7357949", "text": "func (o DocumentDbCollectionSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v DocumentDbCollectionSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "f87a0b60ec32ffd37af548fc18527187", "score": "0.73461103", "text": "func (o SnowflakeSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SnowflakeSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "4b107bf1494a2634243c8ff931916c95", "score": "0.7336329", "text": "func (o DelimitedTextSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v DelimitedTextSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "3a4318e1b5ff2281bbf403d8f7163374", "score": "0.7320849", "text": "func (o CommonDataServiceForAppsSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CommonDataServiceForAppsSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "80dd4d2fe9fc49eeafff686b46f6d6d3", "score": "0.73190296", "text": "func (o AzureSearchIndexSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureSearchIndexSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "0ebca837051717845fd46f52339d6306", "score": "0.7307684", "text": "func (o DynamicsCrmSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v DynamicsCrmSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "b1d05d56fba53342530bb4a4cfb5ffb1", "score": "0.7305365", "text": "func (o SapCloudForCustomerSinkOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SapCloudForCustomerSink) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "d4e8895d0c22df3eec3391f3eb6ec524", "score": "0.7295681", "text": "func (o MongoDbAtlasSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v MongoDbAtlasSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "c5a0754df32f969bb1d2aff0fde679b5", "score": "0.7276317", "text": "func (o AzureDatabricksDeltaLakeSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDatabricksDeltaLakeSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "abe79fcbb4924cceac2c30bdc95be138", "score": "0.72195566", "text": "func (o SapCloudForCustomerSinkResponseOutput) SinkRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SapCloudForCustomerSinkResponse) interface{} { return v.SinkRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "d7a2f047e2eabd99207f3927f84e1878", "score": "0.6410254", "text": "func (o RetryConfigOutput) RetryCount() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v RetryConfig) *int { return v.RetryCount }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "04a9418afa1481264ea2001e34b8085e", "score": "0.63993055", "text": "func (o HttpRetryPolicyOutput) NumRetries() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v HttpRetryPolicy) *int { return v.NumRetries }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "994ba808dc5f254d52f0641b753e871a", "score": "0.62386715", "text": "func (o RetryConfigResponseOutput) RetryCount() pulumi.IntOutput {\n\treturn o.ApplyT(func(v RetryConfigResponse) int { return v.RetryCount }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "666e2cb1e65ef43315ca1bb4d256d707", "score": "0.62204975", "text": "func (o JobRetryConfigOutput) RetryCount() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v JobRetryConfig) *int { return v.RetryCount }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "ae3d289effeb5591383f4af88a58edaa", "score": "0.61970216", "text": "func (o HttpRetryPolicyResponseOutput) NumRetries() pulumi.IntOutput {\n\treturn o.ApplyT(func(v HttpRetryPolicyResponse) int { return v.NumRetries }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "8e7184ce18d0637315aa66ec8383f43d", "score": "0.6189565", "text": "func (o GreenplumSourceOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v GreenplumSource) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "39ef3e69b36cea8d0f4266854ce3daf2", "score": "0.61610496", "text": "func (o PhoenixSourceOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v PhoenixSource) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "b4e383935d0adfba49ff2fe91efad2cf", "score": "0.61604595", "text": "func (o AvroSourceOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AvroSource) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "e625d9549d9c27a0106f017bd5ca143b", "score": "0.6157669", "text": "func (o Db2SourceOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v Db2Source) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "2ff742d4f3a4494c8b72a0cd13adf3d4", "score": "0.61426777", "text": "func getRetry(h amqp.Table) int32 {\n\tvar r int32\n\tlastCount := h[\"x-retry-count\"]\n\tif lastCount != nil {\n\t\tr = lastCount.(int32)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "836dc0d7c920c6421912425240eafd11", "score": "0.6136576", "text": "func (o ImpalaSourceOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v ImpalaSource) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "721433918c126aa6862806cec7847896", "score": "0.6136165", "text": "func (o HBaseSourceOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HBaseSource) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "a16895ab7b0a15d64c5d5255b210aadf", "score": "0.6106689", "text": "func (o PostgreSqlSourceOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v PostgreSqlSource) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "4ee7b29be43d412494ec6a9e71dd07ff", "score": "0.60981506", "text": "func (pee PolicyExponential) RetryCount() uint {\n\treturn pee.currentCount\n}", "title": "" }, { "docid": "2f922adc816d63913efd8895fc4d0c5c", "score": "0.60921675", "text": "func (o OdbcSourceOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v OdbcSource) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "a9c78ecbc5040e01bd146f6c0076b15e", "score": "0.60816085", "text": "func (o AzurePostgreSqlSourceOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzurePostgreSqlSource) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "f8c935f073519399d6cfe0872ec0a6e0", "score": "0.6072173", "text": "func (o CouchbaseSourceOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CouchbaseSource) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "7408c75d8c7be6111211b410d85a6040", "score": "0.60720485", "text": "func (p *Pool) RetryCount() int {\n\treturn p.retryCount\n}", "title": "" }, { "docid": "ad88cf2b89c7f4348ff31b712d01e2c1", "score": "0.60622257", "text": "func (o WebSourceOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v WebSource) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "8104ec583b0ea332c64780b703face2e", "score": "0.6055739", "text": "func (o ApplicationStatusOperationStateOutput) RetryCount() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v ApplicationStatusOperationState) *int { return v.RetryCount }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "e6911a9da21d033623ea9443387e595c", "score": "0.60504186", "text": "func (o AvroSourceResponseOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AvroSourceResponse) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "47e1fbeabba2aa658762f3274d1a3aab", "score": "0.6041169", "text": "func (o HiveSourceOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HiveSource) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "d339dd13ee0458ce70e1377e3029a766", "score": "0.60391414", "text": "func (o MongoDbSourceOutput) SourceRetryCount() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v MongoDbSource) interface{} { return v.SourceRetryCount }).(pulumi.AnyOutput)\n}", "title": "" } ]
709e882b2ee04284e358c9641352c8e7
makeHandler makes the handler functions
[ { "docid": "c61e51890579af30d85eab72d2792d54", "score": "0.64814997", "text": "func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tm := validPath.FindStringSubmatch(r.URL.Path)\n\t\tif m == nil {\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn\n\t\t}\n\t\tfn(w, r, m[2])\n\t}\n}", "title": "" } ]
[ { "docid": "e8db16b53f0be4eb498fd59e28a62907", "score": "0.74448955", "text": "func CreateHandler() (Handler) {\n return Handler{}\n}", "title": "" }, { "docid": "cd10a85fc975ab9f32e9eaee8bc83c63", "score": "0.73084307", "text": "func (s *Service) makeHandler(originalHandler http.Handler, secure bool) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tstack := make([]byte, 1024*8)\n\t\t\t\tstack = stack[:runtime.Stack(stack, false)]\n\t\t\t\tlog.Errorf(\"PANIC: %s\\n%s\", err, stack)\n\t\t\t\thttp.Error(w, \"500 Internal Server Error\", http.StatusInternalServerError)\n\t\t\t}\n\t\t}()\n\t\t// build context\n\t\tgctx.Set(r, PrometheusInstance, s.Prometheus)\n\t\tgctx.Set(r, RouterInstance, s.Router)\n\t\t// call custom handler\n\t\tchain := NewChain(StartTimerHandler).Final(FinalHandler).Then(originalHandler)\n\t\tif secure {\n\t\t\tchain = NewChain(StartTimerHandler, AuthHandler).Final(FinalHandler).Then(originalHandler)\n\t\t}\n\t\tchain.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "33d3638868dee38b1c02758cd7e7c8e4", "score": "0.7281137", "text": "func MakeHandler(tracer opentracing.Tracer, svc kuiper.Service) http.Handler {\n\topts := []kithttp.ServerOption{\n\t\tkithttp.ServerErrorEncoder(encodeError),\n\t}\n\n\tr := bone.New()\n\n\tr.Get(\"/streams\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"list_streams\")(listStreamsEndpoint(svc)),\n\t\tdecodeStreamListing,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Post(\"/streams\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"create_stream\")(createStreamEndpoint(svc)),\n\t\tdecodeStreamCreation,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Get(\"/streams/:name\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"get_stream\")(viewStreamEndpoint(svc)),\n\t\tdecodeStreamView,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Get(\"/streams/:name\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"delete_stream\")(deleteStreamEndpoint(svc)),\n\t\tdecodeStreamDeletion,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Get(\"/rules\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"list_rules\")(listRulesEndpoint(svc)),\n\t\tdecodeRuleListing,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Post(\"/rules\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"create_rule\")(createRuleEndpoint(svc)),\n\t\tdecodeRuleCreation,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Get(\"/rules/:name\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"get_rule\")(viewRuleEndpoint(svc)),\n\t\tdecodeRuleView,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Get(\"/rules/:name\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"delete_rule\")(deleteRuleEndpoint(svc)),\n\t\tdecodeRuleDeletion,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Get(\"/rules/:name/status\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"rule_status\")(viewRuleStatusEndpoint(svc)),\n\t\tdecodeRuleStatus,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Post(\"/rules/:name/:action\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"rule_start\")(startRuleEndpoint(svc)),\n\t\tdecodeRuleControl,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\t// Plugins\n\tr.Get(\"/plugins/sources\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"plugins_source_list\")(listPluginSourcesEndpoint(svc)),\n\t\tdecodePluginSourcesListing,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Get(\"/plugins/sources/:name\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"plugins_source_view\")(viewPluginSourceEndpoint(svc)),\n\t\tdecodePluginSourceView,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Get(\"/plugins/sinks\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"plugins_sinks_list\")(listPluginSinksEndpoint(svc)),\n\t\tdecodePluginSourcesListing,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Get(\"/plugins/sinks/:name\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"plugins_sinks_view\")(viewPluginSinkEndpoint(svc)),\n\t\tdecodePluginSourceView,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.GetFunc(\"/version\", pandas.Version(\"kuiper\"))\n\tr.Handle(\"/metrics\", promhttp.Handler())\n\n\treturn r\n}", "title": "" }, { "docid": "3c40295a1135c63886396e0bfa274366", "score": "0.7215753", "text": "func createHandler(w http.ResponseWriter, r *http.Request) {\n\t// TODO: Stub\n}", "title": "" }, { "docid": "4d267d014c520598310d92ed585e2845", "score": "0.7185301", "text": "func MakeHandler(svc engine.Service) http.Handler {\n\topts := []kithttp.ServerOption{\n\t\tkithttp.ServerErrorEncoder(encodeError),\n\t}\n\n\tr := bone.New()\n\n\tr.Get(\"/users/:userId/rules\", kithttp.NewServer(\n\t\tretrieveRulesEndpoint(svc),\n\t\tdecodeList,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Get(\"/users/:userId/rules/:ruleId\", kithttp.NewServer(\n\t\tretrieveRuleEndpoint(svc),\n\t\tdecodeView,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Delete(\"/users/:userId/rules/:ruleId\", kithttp.NewServer(\n\t\tremoveRuleEndpoint(svc),\n\t\tdecodeView,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.GetFunc(\"/health\", engine.Health())\n\n\treturn r\n}", "title": "" }, { "docid": "f63057250a58aeb740bd3066ed5fa24a", "score": "0.71719724", "text": "func MakeHandler(svc authn.Service, tracer opentracing.Tracer) http.Handler {\n\topts := []kithttp.ServerOption{\n\t\tkithttp.ServerErrorEncoder(encodeError),\n\t}\n\n\tmux := bone.New()\n\n\tmux.Post(\"/keys\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"issue\")(issueEndpoint(svc)),\n\t\tdecodeIssue,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tmux.Get(\"/keys/:id\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"retrieve\")(retrieveEndpoint(svc)),\n\t\tdecodeKeyReq,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tmux.Delete(\"/keys/:id\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"revoke\")(revokeEndpoint(svc)),\n\t\tdecodeKeyReq,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tmux.GetFunc(\"/version\", pandas.Version(\"auth\"))\n\tmux.Handle(\"/metrics\", promhttp.Handler())\n\n\treturn SetupMiddleware(mux)\n}", "title": "" }, { "docid": "60f859bb0f0974ff2612644f3866be9e", "score": "0.7168452", "text": "func makeHandler(hc taskHandlerConf) *taskHandler {\n\treturn &taskHandler{\n\t\ttaskHandlerConf: hc,\n\t\tnow: time.Now,\n\t\thandleSingleTask: handleSingleTask,\n\t\topenTaskLog: openTaskLog,\n\t\trotateTaskLog: rotateTaskLog,\n\t\trunCmd: runCmd,\n\t}\n}", "title": "" }, { "docid": "4ea1824d224fceda4686521945683430", "score": "0.7137227", "text": "func MakeHandler(svc k8s_client.Service, l log.Logger) http.Handler {\n\tlogger = l\n\n\topts := []kithttp.ServerOption{\n\t\tkithttp.ServerErrorEncoder(encodeError),\n\t}\n\n\tmux := bone.New()\n\n\tmux.Post(\"/pv\", kithttp.NewServer(\n\t\tcreateNFSPVEndpoint(svc),\n\t\tdecodeNFSPersistentVolume,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tmux.Post(\"/pvc\", kithttp.NewServer(\n\t\tcreatePVCEndpoint(svc),\n\t\tdecodePersistentVolumeClaim,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tmux.Post(\"/deployment\", kithttp.NewServer(\n\t\tcreateDeploymentEndpoint(svc),\n\t\tdecodeDeployment,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tmux.GetFunc(\"/version\", quai.Version(\"k8s-client\"))\n\tmux.Handle(\"/metrics\", promhttp.Handler())\n\n\treturn mux\n}", "title": "" }, { "docid": "bb0ff287e8ea678b208cae962a87a779", "score": "0.71349", "text": "func newHandler(mgr manager.Manager, types []runtime.Object, mutator Mutator, logger logr.Logger) (*handler, error) {\n\t// Build a map of the given types keyed by their GVKs\n\ttypesMap, err := buildTypesMap(mgr, types)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create and return a handler\n\treturn &handler{\n\t\ttypesMap: typesMap,\n\t\tmutator: mutator,\n\t\tlogger: logger.WithName(\"handler\"),\n\t}, nil\n}", "title": "" }, { "docid": "00a5b3c0ae0a9bcaf5118e49a39d8816", "score": "0.71074986", "text": "func (svc *Service) MakeHandler(method api.Method, path string, fn api.HandlerFn) api.Handler {\n\treturn api.MakeHandler(method, path, fn)\n}", "title": "" }, { "docid": "14dced59c8f9cb2f0ef4cf492afcafa7", "score": "0.71031076", "text": "func MakeHandler(svc GolfService, logger log.Logger) http.Handler {\n\topts := []kithttp.ServerOption{\n\t\tkithttp.ServerErrorHandler(transport.NewLogErrorHandler(logger)),\n\t\tkithttp.ServerErrorEncoder(encodeError),\n\t}\n\n\tcreateGolfHandler := kithttp.NewServer(\n\t\tmakeCreateGolfEndpoint(svc),\n\t\tdecodeGolfReqCreate,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tgetGolfHandler := kithttp.NewServer(\n\t\tmakeGetGolfEndpoint(svc),\n\t\tdecodeGolfReqGet,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tr := mux.NewRouter()\n\n\tr.Handle(\"/catalog\", createGolfHandler).Methods(\"POST\")\n\tr.Handle(\"/catalog/{id}\", getGolfHandler).Methods(\"GET\")\n\n\treturn r\n}", "title": "" }, { "docid": "5328f96a1e65b182ff34dd8d44c3ebd4", "score": "0.7080627", "text": "func MakeHandler(svc rulechain.Service, tracer opentracing.Tracer, l log.Logger) http.Handler {\n\tlogger = l\n\n\topts := []kithttp.ServerOption{\n\t\tkithttp.ServerErrorEncoder(encodeError),\n\t}\n\n\tmux := bone.New()\n\n\tmux.Post(\"/rulechain\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"add_rulechain\")(addRuleChainEndpoint(svc)),\n\t\tdecodeNewRuleChainRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tmux.Get(\"/rulechain\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"rulechain_list\")(listRuleChainEndpoint(svc)),\n\t\tdecodeListRuleChainRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tmux.Get(\"/rulechain/:id\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"rulechain_info\")(rulechainInfoEndpoint(svc)),\n\t\tdecodeRuleChainRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tmux.Put(\"/rulechain/:id\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"update_rulechain\")(updateRuleChainEndpoint(svc)),\n\t\tdecodeUpdateRuleChainRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tmux.Delete(\"/rulechain/:id\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"delete_rulechain\")(deleteRuleChainEndpoint(svc)),\n\t\tdecodeRuleChainRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tmux.Put(\"/updateRulechainStatus/:id\", kithttp.NewServer(\n\t\tkitot.TraceServer(tracer, \"update_rulechain_status\")(updateRuleChainStatusEndpoint(svc)),\n\t\tdecodeUpdateRuleChainStatusRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tmux.GetFunc(\"/version\", pandas.Version(\"rulechain\"))\n\tmux.Handle(\"/metrics\", promhttp.Handler())\n\n\treturn SetupMiddleware(mux)\n}", "title": "" }, { "docid": "a80f57e7b563b54fd696bd878dfefcd5", "score": "0.7005576", "text": "func MakeHandler(s Service, extractor authn.SubjectExtractorFunc, authz enforcer.Enforcer, logger log.Logger) http.Handler {\n\topts := []kithttp.ServerOption{\n\t\tkithttp.ServerErrorHandler(transport.NewLogErrorHandler(logger)),\n\t\tkithttp.ServerErrorEncoder(kithttp.DefaultErrorEncoder),\n\t\tkithttp.ServerBefore(kithttp.PopulateRequestContext),\n\t}\n\n\tmakeEndpoint := func(action string, factory func(Service) endpoint.Endpoint) endpoint.Endpoint {\n\t\treturn endpoint.Chain(\n\t\t\tauthn.NewAuthenticator(extractor),\n\t\t\tenforcer.NewActionEndpoint(action),\n\t\t\tenforcer.NewEnforcedEndpoint(authz),\n\t\t)(factory(s))\n\t}\n\n\tlistGroupsHandler := kithttp.NewServer(\n\t\tmakeEndpoint(ActionGroupRead, makeGetGroupsEndpoint),\n\t\tdecodeGetGroupsRequest,\n\t\tkithttp.EncodeJSONResponse,\n\t\topts...,\n\t)\n\n\tcreateGroupHandler := kithttp.NewServer(\n\t\tmakeEndpoint(ActionGroupWrite, makeCreateGroupEndpoint),\n\t\tdecodeCreateGroupRequest,\n\t\tkithttp.EncodeJSONResponse,\n\t\topts...,\n\t)\n\n\tdeleteGroupHandler := kithttp.NewServer(\n\t\tmakeEndpoint(ActionGroupWrite, makeDeleteGroupEndpoint),\n\t\tdecodeDeleteGroupRequest,\n\t\tkithttp.EncodeJSONResponse,\n\t\topts...,\n\t)\n\n\tloadGroupHandler := kithttp.NewServer(\n\t\tmakeEndpoint(ActionGroupRead, makeLoadGroupEndpoint),\n\t\tdecodeLoadGroupRequest,\n\t\tkithttp.EncodeJSONResponse,\n\t\topts...,\n\t)\n\n\tgetGroupMembersHandler := kithttp.NewServer(\n\t\tmakeEndpoint(ActionGroupRead, makeGetGroupMembersEndpoint),\n\t\tdecodeGetGroupMembersRequest,\n\t\tkithttp.EncodeJSONResponse,\n\t\topts...,\n\t)\n\n\tupdateCommentHandler := kithttp.NewServer(\n\t\tmakeEndpoint(ActionGroupWrite, makeUpdateGroupCommentEndpoint),\n\t\tdecodeUpdateCommentRequest,\n\t\tkithttp.EncodeJSONResponse,\n\t\topts...,\n\t)\n\n\taddMemberHandler := kithttp.NewServer(\n\t\tmakeEndpoint(ActionGroupWrite, makeAddMemberEndpoint),\n\t\tdecodeAddMemberRequest,\n\t\tkithttp.EncodeJSONResponse,\n\t\topts...,\n\t)\n\n\tdeleteMemberHandler := kithttp.NewServer(\n\t\tmakeEndpoint(ActionGroupWrite, makeDeleteMemberEndpoint),\n\t\tdecodeDeleteMemberRequest,\n\t\tkithttp.EncodeJSONResponse,\n\t\topts...,\n\t)\n\n\tr := mux.NewRouter()\n\n\t// swagger:route GET /v1/groups/ groups listGroups\n\t//\n\t// List all groups stored and managed by IAM.\n\t//\n\t//\tProduces:\n\t//\t- application/json\n\t//\n\t//\tSchemes: http, https\n\t//\n\t//\tResponses:\n\t//\t\tdefault: body:genericError\n\t//\t\t200: groupList\n\tr.Handle(\"/v1/groups/\", listGroupsHandler).Methods(\"GET\")\n\n\t// swagger:route POST /v1/groups/ groups createGroup\n\t//\n\t// Create a new group.\n\t//\n\t// \tProduces:\n\t//\t- application/json\n\t//\n\t//\tConsumes:\n\t//\t-application/json\n\t//\n\t//\tSchemes: http, https\n\t//\n\t//\tParameters:\n\t//\t+\tin: body\n\t//\t\ttype: createGroupRequest\n\t//\n\t//\tResponses:\n\t//\t\tdefault: body:genericError\n\t//\t\t200: createGroupResponse\n\tr.Handle(\"/v1/groups/\", createGroupHandler).Methods(\"POST\")\n\n\t// swagger:route GET /v1/groups/{id} groups getGroup\n\t//\n\t// Get a specific group.\n\t//\n\t// \tProduces:\n\t//\t- application/json\n\t//\n\t//\tSchemes: http, https\n\t//\n\t//\tParameters:\n\t//\t+\tin: path\n\t//\t\tname: id\n\t//\t\tdescription: The ID of the group.\n\t//\n\t//\tResponses:\n\t//\t\tdefault: body:genericError\n\t//\t\t200: Group\n\tr.Handle(\"/v1/groups/{id}\", loadGroupHandler).Methods(\"GET\")\n\n\t// swagger:route PUT /v1/groups/{id} groups updateGroupComment\n\t//\n\t// Update the comment of a specific group.\n\t//\n\t//\tProduces:\n\t//\t- application/json\n\t//\n\t//\tSchemes: http, https\n\t//\n\t//\tParameters:\n\t//\t+\tin: path\n\t//\t\tname: id\n\t//\t\tdescription: The ID of the group.\n\t//\t+\tin: body\n\t//\t\ttype: updateGroupCommentRequest\n\t//\n\t//\tResponses:\n\t//\t\tdefault: body:genericError\n\t//\t\t201: description: Group updated successfully.\n\tr.Handle(\"/v1/groups/{id}\", updateCommentHandler).Methods(\"PUT\", \"PATCH\")\n\n\t// swagger:route DELETE /v1/groups/{id} groups deleteGroup\n\t//\n\t// Delete an existing group and remove all members of that group.\n\t//\n\t//\tProduces:\n\t//\t- application/json\n\t//\n\t//\tSchemes: http, https\n\t//\n\t//\tParameters:\n\t//\t+\tin: path\n\t//\t\tname: id\n\t//\t\tdescription: The ID of the group to delete.\n\t//\n\t//\tResponses:\n\t//\t\tdefault: body:genericError\n\t//\t\t201: description: Group deleted successfully.\n\tr.Handle(\"/v1/groups/{id}\", deleteGroupHandler).Methods(\"DELETE\")\n\n\t// swagger:route GET /v1/groups/{id}/members/ groups getGroupMembers\n\t//\n\t// Get a list of user URNs that are part of the group.\n\t//\n\t//\tProduces:\n\t//\t- application/json\n\t//\n\t//\tSchemes: http, https\n\t//\n\t//\tParameters:\n\t//\t+ \tin:path\n\t//\t\tname: id\n\t//\t\tdescription: The ID of the group.\n\t//\n\t//\tResponses:\n\t//\t\tdefault: body:genericError\n\t//\t\t200: memberList\n\tr.Handle(\"/v1/groups/{id}/members/\", getGroupMembersHandler).Methods(\"GET\")\n\n\t// swagger:route PUT /v1/groups/{id}/members/{user} groups addMemberToGroup\n\t//\n\t// Add a new member to a group.\n\t//\n\t//\tProduces:\n\t//\t- application/json\n\t//\n\t//\tSchemes: http, https\n\t//\n\t//\tParameters:\n\t//\t+\tin: path\n\t//\t\tname: id\n\t//\t\tdescription: The ID of the group.\n\t//\t+\tin:path\n\t//\t\tname: user\n\t//\t\tdescription: The ID of the user.\n\t//\n\t//\tResponses:\n\t//\t\tdefault: body:genericError\n\t//\t\t201: description: User added successfully.\n\tr.Handle(\"/v1/groups/{id}/members/{user}\", addMemberHandler).Methods(\"PUT\")\n\n\t// swagger:route DELETE /v1/groups/{id}/members/{user} groups deleteMemberFromGroup\n\t//\n\t// Delete a user from a group.\n\t//\n\t//\tProduces:\n\t//\t- application/json\n\t//\n\t//\tSchemes: http, https\n\t//\n\t// \tParameters:\n\t//\t+\tin: path\n\t//\t\tname: id\n\t//\t\tdescription: The ID of the group.\n\t//\t+\tin: path\n\t//\t\tname: user\n\t//\t\tdescription: The ID of the user to remove from the group.\n\t//\n\t//\tResponses:\n\t//\t\tdefault: body:genericError\n\t//\t\t201: description: User successfully removed from group.\n\tr.Handle(\"/v1/groups/{id}/members/{user}\", deleteMemberHandler).Methods(\"DELETE\")\n\n\treturn r\n}", "title": "" }, { "docid": "8b485d0eb99a60ec7e6fc1a44ee0fee6", "score": "0.6966415", "text": "func MakeHandler(service Service, logger kitlog.Logger, ml machineLearning.Service) http.Handler {\n\topts := gokit.GetServerOpts(logger, ml)\n\n\tskynetRebuild := kithttp.NewServer(makeSkynetRebuildEndpoint(service), decodeSkynetRebuildRequest, gokit.EncodeResponse, opts...)\n\tskynetAlert := kithttp.NewServer(makeSkynetAlertEndpoint(service), gokit.DecodeString, gokit.EncodeResponse, opts...)\n\n\tr := mux.NewRouter()\n\n\tr.Handle(\"/api/skynet/\", skynetAlert).Methods(\"POST\")\n\tr.Handle(\"/api/skynet/rebuild\", skynetRebuild).Methods(\"POST\")\n\n\treturn r\n\n}", "title": "" }, { "docid": "a0fbd709fca580c5118457d4a5080297", "score": "0.69423634", "text": "func MakeHandler() *Handler {\n\tvar db db.DB\n\tif config.Properties.Self != \"\" &&\n\t\tlen(config.Properties.Peers) > 0 {\n\t\t// db = cluster.MakeCluster()\n\t} else {\n\t\tdb = copydis.MakeDB()\n\t}\n\treturn &Handler{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "7d9f3d3f2125fc1fe35e78d901095fdd", "score": "0.6878128", "text": "func MakeHandler(s Service, logger kitlog.Logger, idGen IDGenerator) http.Handler {\n\topts := []kithttp.ServerOption{\n\t\tkithttp.ServerErrorEncoder(encodeError),\n\t\tkithttp.ServerBefore(kithttp.PopulateRequestContext, PopulateRequestID(idGen)),\n\t}\n\n\tcreatePlaylistHandler := kithttp.NewServer(\n\t\tmakeCreatePlaylistEndpoint(s),\n\t\tdecodeCreatePlaylistRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tloadPlaylistHandler := kithttp.NewServer(\n\t\tmakeLoadPlaylistEndpoint(s),\n\t\tdecodeLoadPlaylistRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tupsertPlaylistHandler := kithttp.NewServer(\n\t\tmakeUpsertPlaylistEndpoint(s),\n\t\tdecodeUpsertPlaylistRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tupdatePlaylistNameHandler := kithttp.NewServer(\n\t\tmakeUpdatePlaylistNameEndpoint(s),\n\t\tdecodeUpdatePlaylistNameRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tremovePlaylistHandler := kithttp.NewServer(\n\t\tmakeRemovePlaylistEndpoint(s),\n\t\tdecodeRemovePlaylistRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\taddTrackHandler := kithttp.NewServer(\n\t\tmakeAddTrackEndpoint(s),\n\t\tdecodeAddTrackRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tremoveTrackHandler := kithttp.NewServer(\n\t\tmakeRemoveTrackEndpoint(s),\n\t\tdecodeRemoveTrackRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tplaysHandler := kithttp.NewServer(\n\t\tmakePlaysEndpoint(s),\n\t\tdecodePlaysRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tlikesHandler := kithttp.NewServer(\n\t\tmakeLikesEndpoint(s),\n\t\tdecodeLikesRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tdislikesHandler := kithttp.NewServer(\n\t\tmakeDislikesEndpoint(s),\n\t\tdecodeDislikesRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tr := mux.NewRouter()\n\n\tr.Handle(\"/playlists/playlist\", createPlaylistHandler).Methods(\"POST\")\n\tr.Handle(\"/playlists/playlist\", loadPlaylistHandler).Methods(\"GET\")\n\tr.Handle(\"/playlists/{id}\", upsertPlaylistHandler).Methods(\"PUT\")\n\tr.Handle(\"/playlists/{id}\", updatePlaylistNameHandler).Methods(\"PATCH\")\n\tr.Handle(\"/playlists/{id}\", removePlaylistHandler).Methods(\"DELETE\")\n\tr.Handle(\"/playlists/{playlistid}/tracks/{trackid}\", addTrackHandler).Methods(\"PUT\")\n\tr.Handle(\"/playlists/{playlistid}/tracks/{trackid}\", removeTrackHandler).Methods(\"DELETE\")\n\tr.Handle(\"/playlists/{id}/plays\", playsHandler).Methods(\"POST\")\n\tr.Handle(\"/playlists/{id}/likes\", likesHandler).Methods(\"POST\")\n\tr.Handle(\"/playlists/{id}/dislikes\", dislikesHandler).Methods(\"POST\")\n\n\treturn r\n}", "title": "" }, { "docid": "118399eafc5f2dcdf476493c246aaa35", "score": "0.68686384", "text": "func newHandler(s Story) http.Handler {\n\treturn handler{s}\n}", "title": "" }, { "docid": "8127a6d821a201564ada220c2ec59e93", "score": "0.68498814", "text": "func (a *API) buildHandler() {\n\twalletEnable := false\n\tm := http.NewServeMux()\n\tm.Handle(\"/v1/version\", jsonHandler(a.getVersion))\n\tm.Handle(\"/v1/compile/bin\", jsonHandler(a.getBin))\n\tm.Handle(\"/v1/compile/shift\", jsonHandler(a.getShift))\n\tm.Handle(\"/v1/compile/instance\", jsonHandler(a.getInstance))\n\tm.Handle(\"/v1/compile/ast\", jsonHandler(a.getAst))\n\tm.Handle(\"/v1/tool/decode-program\", jsonHandler(a.decodeProgram))\n\tm.Handle(\"/v1/tool/addr-to-script\", jsonHandler(a.addressToScript))\n\t// m.HandleFunc(\"/v1/compile/bin\", a.corsHandler)\n\t// m.HandleFunc(\"/v1/compile/shift\", a.corsHandler)\n\t// m.HandleFunc(\"/v1/compile/instance\", a.corsHandler)\n\t// m.HandleFunc(\"/v1/compile/ast\", a.corsHandler)\n\t// 设置静态目录\n\tpath := \"../ide/dist\"\n\tfsh := http.FileServer(http.Dir(path))\n\tm.Handle(\"/\", http.StripPrefix(\"/\", fsh))\n\n\t// 设置静态目录\n\tm.Handle(\"/lib/\", http.StripPrefix(\"/lib/\", http.FileServer(http.Dir(\"../ide/lib\"))))\n\n\thandler := latencyHandler(m, walletEnable)\n\thandler = gzip.Handler{Handler: handler}\n\n\ta.handler = handler\n}", "title": "" }, { "docid": "22f253fd034cff21748fbbe122c633c6", "score": "0.684586", "text": "func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tm := validPath.FindStringSubmatch(r.URL.Path) //check the title of the page to make sure it is a valid path from our regex\n\t\tif m == nil {\n\t\t\thttp.NotFound(w,r) //if the title is invalid then throw an error\n\t\t\treturn\n\t\t}\n\t\tfn(w, r, m[2]) //if the title is valid then fn will create either a view,edit, or save handler \n\t}\n\t//by taking in the titles here we have saved ourselves lots of needless code in the actual handlers\n}", "title": "" }, { "docid": "5a1efde6a981ff0ebe50cd3e69decb7a", "score": "0.6843202", "text": "func MakeHandler(service Service, logger kitlog.Logger) http.Handler {\n\n\tr := mux.NewRouter()\n\n\topts := []kithttp.ServerOption{\n\t\tkithttp.ServerErrorHandler(transport.NewLogErrorHandler(logger)),\n\t\tkithttp.ServerErrorEncoder(encodeError),\n\t}\n\n\tcreateMessageHandler := kithttp.NewServer(\n\t\tmakeCreateMessageEndpoint(service),\n\t\tdecodeMessageCreateRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tr.Handle(\"/messages\", createMessageHandler).Methods(\"POST\")\n\n\tcreateReplyHandler := kithttp.NewServer(\n\t\tmakeCreateReplyEndpoint(service),\n\t\tdecodeReplyCreateRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tr.Handle(\"/messages/{msgid}/replies\", createReplyHandler).Methods(\"POST\")\n\n\tgetMessageHandler := kithttp.NewServer(\n\t\tmakeQueryMessageForIdEndpoint(service),\n\t\tdecodeMessageForIdQueryRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tr.Handle(\"/messages/{msgid}\", getMessageHandler).Methods(\"GET\")\n\n\tgetUserMessagesHandler := kithttp.NewServer(\n\t\tmakeQueryMessagesForUserEndpoint(service),\n\t\tdecodeMessagesForUserQueryRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tr.Handle(\"/users/{userid}/mailbox\", getUserMessagesHandler).Methods(\"GET\")\n\n\tgetRepliesHandler := kithttp.NewServer(\n\t\tmakeQueryReplyEndpoint(service),\n\t\tdecodeReplyQueryRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tr.Handle(\"/messages/{msgid}/replies\", getRepliesHandler).Methods(\"GET\")\n\n\treturn middleware.NewHTTPInterceptor(r, logger)\n}", "title": "" }, { "docid": "effd6f49a3ea19ede0e96902cbd485c4", "score": "0.6826362", "text": "func MakeHandler(s Service) http.Handler {\n\tgetSourcesHandler := kithttp.NewServer(\n\t\tmakeGetSources(s),\n\t\tdecodeGetSourcesRequest,\n\t\tencodeResponse,\n\t\tkithttp.ServerErrorEncoder(encodeError),\n\t)\n\n\tgetSourceNotificationsHandler := kithttp.NewServer(\n\t\tmakeGetSourceNotifications(s),\n\t\tdecodeGetSourceNotificationsRequest,\n\t\tencodeResponse,\n\t\tkithttp.ServerErrorEncoder(encodeError),\n\t)\n\n\tr := mux.NewRouter()\n\n\tr.Handle(\"/api/sources\", getSourcesHandler).Methods(\"GET\")\n\tr.Handle(\"/api/sources/{sourceID}/notifications\", getSourceNotificationsHandler).Methods(\"GET\")\n\n\treturn r\n}", "title": "" }, { "docid": "7545a460d2059ffe4f69cc0f0c91b728", "score": "0.6797651", "text": "func MakeHandler(svc Service, opts []kithttp.ServerOption, responseEncoder kithttp.EncodeResponseFunc) http.Handler {\n\n\tauthMid := middleware.AuthMiddleware(svc.(*service).authenticator, \"\", \"\")\n\tinfoHandler := kithttp.NewServer(\n\t\tauthMid(makeInfoEndpoint(svc)),\n\t\tdecodeInfoRequest,\n\t\tresponseEncoder, opts...)\n\teditHandler := kithttp.NewServer(\n\t\tauthMid(makeEditEndpoint(svc)),\n\t\tdecodeEditRequest,\n\t\tresponseEncoder, opts...)\n\tr := mux.NewRouter()\n\n\tr.Handle(\"/user/v1/info\", infoHandler).Methods(\"GET\")\n\tr.Handle(\"/user/v1/edit\", editHandler).Methods(\"POST\")\n\treturn r\n}", "title": "" }, { "docid": "e384cc49df8bdd1cf49aa83e325557ac", "score": "0.67903924", "text": "func makeHandler(r *Rule) http.Handler {\n\tif h := r.Forward; h != \"\" {\n\t\treturn &httputil.ReverseProxy{\n\t\t\tDirector: func(req *http.Request) {\n\t\t\t\treq.URL.Scheme = \"https\"\n\t\t\t\treq.URL.Host = h\n\t\t\t\t// req.URL.Path = \"/boo1\" // TODO JvD - regex to change path here\n\t\t\t},\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3c76cf065025ef5a0d3ee2355e908f11", "score": "0.6781484", "text": "func MakeHandler() {\n\tr := router.Get()\n\tr.GET(\"/:key_prefix/:key_suffix\", middleware.Auth(controllers.GetKey))\n}", "title": "" }, { "docid": "876eddd447b4bcbc5292d7a6d307dcd8", "score": "0.6777148", "text": "func MakeHTTPSHandler(s Service) http.Handler {\n\tr := chi.NewRouter()\n\n\t// Registrar jerarquia\n\taddJerarquiaHandler := kithttp.NewServer(\n\t\tmakeAddJerarquiaEndPoint(s),\n\t\taddJerarquiaRequestDecoder,\n\t\tkithttp.EncodeJSONResponse,\n\t)\n\tr.Method(http.MethodPost, \"/registrar\", addJerarquiaHandler)\n\n\t// Agregar una jerarquia padre\n\taddJerarquiaParentByIDHandler := kithttp.NewServer(\n\t\tmakeAddJerarquiaParentByIDEndPoint(s),\n\t\taddJerarquiaParentByIDRequestDecoder,\n\t\tkithttp.EncodeJSONResponse,\n\t)\n\tr.Method(http.MethodPost, \"/agregarJerarquiaPadre\", addJerarquiaParentByIDHandler)\n\n\t// Buscar jerarquia padre por el ID\n\tgetJerarquiaByIDHandler := kithttp.NewServer(\n\t\tmakeGetJerarquiaByIDEndPoint(s),\n\t\tgetJerarquiaByIDRequestDecoder,\n\t\tkithttp.EncodeJSONResponse,\n\t)\n\tr.Method(http.MethodGet, \"/id/{id}\", getJerarquiaByIDHandler)\n\n\t// Obtener todas las jerarquias\n\tgetAllJerarquiaHandler := kithttp.NewServer(\n\t\tmakeGetAllJerarquiaEndPoint(s),\n\t\tgetAllJerarquiaRequestDecoder,\n\t\tkithttp.EncodeJSONResponse,\n\t)\n\tr.Method(http.MethodGet, \"/allJerarquia\", getAllJerarquiaHandler)\n\n\treturn r\n}", "title": "" }, { "docid": "ed6046a994e83a04a0d2593bcc77023f", "score": "0.6764746", "text": "func MakeHandler(f HandlerFunc, middlewares ...middlewareFunc) http.HandlerFunc {\n\tfor _, m := range middlewares {\n\t\tf = m(f)\n\t}\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := &Context{}\n\t\tctx.R = r\n\t\tif err := f(w, ctx); err != nil {\n\t\t\tlog.Printf(\"%s %s: error: %v\", r.Method, r.URL.Path, err)\n\t\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5ad21600df4c1bb0fa6476ff3ebf8641", "score": "0.67234266", "text": "func (h *RequestHandler) createHandlers() error {\n\tctx := context.Background()\n\tmux := denco.NewMux()\n\n\ttx, err := h.db.Begin(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer tx.Rollback(ctx)\n\n\troutes, err := h.Schema.LoadRoutes(ctx, tx, h.SearchPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thandlers := make([]denco.Handler, 0, len(routes))\n\n\tfor _, r := range routes {\n\t\tvar jsonConstants *jason.Object\n\t\tjsonConstants, err = jason.NewObjectFromBytes(r.RawConstants)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.RawConstants = nil\n\n\t\tr.Constants, err = prepareArgumentsFromObject(jsonConstants, r.ParametersTypes, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif h.Verbose {\n\t\t\tlog.Printf(\"Loading route, method: %s, url: %s, target: %s type: %s\", r.Method, r.UrlPath, r.ObjectName, r.ObjectType)\n\t\t}\n\n\t\tvar routeHandler denco.HandlerFunc = nil\n\n\t\tswitch r.ObjectType {\n\t\tcase \"relation\":\n\t\t\tswitch r.Method {\n\t\t\tcase \"get\", \"delete\":\n\t\t\t\trouteHandler = h.makeNonBatchRouteHandler(r)\n\t\t\tcase \"post\", \"put\":\n\t\t\t\trouteHandler = h.makeBatchRouteHandler(r)\n\t\t\tdefault:\n\t\t\t\treturn errors.New(\"Unknown HTTP method \" + r.Method)\n\t\t\t}\n\t\tcase \"procedure\":\n\t\t\tif r.Method == \"get\" && (r.Provolatile != 'i' && r.Provolatile != 's') {\n\t\t\t\treturn errors.New(\"Procedure '\" + r.ObjectName + \"' must be immutable or stable for use in GET routes.\")\n\t\t\t}\n\t\t\trouteHandler = h.makeProcedureRouteHandler(r)\n\t\t}\n\n\t\thandlers = append(handlers, mux.Handler(strings.ToUpper(r.Method), r.UrlPath, routeHandler))\n\t}\n\n\thandler, err := mux.Build(handlers)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thandler = CatchingHandler(handler)\n\n\tif h.reqLogFile != nil {\n\t\thandler = gorilla.LoggingHandler(h.reqLogFile, handler)\n\t}\n\n\tatomic.StorePointer(&h.handler, unsafe.Pointer(&handler))\n\n\treturn nil\n}", "title": "" }, { "docid": "a045a9c070ac2ea87b2c9be6c2db7755", "score": "0.6713809", "text": "func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\ttitle, err := getTitle(w, r)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tfn(w, r, title)\n\t}\n}", "title": "" }, { "docid": "bb77b1e20bc88f9f851808bcfb31b9bd", "score": "0.67048573", "text": "func MakeHandler(logger kitlog.Logger, opts ...kithttp.ServerOption) http.Handler {\n\te := endpoint.Get()\n\n\tserverInfo := server.HTTPOption{\n\t\tDecodeModel: nil,\n\t\tLogger: &server.Logger{\n\t\t\tLogger: logger,\n\t\t\tNamespace: \"test\",\n\t\t\tSubsystem: \"test\",\n\t\t\tAction: \"GET\",\n\t\t},\n\t\tEncodeFunc: fazzkithttp.EncodeCSV,\n\t}\n\n\treturn server.NewHTTPServer(e, serverInfo, opts...)\n}", "title": "" }, { "docid": "61f39ae139607cd05ef5af8d3e2d08e6", "score": "0.6680137", "text": "func MakeHandler(appEnv appenv.AppEnv, fn func(http.ResponseWriter, *http.Request, appenv.AppEnv)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfn(w, r, appEnv)\n\t}\n}", "title": "" }, { "docid": "7ebd4a970185269c3d1c28ddd578a684", "score": "0.6651028", "text": "func (c *Client) NewHandler(service string, v interface{}) {\n\tc.Lock()\n\tdefer c.Unlock()\n\tc.svc[service] = v // save the handler object\n\tc.handlers, c.inputs, c.outputs = Methods(service, v)\n\tfor name := range c.handlers {\n\t\tlog.Info().Str(\"name\", c.handlers[name].String()).Msg(\"+++ \")\n\t}\n}", "title": "" }, { "docid": "bfaf2aad56eb2097c80331a0094ef74e", "score": "0.66420263", "text": "func createHandler() http.Handler {\n\ts := server{}\n\n\tvar router = mux.NewRouter()\n\n\trouter.HandleFunc(\"/\", s.postPlaybookAction).Methods(\"POST\")\n\trouter.HandleFunc(\"/\", s.getPlaybookActions).Methods(\"GET\")\n\n\treturn router\n}", "title": "" }, { "docid": "24ff77670652aab2a3e13483361ace0e", "score": "0.6630562", "text": "func MakeHandler(bs Service, logger kitlog.Logger) http.Handler {\n\topts := []kithttp.ServerOption{\n\t\tkithttp.ServerErrorLogger(logger),\n\t\tkithttp.ServerErrorEncoder(encodeError),\n\t}\n\n\tgetAuthorityHandler := kithttp.NewServer(\n\t\tmakeGetAuthorityEndpoint(bs),\n\t\tdecodeGetAuthorityRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tgetAllAuthorityHandler := kithttp.NewServer(\n\t\tmakeGetAllAuthorityEndpoint(bs),\n\t\tdecodeGetAllAuthorityRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\taddAuthorityHandler := kithttp.NewServer(\n\t\tmakePostAuthorityEndpoint(bs),\n\t\tdecodePostAuthorityRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tdeleteMultiAuthorityHandler := kithttp.NewServer(\n\t\tmakeDeleteMultiAuthorityEndpoint(bs),\n\t\tdecodeDeleteMultiAuthorityRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tupdateMultiAuthorityHandler := kithttp.NewServer(\n\t\tmakePutMultiAuthorityEndpoint(bs),\n\t\tdecodePutMultiAuthorityRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t)\n\n\tr := mux.NewRouter()\n\n\tr.Handle(\"/releation/v1/role/{role_id}/authority\", getAuthorityHandler).Methods(\"GET\")\n\tr.Handle(\"/releation/v1/role/authority\", getAllAuthorityHandler).Methods(\"GET\")\n\tr.Handle(\"/releation/v1/role/authority\", addAuthorityHandler).Methods(\"POST\")\n\tr.Handle(\"/releation/v1/role/authority\", deleteMultiAuthorityHandler).Methods(\"DELETE\")\n\tr.Handle(\"/releation/v1/role/authority\", updateMultiAuthorityHandler).Methods(\"PUT\")\n\treturn r\n}", "title": "" }, { "docid": "a3b1ed2041e666844e1df496fe5afda2", "score": "0.6625015", "text": "func makeMessageHandler(handleRequest requestHandler, handlePrepare prepareHandler, handleCommit commitHandler) messageHandler {\n\treturn func(msg interface{}) (reply <-chan interface{}, new bool, err error) {\n\t\tswitch msg := msg.(type) {\n\t\tcase *messages.Request:\n\t\t\toutChan := make(chan interface{})\n\t\t\treplyChan, new, err := handleRequest(msg, false)\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"Failed to handle Request message: %s\", err)\n\t\t\t\treturn nil, false, err\n\t\t\t}\n\t\t\tgo func() {\n\t\t\t\tdefer close(outChan)\n\t\t\t\tif m, more := <-replyChan; more {\n\t\t\t\t\toutChan <- m\n\t\t\t\t}\n\t\t\t}()\n\t\t\treturn outChan, new, nil\n\t\tcase *messages.Prepare:\n\t\t\tnew, err := handlePrepare(msg)\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"Failed to handle Prepare message: %s\", err)\n\t\t\t\treturn nil, false, err\n\t\t\t}\n\t\t\treturn nil, new, nil\n\t\tcase *messages.Commit:\n\t\t\tnew, err := handleCommit(msg)\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"Failed to handle Commit message: %s\", err)\n\t\t\t\treturn nil, false, err\n\t\t\t}\n\t\t\treturn nil, new, nil\n\t\tdefault:\n\t\t\tpanic(\"Unknown message type\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "20812e37e5ffacf4611c26fb8dc16f8f", "score": "0.6620945", "text": "func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {\n\n\t// Returned the loaded function with it's inputs validated.\n\treturn func(res http.ResponseWriter, req *http.Request) {\n\n\t\t// Retrieve the page name the user requested. \n\t\ttitle := req.URL.Path[lenPath:]\n\n\t\t// For security reasons, make certain that the title is valid.\n\t\tif !titleValidator.MatchString(title) {\n\t\t\thttp.NotFound(res, req)\n\t\t\treturn\n\t\t}\n\n\t\t// Call the originally requested function, passing it the validated title.\n\t\tfn(res, req, title)\n\t}\n}", "title": "" }, { "docid": "fe9a389d3b24d18db5e4f8f23fdaddd5", "score": "0.6620927", "text": "func newHandler(logger log.Logger, obj service.Handler) *handler {\n\treturn &handler{\n\t\tbaasService: obj,\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "bc322e3f08ce9a6ce971ba05d2b870aa", "score": "0.6617972", "text": "func (am AppModule) NewHandler() sdk.Handler { return nil }", "title": "" }, { "docid": "784ad19193a50e55799e419d2830aaf9", "score": "0.66108054", "text": "func CreateHandler(db, searchDB *sql.DB, house *housekeeper.House, dlc *downloader.Client) http.Handler {\n\tr := httprouter.New()\n\tfor _, h := range handlers {\n\t\t// Create local copy that we know won't change as the loop proceeds.\n\t\th := h\n\t\tr.Handle(h.method, h.path, func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t\t\tstart := time.Now()\n\t\t\tctx := &Context{\n\t\t\t\tRequest: r,\n\t\t\t\tDB: db,\n\t\t\t\tSearchDB: searchDB,\n\t\t\t\tHouse: house,\n\t\t\t\tDLClient: dlc,\n\t\t\t\twriter: w,\n\t\t\t\tparams: p,\n\t\t\t}\n\t\t\tdefer func() {\n\t\t\t\terr := recover()\n\t\t\t\tif err == nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tswitch err := err.(type) {\n\t\t\t\tcase error:\n\t\t\t\t\tctx.Err(err)\n\t\t\t\tcase stringer:\n\t\t\t\t\tctx.Err(errors.New(err.String()))\n\t\t\t\tcase string:\n\t\t\t\t\tctx.Err(errors.New(err))\n\t\t\t\tdefault:\n\t\t\t\t\tlog.Println(\"PANIC\", err)\n\t\t\t\t}\n\t\t\t\tdebug.PrintStack()\n\t\t\t}()\n\t\t\th.f(ctx)\n\t\t\tlog.Printf(\"[R] %-10s %-4s %s\\n\",\n\t\t\t\ttime.Since(start).String(),\n\t\t\t\tr.Method,\n\t\t\t\tr.URL.Path,\n\t\t\t)\n\t\t})\n\t}\n\treturn r\n}", "title": "" }, { "docid": "dca44524e23c601918214be52e9984fa", "score": "0.66000956", "text": "func MakeHandler() *Service {\n\t// initiate database connection here\n\treadDB := config.ReadPostgresDB()\n\twriteDB := config.WritePostgresDB()\n\t\n\ttodoQuery := todoQuery.NewTodoQueryPostgre(readDB, writeDB)\n\tdUseCase := todoUseCase.NewTodoUseCase(todoQuery)\n\n\treturn &Service{\n\t\tTodoUseCase: dUseCase,\n\t}\n}", "title": "" }, { "docid": "9634dca2ea6b0f8555a0cbb0246be0c5", "score": "0.65776765", "text": "func (am AppModule) NewHandler() sdk.Handler { return NewHandler(am.keeper) }", "title": "" }, { "docid": "29caa2600145cf750e51c370ad84297f", "score": "0.6543392", "text": "func MakeHandler(fn func(http.ResponseWriter, *http.Request)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tif attmpt := apiAttempt(w, r); !attmpt {\n\t\t\tfn(w, r)\n\t\t}\n\t\tcontext.Clear(r)\n\n\t}\n}", "title": "" }, { "docid": "0cef93884c097d019583fbb24f693f71", "score": "0.65395534", "text": "func NewHandler(repo Repository) *Handler {\n h := &Handler{\n Repository: repo,\n verbs: make(map[string]handlerVerb),\n resumptionToks: make(map[string]*ResumptionToken),\n }\n\n // Set the verbs\n h.verbs[\"listmetadataformats\"] = h.listMetadataFormats\n h.verbs[\"listsets\"] = h.listSets\n h.verbs[\"identify\"] = h.identify\n h.verbs[\"listidentifiers\"] = h.listIdentifiers\n h.verbs[\"listrecords\"] = h.listRecords\n h.verbs[\"getrecord\"] = h.getRecord\n\n return h\n}", "title": "" }, { "docid": "d72a564e110c415955a8b9b8d4dd2982", "score": "0.65280974", "text": "func newHandler(cfg upspin.Config, name upspin.PathName) (http.Handler, error) {\n\th := &handler{}\n\th.update = sync.NewCond(&h.mu)\n\n\tc := client.New(cfg)\n\tdir, err := c.DirServer(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdone := make(chan struct{})\n\tevents, err := dir.Watch(name, 0, done)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgo func() {\n\t\tdefer close(done)\n\t\tfor e := range events {\n\t\t\tif e.Error != nil {\n\t\t\t\tlog.Println(e.Error)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Read the latest frame.\n\t\t\tframe, err := clientutil.ReadAll(cfg, e.Entry)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Share it with viewers.\n\t\t\th.mu.Lock()\n\t\t\th.frame = frame\n\t\t\th.mu.Unlock()\n\t\t\th.update.Broadcast()\n\t\t}\n\t}()\n\n\treturn h, nil\n}", "title": "" }, { "docid": "7bb5318b9d6be70b71795d0f8a8e868b", "score": "0.65192497", "text": "func makeHandler(fn func(http.ResponseWriter, *http.Request, httprouter.Params, string)) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\t\tm := validPath.FindStringSubmatch(params.ByName(\"file\"))\n\t\tif m == nil {\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn\n\t\t}\n\t\tfn(w, r, params, m[1])\n\t}\n}", "title": "" }, { "docid": "c7acd8c20a822d4bfc72dfa0c57245fd", "score": "0.6487071", "text": "func CreateHandler(c Controller) http.Handler {\n\ts := server{\n\t\tcontroller: c,\n\t}\n\n\trouter := mux.NewRouter()\n\n\t// Broker related stuff\n\trouter.HandleFunc(\"/services\", s.ListServices).Methods(\"GET\")\n\trouter.HandleFunc(\"/services\", s.CreateService).Methods(\"POST\")\n\trouter.HandleFunc(\"/services/{service_id}\", s.GetService).Methods(\"GET\")\n\trouter.HandleFunc(\"/services/{service_id}\", s.DeleteService).Methods(\"DELETE\")\n\n\tvar handler http.Handler = router\n\treturn handler\n}", "title": "" }, { "docid": "d6afe2ec5ee82dc5d8372910581b1501", "score": "0.6480531", "text": "func MakeHandler(fn func(*http.Request, database.ConnCoordinates, ...interface{}) string, db database.ConnCoordinates, mediaType string, opts ...interface{}) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=utf-8\", mediaType))\n\t\tdata := fn(r, db, opts...)\n\t\tw.Header().Set(\"Content-Length\", fmt.Sprintf(\"%d\", len(data)))\n\t\tfmt.Fprintf(w, data)\n\t}\n}", "title": "" }, { "docid": "d6afe2ec5ee82dc5d8372910581b1501", "score": "0.6480531", "text": "func MakeHandler(fn func(*http.Request, database.ConnCoordinates, ...interface{}) string, db database.ConnCoordinates, mediaType string, opts ...interface{}) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=utf-8\", mediaType))\n\t\tdata := fn(r, db, opts...)\n\t\tw.Header().Set(\"Content-Length\", fmt.Sprintf(\"%d\", len(data)))\n\t\tfmt.Fprintf(w, data)\n\t}\n}", "title": "" }, { "docid": "d29d0c547a9a43ae850762a672a3c920", "score": "0.6478917", "text": "func makeHandler(handler func(http.ResponseWriter, *http.Request) error) http.HandlerFunc {\r\n\treturn func(w http.ResponseWriter, r *http.Request) {\r\n\t\terr := handler(w, r)\r\n\t\tif err != nil && err != errCustomNil {\r\n\t\t\tlog.Printf(\"%+v\", err)\r\n\t\t}\r\n\t\tif clientError.Code != 0 {\r\n\t\t\tif r.Method == \"HEAD\" {\r\n\t\t\t\tw.Header().Set(\"Content-Type\", contentTypeJSON)\r\n\t\t\t\tw.WriteHeader(clientError.Code)\r\n\t\t\t} else {\r\n\t\t\t\tresponseError(w)\r\n\t\t\t}\r\n\t\t}\r\n\t\tclientError.Code = 0\r\n\t\tclientError.Text = \"\"\r\n\t}\r\n}", "title": "" }, { "docid": "6543aed99667bc1e960066450f0ec986", "score": "0.6472418", "text": "func (a *api) newHandler(settings *Settings) http.Handler {\n\tvar (\n\t\tmux = http.NewServeMux()\n\t\tfileHandler = http.FileServer(http.Dir(a.assetPath))\n\t)\n\n\thandler := a.newAPIHandler()\n\tCSRFHandler := newCSRFHandler(a.dataPath)\n\n\tmux.Handle(\"/\", fileHandler)\n\tmux.Handle(\"/dockerapi/\", http.StripPrefix(\"/dockerapi\", handler))\n\tmux.Handle(\"/ws/exec\", websocket.Handler(a.execContainer))\n\tmux.HandleFunc(\"/settings\", func(w http.ResponseWriter, r *http.Request) {\n\t\tsettingsHandler(w, r, settings)\n\t})\n\tmux.HandleFunc(\"/templates\", func(w http.ResponseWriter, r *http.Request) {\n\t\ttemplatesHandler(w, r, a.templatesURL)\n\t})\n\treturn CSRFHandler(newCSRFWrapper(mux))\n}", "title": "" }, { "docid": "9cb6439485b96ce3bc30c6f6b0e56e88", "score": "0.64642787", "text": "func newHandler(k8sCli kubernetes.Interface, logger log.Logger) *handler {\n\treturn &handler{\n\t\tpipelineService: pipelinev1alpha1.NewPipeline(k8sCli, logger),\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "7c32401215f821a0dbf57797531f785c", "score": "0.6462843", "text": "func (s *Server) MakeHandler() http.Handler {\n\tr := mux.NewRouter()\n\n\tr.HandleFunc(\"/api/team/{teamID}\", s.auth.Authenticate(s.handleGetTeam)).Methods(http.MethodGet)\n\tr.HandleFunc(\"/api/team/\", s.auth.Authenticate(s.handleGetAllTeams)).Methods(http.MethodGet)\n\tr.HandleFunc(\"/api/team/\", s.auth.Authenticate(s.handlePostTeam)).Methods(http.MethodPost)\n\tr.HandleFunc(\"/api/team/{teamID}\", s.auth.Authenticate(s.handlePutTeam)).Methods(http.MethodPut)\n\n\tr.HandleFunc(\"/api/period/{teamID}/{periodID}\", s.auth.Authenticate(s.handleGetPeriod)).Methods(http.MethodGet)\n\tr.HandleFunc(\"/api/period/{teamID}/\", s.auth.Authenticate(s.handleGetAllPeriods)).Methods(http.MethodGet)\n\tr.HandleFunc(\"/api/period/{teamID}/\", s.auth.Authenticate(s.handlePostPeriod)).Methods(http.MethodPost)\n\tr.HandleFunc(\"/api/period/{teamID}/{periodID}\", s.auth.Authenticate(s.handlePutPeriod)).Methods(http.MethodPut)\n\n\tr.HandleFunc(\"/improve\", s.handleImprove).Methods(http.MethodGet)\n\n\treturn r\n}", "title": "" }, { "docid": "89cdafceca40a00850a5a452b4ed0a09", "score": "0.6461644", "text": "func MakeHTTPSHandler(s Service) http.Handler {\n\tr := chi.NewRouter()\n\n\t//Agregar rol\n\taddRolHandler := kithttp.NewServer(\n\t\tmakeAddRolEndPoint(s),\n\t\taddRolRequestDecoder,\n\t\tkithttp.EncodeJSONResponse,\n\t)\n\tr.Method(http.MethodPost, \"/registrar\", addRolHandler)\n\n\t//Actualizar rol\n\tupdateRolHandler := kithttp.NewServer(\n\t\tmakeUpdateRolEndPoint(s),\n\t\tupdateRolRequestDecoder,\n\t\tkithttp.EncodeJSONResponse,\n\t)\n\tr.Method(http.MethodPut, \"/actualizar\", updateRolHandler)\n\n\t//Obtener rol por id\n\tgetRolByIDHandler := kithttp.NewServer(\n\t\tmakeGetRolByIDEndPoint(s),\n\t\tgetRolByIDRequestDecoder,\n\t\tkithttp.EncodeJSONResponse,\n\t)\n\tr.Method(http.MethodGet, \"/id/{id}\", getRolByIDHandler)\n\n\t//Obtener todos los roles\n\tgetAllRolHandler := kithttp.NewServer(\n\t\tmakeGetAllRolEndPoint(s),\n\t\tgetAllRolRequestDecoder,\n\t\tkithttp.EncodeJSONResponse,\n\t)\n\tr.Method(http.MethodGet, \"/allRoles\", getAllRolHandler)\n\n\treturn r\n}", "title": "" }, { "docid": "30dba209565800da6518785c028dc34c", "score": "0.64348227", "text": "func handler() http.Handler {\n\tr := http.NewServeMux()\n\tr.HandleFunc(\"/add\", addHandler)\n\treturn r\n}", "title": "" }, { "docid": "0943f939dd47e2cd17a41577e133b1c4", "score": "0.6423858", "text": "func newHandler(logWriter io.Writer) lambdah.HandlerFunc {\n\treturn lambdah.HandlerFunc(func(c *lambdah.Context) error {\n\t\tvar data eventData\n\t\terr := c.Bind(&data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlog.LoggerFromContext(c.Context).\n\t\t\tInfo().\n\t\t\tMsgf(\"name received: %s\", data.Name)\n\n\t\tc.Response = \"ok\"\n\n\t\treturn nil\n\t}).Middleware(\n\t\tlambdah.CorrelationIDMiddleware(),\n\t\tlambdah.LoggerMiddleware(logWriter, map[string]string{\n\t\t\t\"appName\": \"lambdahExamples\",\n\t\t\t\"functionName\": \"genericMiddlewareExample\",\n\t\t}),\n\t)\n}", "title": "" }, { "docid": "bad8bfc045a47e3e0d1b57e23af9042e", "score": "0.641321", "text": "func newHandler(h http.Handler) *ClawHandler {\n\treturn &ClawHandler{h}\n}", "title": "" }, { "docid": "4414c48a4f34627a9b0ce0b4daa5bdf5", "score": "0.64095014", "text": "func MakeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tm := validPath.FindStringSubmatch(r.URL.Path)\n\t\tif m == nil {\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn\n\t\t}\n\t\tfn(w, r, m[2])\n\t}\n}", "title": "" }, { "docid": "4ab21877f1c346a16ab54063e6a790d2", "score": "0.64066094", "text": "func MakeHandler() http.Handler {\n\tn := middlewares.GetApp()\n\tr := router.Get()\n\tvalidateController := controllers.NewValidate()\n\tr.HandleFunc(\"/api/v1/validate/request\", validateController.Request).Methods(\"POST\")\n\tr.HandleFunc(\"/api/v1/validate/response\", validateController.Response).Methods(\"POST\")\n\tr.NotFoundHandler = http.HandlerFunc(NotFound)\n\n\tn.UseHandler(r)\n\treturn n\n}", "title": "" }, { "docid": "41a0859d0c1ad48fb07e45323725bdf0", "score": "0.63887376", "text": "func createHandler(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tdist := vars[\"dist\"]\n\tw.Write(marshalCreate(dist))\n}", "title": "" }, { "docid": "f38debae3b86701474996b5ae1f9aa40", "score": "0.6385616", "text": "func newHandler(f handlerFunc, db *dbContext) *handler {\n\treturn &handler{f, db}\n}", "title": "" }, { "docid": "0d1bdf29a775cf3320d71828ff6a296b", "score": "0.63720506", "text": "func (t *tinkerforge) handler(uid uint32, funcID, seqNum uint8, h Handler) {\n\tt.handlersMutex.Lock()\n\tdefer t.handlersMutex.Unlock()\n\n\t// Make the handler removable\n\tif h == nil {\n\t\tdelete(t.handlers, handlerIDFromParam(uid, funcID, seqNum))\n\t\treturn\n\t}\n\n\t// Add handler\n\tt.handlers[handlerIDFromParam(uid, funcID, seqNum)] = h\n}", "title": "" }, { "docid": "afe67d7895c7817d2e92be38365d5442", "score": "0.6366387", "text": "func GenerateHandler(handler func(request map[string]interface{}, username string) interface{}) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// set headers for CORS\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST\") // optional add: GET, PUT, DELETE\n\n\t\t// set header code\n\t\tw.WriteHeader(200)\n\n\t\t// write response\n\t\tresponse := handler(read(r.Body, r.ContentLength), \"\")\n\t\tif err, isErr := response.(error); isErr {\n\t\t\t// write error string\n\t\t\twriteMap(w, map[string]interface{}{\"error\": err.Error()})\n\t\t} else if resp, isByte := response.([]byte); isByte {\n\t\t\t// write byte slice\n\t\t\twrite(w, resp)\n\t\t} else if resp, isMap := response.(map[string]interface{}); isMap {\n\t\t\t// write response map\n\t\t\twriteMap(w, resp)\n\t\t} else {\n\t\t\t// unknown response type\n\t\t\twrite(w, []byte(`{\"error\": \"unknwon response type\"}`))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "19e80675978b39968b3c1713b223ee64", "score": "0.6357798", "text": "func MakeHTTPHandler(e Endpoints, logger log.Logger, tracer stdopentracing.Tracer) *mux.Router {\n\tr := mux.NewRouter().StrictSlash(false)\n\toptions := []httptransport.ServerOption{\n\t\thttptransport.ServerErrorLogger(logger),\n\t\thttptransport.ServerErrorEncoder(encodeError),\n\t}\n\n\t// GET /login Login\n\t// GET /register Register\n\t// GET /health Health Check\n\n\tr.Methods(\"GET\").Path(\"/login\").Handler(httptransport.NewServer(\n\t\te.LoginEndpoint,\n\t\tdecodeLoginRequest,\n\t\tencodeResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"GET /login\", logger)))...,\n\t))\n\tr.Methods(\"POST\").Path(\"/register\").Handler(httptransport.NewServer(\n\t\te.RegisterEndpoint,\n\t\tdecodeRegisterRequest,\n\t\tencodeResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"POST /register\", logger)))...,\n\t))\n\tr.Methods(\"GET\").PathPrefix(\"/customers\").Handler(httptransport.NewServer(\n\t\te.UserGetEndpoint,\n\t\tdecodeGetRequest,\n\t\tencodeResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"GET /customers\", logger)))...,\n\t))\n\tr.Methods(\"GET\").PathPrefix(\"/cards\").Handler(httptransport.NewServer(\n\t\te.CardGetEndpoint,\n\t\tdecodeGetRequest,\n\t\tencodeResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"GET /cards\", logger)))...,\n\t))\n\tr.Methods(\"GET\").PathPrefix(\"/addresses\").Handler(httptransport.NewServer(\n\t\te.AddressGetEndpoint,\n\t\tdecodeGetRequest,\n\t\tencodeResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"GET /addresses\", logger)))...,\n\t))\n\tr.Methods(\"POST\").Path(\"/customers\").Handler(httptransport.NewServer(\n\t\te.UserPostEndpoint,\n\t\tdecodeUserRequest,\n\t\tencodeResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"POST /customers\", logger)))...,\n\t))\n\tr.Methods(\"POST\").Path(\"/addresses\").Handler(httptransport.NewServer(\n\t\te.AddressPostEndpoint,\n\t\tdecodeAddressRequest,\n\t\tencodeResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"POST /addresses\", logger)))...,\n\t))\n\tr.Methods(\"POST\").Path(\"/cards\").Handler(httptransport.NewServer(\n\t\te.CardPostEndpoint,\n\t\tdecodeCardRequest,\n\t\tencodeResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"POST /cards\", logger)))...,\n\t))\n\tr.Methods(\"DELETE\").PathPrefix(\"/\").Handler(httptransport.NewServer(\n\t\te.DeleteEndpoint,\n\t\tdecodeDeleteRequest,\n\t\tencodeResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"DELETE /\", logger)))...,\n\t))\n\tr.Methods(\"GET\").PathPrefix(\"/health\").Handler(httptransport.NewServer(\n\t\te.HealthEndpoint,\n\t\tdecodeHealthRequest,\n\t\tencodeHealthResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"GET /health\", logger)))...,\n\t))\n\tr.Handle(\"/metrics\", promhttp.Handler())\n\treturn r\n}", "title": "" }, { "docid": "b308e12f34aaf427ef9a0c0a83697529", "score": "0.6355733", "text": "func MakeHTTPHandler(e EndPoints, logger log.Logger, tracer stdopentracing.Tracer) *mux.Router {\n\tr := mux.NewRouter().StrictSlash(false)\n\toptions := []httptransport.ServerOption{\n\t\thttptransport.ServerErrorLogger(logger),\n\t\thttptransport.ServerErrorEncoder(encodeError),\n\t\thttptransport.ServerBefore(before),\n\t\thttptransport.ServerAfter(after),\n\t}\n\n\tr.Methods(\"POST\").Path(\"/user/signup\").Handler(httptransport.NewServer(\n\t\te.SignUpEndpoint,\n\t\tdecodeSignUpRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t// append(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"POST /user/signup\", logger)))...,\n\t))\n\n\tr.Methods(\"POST\").Path(\"/user/signin\").Handler(httptransport.NewServer(\n\t\te.SignInEndpoint,\n\t\tdecodeSignInRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t// append(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"POST /user/signin\", logger)))...,\n\t))\n\n\tr.Methods(\"GET\").Path(\"/user/{username}\").Handler(httptransport.NewServer(\n\t\te.GetUserEndpoint,\n\t\tdecodeGetUserRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t// append(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"GET /user/{username}\", logger), validateJwt))..., // require jwt in context\n\t))\n\n\tr.Methods(\"GET\").Path(\"/user/confirm/{username}/{code}\").Handler(httptransport.NewServer(\n\t\te.ConfirmSignUpEndpoint,\n\t\tdecodeConfirmSignUpRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\n\tr.Methods(\"POST\").Path(\"/user/forgot_password\").Handler(httptransport.NewServer(\n\t\te.ForgotPasswordEndpoint,\n\t\tdecodeForgotPasswordRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\n\tr.Methods(\"POST\").Path(\"/user/reset_password\").Handler(httptransport.NewServer(\n\t\te.ConfirmForgotPasswordEndpoint,\n\t\tdecodeConfirmForgotPasswordRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\n\tr.Methods(\"POST\").Path(\"/user/change_password\").Handler(httptransport.NewServer(\n\t\te.ChangePasswordEndpoint,\n\t\tdecodeChangePasswordRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\n\tr.Methods(\"POST\").Path(\"/user/validate_token\").Handler(httptransport.NewServer(\n\t\te.ValidateTokenEndpoint,\n\t\tdecodeValidateJwtTokenRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\n\treturn r\n}", "title": "" }, { "docid": "be8022cdfdd38fe17a0842acad121e4d", "score": "0.6351822", "text": "func MakeHandler(packet []byte, fs *FileSystem) (PacketHandler, error) {\n\tif len(packet) < 2 {\n\t\treturn nil, fmt.Errorf(\"Packet too short\")\n\t}\n\n\topcode := ConvertToUInt16(packet[:2])\n\n\tswitch opcode {\n\tcase PKT_RRQ:\n\t\treturn MakeReadSession(fs), nil\n\tcase PKT_WRQ:\n\t\treturn MakeWriteSession(fs), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Session must start with RRQ or RWQ\")\n\t}\n}", "title": "" }, { "docid": "1cfe408e786615f5f188506c90a6c01e", "score": "0.63450193", "text": "func NewHandler(k Keeper) sdk.Handler {\r\n\treturn func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {\r\n\t\tctx = ctx.WithEventManager(sdk.NewEventManager())\r\n\t\tswitch msg := msg.(type) {\r\n\t\t// TODO: Define your msg cases\r\n\t\t// \r\n\t\t//Example:\r\n\t\t// case Msg<Action>:\r\n\t\t// \treturn handleMsg<Action>(ctx, k, msg)\r\n\t\tcase MsgCreateArticle:\r\n\t\t\treturn handleMsgCreateArticle(ctx, k, msg)\r\n\t\r\n\t\tcase MsgCreateComment:\r\n\t\t\treturn handleMsgCreateComment(ctx, k, msg)\r\n\t\r\n\t\tcase MsgCreateReturnVisit:\r\n\t\t\treturn handleMsgCreateReturnVisit(ctx, k, msg)\r\n\t\t\r\n\t\tcase MsgCreateAVote:\r\n\t\t\treturn handleMsgCreateAVote(ctx, k, msg)\r\n\r\n\t\tcase MsgCreateCVote:\r\n\t\t\treturn handleMsgCreateCVote(ctx, k, msg)\t\t\r\n\t\t\t\r\n\t\tdefault:\r\n\t\t\terrMsg := fmt.Sprintf(\"unrecognized %s message type: %T\", ModuleName, msg)\r\n\t\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "014e403b1d1d6cbfd3915cc5431cef4d", "score": "0.63341284", "text": "func handle(w http.ResponseWriter, req *http.Request, handler http.HandlerFunc, middleware []MiddlewareType) {\n\tvar baseHandler = handler\n\tfor _, m := range middleware {\n\t\tbaseHandler = m(baseHandler)\n\t}\n\n\tbaseHandler(w, req)\n}", "title": "" }, { "docid": "5a6b3f283e26c46efbc56c846e0f3d59", "score": "0.6311612", "text": "func (fn RPCClientFunc) MakeHandler(spec RPCSpec) RPCHandler {\n\treturn fn(spec)\n}", "title": "" }, { "docid": "6cc9ec203986e4cb8178a037596a23ea", "score": "0.6303544", "text": "func (client *RPCClientWithMWs) MakeHandler(spec RPCSpec) RPCHandler {\n\thandler := client.client.MakeHandler(spec)\n\tfor i := len(client.mws) - 1; i >= 0; i-- {\n\t\thandler = client.mws[i](spec, handler)\n\t}\n\treturn handler\n}", "title": "" }, { "docid": "8c9c12220d7d8f25e8efff1da3fd7879", "score": "0.629649", "text": "func NewHandler(svc vcsstore.Service, parent *mux.Router, wrap func(http.Handler) http.Handler) *Handler {\n\trouter := vcsclient.NewRouter(parent)\n\tr := (*mux.Router)(router)\n\n\tif wrap == nil {\n\t\twrap = func(h http.Handler) http.Handler { return h }\n\t}\n\n\th := &Handler{\n\t\tService: svc,\n\t\trouter: router,\n\t\tLog: log.New(ioutil.Discard, \"\", 0),\n\t}\n\n\tr.Get(vcsclient.RouteRoot).Handler(wrap(handler{h, h.serveRoot}))\n\tr.Get(vcsclient.RouteRepo).Handler(wrap(handler{h, h.serveRepo}))\n\tr.Get(vcsclient.RouteRepoCreateOrUpdate).Handler(wrap(handler{h, h.serveRepoCreateOrUpdate}))\n\tr.Get(vcsclient.RouteRepoBranch).Handler(wrap(handler{h, h.serveRepoBranch}))\n\tr.Get(vcsclient.RouteRepoBranches).Handler(wrap(handler{h, h.serveRepoBranches}))\n\tr.Get(vcsclient.RouteRepoCommit).Handler(wrap(handler{h, h.serveRepoCommit}))\n\tr.Get(vcsclient.RouteRepoCommits).Handler(wrap(handler{h, h.serveRepoCommits}))\n\tr.Get(vcsclient.RouteRepoRevision).Handler(wrap(handler{h, h.serveRepoRevision}))\n\tr.Get(vcsclient.RouteRepoTag).Handler(wrap(handler{h, h.serveRepoTag}))\n\tr.Get(vcsclient.RouteRepoTags).Handler(wrap(handler{h, h.serveRepoTags}))\n\tr.Get(vcsclient.RouteRepoTreeEntry).Handler(wrap(handler{h, h.serveRepoTreeEntry}))\n\n\treturn h\n}", "title": "" }, { "docid": "1d1533158dfacbd9adce863a97e1873d", "score": "0.629323", "text": "func HandlerFactory(options plugin_v1.HandlerOptions) plugin_v1.Handler {\n\thandler := &Handler{\n\t\tBaseHandler: plugin_v1.NewBaseHandler(options),\n\t}\n\n\thandler.Run()\n\n\treturn handler\n}", "title": "" }, { "docid": "1d1533158dfacbd9adce863a97e1873d", "score": "0.629323", "text": "func HandlerFactory(options plugin_v1.HandlerOptions) plugin_v1.Handler {\n\thandler := &Handler{\n\t\tBaseHandler: plugin_v1.NewBaseHandler(options),\n\t}\n\n\thandler.Run()\n\n\treturn handler\n}", "title": "" }, { "docid": "c39946a17289f72468f8d54391283f2c", "score": "0.6292296", "text": "func handler(h interface{}) http.Handler {\n\tswitch h.(type) {\n\tcase func(w http.ResponseWriter, r *http.Request):\n\t\treturn http.HandlerFunc(h.(func(w http.ResponseWriter, r *http.Request)))\n\tcase http.Handler:\n\t\treturn h.(http.Handler)\n\tdefault:\n\t\tpanic(\"invalid handler\")\n\t}\n}", "title": "" }, { "docid": "7e6f7103727013c557874208afc9258c", "score": "0.62863564", "text": "func NewHandler(r Register, bt BodyTransformer, dflt Body, server string) *Handler {\n\th := new(Handler)\n\th.r = r\n\th.bt = bt\n\th.dflt = dflt\n\th.server = server\n\treturn h\n}", "title": "" }, { "docid": "1e3ecfb171da7362e7d452254df1b195", "score": "0.6282467", "text": "func handler(fn func(w http.ResponseWriter, r *http.Request)) http.Handler {\n\tvar h http.Handler = http.HandlerFunc(fn)\n\tif httpPrefix != \"/\" {\n\t\th = http.StripPrefix(httpPrefix, h)\n\t}\n\tif wrapHandler != nil {\n\t\th = wrapHandler(h)\n\t}\n\treturn h\n}", "title": "" }, { "docid": "9ff4cce06858b1874056fc628d9159e1", "score": "0.62796676", "text": "func (svr *TypeServer) mainHandler(w http.ResponseWriter, r *http.Request) {\n\tnewW := newResponseWriter(w)\n\tnewR := &Request{r, map[string]interface{}{}}\n\n\t// go through server middleware\n\tfor _, middleware := range svr.middlewares {\n\t\tif !middleware.matchPath(r.URL.Path) {\n\t\t\tcontinue\n\t\t}\n\n\t\tnewR.MiddlewareValues[middleware.Name] = middleware.Handler(newW, newR, middleware.Config)\n\t\tif newW.Done {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// search route\n\troute := svr.rootRoute\n\tif r.URL.Path != \"/\" {\n\t\tsegs := D.String(r.URL.Path).TrimPrefix(\"/\").Split(\"/\").Get()\n\t\tfor _, seg := range segs {\n\t\t\tnext := route.GetSubSegment(seg)\n\t\t\tif next == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\troute = next\n\t\t}\n\t}\n\n\t// run middlewares\n\tfor _, middleware := range route.middlewares {\n\t\tif !middleware.matchPath(r.URL.Path) {\n\t\t\tcontinue\n\t\t}\n\n\t\tnewR.MiddlewareValues[middleware.Name] = middleware.Handler(newW, newR, middleware.Config)\n\t\tif newW.Done {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// get handler\n\thandler, ok := route.methodHandlers[r.Method]\n\tif !ok {\n\t\thandler = route.methodHandlers[\"Default\"]\n\t}\n\n\t// run handler\n\tif handler != nil {\n\t\thandler(newW, newR)\n\t}\n}", "title": "" }, { "docid": "4d510b295406c478547f2e1cba4aeaba", "score": "0.62718105", "text": "func MakeAppHandler(ah internal.AppHandler) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tresponse, status, err := ah.HandlerFn(ah.AppContext, r)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"HTTP %d: %q\", status, err)\n\t\t\tswitch status {\n\t\t\tcase http.StatusNotFound:\n\t\t\t\thttp.NotFound(w, r)\n\t\t\tcase http.StatusInternalServerError:\n\t\t\t\thttp.Error(w, http.StatusText(status), status)\n\t\t\tcase http.StatusOK:\n\t\t\t\tjson.NewEncoder(w).Encode(response)\n\t\t\tdefault:\n\t\t\t\thttp.Error(w, http.StatusText(status), status)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4b03bd37128b6a0f003e3d01ea11690d", "score": "0.6262768", "text": "func makeHandler(fn func(w http.ResponseWriter, r *http.Request, title string)) http.HandlerFunc {\n\t//return a function that uses the validPath expression\n\t//to validate path and extract the page title\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tm := validPath.FindStringSubmatch(r.URL.Path)\n\t\tif m == nil {\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn\n\t\t}\n\t\t//it returns fn(w, r, m[2]). It is called a closure,\n\t\t//because it uses variables defined outside of it\n\t\tfn(w, r, m[2]) // m[2] is for submatch group 2: title.\n\t}\n}", "title": "" }, { "docid": "e0f3435aa75f669e4f177b73f97603ff", "score": "0.6256749", "text": "func MakeHTTPHandler(ctx context.Context, svc Service, logger log.Logger) http.Handler {\n\tr := mux.NewRouter()\n\te := MakeServerEndpoints(svc)\n\n\t// These options are same for addsvc.. hmm\n\toptions := []httptransport.ServerOption{\n\t\thttptransport.ServerErrorLogger(logger),\n\t\thttptransport.ServerErrorEncoder(encodeError),\n\t}\n\n\t// POST / posts by user ID a score, which is saved when greater than existing\n\t// GET /:id returns a score by id\n\tr.Methods(\"POST\").Path(\"/\").Handler(httptransport.NewServer(\n\t\tctx,\n\t\te.PostScoreEndpoint,\n\t\tdecodePostScoreRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\tr.Methods(\"GET\").Path(\"/{id}\").Handler(httptransport.NewServer(\n\t\tctx,\n\t\te.GetScoreEndpoint,\n\t\tdecodeGetScoreRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\treturn r\n}", "title": "" }, { "docid": "8234e0e6ebb7129429442af5a821b30e", "score": "0.6243923", "text": "func newHandler(rs rosterStore, ps playerStore, timeout time.Duration, logger zerolog.Logger) (http.Handler, error) {\n\tvar mw []middleware.Middleware\n\tmw = append(mw, middleware.NewRecoverHandler())\n\tmw = append(mw, middleware.NewContextLog(logger)...)\n\n\t// services handle http requests and hold a store to operate on a database\n\trosterSrvc := middleware.Use(&rosterService{rs, timeout}, mw...)\n\tplayerSrvc := middleware.Use(&playerService{ps, timeout}, mw...)\n\n\trouter := mux.NewRouter()\n\trouter.Handle(\"/ready\", &readinessHandler{}).Methods(\"GET\")\n\n\t// roster store\n\trouter.Handle(\"/roster/{id:[0-9]+}\", rosterSrvc).Methods(\"GET\")\n\trouter.Handle(fmt.Sprintf(\"/roster/{id:[0-9]+}/{status:(?:%s|%s)}\", Active, Benched), rosterSrvc).Methods(\"GET\")\n\n\t// player store\n\trouter.Handle(\"/players/add\", playerSrvc).Methods(\"POST\")\n\trouter.Handle(\"/players/update\", playerSrvc).Methods(\"PATCH\")\n\trouter.Handle(\"/players/change\", playerSrvc).Methods(\"PATCH\")\n\n\treturn router, nil\n}", "title": "" }, { "docid": "78f50866058887c38c24bb8ccc82881e", "score": "0.62393945", "text": "func handlerWrapper(h kite.HandlerFunc) (<-chan struct{}, kite.HandlerFunc) {\n\tdoneC := make(chan struct{}, 1)\n\treturn doneC, kite.HandlerFunc(func(req *kite.Request) (interface{}, error) {\n\t\tresult, err := h(req)\n\t\tselect {\n\t\tcase doneC <- struct{}{}:\n\t\tcase <-time.After(5 * time.Second):\n\t\t\tpanic(\"invalid number of handler callas\")\n\t\t}\n\n\t\treturn result, err\n\t})\n}", "title": "" }, { "docid": "c618b9de4ec32624e28f8e82891ac561", "score": "0.6229318", "text": "func (l *LARS) wrapHandler(h Handler) HandlerFunc {\n\n\tswitch h := h.(type) {\n\tcase HandlerFunc:\n\t\treturn h\n\n\tcase func(Context):\n\t\treturn h\n\n\tcase http.Handler, http.HandlerFunc:\n\t\treturn func(c Context) {\n\n\t\t\tctx := c.BaseContext()\n\n\t\t\tif h.(http.Handler).ServeHTTP(ctx.response, ctx.request); ctx.response.status != http.StatusOK || ctx.response.committed {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif ctx.index+1 < len(ctx.handlers) {\n\t\t\t\tc.Next()\n\t\t\t}\n\t\t}\n\n\tcase func(http.ResponseWriter, *http.Request):\n\t\treturn func(c Context) {\n\n\t\t\tctx := c.BaseContext()\n\n\t\t\tif h(ctx.response, ctx.request); ctx.response.status != http.StatusOK || ctx.response.committed {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif ctx.index+1 < len(ctx.handlers) {\n\t\t\t\tc.Next()\n\t\t\t}\n\t\t}\n\n\tcase func(http.ResponseWriter, *http.Request, http.Handler):\n\n\t\treturn func(c Context) {\n\t\t\tctx := c.BaseContext()\n\n\t\t\th(ctx.response, ctx.request, NativeChainHandler)\n\t\t}\n\n\tcase func(http.Handler) http.Handler:\n\n\t\thf := h(NativeChainHandler)\n\n\t\treturn func(c Context) {\n\t\t\tctx := c.BaseContext()\n\n\t\t\thf.ServeHTTP(ctx.response, ctx.request)\n\t\t}\n\n\tdefault:\n\t\tif fn, ok := l.customHandlersFuncs[reflect.TypeOf(h)]; ok {\n\t\t\treturn func(c Context) {\n\t\t\t\tfn(c, h)\n\t\t\t}\n\t\t}\n\n\t\tpanic(\"unknown handler\")\n\t}\n}", "title": "" }, { "docid": "1dfec7a530d40d19c2a6cd4c196ea484", "score": "0.62170595", "text": "func buildHandler(t *testing.T, cfg *config.Params) (*handler, error) {\n\tinfo := GetInfo()\n\tb := info.NewBuilder().(*builder)\n\tb.SetAdapterConfig(cfg)\n\th, err := b.Build(context.Background(), test.NewEnv(t))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn h.(*handler), nil\n}", "title": "" }, { "docid": "10b2ed4874477735192c56e3eb594d4c", "score": "0.6216709", "text": "func CreateHandlers(db *database.DB, b *tb.Bot) {\n\th := &handler{\n\t\tDB: db,\n\t\tBot: b,\n\t}\n\n\tb.Handle(\"/start\", h.handleStart)\n\n\tb.Handle(\"/latest\", h.handleLatest)\n\n\tb.Handle(\"/subscribe\", h.handleSubscribe)\n\tb.Handle(\"/unsubscribe\", h.handleUnsubscribe)\n\n}", "title": "" }, { "docid": "fb4d29c027605a12bdcfebc9e8dc67d9", "score": "0.62127125", "text": "func main() {\n\thandler.RequestHandler()\n}", "title": "" }, { "docid": "56faed62ad214c2ba450d2e8d922bba3", "score": "0.6212431", "text": "func NewHandler(glob string, ag ArgGetter, fm template.FuncMap) http.Handler {\n\tif ag == nil {\n\t\tag = GetArgs\n\t}\n\tth := &handler{\n\t\tpattern: glob,\n\t\tgetArgs: ag,\n\t\tfm: fm,\n\t}\n\tth.recompileIfOlderThan(time.Time{})\n\treturn th\n}", "title": "" }, { "docid": "5f2a0c3d1e490857d07f74c307b9f101", "score": "0.6207441", "text": "func NewHandler(bouncer security.BouncerService, demoService *demo.Service) *Handler {\n\th := &Handler{\n\t\tRouter: mux.NewRouter(),\n\t\trequestBouncer: bouncer,\n\t\tdemoService: demoService,\n\t}\n\n\th.Handle(\"/endpoints\",\n\t\tbouncer.AdminAccess(httperror.LoggerHandler(h.endpointCreate))).Methods(http.MethodPost)\n\th.Handle(\"/endpoints/{id}/settings\",\n\t\tbouncer.AdminAccess(httperror.LoggerHandler(h.endpointSettingsUpdate))).Methods(http.MethodPut)\n\th.Handle(\"/endpoints/{id}/association\",\n\t\tbouncer.AdminAccess(httperror.LoggerHandler(h.endpointAssociationDelete))).Methods(http.MethodDelete)\n\th.Handle(\"/endpoints/snapshot\",\n\t\tbouncer.AdminAccess(httperror.LoggerHandler(h.endpointSnapshots))).Methods(http.MethodPost)\n\th.Handle(\"/endpoints\",\n\t\tbouncer.RestrictedAccess(httperror.LoggerHandler(h.endpointList))).Methods(http.MethodGet)\n\th.Handle(\"/endpoints/agent_versions\",\n\t\tbouncer.RestrictedAccess(httperror.LoggerHandler(h.agentVersions))).Methods(http.MethodGet)\n\th.Handle(\"/endpoints/relations\", bouncer.RestrictedAccess(httperror.LoggerHandler(h.updateRelations))).Methods(http.MethodPut)\n\n\th.Handle(\"/endpoints/{id}\",\n\t\tbouncer.RestrictedAccess(httperror.LoggerHandler(h.endpointInspect))).Methods(http.MethodGet)\n\th.Handle(\"/endpoints/{id}\",\n\t\tbouncer.AdminAccess(httperror.LoggerHandler(h.endpointUpdate))).Methods(http.MethodPut)\n\th.Handle(\"/endpoints/{id}\",\n\t\tbouncer.AdminAccess(httperror.LoggerHandler(h.endpointDelete))).Methods(http.MethodDelete)\n\th.Handle(\"/endpoints/{id}/dockerhub/{registryId}\",\n\t\tbouncer.AuthenticatedAccess(httperror.LoggerHandler(h.endpointDockerhubStatus))).Methods(http.MethodGet)\n\th.Handle(\"/endpoints/{id}/snapshot\",\n\t\tbouncer.AdminAccess(httperror.LoggerHandler(h.endpointSnapshot))).Methods(http.MethodPost)\n\th.Handle(\"/endpoints/{id}/registries\",\n\t\tbouncer.AuthenticatedAccess(httperror.LoggerHandler(h.endpointRegistriesList))).Methods(http.MethodGet)\n\th.Handle(\"/endpoints/{id}/registries/{registryId}\",\n\t\tbouncer.AuthenticatedAccess(httperror.LoggerHandler(h.endpointRegistryAccess))).Methods(http.MethodPut)\n\n\th.Handle(\"/endpoints/global-key\", bouncer.PublicAccess(httperror.LoggerHandler(h.endpointCreateGlobalKey))).Methods(http.MethodPost)\n\n\t// DEPRECATED\n\th.Handle(\"/endpoints/{id}/status\", bouncer.PublicAccess(httperror.LoggerHandler(h.endpointStatusInspect))).Methods(http.MethodGet)\n\n\treturn h\n}", "title": "" }, { "docid": "88ba79393b0c7b8198c8dfc41a4f2e17", "score": "0.6196988", "text": "func NewHandler(k *keepers.Keeper) sdk.Handler {\n\th1 := NewInternalHandler(k)\n\treturn func(ctx sdk.Context, msg sdk.Msg) sdk.Result {\n\t\t//println(\"autoswap handler ...\")\n\t\tctx = ctx.WithEventManager(sdk.NewEventManager())\n\n\t\tmsg2, ok := convertMarketMsg(msg)\n\t\tif !ok {\n\t\t\treturn dex.ErrUnknownRequest(types.ModuleName, msg)\n\t\t}\n\n\t\treturn h1(ctx, msg2)\n\t}\n}", "title": "" }, { "docid": "ac80ee0e1ec20260cafdc08f5a5d18b0", "score": "0.6196438", "text": "func (hb *HandlerBridge) CreateHandler(handler http.HandlerFunc, APICode int) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// validate the Request\n\t\tif err := newValidator(r, &hb.db, APICode)(r, &hb.db); err != nil {\n\t\t\thb.rnd.JSON(w, http.StatusForbidden, err.Error())\n\t\t\treturn\n\t\t}\n\t\thandler.ServeHTTP(w, r)\n\t}\n\n}", "title": "" }, { "docid": "4b3872012833fae02b10bd5cd139053f", "score": "0.61947834", "text": "func MakeHTTPHandler(s Service, logger log.Logger) http.Handler {\n\tr := mux.NewRouter()\n\n\toptions := []httptransport.ServerOption{\n\t\thttptransport.ServerErrorLogger(logger),\n\t\thttptransport.ServerErrorEncoder(encodeError),\n\t}\n\n\tr.Methods(\"GET\", \"POST\").Path(\"/\").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})\n\tr.Methods(\"GET\", \"POST\").Path(\"/healthz\").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})\n\n\tr.Methods(\"POST\").Path(\"/start\").Handler(httptransport.NewServer(\n\t\tMakeStartEndpoint(s),\n\t\tdecodeStartRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\n\tr.Methods(\"POST\").Path(\"/stop\").Handler(httptransport.NewServer(\n\t\tMakeStopEndpoint(s),\n\t\tdecodeStopRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\n\treturn r\n}", "title": "" }, { "docid": "b2c0c74603268ddd14f6f1bd51032137", "score": "0.6191223", "text": "func NewHandler(r *RootResource) (*Handler, error) {\n\tif err := r.Compile(); err != nil {\n\t\treturn nil, err\n\t}\n\th := &Handler{\n\t\tResponseSender: DefaultResponseSender{},\n\t\troot: r,\n\t}\n\treturn h, nil\n}", "title": "" }, { "docid": "c17c9bd66531676b19aed4fe88a63a84", "score": "0.6190961", "text": "func CreateHandler(l *infra.Logger) *Handler {\n\th := &Handler{\n\t\tlogger: l,\n\t\trouter: chi.NewRouter(),\n\t}\n\n\t// A good base middleware stack\n\th.router.Use(chimiddleware.RequestID)\n\th.router.Use(chimiddleware.RealIP)\n\th.router.Use(middleware.NewZapMiddleware(\"router\", l.Log))\n\th.router.Use(middleware.Recoverer)\n\n\treturn h\n}", "title": "" }, { "docid": "b68c6e14bd84e9ca8ef73d629f1fb14f", "score": "0.61839426", "text": "func MakeHttpHandler(ctx context.Context, endpoints Endpoints) http.Handler {\n\tr := mux.NewRouter()\n\n\toptions := []kithttp.ServerOption{\n\t\tkithttp.ServerErrorEncoder(kithttp.DefaultErrorEncoder),\n\t}\n\tr.Methods(\"GET\").PathPrefix(\"/health\").Handler(kithttp.NewServer(\n\t\tendpoints.HealthEndpoint,\n\t\tHealthDecodeRequest,\n\t\tHealthEncodeResponse,\n\t\toptions...,\n\t))\n\tr.Methods(\"GET\").PathPrefix(\"/users\").Handler(kithttp.NewServer(\n\t\tendpoints.UserGetEndpoint,\n\t\tDecodeGetRequest,\n\t\tEncodeResponse,\n\t\toptions...,\n\t))\n\n\tr.Methods(\"POST\").Path(\"/register\").Handler(kithttp.NewServer(\n\t\tendpoints.RegisterEndpoint,\n\t\tDecodeRegisterRequest,\n\t\tEncodeResponse,\n\t\toptions...,\n\t))\n\treturn r\n}", "title": "" }, { "docid": "74636c47b4f35c4940a226343f8ab932", "score": "0.6183395", "text": "func MakeHTTPHandler(ctx context.Context, endpoints Endpoints, logger log.Logger) http.Handler {\n\tm := http.NewServeMux()\n\n\treturn m\n}", "title": "" }, { "docid": "33d5eac0125bcb1527aed3488852a507", "score": "0.61833906", "text": "func makeHandler(customHandler func(http.ResponseWriter, *http.Request) (int, error)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method == \"OPTIONS\" {\n\t\t\treturn\n\t\t}\n\t\tcode, err := customHandler(w, r)\n\t\tif err != nil {\n\t\t\tif stErr, ok := err.(stackTracer); ok {\n\t\t\t\tst := stErr.StackTrace()\n\t\t\t\tfmt.Fprintf(os.Stderr, \"%v\\n%+v\\n\\n\", err, st[0:2])\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"%v\\n\", err)\n\t\t\t}\n\t\t\tif code >= http.StatusInternalServerError {\n\t\t\t\tw.WriteHeader(code)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsendError(w, code, err.Error())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "28d1bf1f1ffe0305f2bfcd26b0c1778b", "score": "0.61800015", "text": "func MakeHTTPHandler(ctx context.Context, e Endpoints, logger log.Logger, tracer stdopentracing.Tracer) *mux.Router {\n\tr := mux.NewRouter().StrictSlash(false)\n\toptions := []httptransport.ServerOption{\n\t\thttptransport.ServerErrorLogger(logger),\n\t\thttptransport.ServerErrorEncoder(encodeError),\n\t}\n\n\tr.Methods(\"POST\").Path(\"/paymentAuth\").Handler(httptransport.NewServer(\n\t\tctx,\n\t\tcircuitbreaker.HandyBreaker(breaker.NewBreaker(0.2))(e.AuthoriseEndpoint),\n\t\tdecodeAuthoriseRequest,\n\t\tencodeAuthoriseResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"POST /paymentAuth\", logger)))...,\n\t))\n\tr.Methods(\"GET\").Path(\"/health\").Handler(httptransport.NewServer(\n\t\tctx,\n\t\tcircuitbreaker.HandyBreaker(breaker.NewBreaker(0.2))(e.HealthEndpoint),\n\t\tdecodeHealthRequest,\n\t\tencodeHealthResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, \"GET /health\", logger)))...,\n\t))\n\tr.Handle(\"/metrics\", promhttp.Handler())\n\treturn r\n}", "title": "" }, { "docid": "a6b1eb88432b14c7bc26a78b22c1ea83", "score": "0.61754197", "text": "func (f *ResourceHandlers) createHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) {\n\treq := newRequest(ctx, w, r).WithMod1()\n\tif err := req.Error(); err != nil {\n\t\thttperrors.GeneralServerError(ctx, w, err)\n\t\treturn\n\t}\n\tmodule := req.Mod1()\n\tsession := req.Session()\n\tbody := req.Body()\n\n\tcount, e := body.Int(\"__count__\")\n\tif e == nil && count > 1 {\n\t\tbodyDict, ok := body.(*jsonutils.JSONDict)\n\t\tif !ok {\n\t\t\thttperrors.GeneralServerError(ctx, w, fmt.Errorf(\"Fail to decode body\"))\n\t\t} else {\n\t\t\tnbody := bodyDict.Copy(\"__count__\")\n\t\t\tret := module.BatchCreate(session, nbody, int(count))\n\t\t\tw.WriteHeader(207)\n\t\t\tappsrv.SendJSON(w, modulebase.SubmitResults2JSON(ret))\n\t\t}\n\t} else {\n\t\tobj, e := module.Create(session, body)\n\t\tif e != nil {\n\t\t\thttperrors.GeneralServerError(ctx, w, e)\n\t\t} else {\n\t\t\tappsrv.SendJSON(w, obj)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e71cc8a83efcdf67d660c7860b9dabbe", "score": "0.617362", "text": "func Handler(name string) http.Handler", "title": "" } ]
1d75f542471de2f6eb8b79525658bf3e
gets all repos in a search by "forks" or "stars"
[ { "docid": "65948610c24cb3f9da1db76ff6662f6f", "score": "0.683867", "text": "func get_searchPage_repo(orderBy string, page int) (int, int) {\n\t// check param errors\n\tif orderBy != \"stars\" && orderBy != \"forks\" {\n\t\tfmt.Println(\"get_searchPage_repo must have 'stars' or 'forks' as first parameter\")\n\t\tos.Exit(1)\n\t}\n\tif page <= 0 {\n\t\tpage = 1\n\t}\n\n\t// get the page\n\turl := \"https://github.com/search?o=desc&q=stars%3A%3E1&s=\" + orderBy + \"&type=Repositories&p=\" + strconv.Itoa(page)\n\tdoc := get_html_page(url)\n\tif doc == nil {\n\t\tfmt.Println(\"Failed to parse page \" + strconv.Itoa(page))\n\t\treturn -1, -1\n\t}\n\n\t// need to return min value to stop scrapping\n\tvar min_stars = 0\n\tvar min_forks = 0\n\n\t// html parsing\n\trepo_list := doc.Find(\".repo-list-item\")\n\tif repo_list == nil {\n\t\tfmt.Println(\"Failed to parse page \" + strconv.Itoa(page))\n\t\treturn -1, -1\n\t}\n\n\trepo_list.Each(func (i int, repo *goquery.Selection) {\n\t\tvar nbr_stars = 0\n\t\tvar nbr_forks = 0\n\t\tvar repo_path = \"\"\n\t\tvar repo_name = \"\"\n\t\tvar repo_owner = \"\"\n\n\t\t// find forks and stars numbers in the DOM\n\t\tstat_items := repo.Find(\".repo-list-stat-item\")\n\t\tstat_items.Each(func (j int, stat_item *goquery.Selection) {\n\t\t\tstatItem_value, exists := stat_item.Attr(\"aria-label\")\n\t\t\tif exists == true {\n\t\t\t\tstat_item := strings.TrimSpace(stat_item.Text())\n\t\t\t\tstat_item = strings.Replace(stat_item, \",\", \"\", 3)\n\t\t\t\tnbr, err := strconv.Atoi(stat_item)\n\t\t\t\tif err == nil && statItem_value == \"Stargazers\" {\n\t\t\t\t\tnbr_stars = nbr\n\t\t\t\t}\n\t\t\t\tif err == nil && statItem_value == \"Forks\" {\n\t\t\t\t\tnbr_forks = nbr\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\t// find repo name and owner\n\t\trepo_path = repo.Find(\".repo-list-name a\").Text()\n\t\trepo_owner = strings.Split(repo_path, \"/\")[0]\n\t\trepo_name = strings.Split(repo_path, \"/\")[1]\n\n\t\t// update min values to stop the scrapping\n\t\tif nbr_stars > 0 && (min_stars == 0 || min_stars > nbr_stars) {\n\t\t\tmin_stars = nbr_stars\n\t\t}\n\t\tif nbr_forks > 0 && (min_forks == 0 || min_forks > nbr_forks) {\n\t\t\tmin_forks = nbr_forks\n\t\t}\n\n\t\tpersist_scrapped_repo(repo_path, repo_owner, repo_name, nbr_stars, nbr_forks)\n\t})\n\n\treturn min_stars, min_forks\n}", "title": "" } ]
[ { "docid": "db070a2427f9d1ec4863a3b58f0c3b00", "score": "0.68213636", "text": "func scrape_repos() {\n\t// let's scrape most starred repos\n\tfmt.Println(\"Search repos by stars\")\n\tfor i := 0; true; i++ {\n\t\tmin_stars, _ := get_searchPage_repo(\"stars\", i)\n\t\t// bug -> retry\n\t\tif min_stars == -1 {\n\t\t\ti--\n\t\t\tcontinue;\n\t\t}\n\t\tif min_stars < config.Github_scrapping.Repo_min_stars {\n\t\t\tfmt.Println(\"Search repos by stars - Page: \" + strconv.Itoa(i) + \" - Min star: \" + strconv.Itoa(min_stars))\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// let's scrape most starred repos\n\tfmt.Println(\"Search repos by forks\")\n\tfor i := 0; true; i++ {\n\t\t_, min_forks := get_searchPage_repo(\"forks\", i)\n\t\t// bug -> retry\n\t\tif min_forks == -1 {\n\t\t\ti--\n\t\t\tcontinue;\n\t\t}\n\t\tif min_forks < config.Github_scrapping.Repo_min_forks {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "42f74829966006b284e820deebac1cf9", "score": "0.6755938", "text": "func Forks(conf *config.Config) {\n\tfor _, repo := range getReposSortedByForks(conf) {\n\t\tfmt.Println(repo)\n\t}\n}", "title": "" }, { "docid": "7f6af120396f2b10cae7705bbda5e16a", "score": "0.65288734", "text": "func getRepoList(text string) (searchResult, error) {\n\tvar gURL string = \"https://api.github.com/search/repositories?q=\"\n\tvar res searchResult\n\tresp, err := http.Get(gURL + url.QueryEscape(text))\n\tif err != nil {\n\t\treturn res, err\n\t}\n\tdec := json.NewDecoder(resp.Body)\n\terr = dec.Decode(&res)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "b0d4787794ad3b654e58c19c5b190b52", "score": "0.6490215", "text": "func listAvailable(officialOnly bool) ([]*github.Repository, error) {\n\tclient := ddevgh.GetGithubClient(context.Background())\n\tq := \"topic:ddev-get fork:true\"\n\tif officialOnly {\n\t\tq = q + \" org:\" + globalconfig.DdevGithubOrg\n\t}\n\n\topts := &github.SearchOptions{Sort: \"updated\", Order: \"desc\", ListOptions: github.ListOptions{PerPage: 200}}\n\tvar allRepos []*github.Repository\n\tfor {\n\n\t\trepos, resp, err := client.Search.Repositories(context.Background(), q, opts)\n\t\tif err != nil {\n\t\t\tmsg := fmt.Sprintf(\"Unable to get list of available services: %v\", err)\n\t\t\tif resp != nil {\n\t\t\t\tmsg = msg + fmt.Sprintf(\" rateinfo=%v\", resp.Rate)\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(msg)\n\t\t}\n\t\tallRepos = append(allRepos, repos.Repositories...)\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\t// Set the next page number for the next request\n\t\topts.ListOptions.Page = resp.NextPage\n\t}\n\tout := \"\"\n\tfor _, r := range allRepos {\n\t\tout = out + fmt.Sprintf(\"%s: %s\\n\", r.GetFullName(), r.GetDescription())\n\t}\n\tif len(allRepos) == 0 {\n\t\treturn nil, fmt.Errorf(\"No add-ons found\")\n\t}\n\treturn allRepos, nil\n}", "title": "" }, { "docid": "aa8faec78880ea4dd2d2a6996ba6b521", "score": "0.6417292", "text": "func getIssuesAndForks(client *githubv4.Client) error {\n\n\t// Query some details about a repository, an issue in it, and its comments.\n\t{\n\t\t/*\n\t\t\t\t\t\t{\n\t\t\t organization(login: \"kyma-project\") {\n\t\t\t repositories(first: 10) {\n\t\t\t edges {\n\t\t\t node {\n\t\t\t name\n\t\t\t issues(first:100 after:\"Y3Vyc29yOnYyOpHOFTLViw==\") {\n\t\t\t\t\t\t pageInfo {\n\t\t\t\t\t\t endCursor\n\t\t\t\t\t\t hasNextPage\n\t\t\t\t\t\t }\n\t\t\t edges {\n\t\t\t\t\t\t cursor\n\t\t\t\t\t\t node {\n\t\t\t\t\t\t number\n\t\t\t\t\t\t state\n\t\t\t\t\t\t author {\n\t\t\t\t\t\t login\n\t\t\t\t\t\t }\n\t\t\t\t\t\t }\n\t\t\t\t\t\t }\n\t\t\t }\n\t\t\t forks(first: 100) {\n\t\t\t\t\t\t totalCount\n\t\t\t\t\t\t pageInfo {\n\t\t\t\t\t\t endCursor\n\t\t\t\t\t\t hasNextPage\n\t\t\t\t\t\t }\n\t\t\t\t\t\t edges {\n\t\t\t\t\t\t node {\n\t\t\t\t\t\t owner {\n\t\t\t\t\t\t login\n\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 }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t*/\n\n\t\tvar getCollaborators struct {\n\t\t\tOrganization struct {\n\t\t\t\tRepositories struct {\n\t\t\t\t\tEdges []struct {\n\t\t\t\t\t\tNode struct {\n\t\t\t\t\t\t\tName githubv4.String\n\t\t\t\t\t\t\tCollaborators struct {\n\t\t\t\t\t\t\t\tTotalCount githubv4.Int\n\t\t\t\t\t\t\t\tEdges []struct {\n\t\t\t\t\t\t\t\t\tNode struct {\n\t\t\t\t\t\t\t\t\t\tName githubv4.String\n\t\t\t\t\t\t\t\t\t\tLogin githubv4.String\n\t\t\t\t\t\t\t\t\t\tOrganizations struct {\n\t\t\t\t\t\t\t\t\t\t\tEdges []struct {\n\t\t\t\t\t\t\t\t\t\t\t\tNode struct {\n\t\t\t\t\t\t\t\t\t\t\t\t\tName githubv4.String\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} `graphql:\"organizations(first:$orgLimit)\"`\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} `graphql:\"collaborators(first:$collaboratorsLimit)\"`\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} `graphql:\"repositories(first:$repoLimit)\"`\n\t\t\t} `graphql:\"organization(login:$repositoryOwner)\"`\n\t\t}\n\n\t\tvariables := map[string]interface{}{\n\t\t\t\"repositoryOwner\": githubv4.String(\"kyma-project\"),\n\t\t\t\"repoLimit\": githubv4.Int(10),\n\t\t\t\"orgLimit\": githubv4.Int(10),\n\t\t\t\"collaboratorsLimit\": githubv4.Int(100),\n\t\t}\n\t\terr := client.Query(ctx, &getCollaborators, variables)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tprintJSON(getCollaborators)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9d311291351e20949275750ff92e088a", "score": "0.6415669", "text": "func Get(\n\tctx context.Context,\n\tclient *github.Client,\n\trepos []*github.Repository,\n) (result []model.Star, err error) {\n\tvar g errgroup.Group\n\tvar m sync.Mutex\n\tvar pool = make(chan bool, 5)\n\tfor _, repo := range repos {\n\t\trepo := repo\n\t\tpool <- true\n\t\tg.Go(func() error {\n\t\t\tdefer func() {\n\t\t\t\t<-pool\n\t\t\t}()\n\t\t\tr, er := processRepo(ctx, client, repo)\n\t\t\tif er != nil {\n\t\t\t\treturn errors.Wrap(er, \"failed to get repository stars\")\n\t\t\t}\n\t\t\tm.Lock()\n\t\t\tdefer m.Unlock()\n\t\t\tresult = append(result, r)\n\t\t\treturn nil\n\t\t})\n\t}\n\terr = g.Wait()\n\treturn\n}", "title": "" }, { "docid": "9d31961fcdd8b4e3e735fd9905feb5a9", "score": "0.6127994", "text": "func getReposByOrg(config *config.GitXargsConfig) ([]*github.Repository, error) {\n\n\tlogger := logging.GetLogger(\"git-xargs\")\n\n\t// Page through all of the organization's repos, collecting them in this slice\n\tvar allRepos []*github.Repository\n\n\tif config.GithubOrg == \"\" {\n\t\treturn allRepos, errors.WithStackTrace(types.NoGithubOrgSuppliedErr{})\n\t}\n\n\topt := &github.RepositoryListByOrgOptions{\n\t\tListOptions: github.ListOptions{\n\t\t\tPerPage: 100,\n\t\t},\n\t}\n\n\tfor {\n\t\tvar reposToAdd []*github.Repository\n\t\trepos, resp, err := config.GithubClient.Repositories.ListByOrg(context.Background(), config.GithubOrg, opt)\n\t\tif err != nil {\n\t\t\treturn allRepos, errors.WithStackTrace(err)\n\t\t}\n\n\t\t// github.RepositoryListByOrgOptions doesn't seem to be able to filter out archived repos\n\t\t// So re-slice the repos list if --skip-archived-repos is passed and the repository is in archived/read-only state\n\t\tfor i, repo := range repos {\n\t\t\tif config.SkipArchivedRepos && repo.GetArchived() {\n\t\t\t\tlogger.WithFields(logrus.Fields{\n\t\t\t\t\t\"Name\": repo.GetFullName(),\n\t\t\t\t}).Debug(\"Skipping archived repository\")\n\n\t\t\t\t// Track repos to skip because of archived status for our final run report\n\t\t\t\tconfig.Stats.TrackSingle(stats.ReposArchivedSkipped, repo)\n\n\t\t\t\treposToAdd = append(repos[:i], repos[i+1:]...)\n\t\t\t} else {\n\t\t\t\treposToAdd = repos\n\t\t\t}\n\t\t}\n\n\t\tallRepos = append(allRepos, reposToAdd...)\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\n\trepoCount := len(allRepos)\n\n\tif repoCount == 0 {\n\t\treturn nil, errors.WithStackTrace(types.NoReposFoundErr{GithubOrg: config.GithubOrg})\n\t}\n\n\tlogger.WithFields(logrus.Fields{\n\t\t\"Repo count\": repoCount,\n\t}).Debug(fmt.Sprintf(\"Fetched repos from Github organization: %s\", config.GithubOrg))\n\n\tconfig.Stats.TrackMultiple(stats.FetchedViaGithubAPI, allRepos)\n\n\treturn allRepos, nil\n}", "title": "" }, { "docid": "3d5ce8f333cb1793f5711aad90c57a2b", "score": "0.6106777", "text": "func (cloud Cloud) Repositories(metadata bool) ([]common.Repository, error) {\n\n\tkindSplit := strings.SplitN(cloud.kind, \"/\", 2)\n\tkindType := kindSplit[0]\n\tkindKey := kindSplit[1]\n\n\taccountID, _, err := cloud.Credentials()\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to get repositories\")\n\t\treturn nil, err\n\t}\n\n\tswitch kindType {\n\tcase \"project\":\n\t\tro := bitbucket.RepositoriesOptions{Owner: accountID, Role: \"member\"}\n\t\tresult, err := cloud.API.Repositories.ListForAccount(&ro)\n\t\tif err != nil {\n\t\t\tlog.WithFields(logrus.Fields{\n\t\t\t\t\"project\": kindKey,\n\t\t\t}).Errorf(\"Failed to get project repositories\")\n\t\t\treturn nil, err\n\t\t}\n\n\t\trepositories := []common.Repository{}\n\t\tfor _, repo := range result.Items {\n\t\t\tif repo.Project.Key == kindKey {\n\n\t\t\t\trepoBytes, _ := json.MarshalIndent(repo, \"\", \" \")\n\t\t\t\trepoJSON := string(repoBytes)\n\t\t\t\t// fmt.Println(repoJSON)\n\t\t\t\t// Get all metadata for the repository\n\t\t\t\thttpCloneLink := gjson.Get(repoJSON, `Links.clone.#(name%\"http*\").href`).String()\n\t\t\t\tslug := gjson.Get(repoJSON, `Slug`).String()\n\t\t\t\tdescription := gjson.Get(repoJSON, `Description`).String()\n\n\t\t\t\tnewRepo := common.Repository{\n\t\t\t\t\tSlug: slug,\n\t\t\t\t\tSource: httpCloneLink,\n\t\t\t\t\tDescription: description,\n\t\t\t\t}\n\t\t\t\trepositories = append(repositories, newRepo)\n\t\t\t}\n\t\t}\n\t\trepositories = utils.FilterRepos(repositories, cloud.filters.include, cloud.filters.exclude)\n\t\treturn repositories, nil\n\n\tcase \"user\":\n\t\tro := bitbucket.RepositoriesOptions{Owner: kindKey, Role: \"member\"}\n\t\tresult, err := cloud.API.Repositories.ListForAccount(&ro)\n\t\tif err != nil {\n\t\t\tlog.WithFields(logrus.Fields{\n\t\t\t\t\"user\": kindKey,\n\t\t\t}).Errorf(\"Failed to get user repositories\")\n\t\t\treturn nil, err\n\t\t}\n\n\t\trepositories := []common.Repository{}\n\t\tfor _, repo := range result.Items {\n\t\t\trepoBytes, _ := json.MarshalIndent(repo, \"\", \" \")\n\t\t\trepoJSON := string(repoBytes)\n\n\t\t\thttpCloneLink := gjson.Get(repoJSON, `Links.clone.#(name%\"http*\").href`).String()\n\t\t\tslug := gjson.Get(repoJSON, `Slug`).String()\n\t\t\tdescription := gjson.Get(repoJSON, `Description`).String()\n\n\t\t\tnewRepo := common.Repository{\n\t\t\t\tSlug: slug,\n\t\t\t\tSource: httpCloneLink,\n\t\t\t\tDescription: description,\n\t\t\t}\n\t\t\trepositories = append(repositories, newRepo)\n\t\t}\n\t\trepositories = utils.FilterRepos(repositories, cloud.filters.include, cloud.filters.exclude)\n\t\treturn repositories, nil\n\n\tdefault:\n\t\tlog.WithFields(logrus.Fields{\n\t\t\t\"kind\": kindType,\n\t\t}).Errorf(\"Unsupported kind\")\n\t\treturn nil, fmt.Errorf(\"Unsupported kind\")\n\t}\n}", "title": "" }, { "docid": "38806ca6947b614f39e9da6b988a0491", "score": "0.61052245", "text": "func scrape_repos_contributors() {\n\tvar repos []GRepo\n\tpg_findAll(&repos, \"\")\n\n\tfmt.Println(\"Search repos contributors\")\n\n\tfor i := 0; i < len(repos); i++ {\n\t\t// get contributor list\n\t\tvar dataContributors []DataContributor\n\t\tget_json_page(\"https://github.com/\" + repos[i].Path + \"/graphs/contributors-data\", &dataContributors)\n\n\t\t// get each user page of the contributor\n\t\tfor j := 0; j < len(dataContributors); j++ {\n\t\t\tscrape_repo_owner(dataContributors[j].Author.Login)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5f254d33e737a5733a668b26c8641b1a", "score": "0.6088768", "text": "func CloneAllRepos(git git.Gitter, cloneTargets []scm.Repo) {\n\t// Filter repos that have attributes that don't need specific scm api calls\n\tif os.Getenv(\"GHORG_MATCH_REGEX\") != \"\" {\n\t\tcolorlog.PrintInfo(\"Filtering repos down by including regex matches...\")\n\t\tcloneTargets = filterByRegexMatch(cloneTargets)\n\t}\n\tif os.Getenv(\"GHORG_EXCLUDE_MATCH_REGEX\") != \"\" {\n\t\tcolorlog.PrintInfo(\"Filtering repos down by excluding regex matches...\")\n\t\tcloneTargets = filterByExcludeRegexMatch(cloneTargets)\n\t}\n\tif os.Getenv(\"GHORG_MATCH_PREFIX\") != \"\" {\n\t\tcolorlog.PrintInfo(\"Filtering repos down by including prefix matches...\")\n\t\tcloneTargets = filterByMatchPrefix(cloneTargets)\n\t}\n\tif os.Getenv(\"GHORG_EXCLUDE_MATCH_PREFIX\") != \"\" {\n\t\tcolorlog.PrintInfo(\"Filtering repos down by excluding prefix matches...\")\n\t\tcloneTargets = filterByExcludeMatchPrefix(cloneTargets)\n\t}\n\n\t// filter repos down based on ghorgignore if one exists\n\t_, err := os.Stat(configs.GhorgIgnoreLocation())\n\tif !os.IsNotExist(err) {\n\t\t// Open the file parse each line and remove cloneTargets containing\n\t\ttoIgnore, err := readGhorgIgnore()\n\t\tif err != nil {\n\t\t\tcolorlog.PrintErrorAndExit(fmt.Sprintf(\"Error parsing your ghorgignore, error: %v\", err))\n\t\t}\n\n\t\tcolorlog.PrintInfo(\"Using ghorgignore, filtering repos down...\")\n\n\t\tfilteredCloneTargets := []scm.Repo{}\n\t\tvar flag bool\n\t\tfor _, cloned := range cloneTargets {\n\t\t\tflag = false\n\t\t\tfor _, ignore := range toIgnore {\n\t\t\t\tif strings.Contains(cloned.URL, ignore) {\n\t\t\t\t\tflag = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !flag {\n\t\t\t\tfilteredCloneTargets = append(filteredCloneTargets, cloned)\n\t\t\t}\n\t\t}\n\n\t\tcloneTargets = filteredCloneTargets\n\n\t}\n\n\trepoCount := getRepoCountOnly(cloneTargets)\n\n\tif os.Getenv(\"GHORG_CLONE_WIKI\") == \"true\" {\n\t\twikiCount := strconv.Itoa(len(cloneTargets) - repoCount)\n\t\tcolorlog.PrintInfo(strconv.Itoa(repoCount) + \" repos found in \" + targetCloneSource + \", including \" + wikiCount + \" enabled wikis\\n\")\n\t} else {\n\t\tcolorlog.PrintInfo(strconv.Itoa(repoCount) + \" repos found in \" + targetCloneSource + \"\\n\")\n\t}\n\n\tif os.Getenv(\"GHORG_DRY_RUN\") == \"true\" {\n\t\tprintDryRun(cloneTargets)\n\t\treturn\n\t}\n\n\tcreateDirIfNotExist()\n\n\t// check for duplicate names will cause issues for some clone types on gitlab\n\trepoNameWithCollisions, hasCollisions := hasRepoNameCollisions(cloneTargets)\n\n\tl, err := strconv.Atoi(os.Getenv(\"GHORG_CONCURRENCY\"))\n\tif err != nil {\n\t\tlog.Fatal(\"Could not determine GHORG_CONCURRENCY\")\n\t}\n\n\tlimit := limiter.NewConcurrencyLimiter(l)\n\n\tvar cloneCount, pulledCount, updateRemoteCount int\n\n\t// maps in go are not safe for concurrent use\n\tvar mutex = &sync.RWMutex{}\n\n\tfor i := range cloneTargets {\n\t\trepo := cloneTargets[i]\n\t\trepoSlug := getAppNameFromURL(repo.URL)\n\t\tlimit.Execute(func() {\n\t\t\tif repo.Path != \"\" && os.Getenv(\"GHORG_PRESERVE_DIRECTORY_STRUCTURE\") == \"true\" {\n\t\t\t\trepoSlug = repo.Path\n\t\t\t}\n\t\t\tmutex.Lock()\n\t\t\tinHash := repoNameWithCollisions[repo.Name]\n\t\t\tmutex.Unlock()\n\t\t\t// Only GitLab repos can have collisions due to groups and subgroups\n\t\t\t// If there are collisions and this is a repo with a naming collision change name to avoid collisions\n\t\t\tif hasCollisions && inHash {\n\t\t\t\trepoSlug = trimCollisionFilename(strings.Replace(repo.Path, \"/\", \"_\", -1))\n\n\t\t\t\tmutex.Lock()\n\t\t\t\tslugCollision := repoNameWithCollisions[repoSlug]\n\t\t\t\tmutex.Unlock()\n\t\t\t\t// If a collision has another collision with trimmed name append a number\n\t\t\t\tif ok := slugCollision; ok {\n\t\t\t\t\trepoSlug = fmt.Sprintf(\"_%v_%v\", strconv.Itoa(i), repoSlug)\n\t\t\t\t} else {\n\t\t\t\t\tmutex.Lock()\n\t\t\t\t\trepoNameWithCollisions[repoSlug] = true\n\t\t\t\t\tmutex.Unlock()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trepo.HostPath = filepath.Join(outputDirAbsolutePath, repoSlug)\n\n\t\t\tif repo.IsWiki {\n\t\t\t\tif !strings.HasSuffix(repo.HostPath, \".wiki\") {\n\t\t\t\t\trepo.HostPath = repo.HostPath + \".wiki\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\taction := \"cloning\"\n\t\t\tif repoExistsLocally(repo) {\n\t\t\t\t// prevents git from asking for user for credentials, needs to be unset so creds aren't stored\n\t\t\t\terr := git.SetOriginWithCredentials(repo)\n\t\t\t\tif err != nil {\n\t\t\t\t\te := fmt.Sprintf(\"Problem setting remote with credentials Repo: %s Error: %v\", repo.Name, err)\n\t\t\t\t\tcloneErrors = append(cloneErrors, e)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif os.Getenv(\"GHORG_BACKUP\") == \"true\" {\n\t\t\t\t\terr := git.UpdateRemote(repo)\n\t\t\t\t\taction = \"updating remote\"\n\t\t\t\t\t// Theres no way to tell if a github repo has a wiki to clone\n\t\t\t\t\tif err != nil && repo.IsWiki {\n\t\t\t\t\t\te := fmt.Sprintf(\"Wiki may be enabled but there was no content to clone on Repo: %s Error: %v\", repo.URL, err)\n\t\t\t\t\t\tcloneInfos = append(cloneInfos, e)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\te := fmt.Sprintf(\"Could not update remotes in Repo: %s Error: %v\", repo.URL, err)\n\t\t\t\t\t\tcloneErrors = append(cloneErrors, e)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tupdateRemoteCount++\n\t\t\t\t} else if os.Getenv(\"GHORG_NO_CLEAN\") == \"true\" {\n\t\t\t\t\taction = \"fetching\"\n\t\t\t\t\terr := git.FetchAll(repo)\n\n\t\t\t\t\t// Theres no way to tell if a github repo has a wiki to clone\n\t\t\t\t\tif err != nil && repo.IsWiki {\n\t\t\t\t\t\te := fmt.Sprintf(\"Wiki may be enabled but there was no content to clone on Repo: %s Error: %v\", repo.URL, err)\n\t\t\t\t\t\tcloneInfos = append(cloneInfos, e)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\te := fmt.Sprintf(\"Could not fetch remotes in Repo: %s Error: %v\", repo.URL, err)\n\t\t\t\t\t\tcloneErrors = append(cloneErrors, e)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\terr := git.Checkout(repo)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\te := fmt.Sprintf(\"Could not checkout out %s, branch may not exist or may not have any contents, no changes made Repo: %s Error: %v\", repo.CloneBranch, repo.URL, err)\n\t\t\t\t\t\tcloneInfos = append(cloneInfos, e)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\terr = git.Clean(repo)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\te := fmt.Sprintf(\"Problem running git clean: %s Error: %v\", repo.URL, err)\n\t\t\t\t\t\tcloneErrors = append(cloneErrors, e)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\terr = git.Reset(repo)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\te := fmt.Sprintf(\"Problem resetting %s Repo: %s Error: %v\", repo.CloneBranch, repo.URL, err)\n\t\t\t\t\t\tcloneErrors = append(cloneErrors, e)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\terr = git.Pull(repo)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\te := fmt.Sprintf(\"Problem trying to pull %v Repo: %s Error: %v\", repo.CloneBranch, repo.URL, err)\n\t\t\t\t\t\tcloneErrors = append(cloneErrors, e)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\taction = \"pulling\"\n\t\t\t\t\tpulledCount++\n\n\t\t\t\t\tif os.Getenv(\"GHORG_FETCH_ALL\") == \"true\" {\n\t\t\t\t\t\terr = git.FetchAll(repo)\n\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\te := fmt.Sprintf(\"Could not fetch remotes in Repo: %s Error: %v\", repo.URL, err)\n\t\t\t\t\t\t\tcloneErrors = append(cloneErrors, e)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\terr = git.SetOrigin(repo)\n\t\t\t\tif err != nil {\n\t\t\t\t\te := fmt.Sprintf(\"Problem resetting remote Repo: %s Error: %v\", repo.Name, err)\n\t\t\t\t\tcloneErrors = append(cloneErrors, e)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// if https clone and github/gitlab add personal access token to url\n\n\t\t\t\terr = git.Clone(repo)\n\n\t\t\t\t// Theres no way to tell if a github repo has a wiki to clone\n\t\t\t\tif err != nil && repo.IsWiki {\n\t\t\t\t\te := fmt.Sprintf(\"Wiki may be enabled but there was no content to clone on Repo: %s Error: %v\", repo.URL, err)\n\t\t\t\t\tcloneInfos = append(cloneInfos, e)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif err != nil {\n\t\t\t\t\te := fmt.Sprintf(\"Problem trying to clone Repo: %s Error: %v\", repo.URL, err)\n\t\t\t\t\tcloneErrors = append(cloneErrors, e)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif os.Getenv(\"GHORG_BRANCH\") != \"\" {\n\t\t\t\t\terr := git.Checkout(repo)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\te := fmt.Sprintf(\"Could not checkout out %s, branch may not exist or may not have any contents, no changes made Repo: %s Error: %v\", repo.CloneBranch, repo.URL, err)\n\t\t\t\t\t\tcloneInfos = append(cloneInfos, e)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcloneCount++\n\n\t\t\t\t// TODO: make configs around remote name\n\t\t\t\t// we clone with api-key in clone url\n\t\t\t\terr = git.SetOrigin(repo)\n\n\t\t\t\t// if repo has wiki, but content does not exist this is going to error\n\t\t\t\tif err != nil {\n\t\t\t\t\te := fmt.Sprintf(\"Problem trying to set remote on Repo: %s Error: %v\", repo.URL, err)\n\t\t\t\t\tcloneErrors = append(cloneErrors, e)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif os.Getenv(\"GHORG_FETCH_ALL\") == \"true\" {\n\t\t\t\t\terr = git.FetchAll(repo)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\te := fmt.Sprintf(\"Could not fetch remotes in Repo: %s Error: %v\", repo.URL, err)\n\t\t\t\t\t\tcloneErrors = append(cloneErrors, e)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcolorlog.PrintSuccess(\"Success \" + action + \" repo: \" + repo.URL + \" -> branch: \" + repo.CloneBranch)\n\t\t})\n\n\t}\n\n\tlimit.WaitAndClose()\n\n\tprintRemainingMessages()\n\tprintCloneStatsMessage(cloneCount, pulledCount, updateRemoteCount)\n\n\tif hasCollisions {\n\t\tfmt.Println(\"\")\n\t\tcolorlog.PrintInfo(\"ATTENTION: ghorg detected collisions in repo names from the groups that were cloned. This occurs when one or more groups share common repo names trying to be cloned to the same directory. The repos that would have collisions were renamed with the group/subgroup appended.\")\n\t}\n\n\t// Now, clean up local repos that don't exist in remote, if prune flag is set\n\tif os.Getenv(\"GHORG_PRUNE\") == \"true\" {\n\t\tpruneRepos(cloneTargets)\n\t}\n\n\tif os.Getenv(\"GHORG_QUIET\") != \"true\" {\n\t\tcolorlog.PrintSuccess(fmt.Sprintf(\"\\nFinished! %s\", outputDirAbsolutePath))\n\t}\n\n\tif os.Getenv(\"GHORG_EXIT_CODE_ON_CLONE_INFOS\") != \"0\" && len(cloneInfos) > 0 {\n\t\texitCode, err := strconv.Atoi(os.Getenv(\"GHORG_EXIT_CODE_ON_CLONE_INFOS\"))\n\t\tif err != nil {\n\t\t\tcolorlog.PrintError(\"Could not convert GHORG_EXIT_CODE_ON_CLONE_INFOS from string to integer\")\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\tos.Exit(exitCode)\n\t}\n\n\tif len(cloneErrors) > 0 {\n\t\texitCode, err := strconv.Atoi(os.Getenv(\"GHORG_EXIT_CODE_ON_CLONE_ISSUES\"))\n\t\tif err != nil {\n\t\t\tcolorlog.PrintError(\"Could not convert GHORG_EXIT_CODE_ON_CLONE_ISSUES from string to integer\")\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\tos.Exit(exitCode)\n\t}\n\n}", "title": "" }, { "docid": "dacafca2ed4b04e7bb41b91be71771a7", "score": "0.6083922", "text": "func (d *DockerApi) GetRepositoriesStarred(username string, page, pageSize int) ([]UserRepository, error) {\n\tif username == \"\" {\n\t\treturn nil, fmt.Errorf(\"no user given\")\n\t}\n\tusername = strings.ToLower(username)\n\tif page == 0 {\n\t\tpage = 1\n\t}\n\tif pageSize <= 0 {\n\t\tpageSize = 100\n\t}\n\n\tpth := d.getRoute(fmt.Sprintf(\"users/%s/repositories/starred?page_size=%v&page=%v\", username, pageSize, page))\n\tr, err := requests.Get(d.client, pth, d.token)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar search SearchResult\n\terr = json.Unmarshal(r, &search)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif search.Count == 0 {\n\t\treturn nil, nil\n\t}\n\tvar results []UserRepository\n\terr = json.Unmarshal(search.Results, &results)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "624cf08c2f655035916353a436f080a1", "score": "0.6062971", "text": "func GetRepoListFromIncludeAccount(user, repoHost string, options model.Options) {\n\tcheck := true\n\tfor i := 1; check; i++ {\n\t\tapiAddress := fmt.Sprintf(\"https://api.\"+repoHost+\"/orgs/%v/members?page=%v&per_page=100\", user, i)\n\t\treq, err := http.NewRequest(\"GET\", apiAddress, nil)\n\t\ttransport := transport.GetTransport(options)\n\t\tclient := &http.Client{\n\t\t\tTimeout: 5 * time.Second,\n\t\t\tTransport: transport,\n\t\t}\n\n\t\tresp, err := client.Do(req)\n\t\tif err != nil {\n\n\t\t}\n\n\t\tdefer resp.Body.Close()\n\t\tdata, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif string(data) == \"[]\" {\n\t\t\tcheck = false\n\t\t}\n\t\tvar objects []GithubObject\n\t\tjson.Unmarshal(data, &objects)\n\t\tfor k, v := range objects {\n\t\t\t_ = k\n\t\t\tif !v.Fork {\n\t\t\t\tfmt.Println(v.URL)\n\t\t\t\tCheckURL(v.URL, options)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e1d79b86ab9785c1bf6d138d313ae151", "score": "0.6006148", "text": "func (c *Client) Repositories() ([]string, error) {\n\tvar r []string\n\ttype repositoryResponse struct {\n\t\tFullName string `json:\"full_name\"`\n\t}\n\n\t// Get all repos that user owns.\n\tresp, err := c.Send(http.MethodGet, githubV3Endpoint, \"/user/repos?type=owner\", ``, c.accessToken)\n\tdefer resp.Body.Close()\n\tif err != nil {\n\t\treturn r, errors.Wrap(err, \"failed to send request successfully\")\n\t}\n\tvar repos []repositoryResponse\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn r, errors.Wrap(err, \"failed to read response body\")\n\t}\n\terr = json.Unmarshal(body, &repos)\n\tif err != nil {\n\t\treturn r, errors.Wrap(err, \"failed to unmarshal response\")\n\t}\n\n\t// Get all repos of whitelisted orgs.\n\tvar orgRepos []repositoryResponse\n\tfor _, org := range c.orgs {\n\t\tresp, err = c.Send(http.MethodGet, githubV3Endpoint, \"/orgs/\"+org+\"/repos\", \"\", c.accessToken)\n\t\tdefer resp.Body.Close()\n\t\tif err != nil {\n\t\t\treturn r, errors.Wrap(err, \"failed to send request successfully\")\n\t\t}\n\n\t\tbody, err = ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn r, errors.Wrap(err, \"failed to read response body\")\n\t\t}\n\n\t\terr = json.Unmarshal(body, &orgRepos)\n\t\tif err != nil {\n\t\t\treturn r, errors.Wrap(err, \"failed to unmarshal response\")\n\t\t}\n\t}\n\n\trepos = append(repos, orgRepos...)\n\n\tfor _, repo := range repos {\n\t\tr = append(r, repo.FullName)\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "35c8d6a17390663c91c95e40ff58b2ab", "score": "0.5984911", "text": "func scrape_repos_owner() {\n\tvar repos []GRepo\n\tpg_findAll(&repos, \"\")\n\n\tfmt.Println(\"Search repos owners (user/org)\")\n\n\t// for each repo in the db, we get the owner\n\tfor i := 0; i < len(repos); i++ {\n\t\tscrape_repo_owner(repos[i].Owner)\n\t}\n}", "title": "" }, { "docid": "70b35045e8a1e926a93c1790a450bde3", "score": "0.5969692", "text": "func GetRepoListFromUser(user, repoHost string, options model.Options) {\n\tcheck := true\n\tfor i := 1; check; i++ {\n\t\tapiAddress := fmt.Sprintf(\"https://api.\"+repoHost+\"/users/%v/repos?page=%v&per_page=100\", user, i)\n\t\treq, err := http.NewRequest(\"GET\", apiAddress, nil)\n\t\ttransport := transport.GetTransport(options)\n\t\tclient := &http.Client{\n\t\t\tTimeout: 5 * time.Second,\n\t\t\tTransport: transport,\n\t\t}\n\n\t\tresp, err := client.Do(req)\n\t\tif err != nil {\n\n\t\t}\n\n\t\tdefer resp.Body.Close()\n\t\tdata, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif string(data) == \"[]\" {\n\t\t\tcheck = false\n\t\t}\n\t\tvar objects []GithubObject\n\t\tjson.Unmarshal(data, &objects)\n\t\tfor k, v := range objects {\n\t\t\t_ = k\n\t\t\tif !v.Fork {\n\t\t\t\tfmt.Println(v.URL)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fe7bb192daf078d2abfef91b20174b97", "score": "0.58946455", "text": "func OrgRepos(ctx context.Context, client *github.Client, org string) ([]*github.Repository, error) {\n\n // slice to contain all repos, and err object\n var allRepos []*github.Repository\n\n // Set options to load 100 repos at a time\n // This is bc the # of repos in a given classroom org\n // tends to be in the scale of 100s (at least), as there\n // is usually one repo per assignment\n opt := &github.RepositoryListByOrgOptions{\n ListOptions: github.ListOptions{PerPage: 100},\n }\n for {\n repos, resp, err := client.Repositories.ListByOrg(ctx, org, opt)\n if err != nil {\n return allRepos, err\n }\n allRepos = append(allRepos, repos...)\n if resp.NextPage == 0 {\n break\n }\n opt.Page = resp.NextPage\n }\n return allRepos, nil\n}", "title": "" }, { "docid": "8d6e902c2b33a74897d00daebbc592e6", "score": "0.58184534", "text": "func findRepositoriesContributed(output response.ResultsOrderedByContribution, users *response.UsersResponse) (response.ResultsOrderedByContribution, error) {\n\tvar mutex sync.Mutex\n\tvar wg sync.WaitGroup\n\tif utility.Threading == true {\n\t\twg.Add(len(users.Items))\n\t}\n\tfor _, user := range users.Items {\n\t\t// We are running in multithreading\n\t\tif utility.Threading == true {\n\t\t\t// Run a goroutine for every user to fine its contributions\n\t\t\tgo routineFindUserRepositoriesContributed(user.Login, &mutex, &output, &wg)\n\t\t} else {\n\t\t\troutineFindUserRepositoriesContributed(user.Login, nil, &output, nil)\n\t\t}\n\n\t}\n\n\tif utility.Threading == true {\n\t\twg.Wait()\n\t}\n\n\treturn output, nil\n}", "title": "" }, { "docid": "e9ad846fc9cca8b693462991d0ce9900", "score": "0.58030534", "text": "func FilterReposByPref(repos []*github.Repository, pref string) []*github.Repository {\n var prefRepos []*github.Repository\n for _, repo := range(repos) {\n if strings.Contains(*repo.Name, pref) {\n prefRepos = append(prefRepos, repo)\n }\n }\n return prefRepos\n}", "title": "" }, { "docid": "eec24c91a3a8cc7f55651f5cb3b267ab", "score": "0.57997715", "text": "func FindRepositoryContributors(pullRequests *response.ReposResponse, user string, test bool) (response.Result, error) {\n\tvar contributions int\n\tvar repos int\n\tduplicateRepos := make(map[string]int)\n\n\tfor _, repo := range pullRequests.Items {\n\t\tvar dup int\n\t\tvar ok bool\n\t\tif dup, ok = duplicateRepos[repo.Repository_url]; ok != true {\n\t\t\tvar record3 *response.ContributorsResponse\n\t\t\tvar err error\n\t\t\tif !test {\n\t\t\t\turl := fmt.Sprintf(\"%s/contributors\", repo.Repository_url)\n\t\t\t\trecord3, err = utility.LoadContributorResponseFromNetwork(url)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn response.Result{}, err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfile := fmt.Sprintf(\"%s\", repo.Repository_url)\n\t\t\t\trecord3, err = utility.LoadContributorResponseFromFile(file)\n\t\t\t}\n\n\t\t\tfor _, contributor := range record3.Items {\n\t\t\t\tif strings.Compare(contributor.Login, user) == 0 {\n\t\t\t\t\tcontributions++\n\t\t\t\t\trepos++\n\t\t\t\t\tduplicateRepos[repo.Repository_url]++\n\t\t\t\t}\n\t\t\t}\n\t\t\tif contributions == 0 {\n\t\t\t\tduplicateRepos[repo.Repository_url] = 0\n\t\t\t}\n\n\t\t}\n\n\t\tif dup > 0 {\n\t\t\tcontributions++\n\t\t}\n\n\t}\n\tr := response.Result{Login: user, Number_Repositories: repos, Total_Contribution: contributions}\n\treturn r, nil\n}", "title": "" }, { "docid": "284328fe6b244d05765c8eb4ff4974a9", "score": "0.57981807", "text": "func (c Gitlab) GetUserRepos(targetUsername string) ([]Repo, error) {\n\tcloneData := []Repo{}\n\ttargetUsers := []string{}\n\n\tprojectOpts := &gitlab.ListProjectsOptions{\n\t\tListOptions: gitlab.ListOptions{\n\t\t\tPerPage: perPage,\n\t\t\tPage: 1,\n\t\t},\n\t}\n\n\tuserOpts := &gitlab.ListUsersOptions{\n\t\tListOptions: gitlab.ListOptions{\n\t\t\tPerPage: perPage,\n\t\t\tPage: 1,\n\t\t},\n\t}\n\n\tif targetUsername == \"all-users\" {\n\t\tgitLabAllUsers = true\n\t\tfor {\n\t\t\tallUsers, resp, err := c.Users.ListUsers(userOpts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error getting all users, err: %v\", err)\n\t\t\t}\n\n\t\t\tfor _, u := range allUsers {\n\t\t\t\ttargetUsers = append(targetUsers, u.Username)\n\t\t\t}\n\n\t\t\tif resp.NextPage == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// Update the page number to get the next page.\n\t\t\tuserOpts.Page = resp.NextPage\n\t\t}\n\t} else {\n\t\ttargetUsers = append(targetUsers, targetUsername)\n\t}\n\n\tfor _, targetUser := range targetUsers {\n\t\tfor {\n\t\t\t// Get the first page with projects.\n\t\t\tps, resp, err := c.Projects.ListUserProjects(targetUser, projectOpts)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error getting repo for user: %v\", targetUser)\n\t\t\t\tcolorlog.PrintError(fmt.Sprintf(\"Error getting repo for user: %v\", targetUser))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// filter from all the projects we've found so far.\n\t\t\tcloneData = append(cloneData, c.filter(targetUser, ps)...)\n\n\t\t\t// Exit the loop when we've seen all pages.\n\t\t\tif resp.NextPage == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// Update the page number to get the next page.\n\t\t\tuserOpts.Page = resp.NextPage\n\t\t}\n\t}\n\n\treturn cloneData, nil\n}", "title": "" }, { "docid": "4a759a5c02867ff74b22affc9934ac15", "score": "0.5797869", "text": "func groupByRepo(allPrs []PullRequest, CachedRepo map[string]Repo) []Repo {\n\tvar allRepos []Repo\n\tcurrentRepoIndex := len(allRepos)\n\turlMap := make(map[string]int)\n\tfor _, pr := range allPrs {\n\t\t// If not found in map, its a new repo\n\t\t// Save its index\n\t\t// If found, push the PR object to the pr list\n\t\t// inside the repo object\n\t\tif _, isCached := urlMap[pr.RepoUrl]; isCached == false {\n\t\t\turlMap[pr.RepoUrl] = currentRepoIndex\n\t\t\tallRepos = append(allRepos, CachedRepo[pr.RepoUrl])\n\t\t\tallRepos[currentRepoIndex].PullRequests = append(allRepos[currentRepoIndex].PullRequests, pr)\n\t\t\tcurrentRepoIndex = currentRepoIndex + 1\n\t\t} else {\n\t\t\tallRepos[urlMap[pr.RepoUrl]].PullRequests = append(allRepos[urlMap[pr.RepoUrl]].PullRequests, pr)\n\t\t}\n\t}\n\treturn allRepos\n}", "title": "" }, { "docid": "0fca40bb1d4a7c2eb98ded95fa719645", "score": "0.5779713", "text": "func Search(query string, limit int) ([]string, error) {\n\tclient := github.NewClient(nil)\n\tctx := context.Background()\n\tresult, _, err := client.Search.Repositories(ctx, query, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(result.Repositories) == 0 {\n\t\treturn nil, fmt.Errorf(\"query '%s' returned no results\", query)\n\t}\n\n\tnResults := min(len(result.Repositories), limit)\n\tnames := make([]string, nResults)\n\tfor i := 0; i < nResults; i++ {\n\t\tnames[i] = result.Repositories[i].GetFullName()\n\t}\n\treturn names, nil\n}", "title": "" }, { "docid": "c4b36b84691b44a93f4148fba900be6b", "score": "0.5689266", "text": "func listRepos(user string) ([]string, error) {\n\tu := \"https://api.github.com/users/\" + user + \"/repos\"\n\tdata, err := get(u)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar x []struct {\n\t\tName string `json:\"full_name\"`\n\t}\n\tif err := json.Unmarshal(data, &x); err != nil {\n\t\treturn nil, err\n\t}\n\tvar repos []string\n\tfor _, r := range x {\n\t\trepos = append(repos, r.Name)\n\t}\n\treturn repos, nil\n}", "title": "" }, { "docid": "b7b7fce40d42c3ea10c85000c78d447b", "score": "0.56744367", "text": "func (repo repo) getRepositoriesByGithubOrg(githubOrgName string) ([]*models.GithubRepository, error) {\n\tvar out []*models.GithubRepository\n\ttableName := fmt.Sprintf(\"cla-%s-repositories\", repo.stage)\n\tbuilder := expression.NewBuilder()\n\tfilter := expression.Name(\"repository_organization_name\").Equal(expression.Value(githubOrgName))\n\tbuilder = builder.WithFilter(filter)\n\t// Use the nice builder to create the expression\n\texpr, err := builder.Build()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Assemble the query input parameters\n\tscanInput := &dynamodb.ScanInput{\n\t\tExpressionAttributeNames: expr.Names(),\n\t\tExpressionAttributeValues: expr.Values(),\n\t\tProjectionExpression: expr.Projection(),\n\t\tFilterExpression: expr.Filter(),\n\t\tTableName: aws.String(tableName),\n\t}\n\n\tresults, err := repo.dynamoDBClient.Scan(scanInput)\n\tif err != nil {\n\t\tlog.Warnf(\"unable to get github organizations repositories. error = %s\", err.Error())\n\t\treturn nil, err\n\t}\n\tif len(results.Items) == 0 {\n\t\treturn out, nil\n\t}\n\tvar result []*GithubRepository\n\terr = dynamodbattribute.UnmarshalListOfMaps(results.Items, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, gr := range result {\n\t\tout = append(out, gr.toModel())\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "35ce66b4a0f9a61678aa1ef6a297aba6", "score": "0.5630591", "text": "func (repo repo) getProjectRepositories(projectID string) ([]*models.GithubRepository, error) {\n\tvar out []*models.GithubRepository\n\ttableName := fmt.Sprintf(\"cla-%s-repositories\", repo.stage)\n\tvar condition expression.KeyConditionBuilder\n\tbuilder := expression.NewBuilder()\n\n\tcondition = expression.Key(\"repository_project_id\").Equal(expression.Value(projectID))\n\n\tbuilder = builder.WithKeyCondition(condition)\n\t// Use the nice builder to create the expression\n\texpr, err := builder.Build()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Assemble the query input parameters\n\tqueryInput := &dynamodb.QueryInput{\n\t\tExpressionAttributeNames: expr.Names(),\n\t\tExpressionAttributeValues: expr.Values(),\n\t\tKeyConditionExpression: expr.KeyCondition(),\n\t\tProjectionExpression: expr.Projection(),\n\t\tFilterExpression: expr.Filter(),\n\t\tTableName: aws.String(tableName),\n\t\tIndexName: aws.String(ProjectRepositoryIndex),\n\t}\n\n\tresults, err := repo.dynamoDBClient.Query(queryInput)\n\tif err != nil {\n\t\tlog.Warnf(\"unable to get project github repositories. error = %s\", err.Error())\n\t\treturn nil, err\n\t}\n\tif len(results.Items) == 0 {\n\t\treturn out, nil\n\t}\n\tvar result []*GithubRepository\n\terr = dynamodbattribute.UnmarshalListOfMaps(results.Items, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, gr := range result {\n\t\tout = append(out, gr.toModel())\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "599341ecd1ba21200111306ede066ceb", "score": "0.56241864", "text": "func FindGitRepos(arg string) (map[string]string, error) {\n\targ, err := filepath.Abs(arg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar dirs []string\n\tgitDirs := map[string]string{}\n\tif err := filepath.Walk(arg, func(name string, fi os.FileInfo, err error) error {\n\t\tif fi, err := os.Lstat(filepath.Join(name, \".git\")); err == nil && fi.IsDir() {\n\t\t\tdirs = append(dirs, filepath.Join(name, \".git\"))\n\t\t\treturn filepath.SkipDir\n\t\t}\n\n\t\tif !strings.HasSuffix(name, \".git\") || !fi.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tfi, err = os.Lstat(filepath.Join(name, \"objects\"))\n\t\tif err != nil || !fi.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tdirs = append(dirs, name)\n\t\treturn filepath.SkipDir\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, dir := range dirs {\n\t\tname := strings.TrimSuffix(dir, \".git\")\n\t\tname = strings.TrimSuffix(name, \"/\")\n\t\tname = strings.TrimPrefix(name, arg)\n\t\tname = strings.TrimPrefix(name, \"/\")\n\t\tgitDirs[dir] = name\n\t}\n\n\treturn gitDirs, nil\n}", "title": "" }, { "docid": "c32f84cf061037c14dfd53f8f1b167ad", "score": "0.55976665", "text": "func (c githubClient) GetRepositoriesFromOwner(target Owner) ([]*Repository, error) {\n\tvar allRepos []*Repository\n\n\tctx := context.Background()\n\topt := &github.RepositoryListOptions{\n\t\tType: \"sources\",\n\t}\n\n\tvar wg sync.WaitGroup\n\tvar mut sync.Mutex\n\n\tfor {\n\t\trepos, resp, err := c.apiClient.Repositories.List(ctx, *target.Login, opt)\n\t\tif err != nil {\n\t\t\treturn allRepos, err\n\t\t}\n\n\t\twg.Add(1)\n\n\t\tgo func() {\n\t\t\tfor _, repo := range repos {\n\t\t\t\tif !*repo.Fork {\n\t\t\t\t\tr := Repository{\n\t\t\t\t\t\tOwner: repo.Owner.Login,\n\t\t\t\t\t\tID: repo.ID,\n\t\t\t\t\t\tName: repo.Name,\n\t\t\t\t\t\tFullName: repo.FullName,\n\t\t\t\t\t\tCloneURL: repo.CloneURL,\n\t\t\t\t\t\tURL: repo.HTMLURL,\n\t\t\t\t\t\tDefaultBranch: repo.DefaultBranch,\n\t\t\t\t\t\tDescription: repo.Description,\n\t\t\t\t\t\tHomepage: repo.Homepage,\n\t\t\t\t\t}\n\t\t\t\t\tmut.Lock()\n\t\t\t\t\tallRepos = append(allRepos, &r)\n\t\t\t\t\tmut.Unlock()\n\t\t\t\t}\n\t\t\t}\n\t\t\twg.Done()\n\t\t}()\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\topt.Page = resp.NextPage\n\t}\n\twg.Wait()\n\n\treturn allRepos, nil\n}", "title": "" }, { "docid": "ed43df3d0a486926946bd08f69ea0de6", "score": "0.5592356", "text": "func getUserRepositories(c *gin.Context, client github.Client) {\n\n\trepoList, _, _ := getRepoList(client)\n\tc.JSON(http.StatusOK, gin.H{\"data\": repoList})\n\n}", "title": "" }, { "docid": "5c5dcc324e7a4499e94bb7519110c91e", "score": "0.5588926", "text": "func (s *ProjectService) List(owner string) ([]*Repository, error) {\n\tsrcDir := path.Join(s.RootPath, sourceDirPrefix)\n\n\tfiles, err := ioutil.ReadDir(srcDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar out []*Repository\n\n\tfor _, f := range files {\n\t\tif !f.IsDir() || strings.HasPrefix(f.Name(), \".\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tprojects, err := s.listForProvider(f.Name(), owner)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tout = append(out, projects...)\n\t}\n\n\treturn out, nil\n\n}", "title": "" }, { "docid": "2dde1b4ed39ed5b49b68b2b371b34448", "score": "0.5563146", "text": "func RequestRepos(username string) ([]models.Repository, error) {\n\trequestURL := fmt.Sprintf(\"http://api.github.com/users/%s/repos\", username)\n\tresp, err := http.Get(requestURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tvar repos []models.Repository\n\terr = json.NewDecoder(resp.Body).Decode(&repos)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn repos, nil\n}", "title": "" }, { "docid": "16285fbe12c30f4f3826ae5a0fa2ac72", "score": "0.55509716", "text": "func GetStars(w http.ResponseWriter, r *http.Request) {\n\t// parse payload\n\tvar req model.Request\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&req); err != nil {\n\t\tlog.Printf(\"... cannot decode request %v\\n\", err)\n\t\tutils.RespondWithJSON(w, http.StatusBadRequest, model.Response{Error: err.Error(), Status: failure})\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\tif req.Input == nil {\n\t\tlog.Printf(\"... invalid request. Must contain \\\"input:\\\" %v\", req)\n\t\tutils.RespondWithJSON(w, http.StatusBadRequest, model.Response{Error: \"invalid request. Must contain 'input:'\", Status: failure})\n\t\treturn\n\t}\n\n\t// start couting stars\n\tvar totalCount int64\n\tvalidRepos := make([]model.MapNameStar, 0)\n\tinvalidRepos := make([]string, 0)\n\t// caching, save number of call to github API\n\tseenOrgs := make(map[string][]*github.Repository)\n\n\tif gitService.Client == nil || gitService.Ctx == nil {\n\t\tutils.RespondWithJSON(w, http.StatusInternalServerError, model.Response{Error: \"cannot connect to github\", Status: failure})\n\t\treturn\n\t}\n\n\tfor _, input := range *req.Input {\n\t\tlog.Printf(\"... check if each element in the format organization/repository\")\n\t\tif err := utils.ValidateInput(input); err != nil {\n\t\t\tlog.Printf(\"%s is not in right format orginazation/repo\\n\", input)\n\t\t\tinvalidRepos = append(invalidRepos, input)\n\t\t\tcontinue\n\t\t}\n\t\tlog.Printf(\"...processing input %v\\n\", input)\n\t\ttoken := strings.Split(input, \"/\")\n\n\t\tallRepos, ok := seenOrgs[token[0]]\n\t\tif !ok {\n\t\t\tlog.Printf(\"%s is not seen before\\n\", token[0])\n\t\t\tresults, err := utils.ListAllReposForAnOrg(gitService, token[0])\n\t\t\tif err == nil {\n\t\t\t\tallRepos = results\n\t\t\t\tseenOrgs[token[0]] = results\n\t\t\t\tlog.Printf(\"...added all repos of %s to cache\\n\", token[0])\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"%s is not a valid org\\n\", token[0])\n\t\t\t\tinvalidRepos = append(invalidRepos, input)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif count := utils.GetStarsForRepo(allRepos, token[1]); count != -1 {\n\t\t\tvalidRepos = append(validRepos, model.MapNameStar{input, count})\n\t\t\ttotalCount += count\n\t\t} else {\n\t\t\tlog.Printf(\"%s is not a valid repo in the organization %s \\n\", token[1], token[0])\n\t\t\tinvalidRepos = append(invalidRepos, input)\n\t\t}\n\n\t}\n\tpayload := model.Payload{\n\t\tTotalStars: totalCount,\n\t\tValidRepos: validRepos,\n\t\tInvalidRepos: invalidRepos,\n\t}\n\tresp := model.Response{\n\t\tPl: &payload,\n\t\tStatus: success,\n\t}\n\n\tif len(invalidRepos) != 0 {\n\t\tresp.Error = inputNotValidMessage\n\t}\n\tlog.Println(\"finished request\")\n\tlog.Printf(\"Response: %+v\\n\", resp)\n\tutils.RespondWithJSON(w, http.StatusOK, resp)\n}", "title": "" }, { "docid": "b1e40d82a3db184abe23c22d15866f3d", "score": "0.5545524", "text": "func getRepos(manager string) (repos []Repo) {\n\tswitch manager {\n\tcase \"yum\":\n\t\treturn getYumRepos(\"/etc/yum.conf\")\n\tcase \"apt\":\n\t\treturn getAptRepos(\"/etc/apt/sources.list\")\n\tcase \"pacman\":\n\t\treturn getPacmanRepos(\"/etc/pacman.conf\")\n\tdefault:\n\t\tmsg := \"Cannot find repos of unsupported package manager: \"\n\t\t_, message := genericError(msg, manager, []string{getManager()})\n\t\tlog.Fatal(message)\n\t}\n\treturn []Repo{} // will never reach here b/c of default case\n}", "title": "" }, { "docid": "e6d491dc113287b2c4a44fbb3c63dfd7", "score": "0.5542238", "text": "func getPacmanRepos(path string) (repos []Repo) {\n\tdata := fileToString(path)\n\t// match words and dashes in brackets without comments\n\tnameRegex := regexp.MustCompile(\"[^#]\\\\[(\\\\w|\\\\-)+\\\\]\")\n\t// match lines that start with Include= or Server= and anything after that\n\turlRegex := regexp.MustCompile(\"[^#](Include|Server)\\\\s*=\\\\s*.*\")\n\tnames := nameRegex.FindAllString(data, -1)\n\turls := urlRegex.FindAllString(data, -1)\n\tfor i, name := range names {\n\t\tif len(urls) > i {\n\t\t\trepos = append(repos, Repo{Name: name, Url: urls[i]})\n\t\t}\n\t}\n\treturn repos\n}", "title": "" }, { "docid": "bfabfd53c303fbe29208ad93d37c233c", "score": "0.55296534", "text": "func ListGithubTrending(language, since string) string {\n\tvar doc *goquery.Document\n\tvar e error\n\tresult := \"\\n```\\n\" + \"since:\" + since + \"\\n\\n#### \" + language + \"\\n\"\n\n\tif doc, e = goquery.NewDocument(\"https://github.com/trending?l=\" + language + \"&since=\" + since); e != nil {\n\t\tprintln(\"Error:\", e.Error())\n\t\tpanic(language)\n\t}\n\n\tdoc.Find(\"ol.repo-list li\").Each(func(i int, s *goquery.Selection) {\n\t\ttitle := s.Find(\"h3 a\").Text()\n\t\tdescription := s.Find(\"p.col-9\").Text()\n\t\turl, _ := s.Find(\"h3 a\").Attr(\"href\")\n\t\turl = \"https://github.com\" + url\n\t\tvar stars = \"0\"\n\t\tvar forks = \"0\"\n\t\ts.Find(\"a.muted-link.mr-3\").Each(func(i int, contentSelection *goquery.Selection) {\n\t\t\tif temp, ok := contentSelection.Find(\"svg\").Attr(\"aria-label\"); ok {\n\t\t\t\tswitch temp {\n\t\t\t\tcase \"star\":\n\t\t\t\t\tstars = contentSelection.Text()\n\t\t\t\tcase \"fork\":\n\t\t\t\t\tforks = contentSelection.Text()\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\tresult = result + \"* [\" + strings.Replace(strings.TrimSpace(title), \" \", \"\", -1) + \" (\" + strings.TrimSpace(stars) + \"star/\" + strings.TrimSpace(forks) + \"fork)](\" + url + \") : \" + strings.TrimSpace(description) + \"\\n\"\n\t})\n\tresult += \"```\"\n\treturn result\n}", "title": "" }, { "docid": "349689ea82357b94521dca22e5232843", "score": "0.5528682", "text": "func getMatchingRepos(repoNames []string, repoRegex string, regexMatchTimeout uint64) ([]string, error) {\n\tfilter, err := buildRegexFilter(repoRegex, regexMatchTimeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar matchedRepos []string\n\tfor _, repo := range repoNames {\n\t\tmatched, err := filter.MatchString(repo)\n\t\tif err != nil {\n\t\t\t// The only error regexp2 can throw is a timeout error\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif matched {\n\t\t\tmatchedRepos = append(matchedRepos, repo)\n\t\t}\n\t}\n\treturn matchedRepos, nil\n}", "title": "" }, { "docid": "d558f29b76b53d2d6a0bae82391f593e", "score": "0.5513492", "text": "func (s storage) RepoList(user *model.User, owned, active bool) ([]*model.Repo, error) {\n\trepos := make([]*model.Repo, 0)\n\tsess := s.engine.Table(\"repos\").\n\t\tJoin(\"INNER\", \"perms\", \"perms.perm_repo_id = repos.repo_id\").\n\t\tWhere(\"perms.perm_user_id = ?\", user.ID)\n\tif owned {\n\t\tsess = sess.And(builder.Eq{\"perms.perm_push\": true}.Or(builder.Eq{\"perms.perm_admin\": true}))\n\t}\n\tif active {\n\t\tsess = sess.And(builder.Eq{\"repos.repo_active\": true})\n\t}\n\treturn repos, sess.\n\t\tAsc(\"repo_full_name\").\n\t\tFind(&repos)\n}", "title": "" }, { "docid": "b788a427b3fd5847a8e3bd4f4ede0ea6", "score": "0.54934716", "text": "func getRepos() []Repository {\n\tres, err := FindAll(RepositoriesCollection, bson.D{})\n\n\tif err != nil {\n\t\tlog.Println(\"Error getting All\", err)\n\t\treturn []Repository{}\n\t}\n\n\tvar repos []Repository\n\tfor _, v := range res {\n\t\tvar r Repository\n\t\tmr, err := bson.Marshal(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\terr = bson.Unmarshal(mr, &r)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tr.ID = r.ID.(primitive.ObjectID).String()\n\t\tr.ID = strings.TrimLeft(strings.TrimRight(r.ID.(string), \"\\\")\"), \"ObjectID(\\\"\")\n\t\trepos = append(repos, r)\n\t}\n\n\treturn repos\n}", "title": "" }, { "docid": "a9e1e38928aadd290b5537859c620221", "score": "0.5463385", "text": "func (g *gitHub) FetchGoRepositories(ctx context.Context, day time.Time) ([]repository.Repository, error) {\n\tret := []repository.Repository{}\n\tpage := 0\n\tfor {\n\t\tpage++\n\t\tlog.Logger.Infof(\"github.FetchGoRepositories() page %d\", page)\n\t\tresult, resp, err := g.client.Search.Repositories(ctx,\n\t\t\tfmt.Sprintf(\"language:Go pushed:>=%s\", day.Format(\"2006-01-02\")),\n\t\t\t&github.SearchOptions{\n\t\t\t\tSort: \"committer-date\",\n\t\t\t\tOrder: \"desc\",\n\t\t\t\tListOptions: github.ListOptions{\n\t\t\t\t\tPage: page,\n\t\t\t\t\t// you can also set a custom page size up to 100 with the ?per_page parameter\n\t\t\t\t\t// https://developer.github.com/v3/#pagination\n\t\t\t\t\tPerPage: 100,\n\t\t\t\t},\n\t\t\t})\n\t\tif shouldRetry, err := g.waitIfAPIRateLimitExceeded(ctx, err); err != nil {\n\t\t\treturn nil, err\n\t\t} else if shouldRetry {\n\t\t\treturn g.FetchGoRepositories(ctx, day)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, xerrors.Errorf(\"failed to search repository: %w\", err)\n\t\t}\n\t\tfor _, repo := range result.Repositories {\n\t\t\tif repo.GetFork() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tret = append(ret, repository.Repository{\n\t\t\t\tPath: strings.Replace(repo.GetHTMLURL(), \"https://\", \"\", 1),\n\t\t\t\tDescription: fmt.Sprintf(\"%s: %s\", repo.GetDescription(), strings.Join(repo.Topics, \" \")),\n\t\t\t\tLastCommittedAt: repo.GetPushedAt().Time,\n\t\t\t})\n\t\t}\n\t\tif page >= resp.LastPage {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "ec1bd92b7e2c1b281832583b152e9f22", "score": "0.54550385", "text": "func GetMergedBranchList() (brlist []string, err error) {\n\n\tmbrlist := []string{}\n\t_, org := GetRepoAndOrgName()\n\trepo := GetParentRepoName()\n\n\tstdouts, _, err := new(gochips.PipedExec).\n\t\tCommand(\"gh\", \"pr\", \"list\", \"-L\", \"200\", \"--state\", \"merged\", \"--author\", org, \"--repo\", repo).\n\t\tRunToStrings()\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\tmbrlistraw := strings.Split(stdouts, \"\\n\")\n\tfor _, mbranchstr := range mbrlistraw {\n\t\tarr := strings.Split(mbranchstr, \":\")\n\t\tif len(arr) > 1 {\n\t\t\tif strings.Contains(arr[1], \"MERGED\") {\n\t\t\t\tarrstr := strings.ReplaceAll(strings.TrimSpace(arr[1]), \"MERGED\", \"\")\n\t\t\t\tarrstr = strings.TrimSpace(arrstr)\n\t\t\t\tif !strings.Contains(arrstr, \"master\") && !strings.Contains(arrstr, \"main\") {\n\t\t\t\t\tmbrlist = append(mbrlist, arrstr)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t_, _, err = new(gochips.PipedExec).\n\t\tCommand(git, \"remote\", \"prune\", origin).\n\t\tRunToStrings()\n\tgochips.ExitIfError(err)\n\n\tstdouts, _, err = new(gochips.PipedExec).\n\t\tCommand(git, branch, \"-r\").\n\t\tRunToStrings()\n\tgochips.ExitIfError(err)\n\tmybrlist := strings.Split(stdouts, \"\\n\")\n\n\tfor _, mybranch := range mybrlist {\n\t\tmybranch := strings.TrimSpace(string(mybranch))\n\t\tmybranch = strings.ReplaceAll(strings.TrimSpace(mybranch), \"origin/\", \"\")\n\t\tmybranch = strings.TrimSpace(mybranch)\n\t\tbfound := false\n\t\tif strings.Contains(mybranch, \"master\") || strings.Contains(mybranch, \"main\") || strings.Contains(mybranch, \"HEAD\") {\n\t\t\tbfound = false\n\t\t} else {\n\t\t\tfor _, mbranch := range mbrlist {\n\t\t\t\tmbranch = strings.ReplaceAll(strings.TrimSpace(mbranch), \"MERGED\", \"\")\n\t\t\t\tmbranch = strings.TrimSpace(mbranch)\n\t\t\t\tif mybranch == mbranch {\n\t\t\t\t\tbfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif bfound {\n\t\t\t// delete branch in fork\n\t\t\tbrlist = append(brlist, mybranch)\n\t\t}\n\t}\n\treturn brlist, nil\n}", "title": "" }, { "docid": "5568568b84329d1452714d7871b513f3", "score": "0.5448965", "text": "func GetAllRepos(c *gin.Context) {\n\trepos, err := store.GetAllRepos(c)\n\tif err != nil {\n\t\tmsg := \"Getting repository list\"\n\t\tc.Error(exterror.Append(err, msg))\n\t\treturn\n\t}\n\tpublic := []*model.Repo{}\n\tfor _, r := range repos {\n\t\tif !r.Private {\n\t\t\tpublic = append(public, r)\n\t\t}\n\t}\n\tIndentedJSON(c, 200, public)\n}", "title": "" }, { "docid": "31f07cee7447ecb9d3dad15619b7f37c", "score": "0.5434325", "text": "func gitsync(username string) (err error) {\n\tc := github.NewClient(nil)\n\n\trepos, _, err := c.Repositories.List(context.TODO(), username, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(\"export BASE_DIR=$PWD\")\n\tfmt.Println(\"eval `ssh-agent`\")\n\tfmt.Println(\"ssh-add ~/.ssh/id_rsa_mewmew\")\n\n\tfor _, r := range repos {\n\t\trepo, _, err := c.Repositories.Get(context.TODO(), username, *r.Name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif *repo.Fork {\n\t\t\tgitCloneURL := getGitCloneURL(*repo.CloneURL)\n\t\t\tfmt.Println(\"cd $BASE_DIR\")\n\t\t\tfmt.Println(\"git clone\", gitCloneURL)\n\t\t\tfmt.Printf(\"cd $BASE_DIR/%s\\n\", *repo.Name)\n\t\t\tfmt.Println(\"git pull\", *repo.Parent.CloneURL)\n\t\t\tfmt.Println(\"git push -u origin master\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7477ec519c4a6269c3f5088391317afb", "score": "0.542837", "text": "func Repos(root string, pattern string) (paths []string) {\n\tif s, err := os.Stat(root); !os.IsNotExist(err) && s.IsDir() {\n\t\troot, err = filepath.Abs(root)\n\t\tif err == nil {\n\t\t\treposInternal(&paths, root, \"\", pattern, true)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "1a0a71f91ecab158465f185fc0bb0703", "score": "0.54179263", "text": "func getPullRequests(owner string, repo string) (pullRequests []GitPR, err error) {\n\topt := &github.PullRequestListOptions{\n\t\tListOptions: github.ListOptions{\n\t\t\tPerPage: 50,\n\t\t},\n\t}\n\tprs, _, err := buzzClient.PullRequests.List(ctx, owner, repo, opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpullRequests = []GitPR{}\n\n\tfor _, elem := range prs {\n\n\t\tpullRequest := GitPR{}\n\t\tpullRequest.Number = *elem.Number\n\t\tpullRequest.Title = *elem.Title\n\t\tpullRequest.Sender = *elem.Head.User.Login\n\t\tfor _, assignee := range elem.Assignees {\n\t\t\tpullRequest.Assignees += *assignee.Login + \" \"\n\t\t}\n\t\tpullRequest.UpdatedAt = elem.UpdatedAt.Unix()\n\t\tpullRequest.Repo = repo\n\t\tpullRequest.ID = *elem.ID\n\t\tpullRequest.Link = *elem.HTMLURL\n\n\t\tfor _, label := range elem.Labels {\n\t\t\tpullRequest.Labels = append(pullRequest.Labels, *label)\n\t\t}\n\n\t\terr, states := getReviewStatesForPR(owner, pullRequest.Repo, pullRequest.Number)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpullRequest.ReviewState = states\n\n\t\tpullRequests = append(pullRequests, pullRequest)\n\t}\n\n\treturn pullRequests, nil\n}", "title": "" }, { "docid": "369da748e3014536831e433fe665ae41", "score": "0.54138863", "text": "func cloneRepos(updateRepoCh chan *config.Repo) {\n\tfor r := range updateRepoCh {\n\t\tif r.ClonedRepo == (repository.Repository{}) {\n\t\t\tfmt.Printf(\"Cloning repo %s\\n\", r.URL)\n\t\t\tclonedRepo, err := repository.CloneBare(r.URL)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error: Cloning repo %s: %v\\n\", r.URL, err)\n\t\t\t}\n\t\t\tr.ClonedRepo = clonedRepo\n\t\t} else {\n\t\t\tfmt.Printf(\"Fetch latest objects from repo %s\\n\", r.URL)\n\t\t\terr := r.ClonedRepo.Fetch(&git.FetchOptions{})\n\t\t\tif err != nil && err != git.NoErrAlreadyUpToDate {\n\t\t\t\tfmt.Printf(\"Error: Fetching objects from repo %s: %v\\n\", r.URL, err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0f704e5cb49bf589fd8350acde858187", "score": "0.5410128", "text": "func getAllRepoData(ctx context.Context) ([]repoStorageData, error) {\n\trootKey := makeReposRootKey(ctx)\n\tq := datastore.NewQuery(repoKind).Ancestor(rootKey)\n\tit := q.Run(ctx)\n\tcurrent := new(repoStorageData)\n\tresult := []repoStorageData{}\n\n\tvar err error\n\n\tfor _, err = it.Next(current); err == nil; _, err = it.Next(current) {\n\t\tresult = append(result, *current)\n\t}\n\n\tif err != datastore.Done {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "44ca75a42d6910b8e1dc0beed7ddee75", "score": "0.54017115", "text": "func copyRepo(repos []*harborModle.Repo, cli *harbor.Client, host string) []*models.Repository {\n\trepositories := make([]*models.Repository, 0)\n\tfor _, v := range repos {\n\t\t/*tag, err := cli.ListRepoTags(context.Background(), projectName, strings.Split(v.Name,\"/\")[1])\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}*/\n\t\t//for i := 0; i < int(v.TagsCount); i++ {\n\t\trepositories = append(repositories, &models.Repository{\n\t\t\tID: v.ID,\n\t\t\tName: strings.Split(host, \"//\")[1] + \"/\" + v.Name, /*+ \":\" + tag[i].Name*/\n\t\t\tProjectID: v.ProjectID,\n\t\t\tDescription: v.Description,\n\t\t\tPullCount: v.PullCount,\n\t\t\tStarCount: v.StarCount,\n\t\t\tTagsCount: v.TagsCount,\n\t\t\t//Tags: tag[i].Name,\n\t\t\tCreationTime: v.CreationTime,\n\t\t\tUpdateTime: v.UpdateTime,\n\t\t})\n\t\t//}\n\n\t}\n\treturn repositories\n}", "title": "" }, { "docid": "53ccc0f08cf5518d9dadf0525b539cb8", "score": "0.5386789", "text": "func selRepo(text string) (repo, error) {\n\tvar full_name string\n\tvar r repo\n\tif strings.Contains(text, \"/\") {\n\t\tfull_name = text\n\t} else {\n\t\tres, err := getRepoList(text)\n\t\tif err != nil {\n\t\t\treturn r, err\n\t\t}\n\t\tfor i := 0; i < len(res.Items); i++ {\n\t\t\tif strings.ToUpper(res.Items[i].Name) == strings.ToUpper(text) {\n\t\t\t\tfull_name = res.Items[i].FullName\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif full_name == \"\" {\n\t\t\treturn r, errors.New(\"Repository(\" + text + \") not found ...\")\n\t\t}\n\t}\n\tr, err := getRepo(full_name)\n\tif err != nil {\n\t\treturn r, err\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "9a55d39c8ff3418bbebc1deec6883e4f", "score": "0.53628886", "text": "func (c *Client) ListMyRepos() ([]*Repository, error) {\n\trepos := make([]*Repository, 0, 10)\n\treturn repos, c.getParsedResponse(\"GET\", \"/user/repos\", nil, nil, &repos)\n}", "title": "" }, { "docid": "5d01cd98f34cdf88e6db7404261ad6b6", "score": "0.53420043", "text": "func getFileDefinedRepos(GithubClient auth.GithubClient, allowedRepos []*types.AllowedRepo, tracker *stats.RunStats) ([]*github.Repository, error) {\n\tlogger := logging.GetLogger(\"git-xargs\")\n\n\tvar allRepos []*github.Repository\n\n\tfor _, allowedRepo := range allowedRepos {\n\n\t\tlogger.WithFields(logrus.Fields{\n\t\t\t\"Organization\": allowedRepo.Organization,\n\t\t\t\"Name\": allowedRepo.Name,\n\t\t}).Debug(\"Looking up filename provided repo\")\n\n\t\trepo, resp, err := GithubClient.Repositories.Get(context.Background(), allowedRepo.Organization, allowedRepo.Name)\n\n\t\tif err != nil {\n\t\t\tlogger.WithFields(logrus.Fields{\n\t\t\t\t\"Error\": err,\n\t\t\t\t\"Response Status Code\": resp.StatusCode,\n\t\t\t\t\"AllowedRepoOwner\": allowedRepo.Organization,\n\t\t\t\t\"AllowedRepoName\": allowedRepo.Name,\n\t\t\t}).Debug(\"error getting single repo\")\n\n\t\t\tif resp.StatusCode == 404 {\n\t\t\t\t// This repo does not exist / could not be fetched as named, so we won't include it in the list of repos to process\n\n\t\t\t\t// create an empty GitHub repo object to satisfy the stats tracking interface\n\t\t\t\tmissingRepo := &github.Repository{\n\t\t\t\t\tOwner: &github.User{Login: github.String(allowedRepo.Organization)},\n\t\t\t\t\tName: github.String(allowedRepo.Name),\n\t\t\t\t}\n\t\t\t\ttracker.TrackSingle(stats.RepoNotExists, missingRepo)\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\treturn allRepos, errors.WithStackTrace(err)\n\t\t\t}\n\t\t}\n\n\t\tif resp.StatusCode == 200 {\n\t\t\tlogger.WithFields(logrus.Fields{\n\t\t\t\t\"Organization\": allowedRepo.Organization,\n\t\t\t\t\"Name\": allowedRepo.Name,\n\t\t\t}).Debug(\"Successfully fetched repo\")\n\n\t\t\tallRepos = append(allRepos, repo)\n\t\t}\n\t}\n\treturn allRepos, nil\n}", "title": "" }, { "docid": "e413cee2668c1ab9ae17491a7d33e971", "score": "0.53396297", "text": "func GetGophersList() []*models.Gopher {\n\n\tclient := github.NewClient(nil)\n\t// list public repositories for org \"github\"\n\tctx := context.Background()\n\t// list all repositories for the authenticated user\n\t_, directoryContent, _, err := client.Repositories.GetContents(ctx, \"scraly\", \"gophers\", \"/\", nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tvar arr []*models.Gopher\n\n\tfor _, c := range directoryContent {\n\t\tif *c.Name == \".gitignore\" || *c.Name == \"README.md\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar name string = strings.Split(*c.Name, \".\")[0]\n\n\t\tarr = append(arr, &models.Gopher{name, *c.Path, *c.DownloadURL})\n\n\t}\n\n\treturn arr\n}", "title": "" }, { "docid": "6a6f64f33930296d36ed24b7c8691c7a", "score": "0.53265285", "text": "func (d *Mapper) GetRepos() ([]models.Repo, error) {\n\tlogrus.WithField(\"path\", di.GetConfig().DevelopmentDirectory()).Debug(\"Searching for repositories\")\n\n\tfiles, err := ioutil.ReadDir(di.GetConfig().DevelopmentDirectory())\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"repo: unable to list directory contents in dev directory '%s'\", di.GetConfig().DevelopmentDirectory())\n\t}\n\n\trepos := []models.Repo{}\n\n\tfor _, f := range files {\n\t\tif !f.IsDir() {\n\t\t\tcontinue\n\t\t}\n\n\t\tif f.Name() == \"scratch\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tservice := di.GetConfig().GetService(f.Name())\n\t\tif service == nil {\n\t\t\tlogrus.WithField(\"service\", f.Name()).Warn(\"Could not find a matching service entry in your configuration\")\n\t\t\tcontinue\n\t\t}\n\n\t\tchildRepos, err := d.GetReposForService(service)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"repo: unable to list directory contents in service directory '%s'\", di.GetConfig().DevelopmentDirectory())\n\t\t}\n\n\t\trepos = append(repos, childRepos...)\n\t}\n\n\treturn repos, nil\n}", "title": "" }, { "docid": "2aa81099af6dfdc6006d5a7501fd11fd", "score": "0.53263897", "text": "func searchResultsToRepoNodes(matches []result.Match) ([]query.Node, error) {\n\tnodes := make([]query.Node, 0, len(matches))\n\tfor _, match := range matches {\n\t\trepoMatch, ok := match.(*result.RepoMatch)\n\t\tif !ok {\n\t\t\treturn nil, errors.Errorf(\"expected type %T, but got %T\", &result.RepoMatch{}, match)\n\t\t}\n\n\t\trepoFieldValue := \"^\" + regexp.QuoteMeta(string(repoMatch.Name)) + \"$\"\n\t\tif repoMatch.Rev != \"\" {\n\t\t\trepoFieldValue += \"@\" + repoMatch.Rev\n\t\t}\n\n\t\tnodes = append(nodes, query.Parameter{\n\t\t\tField: query.FieldRepo,\n\t\t\tValue: repoFieldValue,\n\t\t})\n\t}\n\n\treturn nodes, nil\n}", "title": "" }, { "docid": "9f654563a30379448a1dd6fbbb7e6305", "score": "0.5322639", "text": "func (c *Client) getRepositories() ([]*model.Repository, error) {\n\tvar repositories []Repository\n\tvar dtrRepositories Repositories\n\n\tendpoint := fmt.Sprintf(\"%s/api/v0/repositories?pageSize=100\", c.url)\n\turlAPI, err := url.Parse(endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor len(endpoint) > 0 {\n\t\treq, err := http.NewRequest(http.MethodGet, endpoint, nil)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treq.SetBasicAuth(c.username, c.password)\n\t\tresp, err := c.client.Do(req)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tdata, err := io.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif resp.StatusCode < 200 || resp.StatusCode > 299 {\n\t\t\treturn nil, &common_http.Error{\n\t\t\t\tCode: resp.StatusCode,\n\t\t\t\tMessage: string(data),\n\t\t\t}\n\t\t}\n\n\t\tif err = json.Unmarshal(data, &dtrRepositories); err != nil {\n\t\t\tlog.Errorf(\"Failed to parse json response\")\n\t\t\tlog.Errorf(\"%v\", err)\n\t\t\tlog.Errorf(\"%s\", string(data))\n\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// merge the arrays\n\t\trepositories = append(repositories, dtrRepositories.Repositories...)\n\t\tendpoint = \"\"\n\n\t\tnextPage := resp.Header.Get(\"X-Next-Page-Start\")\n\t\tif len(nextPage) > 0 {\n\t\t\tquery := urlAPI.Query()\n\t\t\tquery.Set(\"pageStart\", nextPage)\n\t\t\tendpoint = urlAPI.Scheme + \"://\" + urlAPI.Host + urlAPI.Path + \"?\" + query.Encode()\n\t\t}\n\t}\n\n\tresult := []*model.Repository{}\n\n\tfor _, repository := range repositories {\n\t\tlog.Debugf(\"Processing DTR repo %s\", repository.Name)\n\t\tresult = append(result, &model.Repository{\n\t\t\tName: fmt.Sprintf(\"%s/%s\", repository.Namespace, repository.Name),\n\t\t})\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "ddad512154bb169744ec2d5ccc43f71a", "score": "0.53185487", "text": "func (o *Ops) ListRepos(username, namespace string) ([]string, error) {\n\tuid, err := db.FindUserIdByName(username)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgit, err := db.FindGitByUserId(uid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgitArgs := &gits.GitArgs{\n\t\tUsername: git.Username,\n\t\tApiToken: git.Token,\n\t\tUrl: git.Url,\n\t}\n\tc := gits.NewGiteaClient(gitArgs)\n\n\trepos, err := c.ListRepositories(namespace)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar repoName []string\n\tfor _, value := range repos {\n\t\trepoName = append(repoName, value.CloneURL)\n\t}\n\n\treturn repoName, nil\n}", "title": "" }, { "docid": "fc7f104d15ff0b271dc5e77322a4e021", "score": "0.53028035", "text": "func (fgc *FakeGithubClient) ListRepos(org string) ([]string, error) {\n\treturn fgc.Repos, nil\n}", "title": "" }, { "docid": "1649cc45d1feebd55c75d4bcae184ab1", "score": "0.5291416", "text": "func getYumRepos(path string) (repos []Repo) {\n\tvar fullNames []string\n\tvar urls []string\n\tcommentRegex := regexp.MustCompile(\"^\\\\s*#.*\")\n\tfor _, line := range fileToLines(path) {\n\t\t// filter comments and convert to string\n\t\tstrLine := string(line)\n\t\tif !(commentRegex.Match(line)) {\n\t\t\t// first, attempt to replace the prefix\n\t\t\treplaceName := strings.TrimPrefix(strLine, \"name=\")\n\t\t\treplaceURL := strings.TrimPrefix(strLine, \"baseurl=\")\n\t\t\t// if they are different, we know a prefix was replaced\n\t\t\tif replaceName != strLine {\n\t\t\t\tfullNames = append(fullNames, replaceName)\n\t\t\t} else if replaceURL != strLine {\n\t\t\t\turls = append(urls, replaceURL)\n\t\t\t}\n\t\t}\n\t}\n\t// Get shortest list to zip with, so we don't get an index error\n\tshortList := fullNames\n\tif len(fullNames) > len(urls) {\n\t\tshortList = urls\n\t}\n\t// Construct Repos\n\twhitespaceRegex := regexp.MustCompile(\"\\\\s+\")\n\tfor i, _ := range shortList {\n\t\tnameSplit := whitespaceRegex.Split(fullNames[i], -1)\n\t\tshortName := nameSplit[len(nameSplit)-1]\n\t\trepo := Repo{Name: shortName, Fullname: fullNames[i], Url: urls[i]}\n\t\trepos = append(repos, repo)\n\t}\n\treturn repos\n}", "title": "" }, { "docid": "596ce7d6e780ffbf1843e7958ea8f56c", "score": "0.5282725", "text": "func (g *localGitlab) SearchRepos(search string) ([]*searchRepoItem, error) {\n\topt := &gitlabApp.ListProjectsOptions{Search: gitlabApp.String(search)}\n\tprojects, _, err := g.Client().Projects.ListProjects(opt)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn nil, err\n\t}\n\n\tt := make([]*searchRepoItem, 0, len(projects))\n\tfor _, p := range projects {\n\t\titem := &searchRepoItem{}\n\t\tt = append(t, item)\n\t\titem.ID = string(p.ID)\n\t\titem.Name = p.PathWithNamespace\n\t\titem.Description = p.Description\n\t}\n\treturn t, nil\n}", "title": "" }, { "docid": "d251973a1854da746a50e3524e7975ec", "score": "0.5262986", "text": "func HarborRepositories(ctx context.Context, auth types.AuthConfig) ([]*HarborRepository, error) {\n\theaders := http.Header{}\n\theaders.Add(\"Authorization\", \"Basic \"+base64.StdEncoding.EncodeToString([]byte(\n\t\tauth.Username+\":\"+auth.Password,\n\t)))\n\tresp, err := util.HTTPSend(\n\t\tctx,\n\t\thttp.MethodGet,\n\t\tfmt.Sprintf(\"%s/api/search\", auth.ServerAddress),\n\t\tnil, nil, headers, 0)\n\tif err != nil {\n\t\tlog.Error(\"util.HTTPSend\", err, nil)\n\t\treturn nil, err\n\t}\n\tobj := HarborSerchResult{}\n\tif err := json.Unmarshal(resp, &obj); err != nil {\n\t\treturn nil, err\n\t}\n\treturn obj.Repositories, nil\n}", "title": "" }, { "docid": "3060c283880530187aadadf4c56330f3", "score": "0.5259802", "text": "func AllStudents(\n ctx context.Context,\n client *github.Client,\n postfeedback bool,\n prefix, orgname string,\n username_name map[string]string) error {\n \n // Get all repos for the org with prefix\n unfilteredrepos, err := OrgRepos(ctx, client, orgname)\n if err != nil {\n return err\n }\n\n // Filter by prefix for assignment\n repos := FilterReposByPref(unfilteredrepos, prefix)\n\n // Iterate over all repos with given prefix\n for _, repo := range repos {\n\n // Look up name by username\n // Note: It's non blocking for name mapping to not be present here,\n // but there will be a warning message.\n username := UsernameFromRepo(repo, prefix)\n name, prs := username_name[username]\n if !prs {\n name = \"\"\n }\n\n err := HandleRepo(ctx, client, repo, username, name, orgname, postfeedback)\n if err != nil {\n return err\n }\n\n if !postfeedback {\n fmt.Print(\"Press enter to continue\")\n _, inerr := GatherInput()\n if inerr != nil {\n return inerr\n }\n }\n }\n return nil\n}", "title": "" }, { "docid": "a9fa41ec556a419f8ea50805240f403d", "score": "0.52585447", "text": "func (mock) Contributors(repo string) ([]github.Contributor, error) {\n\tswitch repo {\n\tcase \"golang/go\":\n\t\treturn []github.Contributor{\n\t\t\t{Login: \"anna\", Contributions: 27},\n\t\t\t{Login: \"jacob\", Contributions: 18},\n\t\t\t{Login: \"kell\", Contributions: 9},\n\t\t\t{Login: \"carter\", Contributions: 6},\n\t\t\t{Login: \"rory\", Contributions: 1},\n\t\t}, nil\n\t}\n\n\treturn nil, errors.New(\"could not reach API\")\n}", "title": "" }, { "docid": "064ba162697f0efca227136c71cc04d7", "score": "0.5258229", "text": "func (c Gitea) GetUserRepos(targetUsername string) ([]Repo, error) {\n\trepoData := []Repo{}\n\n\tfor i := 1; ; i++ {\n\t\trps, resp, err := c.ListUserRepos(targetUsername, gitea.ListReposOptions{ListOptions: gitea.ListOptions{\n\t\t\tPage: i,\n\t\t\tPageSize: c.perPage,\n\t\t}})\n\n\t\tif err != nil {\n\t\t\tif resp != nil && resp.StatusCode == http.StatusNotFound {\n\t\t\t\terr = fmt.Errorf(\"org \\\"%s\\\" not found\", targetUsername)\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\n\t\trepoDataFiltered, err := c.filter(rps)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trepoData = append(repoData, repoDataFiltered...)\n\n\t\t// Exit the loop when we've seen all pages.\n\t\tif len(rps) < perPage {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn repoData, nil\n}", "title": "" }, { "docid": "e25f29f64750e8702eba754038612cc8", "score": "0.52482724", "text": "func Forks(ctx *context.Context) {\n\tctx.Data[\"Title\"] = ctx.Tr(\"repo.forks\")\n\n\tpage := ctx.FormInt(\"page\")\n\tif page <= 0 {\n\t\tpage = 1\n\t}\n\n\tpager := context.NewPagination(ctx.Repo.Repository.NumForks, setting.ItemsPerPage, page, 5)\n\tctx.Data[\"Page\"] = pager\n\n\tforks, err := repo_model.GetForks(ctx.Repo.Repository, db.ListOptions{\n\t\tPage: pager.Paginater.Current(),\n\t\tPageSize: setting.ItemsPerPage,\n\t})\n\tif err != nil {\n\t\tctx.ServerError(\"GetForks\", err)\n\t\treturn\n\t}\n\n\tfor _, fork := range forks {\n\t\tif err = fork.LoadOwner(ctx); err != nil {\n\t\t\tctx.ServerError(\"LoadOwner\", err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tctx.Data[\"Forks\"] = forks\n\n\tctx.HTML(http.StatusOK, tplForks)\n}", "title": "" }, { "docid": "af6f40480fa2ae318ce6e035b69dd1e2", "score": "0.5240761", "text": "func readRevsByRepo() (map[string][]string, error) {\n\tinfos, err := ioutil.ReadDir(indexDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trevsByRepo := map[string][]string{}\n\tfor _, info := range infos {\n\t\tmatches := indexFilenamePattern.FindStringSubmatch(info.Name())\n\t\tif len(matches) > 0 {\n\t\t\trevsByRepo[matches[1]] = append(revsByRepo[matches[1]], matches[2])\n\t\t}\n\t}\n\n\treturn revsByRepo, nil\n}", "title": "" }, { "docid": "99d8457f7559865610e276902cfe0cac", "score": "0.5240604", "text": "func printRepoUrls(repos appsv1.Repositories) {\n\tfor _, r := range repos {\n\t\tfmt.Println(r.Repo)\n\t}\n}", "title": "" }, { "docid": "dc7da20f125e2d191397429bbca2fbc3", "score": "0.5239995", "text": "func QueryRepos(token string) ([]GQLRepo, error) {\n\tvar query struct {\n\t\tViewer struct {\n\t\t\tRepositories struct {\n\t\t\t\tNodes []GQLRepo\n\t\t\t\tPageInfo struct {\n\t\t\t\t\tHasNextPage bool\n\t\t\t\t\tEndCursor githubv4.String\n\t\t\t\t}\n\t\t\t} `graphql:\"repositories(first: 100, after: $reposCursor, orderBy:{field: NAME, direction: ASC})\"`\n\t\t}\n\t}\n\n\tvariables := map[string]interface{}{\n\t\t\"reposCursor\": (*githubv4.String)(nil),\n\t}\n\n\tctx := context.Background()\n\tclient, _ := newGQLClient(token)\n\n\tvar allRepos []GQLRepo\n\tfor {\n\t\terr := client.Query(ctx, &query, variables)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, repo := range query.Viewer.Repositories.Nodes {\n\t\t\tallRepos = append(allRepos, repo)\n\t\t}\n\n\t\tif !query.Viewer.Repositories.PageInfo.HasNextPage {\n\t\t\tbreak\n\t\t}\n\t\tvariables[\"reposCursor\"] = githubv4.NewString(query.Viewer.Repositories.PageInfo.EndCursor)\n\t}\n\n\treturn allRepos, nil\n}", "title": "" }, { "docid": "d102fd5e387db51367dae071d65b3b31", "score": "0.5233483", "text": "func (owner RepoOwner) GetRepos() ([]Repo, error) {\n\tclient := resty.New()\n\tresp, err := client.R().\n\t\tEnableTrace().\n\t\tGet(owner.ReposURL)\n\n\tif err != nil {\n\t\treturn make([]Repo, 0), nil\n\t}\n\n\tvar userRepos []Repo\n\n\tjson.Unmarshal(resp.Body(), &userRepos)\n\n\treturn userRepos, nil\n}", "title": "" }, { "docid": "4cd60567fbd8e5c4cb141859214f5dde", "score": "0.5229911", "text": "func getRepoInitContainers(repos []string) []corev1.Container {\n\tvar repoInitContainers []corev1.Container\n\tfor i, repo := range repos {\n\t\tinitContainer := corev1.Container{\n\t\t\tName: \"git-init-\" + strconv.Itoa(i),\n\t\t\tImage: \"danistrebel/kita-git-init\",\n\t\t\tArgs: []string{\n\t\t\t\trepo,\n\t\t\t},\n\t\t\tVolumeMounts: []corev1.VolumeMount{\n\t\t\t\t{\n\t\t\t\t\tName: \"project-files\",\n\t\t\t\t\tMountPath: \"/git\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\trepoInitContainers = append(repoInitContainers, initContainer)\n\t}\n\n\treturn repoInitContainers\n}", "title": "" }, { "docid": "e1d494e5a21f1c1d4685019014a539f2", "score": "0.5228986", "text": "func iterate(root string) error {\n\n\ttype result struct {\n\t\trepo string\n\t\tcommits []string\n\t}\n\n\tvar results []result\n\n\tdirs, err := ioutil.ReadDir(root)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"read failed\")\n\t}\n\n\tvar wg sync.WaitGroup\n\tvar commits []string\n\tfor _, dir := range dirs {\n\n\t\trepo := filepath.Join(root, dir.Name())\n\t\tif !git.IsValidRepo(repo) {\n\t\t\tcontinue\n\t\t}\n\t\t// update repo\n\t\twg.Add(1)\n\t\tgo func(repo string) {\n\t\t\tdefer wg.Done()\n\t\t\tcommits, _ = git.Pull(repo)\n\n\t\t\tif len(commits) > 0 {\n\t\t\t\tresults = append(results, result{dir.Name(), commits})\n\t\t\t}\n\t\t}(repo)\n\t}\n\n\t// wait for all goroutines to finish\n\twg.Wait()\n\n\t// print changes\n\tfor _, r := range results {\n\t\tfmt.Println(r.repo) // print repo-name\n\t\tfor _, c := range r.commits {\n\t\t\tfmt.Printf(\"* %s\\n\", c)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e22f4e482002434bdd454c039eb145af", "score": "0.52247757", "text": "func getRevsForMatchedRepo(repo api.RepoName, pats []patternRevspec) (matched []search.RevisionSpecifier, clashing []search.RevisionSpecifier) {\n\trevLists := make([][]search.RevisionSpecifier, 0, len(pats))\n\tfor _, rev := range pats {\n\t\tif rev.includePattern.MatchString(string(repo)) {\n\t\t\trevLists = append(revLists, rev.revs)\n\t\t}\n\t}\n\t// exactly one match: we accept that list\n\tif len(revLists) == 1 {\n\t\tmatched = revLists[0]\n\t\treturn\n\t}\n\t// no matches: we generate a dummy list containing only master\n\tif len(revLists) == 0 {\n\t\tmatched = []search.RevisionSpecifier{{RevSpec: \"\"}}\n\t\treturn\n\t}\n\t// if two repo specs match, and both provided non-empty rev lists,\n\t// we want their intersection, so we count the number of times we\n\t// see a revision in the rev lists, and make sure it matches the number\n\t// of rev lists\n\trevCounts := make(map[search.RevisionSpecifier]int, len(revLists[0]))\n\n\tvar aliveCount int\n\tfor i, revList := range revLists {\n\t\taliveCount = 0\n\t\tfor _, rev := range revList {\n\t\t\tif revCounts[rev] == i {\n\t\t\t\taliveCount += 1\n\t\t\t}\n\t\t\trevCounts[rev] += 1\n\t\t}\n\t}\n\n\tif aliveCount > 0 {\n\t\tmatched = make([]search.RevisionSpecifier, 0, len(revCounts))\n\t\tfor rev, seenCount := range revCounts {\n\t\t\tif seenCount == len(revLists) {\n\t\t\t\tmatched = append(matched, rev)\n\t\t\t}\n\t\t}\n\t\tsort.Slice(matched, func(i, j int) bool { return matched[i].Less(matched[j]) })\n\t\treturn\n\t}\n\n\tclashing = make([]search.RevisionSpecifier, 0, len(revCounts))\n\tfor rev := range revCounts {\n\t\tclashing = append(clashing, rev)\n\t}\n\t// ensure that lists are always returned in sorted order.\n\tsort.Slice(clashing, func(i, j int) bool { return clashing[i].Less(clashing[j]) })\n\treturn\n}", "title": "" }, { "docid": "d1231b766205f2be8b4e6ad080294d46", "score": "0.52176106", "text": "func (s *Server) List(ctx context.Context, q *RepoQuery) (*appsv1.RepositoryList, error) {\n\trepoList, err := s.db.ListRepositories(ctx)\n\tif repoList != nil {\n\t\tnewItems := make([]appsv1.Repository, 0)\n\t\tfor _, repo := range repoList.Items {\n\t\t\tif s.enf.EnforceClaims(ctx.Value(\"claims\"), \"repositories\", \"get\", repo.Repo) {\n\t\t\t\tnewItems = append(newItems, *redact(&repo))\n\t\t\t}\n\t\t}\n\t\trepoList.Items = newItems\n\t}\n\treturn repoList, err\n}", "title": "" }, { "docid": "eed550d15a9fd9f39162dc93744ebda2", "score": "0.5213078", "text": "func ReposFromGitHub(rs []*github.Repository) []host.Repo {\n\trepos := make([]host.Repo, len(rs))\n\tfor i, r := range rs {\n\t\trepos[i] = RepoFromGitHub(r)\n\t}\n\treturn repos\n}", "title": "" }, { "docid": "3d1ba39090d21ab263931145459adc31", "score": "0.520223", "text": "func gitListObjects(ref string, exclude []string) ([]string, error) {\n\targs := []string{\"rev-list\", \"--objects\", ref}\n\tfor _, e := range exclude {\n\t\targs = append(args, \"^\"+e)\n\t}\n\trevList := exec.Command(\"git\", args...)\n\t// dunno why - sometime git doesnt want to work on the inner repo/.git\n\tif strings.HasSuffix(thisGitRepo, \".git\") {\n\t\tthisGitRepo = filepath.Dir(thisGitRepo)\n\t}\n\trevList.Dir = thisGitRepo // GIT_DIR\n\tout, err := revList.CombinedOutput()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"rev-list failed: %s\\n%q\", err, string(out))\n\t}\n\tvar objs []string\n\ts := bufio.NewScanner(bytes.NewReader(out))\n\tfor s.Scan() {\n\t\tobjs = append(objs, strings.Split(s.Text(), \" \")[0])\n\t}\n\tif err := s.Err(); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"scanning rev-list output failed: %s\", err)\n\t}\n\treturn objs, nil\n}", "title": "" }, { "docid": "dd3a381fc355f0d28ee45884ba053bc6", "score": "0.52018154", "text": "func repoSets(indexed *zoektutil.IndexedSearchRequest, mode search.GlobalSearchMode) []repoData {\n\trepoSets := []repoData{UnindexedList(indexed.Unindexed)} // unindexed included by default\n\tif mode != search.SearcherOnly {\n\t\trepoSets = append(repoSets, IndexedMap(indexed.Repos()))\n\t}\n\treturn repoSets\n}", "title": "" }, { "docid": "41504b09f0035ac34b699d101c2647ae", "score": "0.5198247", "text": "func GetRepos(username string) ([]map[string]interface{}, error) {\n\turl := fmt.Sprintf(\"https://api.github.com/users/%s/repos?sort=created&direction=desc\", username)\n\n\trequest, err := http.NewRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse, err := Client.Do(request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer response.Body.Close()\n\n\tm := []map[string]interface{}{}\n\terr = json.NewDecoder(response.Body).Decode(&m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "bea9093de5b49e9f9de22cfdc22a2de8", "score": "0.5182277", "text": "func (f *FakeProvider) GetRepositories() ([]*GitRepository, error) {\n\treturn nil, fmt.Errorf(\"not implemented\")\n}", "title": "" }, { "docid": "7846ccf91ff6f3836f32a2e076d896d2", "score": "0.51718855", "text": "func GatherRepositories(sess *Session) {\n\tvar ch = make(chan *Owner, len(sess.Targets))\n\tsess.Out.Debug(\"Number of targets: %d\\n\", len(sess.Targets))\n\tvar wg sync.WaitGroup\n\tvar threadNum int\n\tif len(sess.Targets) == 1 {\n\t\tthreadNum = 1\n\t} else if len(sess.Targets) <= sess.Threads {\n\t\tthreadNum = len(sess.Targets) - 1\n\t} else {\n\t\tthreadNum = sess.Threads\n\t}\n\twg.Add(threadNum)\n\tsess.Out.Debug(\"Threads for repository gathering: %d\\n\", threadNum)\n\tfor i := 0; i < threadNum; i++ {\n\t\tgo func() {\n\t\t\tfor {\n\t\t\t\ttarget, ok := <-ch\n\t\t\t\tif !ok {\n\t\t\t\t\twg.Done()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\trepos, err := sess.Client.GetRepositoriesFromOwner(*target)\n\t\t\t\tif err != nil {\n\t\t\t\t\tsess.Out.Error(\" Failed to retrieve repositories from %s: %s\\n\", *target.Login, err)\n\t\t\t\t}\n\t\t\t\tif len(repos) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor _, repo := range repos {\n\t\t\t\t\tsess.Out.Debug(\" Retrieved repository: %s\\n\", *repo.CloneURL)\n\t\t\t\t\tsess.AddRepository(repo)\n\t\t\t\t}\n\t\t\t\tsess.Out.Info(\" Retrieved %d %s from %s\\n\", len(repos), Pluralize(len(repos), \"repository\", \"repositories\"), *target.Login)\n\t\t\t}\n\t\t}()\n\t}\n\n\tfor _, target := range sess.Targets {\n\t\tch <- target\n\t}\n\tclose(ch)\n\twg.Wait()\n}", "title": "" }, { "docid": "cc9e9b1bdef00cb35a5e95b9f0004ae1", "score": "0.51593876", "text": "func (p *BitbucketProvider) GetRepos() []*entity.Repository {\n\trequestURL := url.URL{\n\t\tScheme: p.Scheme,\n\t\tHost: p.BaseURL,\n\t\tPath: p.Path,\n\t}\n\n\tquery := requestURL.Query()\n\t// role is required otherwise we will get all bitbucket repos.\n\tquery.Set(\"role\", \"contributor\")\n\n\tif p.Visibility == \"public\" {\n\t\t// By default Bitbucket API returns all repositories\n\t\tquery.Set(\"q\", \"is_private = false\")\n\t}\n\n\trequestURL.RawQuery = query.Encode()\n\n\trequest, err := http.NewRequest(http.MethodGet, requestURL.String(), nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\trequest.SetBasicAuth(p.Username, p.Token)\n\n\tclient := &http.Client{}\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdefer response.Body.Close()\n\tbody, err := ioutil.ReadAll(response.Body)\n\n\tvar bitbucketRepos *BitbucketRepository\n\terr = json.Unmarshal([]byte(body), &bitbucketRepos)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\trepos := make([]*entity.Repository, len(bitbucketRepos.Values))\n\tfor index, repo := range bitbucketRepos.Values {\n\t\trepos[index] = &entity.Repository{\n\t\t\tID: repo.UUID,\n\t\t\tFullName: repo.FullName,\n\t\t\tName: repo.Name,\n\t\t}\n\t}\n\n\treturn repos\n}", "title": "" }, { "docid": "decd479a8fa17573c5e2e1f93047c6d6", "score": "0.51413774", "text": "func (s *SearchService) Repositories(query string, opt *SearchOptions) (*RepositoriesSearchResult, *Response, error) {\n\tresult := new(RepositoriesSearchResult)\n\tresp, err := s.search(query, opt, result)\n\treturn result, resp, err\n}", "title": "" }, { "docid": "a0a08d7aa5cd4c603339c989cf726d6f", "score": "0.5127564", "text": "func fetchOrgsRepos(done chan<- bool, orgMapChan chan<- map[string]bool, client *github.Client) {\n\torgs, _, err1 := client.Organizations.List(context.Background(), \"shyamkatta\", nil)\n\tif err1 == nil {\n\t\tfmt.Println(orgs, \" is list of orgs\")\n\t} else {\n\t\tfmt.Println(err1, \" is err1 \")\n\t}\n\tdone <- true\n\t// need to populate the orgMapChan which will be used to populate repos\n}", "title": "" }, { "docid": "1924cc82a21238663171fbdf2d747025", "score": "0.51139575", "text": "func (f *RepoFetcher) GetProjectsWithAtLeastDevAccess() ([]Repo, error) {\n\tvar repos []Repo\n\n\topt := &gitlab.ListGroupProjectsOptions{\n\t\tMinAccessLevel: gitlab.AccessLevel(gitlab.DeveloperPermissions),\n\t\tListOptions: gitlab.ListOptions{\n\t\t\tPerPage: 100,\n\t\t},\n\t}\n\n\tf.logger.Debugf(\"Fetching gitlab repos for %d groups (%s) ...\", len(f.config.Groups), f.config.Groups)\n\n\tfor _, group := range f.config.Groups {\n\t\tprojects, _, err := f.client.ListGroupProjects(group, opt, addIncludeSubgroups)\n\t\tif err != nil {\n\t\t\treturn []Repo{}, fmt.Errorf(\"failed to fetch GitLab projects or group %q: %v\", group, err)\n\t\t}\n\n\t\tfor _, p := range projects {\n\t\t\trepos = append(repos, Repo{\n\t\t\t\tID: p.ID,\n\t\t\t\tName: p.Name,\n\t\t\t\tFullPath: p.PathWithNamespace,\n\t\t\t})\n\t\t}\n\n\t}\n\n\tf.logger.Debugf(\"Fetching gitlab repos done. Got %d repos.\", len(repos))\n\n\treturn repos, nil\n}", "title": "" }, { "docid": "f43e9e513c0b85aa366a91e0759fc3a8", "score": "0.51042575", "text": "func GitHubVersionSpider(url string) (versions []string) {\n\taccessToken := os.Getenv(\"GITHUB_TOKEN\")\n\tif accessToken == \"\" {\n\t\tlog.Fatal(\"Please set GITHUB_TOKEN environment variable.\")\n\t}\n\tu, err := neturl.Parse(url)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif u.Host != \"github.com\" {\n\t\treturn\n\t}\n\tpathStr := strings.Split(u.Path, \"/\")\n\tuser, repo := pathStr[1], pathStr[2]\n\tctx := context.Background()\n\tts := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: accessToken},\n\t)\n\ttc := oauth2.NewClient(ctx, ts)\n\tclient := github.NewClient(tc)\n\topt := &github.ListOptions{}\n\t//version, _, _ := client.Repositories.ListTags(ctx, user, repo, opt)\n\tvers, _, err := client.Repositories.ListTags(ctx, user, repo, opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tbrchs, _, err := client.Repositories.ListBranches(ctx, user, repo, opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor i := range vers {\n\t\tversions = append(versions, vers[i].GetName())\n\t}\n\tfor i := range brchs {\n\t\tversions = append(versions, brchs[i].GetName())\n\t}\n\treturn versions\n}", "title": "" }, { "docid": "299263ca41631cf9b36361789aa0ebc1", "score": "0.50968415", "text": "func partitionHostRepos(host string, repos []string, maxReposPerQuery int) []*QueryState {\n\t// Heuristic targeting ChromeOS like structure with lots of repos under\n\t// chromiumos/ prefix.\n\tbyPrefix := make(map[string][]string, 2)\n\tfor _, r := range repos {\n\t\tprefix := strings.SplitN(r, \"/\", 2)[0]\n\t\tbyPrefix[prefix] = append(byPrefix[prefix], r)\n\t}\n\tprefixes := make([]string, len(byPrefix))\n\tfor prefix := range byPrefix {\n\t\tprefixes = append(prefixes, prefix)\n\t}\n\tsort.Strings(prefixes)\n\n\tqueries := make([]*QueryState, 0, 1)\n\tremainingRepos := repos[:0] // re-use the slice.\n\tfor _, prefix := range prefixes {\n\t\tif shared := byPrefix[prefix]; len(shared) < minReposPerPrefixQuery {\n\t\t\tremainingRepos = append(remainingRepos, shared...)\n\t\t} else {\n\t\t\tqueries = append(queries, &QueryState{\n\t\t\t\tHost: host,\n\t\t\t\tCommonProjectPrefix: prefix,\n\t\t\t})\n\t\t}\n\t}\n\tif len(remainingRepos) == 0 {\n\t\treturn queries\n\t}\n\n\t// Split remainingRepos into queries minimizing max of repos per query.\n\t// TODO(crbug/1163177): take ref_regexp into account, since most LUCI projects\n\t// watching >1 project use the same ref(s) for each, which in turn allows to\n\t// specify `branch:` search term for Gerrit.\n\t// Note that rounding up positive int division is (x-1)/y + 1.\n\tneededQueries := (len(remainingRepos)-1)/maxReposPerQuery + 1\n\tmaxPerQuery := (len(remainingRepos)-1)/neededQueries + 1\n\tsort.Strings(remainingRepos)\n\tfor {\n\t\tq := &QueryState{Host: host}\n\t\tswitch l := len(remainingRepos); {\n\t\tcase l == 0:\n\t\t\treturn queries\n\t\tcase l <= maxPerQuery:\n\t\t\tq.OrProjects = remainingRepos\n\t\tdefault:\n\t\t\tq.OrProjects = remainingRepos[:maxPerQuery]\n\t\t}\n\t\tqueries = append(queries, q)\n\t\tremainingRepos = remainingRepos[len(q.GetOrProjects()):]\n\t}\n}", "title": "" }, { "docid": "246b26a90ceddd6ccbac56d2f53a4ebf", "score": "0.50915724", "text": "func GetRepoDigests(image string) string {\n\trepo := strings.Split(image, \":\")[0]\n\treturn \"[\\\"\" + repo + \"@sha256:\" + image + \"\\\"]\"\n}", "title": "" }, { "docid": "3b538af9fba8c1173c55d1bca573ad4a", "score": "0.5091326", "text": "func (c Bitbucket) GetUserRepos(targetUser string) ([]Repo, error) {\n\tresp, err := c.Users.Repositories(targetUser)\n\tif err != nil {\n\t\treturn []Repo{}, err\n\t}\n\n\treturn c.filter(resp)\n}", "title": "" }, { "docid": "c6b6830535713b167aff1c434eb14cd3", "score": "0.5070892", "text": "func (c Gitlab) GetOrgRepos(targetOrg string) ([]Repo, error) {\n\tallGroups := []string{}\n\trepoData := []Repo{}\n\tlongFetch := false\n\n\tif targetOrg == \"all-users\" {\n\t\tcolorlog.PrintErrorAndExit(\"When using the 'all-users' keyword the '--clone-type=user' flag should be set\")\n\t}\n\n\tif targetOrg == \"all-groups\" {\n\t\tgitLabAllGroups = true\n\t\tlongFetch = true\n\n\t\tgrps, err := c.GetTopLevelGroups()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error getting groups error: %v\", err)\n\t\t}\n\n\t\tallGroups = append(allGroups, grps...)\n\n\t} else {\n\t\tallGroups = append(allGroups, targetOrg)\n\t}\n\n\tif os.Getenv(\"GHORG_GITLAB_GROUP_EXCLUDE_MATCH_REGEX\") != \"\" {\n\t\tallGroups = filterGitlabGroupByExcludeMatchRegex(allGroups)\n\t}\n\n\tfor i, group := range allGroups {\n\t\tif longFetch {\n\t\t\tif i == 0 {\n\t\t\t\tfmt.Println(\"\")\n\t\t\t}\n\t\t\tmsg := fmt.Sprintf(\"fetching repos for group: %v\", group)\n\t\t\tcolorlog.PrintInfo(msg)\n\t\t}\n\t\trepos, err := c.GetGroupRepos(group)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error fetching repos for group '%s', error: %v\", group, err)\n\t\t}\n\n\t\trepoData = append(repoData, repos...)\n\n\t}\n\n\treturn repoData, nil\n}", "title": "" }, { "docid": "da92d71eb02d9020e1a65110a91c46ed", "score": "0.5060122", "text": "func GatherLocalRepositories(sess *Session) {\n\n\t// This is the number of targets as we don't do forks or anything else.\n\t// It will contain directorys, that will then be added to the repo count\n\t// if they contain a .git directory\n\tsess.Stats.Targets = len(sess.LocalDirs)\n\tsess.Stats.Status = StatusGathering\n\tsess.Out.Important(\"Gathering Local Repositories...\\n\")\n\n\tfor _, pth := range sess.LocalDirs {\n\n\t\tif !PathExists(pth, sess) {\n\t\t\tsess.Out.Error(\"\\n[*] <%s> does not exist! Quitting.\\n\", pth)\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\t// Gather all paths in the tree\n\t\terr0 := filepath.Walk(pth, func(path string, f os.FileInfo, err1 error) error {\n\t\t\tif err1 != nil {\n\t\t\t\tsess.Out.Error(\"Failed to enumerate the path: %s\\n\", err1.Error())\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t// If it is a directory then move forward\n\t\t\tif f.IsDir() {\n\n\t\t\t\t// If there is a .git directory then we have a repo\n\t\t\t\tif filepath.Ext(path) == \".git\" { // TODO Should we reverse this to ! to make the code cleaner\n\n\t\t\t\t\tparent, _ := filepath.Split(path)\n\n\t\t\t\t\tgitProjName, _ := filepath.Split(parent)\n\n\t\t\t\t\topenRepo, err2 := git.PlainOpen(parent)\n\t\t\t\t\tif err2 != nil {\n\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\n\t\t\t\t\tref, err3 := openRepo.Head()\n\t\t\t\t\tif err3 != nil {\n\t\t\t\t\t\tsess.Out.Error(\"Failed to open the repo HEAD: %s\\n\", err3.Error())\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\n\t\t\t\t\t// Get the name of the branch we are working on\n\t\t\t\t\ts := ref.Strings()\n\t\t\t\t\tbranchPath := fmt.Sprintf(\"%s\", s[0])\n\t\t\t\t\tbranchPathParts := strings.Split(branchPath, string(\"refs/heads/\"))\n\t\t\t\t\tbranchName := branchPathParts[len(branchPathParts)-1]\n\t\t\t\t\tpBranchName := &branchName\n\n\t\t\t\t\tcommit, _ := openRepo.CommitObject(ref.Hash())\n\t\t\t\t\tvar commitHash = commit.Hash[:]\n\n\t\t\t\t\t// TODO make this a generic function at some point\n\t\t\t\t\t// Generate a uid for the repo\n\t\t\t\t\th := sha1.New()\n\t\t\t\t\trepoID := fmt.Sprintf(\"%x\", h.Sum(commitHash))\n\n\t\t\t\t\tintRepoID, _ := strconv.ParseInt(repoID, 10, 64)\n\t\t\t\t\tvar pRepoID *int64\n\t\t\t\t\tpRepoID = &intRepoID\n\n\t\t\t\t\t// Set the url to the relative path of the repo based on the execution path of wraith\n\t\t\t\t\tpRepoURL := &parent\n\n\t\t\t\t\t// This is used to id the owner, fullname, and description of the repo. It is ugly but effective. It is the relative path to the repo, for example ../foo\n\t\t\t\t\tpGitProjName := &gitProjName\n\n\t\t\t\t\t// The project name is simply the parent directory in the case of a local scan with all other path bits removed for example ../foo -> foo.\n\t\t\t\t\tprojectPathParts := strings.Split(*pGitProjName, string(os.PathSeparator))\n\t\t\t\t\tpProjectName := &projectPathParts[len(projectPathParts)-2]\n\n\t\t\t\t\tsessR := Repository{\n\t\t\t\t\t\tOwner: pGitProjName,\n\t\t\t\t\t\tID: pRepoID,\n\t\t\t\t\t\tName: pProjectName,\n\t\t\t\t\t\tFullName: pGitProjName,\n\t\t\t\t\t\tCloneURL: pRepoURL,\n\t\t\t\t\t\tURL: pRepoURL,\n\t\t\t\t\t\tDefaultBranch: pBranchName,\n\t\t\t\t\t\tDescription: pGitProjName,\n\t\t\t\t\t\tHomepage: pRepoURL,\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add the repo to the sess to be cloned and scanned\n\t\t\t\t\tsess.AddRepository(&sessR)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err0 != nil {\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0da0bb523e1892fcca56c5c879df58aa", "score": "0.504332", "text": "func (g *Github) GetStars(starChan chan<- *model.StarResult, token string, user string) {\n\tclient := g.getClient(token)\n\n\t// The first response will give us the correct value for the last page\n\tcurrentPage := 1\n\tlastPage := 1\n\n\tfor currentPage <= lastPage {\n\t\trepos, response, err := client.Activity.ListStarred(user, &github.ActivityListStarredOptions{\n\t\t\tListOptions: github.ListOptions{\n\t\t\t\tPage: currentPage,\n\t\t\t},\n\t\t})\n\t\t// If we got an error, put it on the channel\n\t\tif err != nil {\n\t\t\tstarChan <- &model.StarResult{\n\t\t\t\tError: err,\n\t\t\t\tStar: nil,\n\t\t\t}\n\t\t} else {\n\t\t\t// Set last page only if we didn't get an error\n\t\t\tlastPage = response.LastPage\n\n\t\t\t// Create a Star for each repository and put it on the channel\n\t\t\tfor _, repo := range repos {\n\t\t\t\tstar, err := model.NewStarFromGithub(repo.StarredAt, *repo.Repository)\n\t\t\t\tstarChan <- &model.StarResult{\n\t\t\t\t\tError: err,\n\t\t\t\t\tStar: star,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Go to the next page\n\t\tcurrentPage++\n\t}\n\tclose(starChan)\n}", "title": "" }, { "docid": "d49eea170ed0356df1f1fe577d29c7f6", "score": "0.5043239", "text": "func (g *GitLab) GetRepoTree(ctx context.Context, info remote.RepoInfo, skip remote.PathSkipperFn) (*domain.DirTree, string, error) {\n\tlogger := simplog.FromContext(ctx)\n\n\tpid := info.Owner + \"/\" + info.Name\n\trecursive := true\n\tlistOptions := &gl.ListTreeOptions{\n\t\tRecursive: &recursive,\n\t\tRef: &info.Ref,\n\t\tListOptions: gl.ListOptions{\n\t\t\tPage: 1,\n\t\t\tPerPage: 100,\n\t\t},\n\t}\n\n\t// Get latest commit SHA\n\tlogger.Debugf(\"getting latest commit SHA for %s@%s\", pid, info.Ref)\n\tsha, err := g.getRepoSHA(info)\n\tif err != nil {\n\t\tlogger.Debugf(\"failed to get repo SHA for %s: %s\", pid, err)\n\t\tsha = \"\"\n\t}\n\tlogger.Debugf(\"setting sha of %s to %s\", pid, sha)\n\n\tvar tree domain.DirTree\n\n\tfor {\n\t\t// Get the next page of tree entries.\n\t\tlogger.Debugf(\"getting page %d with size %d for %s@%s\", listOptions.Page, listOptions.PerPage, pid, info.Ref)\n\t\tnodes, resp, err := g.client.Repositories.ListTree(pid, listOptions)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", errors.Wrap(err, \"list tree\")\n\t\t}\n\t\tif !remote.IsStatusCodeOK(resp.StatusCode) {\n\t\t\treturn nil, \"\", errors.New(\"list tree responded with code \" + resp.Status)\n\t\t}\n\n\t\t// Store the tree entries to the list.\n\t\tif tree.Entries == nil {\n\t\t\ttree.Entries = make([]*domain.DirEntry, 0, resp.TotalItems)\n\t\t}\n\t\tfor _, node := range nodes {\n\t\t\tif node == nil || skip(node.Path) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ttree.Entries = append(tree.Entries, &domain.DirEntry{\n\t\t\t\tPath: node.Path,\n\t\t\t\tIsDir: node.Type == \"tree\",\n\t\t\t})\n\t\t}\n\n\t\t// If there are no more pages, we're done.\n\t\tif resp.NextPage == 0 {\n\t\t\tlogger.Debugf(\"no more pages for %s@%s\", pid, info.Ref)\n\t\t\tbreak\n\t\t}\n\n\t\t// Otherwise, fetch the next page.\n\t\tlistOptions.ListOptions.Page = resp.NextPage\n\t}\n\n\treturn &tree, sha, nil\n}", "title": "" }, { "docid": "8c2557f8c957f225bb78c53cbb0d8eee", "score": "0.50386363", "text": "func (i *Image) RepoDigests() ([]string, error) {\n\trepoDigests := []string{}\n\tadded := make(map[string]struct{})\n\n\tfor _, name := range i.Names() {\n\t\tfor _, imageDigest := range append(i.Digests(), i.Digest()) {\n\t\t\tif imageDigest == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tnamed, err := reference.ParseNormalizedNamed(name)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tcanonical, err := reference.WithDigest(reference.TrimNamed(named), imageDigest)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif _, alreadyInList := added[canonical.String()]; !alreadyInList {\n\t\t\t\trepoDigests = append(repoDigests, canonical.String())\n\t\t\t\tadded[canonical.String()] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\tsort.Strings(repoDigests)\n\treturn repoDigests, nil\n}", "title": "" }, { "docid": "b3d61c908257d9af881d1e4c315e7d00", "score": "0.5020431", "text": "func GetRepositories(uri string) ([]string, error) {\n\n\t// Create and execute Get request for the catalog of repositores\n\t// https://github.com/docker/distribution/blob/master/docs/spec/api.md#catalog\n\tbody, err := get(uri + \"/_catalog\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Unmarshal JSON into the catalog struct containing a slice of repositories\n\tc := catalog{}\n\tif err = json.Unmarshal(body, &c); err != nil {\n\t\tutils.Log.WithFields(logrus.Fields{\n\t\t\t\"Error\": err,\n\t\t\t\"Response Body\": string(body),\n\t\t}).Error(\"Unable to unmarshal JSON!\")\n\t\treturn nil, err\n\t}\n\n\treturn c.Repositories, err\n}", "title": "" }, { "docid": "a427776e2b8a0dc2cb7362d2b11a8f85", "score": "0.50154805", "text": "func getRepoReleases(ctx context.Context, repo string, client *github.Client) error {\n\tallReleases, err := githubutils.GetAllRepoReleases(ctx, client, \"solo-io\", repo)\n\tvar buf bytes.Buffer\n\tenc := gob.NewEncoder(&buf)\n\terr = enc.Encode(allReleases)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Print(buf.String())\n\treturn nil\n}", "title": "" }, { "docid": "072f1b6e58cb23b5d0a007a6ad9dde80", "score": "0.5013679", "text": "func SearchH(w http.ResponseWriter, r *http.Request, els *ElServer, gins *GinServer) {\n\trbd := SearchRequest{}\n\terr := getParsedBody(r, &rbd)\n\tlog.Debugf(\"got a search request:%+v\", rbd)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\t// Get repo ids from the gin server to which the user has access\n\t// we need to limit results to those\n\trepos := []gogs.Repository{}\n\terr = getParsedHttpCall(http.MethodGet, fmt.Sprintf(\"%s/api/v1/user/repos\", gins.URL),\n\t\tnil, rbd.Token, rbd.CsrfT, &repos)\n\tif err != nil {\n\t\tlog.Errorf(\"could not querry repos: %+v\", err)\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\t// Get repos ids for public repos\n\tprepos := struct{ Data []gogs.Repository }{}\n\terr = getParsedHttpCall(http.MethodGet, fmt.Sprintf(\"%s/api/v1/repos/search/?limit=10000\", gins.URL),\n\t\tnil, rbd.Token, rbd.CsrfT, &prepos)\n\tif err != nil {\n\t\tlog.Errorf(\"could not querry public repos: %+v\", err)\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\trepos = append(repos, prepos.Data...)\n\n\trepids := make([]string, len(repos))\n\tfor c, repo := range repos {\n\t\trepids[c] = fmt.Sprintf(\"%d\", repo.ID)\n\t}\n\tlog.Debugf(\"Repod to search in:%+v\", repids)\n\t// Lets search now\n\trBlobs := [] BlobSResult{}\n\terr = searchBlobs(rbd.Querry, repids, els, &rBlobs)\n\tif err != nil {\n\t\tlog.Warnf(\"could not search blobs:%+v\", err)\n\t}\n\trCommits := [] CommitSResult{}\n\terr = searchCommits(rbd.Querry, repids, els, &rCommits)\n\tif err != nil {\n\t\tlog.Warnf(\"could not search commits:%+v\", err)\n\t}\n\tdata, err := json.Marshal(SearchResults{Blobs: rBlobs, Commits: rCommits})\n\tif err != nil {\n\t\tlog.Debugf(\"Could not Masrschal search results\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(data)\n}", "title": "" }, { "docid": "3071e7d34656cd7e10a90343247e7640", "score": "0.5013347", "text": "func (s *SearchService) Repositories(ctx context.Context, query string, opt *SearchOptions) (*RepositoriesSearchResult, *Response, error) {\n\tresult := new(RepositoriesSearchResult)\n\tresp, err := s.search(ctx, \"repositories\", &searchParameters{Query: query}, opt, result)\n\treturn result, resp, err\n}", "title": "" }, { "docid": "a67154d37a97ca0cdbf4ff07522af251", "score": "0.49846962", "text": "func (app *App) Search(pattern string) ([]*model.Repo, *model.Error) {\n\treturn services.SearchRepos(\"*\" + pattern + \"*\")\n}", "title": "" }, { "docid": "9a25226562dbc7394ac71a6a539c1057", "score": "0.49764118", "text": "func Clone(cfg *config.GitConfig, opts ...bool) {\n\tfor _, v := range cfg.Repos {\n\t\tremote := v.Git_Remote\n\t\tcleanRemoteBase := strings.Replace(path.Base(v.Git_Remote), \".git\", \"\", -1)\n\t\tlocal := path.Join(v.LocalDir, cleanRemoteBase)\n\t\tlog.Printf(\"processing repo %s in local dir %s %s \\n\", remote, local, emoji.Sprint(\":gear:\"))\n\n\t\tif len(opts) >= 1 {\n\t\t\tif alreadyCloned(local) {\n\t\t\t\tlog.Printf(\"repo %s already cloned in %s, skipping %s \\n\", remote, local, emoji.Sprint(\":kangaroo:\"))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\trepo, err := vcs.NewRepo(remote, local)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\t// Returns: instance of GitRepo\n\t\tok := repo.Ping()\n\t\tif !ok {\n\t\t\tlog.Printf(\"remote origin %s is not reachable %s \\n\", remote, emoji.Sprint(\":no_entry:\"))\n\t\t\tcontinue\n\t\t}\n\t\tcreatDirIfNotExist(local)\n\n\t\tlog.Printf(\"cloning/fetching repo %s in local dir %s %s \\n\", remote, local, emoji.Sprint(\":hourglass_not_done:\"))\n\t\terr = repo.Get()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"repository %s already cloned in path %s, trying to update it %s\\n\", remote, local, emoji.Sprint(\":repeat_button:\"))\n\t\t\tif repo.IsDirty() {\n\t\t\t\tlog.Printf(\"repo %s has modification, skipping updates %s \\n\", remote, emoji.Sprint(\":page_with_curl:\"))\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"repo %s is clean %s \\n\", remote, emoji.Sprint(\":soap:\"))\n\t\t\t\terr = repo.Update()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"error while trying to pull/fetch the %s repository : %v \\n\", remote, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tlog.Printf(\"update complete! %s \\n\", emoji.Sprint(\":thumbs_up:\"))\n\t\t\t}\n\t\t}\n\n\t\terr = repo.UpdateVersion(\"master\")\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fa7f74db8393f04de6bf175635821bf4", "score": "0.49753585", "text": "func main() {\n\tfileNameArg := os.Args[1]\n\trepoInfos := ParseFile(fileNameArg)\n\t\n\t// GitHub\n\tclient := github.NewClient(nil)\n\tctx := context.Background()\n\topt := &github.ListOptions{PerPage: 10}\n\t\n\tfor _, repoInfo := range repoInfos {\n\t\treleases, _, err := client.Repositories.ListReleases(ctx, repoInfo.owner, repoInfo.repo, opt)\n\t\tif err != nil {\n\t\t\tpanic(err) // is this really a good way?\n\t\t}\n\t\tminVersion := semver.New(repoInfo.minVersion)\n\t\tallReleases := make([]*semver.Version, len(releases))\n\t\tfor i, release := range releases {\n\t\t\tversionString := *release.TagName\n\t\t\tif versionString[0] == 'v' {\n\t\t\t\tversionString = versionString[1:]\n\t\t\t}\n\t\t\tallReleases[i] = semver.New(versionString)\n\t\t}\n\t\tversionSlice := LatestVersions(allReleases, minVersion)\n\t\n\t\tfmt.Printf(\"latest versions of %s/%s: %s\\n\", repoInfo.owner, repoInfo.repo, versionSlice)\n\t}\n}", "title": "" }, { "docid": "88730cb6e869aa06025f450a85dc5a72", "score": "0.49700603", "text": "func getRepoPVCNames(\n\tcluster *v1beta1.PostgresCluster,\n\tcurrentRepoPVCs []*corev1.PersistentVolumeClaim,\n) map[string]string {\n\n\trepoPVCs := make(map[string]string)\n\tfor _, repo := range cluster.Spec.Backups.PGBackRest.Repos {\n\t\tfor _, pvc := range currentRepoPVCs {\n\t\t\tif pvc.Labels[naming.LabelPGBackRestRepo] == repo.Name {\n\t\t\t\trepoPVCs[repo.Name] = pvc.GetName()\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn repoPVCs\n}", "title": "" }, { "docid": "76bbedc9f3b326bdb8423c38bd2cae73", "score": "0.49677426", "text": "func LsRepo(svnpath string) []string {\n\tcmd := exec.Command(\"ls\", svnpath)\n\tstdout, err := cmd.StdoutPipe()\n\tdefer stdout.Close()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tcmd.Start()\n\tdata, err := ioutil.ReadAll(stdout)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttrimdata := strings.TrimSuffix(string(data), \"\\n\")\n\t// fmt.Printf(\"%q\", string(data))\n\tsplitrepos := strings.SplitN(string(trimdata), \"\\n\", -1)\n\treturn splitrepos\n}", "title": "" }, { "docid": "130ace4301bfe76283d735a499386b4b", "score": "0.49630862", "text": "func (c *client) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error) {\n\tclient := c.newClientToken(ctx, u.Token)\n\n\topts := new(github.RepositoryListOptions)\n\topts.PerPage = 100\n\topts.Page = 1\n\n\tvar repos []*model.Repo\n\tfor opts.Page > 0 {\n\t\tlist, resp, err := client.Repositories.List(ctx, \"\", opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trepos = append(repos, convertRepoList(list)...)\n\t\topts.Page = resp.NextPage\n\t}\n\treturn repos, nil\n}", "title": "" }, { "docid": "7b369c095621956cd0b05bb76737df8d", "score": "0.49601325", "text": "func (s *Spider) ReadRepo(ctx context.Context, user string, repo string, sha string, f func(path string, pkg *gpb.Package) error) error {\n\ttree, err := s.getTree(ctx, user, repo, sha, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpkgs := make(map[string][]github.TreeEntry)\n\tfor _, te := range tree.Entries {\n\t\tif stringsp.Get(te.Type) != \"blob\" {\n\t\t\tcontinue\n\t\t}\n\t\tp := stringsp.Get(te.Path)\n\t\tif p == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\td := path.Dir(p)\n\t\tif d == \".\" {\n\t\t\td = \"\"\n\t\t} else {\n\t\t\td = \"/\" + d\n\t\t}\n\t\tpkgs[d] = append(pkgs[d], te)\n\t}\n\tlog.Printf(\"pkgs: %v\", pkgs)\n\tfor d, teList := range pkgs {\n\t\tpkg := gpb.Package{\n\t\t\tPath: d,\n\t\t}\n\t\tvar imports stringsp.Set\n\t\tvar testImports stringsp.Set\n\t\tfor _, te := range teList {\n\t\t\tfn := path.Base(*te.Path)\n\t\t\tcPath := *te.Path\n\t\t\tsha := *te.SHA\n\t\t\tswitch {\n\t\t\tcase strings.HasSuffix(fn, \".go\"):\n\t\t\t\tfi, err := func() (*gpb.GoFileInfo, error) {\n\t\t\t\t\tfi := &gpb.GoFileInfo{}\n\t\t\t\t\tif s.FileCache.Get(sha, fi) {\n\t\t\t\t\t\tlog.Printf(\"Cache for %v found(sha:%q)\", \"github.com/\"+user+\"/\"+cPath, sha)\n\t\t\t\t\t\treturn fi, nil\n\t\t\t\t\t}\n\t\t\t\t\tbody, err := s.getFile(ctx, user, repo, cPath)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tif isTooLargeError(err) {\n\t\t\t\t\t\t\t*fi = goFileInfo_ShouldIgnore\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Temporary error\n\t\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tparseGoFile(cPath, body, fi)\n\t\t\t\t\t}\n\t\t\t\t\ts.FileCache.Set(sha, fi)\n\t\t\t\t\tlog.Printf(\"Save file cache for %v (sha:%q)\", \"github.com/\"+user+\"/\"+cPath, sha)\n\t\t\t\t\treturn fi, nil\n\t\t\t\t}()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif fi.Status == gpb.GoFileInfo_ParseFailed {\n\t\t\t\t\treturn errorsp.WithStacksAndMessage(ErrInvalidPackage, \"fi.Status is ParseFailed\")\n\t\t\t\t}\n\t\t\t\tif fi.Status == gpb.GoFileInfo_ShouldIgnore {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif fi.IsTest {\n\t\t\t\t\ttestImports.Add(fi.Imports...)\n\t\t\t\t} else {\n\t\t\t\t\tif pkg.Name != \"\" {\n\t\t\t\t\t\tif fi.Name != pkg.Name {\n\t\t\t\t\t\t\treturn errorsp.WithStacksAndMessage(ErrInvalidPackage, \"conflicting package name processing file %v: %v vs %v\", cPath, fi.Name, pkg.Name)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpkg.Name = fi.Name\n\t\t\t\t\t}\n\t\t\t\t\tif fi.Description != \"\" {\n\t\t\t\t\t\tif pkg.Description != \"\" && !strings.HasSuffix(pkg.Description, \"\\n\") {\n\t\t\t\t\t\t\tpkg.Description += \"\\n\"\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpkg.Description += fi.Description\n\t\t\t\t\t}\n\t\t\t\t\timports.Add(fi.Imports...)\n\t\t\t\t}\n\t\t\tcase isReadmeFile(fn):\n\t\t\t\tbody, err := s.getFile(ctx, user, repo, cPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"Get file %v failed: %v\", cPath, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tpkg.ReadmeFn = fn\n\t\t\t\tpkg.ReadmeData = string(body)\n\t\t\t}\n\t\t}\n\t\tif pkg.Name == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tpkg.Imports = imports.Elements()\n\t\tpkg.TestImports = testImports.Elements()\n\t\tif err := errorsp.WithStacks(f(d, &pkg)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
cfc4e06251ed8adc996b15d00e731978
WithAdminID adds the adminID to the add Api token by admin Id params
[ { "docid": "f92cb09122e6342a14bd01ccf898117d", "score": "0.61724854", "text": "func (o *AddAPITokenByAdminIDParams) WithAdminID(adminID int32) *AddAPITokenByAdminIDParams {\n\to.SetAdminID(adminID)\n\treturn o\n}", "title": "" } ]
[ { "docid": "76c0bc319cf7677d408a1fa3c01d4230", "score": "0.76638687", "text": "func (a *Client) AddAPITokenByAdminID(params *AddAPITokenByAdminIDParams) (*AddAPITokenByAdminIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewAddAPITokenByAdminIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"addApiTokenByAdminId\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/setting/admins/{adminId}/apitokens\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &AddAPITokenByAdminIDReader{formats: a.formats},\n\t\tAuthInfo: a.authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*AddAPITokenByAdminIDOK), nil\n\n}", "title": "" }, { "docid": "e35a50a3722ba5a6e176d73ff720c6d2", "score": "0.72402376", "text": "func (a *DefaultApiService) AddApiTokenByAdminId(ctx context.Context, adminId int32, body ApiToken) (ApiTokenResponse, *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 ApiTokenResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/setting/admins/{adminId}/apitokens\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"adminId\"+\"}\", fmt.Sprintf(\"%v\", adminId), -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\t\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v ApiTokenResponse\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": "f79a391796ec8e55ef7f20237124fe09", "score": "0.6312727", "text": "func (o *AddAPITokenByAdminIDParams) WithContext(ctx context.Context) *AddAPITokenByAdminIDParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "f1371c68b140c5426a72a5de6811a545", "score": "0.6286646", "text": "func (o *AddAPITokenByAdminIDParams) WithBody(body *models.APIToken) *AddAPITokenByAdminIDParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "282740b4a456aeeb76d1fe93a1d3f533", "score": "0.6212044", "text": "func NewAddAPITokenByAdminIDParamsWithHTTPClient(client *http.Client) *AddAPITokenByAdminIDParams {\n\tvar ()\n\treturn &AddAPITokenByAdminIDParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "0941e63e029516e639cf002f32655a9a", "score": "0.6210524", "text": "func (o *AddAPITokenByAdminIDParams) SetAdminID(adminID int32) {\n\to.AdminID = adminID\n}", "title": "" }, { "docid": "b6dd2881d227ac7b6d0304cba35314f3", "score": "0.61152095", "text": "func (o *AddAPITokenByAdminIDParams) WithHTTPClient(client *http.Client) *AddAPITokenByAdminIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "b5f090f6f9f1925db94f42e548d8bdb3", "score": "0.6095781", "text": "func NewAddAPITokenByAdminIDParams() *AddAPITokenByAdminIDParams {\n\tvar ()\n\treturn &AddAPITokenByAdminIDParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "2c82d65e2958ee46112e482182794d67", "score": "0.6045267", "text": "func (o *AddAPITokenByAdminIDParams) WithTimeout(timeout time.Duration) *AddAPITokenByAdminIDParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "588127b5c457ca2763dc0184dcb38e76", "score": "0.5976827", "text": "func (a *Client) PatchAPITokenByAdminID(params *PatchAPITokenByAdminIDParams) (*PatchAPITokenByAdminIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPatchAPITokenByAdminIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"patchApiTokenByAdminId\",\n\t\tMethod: \"PATCH\",\n\t\tPathPattern: \"/setting/admins/{adminId}/apitokens/{apitokenId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PatchAPITokenByAdminIDReader{formats: a.formats},\n\t\tAuthInfo: a.authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*PatchAPITokenByAdminIDOK), nil\n\n}", "title": "" }, { "docid": "02d25838be13162fcb641e272f15a696", "score": "0.59698844", "text": "func (a *Client) UpdateAPITokenByAdminID(params *UpdateAPITokenByAdminIDParams) (*UpdateAPITokenByAdminIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateAPITokenByAdminIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"updateApiTokenByAdminId\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/setting/admins/{adminId}/apitokens/{apitokenId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &UpdateAPITokenByAdminIDReader{formats: a.formats},\n\t\tAuthInfo: a.authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*UpdateAPITokenByAdminIDOK), nil\n\n}", "title": "" }, { "docid": "456f98bc6253236c38ba755399147ec8", "score": "0.59010667", "text": "func NewAddAPITokenByAdminIDParamsWithTimeout(timeout time.Duration) *AddAPITokenByAdminIDParams {\n\tvar ()\n\treturn &AddAPITokenByAdminIDParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "ca128da08671a33f9c2afe3395660126", "score": "0.58909625", "text": "func (a *DefaultApiService) UpdateApiTokenByAdminId(ctx context.Context, adminId int32, apitokenId int32, body DeviceDatasourceInstanceConfigPaginationResponse) (ApiTokenResponse, *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 ApiTokenResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/setting/admins/{adminId}/apitokens/{apitokenId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"adminId\"+\"}\", fmt.Sprintf(\"%v\", adminId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"apitokenId\"+\"}\", fmt.Sprintf(\"%v\", apitokenId), -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\t\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v ApiTokenResponse\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": "b5c70f1359026b72f0a37ffa2fcbddac", "score": "0.58204144", "text": "func (s *ProjectUserService) AddAdmin(target ProjectIDOrKeyGetter, userID int) (*User, error) {\n\tprojectIDOrKey, err := target.getProjectIDOrKey()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif userID < 1 {\n\t\treturn nil, errors.New(\"id must be greater than 1\")\n\t}\n\n\tparams := newRequestParams()\n\tparams.Add(\"userId\", strconv.Itoa(userID))\n\n\tspath := \"projects/\" + projectIDOrKey + \"/administrators\"\n\treturn addUser(s.method.Post, spath, params)\n}", "title": "" }, { "docid": "8c5b6431055f41168281728483c49ea2", "score": "0.58096343", "text": "func AddAdmin(i ChannelI) {\n\tch := newSDKChannel(i, messages.NewParser(func(typ string) interface{} {\n\t\tswitch typ {\n\t\tcase \"position\", \"goto\":\n\t\t\treturn &models.Position{}\n\t\tcase \"battery\":\n\t\t\treturn &models.Battery{}\n\t\tcase \"rc\":\n\t\t\treturn &models.Rc{}\n\t\tcase \"fence\":\n\t\t\treturn &models.Fence{}\n\t\tcase \"webrtc:sdp\":\n\t\t\treturn &models.SessionDescription{}\n\t\tcase \"webrtc:icecandidate\":\n\t\t\treturn &models.IceCandidate{}\n\t\tcase \"webrtc:start\", \"takeoff\", \"land\", \"rtl\":\n\t\t\treturn &struct{}{}\n\t\tcase \"caps\":\n\t\t\treturn &models.Caps{}\n\t\tdefault:\n\t\t\treturn &libs.JSONObject{}\n\t\t}\n\t}))\n\n\ta := admin.New(ch)\n\tgo a.Start(models.NewAdmin(\"0\", \"\"), nil)\n}", "title": "" }, { "docid": "36ed58da83e68d7584fbb59467d40ae1", "score": "0.58065957", "text": "func (a *Client) AddAdmin(params *AddAdminParams) (*AddAdminOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewAddAdminParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"addAdmin\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/setting/admins\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &AddAdminReader{formats: a.formats},\n\t\tAuthInfo: a.authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*AddAdminOK), nil\n\n}", "title": "" }, { "docid": "4aff4438d72be7e1cb210c456395c3f8", "score": "0.5709836", "text": "func (api UserAPI) AddAdmin(context *gin.Context) /*(model.UserAuth, error)*/ {\n\t//log.Println(context.Params)\n\t// var user model.UserMail\n\t// err := context.ShouldBindBodyWith(&user, binding.JSON)\n\t// if err != nil {\n\t// \tlog.Println(\"error AddUserHandeler\", err.Error())\n\t// \tcontext.JSON(http.StatusBadRequest, gin.H{\"msg\": err.Error()})\n\t// \t//var acc model.UserAuth\n\t// \treturn\n\t// }\n\n\t// if api.UserRepository.CheckEmail(user.Email) {\n\t// \tlog.Println(\"email in use\")\n\t// \tcontext.JSON(http.StatusIMUsed, gin.H{\"msg\": \"Email in use\"})\n\t// \treturn\n\t// }\n\t// user.Password = utils.HashAndSalt([]byte(user.Password))\n\t// err2 := api.UserRepository.AddUserAdmin(user)\n\t// if err2 != nil {\n\t// \tlog.Println(\"error AddUserHandeler\", err.Error())\n\t// \tcontext.JSON(http.StatusInternalServerError, gin.H{\"msg\": err.Error()})\n\t// \treturn\n\t// }\n\t// context.Redirect(http.StatusTemporaryRedirect, \"/api/v1/user/login\")\n}", "title": "" }, { "docid": "dd6d46005ff45e60e580a9ff1f7ca8e6", "score": "0.5693032", "text": "func (a *DefaultApiService) AddAdmin(ctx context.Context, body Admin) (AdminResponse, *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 AdminResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/setting/admins\"\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\t\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v AdminResponse\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": "f13a29a1d3f86d1876c64f6115026ad4", "score": "0.5689414", "text": "func (o *AddAPITokenByAdminIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param adminId\n\tif err := r.SetPathParam(\"adminId\", swag.FormatInt32(o.AdminID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a9dc4ee65d27a7fa5409641d86700729", "score": "0.5514603", "text": "func (a *Client) GetAPITokenListByAdminID(params *GetAPITokenListByAdminIDParams) (*GetAPITokenListByAdminIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAPITokenListByAdminIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getApiTokenListByAdminId\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/setting/admins/{adminId}/apitokens\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetAPITokenListByAdminIDReader{formats: a.formats},\n\t\tAuthInfo: a.authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetAPITokenListByAdminIDOK), nil\n\n}", "title": "" }, { "docid": "c1266b1655dad43adc6cd63cc4835e88", "score": "0.5394686", "text": "func (k Keeper) AddAdmin(ctx sdk.Context, admin, creator sdk.AccAddress) (err sdk.Error) {\n\tparams := k.GetParams(ctx)\n\n\t// first admin can be added without any authorisation\n\tif len(params.CommunityAdmins) > 0 && !k.isAdmin(ctx, creator) {\n\t\terr = ErrAddressNotAuthorised()\n\t}\n\n\t// if already present, don't add again\n\tfor _, currentAdmin := range params.CommunityAdmins {\n\t\tif currentAdmin.Equals(admin) {\n\t\t\treturn\n\t\t}\n\t}\n\n\tparams.CommunityAdmins = append(params.CommunityAdmins, admin)\n\n\tk.SetParams(ctx, params)\n\n\treturn\n}", "title": "" }, { "docid": "285756d17fc5aea4158d052b9728fb76", "score": "0.5330315", "text": "func (m *PersonMutation) AddAdminOfIDs(ids ...uuid.UUID) {\n\tif m.adminOf == nil {\n\t\tm.adminOf = make(map[uuid.UUID]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.adminOf[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "756302bd5f26eba40915fe059f6cae0a", "score": "0.5302458", "text": "func (m *DomainMutation) AddAdminIDs(ids ...uuid.UUID) {\n\tif m.admins == nil {\n\t\tm.admins = make(map[uuid.UUID]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.admins[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "b7cbf9a1ac8ba4ddb60e631714b45965", "score": "0.52748835", "text": "func GenerateAdminToken(admin string, session int) (string, error) {\n\treturn generateToken(&tokenPayload{\n\t\tAdmin: admin,\n\t\tSessionID: session,\n\t})\n}", "title": "" }, { "docid": "83956b0181082dcfdb1bd5b14740a8df", "score": "0.52623594", "text": "func addOrderAdmin(c *bm.Context) {\n\tadmin := model.OrderAdmin{}\n\tif err := c.BindWith(&admin, binding.Form); err != nil {\n\t\treturn\n\t}\n\tc.JSON(nil, srv.AddOrderAdmin(&admin))\n}", "title": "" }, { "docid": "df86b0bccc98129911abdd550a7280b9", "score": "0.50928295", "text": "func AdminJwtHandling(c *gin.Context) {\n\tvar token string\n\n\t// Check a token is present\n\t_, checkToken := c.Request.Header[\"Authorization\"]\n\tif checkToken == false {\n\t\tc.JSON(403, gin.H{\n\t\t\t\"message\": \"No token provided\",\n\t\t})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\t// Check the token is formatted correctly\n\tauthorization := c.Request.Header[\"Authorization\"][0]\n\tbearer := strings.Split(authorization, \"Bearer \")\n\tif len(bearer) != 2 {\n\t\tc.JSON(403, gin.H{\n\t\t\t\"message\": \"Bad token\",\n\t\t})\n\t\tc.Abort()\n\t\treturn\n\t}\n\ttoken = bearer[1]\n\n\tsplittedToken := strings.Split(token, \".\")\n\tif len(splittedToken) != 3 {\n\t\tc.JSON(403, gin.H{\n\t\t\t\"message\": \"Bad token\",\n\t\t})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\t// Fetching token data\n\theader := splittedToken[0]\n\tpayload := splittedToken[1]\n\tsignature := splittedToken[2]\n\n\t// Check token validity\n\tvalidity, message, status, id, isAdmin := authentication.VerifyToken(string(header), string(payload), string(signature))\n\tif validity == false {\n\t\tc.JSON(status, gin.H{\n\t\t\t\"message\": message,\n\t\t})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tif !isAdmin {\n\t\tc.JSON(status, gin.H{\n\t\t\t\"message\": \"Admin privileges are required to access this endpoint.\",\n\t\t})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tc.Set(\"id\", id)\n\tc.Next()\n}", "title": "" }, { "docid": "7f2dc0913ea9883e89735e595335515a", "score": "0.5088049", "text": "func AdminMiddleWare(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tauthorization := r.Header.Get(\"Authorization\")\n\t\tif len(strings.Split(authorization, \".\")) != 3 {\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tw.Write([]byte(`{\"status\": 401, \"error\": \"StatusUnauthorized\"}`))\n\t\t\treturn\n\t\t}\n\n\t\ttoken, _ := jwt.ParseWithClaims(authorization, &Admin{}, func(token *jwt.Token) (interface{}, error) {\n\t\t\treturn []byte(settings.Get(\"SIGNING_KEY\")), nil\n\t\t})\n\n\t\tif claims, ok := token.Claims.(*Admin); ok && token.Valid {\n\t\t\tgctx.Set(r, \"Admin\", claims)\n\t\t\tnext.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tw.Write([]byte(`{\"status\": 401, \"error\": \"StatusUnauthorized\"}`))\n\t})\n}", "title": "" }, { "docid": "c521bee20c14148651d9cefc320f222d", "score": "0.50621194", "text": "func GetToken() error {\n\tcurrentTime = time.Now()\n\tfmt.Println(\"Expiration: \", expirationDate)\n\tif currentTime.Unix() < expirationDate {\n\t\tlog.Info(\"the admin api token is still valid.\")\n\t\treturn nil\n\t}\n\tlog.Info(\"the admin api token is being renewed.\")\n\n\t// set up some default values for unit test environment\n\tif adminUser == \"\" {\n\t\tadminUser = \"admin\"\n\t}\n\n\tif adminPw == \"\" {\n\t\tadminPw = \"admin\"\n\t}\n\n\tif keycloakHost == \":\" {\n\t\tkeycloakHost = \"http://dev.havengrc.com:2015\"\n\t}\n\n\tform := url.Values{\n\t\t\"username\": {adminUser},\n\t\t\"password\": {adminPw},\n\t\t\"client_id\": {\"admin-cli\"},\n\t\t\"grant_type\": {\"password\"},\n\t}\n\n\tbody := bytes.NewBufferString(form.Encode())\n\tresp, err := http.Post(\n\t\tkeycloakHost+getTokenURL,\n\t\t\"application/x-www-form-urlencoded\",\n\t\tbody,\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Trouble fetching the token: %s\", err.Error())\n\t}\n\n\tdefer resp.Body.Close()\n\n\tbodyByte, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Trouble processing the response body: %s\", err.Error())\n\t}\n\n\terr = json.Unmarshal(bodyByte, &adminToken)\n\tif err != nil {\n\t\tlog.Info(string(bodyByte))\n\t\tlog.Info(\"StatusCode: %d\", resp.StatusCode)\n\t\treturn fmt.Errorf(\"Trouble processing the json result: %s\", err.Error())\n\t}\n\texpirationDate = currentTime.Unix() + int64(adminToken.Expires-5)\n\treturn err\n}", "title": "" }, { "docid": "9f8698c625ea3321ba78607ccb2799f3", "score": "0.505152", "text": "func PutAdmin(c *gin.Context) {\n\tvar administrator admin.Admin\n\tc.ShouldBindJSON(&administrator)\n\tsession := sessions.Default(c)\n\tid := session.Get(\"adminID\")\n\tif id == nil {\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"status\": \"failed\",\n\t\t\t\"errlog\": \"not logged in\",\n\t\t})\n\t\treturn\n\t}\n\tadministrator.ID = id.(int)\n\tif err := putAdmin(&administrator); err != nil {\n\t\thandleErr(err, c)\n\t\treturn\n\t} else {\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"status\": \"success\",\n\t\t})\n\t}\n}", "title": "" }, { "docid": "5aadc3bb2efa90bc406f863f28b4d33b", "score": "0.50293314", "text": "func (d *Dao) AddAdminLog(c context.Context, oids, rpIDs []int64, adminID int64, typ, isNew, isReport, state int32, result, remark string, now time.Time) (rows int64, err error) {\n\tvar vals []string\n\tfor i := range oids {\n\t\tvals = append(vals, fmt.Sprintf(_addAdminLogFormat, oids[i], typ, rpIDs[i], adminID, result, remark, isNew, isReport, state, now.Format(_logTimeLayout), now.Format(_logTimeLayout)))\n\t}\n\tinsertSQL := strings.Join(vals, \",\")\n\tres, err := d.db.Exec(c, fmt.Sprintf(_addAdminLogSQL, insertSQL))\n\tif err != nil {\n\t\treturn\n\t}\n\treturn res.RowsAffected()\n}", "title": "" }, { "docid": "c63598f2d0c7f29e031276e5d5e77539", "score": "0.5003844", "text": "func (w *organizationWrapper) AddAdmin(wrapper interface{}) *organizationWrapper {\n\taddRoleByName(w.baseWrapper, w.resource, authorization.IdentityResourceTypeOrganization, identityIDFromWrapper(w.graph.t, wrapper), authorization.OrganizationAdminRole)\n\treturn w\n}", "title": "" }, { "docid": "da28bd7f9a9ef969059aed44d83681b1", "score": "0.5001315", "text": "func (a *assetStore) addBearerToken(ctx context.Context, ns string, sel v1.SecretKeySelector, key string) error {\n\tif sel.Name == \"\" {\n\t\treturn nil\n\t}\n\n\tbearerToken, err := a.getSecretKey(ctx, ns, sel)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to get bearer token\")\n\t}\n\n\ta.bearerTokenAssets[key] = BearerToken(bearerToken)\n\n\treturn nil\n}", "title": "" }, { "docid": "06c93e344e18ab88d1180846582e5671", "score": "0.4996699", "text": "func WithRdsOnlineAdminToken(db int, userid, token string, expireSec int) error {\n\tif err := withRdsOnlineVal(db, userid, onlineUserTokenKey, token); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := redis.Instance().Do(db, \"expire\", common.GetAdminRdsOnlineKey(userid), expireSec); err != nil {\n\t\t//RemoveOnlineAdminUser(db, userid)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c19436238bca3d069131c43d8aa5ea5", "score": "0.4983793", "text": "func AddAdminForContext(ctx context.Context, branchName string) error {\n\tbranchAwareSession := GetBranchAwareSession(ctx)\n\tif branchAwareSession == nil {\n\t\treturn nil\n\t}\n\tcontroller := branchAwareSession.GetController()\n\tif controller == nil {\n\t\treturn nil\n\t}\n\n\tuser := branchAwareSession.GetUser()\n\thost := branchAwareSession.GetHost()\n\tdatabase := branchAwareSession.GetCurrentDatabase()\n\t// Check if we already have admin permissions for the given branch, as there's no need to do another insertion if so\n\tcontroller.Access.RWMutex.RLock()\n\t_, modPerms := controller.Access.Match(database, branchName, user, host)\n\tcontroller.Access.RWMutex.RUnlock()\n\tif modPerms&Permissions_Admin == Permissions_Admin {\n\t\treturn nil\n\t}\n\tcontroller.Access.RWMutex.Lock()\n\tcontroller.Access.Insert(database, branchName, user, host, Permissions_Admin)\n\tcontroller.Access.RWMutex.Unlock()\n\treturn SaveData(ctx)\n}", "title": "" }, { "docid": "c8c99a356d1983a7dac7367fc51edf13", "score": "0.49738064", "text": "func (ws *WebServer) handlerPostAPIToken(ctx *routing.Context) error {\r\n\tuser := ctx.Get(\"user\").(*objects.User)\r\n\tvar err error\r\n\ttoken := new(objects.APIToken)\r\n\r\n\tif token.Token, err = random.Base64(apiTokenLength); err != nil {\r\n\t\treturn jsonError(ctx, err, fasthttp.StatusInternalServerError)\r\n\t}\r\n\r\n\ttoken.UserID = user.UID\r\n\ttoken.Created = time.Now()\r\n\r\n\tif err = ws.db.SetAPIToken(token); err != nil {\r\n\t\treturn jsonError(ctx, err, fasthttp.StatusInternalServerError)\r\n\t}\r\n\tws.cache.SetUserByToken(token.Token, user)\r\n\r\n\treturn jsonResponse(ctx, token, fasthttp.StatusOK)\r\n}", "title": "" }, { "docid": "54a6ee93f256eeee3fa3a390952d9863", "score": "0.493536", "text": "func getAdminAuthHeader() map[string]string {\n\theaders := map[string]string{}\n\theaders[\"Authorization\"] = \"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwicm9sZSI6ImFkbWluIn0.oDr14tn99Ma3wUe-6FAlWgsYWrHe6YnbOL9VCmhdcTA\"\n\treturn headers\n}", "title": "" }, { "docid": "81d96d0350a88eb28533d6a2dd7e14e8", "score": "0.49296847", "text": "func (d *Dao) AdminName(c context.Context, admins map[int64]string) (err error) {\n\tif len(admins) == 0 {\n\t\treturn\n\t}\n\tvar res struct {\n\t\tCode int `json:\"code\"`\n\t\tData map[string]string `json:\"data\"`\n\t}\n\tvar uids []int64\n\tfor key := range admins {\n\t\tuids = append(uids, key)\n\t}\n\tparams := url.Values{}\n\tparams.Set(\"uids\", xstr.JoinInts(uids))\n\tif err = d.httpClient.Get(c, _adminNameURL, \"\", params, &res); err != nil {\n\t\tlog.Error(\"ReportLog httpClient.Get(%s) error(%v) res(%v)\", _adminNameURL, err, res)\n\t\treturn\n\t}\n\tif ec := ecode.Int(res.Code); !ecode.OK.Equal(ec) {\n\t\tlog.Error(\"ReportLog not ok(%s) error(%v) res(%v)\", _adminNameURL, ec, res)\n\t\terr = ec\n\t\treturn\n\t}\n\tfor k, v := range res.Data {\n\t\tid, err := strconv.ParseInt(k, 10, 64)\n\t\tif err == nil {\n\t\t\tadmins[id] = v\n\t\t} else {\n\t\t\tlog.Error(\"ReportLog(%s) strconv error(%v) res(%v)\", _adminNameURL, err, res)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "38b121966b6a7d644c6dc789b1fef426", "score": "0.49177176", "text": "func AddAsSuperAdmin(ctx *AppContext, userID uint, email string) error {\n\t/*\n\t * We will add the user as super admin\n\t * Then will create the master token for the same\n\t * Then we will inform the auth\n\t * Then we will initialize the datastore\n\t */\n\tiu := UserInfo{Model: gorm.Model{ID: userID}}\n\terr := iu.AddAsSuperAdmin(*ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = initializeAppToken(ctx, userID, email)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuser := MasterAppDetails.ToApp().ToUser()\n\tuser.InformAuth(*ctx, true)\n\n\terr = initializeDatastore(ctx, userID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "df70e79690dc2470c8e836072ea4f380", "score": "0.49056053", "text": "func (w *ServerInterfaceWrapper) PostAdmin(ctx echo.Context) error {\n\tvar err error\n\n\tctx.Set(AdminAuthScopes, []string{\"\"})\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.PostAdmin(ctx)\n\treturn err\n}", "title": "" }, { "docid": "c9239e5e4203397939f82a5ff5a7a6a2", "score": "0.4902183", "text": "func (b *Bot) isAdminID(id int) bool {\n\ti := sort.SearchInts(b.admins, id)\n\treturn i < len(b.admins) && b.admins[i] == id\n}", "title": "" }, { "docid": "294c1934f7f1e816fadda25bc1690f75", "score": "0.4891921", "text": "func addClientID(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, PUT, DELETE\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, Authorization\")\n\t\tif (*r).Method == \"OPTIONS\" {\n\t\t\treturn\n\t\t}\n\t\tif r.URL.Path == \"/v1/merchants/signup\" ||\n\t\t\tr.URL.Path == \"/v1/merchants/verify/phone\" ||\n\t\t\tr.URL.Path == \"/v1/merchants/verify/email\" ||\n\t\t\tr.URL.Path == \"/v1/merchants/resend-code\" ||\n\t\t\tr.URL.Path == \"/v1/merchants/upload\" ||\n\t\t\tr.URL.Path == \"/v1/merchants/forgot-password\" ||\n\t\t\tr.URL.Path == \"/v1/merchants/login\" ||\n\t\t\tr.URL.Path == \"/v1/merchants/verify/phone/team\" ||\n\t\t\tr.URL.Path == \"/v1/merchants/reset-password\" {\n\t\t\th.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\t\terrorMessage := map[string]string{}\n\t\tauth := r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terrorMessage[\"error\"] = \"authorization token is not supplied\"\n\t\t\tb, _ := json.Marshal(errorMessage)\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tw.Write(b)\n\t\t\treturn\n\t\t}\n\t\tparts := strings.Split(auth, \":\")\n\t\tif len(parts) < 2 {\n\t\t\terrorMessage[\"error\"] = \"invalid authorization token passed\"\n\t\t\tb, _ := json.Marshal(errorMessage)\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tw.Write(b)\n\t\t\treturn\n\t\t}\n\t\tuserIDStr := parts[1]\n\t\ttoken := parts[0]\n\t\tuserID, err := strconv.Atoi(userIDStr)\n\t\tif err != nil {\n\t\t\terrorMessage[\"error\"] = \"invalid authorization token passed\"\n\t\t\tb, _ := json.Marshal(errorMessage)\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tw.Write(b)\n\t\t\treturn\n\t\t}\n\t\tmasterDB, err := db.GetDB(context.Background(), dal.MasterDBConnectionName)\n\t\tif err != nil {\n\t\t\terrorMessage[\"error\"] = \"user not found\"\n\t\t\tb, _ := json.Marshal(errorMessage)\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\tw.Write(b)\n\t\t\treturn\n\t\t}\n\t\tuser, err := db.GetUserByID(context.Background(), masterDB, userID, false)\n\t\tif err != nil {\n\t\t\terrorMessage[\"error\"] = \"user not found\"\n\t\t\tb, _ := json.Marshal(errorMessage)\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\tw.Write(b)\n\t\t\treturn\n\t\t}\n\t\t// if time.Now().After(user.TokenExpireAt) {\n\t\t// \terrorMessage[\"error\"] = \"authorization token expired\"\n\t\t// \tb, _ := json.Marshal(errorMessage)\n\t\t// \tw.WriteHeader(http.StatusUnauthorized)\n\t\t// \tw.Write(b)\n\t\t// \treturn\n\t\t// }\n\t\tif !utile.ValidPassword(token, user.TokenHash) {\n\t\t\terrorMessage[\"error\"] = \"invalid authorization token passed\"\n\t\t\tb, _ := json.Marshal(errorMessage)\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tw.Write(b)\n\t\t\treturn\n\t\t}\n\t\th.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "69b2eac3b83779e4d7c273cfae631033", "score": "0.48760724", "text": "func AuthAdminMiddleware(c *fiber.Ctx) error {\n\tauthHeader := c.Get(headerKey)\n\tclaims, err := authValidator(authHeader, adminAuth)\n\tif err != nil {\n\t\treturn c.Status(err.Status()).JSON(err)\n\t}\n\n\tc.Locals(mjwt.CLAIMS, claims)\n\treturn c.Next()\n}", "title": "" }, { "docid": "63124f91db2f3e50c321b87fa9a9ea56", "score": "0.4872102", "text": "func CreateOrderForAdmin(c *gin.Context) {\n\tvar body order.CreateOrderParam\n\n\t// Check user session\n\t_, token, errGetResponse := getUserProfile(c)\n\tif errGetResponse != nil {\n\t\tglobal.Error.Println(\"func CreateOrderForAdmin error get user profile: \", errGetResponse)\n\t\tglobal.ForbiddenResponse(c, constErr.WORDING_ERROR_FORBIDDEN)\n\t\treturn\n\t}\n\n\terrBindJSON := c.BindJSON(&body)\n\tif errBindJSON != nil {\n\t\tglobal.Error.Printf(\"func CreateOrderForAdmin error when marshal json: %v\\n\", errBindJSON)\n\t\tglobal.BadRequestResponse(c, \"invalid request\")\n\t\treturn\n\t}\n\n\tresp, err := global.GetServiceOrder().CreateOrderForAdmin(token, body)\n\tif err != nil {\n\t\tglobal.Error.Println(\"func CreateOrderForAdmin error when create order for admin: \", err)\n\t\tglobal.InternalServerErrorResponse(c, constErr.WORDING_ERROR_INTERNAL_SERVER)\n\t\treturn\n\t}\n\n\tresponse := map[string]interface{}{\n\t\t\"error\": resp.Error,\n\t\t\"data\": resp.Data,\n\t}\n\n\tglobal.OKResponse(c, response)\n\n\treturn\n}", "title": "" }, { "docid": "9d983c5b82ac15b2d8b706f633621eaa", "score": "0.4865136", "text": "func (c *OuterChannel) AddToken(token string, expire int64, key string) error {\n\tc.mutex.Lock()\n\tif err := c.token.Add(token, expire); err != nil {\n\t\tLog.Error(\"user_key:\\\"%s\\\" add token failed (%s)\", key, err.Error())\n\t\tc.mutex.Unlock()\n\t\treturn err\n\t}\n\n\tc.mutex.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "403babe9dee876fe4db0c4e91bf6405a", "score": "0.48595122", "text": "func (userBase *UserBase) UserAddAdmin() error {\n\tuserBase.UserType = \"admin\"\n\treturn userBase.UserAdd()\n}", "title": "" }, { "docid": "ad8d72de6a983067de74a1d4628fb4fd", "score": "0.48545817", "text": "func WithAdminAuthz(ac be.ActionController, next httprouter.Handle) httprouter.Handle {\n\treturn func(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {\n\t\tctx := req.Context()\n\t\tkeyID, HMAC, err := parseHeader(&req.Header)\n\t\tif err != nil {\n\t\t\tgw.LogC(ctx, \"http\", gw.LogError).\n\t\t\t\tErr(err).\n\t\t\t\tMsg(\"authorization failure\")\n\t\t\treplyJSON(ctx, w, message{\"status\": \"error\", \"reason\": \"invalid_authorization_header\"})\n\t\t\treturn\n\t\t}\n\n\t\tkeyCfg := ac.GetKey(ctx, keyID)\n\t\tif keyCfg == nil {\n\t\t\tgw.LogC(ctx, \"http\", gw.LogError).\n\t\t\t\tMsg(\"invalid key ID specified\")\n\t\t\treplyJSON(ctx, w, message{\"status\": \"error\", \"reason\": \"invalid_key\"})\n\t\t\treturn\n\t\t}\n\n\t\tif !keyCfg.Admin {\n\t\t\tgw.LogC(ctx, \"http\", gw.LogError).\n\t\t\t\tMsg(\"key does not have admin rights\")\n\t\t\treplyJSON(ctx, w, message{\"status\": \"error\", \"reason\": \"no_admin_key\"})\n\t\t\treturn\n\t\t}\n\n\t\tvar HMACInput []byte\n\t\tswitch req.Method {\n\t\tcase \"DELETE\":\n\t\t\t// For DELETE requests, use the path component of the URL to compute the HMAC\n\t\t\tHMACInput = []byte(req.URL.Path)\n\t\tcase \"POST\":\n\t\t\t// For POST requests, the request body is used to compute HMAC\n\t\t\tHMACInput, err = readBody(req, req.ContentLength)\n\t\t\tif err != nil {\n\t\t\t\thttpWrapError(ctx, err, \"could not read request body\", w, http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\tdefault:\n\t\t\tmsg := fmt.Sprintf(\"authorization middleware not implemented for HTTP method: %v\", req.Method)\n\t\t\tgw.LogC(ctx, \"http\", gw.LogError).\n\t\t\t\tMsgf(msg)\n\t\t\thttp.Error(w, msg, http.StatusMethodNotAllowed)\n\t\t}\n\n\t\tif !CheckHMAC(HMACInput, HMAC, keyCfg.Secret) {\n\t\t\tgw.LogC(ctx, \"http\", gw.LogError).\n\t\t\t\tMsg(\"invalid HMAC\")\n\t\t\treplyJSON(ctx, w, message{\"status\": \"error\", \"reason\": \"invalid_hmac\"})\n\t\t\treturn\n\t\t}\n\n\t\tnext(w, req, ps)\n\t}\n}", "title": "" }, { "docid": "d5d19a77922db12e3826ce6b57e34b5f", "score": "0.4843941", "text": "func (service *service) AddAdmin(channelUsername string, adminUsername string) error {\n\t_, err := service.GetChannel(channelUsername)\n\tif err != nil {\n\t\t//fmt.Errorf(\"channel can'add admin because %s\", err.Error())\n\t\treturn err\n\t}\n\treturn (*service.repo).AddAdmin(channelUsername, adminUsername)\n}", "title": "" }, { "docid": "b8f051e7ad307a461d69f358d01d3021", "score": "0.48297113", "text": "func (t *TopicsController) AddAdminUser(ctx *gin.Context) {\n\tvar paramJSON tat.ParamTopicUserJSON\n\tctx.Bind(&paramJSON)\n\ttopic, e := t.preCheckUser(ctx, &paramJSON)\n\tif e != nil {\n\t\treturn\n\t}\n\n\tif err := topicDB.AddAdminUser(topic, getCtxUsername(ctx), paramJSON.Username, paramJSON.Recursive); err != nil {\n\t\tlog.Errorf(\"Error while adding admin user: %s\", err)\n\t\tctx.JSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tctx.JSON(http.StatusCreated, \"\")\n}", "title": "" }, { "docid": "b6c99bc8dd7c75344b03e2eacb677ff9", "score": "0.4818393", "text": "func (wl *whitelist) PutAdmin(admin string) {\n\twl.Lock()\n\twl.admins[admin] = true\n\twl.Unlock()\n}", "title": "" }, { "docid": "6153a625248f01f66c47f5471a2f1ab1", "score": "0.48182958", "text": "func getThreeScaleAdminToken(ctx context.Context, client k8sclient.Client) (string, error) {\n\tlog.Info(\"Get 3scale admin Token\")\n\ts := &corev1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"system-seed\",\n\t\t},\n\t}\n\terr := client.Get(ctx, k8sclient.ObjectKey{Name: s.Name, Namespace: threeScaleNamespace}, s)\n\tif err != nil {\n\t\tlog.Error(\"Error get 3Scale admin token \", err)\n\t\treturn \"\", err\n\t}\n\taccessToken := string(s.Data[\"ADMIN_ACCESS_TOKEN\"])\n\treturn accessToken, nil\n}", "title": "" }, { "docid": "4bca9de764a0efa8fabfa6cb1c865692", "score": "0.48155576", "text": "func add_param(ctx *iris.Context) {\n // Grab parameters from the JSON\n rolename := ctx.GetString(\"rolename\")\n abname := cast.ToString(utils.GetJSON(ctx,\"abname\"))\n param := cast.ToString(utils.GetJSON(ctx,\"param\"))\n value := cast.ToString(utils.GetJSON(ctx,\"value\"))\n\n // Try to get the role\n role := &objects.Role{}\n app.Database.Where(\"name = ?\", rolename).First(role)\n ability := &objects.Ability{}\n app.Database.Where(\"name = ?\", abname).First(ability)\n errors := []string{}\n codes := []int{}\n if role.Name != rolename {\n errors = append(errors,\"The role does not exist.\")\n codes = append(codes, 3030)\n }\n if ability.Name != abname {\n errors = append(errors,\"The ability does not exist.\")\n codes = append(codes, 2107)\n }\n if len(errors) > 0 {\n utils.WriteJSON(ctx, iris.StatusBadRequest, utils.Error(errors...).Code(codes...))\n return\n }\n\n // Both objects are valid, check if they are linked\n role.AddParam(abname, param, value)\n app.Database.Save(role)\n utils.WriteJSON(ctx, iris.StatusOK, iris.Map{\"error\": false})\n}", "title": "" }, { "docid": "03433ca9c4a2fb15b6a3693e5edbf0a6", "score": "0.47846207", "text": "func (p *processor) addToken(req *http.Request, payload Serializable) error {\n\t// if authentication credentials are available\n\tif len(p.cfg.Username) > 0 && len(p.cfg.Password) > 0 {\n\t\t// add an authentication token to the request\n\t\treq.Header.Set(\"Authorization\", basicAuthToken(p.cfg.Username, p.cfg.Password))\n\t}\n\t// all content type should be in JSON format\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treturn nil\n}", "title": "" }, { "docid": "9f1fbbd08cfdadd989f3577f2d4962c0", "score": "0.4765845", "text": "func WithAdminCaller(ctx context.Context) context.Context {\n\treturn context.WithValue(ctx, callerAdminTagKey{}, struct{}{})\n}", "title": "" }, { "docid": "db7b43c21e99eb03f675e45f8301dacd", "score": "0.47554994", "text": "func AdminAuthLogin(c *config.Config, db *models.Repository, sm *scs.Manager) http.HandlerFunc {\n\n\ttype Request struct {\n\t\tPassword string `json:\"password\"`\n\t}\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar req Request\n\n\t\tif err := jsonDecode(r, &req); err != nil {\n\t\t\thandleError(w, r, ErrInvalidJSON)\n\t\t\treturn\n\t\t}\n\n\t\tif err := bcrypt.CompareHashAndPassword(\n\t\t\t[]byte(c.Admin.Password),\n\t\t\t[]byte(req.Password),\n\t\t); err != nil {\n\t\t\thandleError(w, r, ErrInvalidCreds)\n\t\t\treturn\n\t\t}\n\n\t\tsession := sm.Load(r)\n\n\t\tif err := session.RenewToken(w); err != nil {\n\t\t\thandleError(w, r, ErrInternal.SetError(err))\n\t\t\treturn\n\t\t}\n\n\t\tif err := session.PutBool(w, \"isAdmin\", true); err != nil {\n\t\t\thandleError(w, r, ErrInternal.SetError(err))\n\t\t\treturn\n\t\t}\n\n\t\tresponseOK(w)\n\t}\n}", "title": "" }, { "docid": "8dfc3b16035c2c85abbd8c01c64b626f", "score": "0.47491053", "text": "func EditAdmin(adminID, adminName string, roleIDs []string) error {\n\tadminModel = &models.Admin{}\n\tadmin := adminModel.(*models.Admin)\n\tadmin.AdminID = adminID\n\terr := admin.GetSingle()\n\tif err != nil {\n\t\treturn err\n\t}\n\troles := []models.Role{}\n\tfor _, roleID := range roleIDs {\n\t\troles = append(roles, models.Role{RoleID: roleID})\n\t}\n\tadmin.Role = roles\n\tadmin.Name = adminName\n\tadmin.Token = util.GUID()\n\tadmin.TokenExpire = time.Now().Add(time.Minute * 30).Unix()\n\treturn admin.Edit()\n}", "title": "" }, { "docid": "68ac1ac0e2363c4fa3334f806eed95a8", "score": "0.47361428", "text": "func (me *CUSTOMERS_IMPL) CreateAccessToken (\r\n customerId string,\r\n body *models_pkg.CustomersAccessTokensRequest,\r\n idempotencyKey *string) (*models_pkg.CustomersAccessTokensResponse, error) {\r\n //the endpoint path uri\r\n _pathUrl := \"/customers/{customer_id}/access-tokens\"\r\n\r\n //variable to hold errors\r\n var err error = nil\r\n //process optional template parameters\r\n _pathUrl, err = apihelper_pkg.AppendUrlWithTemplateParameters(_pathUrl, map[string]interface{} {\r\n \"customer_id\" : customerId,\r\n })\r\n if err != nil {\r\n //error in template param handling\r\n return nil, err\r\n }\r\n\r\n //the base uri for api requests\r\n _queryBuilder := configuration_pkg.BASEURI;\r\n\r\n //prepare query string for API call\r\n _queryBuilder = _queryBuilder + _pathUrl\r\n\r\n //validate and preprocess url\r\n _queryBuilder, err = apihelper_pkg.CleanUrl(_queryBuilder)\r\n if err != nil {\r\n //error in url validation or cleaning\r\n return nil, err\r\n }\r\n //prepare headers for the outgoing request\r\n headers := map[string]interface{} {\r\n \"user-agent\" : \"MundiSDK - Go 2.4.5\",\r\n \"accept\" : \"application/json\",\r\n \"content-type\" : \"application/json; charset=utf-8\",\r\n \"Content-Type\" : \"application/json\",\r\n \"idempotency-key\" : apihelper_pkg.ToString(idempotencyKey, \"\"),\r\n }\r\n\r\n //prepare API request\r\n _request := unirest.PostWithAuth(_queryBuilder, headers, body, me.config.BasicAuthUserName(), me.config.BasicAuthPassword())\r\n //and invoke the API call request to fetch the response\r\n _response, err := unirest.AsString(_request,false);\r\n if err != nil {\r\n //error in API invocation\r\n return nil, err\r\n }\r\n\r\n //error handling using HTTP status codes\r\n if (_response.Code == 400) {\r\n err = apihelper_pkg.NewAPIError(\"Invalid request\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 401) {\r\n err = apihelper_pkg.NewAPIError(\"Invalid API key\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 404) {\r\n err = apihelper_pkg.NewAPIError(\"An informed resource was not found\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 412) {\r\n err = apihelper_pkg.NewAPIError(\"Business validation error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 422) {\r\n err = apihelper_pkg.NewAPIError(\"Contract validation error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 500) {\r\n err = apihelper_pkg.NewAPIError(\"Internal server error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code < 200) || (_response.Code > 206) { //[200,206] = HTTP OK\r\n err = apihelper_pkg.NewAPIError(\"HTTP Response Not OK\", _response.Code, _response.RawBody)\r\n }\r\n if(err != nil) {\r\n //error detected in status code validation\r\n return nil, err\r\n }\r\n\r\n //returning the response\r\n var retVal *models_pkg.CustomersAccessTokensResponse = &models_pkg.CustomersAccessTokensResponse{}\r\n err = json.Unmarshal(_response.RawBody, &retVal)\r\n\r\n if err != nil {\r\n //error in parsing\r\n return nil, err\r\n }\r\n return retVal, nil\r\n\r\n}", "title": "" }, { "docid": "b4833ba825fcb7d070ea4df0b8295193", "score": "0.47315842", "text": "func addRoutesLoginToken(internalAPIMux *mux.Router, s api.UserInternalAPI, enableMetrics bool) {\n\tinternalAPIMux.Handle(\n\t\tPerformLoginTokenCreationPath,\n\t\thttputil.MakeInternalRPCAPI(\"UserAPIPerformLoginTokenCreation\", enableMetrics, s.PerformLoginTokenCreation),\n\t)\n\n\tinternalAPIMux.Handle(\n\t\tPerformLoginTokenDeletionPath,\n\t\thttputil.MakeInternalRPCAPI(\"UserAPIPerformLoginTokenDeletion\", enableMetrics, s.PerformLoginTokenDeletion),\n\t)\n\n\tinternalAPIMux.Handle(\n\t\tQueryLoginTokenPath,\n\t\thttputil.MakeInternalRPCAPI(\"UserAPIQueryLoginToken\", enableMetrics, s.QueryLoginToken),\n\t)\n}", "title": "" }, { "docid": "0b790af76e8c05ff32bb52541e6fd976", "score": "0.47068873", "text": "func AdminAndOwnerAccessToken() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\theader := strings.TrimSpace(c.GetHeader(HeaderAuthorization))\n\t\tif header == \"\" {\n\t\t\tc.JSON(http.StatusUnauthorized, &response.Data{Data: &response.UnauthorizedError{Error: \"ارسال توکن شناسایی الزامی میباشد\"}})\n\t\t\tc.Abort()\n\t\t} else {\n\t\t\ttoken, err := jwt.Parse(c.GetHeader(HeaderAuthorization), func(token *jwt.Token) (interface{}, error) {\n\t\t\t\t//return utility.VerifyKey, nil\n\t\t\t\treturn []byte(constants.SecretKeyHS512), nil\n\t\t\t})\n\t\t\tif err == nil {\n\t\t\t\tif token.Valid {\n\t\t\t\t\tclaims := token.Claims.(jwt.MapClaims)\n\t\t\t\t\trole := claims[\"role\"].(string)\n\t\t\t\t\tif role == constants.AdminRole {\n\t\t\t\t\t\tc.Set(constants.TokenClaims, token.Claims)\n\t\t\t\t\t\tc.Next()\n\t\t\t\t\t} else if role == constants.OwnerRole {\n\t\t\t\t\t\tc.Set(constants.TokenClaims, token.Claims)\n\t\t\t\t\t\tc.Next()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tc.JSON(http.StatusUnauthorized, &response.Data{Data: &response.UnauthorizedError{Error: \"شما اجازه ی دسترسی به این بخش را ندارید\"}})\n\t\t\t\t\t\tc.Abort()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tc.JSON(http.StatusUnauthorized, &response.Data{Data: &response.UnauthorizedError{Error: \"توکن شناسایی نامعتبر است\"}})\n\t\t\t\tc.Abort()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "32233a98748315c5638d1ec940a1c1a1", "score": "0.4695355", "text": "func (a *DefaultApiService) DeleteApiTokenById(ctx context.Context, adminId int32, apitokenId int32) (ApiTokenResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue ApiTokenResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/setting/admins/{adminId}/apitokens/{apitokenId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"adminId\"+\"}\", fmt.Sprintf(\"%v\", adminId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"apitokenId\"+\"}\", fmt.Sprintf(\"%v\", apitokenId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil {\n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v ApiTokenResponse\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": "e9a2ba046b09031086da83669a5ecef8", "score": "0.46824253", "text": "func AddAdmin(c *gin.Context) {\n\tvar user models.Employee\n\tvar res models.Employee\n\terr := c.ShouldBindJSON(&user)\n\tif err != nil {\n\t\tc.JSON(500, gin.H{\n\t\t\t\"error\": err,\n\t\t})\n\t\treturn\n\t}\n\n\tdb := conn.Connectdb()\n\trows := db.QueryRow(`insert into employee (employee_id, employee_name, login_password) values ($1, $2, $3) returning *;`, user.EmployeeID, user.EmployeeName, user.LoginPassword)\n\n\tres = models.Employee{}\n\ts := reflect.ValueOf(&res).Elem()\n\tnumCols := s.NumField()\n\tcolumns := make([]interface{}, numCols)\n\tfor i := 0; i < numCols; i++ {\n\t\tfield := s.Field(i)\n\t\tcolumns[i] = field.Addr().Interface()\n\t}\n\n\terr = rows.Scan(columns...)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tc.JSON(500, gin.H{\n\t\t\t\"messages\": err,\n\t\t})\n\t\treturn\n\t}\n\n\t// insertUser.Exec(user.Username, user.Password, user.Status)\n\n\tc.JSON(200, res)\n\tdefer db.Close()\n}", "title": "" }, { "docid": "63b381a19c2dd3f883fa72b1724ba153", "score": "0.46756846", "text": "func (g *GoCloak) LoginAdmin(ctx context.Context, username, password, realm string) (*JWT, error) {\n\treturn g.GetToken(ctx, realm, TokenOptions{\n\t\tClientID: StringP(adminClientID),\n\t\tGrantType: StringP(\"password\"),\n\t\tUsername: &username,\n\t\tPassword: &password,\n\t})\n}", "title": "" }, { "docid": "b0f7ea6c9a211601770bfd74316fb8c8", "score": "0.46522525", "text": "func (n *Node) initAdminAPI() error {\n\tif !n.Config.AdminAPIEnabled {\n\t\tn.Log.Info(\"skipping admin API initialization because it has been disabled\")\n\t\treturn nil\n\t}\n\tn.Log.Info(\"initializing admin API\")\n\tservice, err := admin.NewService(\n\t\tadmin.Config{\n\t\t\tLog: n.Log,\n\t\t\tChainManager: n.chainManager,\n\t\t\tHTTPServer: n.APIServer,\n\t\t\tProfileDir: n.Config.ProfilerConfig.Dir,\n\t\t\tLogFactory: n.LogFactory,\n\t\t\tNodeConfig: n.Config,\n\t\t\tVMManager: n.VMManager,\n\t\t\tVMRegistry: n.VMRegistry,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn n.APIServer.AddRoute(service, &sync.RWMutex{}, \"admin\", \"\")\n}", "title": "" }, { "docid": "1674e7ad7a895c841a5f4eb66ca2fd42", "score": "0.45948565", "text": "func Admin(m jwt.Auth) gin.HandlerFunc {\n\treturn m.VerifyPerm(func(claims jwt.MapClaims) bool {\n\t\treturn role(claims).IsAdmin()\n\t})\n}", "title": "" }, { "docid": "12bf79c30eec4564ddf84c6d4ede2edc", "score": "0.4577993", "text": "func NewAddAPITokenByAdminIDParamsWithContext(ctx context.Context) *AddAPITokenByAdminIDParams {\n\tvar ()\n\treturn &AddAPITokenByAdminIDParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "b5945a681a9cb8406605ca19a0c8d867", "score": "0.457728", "text": "func doReq(client *http.Client, req *http.Request) (*http.Response, error) {\n\tpassword, err := adminToken.MarshalText()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Make sure the map isn't nil:\n\tif req.Header == nil {\n\t\treq.Header = http.Header{}\n\t}\n\treq.SetBasicAuth(\"admin\", string(password))\n\treturn client.Do(req)\n}", "title": "" }, { "docid": "1d2fef60027961c317e38ee3361a3dd0", "score": "0.45723087", "text": "func TokenGenerator(w http.ResponseWriter, r *http.Request) {\n\n\tCheck(\"tokengenerate\", \"POST\", w, r)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\thelpers.LoadEnv()\n\n\tvar mySigningKey = []byte(helpers.GetEnvWithKey(\"MY_SIGNING_KEY\"))\n\tvar adminKey = []byte(helpers.GetEnvWithKey(\"ADMIN_KEY\"))\n\n\tadmin := r.Header[\"Admin\"]\n\tcheck := admin[len(admin)-1]\n\n\tvar token *jwt.Token\n\tvar err error\n\tvar tokenacc string\n\n\tvar data models.User\n\n\tif r.Header[\"Token1\"] != nil {\n\n\t\tif check == \"true\" {\n\n\t\t\ttoken, err = jwt.Parse(r.Header[\"Token1\"][0], func(token *jwt.Token) (interface{}, error) {\n\t\t\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"There was an error\")\n\t\t\t\t}\n\t\t\t\treturn adminKey, nil\n\t\t\t})\n\t\t} else {\n\n\t\t\ttoken, err = jwt.Parse(r.Header[\"Token1\"][0], func(token *jwt.Token) (interface{}, error) {\n\t\t\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"There was an error\")\n\t\t\t\t}\n\t\t\t\treturn mySigningKey, nil\n\t\t\t})\n\n\t\t}\n\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(w, err.Error())\n\t\t\tfmt.Println(\"trello\")\n\t\t\tfmt.Println(err.Error())\n\n\t\t}\n\n\t\tif token.Valid {\n\t\t\tclaims, _ := token.Claims.(jwt.MapClaims)\n\t\t\tfmt.Println(claims[\"id\"])\n\n\t\t\tstr := fmt.Sprintf(\"%v\", claims[\"id\"])\n\t\t\toid, _ := primitive.ObjectIDFromHex(str)\n\n\t\t\tcollection, client := query.Connection(\"user\")\n\t\t\terr = collection.FindOne(context.TODO(), bson.D{{Key: \"_id\", Value: oid}}).Decode(&data)\n\t\t\tdefer query.Endconn(client)\n\n\t\t\ttokenacc, err = helpers.GenerateJWTAccess(check, data)\n\n\t\t\tfmt.Println(tokenacc)\n\t\t\tw.Header().Add(\"Token\", tokenacc)\n\t\t\t//w.Header().Add(\"Access-Control-Expose-Headers\", \"Content-Disposition\")\n\t\t}\n\t} else {\n\t\tfmt.Println(\"hiko\")\n\t\tfmt.Fprintf(w, \"Not Authorized\")\n\t}\n\n}", "title": "" }, { "docid": "25364787e9d10569afe54fe14e288a72", "score": "0.45608363", "text": "func (ethclient *EthereumLocal) AdminAP(w http.ResponseWriter, req *http.Request) {\n\tif req.URL.Path != \"/adminap\" {\n\t\thttp.Error(w, \"404 not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\n\tswitch req.Method {\n\tcase \"POST\":\n\n\t\tlogger.Log.Printf(\"Request received from %s\\n\", req.Host)\n\n\t\t// check the authentication header value\n\t\tusername, password, ok := req.BasicAuth()\n\t\tif !ok {\n\t\t\thttp.Error(w, \"There is no authentication header in the request\", http.StatusBadRequest)\n\t\t\tlogger.Log.Printf(\"Could not read the authentication header of the request\\n\")\n\t\t\treturn\n\t\t}\n\t\tif username != libs.ADMINACCOUNT || password != libs.ADMINPASSWORD {\n\t\t\tlogger.Log.Printf(\"Wrong user or pasword\")\n\t\t\thttp.Error(w, \"Wrong password or user\", http.StatusBadRequest)\n\t\t}\n\n\t\t// Process the request of the admin user\n\t\tethClientArg := &libs.Ethereum{\n\t\t\tEthereumClient: ethclient.EthereumClient,\n\t\t\tDataCon: ethclient.DataCon,\n\t\t\tAccessCon: ethclient.AccessCon,\n\t\t\tBalanceCon: ethclient.BalanceCon,\n\t\t\tAdminPrivKey: ethclient.AdminPrivKey,\n\t\t}\n\t\terr := adminap.ProcessRequest(req, ethClientArg)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\thttp.Error(w, \"200 ok\", http.StatusOK)\n\n\tdefault:\n\t\thttp.Error(w, \"401 Only POST methods are supported\", http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"Only Post methods are supported\")\n\t}\n}", "title": "" }, { "docid": "b5da3b293c0a9e2acf9577887336fc34", "score": "0.45607087", "text": "func (db *Database) updateToken(uid bson.ObjectId, token string) error {\n\tupdate := bson.M{\n\t\t\"$set\": bson.M{\n\t\t\t\"token\": token,\n\t\t},\n\t}\n\treturn db.users.UpdateId(uid, update)\n}", "title": "" }, { "docid": "0f57f3688d750a7cbdf34f33536838ea", "score": "0.45603153", "text": "func WithToken(t string) Option {\n\treturn func(c *Client) {\n\t\tif c != nil {\n\t\t\tc.settings.APIKey = t\n\t\t}\n\t}\n}", "title": "" }, { "docid": "37ac9051e716d1b7342d0ea246683abb", "score": "0.45567116", "text": "func (m *OptionalClaims) SetIdToken(value []OptionalClaimable)() {\n m.idToken = value\n}", "title": "" }, { "docid": "088f27616ab45e7abcd349dc2ec3c85b", "score": "0.45543554", "text": "func registerAdminRoute(r *gin.RouterGroup) {\n\t// admin category\n\tr.GET(\"/categories\", handler.GetAdminCategories)\n\tr.GET(\"/categories/:id\", handler.GetAdminCategory)\n\tr.POST(\"/categories\", handler.PostCategory)\n\tr.PUT(\"/categories/:id\", handler.UpdateCategory)\n\tr.PATCH(\"/categories/:id\", handler.UpdateCategory)\n\tr.DELETE(\"/categories/:id\", handler.DeleteCategory)\n\n\t// admin post\n\tr.GET(\"/posts\", handler.GetAdminPosts)\n\tr.GET(\"/posts/:id\", handler.GetAdminPost)\n\tr.GET(\"/categories/:id/posts\", handler.GetAdminCategoryPosts)\n\tr.POST(\"/categories/:id/posts\", handler.PostCategoryPost)\n\tr.POST(\"/posts\", handler.PostPost)\n\tr.PUT(\"/posts/:id\", handler.UpdatePost)\n\tr.PATCH(\"/posts/:id\", handler.UpdatePost)\n\tr.DELETE(\"/posts/:id\", handler.DeletePost)\n\n\t// admin user\n\tr.PUT(\"/users/:id\", handler.UpdateUser)\n\tr.PATCH(\"/users/:id\", handler.UpdateUser)\n\tr.PUT(\"/users/:id/password\", handler.UpdateUserPassword)\n}", "title": "" }, { "docid": "d4ceffaf0f3c896a5f993fdcaab420e9", "score": "0.45472544", "text": "func AdminFilter(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) {\n CheckAdminPermission(GetTokenFromContext(req), vault.DefaultConfig())\n chain.ProcessFilter(req, resp)\n}", "title": "" }, { "docid": "e82630c54840d631d09880645378b7b4", "score": "0.45436224", "text": "func buildAdminRequest(queryVal url.Values, method, path string,\n\tcontentLength int64, bodySeeker io.ReadSeeker) (*http.Request, error) {\n\n\treq, err := newTestRequest(method,\n\t\tadminPathPrefix+adminAPIVersionPrefix+path+\"?\"+queryVal.Encode(),\n\t\tcontentLength, bodySeeker)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcred := globalActiveCred\n\terr = signRequestV4(req, cred.AccessKey, cred.SecretKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "8413a9f7e4ab41b9ebede2176b3a3d93", "score": "0.45382464", "text": "func AdminAuth(w http.ResponseWriter, r *http.Request) {\n\tvar login Login\n\tbody, _ := ioutil.ReadAll(r.Body)\n\terr := json.Unmarshal(body, &login)\n\tif err != nil || len(login.Username) < 3 || len(login.Password) < 3 {\n\t\t// Didn't meet the reqs to even be an admin.\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tw.Write([]byte(`{\"status\": 401, \"error\": \"StatusUnauthorized\"}`))\n\t\treturn\n\t}\n\n\tvar ctx = context.Background()\n\tclient, err := datastore.NewClient(ctx, \"timcole-me\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tkey := datastore.NameKey(\"Admins\", login.Username, nil)\n\tadmin := Admin{Permissions: make(map[string]bool)}\n\terr = client.Get(ctx, key, &admin)\n\tif err != nil {\n\t\t// Not an admin.\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tw.Write([]byte(`{\"status\": 401, \"error\": \"StatusUnauthorized\"}`))\n\t\treturn\n\t}\n\n\terr = bcrypt.CompareHashAndPassword([]byte(admin.PasswordHash), []byte(login.Password))\n\tif err != nil {\n\t\t// Invalid Login\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tw.Write([]byte(`{\"status\": 401, \"error\": \"StatusUnauthorized\"}`))\n\t\treturn\n\t}\n\n\tadmin.Name = login.Username\n\n\ttype perms []string\n\tvar permission = perms{}\n\tfmt.Println(admin.PermissionsString)\n\terr = json.Unmarshal([]byte(admin.PermissionsString), &permission)\n\tif err != nil {\n\t\t// Can't get perms\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(`{\"status\": 500, \"error\": \"StatusInternalServerError\"}`))\n\t\treturn\n\t}\n\tfor _, v := range permission {\n\t\tadmin.Permissions[v] = true\n\t}\n\n\t// Expire in a week\n\tadmin.ExpiresAt = time.Now().UTC().Add((24 * time.Hour) * 7).Unix()\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, admin)\n\n\t// Sign and get the complete encoded token as a string using the secret\n\ttokenString, err := token.SignedString([]byte(settings.Get(\"SIGNING_KEY\")))\n\tif err != nil {\n\t\t// Failed to sign token\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(`{\"status\": 500, \"error\": \"StatusInternalServerError\"}`))\n\t\treturn\n\t}\n\n\tadmin.JWT = tokenString\n\tresp, err := json.Marshal(admin)\n\tif err != nil {\n\t\t// Failed to encode return\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(`{\"status\": 500, \"error\": \"StatusInternalServerError\"}`))\n\t\treturn\n\t}\n\n\tw.Write(resp)\n}", "title": "" }, { "docid": "19acf7c37e112e746482293cf13ae125", "score": "0.45325854", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv) AppendAdminGroup(v *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_AdminGroup) error {\n\tkey := *v.BitIndex\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[uint8]*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_AdminGroup)\n\t}\n\n\tif _, ok := t.AdminGroup[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list AdminGroup %v\", key)\n\t}\n\n\tt.AdminGroup[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "b4c18d03839c16e6301001735c951d60", "score": "0.45325282", "text": "func CreateAdminToken(password string, rancherConfig *rancher.Config) (string, error) {\n\tadminUser := &management.User{\n\t\tUsername: \"admin\",\n\t\tPassword: password,\n\t}\n\n\thostURL := rancherConfig.Host\n\tvar userToken *management.Token\n\terr := kwait.Poll(500*time.Millisecond, 5*time.Minute, func() (done bool, err error) {\n\t\tuserToken, err = token.GenerateUserToken(adminUser, hostURL)\n\t\tif err != nil {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t})\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn userToken.Token, nil\n}", "title": "" }, { "docid": "e72974854b05fb98ea251ca65853d3cf", "score": "0.4531473", "text": "func ElevateToAdmin(ctx context.Context, client *fbauth.Client, uid string) error {\n\tclaims := map[string]interface{}{\"admin\": true}\n\terr := client.SetCustomUserClaims(ctx, uid, claims)\n\tif err != nil {\n\t\treturn errs.Wrap(err, \"error setting custom claims\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a8b9a25d1934a784d5cc6d623d4d941", "score": "0.45311576", "text": "func (ctl *controller) APIJWTIndexPostAction(ctx *gin.Context) {\n\tctl.logger.Debug(\"controler APIJWTIndexPostAction\")\n\n\t// check login\n\tuserID, mail, err := ctl.apiLogin(ctx)\n\tif err != nil {\n\t\tctx.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\ttoken, err := ctl.jwter.CreateBasicToken(\n\t\ttime.Now().Add(time.Minute*60).Unix(), // TODO: time should be configurable\n\t\tstrconv.Itoa(userID),\n\t\tmail,\n\t)\n\tif err != nil {\n\t\tctx.AbortWithError(http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tctl.logger.Debug(\"APIJWTIndexPostAction\", zap.String(\"token\", token))\n\n\t// json response\n\tctx.JSON(http.StatusOK, jsonresp.CreateJWTJson(token))\n}", "title": "" }, { "docid": "fb596f00cf0889b63c78dbbff88e3fa9", "score": "0.45206004", "text": "func (_Registry *RegistryTransactor) AddToken(opts *bind.TransactOpts, token_address common.Address) (*types.Transaction, error) {\n\treturn _Registry.contract.Transact(opts, \"addToken\", token_address)\n}", "title": "" }, { "docid": "b75445e433461036c493df1302666759", "score": "0.45181048", "text": "func addToken(tokenType TokenType, value string, tokens *[]*Token) {\n\ttoken := &Token{tokenType, value}\n\t*tokens = append(*tokens, token)\n}", "title": "" }, { "docid": "c329b1399f51c8b91ee5c5c658ead45d", "score": "0.4505855", "text": "func authTokenPost(t *testing.T, options gophercloud.AuthOptions, scope *tokens.Scope, requestJSON string) {\n\ttesthelper.SetupHTTP()\n\tdefer testhelper.TeardownHTTP()\n\n\tclient := gophercloud.ServiceClient{\n\t\tProviderClient: &gophercloud.ProviderClient{\n\t\t\tTokenID: options.TokenID,\n\t\t},\n\t\tEndpoint: testhelper.Endpoint(),\n\t}\n\n\ttesthelper.Mux.HandleFunc(\"/auth/tokens\", func(w http.ResponseWriter, r *http.Request) {\n\t\ttesthelper.TestMethod(t, r, \"POST\")\n\t\ttesthelper.TestHeader(t, r, \"Content-Type\", \"application/json\")\n\t\ttesthelper.TestHeader(t, r, \"Accept\", \"application/json\")\n\t\ttesthelper.TestJSONRequest(t, r, requestJSON)\n\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tfmt.Fprintf(w, `{\n\t\t\t\"token\": {\n\t\t\t\t\"expires_at\": \"2014-10-02T13:45:00.000000Z\"\n\t\t\t}\n\t\t}`)\n\t})\n\n\t_, err := tokens.Create(&client, AuthOptionsExt{AuthOptions: tokens.AuthOptions{options}, TrustID: \"123456\"}, scope).Extract()\n\tif err != nil {\n\t\tt.Errorf(\"Create returned an error: %v\", err)\n\t}\n}", "title": "" }, { "docid": "252b9192ef5575c483fc1e598fbafa06", "score": "0.45026466", "text": "func IsAdmin(next echo.HandlerFunc) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\t\tuser := c.Get(\"user\").(*jwt.Token)\n\t\tclaims := user.Claims.(jwt.MapClaims)\n\t\tisAdmin := claims[\"admin\"].(bool)\n\t\tif isAdmin == false {\n\t\t\treturn echo.ErrUnauthorized\n\t\t}\n\t\treturn next(c)\n\t}\n}", "title": "" }, { "docid": "053ba214c2e638b56c71800d67e047de", "score": "0.4493651", "text": "func addAuthorization(w http.ResponseWriter, req *http.Request) {\n\tdefer common.Untrace(common.Trace())\n\n\tvar httpStatus int\n\tvar httpResponse []byte\n\n\t// parse request body\n\tbody, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tlog.Warn(\"failed to parse request body for adding authorization, err:\", err)\n\t\tserverError(w, auth_errors.ErrParsingRequest)\n\t\treturn\n\t}\n\n\t// unmarshal request body\n\taddAuthzReq := &AddAuthorizationRequest{}\n\tif err := json.Unmarshal(body, addAuthzReq); err != nil {\n\t\tlog.Warn(\"failed to unmarshal authorization, err:\", err)\n\t\tserverError(w, auth_errors.ErrUnmarshalingBody)\n\t\treturn\n\t}\n\n\t// input validation\n\tif common.IsEmpty(addAuthzReq.PrincipalName) {\n\t\tlog.Warnf(\"principal name missing from authorization: %#v\", addAuthzReq)\n\n\t\thttpStatus = http.StatusBadRequest\n\t\thttpResponse = []byte(\"principal name is missing\")\n\n\t\tprocessStatusCodes(httpStatus, httpResponse, w)\n\t\treturn\n\t}\n\n\trole, err := types.Role(addAuthzReq.Role)\n\tif err != nil {\n\t\tlog.Warnf(\"illegal role specified in authorization: %#v\", addAuthzReq)\n\n\t\thttpStatus = http.StatusBadRequest\n\t\thttpResponse = []byte(\"illegal role specified\")\n\n\t\tprocessStatusCodes(httpStatus, httpResponse, w)\n\t\treturn\n\t}\n\n\t// If role specific is ops, a tenant name must be specified\n\tif role == types.Ops && common.IsEmpty(addAuthzReq.TenantName) {\n\t\tlog.Warnf(\"ops role without specifying tenant in authorization: %#v\", addAuthzReq)\n\n\t\thttpStatus = http.StatusBadRequest\n\t\thttpResponse = []byte(\"ops role requires a tenant to be specified\")\n\n\t\tprocessStatusCodes(httpStatus, httpResponse, w)\n\t\treturn\n\t}\n\n\t// invoke helper to add authz\n\tauthz, err := auth.AddAuthorization(addAuthzReq.TenantName,\n\t\trole, addAuthzReq.PrincipalName, addAuthzReq.Local)\n\tswitch err {\n\tcase nil:\n\n\t\tgetAuthzReply := convertAuthz(authz)\n\n\t\t// convert authorization reply to JSON\n\t\tjsonAuthz, err := json.Marshal(getAuthzReply)\n\t\tif err != nil {\n\n\t\t\tlog.Error(\"failed to marshal authorization, err:\", err)\n\t\t\thttpStatus = http.StatusInternalServerError\n\t\t\thttpResponse = []byte(auth_errors.ErrPartialFailureToAddAuthz.Error())\n\n\t\t\t// clean up created authorization\n\t\t\terr = auth.DeleteAuthorization(authz.UUID)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"Failed to delete authz after partially failed \",\n\t\t\t\t\t\" authz creation, Manual cleanup from KV store needed!\")\n\t\t\t}\n\t\t\tprocessStatusCodes(httpStatus, httpResponse, w)\n\t\t\treturn\n\t\t}\n\t\thttpStatus = http.StatusCreated\n\t\thttpResponse = jsonAuthz\n\tcase auth_errors.ErrIllegalOperation:\n\t\thttpStatus = http.StatusBadRequest\n\t\thttpResponse = []byte(err.Error())\n\tdefault:\n\n\t\thttpStatus = http.StatusInternalServerError\n\t\thttpResponse = []byte(auth_errors.ErrUnauthorized.Error())\n\t}\n\n\t// process status codes\n\tprocessStatusCodes(httpStatus, httpResponse, w)\n}", "title": "" }, { "docid": "0466029da3bd464689baf634f2c49499", "score": "0.44818008", "text": "func (manager *JWTManager) NewTokenId(accountId bson.ObjectId) string {\n\tm := md5.New()\n\tm.Write([]byte(accountId.Hex() + \":\" + time.Now().String() + \":\" + string(manager.idCount)))\n\treturn hex.EncodeToString(m.Sum(nil))\n}", "title": "" }, { "docid": "7918a0aeb40c7e6efb6b3237fd5942ee", "score": "0.4479039", "text": "func AddMfa(server *Server, password string, mfaToken string) {\n\tgetLoginResponse := fmt.Sprintf(`{\n \"app\": {\n \"version\": \"4.28.0\"\n },\n \"showLoginLinks\": true,\n \"links\": {\n \"uaa\": \"%[1]s\",\n \"passwd\": \"/forgot_password\",\n \"login\": \"%[1]s\",\n \"register\": \"/create_account\"\n },\n \"zone_name\": \"uaa\",\n \"entityID\": \"some-host-name.example.com\",\n \"commit_id\": \"8917980\",\n \"idpDefinitions\": {},\n \"prompts\": {\n \"username\": [\n \"text\",\n \"Email\"\n ],\n \"password\": [\n \"password\",\n \"Password\"\n ],\n \"passcode\": [\n \"password\",\n \"Temporary Authentication Code ( Get one at %[1]s/passcode )\"\n ],\n \"mfaCode\": [\n \"password\",\n \"MFA Code ( Register at %[1]s )\"\n ]\n },\n \"timestamp\": \"2019-02-19T18:08:02+0000\"\n}`, server.URL())\n\n\tserver.RouteToHandler(http.MethodGet, \"/login\",\n\t\tRespondWith(http.StatusOK, getLoginResponse),\n\t)\n\n\tserver.RouteToHandler(http.MethodPost, \"/oauth/token\", makeMFAValidator(password, mfaToken))\n\n}", "title": "" }, { "docid": "fb9da7ef5f588b347c5dab131cecbf08", "score": "0.44769973", "text": "func is_admin_token( token *string ) ( bool ) {\n\n\tmy_ch := make( chan *ipc.Chmsg )\t\t\t\t\t\t\t// allocate channel for responses to our requests\n\tdefer close( my_ch )\t\t\t\t\t\t\t\t\t// close it on return\n\n\treq := ipc.Mk_chmsg( )\n\treq.Send_req( osif_ch, my_ch, REQ_VALIDATE_TEGU_ADMIN, token, nil )\t\t// verify that the token is good for the admin (default) user given in the config file\n\treq = <- my_ch\t\t\t\t\t\t\t\t\t\t\t\t\t\t// hard wait for response\n\n\tif req.State == nil {\n\t\treturn true\n\t}\n\n\thttp_sheep.Baa( 1, \"admin token auth failed: %s\", req.State )\n\treturn false\n}", "title": "" }, { "docid": "1dd5919b820c7ba89af76c6d2af19eca", "score": "0.4475006", "text": "func (g *MessagesGetExportedChatInvitesRequest) GetAdminID() (value InputUserClass) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.AdminID\n}", "title": "" }, { "docid": "8818fa1109c7eb6536b10d33c4ced53f", "score": "0.4468149", "text": "func (t *TopicsController) AddAdminGroup(ctx *gin.Context) {\n\tvar paramJSON tat.ParamTopicGroupJSON\n\tctx.Bind(&paramJSON)\n\ttopic, e := t.preCheckGroup(ctx, &paramJSON)\n\tif e != nil {\n\t\tctx.JSON(tat.Error(e))\n\t\treturn\n\t}\n\n\tif err := topicDB.AddAdminGroup(topic, getCtxUsername(ctx), paramJSON.Groupname, paramJSON.Recursive); err != nil {\n\t\tlog.Errorf(\"Error while adding admin admin group: %s\", err)\n\t\tctx.JSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tctx.JSON(http.StatusCreated, \"\")\n}", "title": "" }, { "docid": "6f54d87784e730abda8107f23daadb5a", "score": "0.44677442", "text": "func RegisterAdmin(w http.ResponseWriter, req *http.Request) {\n\tfmt.Println(\"Register req.URL.Method\",req.Method)\n\tif err := req.ParseForm(); err != nil {\n\t\treturn\n\t}\n\tls := Structures.LoginStruct{}\n\tls.UserName = req.PostFormValue(\"userame\")\n\tls.PassWord = req.PostFormValue(\"password\")\n\tls.Lastlogintime = time.Now().UTC()\n\tfmt.Println(\"ls\",ls)\n\tswitch req.Method {\n\tcase \"POST\":\n\t\tret := AddAdmin(ls);\n\t\tswitch ret {\n\t\tcase 1 :\n\t\t\tfmt.Fprintf(w, \"Sorry, only POST methods are supported.\")\n\t\tcase 2 :\n\t\t\tredirectionAdminPage(w,\"Added sucessfully\")\n\t\tcase 3 :\n\t\t\tfmt.Fprintf(w, \"User allready exists\")\n\t\tdefault:\n\t\t\tfmt.Fprintf(w, \"unknown error occurs\")\n\t\t}\n\n\tdefault:\n\t\tfmt.Fprintf(w, \"Sorry, only PUT and POST methods are supported.\")\n\t}\n}", "title": "" }, { "docid": "83114ec1f297de4005f3e3750d84f040", "score": "0.44568375", "text": "func RequestAdminAccessToken(c echo.Context) error {\n\tm := echo.Map{}\n\tif err := c.Bind(&m); err != nil {\n\t\treturn err\n\t}\n\trefreshToken, ok := m[\"refresh_token\"].(string)\n\tif !ok {\n\t\temo.ParamError(\"provide a refresh_token parameter\")\n\t\treturn c.JSON(http.StatusBadRequest, echo.Map{\n\t\t\t\"error\": \"provide a refresh_token parameter\",\n\t\t})\n\t}\n\n\t// get the namespace\n\t_, ns, err := db.SelectNamespaceFromName(\"quid\")\n\tif err != nil {\n\t\temo.Error(err)\n\t\tlog.Fatal(err)\n\t\treturn c.JSON(http.StatusInternalServerError, echo.Map{\n\t\t\t\"error\": true,\n\t\t})\n\t}\n\n\t// verify the refresh token\n\tvar username string\n\ttoken, err := jwt.ParseWithClaims(refreshToken, &tokens.StandardRefreshClaims{}, func(token *jwt.Token) (interface{}, error) {\n\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\treturn nil, fmt.Errorf(\"Unexpected signing method: %v\", token.Header[\"alg\"])\n\t\t}\n\t\treturn []byte(ns.RefreshKey), nil\n\t})\n\tif claims, ok := token.Claims.(*tokens.StandardRefreshClaims); ok && token.Valid {\n\t\tusername = claims.Name\n\t\tfmt.Printf(\"%v %v\", claims.Name, claims.StandardClaims.ExpiresAt)\n\t} else {\n\t\temo.Error(err.Error())\n\t\treturn c.JSON(http.StatusUnauthorized, echo.Map{\n\t\t\t\"error\": \"unauthorized\",\n\t\t})\n\t}\n\n\t// get the user\n\tfound, u, err := db.SelectNonDisabledUser(username, ns.ID)\n\tif !found {\n\t\temo.Error(\"User not found: \" + username)\n\t\treturn c.JSON(http.StatusUnauthorized, echo.Map{\n\t\t\t\"error\": \"unauthorized\",\n\t\t})\n\t}\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn c.JSON(http.StatusInternalServerError, echo.Map{\n\t\t\t\"error\": true,\n\t\t})\n\t}\n\n\t// get the user group names\n\tgroupNames, err := db.SelectGroupsNamesForUser(u.ID)\n\tif err != nil {\n\t\temo.Error(\"Groups error\")\n\t\tlog.Fatal(err)\n\t\treturn err\n\t}\n\t// check if the user is in the admin group\n\tisAdmin := false\n\tfor _, gn := range groupNames {\n\t\tif gn == \"quid_admin\" {\n\t\t\tisAdmin = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !isAdmin {\n\t\temo.Warning(\"Admin access token request from user\", u.Name, \"that is not in the quid_admin group\")\n\t\treturn c.JSON(http.StatusUnauthorized, echo.Map{\n\t\t\t\"error\": \"unauthorized\",\n\t\t})\n\t}\n\n\t// generate the access token\n\t_, t, err := tokens.GenAccessToken(ns.Name, ns.Key, ns.MaxTokenTTL, u.Name, groupNames, \"5m\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn c.JSON(http.StatusInternalServerError, echo.Map{\n\t\t\t\"error\": true,\n\t\t})\n\t}\n\n\treturn c.JSON(http.StatusOK, echo.Map{\n\t\t\"token\": t,\n\t})\n}", "title": "" }, { "docid": "d5b2c28e9af029f5407262c3a760efc6", "score": "0.44496116", "text": "func (s *Service) AdminAddMultisigOwner(newsroomAddress common.Address, newOwner common.Address) (common.Hash, error) {\n\tmultisig, multisigAddr, err := s.getMultisigForNewsroom(newsroomAddress)\n\tif err != nil {\n\t\treturn common.Hash{}, err\n\t}\n\n\t// we can't use `multisig.AddOwner` directly, since the function requires it comes from the multisig\n\t// instead, we build the []byte for the tx data and then use `multisig.SubmitTransaction` to execute it\n\tdata, err := s.multisigABI.Pack(\"addOwner\", newOwner)\n\tif err != nil {\n\t\treturn common.Hash{}, err\n\t}\n\n\t// amounf of ETH to send with the tx\n\tvalue := big.NewInt(0)\n\n\t// submit the tx to the multisig\n\ttx, err := multisig.SubmitTransaction(s.eth.Transact(), multisigAddr, value, data)\n\tif err != nil {\n\t\treturn common.Hash{}, err\n\t}\n\n\treturn tx.Hash(), nil\n}", "title": "" }, { "docid": "5a2508f791a2b77c2826ef5d249b71c2", "score": "0.44452938", "text": "func Admin(c echo.Context) error { //=> Admin main page\n\treturn c.String(http.StatusOK, \"Welcome to the secret admin main page!\")\n}", "title": "" }, { "docid": "8c1325dc291d98b89c87a7b80280dfc2", "score": "0.4443928", "text": "func setAdminSession(c *gin.Context, admin Admin) {\n\tsession := sessions.Default(c)\n\tsession.Set(\"adminID\", admin.ID)\n\tsession.Set(\"adminFirstName\", admin.FirstName)\n\tsession.Set(\"adminLastName\", admin.LastName)\n\tsession.Set(\"adminEmail\", admin.Email)\n\tsession.Set(\"adminPhone\", admin.PhoneNumber)\n\tsession.Save()\n}", "title": "" }, { "docid": "ffadfbec9f27e826177f2b45f4072845", "score": "0.44353303", "text": "func (m *UserMutation) AddExternalID(i int) {\n\tif m.addexternal_id != nil {\n\t\t*m.addexternal_id += i\n\t} else {\n\t\tm.addexternal_id = &i\n\t}\n}", "title": "" }, { "docid": "cc7b3091eaa297410a3e5b97ecfd53d6", "score": "0.44340414", "text": "func (api *API) isAdmin(userID string) bool {\n\tif api.cfg.Discord.OwnerID == userID {\n\t\treturn true\n\t}\n\n\tfor _, id := range api.cfg.API.AdminIDs {\n\t\tif id == userID {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "04c816ebfbc19c5e1b6379276db67a2c", "score": "0.44324806", "text": "func (s *systemtestSuite) addAuthorization(c *C, data, token string) proxy.GetAuthorizationReply {\n\tendpoint := proxy.V1Prefix + \"/authorizations\"\n\n\tresp, body := proxyPost(c, token, endpoint+\"/\", []byte(data))\n\tc.Assert(resp.StatusCode, Equals, 201)\n\n\tauthz := proxy.GetAuthorizationReply{}\n\tc.Assert(json.Unmarshal(body, &authz), IsNil)\n\treturn authz\n}", "title": "" }, { "docid": "9239cdfc62e3b0404f44e5c826534d68", "score": "0.4427526", "text": "func add(c *gin.Context) {\n\tvar in app.INUser\n\n\tif err := c.ShouldBindJSON(&in); err != nil {\n\t\toops.Handling(err, c)\n\t\treturn\n\t}\n\n\tid, err := app.Add(&in)\n\tif err != nil {\n\t\toops.Handling(err, c)\n\t\treturn\n\t}\n\n\tc.JSON(201, id)\n}", "title": "" }, { "docid": "407ac3341c292b79af69d31049603a33", "score": "0.44187957", "text": "func SetAPIToken(apiToken string) (err error) {\n\tdirectory, err := GetConfigDirectoryPath()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdoesDirectoryExists, err := exists(directory)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif doesDirectoryExists == false {\n\t\terr = os.Mkdir(directory, 0744)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tconfigFilePath, err := GetConfigFilePath()\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar config = map[string]interface{}{\n\t\t\"api_token\": apiToken}\n\tdata := new(bytes.Buffer)\n\terr = toml.NewEncoder(data).Encode(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ioutil.WriteFile(configFilePath, data.Bytes(), 0600)\n\treturn err\n}", "title": "" }, { "docid": "27b7a3d65afcf7670fffbde79ef0b65f", "score": "0.44145864", "text": "func WithExtraAdmins(ids ...int) BotOption {\n\treturn func(b *Bot) {\n\t\tb.admins = append(b.admins, ids...)\n\t\tsort.Ints(b.admins)\n\t}\n}", "title": "" }, { "docid": "89c70d5491a46646fa42252345e40be0", "score": "0.4413131", "text": "func AdminAPI(ctl *dsmapper.Controller) api.AdminServer {\n\timpl := &adminImpl{\n\t\tacl: rpcacl.CheckAdmin,\n\t\tctl: ctl,\n\t}\n\timpl.init()\n\treturn impl\n}", "title": "" } ]
c9c826218fc5f24d59254172de0054ca
Id returns the ID of the instance.
[ { "docid": "7bd5a5aa824399fac049c1a946b30b23", "score": "0.7719838", "text": "func (i *awsInstance) Id() string { return fi.StringValue(i.obj.ID) }", "title": "" } ]
[ { "docid": "f6ab4427e8cb47ba7b3ea5306b7160ec", "score": "0.773567", "text": "func (pi *Instance) ID() string {\n\treturn pi.id\n}", "title": "" }, { "docid": "e873ccb68d14fb6737c60b376128d2dd", "score": "0.76599205", "text": "func (r *Instance) ID() pulumi.IDOutput {\n\treturn r.s.ID()\n}", "title": "" }, { "docid": "b5c709a4c68980b12c84d3bf7d82e75c", "score": "0.76406795", "text": "func (s *Instance) ID() uuid.UUID {\n\treturn s.id\n}", "title": "" }, { "docid": "04747d8f04a879bbf15f55ccfa50de65", "score": "0.6966027", "text": "func (i *ComputeInstance) ID() string {\n\treturn i.Name\n}", "title": "" }, { "docid": "4a4f622c71b6f28ba44899ad1345c4da", "score": "0.6797306", "text": "func (os *OpenStack) InstanceID() (string, error) {\n\treturn os.localInstanceID, nil\n}", "title": "" }, { "docid": "cdd3ec86f98f904209bf4fc23575659a", "score": "0.6755892", "text": "func InstanceID() string { return appengine_internal.InstanceID() }", "title": "" }, { "docid": "fbc6ecdaf16687e77eb7857c5a1a0569", "score": "0.67037034", "text": "func (o GetInstanceTypeResultOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetInstanceTypeResult) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8e765098537132af326eb5bc511b7969", "score": "0.6702252", "text": "func (o DatabaseOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Database) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8e765098537132af326eb5bc511b7969", "score": "0.6702252", "text": "func (o DatabaseOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Database) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5d4da832e9ddf1b20c1eb1b6be72ee13", "score": "0.6620719", "text": "func (m *Machine) InstanceID() string {\n\treturn m.instanceID\n}", "title": "" }, { "docid": "ee8d046dbe420562c1eead7c393e90a6", "score": "0.660528", "text": "func (d *DefaultServiceInstance) GetId() string {\n\treturn d.Id\n}", "title": "" }, { "docid": "1399e9ae16c864aaf794da2a9cfefc97", "score": "0.6605173", "text": "func (o HAVipAttachmentOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *HAVipAttachment) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c56210d47f22298897e310531456ff6f", "score": "0.66033703", "text": "func (o NotificationOutput) InstanceId() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *Notification) pulumi.IntOutput { return v.InstanceId }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "39984e31404848b752bc662f05200941", "score": "0.6601916", "text": "func (m *MachineInfo) GetInstanceID() string {\n\t//TODO: add implementation\n\treturn \"\"\n}", "title": "" }, { "docid": "16c87e7bab79033e57762622595eaaac", "score": "0.65379316", "text": "func (sim *SISimulation) InstanceID() int {\n\treturn sim.instanceID\n}", "title": "" }, { "docid": "708ed13cb21f9755cb88cb405922b1f0", "score": "0.6511155", "text": "func (indom *PCPInstanceDomain) ID() uint32 { return indom.id }", "title": "" }, { "docid": "fb9c5339d1d064923a1c682c676cee30", "score": "0.6509217", "text": "func (c *Context) InstanceID() string {\n\treturn c.instanceIDFunc()\n}", "title": "" }, { "docid": "b878c1d5aa3c2fab0423d2a0a2041392", "score": "0.6470923", "text": "func (app *Application) InstanceID() string {\n\treturn app.instanceID\n}", "title": "" }, { "docid": "5ce02a468f32ba0731bddfebf39a3508", "score": "0.6466782", "text": "func (o ContactFlowOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ContactFlow) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "837696c690759c2add2265241356b6f4", "score": "0.6447489", "text": "func (o GetSqlManagedInstanceResultOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetSqlManagedInstanceResult) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9d0d4c5f416ed2508d05cb79a3f1ba23", "score": "0.6432185", "text": "func (view *View) ID() uint64 {\n\treturn view.id\n}", "title": "" }, { "docid": "ddafe84ea7c84623083406aa3435efe2", "score": "0.6410861", "text": "func (b *impl) ID() string {\n\treturn b.id\n}", "title": "" }, { "docid": "1b9210f4b5329bc9821e84d5bc2a0761", "score": "0.639869", "text": "func (i *InstanceStats) ID() string {\n\ti.mutex.RLock()\n\tdefer i.mutex.RUnlock()\n\treturn i.stats[\"id\"].(string)\n}", "title": "" }, { "docid": "45ae8e4ef3966e9ef1ee3d8d13363747", "score": "0.6396521", "text": "func (o GetInstancesResultOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetInstancesResult) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6decf60c1218e3b989c100cb46e4c71b", "score": "0.6395035", "text": "func (o PrivatelinkAzureOutput) InstanceId() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *PrivatelinkAzure) pulumi.IntOutput { return v.InstanceId }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "618c6ffee03a5aeecb96cfac42a5977f", "score": "0.6394911", "text": "func (o LaunchConfigurationOutput) InstanceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LaunchConfiguration) pulumi.StringPtrOutput { return v.InstanceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "aa7651f4a58aed63bd47019c9f9bd0e0", "score": "0.6390039", "text": "func (o VocabularyOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Vocabulary) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4fddfb9adfb0074eadea6168a2d1a784", "score": "0.63798463", "text": "func (s *Spoke) ID() uuid.UUID {\n\treturn s.id\n}", "title": "" }, { "docid": "fcf572954ceaf1c5fa650e81353d0da4", "score": "0.6370822", "text": "func (o GetElasticIpResultOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetElasticIpResult) string { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8fe6191282aaea25ab050ec8fe1583bf", "score": "0.6369018", "text": "func (m *MetaData) InstanceID() (string, error) {\n\tvar instanceid ResultList\n\terr := m.New().Resource(INSTANCE_ID).Do(&instanceid)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn instanceid.result[0], err\n}", "title": "" }, { "docid": "dce93a75444556e18ff668707b6afaa3", "score": "0.63630927", "text": "func (o EcsDiskAttachmentOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *EcsDiskAttachment) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8eda37a04841a886b587fd38c44c1878", "score": "0.6357912", "text": "func (o LookupEipResultOutput) InstanceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupEipResult) *string { return v.InstanceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "723894bc72f9bd52cc554723c0911059", "score": "0.6320589", "text": "func (o *Object) ID() string { return o._ID }", "title": "" }, { "docid": "79960d968500efc30eb59e781cfc2596", "score": "0.6313082", "text": "func (o TransitRouterGrantAttachmentOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *TransitRouterGrantAttachment) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "87d16e95d130c742521fde50b3368c24", "score": "0.6290918", "text": "func (o UserOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *User) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "82e3c7b97dd4f3286e6705fce4656a17", "score": "0.6276452", "text": "func (c *component) ID() dependency.Instance {\n\treturn dependency.Ingress\n}", "title": "" }, { "docid": "24ca99cbdd0d36e86536d16c4693f5ce", "score": "0.6273324", "text": "func (i *Identity) InstanceID() (string, error) {\n\treturn i.registrationInfo.InstanceID(i.Log, \"\", registration.RegVaultKey), nil\n}", "title": "" }, { "docid": "0a221d93699454c5ccd9a204fb763f98", "score": "0.6271121", "text": "func (o SpannerIODetailsOutput) InstanceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SpannerIODetails) *string { return v.InstanceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "047b1e9d4f9dfa8c3b3705331622ec8e", "score": "0.62683904", "text": "func (o BigTableIODetailsOutput) InstanceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BigTableIODetails) *string { return v.InstanceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "298f3a64b13bc9b113ceb4d2fe8e017c", "score": "0.626414", "text": "func (r *NetworkInterfaceAttachment) InstanceId() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"instanceId\"])\n}", "title": "" }, { "docid": "e86ebb1ec61b87a8a76ccfbd778bf95c", "score": "0.62576705", "text": "func (o VpcPeeringOutput) InstanceId() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *VpcPeering) pulumi.IntPtrOutput { return v.InstanceId }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "f666ef400e9ec3c733d7692bf934161d", "score": "0.6242304", "text": "func (o InstanceLaunchTemplateOutput) Id() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v InstanceLaunchTemplate) *string { return v.Id }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f142b6454136388b623ff39c7957fdf7", "score": "0.6235373", "text": "func (o LookupAssociationResultOutput) InstanceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupAssociationResult) *string { return v.InstanceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7be98bfb594c0c6ad984a558c90a5045", "score": "0.6234763", "text": "func (h *Host) ID() p2p.ID {\n\treturn h.id\n}", "title": "" }, { "docid": "bc7dd20e459db8ec1f683cc2dd6a01f0", "score": "0.62097704", "text": "func (o GetServerlessInstancesResultOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetServerlessInstancesResult) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "37703d5b7e881317a623ed45c04f1b0c", "score": "0.62093776", "text": "func (d Display) ID() int64 {\n\treturn *d.o.ID\n}", "title": "" }, { "docid": "faf614d26ffe353a159c0fa2d125fad8", "score": "0.62032723", "text": "func (o BigTableIODetailsResponseOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BigTableIODetailsResponse) string { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "70602cad065ea433bb32fa86cb1dba15", "score": "0.61972696", "text": "func (i *Instances) InstanceID(name types.NodeName) (string, error) {\n\tsrv, err := getServerByName(i.compute, name)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// In the future it is possible to also return an endpoint as:\n\t// <endpoint>/<instanceid>\n\treturn \"/\" + srv.ID, nil\n}", "title": "" }, { "docid": "a5a57f10c920f28372cc4f0bb91f6a47", "score": "0.61827797", "text": "func (o SpannerIODetailsResponseOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SpannerIODetailsResponse) string { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2faf1be11655be4acb7058cd2e16154d", "score": "0.6181873", "text": "func (instance redisSession) GetID() string {\n\treturn instance.id\n}", "title": "" }, { "docid": "ac2eef74ab113aca28383d53011df1fd", "score": "0.6173408", "text": "func (s *Service) ID() platform.ID {\n\treturn ID\n}", "title": "" }, { "docid": "47f0e236ff8db14e4d91e895f843eab1", "score": "0.61713034", "text": "func (o ConsumerGroupOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ConsumerGroup) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b1b46e746b10e88de4f785ffa83a8023", "score": "0.6162831", "text": "func (o InstanceLaunchTemplatePtrOutput) Id() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *InstanceLaunchTemplate) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Id\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "218c13bc1197fd92276fbfb1860feee6", "score": "0.61610603", "text": "func (r *HaproxyLayer) ID() pulumi.IDOutput {\n\treturn r.s.ID()\n}", "title": "" }, { "docid": "277d66c3cf26de96ea6f15225acfb38a", "score": "0.6159184", "text": "func (self *Service) ID() string {\n\treturn \"solaredge\"\n}", "title": "" }, { "docid": "1476e006dd5e3d95e042db2637058ccf", "score": "0.6158601", "text": "func (c *Client) ID() int {\n\treturn c.id\n}", "title": "" }, { "docid": "f0ddbc84649b1a51a3f1ef649037aecc", "score": "0.61474043", "text": "func (r *Service) ID() pulumi.IDOutput {\n\treturn r.s.ID()\n}", "title": "" }, { "docid": "b17073086f50b89672a8b9405533bbf0", "score": "0.614624", "text": "func (a *Agenty) Id() int {\n\treturn a.id\n}", "title": "" }, { "docid": "9f1dc4dcb8ef71536f9d844a06df0155", "score": "0.61457497", "text": "func (o *Object) GetInstanceId() int64 {\n\tlog.Println(\"Calling Object.GetInstanceId()\")\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_instance_id\", goArguments, \"int64\")\n\n\treturnValue := goRet.Interface().(int64)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "99b1e68fd02b24a1ab198b9d8e16f510", "score": "0.6144922", "text": "func (p *Proc) ID() int {\n\treturn p.id\n}", "title": "" }, { "docid": "a3104b0c2188c01a9d1aa0a6d0145614", "score": "0.61436045", "text": "func (g *GameObject) ID() ID {\n\treturn g.id\n}", "title": "" }, { "docid": "d5e6f7100cd336be2e4adaa30408eb0e", "score": "0.6143417", "text": "func (o SecurityProfileOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SecurityProfile) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "cf719d748427bd8ca6e0d42af3c4ef46", "score": "0.6142436", "text": "func (r *DocumentationVersion) ID() pulumi.IDOutput {\n\treturn r.s.ID()\n}", "title": "" }, { "docid": "3d95fc294943f53f588e0ce3277a1def", "score": "0.6132891", "text": "func (o HostAccountUserGroupAttachmentOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *HostAccountUserGroupAttachment) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f85f96fa61f9800277ae236bf55d2e0f", "score": "0.61210454", "text": "func (instance memorySession) GetID() string {\n\treturn instance.id\n}", "title": "" }, { "docid": "95b5ba57aed75ea271f8b548ba421e29", "score": "0.6117616", "text": "func (s *RedisServer) ID() string {\n\treturn s.id\n}", "title": "" }, { "docid": "fc2255cf058f3c02b5786b467c15e926", "score": "0.6116564", "text": "func (o ReadWriteSplittingConnectionOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ReadWriteSplittingConnection) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b2ef27c3ed45c6e723f2cb732ac090cf", "score": "0.6107404", "text": "func (p *Ping) ID() int {\n\treturn PingID\n}", "title": "" }, { "docid": "cb54e7d9033a757f154aa9e84a9174ba", "score": "0.6091359", "text": "func (o Ipv6EgressRuleOutput) InstanceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Ipv6EgressRule) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8e332844ff701ed4230cdc21a7f99e9e", "score": "0.60897243", "text": "func (d *DefaultServiceInstance) GetID() string {\n\treturn d.ID\n}", "title": "" }, { "docid": "94ecd58d61fab4c359f1aef36c9facf3", "score": "0.6081869", "text": "func (s *Sandbox) ID() string {\n\treturn s.id\n}", "title": "" }, { "docid": "9045bcd8355172b3905c0747e03f376e", "score": "0.6080215", "text": "func (o SpotInstanceRequestLaunchTemplateOutput) Id() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SpotInstanceRequestLaunchTemplate) *string { return v.Id }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "26573baeb973e8a8e5afdeb613cfd84a", "score": "0.606778", "text": "func (rcv *InstanceStatsMessage) InstanceId() []byte {\n\to := flatbuffers.UOffsetT(rcv._tab.Offset(4))\n\tif o != 0 {\n\t\treturn rcv._tab.ByteVector(o + rcv._tab.Pos)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c52d1b80e2ec16155cf005989631f103", "score": "0.60623944", "text": "func (r *Key) ID() pulumi.IDOutput {\n\treturn r.s.ID()\n}", "title": "" }, { "docid": "9894035f3abf86fb95cf1c65650e7aad", "score": "0.60623294", "text": "func (alien Alien) ID() int {\n\treturn alien.id\n}", "title": "" }, { "docid": "72e16ffe340dc8c219f32beb5b71b2b9", "score": "0.60502803", "text": "func (o RouteTableRouteOutput) InstanceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RouteTableRoute) *string { return v.InstanceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "928ef7c67e747d071f2852646fcfa50b", "score": "0.6050033", "text": "func (o SpotInstanceRequestLaunchTemplatePtrOutput) Id() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SpotInstanceRequestLaunchTemplate) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Id\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "187fb5c72e12899121741a3e39eda418", "score": "0.60386616", "text": "func (i Instance) Key() string {\n\treturn i.key\n}", "title": "" }, { "docid": "c7eba08e96396e3c6a9a923c26898a6f", "score": "0.60351604", "text": "func (c *Client) ID() (api.ID, error) {\n\tvar id api.IDSerial\n\terr := c.do(\"GET\", \"/id\", nil, &id)\n\treturn id.ToID(), err\n}", "title": "" }, { "docid": "8fa7f669d6cdbee682d39af6ab17a52e", "score": "0.6032175", "text": "func (o DefaultRouteTableRouteOutput) InstanceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DefaultRouteTableRoute) *string { return v.InstanceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0783bd06dd73c6d3bd0eb6e203601f4e", "score": "0.60285264", "text": "func (usr *User) ID() int {\n\treturn usr.id\n}", "title": "" }, { "docid": "b073b5c5c48ad9bf416fed910b183c79", "score": "0.6026184", "text": "func (h Host) ID() peer.ID {\n\treturn h.host.ID()\n}", "title": "" }, { "docid": "8dbd716f1ac55363acbe498dc9629a23", "score": "0.60201013", "text": "func (tt *Meta) Id() string {\n return tt.meta_.Id\n}", "title": "" }, { "docid": "457a0bb4f28bf732de982d8b8955113f", "score": "0.6015394", "text": "func (r *UserPoolClient) ID() pulumi.IDOutput {\n\treturn r.s.ID()\n}", "title": "" }, { "docid": "51685b782a5122bfe2f43b392335f03f", "score": "0.601444", "text": "func (r *User) ID() pulumi.IDOutput {\n\treturn r.s.ID()\n}", "title": "" }, { "docid": "9c59cad91cb8ae2d01a7546e0cb0ffee", "score": "0.6004356", "text": "func (s *Cite) ID() string {\n\treturn s.id\n}", "title": "" }, { "docid": "72d91d784845de15ff3ef0e26e7406cf", "score": "0.5998143", "text": "func (a *AzureVolumes) InstanceID() string {\n\treturn a.instanceID\n}", "title": "" }, { "docid": "940c09e9c5c2bb9f7eefd3a3513e1d2b", "score": "0.5993286", "text": "func GetInstanceID(instanceName string) string {\n\n\tlastIndex := strings.LastIndex(instanceName, \"_\")\n\treturn instanceName[lastIndex+1 : len(instanceName)]\n}", "title": "" }, { "docid": "69bc19042433f15cdbd216947a5f59e6", "score": "0.59932095", "text": "func InstanceID(\n\tctx types.Context, config gofig.Config) (*types.InstanceID, error) {\n\n\tvar hostName string\n\tif config == nil {\n\t\thostName = config.GetString(s3fs.ConfigS3FSHostName)\n\t} else {\n\t\thostName, _ = os.Hostname()\n\t}\n\treturn &types.InstanceID{ID: hostName, Driver: s3fs.Name}, nil\n}", "title": "" }, { "docid": "e3c2d80014490252c0cfc2b199d300c1", "score": "0.59897864", "text": "func (obj *connection) ID() *uuid.UUID {\n\treturn obj.id\n}", "title": "" }, { "docid": "62b344e696e667a42170eb8cc0d87926", "score": "0.59836406", "text": "func (e *Event) ID() string {\r\n\treturn e.id\r\n}", "title": "" }, { "docid": "c08d979467f7a4bd33deea736afa1d2e", "score": "0.59720415", "text": "func (m *PingCheck) ID() int32 {\n\treturn m.idField\n}", "title": "" }, { "docid": "d9eb9ad39e589201f800eac0741d14a7", "score": "0.59668803", "text": "func (self elevator) ID() int8 {\n\treturn self.id\n}", "title": "" }, { "docid": "9324024bbe59dcbebbb9725e2897e56e", "score": "0.59548956", "text": "func (o GetDdosCooInstancesResultOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetDdosCooInstancesResult) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e7abf0a62f1e4dcf2116713791bb1a7b", "score": "0.5952395", "text": "func (m *EmbeddedEtcdMember) ID() uint64 {\n\treturn m.id\n}", "title": "" }, { "docid": "8f62d663d7b33e4a2496c98d40e2bfba", "score": "0.59438056", "text": "func (l *Lease) ID() int {\n\treturn l.id\n}", "title": "" }, { "docid": "c4b2f02db425541523eef35a699abc17", "score": "0.5940374", "text": "func (rt *Runtime) ID() signature.PublicKey {\n\treturn rt.id\n}", "title": "" }, { "docid": "dd77ecf3757110b3d7823d44517afedb", "score": "0.5939125", "text": "func (c *Connection) ID() int {\n\treturn c.id\n}", "title": "" }, { "docid": "0fc839c3a356990310e004673f4df7cb", "score": "0.5926482", "text": "func (k *key) ID() string {\n\treturn k.id\n}", "title": "" } ]
0574c67b70468c3810d60ea884ab07dd
GetByID create an http request to get an existing access token by user ID
[ { "docid": "af6cbcf760d06ea06ef80e18ad236935", "score": "0.7292225", "text": "func (handler *accessTokenHandler) GetByID(c *gin.Context) {\n\taccessTokenID := strings.TrimSpace(c.Param(\"access_token_id\"))\n\n\taccessToken, err := handler.service.GetByID(accessTokenID)\n\tif err != nil {\n\t\tc.JSON(err.Status, err)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, accessToken)\n}", "title": "" } ]
[ { "docid": "53ae72a05c009f50b918c5027df493a9", "score": "0.7556553", "text": "func (h *handler) GetByID(c *gin.Context) {\n\taccessToken, err := h.service.GetByID(c.Param(\"access_token_id\"))\n\tif err != nil {\n\t\tc.JSON(err.Status, err)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, accessToken)\n}", "title": "" }, { "docid": "ea4e50cc7f57b7ed1695a2e8c65ee750", "score": "0.69149435", "text": "func (c *Client) Get(ctx context.Context, id uuid.UUID) (*TokenResponse, error) { // nolint:interfacer\n\treq, err := c.Client.NewRequest(ctx, http.MethodGet, basePath, id.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tt := &TokenResponse{}\n\terr = c.Client.Do(req, &t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn t, nil\n}", "title": "" }, { "docid": "10d13a004199b62f4aa0330adda10715", "score": "0.6718567", "text": "func (h *TokenHandler) Get(w http.ResponseWriter, r *http.Request, id int) {\n\ttoken, err := h.interactor.Get(id)\n\tif err != nil {\n\t\tError(w, http.StatusNotFound, err, \"failed to get token\")\n\t\treturn\n\t}\n\tJSON(w, http.StatusOK, token)\n}", "title": "" }, { "docid": "8beff6a61de8790269f9cd71ba5287c8", "score": "0.66684574", "text": "func (service *AccessTokensService) Get(accessTokenID string) (*AccessToken, error) {\n\tpath := fmt.Sprintf(\"/users/me/access_tokens/%s\", accessTokenID)\n\tquery := url.Values{}\n\tmethod := \"GET\"\n\n\treq, err := service.c.newRequest(method, path, query, nil)\n\tif err != nil {\n\t\treturn &AccessToken{}, err\n\t}\n\n\tvar accessToken AccessToken\n\treq.Header.Set(\"X-Contentful-Version\", strconv.Itoa(accessToken.GetVersion()))\n\tif ok := service.c.do(req, &accessToken); ok != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &accessToken, err\n}", "title": "" }, { "docid": "d5347758ac9e02ea8a066b2cef516a51", "score": "0.6553854", "text": "func (s *Controller) handleGetByID(c *gin.Context) {\n\taccessToken, err := s.accessTokenService.GetByID(c.Param(\"access_token_id\"))\n\tif err != nil {\n\t\tc.JSON(err.StatusCode(), err)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, accessToken)\n}", "title": "" }, { "docid": "6521db5e6546b42037595c8379a2294c", "score": "0.6505961", "text": "func (a *Client) GetUserByIDUsingGET(params *GetUserByIDUsingGETParams, authInfo runtime.ClientAuthInfoWriter) (*GetUserByIDUsingGETOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetUserByIDUsingGETParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getUserByIdUsingGET\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/lcm/authzn/api/users/{vmid}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetUserByIDUsingGETReader{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.(*GetUserByIDUsingGETOK)\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 getUserByIdUsingGET: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "a7ecce57d3ca0142a159294ef934ad05", "score": "0.6304557", "text": "func GetToken(w http.ResponseWriter, req *http.Request) {\n\tfmt.Println(\"Asked for token!\")\n\t// First we should parse to see if they are within\n\t// the bounds of the geofence or even gave us a lat\n\t// and long\n\tvar tr TokenRequest\n\tjson.NewDecoder(req.Body).Decode(&tr)\n\n\tif tr.UserID == \"\" {\n\t\tjson.NewEncoder(w).Encode(Response{\"No user id given\", \"invalid_id\"})\n\t\treturn\n\t}\n\n\trows, err := db.Query(\"SELECT admin, userid from users where userid = ?\", tr.UserID)\n\n\tif err != nil {\n\t\t// Internal server error\n\t\tjson.NewEncoder(w).Encode(Response{\"Internal server error\", \"server_error\"})\n\t\treturn\n\t}\n\n\tvar truefalse int\n\tvar uid string\n\ttruefalse = -1\n\t// Grab the value we want\n\tfor rows.Next() {\n\t\trows.Scan(&truefalse, &uid)\n\t}\n\n\tif truefalse == -1 {\n\t\tjson.NewEncoder(w).Encode(Response{\"No user id given\", \"invalid_id\"})\n\t\treturn\n\t}\n\n\t// Declare the token we will be giving them\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\n\tclaims := token.Claims.(jwt.MapClaims)\n\n\tif truefalse == 1 {\n\t\t// It's brian or dom let him do whatever\n\t\tclaims[\"admin\"] = true\n\t} else if truefalse == 0 {\n\t\t// Regular user so just make sure they are not an admin\n\t\tclaims[\"admin\"] = false\n\t} else {\n\t\tjson.NewEncoder(w).Encode(Response{\"No user id given\", \"invalid_id\"})\n\t\treturn\n\t}\n\n\t// Set their userid\n\tclaims[\"userid\"] = uid\n\t// Make sure the token experies in a reasonable amount of time\n\tclaims[\"exp\"] = time.Now().Add(time.Hour * 24).Unix()\n\n\ttokenString, _ := token.SignedString(signingKey)\n\n\t// Create our authorization cookie with the new token\n\tcookie := http.Cookie{\n\t\tName: \"Authorization\",\n\t\tValue: tokenString,\n\t\tExpires: time.Now().AddDate(0, 0, 1),\n\t\tHttpOnly: true,\n\t\tPath: \"/\",\n\t}\n\n\thttp.SetCookie(w, &cookie)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(Response{tokenString, \"auth_successful\"})\n}", "title": "" }, { "docid": "86decd24cf128b18ed28f348b01928b7", "score": "0.62857676", "text": "func makeGetRequest(serviceURL string) (*http.Response, error) {\n\t// query the id_token with ?audience as the serviceURL\n\ttokenURL := fmt.Sprintf(\"/instance/service-accounts/default/identity?audience=%s\", serviceURL)\n\tidToken, err := metadata.Get(tokenURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"metadata.Get: failed to query id_token: %+v\", err)\n\t}\n\tfmt.Printf(\"idToken:%s\\n\", idToken)\n\n\treq, err := http.NewRequest(\"GET\", serviceURL, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"Bearer %s\", idToken))\n\treturn http.DefaultClient.Do(req)\n}", "title": "" }, { "docid": "b4a411aded829c15e3c50b4c7dcfd83a", "score": "0.6276898", "text": "func (c *TokenClient) Get(ctx context.Context, id uuid.UUID) (*Token, error) {\n\treturn c.Query().Where(token.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "8b084702107c84e7573514fa4e23d71e", "score": "0.620304", "text": "func (service *InternalTokenServiceImpl) GetByID(ctx context.Context, id string) (*InternalToken, error) {\n\tvar token *InternalToken\n\n\t// Attempt to get the token from redis.\n\tresult, err := service.library.Redis.Client.Get(fmt.Sprintf(\"ikuta:access:token:%s\", id)).Result()\n\tif err != nil {\n\t\t// Check if the error is telling us the value doesn't exist.\n\t\tif err.Error() == \"redis: nil\" {\n\t\t\t// Pull data from mongo.\n\t\t\terr := service.library.Mongo.InternalToken.Find(bson.M{\"_id\": bson.ObjectIdHex(id)}).One(&token)\n\t\t\tif err != nil {\n\t\t\t\tif strings.Contains(err.Error(), \"not found\") {\n\t\t\t\t\treturn nil, nil\n\t\t\t\t}\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tgo func() {\n\t\t\t\t// Convert the token to a JSON string.\n\t\t\t\tdata, err := json.Marshal(token)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Errorw(\"[Redis] (token.go) Failed to json#Marshal object.\", logger.Err(err))\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Insert the token into Redis.\n\t\t\t\terr = service.library.Redis.Client.Set(fmt.Sprintf(\"ikuta:access:token:%s\", token.ID), data, 10*time.Minute).Err()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Errorw(\"[Redis] (token.go) Failed to insert object.\", logger.Err(err))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\t// Return the token from MongoDB.\n\t\t\treturn token, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tif len(result) < 1 {\n\t\treturn nil, errors.New(\"empty result returned from cache\")\n\t}\n\n\terr = json.Unmarshal([]byte(result), token)\n\treturn token, err\n}", "title": "" }, { "docid": "4dd6475e7737866d7bb2f0578efbd1d9", "score": "0.61911535", "text": "func httpGet(uri string, accessToken string, idToken string) (status int, body []byte, err error) {\n\tclient := &http.Client{}\n\tvar request *http.Request\n\t\n\tif request, err = http.NewRequest(\"GET\", uri, nil); err == nil {\n\t\trequest.Header.Add(\"Accept\", \"application/json\")\n\t\trequest.Header.Add(\"Authorization\", \"Bearer \" + accessToken)\n\t\trequest.Header.Add(\"IDToken\", idToken)\n\t} else {\n\t\treturn\n\t}\n\n\tvar response *http.Response\n\tif response, err = client.Do(request); err == nil {\n\t\tdefer response.Body.Close()\n\t} else {\n\t\treturn\n\t}\n\n\tbody, err = ioutil.ReadAll(response.Body)\n\tstatus = response.StatusCode\n\treturn\n}", "title": "" }, { "docid": "e09a417c312b6b25095ed1f3eb6507b9", "score": "0.617585", "text": "func (infra RestInfra) GetByID(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tuser, _ := infra.usecase.GetByID(1)\n\tjson.NewEncoder(w).Encode(user)\n}", "title": "" }, { "docid": "ffde6878ef1e3f2a7edf2ecfbe945443", "score": "0.6159699", "text": "func (c *TokenClient) Get(id string) (*Token, error) {\n\ttoken := &Token{}\n\terr := c.api.Call(\"GET\", \"/tokens/\"+id, c.token, nil, token)\n\n\treturn token, err\n}", "title": "" }, { "docid": "2bfb5e6b7625ec25ad1f22999f1763d1", "score": "0.61590874", "text": "func (u *HTTPUserHandler) GetByID(w http.ResponseWriter, r *http.Request) {\n\n\tparams := mux.Vars(r) // Get all params\n\tid, _ := strconv.ParseInt(params[\"id\"], 10, 64)\n\tuser, err := u.UserUsecase.GetByID(id)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t} else {\n\t\tuser.Password = \"\"\n\t\tuser.Email = \"\"\n\t\tjson.NewEncoder(w).Encode(user)\n\t}\n}", "title": "" }, { "docid": "1cb77247d504e9a3ee56162ed3ff7602", "score": "0.6077325", "text": "func GetUserWithID(c *gin.Context) {\n\tid := c.Param(\"id\")\n\n\t// if v1/user/self is called, skip this function and move to auth middleware\n\tif id == \"self\" {\n\t\tc.Next()\n\t\treturn\n\t}\n\n\t// prevent calling other handlers AuthMW and GetUserSelf\n\tc.Abort()\n\n\tlog.Info(\"/user/:id GET User with ID API\")\n\n\tuser := queryByID(id)\n\n\tif user == nil {\n\t\tlog.Error(\"/user/:id GET User with ID API error: ID does not exisit\")\n\t\tc.JSON(http.StatusNotFound, \"User with id: \"+id+\" does not exist\")\n\t\treturn\n\t}\n\tlog.Info(\"/user/:id GET User with ID API succeeded\")\n\tc.JSON(http.StatusOK, *user)\n}", "title": "" }, { "docid": "280bc94e11e6102b5dd7a165a388f905", "score": "0.60404575", "text": "func (client *gocloak) GetUserByID(accessToken string, realm string, userID string) (*User, error) {\n\tif userID == \"\" {\n\t\treturn nil, errors.New(\"userID shall not be empty\")\n\t}\n\n\tvar result User\n\tresp, err := client.getRequestWithBearerAuth(accessToken).\n\t\tSetResult(&result).\n\t\tGet(client.getAdminRealmURL(realm, \"users\", userID))\n\n\tif err := checkForError(resp, err); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &result, nil\n}", "title": "" }, { "docid": "aa34956bcd6f7eaf453f8ebb8410d0a1", "score": "0.6019549", "text": "func GetUserID(r *http.Request) (string, error) {\n\n\thmacSecretString := os.Getenv(\"SECRET_HRMS_KEY\") // \"SECRET_HRMS_KEY\" // Value\n\thmacSecret := []byte(hmacSecretString)\n\tfmt.Println(strings.Split(r.Header[\"Authorization\"][0], \" \"))\n\n\ttoken, err := jwt.Parse(strings.Split(r.Header[\"Authorization\"][0], \" \")[1], func(token *jwt.Token) (interface{}, error) {\n\t\t// check token signing method etc\n\t\treturn hmacSecret, nil\n\t})\n\n\tfmt.Println(\"Token :: \", token)\n\tif err != nil {\n\t\tfmt.Println(\"Error while get data from JWT token\")\n\t\treturn \"\", err\n\t}\n\n\tif claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {\n\t\tfmt.Println(claims, claims[\"id\"])\n\t\tfor key, val := range claims {\n\t\t\tfmt.Printf(\"Key: %v, value: %v\\n\", key, val)\n\t\t}\n\t\treturn fmt.Sprint(claims[\"id\"].(float64)), nil\n\t}\n\tlog.Printf(\"Invalid JWT Token\")\n\treturn \"\", errors.New(\"Invalid JWT Token\")\n}", "title": "" }, { "docid": "c24185e57686f16f8a61bae936fcf1b7", "score": "0.5972507", "text": "func getToken(id int64) string {\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\tclaims := token.Claims.(jwt.MapClaims)\n\tclaims[\"id\"] = id\n\tclaims[\"exp\"] = time.Now().Add(time.Hour * 24).Unix()\n\ttokenString, _ := token.SignedString(mySigningKey)\n\treturn tokenString\n}", "title": "" }, { "docid": "9b776bc00b9bf5e0bf844860bf1d7802", "score": "0.59169024", "text": "func (h Handler) Get(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvars := mux.Vars(r)\n\n\tid, err := strconv.ParseUint(vars[\"id\"], 10, 64)\n\tif err != nil {\n\t\trespWriter(w, false, err.Error(), database.User{})\n\t\treturn\n\t}\n\tuser, err := h.Storage.Get(id)\n\tif err != nil {\n\t\trespWriter(w, false, err.Error(), database.User{})\n\t\treturn\n\t}\n\n\trespWriter(w, true, \"Obtaind succesfully\", user)\n}", "title": "" }, { "docid": "c7476c88edafe0f3fddfce9f792e73b8", "score": "0.5908488", "text": "func getToken(userid int64) string {\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"uid\": userid,\n\t\t\"iat\": time.Now().Unix(),\n\t\t\"exp\": time.Now().Add(time.Second * 3600 * 24).Unix(),\n\t})\n\tjwtToken, err := token.SignedString(secretKey)\n\tif err != nil {\n\n\t}\n\treturn jwtToken\n}", "title": "" }, { "docid": "baf77f882342978c73750745e48e3315", "score": "0.59008163", "text": "func (s *tokenService) Get(u *User) (string, error) {\n\t// Create token\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\n\t// Try to log in the user\n\tuser, err := s.UserService.Read(u.ID)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"Failed to retrieve user\")\n\t}\n\tif user == nil {\n\t\treturn \"\", errors.New(\"Failed to retrieve user\")\n\t}\n\n\t// Set token claims\n\ttoken.Claims[\"admin\"] = true\n\ttoken.Claims[\"user\"] = u\n\ttoken.Claims[\"exp\"] = time.Now().Add(time.Hour * 24).Unix()\n\n\t// Sign token with key\n\ttokenString, err := token.SignedString(mySigningKey)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"Failed to sign token\")\n\t}\n\n\treturn tokenString, nil\n}", "title": "" }, { "docid": "c978ff79c6560037e9b252e2961ee2fd", "score": "0.58831525", "text": "func (userH *UserHTTPhandler) GetuserByID(c echo.Context) error {\n\n\tdata, err := userH.UserRepo.GetuserByID(2)\n\tif err != nil {\n\t\treturn c.String(http.StatusInternalServerError, err.Error())\n\t}\n\treturn c.JSON(http.StatusOK, data)\n}", "title": "" }, { "docid": "923d31ed4af51ab85d87de2c8530cd61", "score": "0.58612907", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n w.Header().Set(\"Context-Type\", \"application/x-www-form-urlencoded\")\n w.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n // get the userid from the request params, key is \"id\"\n params := mux.Vars(r)\n\n // // convert the id type from string to int\n id := params[\"id\"]\n\n // call the getUser function with user id to retrieve a single user\n user, err := getUser(id)\n\n if err != nil {\n log.Fatalf(\"Unable to get user. %v\", err)\n }\n\n // send the response\n json.NewEncoder(w).Encode(user)\n}", "title": "" }, { "docid": "59e1060315af551118ce5b28490c5742", "score": "0.5834932", "text": "func (s *server) get(c *gin.Context) {\n\tu, err := s.getUser(c.Param(\"id\"))\n\tif err != nil {\n\t\ts.withError(c, err)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, object.NewGet(*u))\n}", "title": "" }, { "docid": "68458f8f8c6be095f158cd3c808b9dab", "score": "0.58299494", "text": "func GetToken(w http.ResponseWriter, r *http.Request, user *model.User) {\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\tclaims := token.Claims.(jwt.MapClaims)\n\tvar mySigningKey = middleware.GetSecretKey()\n\tclaims[\"admin\"] = true\n\tclaims[\"user\"] = user.Email\n\tclaims[\"exp\"] = time.Now().Add(time.Hour * 24).Unix()\n\ttokenString, _ := token.SignedString(mySigningKey)\n\tlog.Printf(\"[GetToken] %v\", tokenString)\n\tutils.Jsonify(w, r, map[string]string{\"token\": tokenString}, http.StatusOK)\n}", "title": "" }, { "docid": "78827c080a0b3f31dd0535b71354b6ec", "score": "0.5826369", "text": "func (a *Auth) GetAccessToken() (string, error) {\n\tapiTokenLock.Lock()\n\tdefer apiTokenLock.Unlock()\n\tif !a.needNewToken() {\n\t\treturn a.request, nil\n\t}\n\ta.clearToken()\n\tlog.Println(\"GetAccessToken Request new token\")\n\n\treq, err := http.NewRequest(\"POST\", tokenURL, nil)\n\tif err != nil {\n\t\tlog.Fatalln(\"GetToken can't create new request\", err)\n\t}\n\treq.SetBasicAuth(a.keys.id, a.keys.secret)\n\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tlog.Println(\"GetToken request failed!!!\", err)\n\t\treturn \"\", errors.New(\"unable to request token\")\n\t}\n\n\tdefer res.Body.Close()\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlog.Println(\"GetToken unable to read response body\", err)\n\t\treturn \"\", errors.New(\"can't open GetToken response\")\n\t}\n\n\tvar token tokenResp\n\terr = json.Unmarshal(body, &token)\n\tif err != nil {\n\t\tlog.Println(\"GetToken response is not a TokenResp\", err)\n\t\treturn \"\", errors.New(\"update the code! response wrong format:\" + string(body))\n\t}\n\n\ta.request = token.AccessToken\n\tlog.Println(\"GetToken new token:\", a.request)\n\n\t// now check when the token expires\n\tcheckURI := fmt.Sprintf(checkTokenURL, a.request)\n\n\tresp, err := http.Get(checkURI)\n\n\tif err != nil {\n\t\tlog.Println(\"GetToken check token req failed:\", checkURI, err)\n\t\treturn a.request, errors.New(\"token expiration time not obtained\")\n\t}\n\n\tdefer resp.Body.Close()\n\tbody, err = ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\tlog.Println(\"GetAuctionRespFile bad resp:\", checkURI, string(body), err)\n\t\treturn a.request, errors.New(\"check token bad response\")\n\t}\n\tvar status tokenStatus\n\terr = json.Unmarshal(body, &status)\n\tif err != nil {\n\t\tlog.Println(\"Unsupported Auth Status\", string(body))\n\t\treturn a.request, errors.New(\"update the code Auth Status resp body unknown\")\n\t}\n\n\ta.expiration = status.Expiration\n\texpiryTime := time.Unix(a.expiration, 0)\n\tlog.Println(\"GetToken token expires at \", expiryTime, \"(\", a.expiration, \")\")\n\treturn a.request, nil\n}", "title": "" }, { "docid": "9253cdfba7f4f7e990df26aaa7b4d7b4", "score": "0.5804938", "text": "func (u *UsersHandler) GetByID(c *gin.Context) {\n\tid := c.Param(\"id\")\n\n\tctx := c.Request.Context()\n\n\tuser, err := u.userUsecase.GetByIDUC(ctx, id)\n\tif err != nil {\n\t\tc.JSON(status.GetStatusCode(err), status.ResponseError{Message: err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, user)\n}", "title": "" }, { "docid": "8b2393c12e3ef6adae4b8d224a709abb", "score": "0.57598555", "text": "func GetJWT(userID string) (*authEndpoint.GetJWTResponse, error) {\n\turl := \"http://auths:8084/get-jwt\"\n\tspaceClient := http1.Client{\n\t\tTimeout: time.Second * 20, // Timeout after 2 seconds\n\t}\n\tjsonData := map[string]string{\"user_id\": userID}\n\ts, _ := json.Marshal(jsonData)\n\treq, err := http1.NewRequest(http1.MethodPost, url, bytes.NewReader(s))\n\tif err != nil {\n\t\tfmt.Println(\"CALAMAR1\")\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Access-Control-Allow-Origin\", \"*\")\n\n\tres, getErr := spaceClient.Do(req)\n\tif getErr != nil {\n\t\tfmt.Println(\"CALAMAR2\")\n\t\treturn nil, getErr\n\t}\n\tbody, readErr := ioutil.ReadAll(res.Body)\n\tif readErr != nil {\n\t\tfmt.Println(\"CALAMAR3\")\n\t\treturn nil, readErr\n\t}\n\tmyAccountResponse := authEndpoint.GetJWTResponse{}\n\tjsonErr := json.Unmarshal(body, &myAccountResponse)\n\tif jsonErr != nil {\n\t\tfmt.Println(\"CALAMAR4\")\n\t\treturn nil, jsonErr\n\t}\n\n\tfmt.Println(\"AccessToken = \", myAccountResponse.Token.AccessToken)\n\treturn &myAccountResponse, nil\n}", "title": "" }, { "docid": "04a30bd22d28a06cfbeafc1edb7411ab", "score": "0.575644", "text": "func GetToken(w http.ResponseWriter, r *http.Request){\n\tif msg, flag := BasicAuth(r); !flag{\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tw.Write([]byte(msg))\n\t\treturn\n\t}\n\tparams := mux.Vars(r)\n\tmySigningKey := []byte(\"secretkey\")\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\tclaims := token.Claims.(jwt.MapClaims)\n\n\tuser, _, _ := GetUserPass(r)\n\n\tclaims[\"admin\"] = true\n\tclaims[\"user\"] = user\n\tx, _ := strconv.ParseInt(params[\"exp\"],10,8)\n\tclaims[\"exp\"] = time.Now().Add(time.Minute * time.Duration(x)).Unix()\n\ttoken.Claims = claims\n\ttokenString, _ := token.SignedString(mySigningKey)\n\tw.Write([]byte(tokenString+\"\\n\"))\n}", "title": "" }, { "docid": "9f5aa7a3744d349bb9f26f2792c9cc3e", "score": "0.57441944", "text": "func getID2 (handle string ) (string, error){ //this is the getHandle method for Twitter API 2.0\r\n\t base_url := \"https://api.twitter.com/2/users/by/username/\" + handle\r\n\t access_token, err := getBearer()\r\n\t if err != nil{\r\n\t\t return \"\", r\r\n\t }\r\n\t oauth2_string := \"Bearer \" + access_token\r\n\t method := \"GET\"\r\n\t req, _ := http.NewRequest(method, base_url, nil)\r\n\t req.Header.Add(\"Authorization\",oauth2_string)\r\n\t resp, err := http.DefaultClient.Do(req)\r\n\t if err != nil{\r\n\t\t return \"\", r\r\n\t }\r\n\t body_resp, _ := ioutil.ReadAll(resp.Body)\r\n\t\tvar json_data interface{}\r\n\t\terr = json.Unmarshal(body_resp, &json_data)\r\n\t//\tfmt.Printf(\"%s\", body_resp)\r\n\t\t//id, ok := json_data.(map[string]interface{})[\"data\"].(map[string]interface{})[\"id\"].(string)\r\n\r\n\t return parseGetID2(json_data)\r\n}", "title": "" }, { "docid": "d3f5935ba291c04992c2116f80200fe6", "score": "0.57380885", "text": "func (c *UtilController) GetOne() {\n\tt := c.Ctx.Input.Param(\":t\")\n\tvar resp utils.SimpleResponse\n\tv := services.QueryIdentity(t, false)\n\tif v != nil {\n\t\tresp.Success = true\n\t\tmarks := services.QueryMarks(v.Identity)\n\t\tresp.Message = marks\n\t} else {\n\t\tresp.Success = false\n\t\tresp.Message = utils.Msg.TokenErr\n\t}\n\tc.Data[\"json\"] = resp\n\tc.ServeJSON()\n}", "title": "" }, { "docid": "e85ee3775c6317a30624cfd245503940", "score": "0.5720851", "text": "func GetUserByID(c *gin.Context) {\n\tid := c.Params.ByName(\"id\")\n\tvar user Models.User\n\terr := Models.GetUserByID(&user, id)\n\tif err != nil {\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t} else {\n\t\tc.JSON(http.StatusOK, user)\n\t}\n}", "title": "" }, { "docid": "2fc40c6d7d78856a588134f22e29da63", "score": "0.5716475", "text": "func getUser(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tuserID := params.ByName(\"id\")\n\tif _, err := strconv.Atoi(userID); err != nil {\n\t\tapiError := appError.NotFound(\"Invalid ID \" + userID)\n\t\tappError.WriteErrorResponse(w, apiError)\n\t\treturn\n\t}\n\n\tif userInfo, ok := models.UserStore[userID]; ok {\n\t\tresp := response.GenericResponse(http.StatusFound, \"User found successfully\", userInfo)\n\t\tresponse.WriteResponse(w, resp)\n\t\treturn\n\t}\n\n\tapiError := appError.NotFound(\"Invalid ID \" + userID)\n\tappError.WriteErrorResponse(w, apiError)\n}", "title": "" }, { "docid": "aebc7cde0631c25b355aba5fe16f9ef9", "score": "0.57159895", "text": "func (r *TokensService) Get(userKey string, clientId string) *TokensGetCall {\n\tc := &TokensGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.userKey = userKey\n\tc.clientId = clientId\n\treturn c\n}", "title": "" }, { "docid": "f7b6603043b676f67ba7b916aeed8286", "score": "0.5715647", "text": "func (a *AdminApiService) GetIdentity(ctx context.Context, id string) ApiGetIdentityRequest {\n\treturn ApiGetIdentityRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "405d6f9768aa42b938e1388f7d5ed8c0", "score": "0.57065743", "text": "func (m *MongoDBTokenRepository) GetForClientAndUser(clientID, userID string) (*oauth2.AuthToken, error) {\n\ttoken := oauth2.AuthToken{}\n\terr := m.collection.Find(bson.M{\n\t\t\"clientId\": clientID,\n\t\t\"userId\": userID,\n\t}).One(&token)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &token, nil\n}", "title": "" }, { "docid": "455fdb2f038667b04aa19456d39afbaf", "score": "0.57061607", "text": "func Get(c *gin.Context) {\n\n\t//Get the id from the GET request\n\tuserID, idErr := getUserID(c.Param(\"user_id\"))\n\tif idErr != nil {\n\t\tc.JSON(idErr.Status, idErr)\n\t\treturn\n\t}\n\n\tresult, getErr := services.UsersService.GetUser(userID)\n\tif getErr != nil {\n\t\tc.JSON(getErr.Status, getErr)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, result.Marshall(c.GetHeader(\"X-Public\") == \"true\"))\n}", "title": "" }, { "docid": "1c9bdf8d58878a24a80cf718f993440e", "score": "0.5705228", "text": "func getAccessToken(appid string, secret string) {\n token, err := models.GetAccessToken(appid, secret)\n if err != nil {\n revel.ERROR.Println(err.Error())\n return\n }\n if token.ErrorCode != 0 {\n revel.ERROR.Println(fmt.Sprintf(\"Error Code: %s\", strconv.Itoa(token.ErrorCode)))\n }\n models.Set(token)\n}", "title": "" }, { "docid": "550b6a1f5efbdfc002c2e9a3d193ac08", "score": "0.57022595", "text": "func GetUserByID(c *gin.Context) {\n\tid := c.Params.ByName(\"id\")\n\tuser := &models.User{}\n\tlist, err := user.GetUserByID(id)\n\tif err != nil {\n\t\tresponse.JSON(c, http.StatusNotFound, false, err.Error())\n\t} else {\n\t\tresponse.JSON(c, http.StatusOK, true, list)\n\t}\n}", "title": "" }, { "docid": "34e492c1e128da59bf73effa71eeacbe", "score": "0.56911784", "text": "func GetUserByID(c *gin.Context) {\n\tid := c.Params.ByName(\"id\")\n\tvar user models.User\n\terr := service.UserService().GetUserByID(&user, id)\n\tif err != nil {\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t} else {\n\t\tc.JSON(http.StatusOK, user)\n\t}\n}", "title": "" }, { "docid": "2453da320197294d673d01745ede45d2", "score": "0.56896096", "text": "func Get(iss string, sub string, secret string, nbf time.Time, exp time.Duration) string {\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"iss\": iss,\n\t\t\"sub\": sub,\n\t\t\"exp\": time.Now().Add(exp).Unix(),\n\t\t\"nbf\": nbf.Unix(),\n\t\t\"iat\": time.Now().Unix(),\n\t})\n\ttokenS, err := token.SignedString([]byte(secret))\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn tokenS\n}", "title": "" }, { "docid": "7a4f43978ff031e592bb081ce19239c8", "score": "0.5687018", "text": "func GetOpenIDUserInfo(\n\thttpReq *http.Request,\n\tuserAPI userapi.FederationUserAPI,\n) util.JSONResponse {\n\ttoken := httpReq.URL.Query().Get(\"access_token\")\n\tif len(token) == 0 {\n\t\treturn util.JSONResponse{\n\t\t\tCode: http.StatusUnauthorized,\n\t\t\tJSON: spec.MissingParam(\"access_token is missing\"),\n\t\t}\n\t}\n\n\treq := userapi.QueryOpenIDTokenRequest{\n\t\tToken: token,\n\t}\n\n\tvar openIDTokenAttrResponse userapi.QueryOpenIDTokenResponse\n\terr := userAPI.QueryOpenIDToken(httpReq.Context(), &req, &openIDTokenAttrResponse)\n\tif err != nil {\n\t\tutil.GetLogger(httpReq.Context()).WithError(err).Error(\"userAPI.QueryOpenIDToken failed\")\n\t}\n\n\tvar res interface{} = openIDUserInfoResponse{Sub: openIDTokenAttrResponse.Sub}\n\tcode := http.StatusOK\n\tnowMS := time.Now().UnixNano() / int64(time.Millisecond)\n\tif openIDTokenAttrResponse.Sub == \"\" || nowMS > openIDTokenAttrResponse.ExpiresAtMS {\n\t\tcode = http.StatusUnauthorized\n\t\tres = spec.UnknownToken(\"Access Token unknown or expired\")\n\t}\n\n\treturn util.JSONResponse{\n\t\tCode: code,\n\t\tJSON: res,\n\t}\n}", "title": "" }, { "docid": "9168dfc737ea22d6a17063924a088706", "score": "0.56868285", "text": "func (a *UsersApiService) UsersIdGet(ctx _context.Context, id string) (User, *_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 User\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/users/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.QueryEscape(parameterToString(id, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn 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 User\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\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": "7bff139a578dd1de7e4f5b02280b1eb0", "score": "0.5686458", "text": "func Get(client *gophercloud.ServiceClient, userID string, id string) (r GetResult) {\n\tresp, err := client.Get(getURL(client, userID, id), &r.Body, nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "title": "" }, { "docid": "28c04c92e2fcd5499a4bfff367d46fb3", "score": "0.56798387", "text": "func GetUserByID(userID string) (*model.Response, error) {\n\turl := helpers.BuildURL(connectionString(), \"user\", userID)\n\treturn client.Get(url)\n}", "title": "" }, { "docid": "bb37a794ffe6efef91323f14fafb7210", "score": "0.5673216", "text": "func (client *Client) Get(\n\taccess vsec.AuthLevel,\n\turlArgs ...string) (rr *ResultReader) {\n\tvar req *http.Request\n\tvar resp *http.Response\n\tvar err error\n\tapiURL := client.CreateURL(access, urlArgs...)\n\treq, err = http.NewRequest(\"GET\", apiURL, nil)\n\tauthHeader := fmt.Sprintf(\"Bearer %s\", client.Token)\n\treq.Header.Add(\"Authorization\", authHeader)\n\tresp, err = client.Do(req)\n\tif err == nil {\n\t\trr = NewResultReader(resp)\n\t} else {\n\t\trr = &ResultReader{\n\t\t\tErr: err,\n\t\t}\n\t}\n\treturn rr\n}", "title": "" }, { "docid": "7b3c866fb73789d4e812ca9576f56853", "score": "0.56694686", "text": "func (a *API) getAccessToken(ctx context.Context) (string, error) {\n\tif ctx.Value(authContextKey) != nil {\n\t\treturn ctx.Value(authContextKey).(string), nil\n\t}\n\n\tif len(a.Config.Authorization) > 0 {\n\t\treturn a.Config.Authorization, nil\n\t}\n\n\tif len(a.AuthToken.AccessToken) > 0 && time.Now().Before(a.AuthToken.expiration) {\n\t\treturn fmt.Sprintf(\"%s %s\", a.AuthToken.Type, a.AuthToken.AccessToken), nil\n\t}\n\n\tv := url.Values{}\n\tv.Set(\"grant_type\", \"urn:ibm:params:oauth:grant-type:apikey\")\n\tv.Set(\"apikey\", a.Config.APIKey)\n\treqBody := []byte(v.Encode())\n\n\tu, err := url.Parse(a.Config.TokenURL)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\trequest := &http.Request{\n\t\tMethod: \"POST\",\n\t\tURL: u,\n\t\tHeader: http.Header{\n\t\t\t\"Content-Type\": {\"application/x-www-form-urlencoded\"},\n\t\t\t\"Accept\": {\"application/json\"},\n\t\t\t\"Content-Length\": {strconv.Itoa(len(reqBody))},\n\t\t},\n\t\tBody: ioutil.NopCloser(bytes.NewReader(reqBody)),\n\t}\n\tdefer request.Body.Close()\n\n\tc := make(chan error, 1)\n\tgo func() { c <- a.sendRequest(request.WithContext(ctx), reqBody, &a.AuthToken) }()\n\tselect {\n\tcase <-ctx.Done():\n\t\t<-c // Wait for sendRequest to return.\n\t\treturn \"\", ctx.Err()\n\tcase err := <-c:\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\t// Set the expiration time for 1 min less than the\n\t\t// actual time to prevent timeout errors\n\t\ta.AuthToken.expiration = time.Now().Add(time.Second * time.Duration(a.AuthToken.ExpiresInSeconds-60))\n\t\treturn fmt.Sprintf(\"%s %s\", a.AuthToken.Type, a.AuthToken.AccessToken), nil\n\t}\n}", "title": "" }, { "docid": "ad4937e8c00d7a3f19e50944a5bc2071", "score": "0.565131", "text": "func (a *Client) GetRequestByIDUsingGET(params *GetRequestByIDUsingGETParams, opts ...ClientOption) (*GetRequestByIDUsingGETOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetRequestByIDUsingGETParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"getRequestByIdUsingGET\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/content/api/marketplace/download-requests/{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: &GetRequestByIDUsingGETReader{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.(*GetRequestByIDUsingGETOK)\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 getRequestByIdUsingGET: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "a2ff56be276561b99cef836d1a9f3979", "score": "0.56472605", "text": "func Get(c *gin.Context) {\n\t// c.Param(\"user_id\") is to get the parameter value in url /users/:user_id\n\tuserID, idErr := getUserID(c.Param(\"user_id\"))\n\tif idErr != nil {\n\t\tc.JSON(idErr.Status, idErr)\n\t}\n\n\tuser, getErr := services.UsersService.GetUser(userID)\n\tif getErr != nil {\n\t\tc.JSON(getErr.Status, getErr)\n\t\treturn\n\t}\n\n\t// to see whether it's a public request or private, we can see from \"X-Public\" in request header\n\tc.JSON(http.StatusOK, user.Marshal(c.GetHeader(\"X-Public\") == \"true\"))\n}", "title": "" }, { "docid": "86e243e2f0178bcbb26c2cfbd4dd06c1", "score": "0.563629", "text": "func getUser(w http.ResponseWriter, r *http.Request) {\n InitResponse(&w)\n\n if r.Method == \"OPTIONS\" {return}\n\n allow, _ := HasPermission(&w, r, CoreUserModuleID, CoreAccessRead)\n if !allow {\n w.WriteHeader(http.StatusUnauthorized)\n json.NewEncoder(w).Encode(&CoreMessage{\n Message: \"You do not have access to this resource.\",\n })\n return\n }\n\n params := mux.Vars(r)\n idParam, _ := strconv.ParseUint(params[\"id\"], 10, 16)\n\n user := &CoreUser{ID: uint(idParam)}\n err := Db.Model(user).\n Column(\"core_user.*\").\n Relation(\"Group\").\n WherePK().\n Select()\n if err != nil {\n w.WriteHeader(http.StatusNotFound)\n return\n }\n\n w.WriteHeader(http.StatusOK)\n json.NewEncoder(w).Encode(user)\n}", "title": "" }, { "docid": "8959ab0ffa044bf14673cb89ab7aeb3b", "score": "0.5635954", "text": "func (a *Client) GetUserByProviderIdentifierUsingGET(params *GetUserByProviderIdentifierUsingGETParams, authInfo runtime.ClientAuthInfoWriter) (*GetUserByProviderIdentifierUsingGETOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetUserByProviderIdentifierUsingGETParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getUserByProviderIdentifierUsingGET\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/lcm/authzn/api/users/providerId/{providerId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetUserByProviderIdentifierUsingGETReader{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.(*GetUserByProviderIdentifierUsingGETOK)\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 getUserByProviderIdentifierUsingGET: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "7b64704368de4cd842156a1bc2e86e37", "score": "0.5633361", "text": "func Get_Access(b64Token string) {\n\n\t//Using http request method to POST API Token Request to Twitter API\n\treq, err := http.NewRequest(\"POST\", \"https://api.twitter.com/oauth2/token\", strings.NewReader(\"grant_type=client_credentials\"))\n\tif err != nil {\n\t\tfmt.Println(\"error\", err)\n\t\tos.Exit(-1)\n\t}\n\n\t//Setting up Authorization\n\treq.Header.Add(\"Authorization\", \"Basic \"+b64Token)\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded;charset=UTF-8\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Println(\"Do: \", err)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\t//Creating variable\n\n\tif err := json.NewDecoder(resp.Body).Decode(&App_Access_Token); err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "title": "" }, { "docid": "684adc0b69e3a5c4da355d2fdb08aa0b", "score": "0.56281567", "text": "func (catCntrl *UserController) GetUserByID(w http.ResponseWriter, req *http.Request) {\n\tresponseWriter := util.GetResponseWriter(w, req)\n\tdefer responseWriter.Close()\n\tvars := mux.Vars(req)\n\tidRaw := vars[\"id\"]\n\tid, err := strconv.Atoi(idRaw)\n\tif err == nil {\n\t\tuser, err1 := models.GetUserByID(id)\n\t\tif err1 == nil {\n\t\t\tdata, err2 := json.Marshal(user)\n\t\t\tif err2 == nil {\n\t\t\t\tresponseWriter.Header().Add(\"Content Type\", \"application/json\")\n\t\t\t\tresponseWriter.Write(data)\n\t\t\t} else {\n\t\t\t\tresponseWriter.WriteHeader(404)\n\t\t\t\tresponseWriter.Write([]byte(err2.Error()))\n\t\t\t}\n\t\t} else {\n\t\t\tresponseWriter.WriteHeader(404)\n\t\t\tresponseWriter.Write([]byte(err1.Error()))\n\t\t}\n\t} else {\n\t\tresponseWriter.WriteHeader(400)\n\t\tresponseWriter.Write([]byte(err.Error()))\n\t}\n}", "title": "" }, { "docid": "919f31595f4a08f0174d5ac1bf0242f6", "score": "0.56210077", "text": "func (c *IAP) GetToken() (token string, err error) {\n\tsa, err := ioutil.ReadFile(c.SA)\n\tif err != nil {\n\t\treturn\n\t}\n\tconf, err := google.JWTConfigFromJSON(sa)\n\tif err != nil {\n\t\treturn\n\t}\n\trsaKey, _ := readRsaPrivateKey(conf.PrivateKey)\n\tiat := time.Now()\n\texp := iat.Add(time.Hour)\n\tjwt := &jws.ClaimSet{\n\t\tIss: conf.Email,\n\t\tAud: TokenURI,\n\t\tIat: iat.Unix(),\n\t\tExp: exp.Unix(),\n\t\tPrivateClaims: map[string]interface{}{\n\t\t\t\"target_audience\": c.ID,\n\t\t},\n\t}\n\tjwsHeader := &jws.Header{\n\t\tAlgorithm: \"RS256\",\n\t\tTyp: \"JWT\",\n\t}\n\n\tmsg, err := jws.Encode(jwsHeader, jwt, rsaKey)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tv := url.Values{}\n\tv.Set(\"grant_type\", \"urn:ietf:params:oauth:grant-type:jwt-bearer\")\n\tv.Set(\"assertion\", msg)\n\n\tctx := context.Background()\n\thc := oauth2.NewClient(ctx, nil)\n\tresp, err := hc.PostForm(TokenURI, v)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n\tvar tokenRes struct {\n\t\tAccessToken string `json:\"access_token\"`\n\t\tTokenType string `json:\"token_type\"`\n\t\tIDToken string `json:\"id_token\"`\n\t\tExpiresIn int64 `json:\"expires_in\"`\n\t}\n\n\tif err := json.Unmarshal(body, &tokenRes); err != nil {\n\t\treturn token, err\n\t}\n\n\ttoken = tokenRes.IDToken\n\treturn\n}", "title": "" }, { "docid": "f1e30aaaf30270c2c935bda34e524686", "score": "0.56192183", "text": "func getClient(config *oauth2.Config) *http.Client {\n // The file token.json stores the user's access and refresh tokens, and is\n // created automatically when the authorization flow completes for the first\n // time.\n tokFile := \"/tokens/token.json\"\n tok, _ := tokenFromFile(tokFile)\n return config.Client(context.Background(), tok)\n}", "title": "" }, { "docid": "3f03b8aa59618967f26f8de03adb8390", "score": "0.56126845", "text": "func (g GrantsEndpoint) APIGet(mytoken string) (resp api.GrantTypeInfoResponse, err error) {\n\terr = g.DoHTTPRequestWithAuth(\"GET\", nil, &resp, mytoken)\n\treturn\n}", "title": "" }, { "docid": "61bed042e0817798ec1f1f76ef97366c", "score": "0.5610546", "text": "func GetUser(c echo.Context, db *gorm.DB) (models.User, error) {\n // get user from JWT\n jwtContext := c.Get(\"user\").(*jwt.Token)\n claims := jwtContext.Claims.(jwt.MapClaims)\n // get auth0 id from claims\n id := claims[\"sub\"].(string)\n user := models.User{}\n // find user in database\n if (db.Where(\"auth_id = ?\", id).First(&user).RecordNotFound()) {\n return user, errors.New(\"NOT FOUND\")\n } else {\n return user, nil\n }\n}", "title": "" }, { "docid": "7b9c0b3cb83cb777350633531f12010a", "score": "0.5607613", "text": "func (d *Dao) GetToken(c context.Context, bid string, ip string) (data *model.TokenResq, err error) {\n\tdata = new(model.TokenResq)\n\tval := url.Values{}\n\tval.Add(\"bid\", bid)\n\tif err = d.doRequest(c, d.c.Property.APICoURL, _token, ip, val, data, d.client.Get); err != nil {\n\t\terr = errors.WithStack(err)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "ec6e0bbefa5734a9731ee9e00fb353a6", "score": "0.5597646", "text": "func GetAccessToken(client *gophercloud.ServiceClient, userID string, id string) (r GetAccessTokenResult) {\n\tresp, err := client.Get(userAccessTokenURL(client, userID, id), &r.Body, nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "title": "" }, { "docid": "07c6f5436362bc7dc42bf9495e766dcc", "score": "0.55907875", "text": "func (a *JWTAccessGenerate) Token(data *oauth2.GenerateBasic, isGenRefresh bool) (access, refresh string, err error) {\n\tctx := context.Background()\n\n\tspanName := \"/token/create\"\n\tif isGenRefresh {\n\t\tspanName = \"/token/refresh\"\n\t}\n\tspan, ctx := opentracing.StartSpanFromContext(ctx, \"oauth - \"+spanName)\n\tdefer span.Finish()\n\n\tscope := data.Request.FormValue(\"scope\")\n\n\tfmt.Println(\"feching user\", data.UserID)\n\tuser, fetchErr := a.UserStore.GetUser(ctx, data.UserID)\n\terr = fetchErr\n\tif err != nil {\n\t\treturn\n\t}\n\n\tstandardScopes, nonstandardScopes := separateScopes(scope)\n\tif len(nonstandardScopes) > 0 {\n\t\tfmt.Println(\"validating nonstandard scopes\", nonstandardScopes, data.UserID)\n\t\tvalidatedScopes, err := validateScopeForUser(ctx, strings.Join(nonstandardScopes, \" \"), data.UserID)\n\t\tif err != nil {\n\t\t\treturn access, refresh, err\n\t\t}\n\t\tnonstandardScopes = strings.Split(validatedScopes, \" \")\n\t}\n\n\tscope = strings.Join(append(standardScopes, nonstandardScopes...), \" \")\n\n\tclaims := &JWTAccessClaims{\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\tAudience: data.Client.GetID(),\n\t\t\tSubject: data.UserID,\n\t\t\tExpiresAt: data.TokenInfo.GetAccessCreateAt().Add(data.TokenInfo.GetAccessExpiresIn()).Unix(),\n\t\t},\n\t\tScope: scope,\n\t\tUser: JWTUser{\n\t\t\tEmail: user.Email,\n\t\t},\n\t}\n\n\ttoken := jwt.NewWithClaims(a.SignedMethod, claims)\n\tsignedKey, kid, err := getRSAKey()\n\tif err != nil {\n\t\treturn\n\t}\n\n\ttoken.Header[\"kid\"] = kid\n\n\tvar key interface{}\n\tif a.isEs() {\n\t\tkey, err = jwt.ParseECPrivateKeyFromPEM(signedKey.D.Bytes())\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t} else if a.isRsOrPS() {\n\t\tkey = signedKey\n\t} else if a.isHs() {\n\t\tkey = signedKey\n\t} else {\n\t\treturn \"\", \"\", errs.New(\"unsupported sign method\")\n\t}\n\taccess, err = token.SignedString(key)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif isGenRefresh {\n\t\trefresh = base64.URLEncoding.EncodeToString(uuid.NewSHA1(uuid.Must(uuid.NewRandom()), []byte(access)).Bytes())\n\t\trefresh = strings.ToUpper(strings.TrimRight(refresh, \"=\"))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7a75177d727c66a49c5db5675590cc22", "score": "0.55841124", "text": "func (i *Identity) Get(endpoint, caname string, result interface{}) error {\n\treq, err := i.client.newGet(endpoint)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif caname != \"\" {\n\t\taddQueryParm(req, \"ca\", caname)\n\t}\n\terr = i.addTokenAuthHdr(req, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn i.client.SendReq(req, result)\n}", "title": "" }, { "docid": "960aa36a8ef7326b383083139d3b2dd0", "score": "0.5573015", "text": "func GetToken(userID string) (string, *StatusError) {\n\tclaims := jwt.StandardClaims{\n\t\tSubject: strings.ToLower(userID),\n\t\tIssuer: util.Config.DomainName,\n\t\tIssuedAt: time.Now().Unix(),\n\t\tExpiresAt: time.Now().Add(time.Hour * 24).Unix(),\n\t}\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\tsignature, err := token.SignedString([]byte(util.Config.JwtSigningKey))\n\tif err != nil {\n\t\tlog.Printf(\"err: %+v\\n\", err)\n\t\treturn \"\", &StatusError{\n\t\t\thttp.StatusInternalServerError,\n\t\t\terr.Error(),\n\t\t\terr,\n\t\t}\n\t}\n\tlog.Printf(\"Issued token: %v\\n\", signature)\n\treturn signature, nil\n}", "title": "" }, { "docid": "945498469e6f6c17a13c87891675a058", "score": "0.5569272", "text": "func callback(w http.ResponseWriter, r *http.Request) {\n code := r.URL.Query().Get(\"code\")\n target, _ := authUrl.Parse(tokenPath)\n //form the oauth token request\n body := bytes.NewBufferString(\n url.Values(map[string][]string{\n \"grant_type\": []string{\"authorization_code\"},\n \"code\": []string{code},\n \"redirect_uri\": []string{redirect},\n }).Encode())\n request := &http.Request{\n URL: target,\n Method: \"POST\",\n Header: map[string][]string{\n \"Accept\": []string{\"application/json\"},\n \"Content-Type\": []string{\"application/x-www-form-urlencoded\"},\n },\n Body: ioutil.NopCloser(body),\n ContentLength: int64(body.Len()),\n }\n //the token endpoint uses basic auth with client credentials\n request.SetBasicAuth(clientId, secret)\n response, err := http.DefaultClient.Do(request)\n if err != nil {\n http.Error(w, err.Error(), http.StatusInternalServerError)\n return\n }\n defer response.Body.Close()\n if status := response.StatusCode; status != http.StatusOK {\n msg := fmt.Sprintf(\"bad status for token request: %d\", status)\n http.Error(w, msg, http.StatusInternalServerError)\n return\n }\n //parse the access token from the response\n tokenResponse := &TokenResponse{}\n dec := json.NewDecoder(response.Body)\n dec.Decode(tokenResponse)\n\n\n //We have the access token now, everything from here is just for fun and demonstration\n //get the user from the public api\n /*user, _ := getUser(tokenResponse.AccessToken)\n templ.Execute(w, struct {\n User *User\n }{user})\n */\n\n user, _ := getUser(tokenResponse.AccessToken);\n w.Write(user)\n\n}", "title": "" }, { "docid": "cf48ba72675b830fe790d148944dd73e", "score": "0.5567878", "text": "func (s *dbStore) GetByAccess(access string) (oauth2.TokenInfo, error) {\n\tif len(access) == 0 {\n\t\treturn nil, nil\n\t}\n\ttoken := Token{\n\t\tAccess: access,\n\t}\n\tif find, err := s.engine.Get(&token); find {\n\t\treturn &token, nil\n\t} else {\n\t\treturn nil, err\n\t}\n}", "title": "" }, { "docid": "5112019f98a581eeda0db3c8e4c48a22", "score": "0.55672634", "text": "func GetByID(ctx *routing.Context) error {\n\tlogger := logger.GetLogInstance(\"\", \"\")\n\tdb := ctx.Get(\"db\").(*gorm.DB)\n\n\tuser := dbmodels.User{}\n\n\tif err := db.Where(\"id = ?\", ctx.Param(\"id\")).First(&user).Error; err != nil {\n\t\tlogger.Error(err)\n\t\tctx.Response.SetStatusCode(404)\n\t\tres := models.NewResponse(false, nil, \"not found\")\n\t\treturn ctx.WriteData(res.MustMarshal())\n\t}\n\tres := models.NewResponse(true, user, \"OK\")\n\treturn ctx.WriteData(res.MustMarshal())\n}", "title": "" }, { "docid": "3a31574fda0c544f128ce9173ed6c72c", "score": "0.55634767", "text": "func (g *Godel) GetNewAccessToken() {\n data := NewAccessTokenRequest{\n clientID,\n g.DistinctID,\n g.RefreshToken,\n }\n response := g.post(\"users/refreshToken\", data)\n\n token := NewAccessTokenResonse{}\n response.JSON(&token)\n\n if response.Ok {\n g.AccessToken = token.AccessToken\n }\n}", "title": "" }, { "docid": "3f9332b6922962deec5aa5e4ce61e2c8", "score": "0.5553954", "text": "func (ts *TokenStore) GetByAccess(access string) (ti oauth2.TokenInfo, err error) {\n\tbasicID, err := ts.getBasicID(ts.tcfg.AccessCName, access)\n\tif err != nil && basicID == \"\" {\n\t\treturn\n\t}\n\tti, err = ts.getData(basicID)\n\treturn\n}", "title": "" }, { "docid": "7588627a53daac0c90ec056c3e2c6604", "score": "0.5553478", "text": "func GetByIDHandler(c *gin.Context) {\n\n\tid, err := strconv.ParseInt(c.Param(\"id\"), 10, 64)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\":http.StatusText(http.StatusBadRequest)})\n\t\treturn\n\t}\n\tcu1 := Customer{}\n\tcu1.ID = id\n\n\tcu2, err := database.GetByKey(cu1)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\":http.StatusText(http.StatusInternalServerError)})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, cu2)\n}", "title": "" }, { "docid": "09f8c0340257ab27f3bfa8d771785147", "score": "0.5553089", "text": "func (p *User) GetByID(w http.ResponseWriter, r *http.Request) {\n\tid, _ := strconv.Atoi(chi.URLParam(r, \"id\"))\n\tpayload, err := p.repo.GetByID(r.Context(), int(id))\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": "c9c1faf29e7634eb97dd618d039e2c28", "score": "0.5549439", "text": "func (c *userOAuthAccessTokens) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.UserOAuthAccessToken, err error) {\n\tresult = &v1.UserOAuthAccessToken{}\n\terr = c.client.Get().\n\t\tResource(\"useroauthaccesstokens\").\n\t\tName(name).\n\t\tVersionedParams(&options, scheme.ParameterCodec).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "90d8f3ac308effbe683ad2df8f08c26b", "score": "0.55483884", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Contexxt-Type\", \"application/x-www-form-urlencoded\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\n\tparams := mux.Vars(r)\n\n\tid, err := strconv.Atoi(params[\"id\"])\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to convert the string into int. %v\", err)\n\t}\n\n\tuser, err := getUser(id)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to get user. %v\", err)\n\t}\n\n\t// send the response\n\tjson.NewEncoder(w).Encode(user)\n}", "title": "" }, { "docid": "7012fbf3287ace24f26778e4859304e4", "score": "0.55397266", "text": "func GetDispenserByID(w http.ResponseWriter, r *http.Request) {\n\taccountID, ok := context.GetOk(r, \"account_id\")\n\tif !ok {\n\t\tutil.ErrorResponder(w, http.StatusInternalServerError, errors.New(\"Cannot process token claims\"))\n\t\treturn\n\t}\n\tscopedFields, ok := context.GetOk(r, \"scoped_fields\")\n\tif !ok {\n\t\tutil.ErrorResponder(w, http.StatusBadRequest, errors.New(\"No scopes\"))\n\t\treturn\n\t}\n\tdispenserID := mux.Vars(r)[\"dispenser_id\"]\n\tif dispenserID == \"\" {\n\t\tutil.ErrorResponder(w, http.StatusBadRequest, errors.New(\"No ID supplied\"))\n\t\treturn\n\t}\n\n\tdb, err := db.Open()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer db.Close()\n\tconnection := types.Connection{}\n\tif err := connection.GetAccountDispenserByID(db, uuid.FromStringOrNil(accountID.(string)), uuid.FromStringOrNil(dispenserID)); err != nil {\n\t\tutil.ErrorResponder(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tutil.JSONResponder(w, scoping.FilterByScopes(scopedFields.([]string), connection.Dispensers[0]))\n\n}", "title": "" }, { "docid": "922f33c2d148776024fdf972c066476c", "score": "0.553476", "text": "func getAccessToken(user string, pass string) (accessToken string, error error) {\n\n\t// execute validation - Start\n\turlStr := \"https://sso-ext.tibco.com/as/token.oauth2?grant_type=password\"\n\n\t// Build out the data for our message\n\tv := url.Values{}\n\tv.Set(\"username\", user)\n\tv.Set(\"password\", pass)\n\tv.Set(\"client_id\", \"ropc_ipass\")\n\n\trb := *strings.NewReader(v.Encode())\n\n\t// Create client\n\tclient := &http.Client{}\n\n\treq, _ := http.NewRequest(\"POST\", urlStr, &rb)\n\treq.Header.Add(\"Accept\", \"application/json\")\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\tactivityLog.Info(\"*** getting Access Token\")\n\n\t// Make request\n\tresp, _ := client.Do(req)\n\n\tif resp.StatusCode >= 200 && resp.StatusCode < 300 {\n\t\tvar data map[string]interface{}\n\t\tbodyBytes, _ := ioutil.ReadAll(resp.Body)\n\t\terr := json.Unmarshal(bodyBytes, &data)\n\t\tif err == nil {\n\t\t\t//activityLog.Info(\"D: \" + data[\"access_token\"].(string))\n\t\t\t//fmt.Print(\"D: \" + data[\"access_token\"].(string))\n\n\t\t\treturn data[\"access_token\"].(string), nil\n\t\t}\n\t} else {\n\t\tactivityLog.Error(\"LiveApps Status: \" + resp.Status)\n\t}\n\treturn \"\", nil\n}", "title": "" }, { "docid": "ffec0dcf10075e18e857ed84e36bf7ac", "score": "0.5533448", "text": "func handleGetUser(w http.ResponseWriter, r *http.Request) {\n\tauthString := r.Header.Get(\"Authorization\")\n\tgithubId, err := strconv.Atoi(authString)\n\n\tif err != nil {\n\t\tfmt.Println(\"handle GET user\", err.Error())\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tuser, err := models.GetUser(int64(githubId))\n\tif err != nil {\n\t\tfmt.Println(\"handle GET user\", err.Error())\n\t\thttp.Error(w, err.Error(), http.StatusNotFound)\n\t\treturn\n\t}\n\n\tbytes, err := json.Marshal(user)\n\tif err != nil {\n\t\tfmt.Println(\"handle GET user\", err.Error())\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif _, err = w.Write(bytes); err != nil {\n\t\tfmt.Println(\"handle GET user\", err.Error())\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "4fa4c911e8ae05112bfdbf2ab112e50b", "score": "0.55323553", "text": "func getByID(c echo.Context) error {\n\tgroup := c.Get(\"group\").(types.Group)\n\tuser := c.Get(\"user\").(types.User)\n\n\tif !user.IsAdmin() {\n\t\tgroup.Obfuscate()\n\t}\n\n\treturn c.JSON(http.StatusOK, group)\n}", "title": "" }, { "docid": "9ac82dacc9214b15ff252a83734c9d26", "score": "0.5531258", "text": "func Get(userID int) (string, error) {\n\tvar token string\n\terror := db.GetDB().View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket(bucketName)\n\t\tif b == nil {\n\t\t\treturn nil\n\t\t}\n\t\tv := b.Get([]byte(strconv.Itoa(userID)))\n\t\ttoken = string(v)\n\t\treturn nil\n\t})\n\n\treturn token, error\n}", "title": "" }, { "docid": "15b0364a2e0c1a7b1951e44eaff8cd07", "score": "0.55276793", "text": "func (c *ImgCacher) getToken(v interface{}) error{\n\tif c.TenantID == \"\" {\n\t\treturn fmt.Errorf(\"Tenant ID is empty\")\n\t}\n\tresource := fmt.Sprintf(\"/%v/oauth2/token\", c.TenantID)\n\tdata := url.Values{}\n\tdata.Add(\"grant_type\", \"client_credentials\")\n\tdata.Add(\"client_id\", c.ApplicationID)\n\tdata.Add(\"client_secret\", c.ClientSecret)\n\tdata.Add(\"resource\", BaseURL)\n\n\tu, err := url.ParseRequestURI(LoginBaseURL)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to parse URI: %v\", err)\n\t}\n\n\tu.Path = resource\n\treq, err := http.NewRequest(\"POST\", u.String(), bytes.NewBufferString(data.Encode()))\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"HTTP Request Error: %v\", err)\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\treq.Header.Add(\"Content-Length\", strconv.Itoa(len(data.Encode())))\n\n\n\thttpClient := &http.Client{\n\t\tTimeout: time.Second * 10,\n\t}\n\tresp, err := httpClient.Do(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"HTTP response error: %v of http.Request: %v\", err, req.URL)\n\t}\n\tdefer resp.Body.Close() // close body when func returns\n\n\tbody, err := ioutil.ReadAll(resp.Body) // read body first to append it to the error (if any)\n\tif resp.StatusCode < 200 || resp.StatusCode > 299 {\n\t\t// Hint: this will mostly be the case if the tenant ID can not be found, the Application ID can not be found or the clientSecret is incorrect.\n\t\t// The cause will be described in the body, hence we have to return the body too for proper error-analysis\n\t\treturn fmt.Errorf(\"StatusCode is not OK: %v. Body: %v \", resp.StatusCode, string(body))\n\t}\n\n\t//fmt.Println(\"Body: \", string(body))\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"HTTP response read error: %v of http.Request: %v\", err, req.URL)\n\t}\n\n\treturn json.Unmarshal(body, &v)\n}", "title": "" }, { "docid": "ccd2850b6af8928971e4d1ded2407358", "score": "0.55249643", "text": "func (p *ProjectAccessTokensService) Get(projectID int, accessToken string) (*ProjectAccessToken, *simpleresty.Response, error) {\n\tprojects, response, listErr := p.List(projectID)\n\tif listErr != nil {\n\t\treturn nil, nil, listErr\n\t}\n\n\tvar targetProject *ProjectAccessToken\n\n\tfor _, project := range projects.Result {\n\t\tif project.GetAccessToken() == accessToken {\n\t\t\ttargetProject = project\n\t\t}\n\t}\n\n\tif targetProject == nil {\n\t\treturn nil, response, fmt.Errorf(\"specified project access token not found\")\n\t}\n\n\treturn targetProject, response, nil\n}", "title": "" }, { "docid": "2ed70e44abdb50e0d368724f2f4aa230", "score": "0.55237544", "text": "func (s *ApikeysServiceOp) GetById(id string, args ...interface{}) (*Apikey, error) {\n endpoint := \"apikeys/\"\n endpoint = fmt.Sprintf(\"%s%s\", endpoint, id)\n\n return s.GetByLink(endpoint, args...)\n}", "title": "" }, { "docid": "546152eabfba4b224a9e22bfe718d89c", "score": "0.55188453", "text": "func (ts *JWTTokenStore) GetByAccess(access string) (ti oauth2.TokenInfo, err error) {\n\treturn ParseAccessTokenInfo(ts.cfg.SigningMethod, ts.cfg.SignedKey, access)\n}", "title": "" }, { "docid": "8ee611ae32353e49a71f5d5cf3a27307", "score": "0.5513724", "text": "func (a *adapter) GetUser(ctx *routing.Context) error {\n\tclaims := ctx.Get(ctxClaims).(*domain.AccessTokenClaims)\n\n\tuser, err := a.service.GetUser(claims.UserID)\n\tif err != nil {\n\t\ta.logger.Error(\"Error getting the logged in user!\",\n\t\t\tzap.Any(\"claims\", claims),\n\t\t\tzap.Error(err))\n\t\treturn err\n\t}\n\n\treturn ctx.WriteData(user)\n}", "title": "" }, { "docid": "e093fcf0cd22ded2f2d5a1142229621d", "score": "0.5511367", "text": "func Get(c *gin.Context) {\n\n\tuserId, idErr := getUserId(c.Param(\"user_id\"))\n\tif idErr != nil {\n\n\t\tc.JSON(idErr.Status, idErr)\n\t\treturn\n\t}\n\tuser, getErr := services.UsersService.GetUser(userId)\n\tif getErr != nil {\n\t\tc.JSON(getErr.Status, getErr)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, user.Marshall(c.GetHeader(\"X-Public\") == \"true\"))\n}", "title": "" }, { "docid": "38fca46a348e9f4d74e5bef174cb19a6", "score": "0.5510877", "text": "func GetToken(endpoint Endpoint, projectID string) (string, error) {\n\tclient := http.Client{}\n\tmethods := []string{\"password\"}\n\tpassword := make(map[string]map[string]string)\n\tpassword[\"user\"] = make(map[string]string)\n\tpassword[\"user\"][\"id\"] = endpoint.User\n\tpassword[\"user\"][\"password\"] = endpoint.Password\n\tident := openstackIdentityDef{\n\t\tMethods: methods,\n\t\tPassword: password,\n\t}\n\tscope := make(map[string]map[string]interface{})\n\t// scope[\"domain\"] = make(map[string]string)\n\t// scope[\"domain\"][\"id\"] = endpoint.DomainID\n\tscope[\"project\"] = make(map[string]interface{})\n\tscope[\"project\"][\"id\"] = projectID\n\tscope[\"project\"][\"domain\"] = make(map[string]string)\n\tscope[\"project\"][\"domain\"].(map[string]string)[\"id\"] = endpoint.DomainID\n\tauth := openstackAuthDef{\n\t\tIdentity: ident,\n\t\tScope: scope,\n\t}\n\tdata := openstackAuthReqDef{\n\t\tAuth: auth,\n\t}\n\tjsonData, _ := json.Marshal(data)\n\t// log.Error().Msgf(\"Send %s\", string(jsonData))\n\trequest, err := http.NewRequest(\"POST\", fmt.Sprintf(\"%s/v3/auth/tokens\", endpoint.KeystoneURL), bytes.NewBuffer(jsonData))\n\trequest.Header.Set(\"Content-type\", \"application/json\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"%s\", err)\n\t}\n\tresp, err := client.Do(request)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"%s\", err)\n\t}\n\tdefer resp.Body.Close()\n\t// body, err := ioutil.ReadAll(resp.Body)\n\t// log.Error().Msgf(\"Status: %d, Headers: %+v, Body %s\", resp.StatusCode, resp.Header, body)\n\ttoken := resp.Header.Get(\"X-Subject-Token\")\n\tif token == \"\" {\n\t\treturn \"\", fmt.Errorf(\"Failed to get token\")\n\t}\n\treturn token, nil\n}", "title": "" }, { "docid": "0dcf1fe448b8e88d51d2388528d36f62", "score": "0.55101866", "text": "func GetToken(w http.ResponseWriter, r *http.Request) {\n\tcode := r.FormValue(\"code\")\n\tparams := url.Values{}\n\tparams.Add(\"grant_type\", \"authorization_code\")\n\tparams.Add(\"client_id\", config.AppId)\n\tparams.Add(\"client_secret\", config.AppKey)\n\tparams.Add(\"code\", code)\n\tstr := fmt.Sprintf(\"%s&redirect_uri=%s\", params.Encode(), config.RedirectURI)\n\tloginURL := fmt.Sprintf(\"%s?%s\", \"https://graph.qq.com/oauth2.0/token\", str)\n\n\tresponse, err := http.Get(loginURL)\n\tif err != nil {\n\t\tw.Write([]byte(err.Error()))\n\t}\n\tdefer response.Body.Close()\n\n\tbs, _ := ioutil.ReadAll(response.Body)\n\tbody := string(bs)\n\n\tresultMap := convertToMap(body)\n\n\tinfo := &PrivateInfo{}\n\tinfo.AccessToken = resultMap[\"access_token\"]\n\tinfo.RefreshToken = resultMap[\"refresh_token\"]\n\tinfo.ExpiresIn = resultMap[\"expires_in\"]\n\n\tGetOpenId(info, w, r)\n}", "title": "" }, { "docid": "abfd5c47d7f0e0e903ed17a9a6860451", "score": "0.5508572", "text": "func (testApp *TestApp) GetToken(tenantID string, userID string, scope []string) string {\n\treturn testApp.generateToken(tenantID, userID, \"\", \"\", uuid.UUID{}.String(), \"\", scope, false)\n}", "title": "" }, { "docid": "f9419769ec381a50ad89a4f14ac4617d", "score": "0.55056745", "text": "func HandleGetAccessToken(t *testing.T) {\n\ttesthelper.Mux.HandleFunc(\"/users/ce9e07/OS-OAUTH1/access_tokens/6be26a\", func(w http.ResponseWriter, r *http.Request) {\n\t\ttesthelper.TestMethod(t, r, \"GET\")\n\t\ttesthelper.TestHeader(t, r, \"Accept\", \"application/json\")\n\t\ttesthelper.TestHeader(t, r, \"X-Auth-Token\", client.TokenID)\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tfmt.Fprintf(w, GetUserAccessTokenResponse)\n\t})\n}", "title": "" }, { "docid": "85b5e4d61659bb4dbd2aa7d88a4c90aa", "score": "0.5505512", "text": "func Get(endpoint string, doi string, token string) (int, *api.Request) {\n\n\turl := fmt.Sprintf(\"%s/%s?auth=%s\", endpoint, doi, token)\n\t//fmt.Printf( \"URL: %s\\n\", url )\n\n\tresp, body, errs := gorequest.New().\n\t\tSetDebug(debugHTTP).\n\t\tGet(url).\n\t\tTimeout(time.Duration(serviceTimeout) * time.Second).\n\t\tEnd()\n\n\tif errs != nil {\n\t\tfmt.Printf(\"ERROR: request (%s) returns %s\\n\", url, errs)\n\t\treturn http.StatusInternalServerError, nil\n\t}\n\n\tdefer io.Copy(ioutil.Discard, resp.Body)\n\tdefer resp.Body.Close()\n\n\t//fmt.Printf( \"Received BODY: [%s]\\n\", body )\n\n\tr := api.StandardResponse{}\n\terr := json.Unmarshal([]byte(body), &r)\n\tif err != nil {\n\t\tfmt.Printf(\"ERROR: unmarshal (%s) returns %s\\n\", body, err)\n\t\treturn http.StatusInternalServerError, nil\n\t}\n\n\treturn resp.StatusCode, r.Details\n}", "title": "" }, { "docid": "22f30a581ebb7fb878f3fe458fa90195", "score": "0.55032146", "text": "func GetUserById(c *gin.Context) {\n\t// services.FindUser(c)\n\tuser, err := userService.FindUser(c.Param(\"id\"))\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, gin.H{\"data\": user})\n}", "title": "" }, { "docid": "97fcc9f5e8562aec71370e49b700373f", "score": "0.55015117", "text": "func GetUserByID(c echo.Context) error {\n\tid, err := uuid.Parse(c.Param(\"id\"))\n\n\tif err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, \"Invalid ID\")\n\t}\n\n\tuser := _iurepo.GetUser(id)\n\n\tif user == nil {\n\t\treturn c.JSON(http.StatusNotFound, \"User doesn't exists\")\n\t}\n\n\ttoken, err := GetFirebaseToken(c.Request())\n\n\tif token.UID != user.UID {\n\t\treturn c.JSON(http.StatusForbidden, \"Not Allowed\")\n\t}\n\n\treturn c.JSON(http.StatusOK, user)\n}", "title": "" }, { "docid": "7448c20de6cbf6ad4f0a1ae31dcdded4", "score": "0.5490318", "text": "func GetAuthenticationToken(ClientID string, Secret string) models.AccessTokenResponse {\n\tclient := &http.Client{}\n\n\tdata := url.Values{}\n\tdata.Set(\"scope\", \"accounts\")\n\tdata.Add(\"grant_type\", \"client_credentials\")\n\n\treq, err := http.NewRequest(\"POST\", \"https://openapi.investec.com/identity/v2/oauth2/token\", bytes.NewBufferString(data.Encode()))\n\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded; param=value\")\n\treq.SetBasicAuth(ClientID, Secret)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tf, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tresp.Body.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tvar response models.AccessTokenResponse\n\tjson.Unmarshal(f, &response)\n\n\treturn response\n}", "title": "" }, { "docid": "c303c9cbb03a28bbfa3d69c2b114cca9", "score": "0.54858536", "text": "func (account *Account) getById(id string) *Account {\n\tfmt.Println(\"getting account by Id\")\n\treturn account\n}", "title": "" }, { "docid": "98923e01ef5c020fe0ed881c9f4d48e6", "score": "0.54787445", "text": "func getUserById(req *restful.Request, response *restful.Response) {\n\tuserId := req.PathParameter(\"id\")\n\tvar user User\n\n\terr := SelectUser().QueryRow(userId).Scan(&user.Id, &user.Name, &user.Last, &user.Password, &user.Email, &user.Created)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tresponse.WriteHeader(http.StatusFound)\n\tresponse.WriteEntity(user)\n}", "title": "" }, { "docid": "5138201ac6658d1b301cd6e8feea6c3a", "score": "0.5474162", "text": "func (repo *Repository) GetTokenByAccess(access string) (*model.OAuth2Token, error) {\n\tif len(access) == 0 {\n\t\treturn nil, repository.ErrNotFound\n\t}\n\tot := &model.OAuth2Token{}\n\tif err := repo.db.Take(ot, &model.OAuth2Token{AccessToken: access}).Error; err != nil {\n\t\treturn nil, convertError(err)\n\t}\n\treturn ot, nil\n}", "title": "" }, { "docid": "aaacaf69486d0e51e12aa0b81c0b65a9", "score": "0.5471671", "text": "func (api *API) Get(ctx *gin.Context) {\n\tid, err := strconv.ParseInt(ctx.Param(\"id\"), 10, 64)\n\tif err != nil {\n\t\tctx.JSON(\n\t\t\thttp.StatusBadRequest,\n\t\t\tgin.H{\n\t\t\t\t\"status\": fmt.Sprintf(\"Not a valid identifier of a list: %s, error: %s\", ctx.Param(\"id\"), err.Error()),\n\t\t\t},\n\t\t)\n\t}\n\n\tuser := api.service.Get(id)\n\tif user.ID != 0 {\n\t\tctx.JSON(http.StatusOK, gin.H{\"user\": user})\n\t} else {\n\t\tctx.JSON(http.StatusNotFound, gin.H{\"status\": http.StatusNotFound})\n\t}\n}", "title": "" }, { "docid": "a2c5944c2c41fa917ce4f17226260ca9", "score": "0.5463577", "text": "func GetUserFromAPI (c *gin.Context){\n\n\tuserID := c.Param(paramUserID)\n\n\tid, err := strconv.Atoi(userID)\n\tif err != nil {\n\t\tapiErr := &utils.ApiError{\n\t\t\tMessage: err.Error(),\n\t\t\tStatus: http.StatusBadRequest,\n\t\t}\n\t\tc.JSON(apiErr.Status, apiErr)\n\t\treturn\n\t}\n\n\tresponse ,apiErr := services.GetUser(id)\n\tif err != nil {\n\t\tc.JSON(apiErr.Status, apiErr)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, response)\n}", "title": "" }, { "docid": "59a114988d8544fbe381a1fae0775b9b", "score": "0.5460396", "text": "func (u testUserAPI) GetBy(id string) { // id equals to u.Param(\"param1\")\n\tu.Write(\"Get By %s\\n\", id)\n}", "title": "" }, { "docid": "925f6a8bbd38cc7e7151a5d8642b6f2d", "score": "0.5458016", "text": "func getAPIToken(vmcAuthHost string, vmcAccessToken string) (string, error) {\n\n\tpayload := strings.NewReader(\"refresh_token=\" + vmcAccessToken)\n\treq, _ := http.NewRequest(\"POST\", \"https://\"+vmcAuthHost, payload)\n\n\treq.Header.Add(\"content-type\", \"application/x-www-form-urlencoded\")\n\tres, err := http.DefaultClient.Do(req)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif res.StatusCode != http.StatusOK {\n\t\tb, _ := io.ReadAll(res.Body)\n\t\treturn \"\", fmt.Errorf(\"Unexpected status code %d trying to get auth token. %s\", res.StatusCode, string(b))\n\t}\n\n\tdefer res.Body.Close()\n\ttoken := jwtToken{}\n\terr = json.NewDecoder(res.Body).Decode(&token)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"Decoding token failed with\")\n\t}\n\n\treturn token.AccessToken, nil\n}", "title": "" }, { "docid": "c78ea6019ff364a4e44d970a0b458276", "score": "0.54441935", "text": "func (a *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, domain.ErrNotFound.Error())\n\t}\n\n\tid := int64(idP)\n\tctx := c.Request().Context()\n\n\tuser, err := a.UserUsecase.GetByID(ctx, id)\n\tif err != nil {\n\t\treturn c.JSON(getStatusCode(err), ResponseError{Message: err.Error()})\n\t}\n\n\treturn c.JSON(http.StatusOK, user)\n}", "title": "" }, { "docid": "48eedc29d3e7ccd3f670291dd78dc291", "score": "0.54424137", "text": "func (a *IamUserApiService) IamUserCredentialAuthtokenGet(ctx context.Context, userId string, authtokenId string) ApiIamUserCredentialAuthtokenGetRequest {\n\treturn ApiIamUserCredentialAuthtokenGetRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tuserId: userId,\n\t\tauthtokenId: authtokenId,\n\t}\n}", "title": "" }, { "docid": "d86c01c3932c0b8de2ea17d20fe69a18", "score": "0.5440259", "text": "func GetUser(c *gin.Context) {\n\tidstr := c.Params.ByName(\"user_id\")\n\tid, errparse := strconv.ParseInt(idstr, 10, 64)\n\n\tif errparse != nil {\n\t\tc.JSON(http.StatusBadRequest, errors.NewBadRequestError(\"Invalid Id\"))\n\t\treturn\n\t}\n\tresult, err := services.GetUser(id)\n\tif err != nil {\n\t\tc.JSON(err.Status, err)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, result)\n}", "title": "" } ]
de609e0f769f70c5a1d51ff0aaef4791
directly close, packages in queue will not be sent
[ { "docid": "d2e127afef54accc89a258248d2ebdb2", "score": "0.0", "text": "func (connection *Connection) close() {\r\n\tif ConnStatusConnected != connection.status {\r\n\t\treturn\r\n\t}\r\n\r\n\tconnection.conn.Close()\r\n\tconnection.status = ConnStatusDisconnected\r\n}", "title": "" } ]
[ { "docid": "99aeb7dde506a9d5ee1fdf8e6c29c082", "score": "0.70321286", "text": "func (e *executor) close() {\n\tclose(e.queue)\n}", "title": "" }, { "docid": "e817edc07344c90ee88997f68884536d", "score": "0.68223864", "text": "func (self *Queue) Close() {\n\tself.close(false)\n}", "title": "" }, { "docid": "858fd76bc704c237bd4504ec5de78bbc", "score": "0.67993784", "text": "func (q *Queue) close() {\n\tq.Lock()\n\tdefer q.Unlock()\n\tq.done = true\n\tq.inCond.Broadcast()\n\tq.outCond.Broadcast()\n}", "title": "" }, { "docid": "925304cee31d15bbc552899095fd8d5f", "score": "0.6768774", "text": "func (ctx ContextImpl) Close() {\n\n\tif (ibmmq.MQQueueManager{}) != ctx.qMgr {\n\t\tctx.qMgr.Disc()\n\t}\n\n}", "title": "" }, { "docid": "46f7db2c5a14b1dd517d6110ee63408a", "score": "0.6730569", "text": "func (listener *kqueueListener) close() error {\n\treturn syscall.Close(listener.kq)\n}", "title": "" }, { "docid": "bbe42659db5adab4b3818351179a58b6", "score": "0.6725203", "text": "func (self *Queue) ForceClose() {\n\tself.close(true)\n}", "title": "" }, { "docid": "46230ae1cac38f4fa3de7e318488798d", "score": "0.67245185", "text": "func (L *Pa_log_t) Close() {\n L.Q_flush <- 0xff\n}", "title": "" }, { "docid": "1c18dfaf549e7056735d01dcfba90ac1", "score": "0.66860294", "text": "func (p *APNSPushQueue) Close() {\n\tclose(p.pushChannel)\n\tclose(p.responseChannel)\n\tp.Closed = true\n}", "title": "" }, { "docid": "088287cdb9f529ea6a1ade6b774580c3", "score": "0.66673946", "text": "func (sq *SynchronizedQueueImpl) Close() {\n\t// noop\n}", "title": "" }, { "docid": "cdb8c739fc54a3db54e0a5fea0c36b95", "score": "0.66290784", "text": "func (m *MessagingQueue) Close() {\n\tm.pool.Close()\n}", "title": "" }, { "docid": "2c201673fbd7de792a1b18911057bbeb", "score": "0.6607854", "text": "func close(object ibmmq.MQObject) error {\n\terr := object.Close(0)\n\tif err == nil {\n\t\tfmt.Println(\"Closed queue \" + object.Name)\n\t} else {\n\t\tfmt.Println(err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2c558d7dbcd8001817f572fe425e2e71", "score": "0.6594025", "text": "func (p *PublisherZmq) Close() {\n\tp.socket.Close()\n\treturn\n}", "title": "" }, { "docid": "40dcf158f7c387cef72c56c889da1b84", "score": "0.65926504", "text": "func (mq *MessageQueue) Close() {\n\tif mq.id > -1 {\n\t\tfreeBuffer(mq.buffer)\n\t\tmq.id = -1\n\t\tmq.config = nil\n\t}\n}", "title": "" }, { "docid": "0fb1cef228f40d9cab1040371721e761", "score": "0.6562778", "text": "func (q *MmapQueue) Close() error {\n\t// wait for background go routines to finish.\n\t// we need to acquire lock afterwards so that we avoid a livelock\n\t// between periodic flush goroutine and Close() function.\n\t// A possible lock cycle is here:\n\t// Close() after it has acquired the lock ->\n\t// -> Close() waiting for periodic flush goroutine to stop -> \n\t// -> Periodic flush goroutine is trying to acquire the lock ->\n\t// -> Close() to release the lock\n\tclose(q.quit)\n\tq.wg.Wait()\n\n\tq.lock.Lock()\n\tdefer q.lock.Unlock()\n\n\tvar retErr error\n\tif err := q.md.close(); err != nil {\n\t\tretErr = err\n\t}\n\n\tif err := q.am.close(); err != nil {\n\t\tretErr = err\n\t}\n\n\treturn retErr\n}", "title": "" }, { "docid": "b075c8febd42bb483e3f5869ec2bf5fe", "score": "0.6507072", "text": "func (q *inMemoryQueue) Close() error {\n\treturn q.loop.Stop()\n}", "title": "" }, { "docid": "ab1913221c03862fb3fc4e3323c8a5ce", "score": "0.6489881", "text": "func (c *client) close() {\n\tlog.Printf(\"client %d close()\", c.Numero)\n\tc.closing = true //FIXME: subject to data race condition ?\n\t// stop reading from client\n\tc.rwc.SetReadDeadline(time.Now().Add(time.Second))\n\n\t// TODO: Send a Disconnection notification\n\n\t// signals to all currently running request processor to stop\n\tfor messageID, request := range c.requestList {\n\t\tlog.Printf(\"Client [%d] sent abandon signal to request[messageID = %d]\", c.Numero, messageID)\n\t\tgo request.Abandon()\n\t}\n\n\t// wait for all request processor to end\n\t//log.Printf(\"waiting the end of current (%d) client's requests\", c.Numero)\n\tc.wg.Wait()\n\tclose(c.chanOut)\n\tlog.Printf(\"client [%d] request processors ended\", c.Numero)\n\n\t// close client connection\n\tc.rwc.Close()\n\tlog.Printf(\"client [%d] connection closed\", c.Numero)\n\n\t// signal to server that client shutdown is ok\n\tc.srv.wg.Done()\n}", "title": "" }, { "docid": "7884bc4aa629e7ff55160abf461b698c", "score": "0.6479543", "text": "func (s *Server) Close() { s.once.Do(s.stop) }", "title": "" }, { "docid": "789eeaafebf24531e3244b5bbbe5b209", "score": "0.64393836", "text": "func (q *queueImpl) Close() {\n\tq.mu.Lock()\n\tdefer q.mu.Unlock()\n\tq.closed = true\n\tq.cnt = 0\n\tq.nodes = nil\n\tq.size = 0\n\tq.cond.Broadcast()\n}", "title": "" }, { "docid": "2d928d3112e12c41393bbc2b1943dd5f", "score": "0.64325523", "text": "func (b *batch) Close() {\n\tb.QueueComplete()\n\tb.terminateAll()\n\tb.WaitAll()\n\tb.pool.Release()\n}", "title": "" }, { "docid": "8e2f3b75222eb70abe431afbd967b8c2", "score": "0.6427368", "text": "func (d *dummyPurger) Close() {}", "title": "" }, { "docid": "5429266791a9eb85cdcacfb8b00c0b5b", "score": "0.64194465", "text": "func (c *Channel) close(err error) {\n\tc.closeOnce.Do(func() {\n\t\tc.l.Debugf(\"Closing with error: %+v\", err)\n\t\tc.closeErr = err\n\n\t\tc.m.Lock()\n\t\tfor _, ch := range c.responses { // unblock all subscribers\n\t\t\tclose(ch)\n\t\t}\n\t\tc.responses = nil // prevent future subscriptions\n\t\tc.m.Unlock()\n\n\t\tc.sendM.Lock()\n\t\t_ = c.s.CloseSend()\n\t\tclose(c.closeWait)\n\t\tc.sendM.Unlock()\n\t})\n}", "title": "" }, { "docid": "a1900417f310504d89216f600971d881", "score": "0.6413025", "text": "func (q *Q) Close() {\n\tq.channel.Close()\n\tq.server.Close()\n}", "title": "" }, { "docid": "360dd815a228aaa95b964eed618fd2dd", "score": "0.64033055", "text": "func (w *worker) Close() {\n\tw.closeCh <- struct{}{}\n\t<-w.closeCh\n}", "title": "" }, { "docid": "328a72b8723db532a30126a69d0e15dd", "score": "0.63964844", "text": "func (q *Loop) Close() (err0 error) {\n\t// FIXME use multierr\n\tfor _, queue := range q.queues {\n\t\tif err := queue.Close(); err != nil && err0 == nil {\n\t\t\terr0 = err\n\t\t}\n\t}\n\tq.wg.Wait()\n\tif q.poll != nil {\n\t\tif err := q.poll.close(); err != nil && err0 == nil {\n\t\t\terr0 = err\n\t\t}\n\t}\n\tfor _, qu := range q.queues {\n\t\tring := qu.Ring()\n\t\tif err := ring.CloseEventfd(); err != nil && err0 == nil {\n\t\t\terr0 = err\n\t\t}\n\t\tif err := ring.Close(); err != nil && err0 == nil {\n\t\t\terr0 = err\n\t\t}\n\t}\n\treturn err0\n}", "title": "" }, { "docid": "e0aab3e6b12bda7e79c8d2c660017c99", "score": "0.6391511", "text": "func (b *Broker) Close() {\n\tclose(b.done)\n}", "title": "" }, { "docid": "068cd7ca96e78b58ef0ff6924b674119", "score": "0.638588", "text": "func (s *senderQueue) Close() {\n\ts.once.Do(func() {\n\t\ts.closed.Store(true)\n\t\tclose(s.incoming)\n\t\ts.wg.Wait()\n\t})\n}", "title": "" }, { "docid": "7f3c7306f443b6716b91cfb3bea9d1bb", "score": "0.6384201", "text": "func (b *broker) Close() {\n\tif b.ch != nil {\n\t\tb.ch.Close()\n\t\tb.ch = nil\n\t}\n\tif b.conn != nil {\n\t\tb.conn.Close()\n\t\tb.conn = nil\n\t}\n}", "title": "" }, { "docid": "3147bb24e17b97f40395b095993730a6", "score": "0.63832945", "text": "func (b *Batch) Close() {\n\tb.QueueComplete()\n\tb.WaitAll()\n\tb.terminateAll()\n\tb.pool.Release()\n}", "title": "" }, { "docid": "1f20522501cff4158c1c712b41d2f852", "score": "0.6355016", "text": "func (disp *Dispatcher) Close() {\n\n\t// shut down nats connection\n\tdisp.natsConn.Flush()\n\tdisp.natsConn.Close()\n\n\t// shut down lb connection\n\tdisp.lbConn.Close()\n\n\t// close all handlers by invoking cancelfunc on associated contexts\n\tfor name, _ := range disp.handlerContexts {\n\t\tdisp.removeHandlerContext(name)\n\t}\n\n\tlog.Println(\"dispatcher successfully shut down\")\n\n}", "title": "" }, { "docid": "32f2b0e95488fd47ac66502e76d44310", "score": "0.63460416", "text": "func (p *Rabbitmq) Close() {\n\tif p.channel != nil {\n\t\tp.channel.Close()\n\t}\n\tif p.conn != nil {\n\t\tp.conn.Close()\n\t}\n}", "title": "" }, { "docid": "b257fe270ff3d7f93937d462b17d9eec", "score": "0.63367516", "text": "func (p *Pool) Close() {\n\tclose(p.jobsQueue)\n\tclose(p.cacheQueue)\n}", "title": "" }, { "docid": "658ec5a4464650cea43acc38341280ca", "score": "0.6336044", "text": "func (q *PktQueue) Close() error {\n\tring := ringbuffer.FromPtr(unsafe.Pointer(q.ptr().ring))\n\tif ring == nil {\n\t\treturn nil\n\t}\n\treturn ring.Close()\n}", "title": "" }, { "docid": "0bd93febfa65cf4b83afa6a893de3a79", "score": "0.6328153", "text": "func (b *Batcher[T]) Close(ctx context.Context) error {\n\tvar err error\n\nL:\n\tfor {\n\t\tb.mutex.Lock()\n\n\t\tif b.state != batcherStateQueued {\n\t\t\t// Fast fail if the batcher is dead. On subsequent iterations this occurs\n\t\t\t// only after the batch transitioned from queued to closed. Not necessary\n\t\t\t// in batcherStateQueued.\n\t\t\t// TODO measure impact.\n\t\t\tselect {\n\t\t\tcase <-b.ctx.Done():\n\t\t\t\tb.mutex.Unlock()\n\n\t\t\t\treturn pkgErrors.Wrap(errBatcherDying, \"(*Batcher).Close\")\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\n\t\tswitch b.state {\n\t\tcase batcherStateClosed:\n\t\t\t// Instead of sendCommand, the tomb could simply be killed. Here\n\t\t\t// sendCommand is used so that communication with the dispatcher always\n\t\t\t// follows the same semantic.\n\t\t\terr = b.sendCommand(batcherCommandShutDown)\n\n\t\t\tb.mutex.Unlock()\n\n\t\t\tif err != nil {\n\t\t\t\treturn pkgErrors.Wrap(err, \"(*Batcher).Close: in state close: trigger shut down\")\n\t\t\t}\n\n\t\t\tbreak L\n\t\tcase batcherStateOpen:\n\t\t\tb.initiateQueueingWithLock()\n\n\t\t\terr = b.sendCommand(batcherCommandDispatchAndShutDown)\n\n\t\t\tb.mutex.Unlock()\n\n\t\t\tif err != nil {\n\t\t\t\treturn pkgErrors.Wrap(err, \"(*Batcher).Close: in state open: trigger dispatch and shut down\")\n\t\t\t}\n\n\t\t\tbreak L\n\t\tcase batcherStateQueued:\n\t\t\tqueueingDone := b.queueingDone\n\n\t\t\tb.mutex.Unlock()\n\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn pkgErrors.Wrap(ctx.Err(), \"(*Batcher).Close: in state queued\")\n\t\t\tcase <-b.ctx.Done():\n\t\t\t\treturn pkgErrors.Wrap(errBatcherDying, \"(*Batcher).Close: in state queued\")\n\t\t\tcase <-queueingDone:\n\t\t\t}\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tb.mutex.Unlock()\n\t\t\treturn pkgErrors.Wrapf(errUnknownBatcherState, \"(*Batcher).Close: encountered state %d\", b.state)\n\t\t}\n\t}\n\n\tselect {\n\tcase <-b.dispatcherDone:\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n\n\treturn b.dispatcherErr\n}", "title": "" }, { "docid": "33f7aaf0be095bcd1ccbe48f8ec185f2", "score": "0.6314333", "text": "func (h *handler) close(err error, inflightReq *requestOp) {\n\th.cancelAllRequests(err, inflightReq)\n\th.callWG.Wait()\n\th.cancelRoot()\n\th.cancelServerSubscriptions(err)\n}", "title": "" }, { "docid": "4d1d283d3f895933823dfc252b51462d", "score": "0.6308694", "text": "func (e *Engine) Close() { e.stop <- true }", "title": "" }, { "docid": "a490aa2922766cfc6e85b3bcd2da4eae", "score": "0.62885773", "text": "func (r *pipeline_runner) close() error {\r\n\tif r.done != nil {\r\n\t\tclose(r.done)\r\n\t\tr.done = nil\r\n\t}\r\n\tif r.wait != nil {\r\n\t\tr.wait.Wait()\r\n\t\tr.wait = nil\r\n\t}\r\n\t// Close message channels after we've waited for all routines to stop,\r\n\tif r.passthrough != nil {\r\n\t\tclose(r.passthrough)\r\n\t\tr.passthrough = nil\r\n\t}\r\n\tif r.msgchan != nil {\r\n\t\tclose(r.msgchan)\r\n\t\tr.msgchan = nil\r\n\t}\r\n\treturn r.err.Get()\r\n}", "title": "" }, { "docid": "761876e69b8b7e7e9a604658addbe771", "score": "0.6286693", "text": "func (e *TaskExecutor) close() {\n\tif closing := e.closed.CAS(false, true); !closing {\n\t\treturn\n\t}\n\te.cancel()\n\te.Input.Close()\n\tif err := e.Output.Close(); err != nil {\n\t\tlog.Error(\"Failed to close output: {}\")\n\t}\n\te.function = nil\n\te.Input = nil\n\n\tfor _, callback := range e.finishCallbacks {\n\t\tcallback()\n\t}\n}", "title": "" }, { "docid": "42c3e466ca890700f88baf7bcc1dda69", "score": "0.6276176", "text": "func (q *Queue) Close() {\n\tq.log.Info(\"[Q:%s] is closed...\", q.name)\n\tq.close()\n\tq.log.Info(\"[Q:%s] was closed...\", q.name)\n}", "title": "" }, { "docid": "034a7e03985ad9cf8aa43063333d7edd", "score": "0.62524486", "text": "func (b *Backend) Close() error {\n\tlog.Info(\"gateway/mqtt: closing backend\")\n\n\tlog.WithField(\"topic\", b.eventTopic).Info(\"gateway/mqtt: unsubscribing from event topic\")\n\tif token := b.conn.Unsubscribe(b.eventTopic); token.Wait() && token.Error() != nil {\n\t\treturn fmt.Errorf(\"gateway/mqtt: unsubscribe from %s error: %s\", b.eventTopic, token.Error())\n\t}\n\n\tlog.Info(\"backend/gateway: handling last messages\")\n\tb.wg.Wait()\n\tclose(b.rxPacketChan)\n\tclose(b.statsPacketChan)\n\tclose(b.downlinkTXAckChan)\n\treturn nil\n}", "title": "" }, { "docid": "39cb137571c7a507225915e2f2d519d9", "score": "0.6249263", "text": "func (ts *TimedSched) Close() { ts.dieOnce.Do(func() { close(ts.die) }) }", "title": "" }, { "docid": "f52c613c597f433c55b1015096057559", "score": "0.6248935", "text": "func (p *Protocol) Close() {\n\tp.closeOnce.Do(func() {\n\t\tp.running.Store(false)\n\t\tp.mgr.close()\n\t})\n}", "title": "" }, { "docid": "10afb098282b93bbab3da46215649a27", "score": "0.623698", "text": "func (b *Broadcast) Close() {\n\tb.DoneChan <- struct{}{}\n}", "title": "" }, { "docid": "84c699ef09c33a6541b0bb7d9496f6c4", "score": "0.6234907", "text": "func (o *AppRunner) Close() {\n\to.queue <- nil\n\tif o.sdk != nil {\n\t\to.sdk.Close()\n\t}\n}", "title": "" }, { "docid": "c3d765077081d9ab0eef637760e273bd", "score": "0.6233985", "text": "func Command_Close(script *rex.Script, params []*rex.Value) {\n\tif len(params) != 1 {\n\t\trex.ErrorParamCount(\"thread:close\", \"1\")\n\t}\n\n\tif _, ok := params[0].Data.(chan *rex.Value); !ok {\n\t\trex.ErrorGeneralCmd(\"thread:close\", \"Parameter 0 is not a channel.\")\n\t}\n\tchannel := params[0].Data.(chan *rex.Value)\n\tclose(channel)\n}", "title": "" }, { "docid": "a077a43c669c55e8e6ac644031c18f5a", "score": "0.622375", "text": "func (q *Queue) Close() error {\n\treturn q.CloseTimeout(30 * time.Second)\n}", "title": "" }, { "docid": "a35104bc86384ca5b5337f51bb162d58", "score": "0.6222131", "text": "func (proc *WorkerPool) Close() {\n\tclose(proc.channel)\n\tproc.statsTicker.Stop()\n\tproc.wg.Wait()\n}", "title": "" }, { "docid": "e446d3137bc5d94bf6fa7383cd6201b9", "score": "0.621629", "text": "func (q *Queue) Close() error {\n\t_, err := q.dispatch.CallMethod(\"Close\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"msmq: Close() failed to close queue: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8564e4d064eb8c62cf3194d79d81b6a5", "score": "0.62146956", "text": "func (db *testSender) Close() {}", "title": "" }, { "docid": "a2f0f28997052c86fb08cd934e9d40bb", "score": "0.6214643", "text": "func (t *Buffered) Close() error {\n\tt.once.Do(func() {\n\t\tt.queue <- op{close: true}\n\t})\n\n\t<-t.ctx.Done()\n\treturn nil\n}", "title": "" }, { "docid": "6e8fa7249aa62c5c5270dd22ad611d3b", "score": "0.62046087", "text": "func (p *PeerQueueManager) Close() error {\n\tif p.flag.Inactivate() {\n\t\tp.mutex.Lock()\n\t\tdefer p.mutex.Unlock()\n\t\tclose(p.notify)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b08466c402b0647f05309d34564b161a", "score": "0.61933243", "text": "func (b *Backend) Close() {\n\tb.conn.Disconnect(250) // wait 250 milisec to complete pending actions\n}", "title": "" }, { "docid": "4e2d2d2314a3a57988b7596fb424b176", "score": "0.6190892", "text": "func (context *Context) Close() {\n\tcontext.QueueManager.Close()\n}", "title": "" }, { "docid": "36c684f07f2d7c674549114b907e8994", "score": "0.6189389", "text": "func (a *Agent) Close() {\n\tif a.taskLoopChan != nil {\n\t\tclose(a.taskLoopChan)\n\t}\n}", "title": "" }, { "docid": "e0150b5fd607e45e38db3d223324c38e", "score": "0.6188274", "text": "func (q *execQueue) quit() {\n\tq.mu.Lock()\n\tif !q.isClosed() {\n\t\tq.closeWait = make(chan struct{})\n\t\tq.cond.Signal()\n\t}\n\tq.mu.Unlock()\n\t<-q.closeWait\n}", "title": "" }, { "docid": "458544eeabf3667ae114016bacad1463", "score": "0.61795425", "text": "func (b *RabbitMQEventBus) Close() error {\n\t// will close() the deliveries channel\n\tif err := b.channel.Cancel(b.tag, true); err != nil {\n\t\treturn fmt.Errorf(\"Consumer cancel failed: %s\", err)\n\t}\n\n\tif err := b.conn.Close(); err != nil {\n\t\treturn fmt.Errorf(\"AMQP connection close error: %s\", err)\n\t}\n\n\treturn <-b.done\n}", "title": "" }, { "docid": "cea69cffbaa2f9b2a67f5b045e82698e", "score": "0.61757755", "text": "func (self *INIBackend) Close() {\n\t// TODO: Cancel any watches if they exist\n}", "title": "" }, { "docid": "584defd656e378744ad05761e30c7781", "score": "0.6174579", "text": "func (srv *Receive) Close() {\n\tif srv == nil {\n\t\treturn\n\t}\n\n\tsrv.done <- true\n}", "title": "" }, { "docid": "c40ac98c17af4f999e6c586974a473f9", "score": "0.61695844", "text": "func cleanup(){\n for _, channel := range network {\n close(channel)\n }\n}", "title": "" }, { "docid": "57df914df296c82d9a9278501ee4288e", "score": "0.61634994", "text": "func (s *AMQPServer) Close() {\n\tselect {\n\tcase c := <-s.connections:\n\t\tlog.Printf(\"Closing...%s\\n\", c)\n\t\tdebugr(\"Debug:close %s\", c)\n\t\tc.Close(nil)\n\tdefault:\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "81353899a987beda419cef12afcdae9d", "score": "0.6161154", "text": "func (s *Shout) Close() {\n\ts.m.Lock()\n\tdefer s.m.Unlock()\n\tif s.closed {\n\t\tpanic(\"Close of closed shout channel\")\n\t}\n\tfor k := range s.subscribers {\n\t\tclose(k)\n\t}\n\t//Tell run() to return. Can't do close(s.done) because the\n\t//close(s.send) might be processed by run() first, causing a panic.\n\ts.done <- struct{}{}\n\tclose(s.send)\n\ts.closed = true\n}", "title": "" }, { "docid": "1ebae6a4b52549fe5162a308c60579fc", "score": "0.6158452", "text": "func (p *pool) close() {\n\tp.closePool.Do(func() {\n\t\tp.status = PoolClosed\n\t})\n}", "title": "" }, { "docid": "9cdc21b117a413cc6b360afb91cdaa9c", "score": "0.6152839", "text": "func (c *LGTransport) Close() {\n c.Quit <- true\n c.Conn.Close()\n}", "title": "" }, { "docid": "75424022b822cc4c1e03f160d3f008d1", "score": "0.61526614", "text": "func (t *ackTimer) close() {\n\tt.mutex.Lock()\n\tdefer t.mutex.Unlock()\n\n\tif t.stopFunc != nil {\n\t\tt.stopFunc()\n\t\tt.stopFunc = nil\n\t}\n\n\tt.closed = true\n}", "title": "" }, { "docid": "895ac3d1bf84182dc4ccc4f69b19f750", "score": "0.6147657", "text": "func (disp *serviceDispatcher) close() {\n\tdisp.mu.Lock()\n\tfor _, cs := range disp.activeCommands {\n\t\tclose(cs.upcallCh)\n\t}\n\tdisp.mu.Unlock()\n\t// TODO(saito): prevent new command from launching.\n}", "title": "" }, { "docid": "335249f6cad9ff8301c6daa4cea7aec0", "score": "0.6146435", "text": "func (wind *windObj) close() error {\n\tif wind.ctx.Err() != nil {\n\t\treturn wind.err\n\t}\n\n\tif wind.wind != nil {\n\t\tif wind.evtsink != nil {\n\t\t\twind.cancel(0) // nolint\n\t\t\tif err := unadviseEventReceiver(wind.wind, wind.evtsink); err != nil {\n\t\t\t\twind.err = errs.And(wind.err, err)\n\t\t\t}\n\t\t}\n\n\t\twind.ctx.cancel()\n\t\twind.evtsink = nil\n\n\t\twind.wind.Release()\n\t\twind.wind = nil\n\n\t\tif wind.ctx.tid != 0 {\n\t\t\tif r0, err := postMessage0012(wind.ctx.tid); r0 != 0 {\n\t\t\t\twind.wg.Wait()\n\t\t\t} else {\n\t\t\t\tklog.Warningf(\"(wind) post close message with error: %v(%v)\", err, r0)\n\t\t\t}\n\t\t\twind.ctx.tid = 0\n\t\t}\n\t}\n\n\treturn wind.err\n}", "title": "" }, { "docid": "321dffd7bd6040ab325a81b5f00e47c4", "score": "0.6137096", "text": "func Close() { global.Close() }", "title": "" }, { "docid": "e32f2dad6948155ef0faf795b854d6e3", "score": "0.6129273", "text": "func (p *peer) close() {\n\tclose(p.term)\n}", "title": "" }, { "docid": "e32f2dad6948155ef0faf795b854d6e3", "score": "0.6129273", "text": "func (p *peer) close() {\n\tclose(p.term)\n}", "title": "" }, { "docid": "cfa7b2fe27c389caeaa33cbeb1aa90cd", "score": "0.61286765", "text": "func (qb *BatchChan) Close() {\n\tclose(qb.stop)\n}", "title": "" }, { "docid": "47326a5ebe56365d432571ef7ba8e2bb", "score": "0.61219716", "text": "func (w *WorkerGroup) Close() {\n\t_ = w.close(nil)\n}", "title": "" }, { "docid": "f742eec5258eb8b8d6081dcbc0b55aef", "score": "0.61191696", "text": "func (it *HorseDexOrderRejectedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "3f499e93db6afc3bb1adf7b60ea83528", "score": "0.61184204", "text": "func (ln *listener) Close() error { return nil }", "title": "" }, { "docid": "188862e7e6a22feefff7c5c5d02d34f5", "score": "0.61171407", "text": "func (px *Paxos) Kill() {\n px.dead = true\n if px.l != nil {\n px.l.Close()\n }\n}", "title": "" }, { "docid": "188862e7e6a22feefff7c5c5d02d34f5", "score": "0.61171407", "text": "func (px *Paxos) Kill() {\n px.dead = true\n if px.l != nil {\n px.l.Close()\n }\n}", "title": "" }, { "docid": "a0e1e1d78a224dbd81c395ece475eb67", "score": "0.61149496", "text": "func (self *ZmqConnection) Close() {\n\tself.socket.Close()\n}", "title": "" }, { "docid": "5d2c922f17dd96d339cd73789b2fd30c", "score": "0.6104737", "text": "func (it *AskMeAnythingRequestSentIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "48323ba62fe7a4bbc8ba3a04bc3dd376", "score": "0.61008996", "text": "func (rr *realRunner) close() {\n\trr.Lock()\n\tdefer rr.Unlock()\n\tif rr.signals != nil && !rr.signalsClosed {\n\t\tclose(rr.signals)\n\t\trr.signalsClosed = true\n\t}\n}", "title": "" }, { "docid": "39c1e76fe323cfd1d1865cfb3a698e7b", "score": "0.6097329", "text": "func (o *AP) Close() error {\n\to.tq.PostTask(func() {\n\t\to.internalClose()\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "6ce3ae80a257236da7cbd0dbcf87d846", "score": "0.60832053", "text": "func (t *Thread) Close() (err error) {\n\tclose(t.queue)\n\treturn\n}", "title": "" }, { "docid": "db237d3a37eff7a600548de0dce0a2ae", "score": "0.6078665", "text": "func (b *bolt3) Close(ctx context.Context) {\n\tb.log.Infof(log.Bolt3, b.logId, \"Close\")\n\tif b.state != bolt3_dead {\n\t\tb.out.appendGoodbye()\n\t\tb.out.send(ctx, b.conn)\n\t}\n\tif err := b.conn.Close(); err != nil {\n\t\tb.log.Warnf(log.Driver, b.serverName, \"could not close underlying socket\")\n\t}\n\tb.state = bolt3_dead\n}", "title": "" }, { "docid": "f00471803fec1b2508ca040cdcb87ec3", "score": "0.6065801", "text": "func (pq *PipelineQueue) Quit() {\n\tgo func() {\n\t\tpq.QuitChan <- struct{}{}\n\t}()\n}", "title": "" }, { "docid": "166efd4b41599559496445d02cf5a8a6", "score": "0.6061262", "text": "func (qp *QPool) Close() {\n\tqp.Lock()\n\tif !qp.closed {\n\t\tqp.closed = true\n\t\tclose(qp.closedCh)\n\t}\n\tqp.Unlock()\n}", "title": "" }, { "docid": "fc49d4998d753dc0ed43d785c20b2087", "score": "0.6056081", "text": "func (rl *qpsRateLimiter) Close() {\n\trl.quit <- true\n}", "title": "" }, { "docid": "86d8f5e9763e014b4798f76c430e55e6", "score": "0.60546416", "text": "func (pb *PBServer) kill() {\n pb.dead = true\n pb.l.Close()\n}", "title": "" }, { "docid": "564368412f38843c2ba3d09ec094c0f1", "score": "0.6048933", "text": "func (f *Forwarder) Close() {\n\t// Close idle connections if not local\n\tif !f.Local {\n\t\tdefer f.Client.Close()\n\t}\n\tf.stop <- true\n\t// Waiting forwarder stopped routine is done\n\t<-f.done\n\tif f.EventsPiped > 0 {\n\t\tf.Collect()\n\t}\n\tif f.logfile != nil {\n\t\tf.logfile.Close()\n\t}\n}", "title": "" }, { "docid": "522a8c3750c3255a40d2f6e540e13b5e", "score": "0.60458416", "text": "func (b *BatchRunner) Close() {\n\tb.closeFixtureChannels()\n\tclose(b.requests)\n\t<-b.closed\n}", "title": "" }, { "docid": "fdfbb40ffc209ed2cac9ede57527f863", "score": "0.60411394", "text": "func (p *MessageProducer) Close() {\n p.producer.Close()\n p.open = false\n}", "title": "" }, { "docid": "fbca90ecf31171d5d924fb1c27249638", "score": "0.6040352", "text": "func (f *ForgedPacketGenerator) Close() {\n\tf.close <- true\n}", "title": "" }, { "docid": "9cddc0b48618c14a9b2be648146ce068", "score": "0.6037877", "text": "func (p *Pipeline) closing(cl *Client) {\n\n\tfor e := p.channelHandlers.Front(); e != nil; e = e.Next() {\n\t\tif chMap, ok := e.Value.(map[string]ChannelHandler); ok {\n\t\t\tfor _, ch := range chMap {\n\t\t\t\tif p.lockedBy == nil || p.lockedBy == ch {\n\t\t\t\t\tch.Closing(cl)\n\t\t\t\t} else {\n\t\t\t\t\tif DEBUG {\n\t\t\t\t\t\tlog.Printf(\"WARN: %s cannot handle Closing, pipeline is locked by:%s\", ch, p.lockedBy)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "df58be33dd2522030d11d92ea827c714", "score": "0.6035588", "text": "func (p *Pool) Close() {\n\tp.syncClose.Do(func() {\n\t\tp.guard.Lock()\n\t\tp.cancel()\n\t\tp.guard.Unlock()\n\t\tp.taskDeque.close()\n\n\t\tp.arbiterWg.Wait()\n\n\t\tworkers := make([]*customWorker, len(p.workers))\n\t\tcopy(workers, p.workers)\n\n\t\tfor _, worker := range workers {\n\t\t\tworker.Release()\n\t\t\tfor task := range worker.taskChan {\n\t\t\t\t_ = p.taskDeque.put(task, true)\n\t\t\t}\n\t\t}\n\n\t\tfor range p.taskDeque.tasks {\n\t\t\tp.waitWg.Done()\n\t\t}\n\n\t\tp.Wait()\n\n\t\tp.workerWg.Wait()\n\t})\n}", "title": "" }, { "docid": "00d59bcb11fde5471d3fe29db1a1f028", "score": "0.60355633", "text": "func (c *Broker) close() error {\n\tc.stompConnection.Disconnect(stompngo.Headers{})\n\treturn c.netConnection.Close()\n}", "title": "" }, { "docid": "06007918be69041b9d3a652dd077d8ba", "score": "0.6034081", "text": "func (b *SimBus) Close() {\n\tdefer func() {\n\t\t// handle the case when the done/term channels are already closed\n\t\t_ = recover()\n\t}()\n\n\tlog.Println(\"closing bus\")\n\tclose(b.done)\n\t<-b.term\n}", "title": "" }, { "docid": "210d311b972cd395b20d975b0c94bba3", "score": "0.60332537", "text": "func (f *FakeK8s) Close() {\n\tf.subsMutex.Lock()\n\tdefer f.subsMutex.Unlock()\n\n\tclose(f.eventStopper)\n\tfor _, ch := range f.stoppers {\n\t\tclose(ch)\n\t}\n\n\tf.server.Listener.Close()\n\t//f.server.Close()\n\n}", "title": "" }, { "docid": "c1ed7e37017ad7db225ad6ee9b0a97be", "score": "0.60316855", "text": "func (cee *ChannelEngineEndpoint) Close() {\n}", "title": "" }, { "docid": "2e99d84c67cc214095d62c4ccc5f1dbe", "score": "0.6024803", "text": "func (p *Pool) Close() {\n\tfor i := 0; i < len(p.workers); i++ {\n\t\tp.workers[i].stop()\n\t}\n\tfor i := 0; i < len(p.workers); i++ {\n\t\tp.workers[i].join()\n\t}\n\tclose(p.reqChan)\n}", "title": "" }, { "docid": "83c15c378d9224097bbc161161c0d7ab", "score": "0.602386", "text": "func (s *MockCCComm) Quit() {\n\tif !s.skipClose {\n\t\tclose(s.recvStream)\n\t\tclose(s.sendStream)\n\t}\n}", "title": "" }, { "docid": "e69c655b529f760e7a7154ac2cb60f4a", "score": "0.6023149", "text": "func CloseChannel(){\n\tclose(In)\n}", "title": "" }, { "docid": "7e0a1e244b426222724488508d94e34e", "score": "0.60212916", "text": "func (q *Persistence) Close(clean bool) error {\n\tq.log.Info(\"queue is closing\", log.Any(\"clean\", clean))\n\tdefer q.log.Info(\"queue has closed\")\n\n\tq.Kill(nil)\n\terr := q.Wait()\n\tp := path.Join(q.cfg.Location, \"queue\", q.backend.cfg.Name)\n\tif err != nil {\n\t\tq.log.Warn(\"queue closes failed\", log.Any(\"clean\", clean))\n\t\tif clean && utils.FileExists(p) {\n\t\t\tos.RemoveAll(p)\n\t\t}\n\t\treturn err\n\t}\n\tif clean && utils.FileExists(p) {\n\t\tos.RemoveAll(p)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6208d8785772f27bdefe17502112a2c2", "score": "0.60183257", "text": "func Closeq() {\n\tch.Close()\n\tconn.Close()\n}", "title": "" }, { "docid": "dafef1e5fbe7da790f6c1e7bfe0cf498", "score": "0.6016907", "text": "func (m *MQ) Close() {\n\tm.Lock()\n\tm.closed = true\n\tm.Unlock()\n}", "title": "" }, { "docid": "c14091a7f2d0b14e2f6946911162dca6", "score": "0.6015586", "text": "func (pb *PBServer) kill() {\n pb.dead = true\n pb.l.Close()\n}", "title": "" } ]
0710796df38ab29d98bb9785111c11b1
SetValueFilterIn key must be using plurar
[ { "docid": "aa963cbadb9ea2d68d75f8bc13587124", "score": "0.7111935", "text": "func SetValueFilterIn(params map[string]interface{}, key string, filters *bson.D) {\n\tif params[key] != nil && params[key] != \"\" {\n\t\t// remove plural last word, ex: ids -> id\n\t\tfield := key[:len(key)-1]\n\t\t*filters = append(*filters, bson.E{field, bson.M{\n\t\t\t\"$in\": params[key],\n\t\t}})\n\t}\n}", "title": "" } ]
[ { "docid": "e798468f596946291d59d2d68b17f8cd", "score": "0.615102", "text": "func (rf *Filter) Set(ctx context.Context, cli *bloomd.Client, k bloomd.Key) (bool, error) {\n\tcurrUnit := rf.currUnit()\n\tf := cli.GetFilter(rf.nameForUnit(currUnit))\n\treturn f.Set(k)\n}", "title": "" }, { "docid": "c60b337e4677884d47ab8937c8724c52", "score": "0.59035665", "text": "func (f Filter) Set(key, val string) {\n\tf[key] = val\n}", "title": "" }, { "docid": "28943138523269c5e700a2ed35786357", "score": "0.5714144", "text": "func (f *Filter) Set(key string, value interface{}) error {\n\tswitch v := value.(type) {\n\tcase string:\n\t\tf.params[key] = v\n\tcase int:\n\t\tf.params[key] = strconv.Itoa(v)\n\tcase int32:\n\t\tf.params[key] = strconv.FormatInt(int64(v), 10)\n\tcase int64:\n\t\tf.params[key] = strconv.FormatInt(v, 10)\n\tcase float32:\n\t\tf.params[key] = strconv.FormatFloat(float64(v), 'f', 2, 64)\n\tcase float64:\n\t\tf.params[key] = strconv.FormatFloat(float64(v), 'f', 2, 64)\n\tdefault:\n\t\treturn errors.New(\"Filter can only accept numeric (int32,int64,float32,float64) or string values\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fe668081f8c8c9db9f8650d0672719f8", "score": "0.57111573", "text": "func (*lifoGroupFilter) SetKey(string) {}", "title": "" }, { "docid": "18d4fcf1ba9f70cca4e442af81559b7c", "score": "0.5634117", "text": "func (r ApiDatacentersApplicationloadbalancersGetRequest) Filter(key string, value string) ApiDatacentersApplicationloadbalancersGetRequest {\n\tfilterKey := fmt.Sprintf(FilterQueryParam, key)\n\tr.filters[filterKey] = []string{value}\n\treturn r\n}", "title": "" }, { "docid": "dd7330133306297418a0b13ca3fe8df5", "score": "0.556517", "text": "func (_this *CanvasRenderingContext2D) SetFilter(value string) {\n\tinput := value\n\t_this.Value_JS.Set(\"filter\", input)\n}", "title": "" }, { "docid": "02c11bdddd5adda85b0a0e8be8fab0b7", "score": "0.5530095", "text": "func (r ApiImagesGetRequest) Filter(key string, value string) ApiImagesGetRequest {\n\tfilterKey := fmt.Sprintf(FilterQueryParam, key)\n\tr.filters[filterKey] = []string{value}\n\treturn r\n}", "title": "" }, { "docid": "20969d21b1c2e9c6f15080f5eb031ce0", "score": "0.55158734", "text": "func (r ApiDatacentersApplicationloadbalancersFlowlogsGetRequest) Filter(key string, value string) ApiDatacentersApplicationloadbalancersFlowlogsGetRequest {\n\tfilterKey := fmt.Sprintf(FilterQueryParam, key)\n\tr.filters[filterKey] = []string{value}\n\treturn r\n}", "title": "" }, { "docid": "7a882fd27842a6c691e0271190f48d0a", "score": "0.54817575", "text": "func (_this *OffscreenCanvasRenderingContext2D) SetFilter(value string) {\n\tinput := value\n\t_this.Value_JS.Set(\"filter\", input)\n}", "title": "" }, { "docid": "74e44b2a9a7f8248b92b3fb5de52f8ac", "score": "0.5458678", "text": "func (f *Filter) Set(filter, value string) {\n\tf.v.Set(filter, value)\n}", "title": "" }, { "docid": "505a199ed4acd55639ce651bf1d10338", "score": "0.5442932", "text": "func AddLabelFilter(key, value string) {\n\tif LabelsFilter == nil {\n\t\tLabelsFilter = make(map[string]string)\n\t}\n\n\tLabelsFilter[key] = value\n}", "title": "" }, { "docid": "e90cf0f2585bbbf546e845a5b8555e91", "score": "0.543808", "text": "func (f *Filter) Add(key string) { f.AddBytes([]byte(key)) }", "title": "" }, { "docid": "b27493f98a3fa7926c82f6ce979a6f44", "score": "0.5421556", "text": "func SetValueFilterOr(keys []string, value interface{}, filters *bson.D) {\n\tif value != \"\" {\n\t\tvar fields []interface{}\n\t\tfor i := 0; i < len(keys); i++ {\n\t\t\tfields = append(fields, bson.D{{keys[i], primitive.Regex{Pattern: value.(string), Options: \"i\"}}})\n\t\t}\n\t\t*filters = append(*filters, bson.E{\"$or\", fields})\n\t}\n}", "title": "" }, { "docid": "e0c883a20d1bcfd2d19242d42aa01b1b", "score": "0.54127336", "text": "func (f Filter) Set(key Key) (bool, error) {\n\terr := f.sendSingleOp(\"s\", key)\n\tif err != nil {\n\t\treturn false, f.client.handleWriteError(err)\n\t}\n\n\treturn f.readSingle()\n}", "title": "" }, { "docid": "156cd78841f482289959b1a889d70a7b", "score": "0.5399245", "text": "func (f filterMap) setTollIDFilter() filterMap {\n\tif f.ticket != nil && len(f.ticket.TollID) > 0 {\n\t\tf.filter[\"tollId\"] = f.ticket.TollID\n\t}\n\treturn f\n}", "title": "" }, { "docid": "a578cb02b2dc08da942c43bc6e615ddf", "score": "0.5390733", "text": "func (r ApiDatacentersApplicationloadbalancersForwardingrulesGetRequest) Filter(key string, value string) ApiDatacentersApplicationloadbalancersForwardingrulesGetRequest {\n\tfilterKey := fmt.Sprintf(FilterQueryParam, key)\n\tr.filters[filterKey] = []string{value}\n\treturn r\n}", "title": "" }, { "docid": "873c222c8c160b3b81899e73dfa37363", "score": "0.53634405", "text": "func UpdateFilter(m bson.M, filter map[string]string) error {\n\tfor k, v := range filter {\n\t\tm[k] = interface{}(v)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6419e86f26836e87260a5f2f0a752b5f", "score": "0.5305902", "text": "func Filter(key, value string) RequestOptions {\n return func(req *http.Request) {\n q := req.URL.Query()\n q.Add(key, value)\n req.URL.RawQuery = strings.Replace(q.Encode(), \"%2B\", \"+\", 1)\n }\n}", "title": "" }, { "docid": "8862edbc7cb4f730c313584b547d5590", "score": "0.52974236", "text": "func (h *JSONAPIHandler) SetPresetFilterValues(\n\tfilter *jsonapi.FilterField,\n\tvalues ...interface{},\n) error {\n\tif len(filter.Values) != 0 {\n\t\tfv := filter.Values[0]\n\t\t(*fv).Values = values\n\t\treturn nil\n\t} else if len(filter.Relationships) != 0 {\n\t\tif len(filter.Relationships[0].Values) != 0 {\n\t\t\tfv := filter.Relationships[0].Values[0]\n\t\t\t(*fv).Values = values\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.New(\"Invalid preset filter.\")\n}", "title": "" }, { "docid": "e34aa97a7095b8d25d65b54b61ac00d5", "score": "0.52952296", "text": "func (repository *Repository) SetFilter(newFilter string) error {\n\tsql := \"UPDATE `repository` SET `filter`=? WHERE `id`=?\"\n\tquery, _ := database.Connection.Prepare(sql)\n\t_, err := query.Exec(newFilter, repository.ID)\n\treturn err\n}", "title": "" }, { "docid": "fa815dcece62c377f6a0e8e8c7ac9ca7", "score": "0.52933633", "text": "func translateFilter(accessLog *envoyal.AccessLog, inFilter *als.AccessLogFilter) error {\n\tif inFilter == nil {\n\t\treturn nil\n\t}\n\n\t// We need to validate the enums in the filter manually because the protobuf libraries\n\t// do not validate them, for \"compatibilty reasons\". It's nicer to catch them here instead\n\t// of sending bad configs to Envoy.\n\tif err := validateFilterEnums(inFilter); err != nil {\n\t\treturn err\n\t}\n\n\tbytes, err := proto.Marshal(inFilter)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutFilter := &envoyal.AccessLogFilter{}\n\tif err := proto.Unmarshal(bytes, outFilter); err != nil {\n\t\treturn err\n\t}\n\n\taccessLog.Filter = outFilter\n\treturn nil\n}", "title": "" }, { "docid": "4d7e1fea3c0e1a9fe6992673958633b4", "score": "0.528963", "text": "func (r ApiGetKubernetesTrustedRegistriesPolicyListRequest) Filter(filter string) ApiGetKubernetesTrustedRegistriesPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "c753df88adaaf64457d1c642f633c399", "score": "0.5197385", "text": "func (to *tableOp) SetFilter(filter.Filter) error {\n\t// Doesn't make sense on this kind of RPC.\n\treturn errors.New(\"Cannot set filter on admin operations.\")\n}", "title": "" }, { "docid": "3b4cc5e88581dd53d68b1b28e0d10aec", "score": "0.5194773", "text": "func (r ApiGetApplianceExternalSyslogSettingListRequest) Filter(filter string) ApiGetApplianceExternalSyslogSettingListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "76de9765222985fe41bc7fd2d9679a0e", "score": "0.51716256", "text": "func key_filter(cName, cKeyListExpr, cFilterExpr *C.char) *C.char {\n\tcollectionName := C.GoString(cName)\n\tkeyListExpr := C.GoString(cKeyListExpr)\n\tfilterExpr := C.GoString(cFilterExpr)\n\n\terror_clear()\n\tkeyList := []string{}\n\tif err := json.Unmarshal([]byte(keyListExpr), &keyList); err != nil {\n\t\terror_dispatch(err, \"Unable to unmarshal keys\", err)\n\t\treturn C.CString(\"\")\n\t}\n\tkeys, err := dataset.KeyFilter(collectionName, keyList, filterExpr)\n\tif err != nil {\n\t\terror_dispatch(err, \"filter error, %s\", err)\n\t\treturn C.CString(\"\")\n\t}\n\tsrc, err := json.Marshal(keys)\n\tif err != nil {\n\t\terror_dispatch(err, \"Can't marshal filtered keys, %s\", err)\n\t\treturn C.CString(\"\")\n\t}\n\ttxt := fmt.Sprintf(\"%s\", src)\n\treturn C.CString(txt)\n}", "title": "" }, { "docid": "15a6bcfb33c27ea97ac2a20faca3dced", "score": "0.5156787", "text": "func (api *RestMessageAPI) setFilters(r *http.Request, msg *protocol.Message) {\n\tfor name, values := range r.URL.Query() {\n\t\tif strings.HasPrefix(name, filterPrefix) && len(values) > 0 {\n\t\t\tmsg.SetFilter(filterName(name), values[0])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c674319d6a9e7fb179153d7abae10038", "score": "0.51305366", "text": "func (f filterMap) setTicketIDFilter() filterMap {\n\tif f.ticket != nil && len(f.ticket.TicketID) > 0 {\n\t\tf.filter[\"ticketId\"] = f.ticket.TicketID\n\t}\n\treturn f\n}", "title": "" }, { "docid": "1f2cbbadae723496af06e27894d2e1a4", "score": "0.5129541", "text": "func (res *Resource) Filter(filter *Filter) {\n\tres.filters[filter.Name] = filter\n}", "title": "" }, { "docid": "4b27a7697e173f31621451263651acb0", "score": "0.50983304", "text": "func (r ApiGetApplianceCertificateSettingListRequest) Filter(filter string) ApiGetApplianceCertificateSettingListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "5c90aada8e64405c041440153a73eb05", "score": "0.5070537", "text": "func (r ApiGetEquipmentPsuListRequest) Filter(filter string) ApiGetEquipmentPsuListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "d7eee22db17229021fdba6345f52c2a3", "score": "0.50684345", "text": "func (r ApiGetCapabilityPsuDescriptorListRequest) Filter(filter string) ApiGetCapabilityPsuDescriptorListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "f8c9f2df2fcd1bd2cdf19ff58f88951f", "score": "0.5054819", "text": "func (f *Type) InitFilter(id string, config skipper.FilterConfig) error {\n\tif len(config) != 2 {\n\t\treturn errors.New(\"invalid number of args, expecting 2\")\n\t}\n\n\tkey, ok := config[0].(string)\n\tif !ok {\n\t\treturn errors.New(\"invalid config type, expecting string\")\n\t}\n\n\tvalue, ok := config[1].(string)\n\tif !ok {\n\t\treturn errors.New(\"invalid config type, expecting string\")\n\t}\n\n\tf.key = key\n\tf.value = value\n\tf.SetId(id)\n\treturn nil\n}", "title": "" }, { "docid": "138fa66119863f784ddfcecc24fa671d", "score": "0.50304925", "text": "func (r ApiGetEquipmentPsuControlListRequest) Filter(filter string) ApiGetEquipmentPsuControlListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "3b3075b836a56b83c72fc4fb81268d25", "score": "0.50185734", "text": "func (f *Filter) Set(key string) (bool, error) {\n\tcmd := fmt.Sprintf(\"%s %s %s\", FilterSetCmd, f.Name, f.getKey(key))\n\n\tresp, err := f.Conn.SendAndReceive(cmd)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif resp == FilterYes || resp == FilterNo {\n\t\treturn resp == FilterYes, nil\n\t}\n\n\treturn false, errInvalidResponse(resp)\n}", "title": "" }, { "docid": "20505862186686be196b7a118670cbc9", "score": "0.50137275", "text": "func (r ApiGetCapabilityPsuManufacturingDefListRequest) Filter(filter string) ApiGetCapabilityPsuManufacturingDefListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "26859d36d7ce736dbf789188079df8f0", "score": "0.500703", "text": "func (p *StData) Filter(keys ...string) StData {\n\tdatanew := make(StData)\n\tclone := *p\n\tfor k, vl := range clone {\n\t\tif !utl.InStr(k, keys...) {\n\t\t\tdatanew[k] = vl\n\t\t}\n\t}\n\treturn datanew\n}", "title": "" }, { "docid": "ec3c16aae80f8066c618a5d15ab6dfaa", "score": "0.49921837", "text": "func addParameterWithOriginalName(key string, value string, normalizedNames map[string]string, values t.Values) {\r\n\tlowercaseKey := strings.ToLower(key)\r\n\tif paramName, ok := normalizedNames[lowercaseKey]; ok {\r\n\t\tvalues.Set(paramName, t.String(value))\r\n\t} else {\r\n\t\tvalues.Set(key, t.String(value))\r\n\t}\r\n}", "title": "" }, { "docid": "09554f96f75aa8f3cb7b8120705b6cd6", "score": "0.49837753", "text": "func (monitor *EventMonitor) SetFilter(eventid uint64, filter string) error {\n\tmonitor.lock.Lock()\n\tdefer monitor.lock.Unlock()\n\n\tif event, ok := monitor.events.lookup(eventid); ok {\n\t\tif event.eventType == EventTypeExternal {\n\t\t\treturn errors.New(\"Cannot set filters for external events\")\n\t\t}\n\t\tfor _, source := range event.sources {\n\t\t\tif err := source.SetFilter(filter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t} else {\n\t\treturn fmt.Errorf(\"Event %d does not exist\", eventid)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "23b042373b8e126f82b11894fc77be3a", "score": "0.49800664", "text": "func (f filterMap) setRegistrationNoFilter() filterMap {\n\tif f.ticket != nil && len(f.ticket.RegistrationNo) > 0 {\n\t\tf.filter[\"vehicleRegistrationNo\"] = f.ticket.RegistrationNo\n\t}\n\treturn f\n}", "title": "" }, { "docid": "24249c331d83c1605cebc87f74c37ceb", "score": "0.4968772", "text": "func (f *DefaultFilterEngine) SetFilter(name string, flag bool) error {\n\t// Find filter struct name\n\tfilter, ok := f.filters[name]\n\tif !ok {\n\t\treturn fmt.Errorf(\"couldn't find filter with name %q\", name)\n\t}\n\n\tfilter.Enabled = flag\n\tf.filters[name] = filter\n\treturn nil\n}", "title": "" }, { "docid": "660b6a8a403401837d3de5e7083fc8a9", "score": "0.49618042", "text": "func (m *ConditionalAccessApplications) SetApplicationFilter(value ConditionalAccessFilterable)() {\n err := m.GetBackingStore().Set(\"applicationFilter\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3bfb0916b830f05eee05922562dfd891", "score": "0.49609068", "text": "func newTenantLabelingFilter(labelKey string, extractTenantFunc func(request *web.Request) (string, error)) *TenantFilter {\n\treturn &TenantFilter{\n\t\tLabelKey: labelKey,\n\t\tFilterName: TenantLabelingFilterName,\n\t\tMethods: []string{http.MethodPost},\n\t\tExtractTenant: extractTenantFunc,\n\t\tLabelingFunc: func(request *web.Request, labelKey, labelValue string) error {\n\t\t\tctx := request.Context()\n\t\t\tcurrentLabelValues := gjson.GetBytes(request.Body, fmt.Sprintf(\"labels.%s\", labelKey)).Raw\n\t\t\tvar path string\n\t\t\tvar obj interface{}\n\t\t\tif len(currentLabelValues) != 0 {\n\t\t\t\tpath = fmt.Sprintf(\"labels.%s.-1\", labelKey)\n\t\t\t\tobj = labelValue\n\t\t\t} else {\n\t\t\t\tpath = fmt.Sprintf(\"labels.%s\", labelKey)\n\t\t\t\tobj = []string{labelValue}\n\t\t\t}\n\n\t\t\tvar err error\n\t\t\trequest.Body, err = sjson.SetBytes(request.Body, path, obj)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"could not add label with key %s and value %s: %s to request body during resource creation\", labelKey, labelValue, err)\n\t\t\t}\n\n\t\t\tlog.C(ctx).Infof(\"Successfully added label with key %s and value %s to request body during resource creation\", labelKey, labelValue)\n\n\t\t\treturn nil\n\t\t},\n\t}\n}", "title": "" }, { "docid": "cd75bfb85c1cdaddbbc17a24b9c41551", "score": "0.49545887", "text": "func (k *kstreamConsumer) SetFilter(filter filter.Filter) { k.filter = filter }", "title": "" }, { "docid": "9e0aa9897011cd182482ad28267afcd4", "score": "0.49521407", "text": "func (r ApiGetKubernetesVirtualMachineInfrastructureProviderListRequest) Filter(filter string) ApiGetKubernetesVirtualMachineInfrastructureProviderListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "80d4ecde2fbd64f883b15df4c020d693", "score": "0.49017152", "text": "func (provider *FileProvider) SetFilter(packetFilter *filter.PacketFilter) (err error) {\n\t//we cant attach bpf filter\n\treturn\n}", "title": "" }, { "docid": "17b650284e12dc01bb172233f3d6bd0b", "score": "0.48959523", "text": "func Key(key string) Filter {\n\tif key == \"\" {\n\t\treturn TrueFilter\n\t}\n\treturn func(f Feature) bool { return f.Key == key }\n}", "title": "" }, { "docid": "86d934c53e465bde3d2485020f79e1b3", "score": "0.48952752", "text": "func AccelMapAddFilter(filter string) {\n\tcstr := C.CString(filter)\n\tdefer C.free(unsafe.Pointer(cstr))\n\n\tC.gtk_accel_map_add_filter((*C.gchar)(cstr))\n}", "title": "" }, { "docid": "be553195ce5af1c4e0afeef4f4b4c18f", "score": "0.48938885", "text": "func (f *MeasurementFilter) Filter(key []byte) bool {\n\tseriesKey, _ := tsm1.SeriesAndFieldFromCompositeKey(key)\n\tmeasurement, _ := models.ParseKeyBytes(seriesKey)\n\n\treturn f.filter.Filter(measurement)\n}", "title": "" }, { "docid": "d998bf16719354fd3be2684757ee2da8", "score": "0.4872891", "text": "func (f *ObjectFilter) filter(name string, exp string, value interface{}) *ObjectFilter {\n\tfilter := []interface{}{name, exp, value}\n\tf.attributeFilters = append(f.attributeFilters, filter)\n\treturn f\n}", "title": "" }, { "docid": "cce5238ff532cc421de20b55e1d93bc0", "score": "0.48671514", "text": "func (r ApiGetKubernetesConfigResultEntryListRequest) Filter(filter string) ApiGetKubernetesConfigResultEntryListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "5062f91d8724c27d7203d3d00b780637", "score": "0.48527485", "text": "func (s *StacksWidget) Filter(filter string) {\n\ts.Lock()\n\tdefer s.Unlock()\n\ts.filterPattern = filter\n}", "title": "" }, { "docid": "6750840883c90fd74ddab9cfeceb7edb", "score": "0.4844363", "text": "func (f *PassFilter) Filter(key []byte) bool {\n\treturn false\n}", "title": "" }, { "docid": "646e0c2f017ad64bd49d202c7d44118f", "score": "0.48308814", "text": "func (r ApiGetApplianceDiagSettingListRequest) Filter(filter string) ApiGetApplianceDiagSettingListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "b6141dcfde06b5fdf7582b66449843ca", "score": "0.48281842", "text": "func (f *Filters) AddFilter(key, op, value string) {\n\tfilter := &filter{Key: key, Op: op, Val: value}\n\tf.f = append(f.f, filter)\n}", "title": "" }, { "docid": "b6141dcfde06b5fdf7582b66449843ca", "score": "0.48281842", "text": "func (f *Filters) AddFilter(key, op, value string) {\n\tfilter := &filter{Key: key, Op: op, Val: value}\n\tf.f = append(f.f, filter)\n}", "title": "" }, { "docid": "b927d7694656272c1dccc4b28ba2709f", "score": "0.48128927", "text": "func (u *URL) setPrefixAndFilter() error {\n\tif u.raw {\n\t\treturn nil\n\t}\n\n\tif loc := strings.IndexAny(u.Path, globCharacters); loc < 0 {\n\t\tu.Delimiter = s3Separator\n\t\tu.Prefix = u.Path\n\t} else {\n\t\tu.Prefix = u.Path[:loc]\n\t\tu.filter = u.Path[loc:]\n\t}\n\n\tfilterRegex := matchAllRe\n\tif u.filter != \"\" {\n\t\tfilterRegex = strutil.WildCardToRegexp(u.filter)\n\t}\n\tfilterRegex = regexp.QuoteMeta(u.Prefix) + filterRegex\n\tfilterRegex = strutil.MatchFromStartToEnd(filterRegex)\n\tfilterRegex = strutil.AddNewLineFlag(filterRegex)\n\tr, err := regexp.Compile(filterRegex)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.filterRegex = r\n\treturn nil\n}", "title": "" }, { "docid": "50c5e53741b80688f1ac4da1b18e55c0", "score": "0.478118", "text": "func (m *WorkbookFilterCriteria) SetFilterOn(value *string)() {\n err := m.GetBackingStore().Set(\"filterOn\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c2f62b2caf431d21e686d0f39e70453b", "score": "0.47754192", "text": "func (r ApiGetKubernetesSysConfigPolicyListRequest) Filter(filter string) ApiGetKubernetesSysConfigPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "0cbb91e39815f9421b12e214911c6721", "score": "0.477391", "text": "func bpffilter(handle *pcap.Handle, filter string){\n\n err = handle.SetBPFFilter(filter)\n if err != nil {\n log.Fatal(err)\n }\n\n}", "title": "" }, { "docid": "db5330ae958da645535d0bf3a3f0dc64", "score": "0.4772845", "text": "func (p *ProviderMongoExploded) SetKVDocumentWhere(kv, where KVList) {\n\tvar docids []string\n\terr := p.db_mq.C(\"records\").Find(KVList2ExplodedBsonMany(where)).Distinct(\"docid\", &docids)\n\tif err != nil {\n\t\tReport.Fatal(\"Error selecting documents: %v\", err)\n\t}\n\n\tbson_docs := []bson.M{}\n\tfor _, kv := range kv {\n\t\tfor _, docid := range docids {\n\t\t\tbson_docs = append(bson_docs, bson.M{\"key\": kv[0], \"value\": kv[1], \"docid\": docid})\n\t\t}\n\t}\n\terr = p.db_mq.C(\"records\").Insert(bson_docs)\n\tif err != nil {\n\t\tReport.Fatal(\"Error inserting documents: %v\", err)\n\t}\n}", "title": "" }, { "docid": "d46febf9e77e4a5b436a4aa6cc5d8eb8", "score": "0.4759151", "text": "func (r ApiGetApplianceSetupInfoListRequest) Filter(filter string) ApiGetApplianceSetupInfoListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "0e18e7e736ccb685e105cc28098c0dbd", "score": "0.47552866", "text": "func newTicketFilter(ticket *TicketToll) filterMap {\n\treturn filterMap{\n\t\tticket: ticket,\n\t\tfilter: make(map[string]interface{}, 0),\n\t}\n}", "title": "" }, { "docid": "24325e43d839781dad9a0d7140984a63", "score": "0.47362968", "text": "func (r ApiGetApplianceDataExportPolicyListRequest) Filter(filter string) ApiGetApplianceDataExportPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "d8c84cf341bff91dbd58814c2157af90", "score": "0.47347277", "text": "func (f *RawSerieFilter) Filter(key []byte) bool {\n\tseriesKey, _ := tsm1.SeriesAndFieldFromCompositeKey(key)\n\treturn f.filter.Filter(seriesKey)\n}", "title": "" }, { "docid": "508c0d5b0a39c276bd2d2812f8626179", "score": "0.47305724", "text": "func (r ApiGetKubernetesIngressListRequest) Filter(filter string) ApiGetKubernetesIngressListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "92c36fca00da0becd8221ec8e47e10cd", "score": "0.47243816", "text": "func (rc *RouteConfig) Filter(filters map[string]string) bool {\n\tfor key, value := range filters {\n\t\tif rc.Get(key) != value {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "12b0a22112bc7e298f80f65e9a5c1a44", "score": "0.47227073", "text": "func (r ApiGetCapabilityAdapterUnitDescriptorListRequest) Filter(filter string) ApiGetCapabilityAdapterUnitDescriptorListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "6259182b23712fe2c74161efe2317397", "score": "0.47144634", "text": "func (f *Filters) Set(field, operator, value string) {\n\tif value == \"\" {\n\t\t// UNSET for empty values\n\t\treturn\n\t}\n\tr := reflect.ValueOf(f)\n\tfd := reflect.Indirect(r).FieldByName(field)\n\tif v, err := strconv.ParseBool(value); err == nil {\n\t\tfd.Set(reflect.ValueOf(map[string]bool{operator: v}))\n\t} else {\n\t\tfd.Set(reflect.ValueOf(map[string]string{operator: value}))\n\t}\n}", "title": "" }, { "docid": "1418c4e7e50ecebe7d85c34c34f89e2e", "score": "0.47113127", "text": "func (r ApiGetKubernetesVirtualMachineInfraConfigPolicyListRequest) Filter(filter string) ApiGetKubernetesVirtualMachineInfraConfigPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "591841223d3aae47e38db58c1986afe6", "score": "0.4705769", "text": "func (p *moduleActionProps) setFilter(filter *types.ModuleFilter) *moduleActionProps {\n\tp.filter = filter\n\treturn p\n}", "title": "" }, { "docid": "9e8791a5760f03218b3d2712c2a200a0", "score": "0.46985182", "text": "func (r ApiGetKubernetesStatefulSetListRequest) Filter(filter string) ApiGetKubernetesStatefulSetListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "234b1a4147bfe5e38274d6f33a786b4a", "score": "0.4689588", "text": "func (r ApiGetEquipmentTpmListRequest) Filter(filter string) ApiGetEquipmentTpmListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "48bd61895682d233acda5cf6ad24c77d", "score": "0.468643", "text": "func (tfs *TagFilters) Add(key, value []byte, isNegative, isRegexp bool) error {\n\t// Verify whether tag filter is empty.\n\tif len(value) == 0 {\n\t\t// Substitute an empty tag value with the negative match\n\t\t// of `.+` regexp in order to filter out all the values with\n\t\t// the given tag.\n\t\tisNegative = !isNegative\n\t\tisRegexp = true\n\t\tvalue = []byte(\".+\")\n\t}\n\tif isRegexp && string(value) == \".*\" {\n\t\tif !isNegative {\n\t\t\t// Skip tag filter matching anything, since it equals to no filter.\n\t\t\treturn nil\n\t\t}\n\n\t\t// Substitute negative tag filter matching anything with negative tag filter matching non-empty value\n\t\t// in order to filter out all the time series with the given key.\n\t\tvalue = []byte(\".+\")\n\t}\n\n\ttf := tfs.addTagFilter()\n\tif err := tf.Init(tfs.commonPrefix, key, value, isNegative, isRegexp); err != nil {\n\t\treturn fmt.Errorf(\"cannot initialize tagFilter: %w\", err)\n\t}\n\tif tf.isNegative && tf.isEmptyMatch {\n\t\t// We have {key!~\"|foo\"} tag filter, which matches non=empty key values.\n\t\t// So add {key=~\".+\"} tag filter in order to enforce this.\n\t\t// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/546 for details.\n\t\ttfNew := tfs.addTagFilter()\n\t\tif err := tfNew.Init(tfs.commonPrefix, key, []byte(\".+\"), false, true); err != nil {\n\t\t\treturn fmt.Errorf(`cannot initialize {%s=\".+\"} tag filter: %w`, key, err)\n\t\t}\n\t}\n\tif len(tf.graphiteReverseSuffix) > 0 {\n\t\tre := regexp.QuoteMeta(string(tf.graphiteReverseSuffix)) + \".*\"\n\t\ttfNew := tfs.addTagFilter()\n\t\tif err := tfNew.Init(tfs.commonPrefix, graphiteReverseTagKey, []byte(re), false, true); err != nil {\n\t\t\treturn fmt.Errorf(\"cannot initialize reverse tag filter for Graphite wildcard: %w\", err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0910d2839a6475d6989d4a51cd25208f", "score": "0.468533", "text": "func (r ApiGetCapabilityCatalogListRequest) Filter(filter string) ApiGetCapabilityCatalogListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "5e4d68276f306d98e790cc8c1eac4812", "score": "0.4685059", "text": "func (f *HeadlessAuthenticationFilter) FromMap(m map[string]string) error {\n\tfor key, val := range m {\n\t\tswitch key {\n\t\tcase headlessFilterKeyName:\n\t\t\tf.Name = val\n\t\tcase headlessFilterKeyUsername:\n\t\t\tf.Username = val\n\t\tcase headlessFilterKeyState:\n\t\t\tif err := f.State.Parse(val); err != nil {\n\t\t\t\treturn trace.Wrap(err)\n\t\t\t}\n\t\tdefault:\n\t\t\treturn trace.BadParameter(\"unknown filter key %s\", key)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c6b7f3c002523103f9869dc24e89a659", "score": "0.4677987", "text": "func (v *IADsMembers) SetFilter(variant *ole.VARIANT) (err error) {\n\treturn ole.NewError(ole.E_NOTIMPL)\n}", "title": "" }, { "docid": "3e1b4d385e1bc8af6b7416d6f062a8b6", "score": "0.46768013", "text": "func newTenantCriteriaFilter(labelKey string, extractTenantFunc func(request *web.Request) (string, error)) *TenantFilter {\n\treturn &TenantFilter{\n\t\tLabelKey: labelKey,\n\t\tFilterName: TenantCriteriaFilterName,\n\t\tMethods: []string{http.MethodGet, http.MethodPost, http.MethodPatch, http.MethodDelete},\n\t\tExtractTenant: extractTenantFunc,\n\t\tLabelingFunc: func(request *web.Request, labelKey, labelValue string) error {\n\t\t\tctx := request.Context()\n\t\t\tcriterion := query.ByLabel(query.EqualsOperator, labelKey, labelValue)\n\t\t\tvar err error\n\t\t\tctx, err = query.AddCriteria(ctx, criterion)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"could not add label criteria with key %s and value %s: %s\", labelKey, labelValue, err)\n\t\t\t}\n\n\t\t\tlog.C(ctx).Infof(\"Successfully added label criteria with key %s and value %s to context\", labelKey, labelValue)\n\t\t\trequest.Request = request.WithContext(ctx)\n\n\t\t\treturn nil\n\t\t},\n\t}\n}", "title": "" }, { "docid": "ba818ad503bf635f2eaf30bcf9e41542", "score": "0.46708664", "text": "func AddFilter(sensuurl string, token string, namespace string, filter *v2.EventFilter) error {\n\tsensuRepository := domain.GetSensuRepository()\n\tbodymarshal, err := json.Marshal(&filter)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn sensuRepository.AddResource(sensuurl, token, \"filters\", namespace, bodymarshal)\n}", "title": "" }, { "docid": "9c6e0dca8253eb33c982310bc5f74fd8", "score": "0.46702486", "text": "func (m *SearchRequest_Body_Filter) SetValue(v string) {\n\tif m != nil {\n\t\tm.Value = v\n\t}\n}", "title": "" }, { "docid": "9e726db50c08f68fa76663c1204174a1", "score": "0.46692616", "text": "func (m *Filter) SetValue(v string) {\n\tif m != nil {\n\t\tm.Value = v\n\t}\n}", "title": "" }, { "docid": "f0dabcd84ba5a56fc0a0d791f4918150", "score": "0.46628892", "text": "func (r ApiGetApplianceAutoRmaPolicyListRequest) Filter(filter string) ApiGetApplianceAutoRmaPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "6403ceda5f5ef618944f2d6a5435b7ee", "score": "0.4658246", "text": "func validTagFilters(v interface{}, k string) (ws []string, errors []error) {\n\tvalue := v.(string)\n\tif value != \"KEY_ONLY\" && value != \"VALUE_ONLY\" && value != \"KEY_AND_VALUE\" {\n\t\terrors = append(errors, fmt.Errorf(\n\t\t\t\"%q must be one of \\\"KEY_ONLY\\\", \\\"VALUE_ONLY\\\", or \\\"KEY_AND_VALUE\\\"\", k))\n\t}\n\treturn\n}", "title": "" }, { "docid": "b70c4e2ebcab98fdf53f05b1ef5e836b", "score": "0.46549648", "text": "func (r ApiGetKubernetesVersionPolicyListRequest) Filter(filter string) ApiGetKubernetesVersionPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "969f8ad75c8e8bebe0b1d67317e7fcdc", "score": "0.46430442", "text": "func (o *CatalogActionFilter) SetValue(v map[string]interface{}) {\n\to.Value = v\n}", "title": "" }, { "docid": "d42174ff93a83b068ecb190b3c91e996", "score": "0.46418023", "text": "func RegisterFilter(name string, filter FilterFactory) {\n\tfilterRegistry[name] = filter\n}", "title": "" }, { "docid": "dd4e5a0e1e7684ffe597b41797e6d2de", "score": "0.46338227", "text": "func (m *limitersMap) set(key string, val limiter) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tm.ips[key] = val\n}", "title": "" }, { "docid": "f746671d2217d191dbc44e25f51748fa", "score": "0.4625991", "text": "func (r ApiGetKubernetesAddonPolicyListRequest) Filter(filter string) ApiGetKubernetesAddonPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "305f255377493142003ade6e6bd00a94", "score": "0.46254358", "text": "func AddFilter(filter filters.Args, name string, value string) {\n\tfilter.Add(name, value)\n}", "title": "" }, { "docid": "66f03b0a3b5594498e9978329d8dbd76", "score": "0.46224004", "text": "func (r ApiGetCapabilitySiocModuleCapabilityDefListRequest) Filter(filter string) ApiGetCapabilitySiocModuleCapabilityDefListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "07e73ce2ebf0573bfc02b421946a61cb", "score": "0.46123436", "text": "func (r ApiGetCapabilityActionsMetaDataListRequest) Filter(filter string) ApiGetCapabilityActionsMetaDataListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "73615c5eb0e0a1bc102e628269743649", "score": "0.4598847", "text": "func init() {\n\tfilter.Register(limitRegName, &limitCreator{})\n}", "title": "" }, { "docid": "671a786a115c65e3fab6af6a8e297bfc", "score": "0.45985645", "text": "func (p *M3uParser) FilterBy(key string, filters []string, retrieve bool, nestedKey bool) {\n\tif p.isEmpty() {\n\t\tlog.Infof(\"No streams info to filter.\")\n\t\treturn\n\t}\n\tvar key0, key1 string\n\tvar filteredStreams []Channel\n\tif nestedKey {\n\t\tsplittedKey := strings.Split(key, \"-\")\n\t\tkey0, key1 = splittedKey[0], splittedKey[1]\n\t}\n\tif len(filters) == 0 {\n\t\tlog.Warnln(\"Filter word/s missing!!!\")\n\t\treturn\n\t}\n\n\tswitch nestedKey {\n\tcase false:\n\t\tfor _, stream := range p.streamsInfo {\n\t\t\tif val, ok := stream[key]; ok {\n\t\t\t\tfor _, filter := range filters {\n\t\t\t\t\tif retrieve {\n\t\t\t\t\t\tif strings.Contains(strings.ToLower(fmt.Sprintf(\"%v\", val)), strings.ToLower(filter)) {\n\t\t\t\t\t\t\tfilteredStreams = append(filteredStreams, stream)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif !strings.Contains(strings.ToLower(fmt.Sprintf(\"%v\", val)), strings.ToLower(filter)) {\n\t\t\t\t\t\t\tfilteredStreams = append(filteredStreams, stream)\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\tcase true:\n\t\tfor _, stream := range p.streamsInfo {\n\t\t\tif val, ok := stream[key0]; ok {\n\t\t\t\tswitch v := val.(type) {\n\t\t\t\tcase map[string]string:\n\t\t\t\t\tif val, ok := v[key1]; ok {\n\t\t\t\t\t\tfor _, filter := range filters {\n\t\t\t\t\t\t\tif retrieve {\n\t\t\t\t\t\t\t\tif strings.Contains(strings.ToLower(val), strings.ToLower(filter)) {\n\t\t\t\t\t\t\t\t\tfilteredStreams = append(filteredStreams, stream)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif !strings.Contains(strings.ToLower(val), strings.ToLower(filter)) {\n\t\t\t\t\t\t\t\t\tfilteredStreams = append(filteredStreams, stream)\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\tp.streamsInfo = filteredStreams\n}", "title": "" }, { "docid": "9a1bca9ffae103c3fd80f8b48e7682cb", "score": "0.45965722", "text": "func TestFilterParam(t *testing.T) {\n\n\tr, _ := http.NewRequest(\"GET\", \"/:id\", nil)\n\tw := httptest.NewRecorder()\n\n\t// first test that the param filter does not trigger\n\thandler := new(RouteMux)\n\thandler.Get(\"/\", HandlerOk)\n\thandler.Get(\"/:id\", HandlerOk)\n\thandler.FilterParam(\"id\", FilterId)\n\thandler.ServeHTTP(w, r)\n\n\tif w.Code != http.StatusOK {\n\t\tt.Errorf(\"Code set to [%v]; want [%v]\", w.Code, http.StatusOK)\n\t}\n\n\t// now test the param filter does trigger\n\tr, _ = http.NewRequest(\"GET\", \"/admin\", nil)\n\tw = httptest.NewRecorder()\n\thandler.ServeHTTP(w, r)\n\n\tif w.Code != http.StatusUnauthorized {\n\t\tt.Errorf(\"Did not apply Param Filter. Code set to [%v]; want [%v]\", w.Code, http.StatusUnauthorized)\n\t}\n\n}", "title": "" }, { "docid": "9a1bca9ffae103c3fd80f8b48e7682cb", "score": "0.45965722", "text": "func TestFilterParam(t *testing.T) {\n\n\tr, _ := http.NewRequest(\"GET\", \"/:id\", nil)\n\tw := httptest.NewRecorder()\n\n\t// first test that the param filter does not trigger\n\thandler := new(RouteMux)\n\thandler.Get(\"/\", HandlerOk)\n\thandler.Get(\"/:id\", HandlerOk)\n\thandler.FilterParam(\"id\", FilterId)\n\thandler.ServeHTTP(w, r)\n\n\tif w.Code != http.StatusOK {\n\t\tt.Errorf(\"Code set to [%v]; want [%v]\", w.Code, http.StatusOK)\n\t}\n\n\t// now test the param filter does trigger\n\tr, _ = http.NewRequest(\"GET\", \"/admin\", nil)\n\tw = httptest.NewRecorder()\n\thandler.ServeHTTP(w, r)\n\n\tif w.Code != http.StatusUnauthorized {\n\t\tt.Errorf(\"Did not apply Param Filter. Code set to [%v]; want [%v]\", w.Code, http.StatusUnauthorized)\n\t}\n\n}", "title": "" }, { "docid": "5bb5abdd0b9173c06ee7cd2a0a2c4c94", "score": "0.4589673", "text": "func (r ApiGetCapabilityServerDescriptorListRequest) Filter(filter string) ApiGetCapabilityServerDescriptorListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "9d920e0d40780e16d65fe57ad90d73f4", "score": "0.45771673", "text": "func (c *Controller) DockerFilters() map[string][]string {\n labelFilter := \"mapreduced.ctl=\\\"\" + c.LabelValue + \"\\\"\"\n\n return map[string][]string{\"label\": []string{labelFilter}}\n}", "title": "" }, { "docid": "460ec01ce5a1eb6858b3ec6af2cf5f3f", "score": "0.45755798", "text": "func (q *ChangesQuery) Filter(filter string) *ChangesQuery {\n\tif filter != \"\" {\n\t\tq.URLValues.Set(\"filter\", filter)\n\t}\n\treturn q\n}", "title": "" }, { "docid": "05d604ef7e479b801ea1a4de8fd83e01", "score": "0.4575291", "text": "func (r ApiGetKubernetesServiceListRequest) Filter(filter string) ApiGetKubernetesServiceListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "5c553bf5083062bc3abeb52fed47f899", "score": "0.457383", "text": "func (f *Filter) add(t Type, ns, key int) error {\n\trule := NewRule(t, uint32(ns), uint32(key))\n\n\tif err := f.addRule(rule); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "adf8dd835ab864fe37aba846b0986ff0", "score": "0.45734876", "text": "func (r ApiGetEquipmentFruListRequest) Filter(filter string) ApiGetEquipmentFruListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" } ]
72c67b9da0fddc8b057689f0f417b575
The HTTP path for the repository
[ { "docid": "16b83cfa32e356600df3ee9f52fa2e64", "score": "0.53650373", "text": "func (this RepoAddTopicAuditEntry) GetRepositoryResourcePath() *string {\n\treturn this.RepositoryResourcePath\n}", "title": "" } ]
[ { "docid": "7894d6c54739a745be80ab749a6d9380", "score": "0.6972505", "text": "func (r *Registry) Path(repo string, layer Layer) string {\n\treturn r.repoURL(repo) + \"/blobs/\" + layer.Digest\n}", "title": "" }, { "docid": "5080d343467b6f5d234aa850d63b5f91", "score": "0.650212", "text": "func (this Repository) GetURL() string { return this.URL }", "title": "" }, { "docid": "8f6a10cc2454bfe0de94e2713be6f73f", "score": "0.647168", "text": "func (r *ExpectRepository) URL() *url.URL { return r.RepoURL }", "title": "" }, { "docid": "e4215845bec3d94407699438cfe5b1c4", "score": "0.6383145", "text": "func (r *mockRepoForTest) GetPath() string { return \"~/mockRepo/\" }", "title": "" }, { "docid": "49be53982cc61ceb1c3bbeeed8074c37", "score": "0.6211933", "text": "func (r *Repository) getURL(path string) string {\n\n\tsb := &strings.Builder{}\n\n\tsb.WriteString(\"http\")\n\n\tif r.Config.HTTPS {\n\t\tsb.WriteString(\"s\")\n\t}\n\n\tsb.WriteString(fmt.Sprintf(\"://%s:%d/v%d\", r.Config.Hostname, r.Config.Port, r.Config.APIVersion))\n\tif r.Config.PathBase != \"\" {\n\t\tsb.WriteString(\"/\")\n\t\tsb.WriteString(r.Config.PathBase)\n\t}\n\n\tsb.WriteString(path)\n\n\treturn sb.String()\n}", "title": "" }, { "docid": "3452feb530217e59425f8a451eeb44c7", "score": "0.619095", "text": "func (this RepoAccessAuditEntry) GetRepositoryURL() *string { return this.RepositoryURL }", "title": "" }, { "docid": "236db63416cb295c00eb91379e9c0864", "score": "0.61798954", "text": "func (this Repository) GetResourcePath() string { return this.ResourcePath }", "title": "" }, { "docid": "53ceec9094bcd7a3975aa6c06518e37d", "score": "0.60151285", "text": "func (repo *Repository) WikiPath() string {\n\treturn WikiPath(repo.OwnerName, repo.Name)\n}", "title": "" }, { "docid": "53ceec9094bcd7a3975aa6c06518e37d", "score": "0.60151285", "text": "func (repo *Repository) WikiPath() string {\n\treturn WikiPath(repo.OwnerName, repo.Name)\n}", "title": "" }, { "docid": "561b47071efd85f403d73b87ecdbcd11", "score": "0.60050434", "text": "func (this CreatedRepositoryContribution) GetURL() string { return this.URL }", "title": "" }, { "docid": "7671a80bf8a673533d3c0655bad974f3", "score": "0.5993394", "text": "func (this RepoArchivedAuditEntry) GetRepositoryURL() *string { return this.RepositoryURL }", "title": "" }, { "docid": "62b47b9f8c21d34d83bfc60ebc1ad6f2", "score": "0.5984448", "text": "func (this RepoCreateAuditEntry) GetRepositoryURL() *string { return this.RepositoryURL }", "title": "" }, { "docid": "d0a9a03e8c0df70a48cf7352615e111c", "score": "0.5982167", "text": "func (this TeamAddRepositoryAuditEntry) GetRepositoryURL() *string { return this.RepositoryURL }", "title": "" }, { "docid": "6baccbd7c99eed1c21de0a5b3d100447", "score": "0.5951176", "text": "func (m *Command) URL() string { return m.API.Node().URI.String() }", "title": "" }, { "docid": "9a4ab24d7b8871619bc0836b8d89218b", "score": "0.59337753", "text": "func (repo *Repository) RepoPath() string {\n\treturn repo.repoPath(x)\n}", "title": "" }, { "docid": "5f5c01dd195caa177a25dfc2c76b5082", "score": "0.59230137", "text": "func (r *Repo) Path() (path string) {\n\tif r.IsRaw() {\n\t\treturn r.GitDir\n\t}\n\treturn r.WorkDir\n}", "title": "" }, { "docid": "03ad033486f9f3f6fb85cc7f8a2b9256", "score": "0.59090555", "text": "func (r *Repository) URL() string {\n\trepo, err := git.PlainOpen(r.uri)\n\tif err != nil {\n\t\treturn \"\" // not a git repository\n\t}\n\n\tc, err := repo.Config()\n\tif err != nil {\n\t\treturn \"\" // Has no .git/config or other error.\n\t}\n\n\tif _, ok := c.Remotes[\"origin\"]; ok {\n\t\turls := c.Remotes[\"origin\"].URLs\n\t\tif len(urls) > 0 {\n\t\t\treturn urls[0]\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ee9c3bb065787c4cf3bfae1381b3678d", "score": "0.589943", "text": "func (h Home) Repository() string {\n\treturn h.path(\"repository\")\n}", "title": "" }, { "docid": "8f48059f402b1c8313a2aa17469f7115", "score": "0.58828634", "text": "func (this CreatedRepositoryContribution) GetResourcePath() string { return this.ResourcePath }", "title": "" }, { "docid": "61c4e9d802208ac133a27d7cfa7b3797", "score": "0.58661723", "text": "func (h *Handler) Path() string {\n\treturn fmt.Sprintf(\"/nodeinfo/%s\", h.version)\n}", "title": "" }, { "docid": "d3c04b1e86a4ba7f7f3c2c5b87cbd83f", "score": "0.58622575", "text": "func RepoPathFunc() interface{} {\n\treturn config.Repository.Path\n}", "title": "" }, { "docid": "bbda644c411668a2a53952cdd826434f", "score": "0.58182955", "text": "func Path(path string) *route.T {\n\treturn &route.T{\n\t\tRouter: router.UserAgent(\"git\"),\n\t\tHandler: authNoPush(githttp.New(path)),\n\t}\n}", "title": "" }, { "docid": "1f3f26c07278ba19f0871284f3364179", "score": "0.58017945", "text": "func (w *Wallet) Path(account accounts.Account) (string, error) {\n\treturn account.URL.Path, nil\n}", "title": "" }, { "docid": "c26c0c85d0be71e6df6b35d836608507", "score": "0.5775782", "text": "func (sl SiteList) Path(method string, auth AuthSession) string {\n\tuserid, err := auth.GetUser()\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not determine user for request: %v\", err)\n\t}\n\n\treturn fmt.Sprintf(\"/users/%s/memberships/sites\", userid)\n}", "title": "" }, { "docid": "31de8dccb1aa08d8d2271cdd35b18433", "score": "0.57742393", "text": "func (Api) Path() string {\n\treturn \"/api/v1\"\n}", "title": "" }, { "docid": "bd2bf645784628b78ecf4e4af193eb80", "score": "0.5761915", "text": "func (c *Cache) Path(checksum, uri string) string {\n\tbase := BasePath(checksum, uri)\n\treturn filepath.Join(c.root, base)\n}", "title": "" }, { "docid": "1e9cd976193c1926240b6ac504a1b790", "score": "0.5743312", "text": "func (o AppSpecServiceHealthCheckOutput) HttpPath() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AppSpecServiceHealthCheck) *string { return v.HttpPath }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fb260c252a0388ddace5132d4b28567d", "score": "0.5737889", "text": "func (this RepoAddTopicAuditEntry) GetRepositoryURL() *string { return this.RepositoryURL }", "title": "" }, { "docid": "7d3d1ddc9cf488c4aa3ca510caa8f3a0", "score": "0.57331616", "text": "func (this Repository) GetProjectsURL() string { return this.ProjectsURL }", "title": "" }, { "docid": "b1237311bd171c68c38d901be3b3a342", "score": "0.57307744", "text": "func (this RepoAddMemberAuditEntry) GetRepositoryURL() *string { return this.RepositoryURL }", "title": "" }, { "docid": "776db582dd1396d691ba66b996babb71", "score": "0.5705275", "text": "func (o GetAppSpecServiceHealthCheckOutput) HttpPath() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GetAppSpecServiceHealthCheck) *string { return v.HttpPath }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3ebadd9532b63267b45665a2ff7c43e5", "score": "0.5666803", "text": "func GetFullPath() string {\n\tbaseURI := viper.GetString(\"base-uri\")\n\n\treturn GetBaseURL() + baseURI\n}", "title": "" }, { "docid": "9ccf4603a54ad8a52bc674bf1e4d9aa7", "score": "0.5663946", "text": "func (this RepoDestroyAuditEntry) GetRepositoryURL() *string { return this.RepositoryURL }", "title": "" }, { "docid": "000078208ad5eddf7be9edabb610cf1d", "score": "0.5662133", "text": "func (api *AudistoAPIClient) GetURLPath() string {\n\treturn fmt.Sprintf(\"%s/%v/%s\", api.GetBaseURL(), api.CrawlID, api.Mode)\n}", "title": "" }, { "docid": "4d38e97ce48c53b6b4d88a2d143d78c2", "score": "0.56559265", "text": "func (s Server) Path() string {\n\treturn s.path\n}", "title": "" }, { "docid": "62470e106d9f598d9940d2ec105ec3ea", "score": "0.5645608", "text": "func (repo *Repository) HTMLURL() string {\n\treturn conf.Server.ExternalURL + repo.FullName()\n}", "title": "" }, { "docid": "1e546b6c86b007297ccced9e1656e8e4", "score": "0.5641752", "text": "func (r *Repository) GetRepoPath() (string, error) {\n\treturn r.cache.Repository(r.Provider, r)\n}", "title": "" }, { "docid": "ac2791580ae7bb192f2a52bf299d5eed", "score": "0.5638836", "text": "func (j *Job) RepoURL() string {\n\tserverURL := \"https://github.com\"\n\tif j.GHEDomain.Valid {\n\t\tserverURL = j.GHEDomain.String\n\t}\n\n\ts := strings.Split(serverURL, \"://\")\n\n\tvar u url.URL\n\tu.Scheme = s[0]\n\tu.Host = s[1]\n\tu.Path = j.Repository\n\n\treturn u.String()\n}", "title": "" }, { "docid": "e01e342923a94ebe7c62a1e6392f576d", "score": "0.5616461", "text": "func (this TeamRemoveRepositoryAuditEntry) GetRepositoryURL() *string { return this.RepositoryURL }", "title": "" }, { "docid": "101f2157e81db1b844037ab09beebe07", "score": "0.56076986", "text": "func (o SourcePropertiesResponseOutput) RepositoryUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SourcePropertiesResponse) string { return v.RepositoryUrl }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "86be8321d3c5a0870d4651dbb3550d0d", "score": "0.5605331", "text": "func (this PullRequest) GetResourcePath() string { return this.ResourcePath }", "title": "" }, { "docid": "500e13e26279ecbce688b4537a1652dc", "score": "0.56048393", "text": "func (m *gitEvent) HTTPURL() string {\n\treturn m.httpUrlField\n}", "title": "" }, { "docid": "5fb85303f7c313497ca4fdf65e27aa4a", "score": "0.56016123", "text": "func (this RepositoryTopic) GetResourcePath() string { return this.ResourcePath }", "title": "" }, { "docid": "e644b1caa1386e6e3711c295c1c411ea", "score": "0.55992603", "text": "func (o *Object) path() string {\n\treturn o.fs.remotePath(o.remote)\n}", "title": "" }, { "docid": "64171f6bdee1a9e86968b3b06d1b03fa", "score": "0.5597322", "text": "func (this RepoAccessAuditEntry) GetRepositoryResourcePath() *string {\n\treturn this.RepositoryResourcePath\n}", "title": "" }, { "docid": "198d416c7778b5b4086cf27beed3605a", "score": "0.55927885", "text": "func (repository *Collection) GetPath() string {\n\treturn repository.Path\n}", "title": "" }, { "docid": "87f5bf41421183aab21afcdda322c71e", "score": "0.5583897", "text": "func (t *Target) RepoURL() string {\n\tserverURL := \"https://github.com\"\n\tif t.GHEDomain.Valid {\n\t\tserverURL = t.GHEDomain.String\n\t}\n\n\ts := strings.Split(serverURL, \"://\")\n\n\tvar u url.URL\n\tu.Scheme = s[0]\n\tu.Host = s[1]\n\tu.Path = t.Scope\n\n\treturn u.String()\n}", "title": "" }, { "docid": "d57cc1e753f6803c34882e68f057431d", "score": "0.55796224", "text": "func (r Repo) PathName() string {\n\treturn fmt.Sprintf(\"%s/%s.git\", r.Uname, r.Name)\n}", "title": "" }, { "docid": "cb45165f6a6f2a7559cc7b454713387e", "score": "0.557856", "text": "func (si *SimInfo) RelPath() string {\n\treturn fmt.Sprintf(\"/api/simulation/%s\", si.ID)\n}", "title": "" }, { "docid": "58242be9409166d85e3c27cc13086ce5", "score": "0.5577442", "text": "func (o SourceRepositoryResponseOutput) Url() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SourceRepositoryResponse) string { return v.Url }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a523d8a9160b0b90bf31bd2504acec03", "score": "0.5575878", "text": "func (this Commit) GetURL() string { return this.URL }", "title": "" }, { "docid": "f4002ec4c406c46e8566bd76d7dbbb13", "score": "0.5562332", "text": "func (r *Resource) Path() string {\n\treturn r.path\n}", "title": "" }, { "docid": "bd36270338217ebdcce2aafaa5bd2260", "score": "0.555582", "text": "func (this Organization) GetResourcePath() string { return this.ResourcePath }", "title": "" }, { "docid": "faddd9bc2cdd32133447e3b27669ec9c", "score": "0.5555665", "text": "func (this Organization) GetURL() string { return this.URL }", "title": "" }, { "docid": "9eec6842aef7afb918a4b6853044e0d9", "score": "0.5552653", "text": "func (h Home) Repositories() string {\n\treturn h.Path(\"repositories.json\")\n}", "title": "" }, { "docid": "767b6b5ac53f7b598216da50d4252e23", "score": "0.5552602", "text": "func (this PullRequestCommit) GetResourcePath() string { return this.ResourcePath }", "title": "" }, { "docid": "b37751f526c6a4f318eb9f3514a6ed98", "score": "0.55314296", "text": "func (cli *RegistryClient) URL() string {\n\treturn cli.webScheme() + cli.registry + \"/v2/\"\n}", "title": "" }, { "docid": "0e35d3842f701401ea5aa74e9be380e7", "score": "0.5531022", "text": "func (a *AaaUser) GetPath() string { return fmt.Sprintf(\"/api/objects/aaa/user/%s\", a.Reference) }", "title": "" }, { "docid": "8a9a004819262cc9e6d772a3f9276de4", "score": "0.5530269", "text": "func (c *Context) Path() string { return c.req.URL.Path }", "title": "" }, { "docid": "76536dbea4036b63ec84cf49f4c70836", "score": "0.55270994", "text": "func (g *GenericRepository) Name() string {\n\ttokens := strings.Split(g.URL, \"/\")\n\treturn tokens[len(tokens)-1]\n}", "title": "" }, { "docid": "18f583f2b0cf421941f537a449888a96", "score": "0.5524349", "text": "func (this RepositoryTopic) GetURL() string { return this.URL }", "title": "" }, { "docid": "f468cb0a4b03250684577b291324b941", "score": "0.5523557", "text": "func helmS3RepositoryURI(bucketName string) string {\n\treturn fmt.Sprintf(\"s3://%s/%s\", bucketName, awsS3BucketRepositoryPath)\n}", "title": "" }, { "docid": "1a6f5134afeb86e350f6908043b51e5a", "score": "0.55119556", "text": "func HttpRemote(owner, repo string) string {\n\treturn fmt.Sprintf(\"http://github.com/%s/%s.git\", owner, repo)\n}", "title": "" }, { "docid": "be66a7013deccbcfc235ecf5225fc14c", "score": "0.55104095", "text": "func (s *Shard) Path() string { return s.path }", "title": "" }, { "docid": "5451ba8e3fc3e2a726b71fd98d744971", "score": "0.5504091", "text": "func (this RepoChangeMergeSettingAuditEntry) GetRepositoryURL() *string { return this.RepositoryURL }", "title": "" }, { "docid": "a51c71082328077a7f6254fc00630496", "score": "0.5503578", "text": "func (r *Repository) repositoryURI() (string, error) {\n\tif r.uri != \"\" {\n\t\treturn r.uri, nil\n\t}\n\turi, err := r.registry.RepositoryURI(r.name)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"get repository URI: %w\", err)\n\t}\n\tr.uri = uri\n\treturn uri, nil\n}", "title": "" }, { "docid": "e9feabff43261192d4007f2c6c2710b5", "score": "0.5496051", "text": "func (a *account) Path() string {\n\treturn a.path\n}", "title": "" }, { "docid": "365c070f7c584d8b7ea0de57c3d2398f", "score": "0.54956824", "text": "func (r *Request) URL() string {\n\treturn fmt.Sprintf(\"%s/%s/%s/%s/%s/%s\",\n\t\tr.Host,\n\t\tr.Repo.Host,\n\t\tr.Repo.Owner,\n\t\tr.Repo.Name,\n\t\tr.Commit.Branch,\n\t\tr.Commit.Sha,\n\t)\n}", "title": "" }, { "docid": "c96b125dba2d56da439acaa827b7de41", "score": "0.5488254", "text": "func (branchInfoModel BranchInfoModel) getRepositoryURL() string {\n\treturn branchInfoModel.Repo.SSHURL\n}", "title": "" }, { "docid": "776fe4be99e6acbc8cc808be9c0f51dc", "score": "0.54851806", "text": "func (this RepoAddMemberAuditEntry) GetRepositoryResourcePath() *string {\n\treturn this.RepositoryResourcePath\n}", "title": "" }, { "docid": "76e5aa1b4c729ab21e2e478825f98f47", "score": "0.54748714", "text": "func (u *URI) Path() []byte {\n\tpath := u.path\n\tif len(path) == 0 {\n\t\tpath = strSlash\n\t}\n\treturn path\n}", "title": "" }, { "docid": "c78b235347df2af415f6b62e120d7fde", "score": "0.54677844", "text": "func (o AppSpecServiceHealthCheckPtrOutput) HttpPath() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AppSpecServiceHealthCheck) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.HttpPath\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fd3c65867b43936db8be7313479e6528", "score": "0.54629195", "text": "func (a *AaaGroup) GetPath() string { return fmt.Sprintf(\"/api/objects/aaa/group/%s\", a.Reference) }", "title": "" }, { "docid": "baadcc1d6763e0e00c7c359a6ea2dbfb", "score": "0.54605454", "text": "func (c *client) BasePath() string {\n\treturn c.raw.BasePath\n}", "title": "" }, { "docid": "772b880ecf1e129d81e2f0c1a4b50f87", "score": "0.5459706", "text": "func (g *GenericRepository) GetURL() string {\n\treturn g.URL\n}", "title": "" }, { "docid": "a37d216e5159b8100251accfe686d2a6", "score": "0.5457747", "text": "func (app *App) GitURL(server string) string {\n\treturn fmt.Sprintf(\"%s/%s/%s\", server, app.Org, app.Name)\n}", "title": "" }, { "docid": "992d112c7adf73b6d6df3fb70031a944", "score": "0.5453905", "text": "func (o ApiEntityOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ApiEntity) *string { return v.Path }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b3e9823d6d2ce248a6ea58458c151f74", "score": "0.54490966", "text": "func (this Repository) GetProjectsResourcePath() string { return this.ProjectsResourcePath }", "title": "" }, { "docid": "0d7c62c3f1707758aea9bbd05cb27b6b", "score": "0.54483116", "text": "func handler(w http.ResponseWriter, r *http.Request) {\n fmt.Fprintf(w, \"URL.Path = %q\\n\", r.URL.Path)\n}", "title": "" }, { "docid": "d4d969693d3a23af899d20ad6b9569ba", "score": "0.54457706", "text": "func (d *Dependency) Path() (p string) {\n\tgoPath := os.Getenv(\"GOPATH\")\n\tif strings.TrimSpace(goPath) == \"\" {\n\t\tlog.Fatal(colors.Red(\"You must set GOPATH\"))\n\t}\n\n\tp = path.Join(goPath, \"src\")\n\n\tif d.Alias == \"\" {\n\t\tp = path.Join(p, d.Repo)\n\t} else {\n\t\tp = path.Join(p, d.Alias)\n\t}\n\n\treturn\n\n}", "title": "" }, { "docid": "06b72efeafcbfeda48666ed46036e2aa", "score": "0.5438167", "text": "func (o GetAppServiceSourceControlOutput) RepoUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetAppServiceSourceControl) string { return v.RepoUrl }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "781db5e69ba72f52df7c8517720428f3", "score": "0.54330045", "text": "func (r *request) Path() string {\n\treturn r.path\n}", "title": "" }, { "docid": "1d23be96d696489baa14d7b04fc852f4", "score": "0.5428876", "text": "func (p *v1Provider) Path(elements ...string) string {\n\tparts := []string{\n\t\tstrings.TrimSuffix(p.Cluster.Config.CatalogURL, \"/\"),\n\t\t\"v1\",\n\t}\n\tparts = append(parts, elements...)\n\treturn strings.Join(parts, \"/\")\n}", "title": "" }, { "docid": "04cac9d7e860425337dbfafc36b07159", "score": "0.5421429", "text": "func (driver BitbucketCodeHostingDriver) GetRepositoryURL(repository string) string {\n\treturn \"https://bitbucket.org/\" + repository\n}", "title": "" }, { "docid": "6869622978ee42150b37f1870c2548d8", "score": "0.5421236", "text": "func (this Gist) GetResourcePath() string { return this.ResourcePath }", "title": "" }, { "docid": "2195450c39908e106abeaf3de18f52e6", "score": "0.5418794", "text": "func (n SyncItem) Path() string {\n\tfirst := strconv.Itoa(n.Revision / 100)\n\tsecond := strconv.Itoa(n.Revision)\n\tbase := n.ID.String() + \".note\"\n\n\treturn filepath.Join(first, second, base)\n}", "title": "" }, { "docid": "2faf8c3465370a2fa0401e08b989c7f4", "score": "0.54150045", "text": "func (h *Hart) Path() string {\n\treturn h.path\n}", "title": "" }, { "docid": "47c36dd9d6f4fd3089f3f22980b5be39", "score": "0.5413278", "text": "func (this Issue) GetResourcePath() string { return this.ResourcePath }", "title": "" }, { "docid": "f3bc8853d11b5974db55c637b01f8e36", "score": "0.54131955", "text": "func (a *account) Path() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "4d433a0e66b17535e593938eb8077bb1", "score": "0.54116243", "text": "func GetRepositoryPath(\n\troot string,\n\tproblemName string,\n) string {\n\treturn path.Join(\n\t\troot,\n\t\t\"problems.git\",\n\t\tproblemName,\n\t)\n}", "title": "" }, { "docid": "83c14dc3b0b5c04dd91b4380fdc33de2", "score": "0.54107493", "text": "func (f *File) Path(p *syncer.Profile) string {\n\tif f.ID() == p.Remote.ID() {\n\t\treturn f.URL\n\t}\n\treturn strings.TrimPrefix(f.URL, p.Remote.Path(p))\n}", "title": "" }, { "docid": "20b1267c9aa957297cf75e2dc30822e6", "score": "0.54054403", "text": "func RepoURL() string {\n\treturn os.Getenv(\"REPO_URL\")\n}", "title": "" }, { "docid": "cd97f7b4b28f3140dfb75bd762e91ecd", "score": "0.5403418", "text": "func RepositoriesURL() string {\n\treturn \"/v2/_catalog\"\n}", "title": "" }, { "docid": "368d107721f6cc4ccae6cd5010ae181a", "score": "0.53949726", "text": "func WikiPath(userName, repoName string) string {\n\treturn filepath.Join(repoutil.UserPath(userName), strings.ToLower(repoName)+\".wiki.git\")\n}", "title": "" }, { "docid": "14a64fb7b2ba24d88b8a1afcfaa9313e", "score": "0.5394182", "text": "func (this Commit) GetResourcePath() string { return this.ResourcePath }", "title": "" }, { "docid": "0252796559193a275ec0aa04b003a45a", "score": "0.539264", "text": "func (driver GithubCodeHostingDriver) GetRepositoryURL(repository string) string {\n\treturn \"https://github.com/\" + repository\n}", "title": "" }, { "docid": "b1460bbd81258bc2beb98763e225d6c4", "score": "0.5388849", "text": "func (o GetAppSpecServiceHealthCheckPtrOutput) HttpPath() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GetAppSpecServiceHealthCheck) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.HttpPath\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a3b91523352a3012ce6bb439508ef7b4", "score": "0.5383639", "text": "func (this RepoRemoveTopicAuditEntry) GetRepositoryURL() *string { return this.RepositoryURL }", "title": "" }, { "docid": "4c8585f7453269a9abd188b68d4b9003", "score": "0.53731585", "text": "func (cli *client) getAPIPath(path string) string {\n\treturn fmt.Sprintf(\"http://%s:%s%s\", cli.addr.IP, cli.addr.Port, path)\n}", "title": "" }, { "docid": "41e43b6078e638ed51f8056818feaf81", "score": "0.53647107", "text": "func (o ApiEntityResponseOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ApiEntityResponse) *string { return v.Path }).(pulumi.StringPtrOutput)\n}", "title": "" } ]
b6dca8057030526efa00c2f1cc04f746
ValidateGardenletConfiguration validates a GardenletConfiguration object.
[ { "docid": "3c3fddebf829234794117df4aa0ac279", "score": "0.79632896", "text": "func ValidateGardenletConfiguration(cfg *config.GardenletConfiguration, fldPath *field.Path, inTemplate bool) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\n\tif cfg.Controllers != nil {\n\t\tif cfg.Controllers.BackupEntry != nil {\n\t\t\tallErrs = append(allErrs, ValidateBackupEntryControllerConfiguration(cfg.Controllers.BackupEntry, fldPath.Child(\"controllers\", \"backupEntry\"))...)\n\t\t}\n\t\tif cfg.Controllers.Bastion != nil {\n\t\t\tallErrs = append(allErrs, ValidateBastionControllerConfiguration(cfg.Controllers.Bastion, fldPath.Child(\"controllers\", \"bastion\"))...)\n\t\t}\n\t\tif cfg.Controllers.Shoot != nil {\n\t\t\tallErrs = append(allErrs, ValidateShootControllerConfiguration(cfg.Controllers.Shoot, fldPath.Child(\"controllers\", \"shoot\"))...)\n\t\t}\n\t\tif cfg.Controllers.ManagedSeed != nil {\n\t\t\tallErrs = append(allErrs, ValidateManagedSeedControllerConfiguration(cfg.Controllers.ManagedSeed, fldPath.Child(\"controllers\", \"managedSeed\"))...)\n\t\t}\n\t}\n\n\tif cfg.LogLevel != nil {\n\t\tif !sets.NewString(logger.AllLogLevels...).Has(*cfg.LogLevel) {\n\t\t\tallErrs = append(allErrs, field.NotSupported(field.NewPath(\"logLevel\"), cfg.LogLevel, logger.AllLogLevels))\n\t\t}\n\t}\n\n\tif cfg.LogFormat != nil {\n\t\tif !sets.NewString(logger.AllLogFormats...).Has(*cfg.LogFormat) {\n\t\t\tallErrs = append(allErrs, field.NotSupported(field.NewPath(\"logFormat\"), cfg.LogFormat, logger.AllLogFormats))\n\t\t}\n\t}\n\n\tif !inTemplate && cfg.SeedConfig == nil {\n\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"seedConfig\"), cfg, \"seed config must be set\"))\n\t}\n\n\tif cfg.SeedConfig != nil {\n\t\tallErrs = append(allErrs, corevalidation.ValidateSeedTemplate(&cfg.SeedConfig.SeedTemplate, fldPath.Child(\"seedConfig\"))...)\n\t}\n\n\tserverPath := fldPath.Child(\"server\")\n\tif cfg.Server != nil {\n\t\tif len(cfg.Server.HTTPS.BindAddress) == 0 {\n\t\t\tallErrs = append(allErrs, field.Required(serverPath.Child(\"https\", \"bindAddress\"), \"bind address is required\"))\n\t\t}\n\t\tif cfg.Server.HTTPS.Port == 0 {\n\t\t\tallErrs = append(allErrs, field.Required(serverPath.Child(\"https\", \"port\"), \"port is required\"))\n\t\t}\n\t}\n\n\tresourcesPath := fldPath.Child(\"resources\")\n\tif cfg.Resources != nil {\n\t\tfor resourceName, quantity := range cfg.Resources.Capacity {\n\t\t\tif reservedQuantity, ok := cfg.Resources.Reserved[resourceName]; ok && reservedQuantity.Value() > quantity.Value() {\n\t\t\t\tallErrs = append(allErrs, field.Invalid(resourcesPath.Child(\"reserved\", string(resourceName)), cfg.Resources.Reserved[resourceName], \"reserved must be lower or equal to capacity\"))\n\t\t\t}\n\t\t}\n\t\tfor resourceName := range cfg.Resources.Reserved {\n\t\t\tif _, ok := cfg.Resources.Capacity[resourceName]; !ok {\n\t\t\t\tallErrs = append(allErrs, field.Invalid(resourcesPath.Child(\"reserved\", string(resourceName)), cfg.Resources.Reserved[resourceName], \"reserved without capacity\"))\n\t\t\t}\n\t\t}\n\t}\n\n\tsniPath := fldPath.Child(\"sni\", \"ingress\")\n\tif cfg.SNI != nil && cfg.SNI.Ingress != nil && cfg.SNI.Ingress.ServiceExternalIP != nil {\n\t\tif ip := net.ParseIP(*cfg.SNI.Ingress.ServiceExternalIP); ip == nil {\n\t\t\tallErrs = append(allErrs, field.Invalid(sniPath.Child(\"serviceExternalIP\"), cfg.SNI.Ingress.ServiceExternalIP, \"external service ip is invalid\"))\n\t\t}\n\t}\n\n\texposureClassHandlersPath := fldPath.Child(\"exposureClassHandlers\")\n\tfor i, handler := range cfg.ExposureClassHandlers {\n\t\thandlerPath := exposureClassHandlersPath.Index(i)\n\n\t\tfor _, errorMessage := range validation.IsDNS1123Label(handler.Name) {\n\t\t\tallErrs = append(allErrs, field.Invalid(handlerPath.Child(\"name\"), handler.Name, errorMessage))\n\t\t}\n\n\t\tif handler.SNI != nil && handler.SNI.Ingress != nil && handler.SNI.Ingress.ServiceExternalIP != nil {\n\t\t\tif apiServerSNIEnabled, ok := cfg.FeatureGates[string(features.APIServerSNI)]; ok && !apiServerSNIEnabled {\n\t\t\t\tallErrs = append(allErrs, field.Forbidden(handlerPath.Child(\"sni\", \"ingress\", \"serviceExternalIP\"), \"cannot use an external service ip when APIServerSNI feature gate is disabled\"))\n\t\t\t}\n\n\t\t\tif ip := net.ParseIP(*handler.SNI.Ingress.ServiceExternalIP); ip == nil {\n\t\t\t\tallErrs = append(allErrs, field.Invalid(handlerPath.Child(\"sni\", \"ingress\", \"serviceExternalIP\"), handler.SNI.Ingress.ServiceExternalIP, \"external service ip is invalid\"))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn allErrs\n}", "title": "" } ]
[ { "docid": "4dfce0099ba716fd4e3d06f833255b05", "score": "0.6632918", "text": "func ValidateConfiguration(config *schema.Configuration, validator *schema.StructValidator) {\n\tvar err error\n\n\tif config.CertificatesDirectory != \"\" {\n\t\tvar info os.FileInfo\n\n\t\tif info, err = os.Stat(config.CertificatesDirectory); err != nil {\n\t\t\tvalidator.Push(fmt.Errorf(\"the location 'certificates_directory' could not be inspected: %w\", err))\n\t\t} else if !info.IsDir() {\n\t\t\tvalidator.Push(fmt.Errorf(\"the location 'certificates_directory' refers to '%s' is not a directory\", config.CertificatesDirectory))\n\t\t}\n\t}\n\n\tif config.JWTSecret == \"\" {\n\t\tvalidator.Push(fmt.Errorf(\"option 'jwt_secret' is required\"))\n\t}\n\n\tif config.DefaultRedirectionURL != \"\" {\n\t\tif err = utils.IsStringAbsURL(config.DefaultRedirectionURL); err != nil {\n\t\t\tvalidator.Push(fmt.Errorf(\"option 'default_redirection_url' is invalid: %s\", strings.ReplaceAll(err.Error(), \"like 'http://' or 'https://'\", \"like 'ldap://' or 'ldaps://'\")))\n\t\t}\n\t}\n\n\tvalidateDefault2FAMethod(config, validator)\n\n\tValidateTheme(config, validator)\n\n\tValidateLog(config, validator)\n\n\tValidateDuo(config, validator)\n\n\tValidateTOTP(config, validator)\n\n\tValidateWebAuthn(config, validator)\n\n\tValidateAuthenticationBackend(&config.AuthenticationBackend, validator)\n\n\tValidateAccessControl(config, validator)\n\n\tValidateRules(config, validator)\n\n\tValidateSession(&config.Session, validator)\n\n\tValidateRegulation(config, validator)\n\n\tValidateServer(config, validator)\n\n\tValidateTelemetry(config, validator)\n\n\tValidateStorage(config.Storage, validator)\n\n\tValidateNotifier(&config.Notifier, validator)\n\n\tValidateIdentityProviders(&config.IdentityProviders, validator)\n\n\tValidateNTP(config, validator)\n\n\tValidatePasswordPolicy(&config.PasswordPolicy, validator)\n\n\tValidatePrivacyPolicy(&config.PrivacyPolicy, validator)\n}", "title": "" }, { "docid": "4d7f71631dbf5d17d133944d00aa1ace", "score": "0.66229576", "text": "func (cf *Configuration) Validate() error {\n\t//\n\t// Components:\n\tif cf.Cipher == nil {\n\t\treturn makeError(0xE16FB9, \"nil Configuration.Cipher\")\n\t}\n\tif cf.Compressor == nil {\n\t\treturn makeError(0xE5B3C1, \"nil Configuration.Compressor\")\n\t}\n\t// Limits:\n\tn := cf.PacketSizeLimit\n\tif n < 8 || n > (65535-8) {\n\t\treturn makeError(0xE86C2A,\n\t\t\t\"invalid Configuration.PacketSizeLimit:\", n)\n\t}\n\tn = cf.PacketPayloadSize\n\tif n < 1 || n > (cf.PacketSizeLimit-200) {\n\t\treturn makeError(0xE54BF4,\n\t\t\t\"invalid Configuration.PacketPayloadSize:\", n)\n\t}\n\tn = cf.SendBufferSize\n\tif n < 0 {\n\t\treturn makeError(0xE27C2B,\n\t\t\t\"invalid Configuration.SendBufferSize:\", n)\n\t}\n\tn = cf.SendRetries\n\tif n < 0 {\n\t\treturn makeError(0xE47C83,\n\t\t\t\"invalid Configuration.SendRetries:\", n)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "61c96834bf4bdf99d4f05801d38de45e", "score": "0.65742946", "text": "func ValidateGardenletConfigurationUpdate(newCfg, oldCfg *config.GardenletConfiguration, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\n\tif newCfg.SeedConfig != nil && oldCfg.SeedConfig != nil {\n\t\tallErrs = append(allErrs, corevalidation.ValidateSeedTemplateUpdate(&newCfg.SeedConfig.SeedTemplate, &oldCfg.SeedConfig.SeedTemplate, fldPath.Child(\"seedConfig\"))...)\n\t}\n\n\treturn allErrs\n}", "title": "" }, { "docid": "f662b5185c2b88889a4baf43f0a5458e", "score": "0.6408438", "text": "func (c *Config) Validate() error {\n\tif c.ChunkSize < 10 || c.ChunkSize > 100000 {\n\t\treturn errors.New(\"chunkSize should be between 10 and 100000\")\n\t}\n\n\tif c.Workers < 1 || c.Workers > runtime.NumCPU() {\n\t\treturn errors.New(\"workers must be between 1 and \" + strconv.Itoa(runtime.NumCPU()))\n\t}\n\n\tif c.Password == \"\" {\n\t\treturn errors.New(\"configuration does not contain password (database)\")\n\t}\n\n\tif c.SolrUrl == \"\" {\n\t\treturn errors.New(\"configuration does not contain solrUrl\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2979ae04a89fcf58bd7b05697e99f3ca", "score": "0.6328867", "text": "func (c ProvisionerConfig) Validate() error {\n\tswitch {\n\tcase c.Issuer == \"\":\n\t\treturn errors.New(\"provisioner.issuer cannot be empty\")\n\tcase c.KeyID == \"\":\n\t\treturn errors.New(\"provisioner.kid cannot be empty\")\n\tcase c.CaURL == \"\":\n\t\treturn errors.New(\"provisioner.ca-url cannot be empty\")\n\tcase c.CaRoot == \"\":\n\t\treturn errors.New(\"provisioner.root cannot be empty\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fdac60688b3b067dc830a8e259dfa26a", "score": "0.62782586", "text": "func ValidateConfig() error {\n\tif SandboxID == \"\" {\n\t\treturn appError.NewInitializationError(\"The variable sandboxID must be provided through the CLI arguments or environment variable\", nil)\n\t}\n\n\tif GrafanaURL == \"\" {\n\t\treturn appError.NewInitializationError(\"The variable grafanaURL must be provided through the CLI arguments or environment variable\", nil)\n\t}\n\n\tif GrafanaPassword == \"\" {\n\t\treturn appError.NewInitializationError(\"The variable grafanaPassword must be provided through the CLI arguments or environment variable\", nil)\n\t}\n\n\tif CirconusAPIToken == \"\" {\n\t\treturn appError.NewInitializationError(\"The variable circonusAPIToken must be provided through the CLI arguments or environment variable\", nil)\n\t}\n\n\tif TSDBSystem != \"irondb\" && TSDBSystem != \"influxdb\" && TSDBSystem != \"timescale\" {\n\t\treturn appError.NewInitializationError(\"The value of tsdbSystem is invalid\", nil)\n\t}\n\n\tlogrusLevel, err := logrus.ParseLevel(LogLevel)\n\tif err != nil {\n\t\treturn appError.NewInitializationError(\"Error parsing log level value for LOG_LEVEL\", err)\n\t}\n\tlog.SetLevel(logrusLevel)\n\n\tlog.Debug(\"Configuration validated successfully\")\n\n\treturn nil\n}", "title": "" }, { "docid": "e4f5c7b91a9b97b7e0bf9bfa8a990332", "score": "0.62354684", "text": "func (config *Configuration) Validate() error {\n\tvar errs []string\n\tvar undefinedErrs []string\n\n\tif config.HcloudApiToken == \"\" {\n\t\tundefinedErrs = append(errs, \"hetzner cloud API token\")\n\t}\n\tif len(config.HcloudFloatingIPs) <= 0 {\n\t\tundefinedErrs = append(errs, \"hetzner cloud floating IPs\")\n\t}\n\tif config.NodeName == \"\" {\n\t\tundefinedErrs = append(errs, \"kubernetes node name\")\n\t}\n\tif config.Namespace == \"\" {\n\t\tundefinedErrs = append(errs, \"kubernetes namespace\")\n\t}\n\tif config.LeaseDuration <= 0 {\n\t\terrs = append(errs, \"lease duration needs to be greater than one\")\n\t}\n\n\tif len(undefinedErrs) > 0 {\n\t\terrs = append(errs, fmt.Sprintf(\"required configuration options not configured: %s\", strings.Join(errs, \", \")))\n\t}\n\tif len(errs) > 0 {\n\t\treturn fmt.Errorf(\"%s\", strings.Join(errs, \", \"))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b3aa6a68b3f1e4884acaf88e9584994e", "score": "0.6213216", "text": "func (c Config) Validate() error {\n\tif c.CollectorEndpoint == \"\" && c.AgentEndpoint == \"\" {\n\t\treturn xerrors.New(\"jaeger: either collector endpoint or agent endpoint must be configured\")\n\t}\n\tif c.ServiceName == \"\" {\n\t\treturn xerrors.New(\"jaeger: service name must not be blank\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2e2cc44765a499055a4536294d7cc128", "score": "0.6172617", "text": "func (c *Config) Validate() error {\n\tif c.config == nil {\n\t\treturn &ErrInvalidConfig{\"config is empty\"}\n\t}\n\tif len(c.config.ServerAddress) == 0 {\n\t\treturn &ErrInvalidConfig{\"unspecified server address\"}\n\t}\n\tif len(c.config.DatabaseAddress) == 0 {\n\t\treturn &ErrInvalidConfig{\"unspecified database address\"}\n\t}\n\tif len(c.config.DatabaseName) == 0 {\n\t\treturn &ErrInvalidConfig{\"unspecified database name\"}\n\t}\n\tif len(c.config.LogFilePath) == 0 {\n\t\treturn &ErrInvalidConfig{\"unspecified log file path\"}\n\t}\n\tif len(c.config.HashKey) == 0 {\n\t\treturn &ErrInvalidConfig{\"unspecified hash key\"}\n\t}\n\tif len(c.config.BlockKey) == 0 {\n\t\treturn &ErrInvalidConfig{\"unspecified block key\"}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "62b95e040fcee65fe622f128fea2bdbb", "score": "0.61556107", "text": "func (c Config) Validate() error {\n\tif c.Environment == \"\" {\n\t\treturn errors.New(\"environment is required\")\n\t}\n\n\tif err := c.Instrumentation.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.Dgraph.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "85088fe7ca730cd3c0c73939e642cf38", "score": "0.61368537", "text": "func ValidateConfig(config *config.Config) {\n\t_, err := config.String(\"Miner.Protocol\")\n\tif err != nil {\n\t\tlog.WithError(err).Fatal(\"failed to read miner protocol from config\")\n\t}\n\t_, err = config.Int(\"Miner.NumberOfMiners\")\n\tif err != nil {\n\t\tlog.WithError(err).Fatal(\"failed to read number of miners from config\")\n\t}\n\n\tidentity, err := config.String(\"Miner.IdentityChain\")\n\tif err != nil {\n\t\tlog.WithError(err).Fatal(\"failed to read the identity chain or miner id\")\n\t}\n\n\tif err := common.ValidIdentity(identity); err != nil {\n\t\tlog.WithError(err).Fatal(\"invalid identity\")\n\t}\n}", "title": "" }, { "docid": "1cf8acc5cb28cd2060c6ee9632442fa2", "score": "0.6130012", "text": "func (c InstrumentationConfig) Validate() error {\n\tif c.Jaeger.Enabled {\n\t\tif err := c.Jaeger.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e1f567536dfef52fb36ac7e46111381e", "score": "0.61244136", "text": "func (c *PGBouncerConfig) Validate() error {\n\tif c.MaxDatabaseConnectionsPerPool < 1 {\n\t\treturn errors.New(\"MaxDatabaseConnectionsPerPool must be 1 or greater\")\n\t}\n\tif c.DefaultPoolSize < 1 {\n\t\treturn errors.New(\"DefaultPoolSize must be 1 or greater\")\n\t}\n\tif c.ServerResetQueryAlways != 0 && c.ServerResetQueryAlways != 1 {\n\t\treturn errors.New(\"ServerResetQueryAlways must be 0 or 1\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b9fd029ae86395bc62e09d9b192aadc0", "score": "0.61171985", "text": "func (cfg *Config) Validate() error {\n\tif cfg.Dialect != \"postgres\" && cfg.Dialect != \"sqlite3\" {\n\t\treturn errors.Errorf(\n\t\t\t\"invalid database dialect: '%s'. Valid dialects: 'postgres', 'sqlite3'\", cfg.Dialect)\n\t}\n\n\tif cfg.Host == \"\" {\n\t\tcfg.Host = \"localhost\"\n\t}\n\tif cfg.Port == 0 {\n\t\tcfg.Port = 5432\n\t}\n\tif cfg.User == \"\" {\n\t\tcfg.User = \"postgres\"\n\t}\n\tif cfg.Pass == \"\" {\n\t\tcfg.Pass = \"postgres\"\n\t}\n\tif cfg.Database == \"\" {\n\t\tcfg.Database = \"blockpropeller\"\n\t}\n\n\tif cfg.File == \"\" {\n\t\tcfg.File = \".blockpropeller/blockpropeller.db\"\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "45f50f1411807c528aaadae75dc1e75b", "score": "0.61050093", "text": "func (c *Config) Validate() error {\n\tif c.config == nil {\n\t\treturn &ErrInvalidConfig{\"config is empty\"}\n\t}\n\tif len(c.config.ServerAddress) == 0 {\n\t\treturn &ErrInvalidConfig{\"unspecified server address\"}\n\t}\n\tif len(c.config.DatabaseName) == 0 {\n\t\treturn &ErrInvalidConfig{\"unspecified database name\"}\n\t}\n\tif len(c.config.DatabaseUsername) == 0 {\n\t\treturn &ErrInvalidConfig{\"unspecified database username\"}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c5100710e249d5d3c8674ed6ac444371", "score": "0.6091126", "text": "func (c Config) Validate() error {\n\tvar buf bytes.Buffer\n\n\tc.SlackConfig.validate(&buf)\n\tc.SnipsConfig.validate(&buf)\n\n\tif buf.Len() > 0 {\n\t\treturn fmt.Errorf(\"Following error(s) with config:\\n%s\", buf.String())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8bb7dbd79d069632a560d59081f15df9", "score": "0.60906416", "text": "func (m *TLSConfiguration) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "eb57a7ec873575bb801349480833222b", "score": "0.60879254", "text": "func (cfg *Config) Validate() error {\n\tif cfg.ClientID == \"\" {\n\t\treturn errNoClientIDProvided\n\t}\n\tif cfg.ClientSecret == \"\" {\n\t\treturn errNoClientSecretProvided\n\t}\n\tif cfg.TokenURL == \"\" {\n\t\treturn errNoTokenURLProvided\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "866f18ee4caf3a5a9ab232a255b1542b", "score": "0.60805845", "text": "func ValidateConfiguration() error {\n\tvar err error\n\tif err = CheckRootServiceuuid(Data.RootServiceUUID); err != nil {\n\t\treturn err\n\t}\n\tif err = checkMiscellaneousConf(); err != nil {\n\t\treturn err\n\t}\n\tif err = checkDBConf(); err != nil {\n\t\treturn err\n\t}\n\tif err = checkKeyCertConf(); err != nil {\n\t\treturn err\n\t}\n\tif err = checkAPIGatewayConf(); err != nil {\n\t\treturn err\n\t}\n\tif err = checkTLSConf(); err != nil {\n\t\treturn err\n\t}\n\tif err = checkConnectionMethodConf(); err != nil {\n\t\treturn err\n\t}\n\tcheckAuthConf()\n\tcheckAddComputeSkipResources()\n\tcheckURLTranslation()\n\tcheckPluginStatusPolling()\n\tcheckExecPriorityDelayConf()\n\n\treturn nil\n}", "title": "" }, { "docid": "0982449f8f30a62ee75dcc1f4afb274d", "score": "0.6076817", "text": "func (c *Config) Validate() error {\n\tif c.LogLevel == \"\" {\n\t\treturn errors.New(\"LogLevel is required\")\n\t}\n\n\tif err := c.Store.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.GraphQL.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.Worker.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.Server.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := c.Metrics.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := c.Search.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := c.Debug.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := c.CoinManager.Validate(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6340df56c4f200bd6193ae7d1e6361aa", "score": "0.6075235", "text": "func ValidateConfig(config kritisv1beta1.GrafeasConfigSpec) error {\n\tif config.Addr == \"\" {\n\t\treturn fmt.Errorf(\"missing Grafeas address\")\n\t}\n\tif strings.HasPrefix(config.Addr, \"/\") { // Unix socket address\n\t\treturn nil\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59b766b0a54e830c5f7f7f48296985d3", "score": "0.6071245", "text": "func (conf *Config) Validate() error {\n\tif conf.ServerURL == \"\" {\n\t\treturn errors.New(\"server-url missing\")\n\t}\n\n\tif conf.DeviceName == \"\" {\n\t\treturn errors.New(\"device-name missing\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c51dbae8426e936dc21e56c196af73cd", "score": "0.60610574", "text": "func (c metaConfiguration) Validate() error {\n\tif c.Vault.Enabled {\n\t\tif c.Vault.Address != \"\" {\n\t\t\tif _, err := url.Parse(c.Vault.Address); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"invalid vault address\")\n\t\t\t}\n\t\t}\n\n\t\tif c.Vault.SecretPath == \"\" {\n\t\t\treturn errors.New(\"vault secret path is required\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c3987a6b030b90576cbe8cf7e2547324", "score": "0.6060141", "text": "func (gc *GeneratorConfig) Validate() error {\n\tif gc.NumWords < 0 {\n\t\treturn errors.New(\"num_words must be a positive integer\")\n\t}\n\n\tif gc.WordLenMin < 0 {\n\t\treturn errors.New(\"word_len_min must be a positive integer\")\n\t}\n\tif gc.WordLenMax < 0 {\n\t\treturn errors.New(\"word_len_max must be a positive integer\")\n\t}\n\tif gc.WordLenMax < gc.WordLenMin {\n\t\treturn errors.New(\"word_len_max cannot be less than word_len_min\")\n\t}\n\n\tif gc.PaddingDigitsBefore < 0 {\n\t\treturn errors.New(\"padding_digits_before must be a positive integer\")\n\t}\n\tif gc.PaddingDigitsAfter < 0 {\n\t\treturn errors.New(\"padding_digits_after must be a positive integer\")\n\t}\n\n\tif gc.PadToLength < 0 {\n\t\treturn errors.New(\"pad_to_length must be a positive integer\")\n\t}\n\n\tif gc.PaddingCharactersBefore < 0 {\n\t\treturn errors.New(\"padding_characters_before must be a positive integer\")\n\t}\n\tif gc.PaddingCharactersAfter < 0 {\n\t\treturn errors.New(\"padding_characters_after must be a positive integer\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8555683c2483652d6ae75d00274df381", "score": "0.6058316", "text": "func (c *DataGeneratorConfig) Validate() error {\n\terr := c.BaseConfig.Validate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif c.InitialScale == 0 {\n\t\tc.InitialScale = c.BaseConfig.Scale\n\t}\n\n\tif c.LogInterval == 0 {\n\t\treturn fmt.Errorf(errLogIntervalZero)\n\t}\n\n\terr = validateGroups(c.InterleavedGroupID, c.InterleavedNumGroups)\n\treturn err\n}", "title": "" }, { "docid": "c0c54ae4ed9ae839507d9c160a9b6417", "score": "0.60491186", "text": "func (c configuration) Validate() error {\n\t// TODO: write config validation\n\treturn nil\n}", "title": "" }, { "docid": "a2fc172666c83a9f05acf228c5104e99", "score": "0.60471076", "text": "func (cfg *Config) Validate() error {\n\treturn config.ValidateAll(\n\t\t&cfg.General,\n\t\t&cfg.Features,\n\t\t&cfg.Logging,\n\t\t&cfg.Metrics,\n\t\t&cfg.Sciond,\n\t\t&cfg.TrustDB,\n\t\t&cfg.Discovery,\n\t\t&cfg.DRKey,\n\t\t&cfg.CS,\n\t)\n}", "title": "" }, { "docid": "f950feaf820e824b3b4a94dff21b230f", "score": "0.6018815", "text": "func (c *Config) Validate() error {\n\tif len(c.PrometheusURL) > 0 {\n\t\tif _, err := url.Parse(c.PrometheusURL); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(c.LogFormat) > 0 {\n\t\tif !mapLogFormat[c.LogFormat] {\n\t\t\treturn fmt.Errorf(`invalid value for logFormat. \"%s\" Valid values are \"%s\" or \"%s\"`, c.LogFormat, TextFormat, JSONFormat)\n\t\t}\n\t} else {\n\t\t// default value\n\t\tc.LogFormat = TextFormat\n\t}\n\n\tif c.MetadataLookbackInterval <= 0 {\n\t\tc.MetadataLookbackInterval = defaultInterval\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d47234107b8791319e4525caaaf88b24", "score": "0.6015821", "text": "func (c *RunnerConfig) Validate() error {\n\tif c.ParseChunkSize <= 0 {\n\t\treturn fmt.Errorf(\"invalid ParseChunkSize value %d: should be more than 0\", c.ParseChunkSize)\n\t}\n\tif c.PlanChunkSize <= 0 {\n\t\treturn fmt.Errorf(\"invalid PlanChunkSize value %d: should be more than 0\", c.PlanChunkSize)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d7e262ab57c3e8337346562c0cd2e190", "score": "0.59852093", "text": "func (p *Plugin) IsConfigurationValid() error {\n\tif p.KWMServerURL == \"\" {\n\t\treturn fmt.Errorf(\"KWMServerURL is empty\")\n\t} else if p.KWMServerInternalURL == \"\" {\n\t\treturn fmt.Errorf(\"KWMServerInternalURL is empty\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b6090f4ab54d4a44fde6cd2e3f57ea10", "score": "0.5982658", "text": "func (cfg *Config) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "b6090f4ab54d4a44fde6cd2e3f57ea10", "score": "0.5982658", "text": "func (cfg *Config) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "b6090f4ab54d4a44fde6cd2e3f57ea10", "score": "0.5982658", "text": "func (cfg *Config) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "e9bfa7196c6e39c27613f9f86fafb9a0", "score": "0.5979021", "text": "func (cfg *Config) Validate() error {\n\tif err := utils.MustBeGreaterThanOrEqualTo(workersFlagName, 0, cfg.Workers); err != nil {\n\t\treturn err\n\t}\n\tif err := utils.MustBeGreaterThan(eventsThresholdFlagName, 0, cfg.EventsThreshold); err != nil {\n\t\treturn err\n\t}\n\treturn utils.MustBeGreaterThan(activeDeadlineDurationFlagName, 0, cfg.ActiveDeadlineDuration.Seconds())\n}", "title": "" }, { "docid": "b8811eed72eb3c3634bf5bb439fb4af8", "score": "0.5976229", "text": "func (config Configuration) Validate() error {\n\tif config.NumShards <= 0 {\n\t\treturn fmt.Errorf(\"Configuration: expect configuration NumShards to be positive but got: %d\", config.NumShards)\n\t}\n\n\tif _, exist := config.Groups[uint64(0)]; exist {\n\t\treturn fmt.Errorf(\"Configuration: invalid replication group ID: %d, addr: %v\", uint64(0), config.Groups[uint64(0)])\n\t}\n\n\tif len(config.Groups) == 0 {\n\t\tfor _, group := range config.Location {\n\t\t\tif group != 0 {\n\t\t\t\treturn fmt.Errorf(\"Configuration: expect all shards assigned to group 0 when no group exist but got: %v\", config.Location)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor shard, group := range config.Location {\n\t\t\tif _, exist := config.Groups[group]; !exist {\n\t\t\t\treturn fmt.Errorf(\"Configuration: shard %d is assigned to non-existing group: %d\", shard, group)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b5bcd03db2945cd651c3dfb36f24af38", "score": "0.597228", "text": "func (cfg *Config) Validate() error {\n\tif cfg.ListenAddr == nil {\n\t\treturn errors.New(\"restapi.listen_multiaddress not set\")\n\t}\n\n\tif cfg.ReadTimeout <= 0 {\n\t\treturn errors.New(\"restapi.read_timeout is invalid\")\n\t}\n\n\tif cfg.ReadHeaderTimeout <= 0 {\n\t\treturn errors.New(\"restapi.read_header_timeout is invalid\")\n\t}\n\n\tif cfg.WriteTimeout <= 0 {\n\t\treturn errors.New(\"restapi.write_timeout is invalid\")\n\t}\n\n\tif cfg.IdleTimeout <= 0 {\n\t\treturn errors.New(\"restapi.idle_timeout invalid\")\n\t}\n\n\tif cfg.BasicAuthCreds != nil && len(cfg.BasicAuthCreds) == 0 {\n\t\treturn errors.New(\"restapi.basic_auth_creds should be null or have at least one entry\")\n\t}\n\n\tif (cfg.pathSSLCertFile != \"\" || cfg.pathSSLKeyFile != \"\") && cfg.TLS == nil {\n\t\treturn errors.New(\"error loading SSL certificate or key\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "045e3d825d818b56cfbe5e3b6297c6d4", "score": "0.59655964", "text": "func (conf *Config) Validate() derrors.Error {\n\tif conf.Port <= 0 {\n\t\treturn derrors.NewInvalidArgumentError(\"port must be specified\")\n\t}\n\tif conf.UseDBScyllaProviders && conf.UseInMemoryProviders {\n\t\treturn derrors.NewInvalidArgumentError(\"only one type of provider must be selected\")\n\t}\n\tif conf.UseDBScyllaProviders {\n\t\tif conf.ScyllaDBAddress == \"\" {\n\t\t\treturn derrors.NewInvalidArgumentError(\"address must be specified to use dbScylla Providers\")\n\t\t}\n\t\tif conf.KeySpace == \"\" {\n\t\t\treturn derrors.NewInvalidArgumentError(\"keyspace must be specified to use dbScylla Providers\")\n\t\t}\n\t\tif conf.ScyllaDBPort <= 0 {\n\t\t\treturn derrors.NewInvalidArgumentError(\"port must be specified to use dbScylla Providers \")\n\t\t}\n\t}\n\tif !conf.UseDBScyllaProviders && !conf.UseInMemoryProviders {\n\t\treturn derrors.NewInvalidArgumentError(\"a type of provider must be selected\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9437ead859232cc7ca15eb020364a390", "score": "0.59597224", "text": "func (conf *Config) Validate() error {\n\tif conf.ServerURL == \"\" {\n\t\treturn errors.New(\"server-url missing\")\n\t}\n\n\tif conf.UserName == \"\" {\n\t\treturn errors.New(\"user-name is missing\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e21d0f91d68715e151ed4635463cf002", "score": "0.5959603", "text": "func (cfg Config) Validate() Config {\n\tvalidcfg := cfg\n\n\tif cfg.ShardCount <= 0 || cfg.ShardCount > (math.MaxInt/2) {\n\t\tvalidcfg.ShardCount = defaultShardCount\n\t\tlog.Warn(\"falling back to default configuration\", log.Fields{\n\t\t\t\"name\": Name + \".ShardCount\",\n\t\t\t\"provided\": cfg.ShardCount,\n\t\t\t\"default\": validcfg.ShardCount,\n\t\t})\n\t}\n\n\tif cfg.GarbageCollectionInterval <= 0 {\n\t\tvalidcfg.GarbageCollectionInterval = defaultGarbageCollectionInterval\n\t\tlog.Warn(\"falling back to default configuration\", log.Fields{\n\t\t\t\"name\": Name + \".GarbageCollectionInterval\",\n\t\t\t\"provided\": cfg.GarbageCollectionInterval,\n\t\t\t\"default\": validcfg.GarbageCollectionInterval,\n\t\t})\n\t}\n\n\tif cfg.PrometheusReportingInterval <= 0 {\n\t\tvalidcfg.PrometheusReportingInterval = defaultPrometheusReportingInterval\n\t\tlog.Warn(\"falling back to default configuration\", log.Fields{\n\t\t\t\"name\": Name + \".PrometheusReportingInterval\",\n\t\t\t\"provided\": cfg.PrometheusReportingInterval,\n\t\t\t\"default\": validcfg.PrometheusReportingInterval,\n\t\t})\n\t}\n\n\tif cfg.PeerLifetime <= 0 {\n\t\tvalidcfg.PeerLifetime = defaultPeerLifetime\n\t\tlog.Warn(\"falling back to default configuration\", log.Fields{\n\t\t\t\"name\": Name + \".PeerLifetime\",\n\t\t\t\"provided\": cfg.PeerLifetime,\n\t\t\t\"default\": validcfg.PeerLifetime,\n\t\t})\n\t}\n\n\treturn validcfg\n}", "title": "" }, { "docid": "d2d64e7a4340f06636e521cbe521471a", "score": "0.5954709", "text": "func ValidateConfig() (err error) {\n\tmerr := &multierror.Error{}\n\n\t// validate daemon section\n\terr = ValidateDaemon()\n\tif err != nil {\n\t\tmerr = multierror.Append(merr, err)\n\t}\n\n\t// validate log section\n\terr = ValidateLog()\n\tif err != nil {\n\t\tmerr = multierror.Append(merr, err)\n\t}\n\n\t// validate server section\n\terr = ValidateServer()\n\tif err != nil {\n\t\tmerr = multierror.Append(merr, err)\n\t}\n\n\t// validate database section\n\terr = ValidateDatabase()\n\tif err != nil {\n\t\tmerr = multierror.Append(merr, err)\n\t}\n\n\t// validate soar section\n\terr = ValidateSQLAdvisor()\n\tif err != nil {\n\t\tmerr = multierror.Append(merr, err)\n\t}\n\n\treturn merr.ErrorOrNil()\n}", "title": "" }, { "docid": "2d297dccb56bc2b81317d4e104838381", "score": "0.5948578", "text": "func (config *TelemetryConfiguration) Validate() error {\n\tif config.UploadInterval <= 0 {\n\t\treturn fmt.Errorf(\"UploadInterval can not be <= 0\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "76ab2e8c56828c1585a4d83f53829932", "score": "0.5929093", "text": "func (c *Config) Validate() error {\n\tif c.Meta.Dir == \"\" {\n\t\treturn errors.New(\"Meta.Dir must be specified\")\n\t} else if c.Data.Dir == \"\" {\n\t\treturn errors.New(\"Data.Dir must be specified\")\n\t} else if c.HintedHandoff.Dir == \"\" {\n\t\treturn errors.New(\"HintedHandoff.Dir must be specified\")\n\t}\n\n\t// for _, g := range c.Graphites {\n\t// \tif err := g.Validate(); err != nil {\n\t// \t\treturn fmt.Errorf(\"invalid graphite config: %v\", err)\n\t// \t}\n\t// }\n\treturn nil\n}", "title": "" }, { "docid": "5db907e23aaf44f226bca420b542d472", "score": "0.59226847", "text": "func (c configuration) Validate() error {\n\t// TODO: write config validation\n\n\tif !c.Scrape.Enabled && !(c.Store.Redis.Enabled || c.Store.Cassandra.Enabled) {\n\t\treturn errors.New(\"storage is required when scraping is disabled\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9585165e3cacfbc17d004803047d9ad0", "score": "0.59221363", "text": "func (m *EmbedConfig) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateDomainWhitelist(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSecrets(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": "959a2c2035c49a6792c246a295e71441", "score": "0.5884922", "text": "func (m *AlertingConfig) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAlerts(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateReceiverSecretStatus(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateReceivers(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": "4412061d95420796b0d0e0ff414ddba6", "score": "0.5878837", "text": "func (m *LDAPConfiguration) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateEnforceStarttls(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGroupSearch(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateHost(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePort(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateUseLdaps(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateUserSearch(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": "d9f26db34b3d8f69f66609fa15041194", "score": "0.5878578", "text": "func (c Config) Validate() error {\n\tswitch {\n\tcase c.Network == \"\":\n\t\treturn errors.New(\"network cannot be empty\")\n\tcase c.Address == \"\":\n\t\treturn errors.New(\"address cannot be empty\")\n\t}\n\n\tvar tcp bool\n\tif c.IsTCP() {\n\t\ttcp = true\n\t} else if c.Network != \"unix\" && c.Network != \"unixpacket\" {\n\t\treturn errors.Errorf(`invalid value \"%s\" for \"network\", options are tcp, tcp4, tcp6, unix or unixpacket`, c.Network)\n\t}\n\n\tif tcp {\n\t\t// root can be empty if the certs are trusted by the system\n\t\tswitch {\n\t\tcase c.Certificate == \"\":\n\t\t\treturn errors.Errorf(\"crt cannot be empty if network is %s\", c.Network)\n\t\tcase c.CertificateKey == \"\":\n\t\t\treturn errors.Errorf(\"key cannot be empty if network is %s\", c.Network)\n\t\t}\n\t}\n\n\treturn c.Provisioner.Validate()\n}", "title": "" }, { "docid": "a836902d517f24daa5aac1619275ca72", "score": "0.5876454", "text": "func (m *PacketGeneratorConfig) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateDuration(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFlowCount(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLoad(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOrder(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateProtocolCounters(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTraffic(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": "143aa72072d5e83ebcc085a2869d8720", "score": "0.5866221", "text": "func (d *Config) Validate() error {\n\tvar errors util.ValidateErrors\n\n\tif d.Address == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"address must be set\"))\n\t}\n\n\tif d.User == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"user must be set\"))\n\t}\n\n\tif d.Password == \"\" && d.PrivateKey == \"\" && os.Getenv(SSHAuthSockEnv) == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"at least one authentication method must be available\"))\n\t}\n\n\tif _, err := gossh.ParsePrivateKey([]byte(d.PrivateKey)); d.PrivateKey != \"\" && err != nil {\n\t\terrors = append(errors, fmt.Errorf(\"parsing private key: %w\", err))\n\t}\n\n\tif d.Port == 0 {\n\t\terrors = append(errors, fmt.Errorf(\"port must be set\"))\n\t}\n\n\terrors = append(errors, d.validateDurations()...)\n\n\treturn errors.Return()\n}", "title": "" }, { "docid": "12742b4d5d7bd6cff51ecd13fa5039f3", "score": "0.5864744", "text": "func (config Config) Validate() error {\r\n\tvalidate := validator.New()\r\n\treturn validate.Struct(config)\r\n}", "title": "" }, { "docid": "75e492946d9d9fc3b4a61284e567b562", "score": "0.58606994", "text": "func (m *Configuration) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tfor idx, item := range m.GetControlPlanes() {\n\t\t_, _ = idx, item\n\n\t\tif v, ok := interface{}(item).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn ConfigurationValidationError{\n\t\t\t\t\tfield: fmt.Sprintf(\"ControlPlanes[%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\tfor idx, item := range m.GetContexts() {\n\t\t_, _ = idx, item\n\n\t\tif v, ok := interface{}(item).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn ConfigurationValidationError{\n\t\t\t\t\tfield: fmt.Sprintf(\"Contexts[%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\t// no validation rules for CurrentContext\n\n\treturn nil\n}", "title": "" }, { "docid": "4a223e3e03c8bc57ee46376d78d2c1f1", "score": "0.5850869", "text": "func (c *Config) Validate() (err error) {\n\tif c.SleepMilli <= 0 {\n\t\treturn Errorf(`invalid SleepMilli: %d`, c.SleepMilli)\n\t}\n\tif c.ScreenWidth <= 0 {\n\t\treturn Errorf(`invalid ScreenWidth: %d`, c.ScreenWidth)\n\t}\n\tif c.ScreenHeight <= 0 {\n\t\treturn Errorf(`invalid ScreenHeight: %d`, c.ScreenHeight)\n\t}\n\tif c.FontFace == \"\" {\n\t\treturn Errorf(`invalid FontFace: '%s'`, c.FontFace)\n\t}\n\tif c.FontSize <= 0 {\n\t\treturn Errorf(`invalid FontSize: %d`, c.FontSize)\n\t}\n\tif c.BlackOutlineScale <= 0 {\n\t\treturn Errorf(`invalid BlackOutlineScale: %+v`, c.BlackOutlineScale)\n\t}\n\tif c.WhiteOutlineScale <= 0 {\n\t\treturn Errorf(`invalid WhiteOutlineScale: %+v`, c.WhiteOutlineScale)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7212119fc8409fefc5697adbbd41d91c", "score": "0.5847776", "text": "func (c Config) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "7212119fc8409fefc5697adbbd41d91c", "score": "0.5847776", "text": "func (c Config) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "7212119fc8409fefc5697adbbd41d91c", "score": "0.5847776", "text": "func (c Config) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "368296ef7ac7a5240c03d37e9af3bd87", "score": "0.5843254", "text": "func (m *WhitelabelConfiguration) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "57d9b7e5efa8416bdc105a2ce5ce623c", "score": "0.5839091", "text": "func (whc *WebHookConfig) Validate() error {\n\tif whc == nil {\n\t\treturn errors.New(\"webHook config is required\")\n\t}\n\tif whc.URL == \"\" {\n\t\treturn errors.New(\"'url' is required parameter\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f1756a7a0fa76b7eaab097bb2896df4d", "score": "0.58338046", "text": "func (c Config) Validate() error {\n\tif c.NSQDAddress == \"\" {\n\t\treturn errors.New(\"NSQDAddress cannot be blank\")\n\t}\n\tif c.NSQLookupdAddress == \"\" {\n\t\treturn errors.New(\"NSQLookupdAddress cannot be blank\")\n\t}\n\tif c.SendGridAPIKey == \"\" {\n\t\treturn errors.New(\"SendGridAPIKey cannot be blank\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f1fc1e8479d4c1f5f0798fc0a368fc2e", "score": "0.58232486", "text": "func (c *Config) Validate() error {\n\tif _, err := c.ParseListenAddress(); err != nil {\n\t\treturn errors.WithMessage(err, \"parse listen address as multiaddr\")\n\t}\n\tif c.DataPath == \"\" {\n\t\treturn errors.New(\"data path must be specified\")\n\t}\n\tif _, ok := daemonDatabaseImpls[c.DataDb]; !ok {\n\t\treturn errors.Errorf(\"database impl %q not known\", c.DataDb)\n\t}\n\tfor ai, addr := range c.AddrFilters {\n\t\tif _, _, err := net.ParseCIDR(addr); err != nil {\n\t\t\treturn errors.Errorf(\"addr-filters[%d]: invalid: %v\", ai, err.Error())\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "138e3917de8694ff0ef8e6b77bccec45", "score": "0.5816633", "text": "func ValidateStakingConfig(config *config.Config) {\n\t_, err := config.String(\"Staker.Protocol\")\n\tif err != nil {\n\t\tlog.WithError(err).Fatal(\"failed to read staker protocol from config\")\n\t}\n\n\t_, err = config.String(\"Staker.Network\")\n\tif err != nil {\n\t\tlog.WithError(err).Fatal(\"failed to read staker network from config\")\n\t}\n}", "title": "" }, { "docid": "6c7c1b3c9edb3d525fde0a220ac43872", "score": "0.58022785", "text": "func (config appConfig) Validate() error {\n\treturn validation.ValidateStruct(&config,\n\t\tvalidation.Field(&config.JWTSigningKey, validation.Required),\n\t\tvalidation.Field(&config.JWTVerificationKey, validation.Required),\n\t)\n}", "title": "" }, { "docid": "c3879708a3f685076fed46a19d10ba80", "score": "0.57978064", "text": "func (c *config) Validate() error {\n\n\treturn c.SetSecretBackend(c.wrapper.SecretBackend)\n}", "title": "" }, { "docid": "682b04a071112e99916ee4a5755de02a", "score": "0.5778847", "text": "func (c *configuration) ValidateConfig() error {\n\n\t////deserialize Questions\n\t//questionsMap := map[string]Question{}\n\t//err := c.UnmarshalKey(\"questions\", &questionsMap)\n\t//\n\t//if err != nil {\n\t//\tlog.Printf(\"questions could not be deserialized correctly. %v\", err)\n\t//\treturn err\n\t//}\n\t//\n\t//for _, v := range questionsMap {\n\t//\n\t//\ttypeContent, ok := v.Schema[\"type\"].(string)\n\t//\tif !ok || len(typeContent) == 0 {\n\t//\t\treturn errors.QuestionSyntaxError(\"`type` is required for questions\")\n\t//\t}\n\t//}\n\t//\n\t//\n\n\treturn nil\n}", "title": "" }, { "docid": "6294463a0f82a341d2bbc4f74bdb29f7", "score": "0.5776035", "text": "func (cfg *Config) Validate() (err error) {\n\tif cfg.DSN == \"\" {\n\t\terr = multierr.Append(err, errConfigNoDSN)\n\t}\n\t_, e := parseDSNDatabase(cfg.DSN)\n\tif e != nil {\n\t\terr = multierr.Append(err, fmt.Errorf(\"invalid dsn format:%w\", err))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "5593bdcd9d4e689a31c257e225dd4857", "score": "0.57749546", "text": "func (config *Config) Validate() error {\n\tif (len(config.Include.Metrics) > 0 && len(config.Include.MatchType) == 0) ||\n\t\t(len(config.Exclude.Metrics) > 0 && len(config.Exclude.MatchType) == 0) {\n\t\treturn fmt.Errorf(\"match_type must be set if metrics are supplied\")\n\t}\n\tif (len(config.Include.MatchType) > 0 && len(config.Include.Metrics) == 0) ||\n\t\t(len(config.Exclude.MatchType) > 0 && len(config.Exclude.Metrics) == 0) {\n\t\treturn fmt.Errorf(\"metrics must be supplied if match_type is set\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dd7ba639b15beb286a216b535ffd06e9", "score": "0.5774581", "text": "func (a *ListDirectory) ValidateConfiguration() (bool, []string) {\n\t// Check if Cfgs are there as needed\n\t// Needs a Directory to monitor\n\tpathProp := a.Cfg.GetProperty(\"path\")\n\tmissing := make([]string, 0)\n\tif pathProp == nil {\n\t\tmissing = append(missing, \"path\")\n\t\treturn false, missing\n\t}\n\tbufferProp := a.Cfg.GetProperty(\"buffertime\")\n\tif bufferProp.Value == nil {\n\t\ta.buffertime = DefaultBufferTime\n\t} else {\n\t\tvalue, err := bufferProp.Int64()\n\t\tif err != nil {\n\t\t\tmissing = append(missing, \"buffertime\")\n\t\t\treturn false, missing\n\t\t}\n\t\ta.buffertime = value\n\t}\n\n\ta.path = pathProp.String()\n\treturn true, nil\n}", "title": "" }, { "docid": "38f853b197f1ce75b3e923208f6c81c3", "score": "0.57744163", "text": "func (rCfg *Config) Validate() error {\n\tif rCfg.HTTPServerSettings.Endpoint == \"\" {\n\t\treturn errEmptyEndpoint\n\t}\n\n\t_, err := extractPortFromEndpoint(rCfg.HTTPServerSettings.Endpoint)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "746c400bf5e2321ca535a719f7dfa32e", "score": "0.5773204", "text": "func (c *Config) Validate() error {\n\terrors := []error{}\n\n\terr := validator.New().Struct(c)\n\tif validationErrors, ok := err.(validator.ValidationErrors); err != nil && ok {\n\t\tfor _, fieldError := range validationErrors {\n\t\t\terrors = append(errors,\n\t\t\t\ttrace.Errorf(\" * %s=\\\"%v\\\" fails \\\"%s\\\"\", fieldError.Field(), fieldError.Value(), fieldError.Tag()))\n\t\t}\n\t}\n\n\tif len(errors) != 0 {\n\t\treturn trace.NewAggregate(errors...)\n\t}\n\n\tswitch c.CloudProvider {\n\tcase constants.AWS:\n\t\tif c.AWS == nil {\n\t\t\treturn trace.BadParameter(\"AWS configuration is required\")\n\t\t}\n\t\tif c.AWS.SSHUser == \"\" || c.AWS.SSHKeyPath == \"\" {\n\t\t\treturn trace.BadParameter(\"AWS SSH access configuration is required\")\n\t\t}\n\tcase constants.Azure:\n\t\tif c.Azure == nil {\n\t\t\treturn trace.BadParameter(\"Azure configuration is required\")\n\t\t}\n\t\tif c.Azure.SSHUser == \"\" || c.Azure.SSHKeyPath == \"\" {\n\t\t\treturn trace.BadParameter(\"Azure SSH access configuration is required\")\n\t\t}\n\tcase constants.GCE:\n\t\treturn trace.Wrap(c.GCE.CheckAndSetDefaults())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "daabb09bfaa4360a55ae38532cfb0fd0", "score": "0.5772296", "text": "func (c *Config) Validate() error {\n\tvl := validator.New()\n\treturn vl.Err()\n}", "title": "" }, { "docid": "dd36b620b32b60d261c21c8842873b9c", "score": "0.57721585", "text": "func (cfg *Config) Validate() error {\n\tif _, ok := supportedLevels[cfg.Verbosity]; !ok {\n\t\treturn fmt.Errorf(\"verbosity level %q is not supported\", cfg.Verbosity)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8f4f0434b2c0da2c7973c6a8396a4579", "score": "0.57699865", "text": "func (initializerConfigurationStrategy) Validate(ctx genericapirequest.Context, obj runtime.Object) field.ErrorList {\n\tic := obj.(*admissionregistration.InitializerConfiguration)\n\treturn validation.ValidateInitializerConfiguration(ic)\n}", "title": "" }, { "docid": "24136b55cf7b65efab08b2e6f4bb621f", "score": "0.57593334", "text": "func (c *Config) Validate() error {\n\tif c.DbHost == \"\" {\n\t\treturn errors.New(\"dbHost was empty\")\n\t}\n\tif c.DbName == \"\" {\n\t\treturn errors.New(\"dbName was empty\")\n\t}\n\tif c.DbSecretParam == \"\" {\n\t\treturn errors.New(\"dbSecretParam was empty\")\n\t}\n\tif c.StorageSecretParam == \"\" {\n\t\treturn errors.New(\"storageSecretParam was empty\")\n\t}\n\tif c.DefaultStorageURL == \"\" {\n\t\treturn errors.New(\"defaultStorageURL was empty\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "62ff78386166266c0ab320471e66b24c", "score": "0.5754177", "text": "func (Config) Validate() error {\n\tif DefaultEncoding == Delta {\n\t\t// Delta is deprecated.\n\t\treturn errors.New(\"delta encoding is deprecated\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c5b8d72c9f8f3de0cbae91a19f323b17", "score": "0.575379", "text": "func (c *Config) Validate() error {\n\tif c.Bind == \"\" {\n\t\treturn errors.New(\"'Bind' is not set\")\n\t}\n\n\tif c.PromBind == \"\" {\n\t\treturn errors.New(\"'PromBind' is not set\")\n\t}\n\n\tif c.Zone == \"\" {\n\t\treturn errors.New(\"'Zone' is not set\")\n\t}\n\n\tif len(c.Services) == 0 {\n\t\treturn errors.New(\"'Services' must be defined\")\n\t}\n\n\tif hasDuplicate(c.Services) {\n\t\treturn errors.New(\"'Services' contains duplicate entries\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2080551ef4c966a8e2d454045cde6d47", "score": "0.575272", "text": "func (c *LdapConfig) Validate() error {\n\tif c.URL == \"\" {\n\t\treturn errors.New(\"ldap_config.server configuration must be set to a valid address (format: <LDAP_HOST:<LDAP_PORT>)\")\n\t}\n\tif c.CacheDir == \"\" {\n\t\tc.CacheDir = \"./.cache\"\n\t}\n\tif c.CacheTTL <= 0 {\n\t\tc.CacheTTL = 1 // Setting default to 1 second as 0 would mean no expiry\n\t}\n\tif c.BindDN == \"\" {\n\t\treturn errors.New(\"ldap_config.bind_dn must be set\")\n\t}\n\tif len(c.BaseDnMappings) == 0 {\n\t\treturn errors.New(\"ldap_config.base_dn_mappings must be set\")\n\t} else {\n\t\tfor k, v := range c.BaseDnMappings {\n\t\t\tif len(v.BaseDnList) == 0 && v.Filter == \"\" {\n\t\t\t\treturn fmt.Errorf(\"base_dn_list for %s must have at least one base DN or custom filter must be set\", k)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(c.DefaultAttributes) == 0 {\n\t\treturn errors.New(\"ldap_config.attributes must be set\")\n\t}\n\tif c.Authenticated && strings.Trim(c.PasswordEnvVar, \" \") == \"\" {\n\t\treturn errors.New(\"The password_env_var value must be specified when authenticated=true\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d283eb88e6ac466852968c8714ba1b55", "score": "0.57391745", "text": "func (config KubeRunConfig) Validate() error {\n\tif err := config.Connection.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"invalid connection configuration (%w)\", err)\n\t}\n\tif err := config.Pod.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"invalid pod configuration (%w)\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "beff3983c5d214a3cccd53af401ae416", "score": "0.5737687", "text": "func validateConfig() (bool, error) {\n\t// variable to be validated\n\tvar config Config\n\n\t// setup validator\n\tvar validate *validator.Validate = validator.New()\n\n\t// prepare config for validation\n\tif err := viper.Unmarshal(&config); err != nil {\n\t\tfmt.Println(err)\n\t\treturn false, errors.New(\"Unable to validate config.\")\n\t}\n\n\t// validate config\n\tif err := validate.Struct(config); err != nil {\n\t\tfor _, err := range err.(validator.ValidationErrors) {\n\t\t\tswitch err.Tag() {\n\t\t\tcase \"required\":\n\t\t\t\tlogger.Error(\"Required value for \\\"%s\\\" is missing.\", err.Namespace())\n\t\t\tcase \"unique\":\n\t\t\t\tlogger.Error(\"Duplicate value found in \\\"%s\\\".\", err.Namespace())\n\t\t\tcase \"oneof\":\n\t\t\t\tlogger.Error(\"Value for \\\"%s\\\" should be one of \\\"%s\\\" (actual: %s).\", err.Namespace(), err.Param(), err.Value())\n\t\t\tcase \"url\":\n\t\t\t\tlogger.Error(\"Value for \\\"%s\\\" should be of type URL (actual: %s).\", err.Namespace(), err.Value())\n\t\t\tcase \"startswith\":\n\t\t\t\tlogger.Error(\"Value for \\\"%s\\\" should start with \\\"%s\\\" (actual: %s).\", err.Namespace(), err.Param(), err.Value())\n\t\t\tcase \"endsnotwith\":\n\t\t\t\tlogger.Error(\"Value for \\\"%s\\\" should not end with \\\"%s\\\" (actual: %s).\", err.Namespace(), err.Param(), err.Value())\n\t\t\t}\n\t\t}\n\n\t\t// invalid config\n\t\treturn false, errors.New(\"Provided config is invalid - please check validation errors above.\")\n\t}\n\n\t// valid config\n\treturn true, nil\n}", "title": "" }, { "docid": "3ca3edb0721fe445fd3123832a4e9060", "score": "0.5732677", "text": "func Validate() error {\n\tif len(viper.GetString(\"log_level.file\")) <= 0 {\n\t\tglog.Errorf(\"Cannot read log_level.file in config\")\n\t\treturn errors.ErrConfigWrangParams\n\t}\n\tif len(viper.GetString(\"log_level.command\")) <= 0 {\n\t\tglog.Errorf(\"Cannot read log_level.ficommandle in config\")\n\t\treturn errors.ErrConfigWrangParams\n\t}\n\tif len(viper.GetString(\"log_file\")) <= 0 {\n\t\tglog.Errorf(\"Cannot read log_file in config\")\n\t\treturn errors.ErrConfigWrangParams\n\t}\n\tif len(viper.GetString(\"http_listen.ip\")) <= 0 {\n\t\tglog.Errorf(\"Cannot read http_listen.ip in config\")\n\t\treturn errors.ErrConfigWrangParams\n\t}\n\tif len(viper.GetString(\"http_listen.port\")) <= 0 {\n\t\tglog.Errorf(\"Cannot read lhttp_listen.port in config\")\n\t\treturn errors.ErrConfigWrangParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a10873822307874e1b9d026546444f42", "score": "0.5732289", "text": "func (c *Config) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "a10873822307874e1b9d026546444f42", "score": "0.5732289", "text": "func (c *Config) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "accc79f57f5d66c5f081330ce9ca4d11", "score": "0.57307494", "text": "func (c configuration) Validate() error {\n\tdef := defaults()\n\tif strings.TrimSpace(c.RootDir) == \"\" {\n\t\tc.RootDir = def.RootDir\n\t\tlog.Printf(\"Configuration has no value for root directory, assuming default of '%s'\", c.RootDir)\n\t}\n\tif _, err := os.Stat(c.RootDir); err != nil {\n\t\treturn fmt.Errorf(\"Could not find root directory '%s': %s\", c.RootDir, err)\n\t}\n\n\tif strings.TrimSpace(c.StyleDir) == \"\" {\n\t\tc.StyleDir = def.StyleDir\n\t\tlog.Printf(\"Configuration has no value for style directory, assuming default of '%s'\", c.StyleDir)\n\t}\n\tif _, err := os.Stat(c.StyleDir); err != nil {\n\t\treturn fmt.Errorf(\"Could not find style directory '%s': %s\", c.StyleDir, err)\n\t}\n\n\tif strings.TrimSpace(c.TemplateDir) == \"\" {\n\t\tc.TemplateDir = def.TemplateDir\n\t\tlog.Printf(\"Configuration has no value for template directory, assuming default of '%s'\", c.TemplateDir)\n\t}\n\tif _, err := os.Stat(c.TemplateDir); err != nil {\n\t\treturn fmt.Errorf(\"Could not find template directory '%s': %s\", c.TemplateDir, err)\n\t}\n\n\tif c.Port == 0 {\n\t\tc.Port = def.Port\n\t\tlog.Printf(\"Configuration port unset; using default %d\", def.Port)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "77c1a7d873dcca7d4603ad40245e5a89", "score": "0.5717686", "text": "func ValidateConfig(jsonData string) CVLRetCode {\n\tclearTmpDbCache()\n\n\t//Convert JSON to YANG XML \n\tdoc, err := translateToYang(jsonData)\n\tif (err == CVL_SUCCESS) {\n\t\tyangXml := doc.OutputXML(true)\n\n\t\treturn validate(yangXml)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "733a2377e3932b85f3bd2c811b138def", "score": "0.5716516", "text": "func (c Config) Validate() error {\n\tif c.DSN == \"\" {\n\t\treturn fmt.Errorf(\"%s field: empty\", \"DSN\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "988007b673f3f01d0564203f50a9422d", "score": "0.5712287", "text": "func (adxCfg *Config) Validate() error {\n\tif adxCfg == nil {\n\t\treturn errors.New(\"ADX config is nil / not provided\")\n\t}\n\tisAppAuthEmpty := isEmpty(adxCfg.ApplicationID) || isEmpty(string(adxCfg.ApplicationKey)) || isEmpty(adxCfg.TenantID)\n\tisManagedAuthEmpty := isEmpty(adxCfg.ManagedIdentityID)\n\tisClusterURIEmpty := isEmpty(adxCfg.ClusterURI)\n\t// Cluster URI is the target ADX cluster\n\tif isClusterURIEmpty {\n\t\treturn errors.New(`clusterURI config is mandatory`)\n\t}\n\t// Parameters for AD App Auth or Managed Identity Auth are mandatory\n\tif isAppAuthEmpty && isManagedAuthEmpty {\n\t\treturn errors.New(`either [\"application_id\" , \"application_key\" , \"tenant_id\"] or [\"managed_identity_id\"] are needed for auth`)\n\t}\n\n\tif !(adxCfg.IngestionType == managedIngestType || adxCfg.IngestionType == queuedIngestTest || isEmpty(adxCfg.IngestionType)) {\n\t\treturn fmt.Errorf(\"unsupported configuration for ingestion_type. Accepted types [%s, %s] Provided [%s]\", managedIngestType, queuedIngestTest, adxCfg.IngestionType)\n\t}\n\t// Validate managed identity ID. Use system for system assigned managed identity or UserManagedIdentityID (objectID) for user assigned managed identity\n\tif !isEmpty(adxCfg.ManagedIdentityID) && !strings.EqualFold(strings.TrimSpace(adxCfg.ManagedIdentityID), \"SYSTEM\") {\n\t\t// if the managed identity is not a system identity, validate if it is a valid UUID\n\t\t_, err := uuid.Parse(strings.TrimSpace(adxCfg.ManagedIdentityID))\n\t\tif err != nil {\n\t\t\treturn errors.New(\"managed_identity_id should be a UUID string (for User Managed Identity) or system (for System Managed Identity)\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9c2384add5f9453b99e7c2aec4b9a1fe", "score": "0.57089263", "text": "func (c *Config) Validate() error {\n\tif c.Meta.Dir == \"\" {\n\t\treturn errors.New(\"Meta.Dir must be specified\")\n\t} else if c.Data.Dir == \"\" {\n\t\treturn errors.New(\"Data.Dir must be specified\")\n\t} else if c.HintedHandoff.Dir == \"\" {\n\t\treturn errors.New(\"HintedHandoff.Dir must be specified\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fe4bb7b50f7ff5a2f20fe4de748a8f6f", "score": "0.5700558", "text": "func (c *Config) Validate() error {\n\tif c.HTTP.Enable {\n\t\t_, _, err := net.SplitHostPort(c.HTTP.Addr)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"invalid http_addr\")\n\t\t}\n\t}\n\t_, _, err := net.SplitHostPort(c.GRPC.Addr)\n\tif err != nil {\n\t\treturn errors.New(\"invalid grpc_addr\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fec861b5a501cfb05bea9ac9ee922dc8", "score": "0.5695624", "text": "func (c *Config) Validate() error {\n\tif c.Output == nil {\n\t\treturn errors.New(\"butler: an Output must be supplied\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef973179d397fb199589160b4150bf7b", "score": "0.5693003", "text": "func ValidConfig(cfg *Config) error {\n\tswitch {\n\tcase cfg == nil:\n\t\treturn fmt.Errorf(\"`Config` not found\")\n\tcase cfg.Logger == nil:\n\t\treturn fmt.Errorf(\"`Logger` not found\")\n\tcase cfg.SessionStore == nil:\n\t\treturn fmt.Errorf(\"`SessionStore` not found\")\n\tcase cfg.DBHandler == nil:\n\t\treturn fmt.Errorf(\"`DBHandler` not found\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0ba1c04b01cef63f837edc25c9ce8792", "score": "0.5680736", "text": "func (m *ConfigurationBundle) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f075baa389b8f6fffac1175b8a3d669", "score": "0.56777835", "text": "func validateConfig(conf Conf) error {\n\tvar problems []string\n\n\tif len(problems) > 0 {\n\t\treturn errors.New(strings.Join(problems, \", \"))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e35614372feeb6612348eab466a2dcb6", "score": "0.5676488", "text": "func (c Config) Validate() error {\n\tswitch {\n\tcase c.ShowAllPolicy,\n\t\tc.TargetResource != \"\",\n\t\tc.TargetAction != \"\",\n\t\tc.TargetActionService != \"\":\n\t\treturn nil\n\t}\n\treturn errors.New(\"Config does not contain valid rules\")\n}", "title": "" }, { "docid": "fd7b5479c99db097244fd9b12cc85be8", "score": "0.56762457", "text": "func ValidateConfig() error {\n\terrs := []error{}\n\n\tif DefaultAWSRegion == \"\" {\n\t\terrs = append(errs, errors.New(\"AWS region cannot be empty\"))\n\t}\n\n\tif err := errorlib.Merge(errs); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "33e584b2b13835df3b66689ab0f2081d", "score": "0.56759655", "text": "func (m *FalconxMalwareConfig) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateC2s(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMitreAttacks(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": "1838d59092dda3f9ad5ecfc47d1e7e7d", "score": "0.5675711", "text": "func (m *Config) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAuthInfos(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateClusters(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateContexts(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateExtensions(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePreferences(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": "29526415972f8568dc8f44b0d04aaded", "score": "0.5671032", "text": "func (c *Config) Validate() error {\n\terrPrefix := \"config error: \"\n\n\tif c.SSL {\n\t\tif c.SSLCert == \"\" {\n\t\t\treturn errors.New(errPrefix + \"no SSL certificate provided\")\n\t\t}\n\t\tif c.SSLKey == \"\" {\n\t\t\treturn errors.New(errPrefix + \"no SSL certificate key provided\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "86a1c66d0c6ba892f996acd499630228", "score": "0.5668402", "text": "func (c *Config) Validate() error {\n\tif c.Endpoint == \"\" {\n\t\treturn errors.New(\"no endpoint was provided\")\n\t}\n\n\tvar err error\n\tres, err := url.Parse(c.Endpoint)\n\tif err != nil {\n\t\terr = multierr.Append(err, fmt.Errorf(\"unable to parse url %s: %w\", c.Endpoint, err))\n\t\treturn err\n\t}\n\n\tif res.Scheme != \"http\" && res.Scheme != \"https\" {\n\t\terr = multierr.Append(err, errors.New(\"url scheme must be http or https\"))\n\t}\n\n\tif c.Username == \"\" {\n\t\terr = multierr.Append(err, errors.New(\"username not provided and is required\"))\n\t}\n\n\tif c.Password == \"\" {\n\t\terr = multierr.Append(err, errors.New(\"password not provided and is required\"))\n\t}\n\n\tif _, tlsErr := c.LoadTLSConfig(); err != nil {\n\t\terr = multierr.Append(err, fmt.Errorf(\"error loading tls configuration: %w\", tlsErr))\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "a5a6f3791267e05d459215e50c9a7826", "score": "0.5666907", "text": "func (c *Config) Validate() error {\n\tc.Init()\n\tif c.Dest.URL == \"\" {\n\t\treturn errors.Errorf(\"dest.url was empty\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59ed8a8677501ed9794c18a8f3cd3b1a", "score": "0.5663286", "text": "func (c Config) validate() error {\n\t/*\n\t\tif c.Enabled && !c.ServerlessMode.Enabled {\n\t\t\tif len(c.License) != licenseLength {\n\t\t\t\treturn errLicenseLen\n\t\t\t}\n\t\t} else {\n\t\t\t// The License may be empty when the agent is not enabled.\n\t\t\tif len(c.License) != licenseLength && len(c.License) != 0 {\n\t\t\t\treturn errLicenseLen\n\t\t\t}\n\t\t}\n\t*/\n\tif \"\" == c.AppName && c.Enabled && !c.ServerlessMode.Enabled {\n\t\treturn errAppNameMissing\n\t}\n\tif c.HighSecurity && \"\" != c.SecurityPoliciesToken {\n\t\treturn errHighSecurityWithSecurityPolicies\n\t}\n\tif len(c.AppName) > appNameLimit {\n\t\treturn errAppNameLimit\n\t}\n\tif \"\" != c.InfiniteTracing.TraceObserver.Host && c.ServerlessMode.Enabled {\n\t\treturn errInfTracingServerless\n\t}\n\tif \"\" == c.AgentID {\n\t\treturn errAgentIDMissing\n\t}\n\tif len(c.AgentID) > agentIDLimit {\n\t\treturn errAgentIDLimit\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2ccd8b3946ee154aba2e394bce909413", "score": "0.56631917", "text": "func (conf *Config) Validate() derrors.Error {\n\tif conf.Port <= 0 {\n\t\treturn derrors.NewInvalidArgumentError(\"ports must be valid\")\n\t}\n\tif conf.MusicianAddress == \"\" {\n\t\treturn derrors.NewInvalidArgumentError(\"musicianAddress invalid\")\n\t}\n\tif conf.DeploymentManagerAddress == \"\" {\n\t\treturn derrors.NewInvalidArgumentError(\"deploymentManagerAddress invalid\")\n\t}\n\tif conf.UnifiedLoggingAddress == \"\" {\n\t\treturn derrors.NewInvalidArgumentError(\"unifiedLoggingAddress invalid\")\n\t}\n\tif conf.MetricsCollectorAddress == \"\" {\n\t\treturn derrors.NewInvalidArgumentError(\"metricsCollectorAddress invalid\")\n\t}\n\tif conf.ClusterWatcherAddress == \"\" {\n\t\treturn derrors.NewInvalidArgumentError(\"clusterWatcherAddress invalid\")\n\t}\n\tif conf.ManagementPublicHost == \"\" {\n\t\treturn derrors.NewInvalidArgumentError(\"managementPublicHost must be set\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f9b92ae3814a0de80571064d4d89ca75", "score": "0.5662548", "text": "func (c BackendConfig) Validate() error {\n\tif c.HealthTimeout <= 0 {\n\t\treturn fmt.Errorf(\"'health-check-timeout' = '%s' cannot be 0 or negative\", c.HealthTimeout)\n\t}\n\tif c.HealthTimeout > Duration(time.Second) {\n\t\treturn fmt.Errorf(\"'health-check-timeout' = '%s' cannot be longer than '1s'\", c.HealthTimeout)\n\t}\n\tif c.DialTimeout <= 0 {\n\t\treturn fmt.Errorf(\"'dial-timeout' = '%s' cannot be 0 or negative\", c.DialTimeout)\n\t}\n\tif c.LatencyAvg <= 0 {\n\t\treturn fmt.Errorf(\"'latency-average-seconds' = '%d' cannot be 0 or negative\", c.LatencyAvg)\n\t}\n\treturn nil\n}", "title": "" } ]
707fafc9cc14d2a3be12e67fdb3a7b6f
GetString returns single entry by path
[ { "docid": "3094f570941eacb4652c8be7531ebb47", "score": "0.0", "text": "func (c *Client) GetString(p string) (string, error) {\n\tm, err := c.EC2Metadata.GetMetadata(p)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn m, nil\n}", "title": "" } ]
[ { "docid": "1817e10a01948837803ac4e3bdca85ab", "score": "0.6541712", "text": "func (v *Value) GetString(keys ...string) (string, error) {\n\tchild, err := v.getPath(keys)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t} else {\n\t\treturn child.AsString()\n\t}\n\n\treturn \"\", nil\n}", "title": "" }, { "docid": "2bfe4d7094db6319a8c51a208568ae83", "score": "0.64745533", "text": "func (db *RedicoDB) stringGet(k string) string {\n\tdata, err := db.leveldb.Get([]byte(k), nil)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(data)\n}", "title": "" }, { "docid": "609f6b5fe19c37305d5df51519a14561", "score": "0.64690655", "text": "func (vm Web100ValueMap) GetString(path []string) (string, bool) {\n\tif len(path) <= 1 {\n\t\tval, ok := vm[path[0]]\n\t\tif ok {\n\t\t\treturn val.(string), ok\n\t\t} else {\n\t\t\treturn \"\", ok\n\t\t}\n\t} else {\n\t\tnext := vm.Get(path[0])\n\t\tif next != nil {\n\t\t\treturn next.GetString(path[1:])\n\t\t} else {\n\t\t\treturn \"\", false\n\t\t}\n\t}\n}", "title": "" }, { "docid": "64af11cb540bac8a9cfa0b556a91d345", "score": "0.620196", "text": "func (d Dict) StringEntry(key string) *string {\n\n\tvalue, found := d.Find(key)\n\tif !found {\n\t\treturn nil\n\t}\n\n\tpdfStr, ok := value.(StringLiteral)\n\tif ok {\n\t\ts := string(pdfStr)\n\t\treturn &s\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7b7e45c10217abe572946331d31c251a", "score": "0.6162173", "text": "func (cache *FileCache) GetItemString(name string) (content string, ok bool) {\n\titm, ok := cache.getItem(name)\n\tif !ok {\n\t\treturn\n\t}\n\tcontent = string(itm.Access())\n\treturn\n}", "title": "" }, { "docid": "ab7f6a873f89c244244af2fc56d2930b", "score": "0.6102817", "text": "func (j *Data) Str(path string) string {\n\tif str, ok := j.Path(path).obj.(string); ok {\n\t\treturn str\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "94b2cb2d8041a33993d787994b459967", "score": "0.6046846", "text": "func GetString(key RootKey) string {\n\treturn root.GetString(string(key))\n}", "title": "" }, { "docid": "46fc26f18818837a475b0e8059cc71bb", "score": "0.5998294", "text": "func GetString(json map[string]interface{}, path ...string) (string, bool) {\n\tv, ok := Get(json, path...)\n\tif !ok {\n\t\treturn \"\", false\n\t}\n\tval, ok := v.(string)\n\tif !ok {\n\t\treturn \"\", false\n\t}\n\treturn val, true\n}", "title": "" }, { "docid": "7a3cbd27d2495d0e171ba5327a66c5d2", "score": "0.5936798", "text": "func (c *Conf) GetString(path string) string {\r\n\treturn c.GetStringWithDef(path, \"\")\r\n}", "title": "" }, { "docid": "c33d768a8c139c8bce7500672f70b84f", "score": "0.58764064", "text": "func (t *Toystore) GetString(key string) (string, bool) {\n\td, ok := t.Get(key)\n\treturn d.(string), ok\n}", "title": "" }, { "docid": "b3bf6227d5def1ce1af88e1e8d66fc5c", "score": "0.5863395", "text": "func (n *Node) GetString(key string) string {\n\tnode := n.load()\n\treturn node.GetString(key)\n}", "title": "" }, { "docid": "2aa91037d2ade3d51071dc3da3286143", "score": "0.5830802", "text": "func (conf *HadeConfig) GetString(key string) string {\n\treturn cast.ToString(conf.find(key))\n}", "title": "" }, { "docid": "1309c227d2b13529efadc6017bc8e013", "score": "0.5788552", "text": "func (s *GeddisStore) GetStr(key string) (string, error) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\ts.cleanExpired()\n\n\telem, ok := s.m[key]\n\tif !ok {\n\t\treturn \"\", ErrNotFound\n\t}\n\n\tresp, ok := elem.(string)\n\tif !ok {\n\t\treturn \"\", ErrInvalidType\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "8a4c5ee2f5cdad89cff82c46635d6a64", "score": "0.57621884", "text": "func (rg *Reg) GetString(key string) (x string, err error) {\n\trg.m.RLock()\n\tdefer rg.m.RUnlock()\n\n\tj, err := rg.get(key)\n\tif err != nil {\n\t\treturn\n\t}\n\tswitch v := j.(type) {\n\tcase nil:\n\t\tx = \"null\"\n\tcase bool:\n\t\tif v {\n\t\t\tx = \"true\"\n\t\t} else {\n\t\t\tx = \"false\"\n\t\t}\n\t//case float64:\n\t//x = strconv.FormatFloat(v, 'f', -1, 64)\n\tcase string:\n\t\tx = v\n\tdefault:\n\t\tvar b []byte\n\t\tb, err = json.Marshal(v)\n\t\tx = string(b)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a98af6b183f4f5356775839c428eb128", "score": "0.569574", "text": "func (image *imageBlock) getString(key string) string {\n\ts, err := image.GetStr(key)\n\tif err != nil {\n\t\timage.warn(image.getKeyPos(key), key+\": \"+err.Error())\n\t\treturn \"\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "d7104e8665a899a71290e238b956a918", "score": "0.5692043", "text": "func (k Getter) GetString(ctx sdk.Context, key string) (res string, err error) {\n\tstore := ctx.KVStore(k.k.key)\n\tbz := store.Get([]byte(key))\n\terr = k.k.cdc.UnmarshalBinary(bz, &res)\n\treturn\n}", "title": "" }, { "docid": "f4b869d9e80c517237415557b3108591", "score": "0.56677574", "text": "func (vi *VersionInfo) String(language, codepage uint16, key string) (string, bool) {\n\tst := vi.stringTable(language, codepage, false)\n\tif st == nil {\n\t\treturn \"\", false\n\t}\n\tfor _, s := range st.strings {\n\t\tif s.key == key {\n\t\t\treturn s.value, true\n\t\t}\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "40793b6bd3a0b2465d7c8f5942dbb549", "score": "0.5639739", "text": "func GetString(req *http.Request, key interface{}) string {\n\tcrc := getContextReadCloser(req)\n\tif value, ok := crc.Context()[key]; ok {\n\t\tif typed, ok := value.(string); ok {\n\t\t\treturn typed\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "22e1e6736caf1c62abd27f6e5e472441", "score": "0.56347644", "text": "func (mpt *MerklePatriciaTrie) Get(key string) (string, error) {\n\tvar value string\n\tvar err error\n\tif mpt == nil {\n\t\tvalue = \"\"\n\t\terr = errors.New(\"path_not_found\")\n\t} else {\n\t\t//convert string to hex array [1,6,1]\n\t\thex_array := stringToHex_array(key)\n\t\t//fmt.Println(\"hex:\", hex_array)\n\t\tif key == \"\" {\n\t\t\tvalue = \"\"\n\t\t\terr = errors.New(\"path_not_found\")\n\t\t} else {\n\t\t\t//get helper\n\t\t\tvalue, err = mpt.get_helper(hex_array, mpt.root)\n\t\t}\n\t}\n\treturn value, err\n}", "title": "" }, { "docid": "eabedefa91891cd52cc3a6f1e5597300", "score": "0.56200093", "text": "func (gp *GPath) GetString(path string, fallback ...string) string {\n\tif val, has := gp.get(path); has {\n\t\tif sval, ok := cast.CastString(val); ok {\n\t\t\treturn sval\n\t\t}\n\t}\n\tif len(fallback) > 0 {\n\t\treturn fallback[0]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "c7606d43329f8074177049f81a6102cb", "score": "0.561318", "text": "func GetString(key string) string {\n\treturn cast.ToString(v.Get(key))\n}", "title": "" }, { "docid": "3092da7c419b19602bc7ef555789415c", "score": "0.56017435", "text": "func String(key string) string {\n\tvalue, found := c.m[key]\n\tif !found {\n\t\tpanic(fmt.Sprintf(\"Unknown key %s !\", key))\n\t}\n\n\treturn value\n}", "title": "" }, { "docid": "b75c74081aa63616035060fecd77f013", "score": "0.5598787", "text": "func (d *PennDirectory) Get(id int) string {\n\td.mu.RLock()\n\tdefer d.mu.RUnlock()\n\tname, ok := d.directory[id]\n\tif !ok {\n\t\tlog.Printf(\"Warning: no such entry existed\")\n\t}\n\treturn name\n}", "title": "" }, { "docid": "29293d80288014acd996bacb94ab5e72", "score": "0.55957127", "text": "func (st *ViperSubtree) GetString(key string) string {\n\treturn st.Viper.GetString(st.prefix + \".\" + key)\n}", "title": "" }, { "docid": "37831105fcba3093a4fa701f4b17d2f8", "score": "0.5589551", "text": "func (b *Bigot) GetString(key string) string {\n\treturn cast.ToString(b.Get(key))\n}", "title": "" }, { "docid": "e82772fc1e582dbac7dfcf45697894a6", "score": "0.55886006", "text": "func getString(s interface{}) string {\n\tif _, ok := s.([]interface{}); ok {\n\t\tvalues := getStringArray(s)\n\t\tif len(values) == 1 {\n\t\t\treturn values[0]\n\t\t}\n\t\tlogFatalf(\"Entry %v is not a string or string array of size 1\", s)\n\t}\n\tif str, ok := s.(string); ok {\n\t\treturn str\n\t}\n\tlogFatalf(\"Entry %v is not a string\", s)\n\treturn \"\"\n}", "title": "" }, { "docid": "e7b7ec83c059e66d29bb878bf0bc1688", "score": "0.5584142", "text": "func (s *Storage) GetString(name, def string) string {\n\tif res, ok := s.get(name); ok {\n\t\treturn res.(string)\n\t}\n\n\treturn def\n}", "title": "" }, { "docid": "5c74841932accbe448ea5b39ea483d1a", "score": "0.5579174", "text": "func getUriValue(path []string, index int) string {\n\t/**\n\t * Always return a string, we don't care if the index is out of bounds\n\t */\n\tdefer func() (s string) {\n\t\t_ = recover()\n\t\treturn s\n\t}()\n\n\tval := path[index]\n\treturn val\n}", "title": "" }, { "docid": "45a2af9eedc595ce2206ce1dbfd4ade3", "score": "0.55714476", "text": "func Get(key string) string {\n\tif xlateStrings == nil {\n\t\treturn key\n\t}\n\n\tnewString := xlateStrings[key]\n\n\tif newString == \"\" {\n\t\treturn key\n\t}\n\n\treturn newString\n}", "title": "" }, { "docid": "f143c33bac5216f47eb88c064f3022a0", "score": "0.55585206", "text": "func (realRegistry) GetString(path regKey, valueName string) (value string, err error) {\n\thandle := openKey(path, syscall.KEY_QUERY_VALUE)\n\tdefer syscall.RegCloseKey(handle)\n\n\tvar typ uint32\n\tvar bufSize uint32\n\n\t// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724911(v=vs.85).aspx\n\terr = syscall.RegQueryValueEx(\n\t\thandle,\n\t\tsyscall.StringToUTF16Ptr(valueName),\n\t\tnil,\n\t\t&typ,\n\t\tnil,\n\t\t&bufSize)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdata := make([]uint16, bufSize/2+1)\n\n\terr = syscall.RegQueryValueEx(\n\t\thandle,\n\t\tsyscall.StringToUTF16Ptr(valueName),\n\t\tnil,\n\t\t&typ,\n\t\t(*byte)(unsafe.Pointer(&data[0])),\n\t\t&bufSize)\n\n\tif err != nil {\n\t\treturn\n\t}\n\treturn syscall.UTF16ToString(data), nil\n}", "title": "" }, { "docid": "b6190b378e1a6f226a86fa58a5c39435", "score": "0.5538297", "text": "func GetString(k string, m map[string]interface{}) (v string, err error) {\n\ti, ok := m[k]\n\tif !ok {\n\t\terr = errNotFound\n\t\treturn\n\t}\n\n\tswitch i := i.(type) {\n\tcase nil:\n\tcase string:\n\t\tv = i\n\tdefault:\n\t\terr = errBadType\n\t}\n\treturn\n}", "title": "" }, { "docid": "ed76974e0b313b092a4ebaacaaa1eefb", "score": "0.5536725", "text": "func (tr *TrieReader) GetStr(key string) string {\n\treturn string(tr.Get([]byte(key)))\n}", "title": "" }, { "docid": "0836f5a29b6cf05bda27c6fca7626c87", "score": "0.5530833", "text": "func (dr DatumRow) GetString(colIdx int) string {\n\treturn dr[colIdx].GetString()\n}", "title": "" }, { "docid": "8f23864623a915e89c91ada8bbf140cc", "score": "0.55215454", "text": "func (p *JSONStore) GetString(key FieldKey) (string, error) {\n\treturn p.GetStringWithScopeAndOverride(\"\", key, nil)\n}", "title": "" }, { "docid": "d2509cdbe632f1488318c8d34483e690", "score": "0.5517295", "text": "func (j *JsonDOC) GetString(key string) string {\n\treturn cast.ToString(j.values[key])\n}", "title": "" }, { "docid": "aaebac9229770a5955f818b31f6c45af", "score": "0.55101967", "text": "func (t *StringTable) GetString(id uint32) string {\n\treturn t.idToString[id]\n}", "title": "" }, { "docid": "bd778c152228924edc3d24e32cdc8fe0", "score": "0.5501294", "text": "func GetAssetString(name string) string {\n\treturn files[name]\n}", "title": "" }, { "docid": "bd778c152228924edc3d24e32cdc8fe0", "score": "0.5501294", "text": "func GetAssetString(name string) string {\n\treturn files[name]\n}", "title": "" }, { "docid": "bd778c152228924edc3d24e32cdc8fe0", "score": "0.5501294", "text": "func GetAssetString(name string) string {\n\treturn files[name]\n}", "title": "" }, { "docid": "bd778c152228924edc3d24e32cdc8fe0", "score": "0.5501294", "text": "func GetAssetString(name string) string {\n\treturn files[name]\n}", "title": "" }, { "docid": "f8d4d4ad7ad5699cae3bbf7a531185e9", "score": "0.54923195", "text": "func (s *Storage) Get(location string) (string, error) {\n\tvar item []byte\n\terr := s.View(func(tx *bolt.Tx) error {\n\t\titemBytes := tx.Bucket(macaroonBucketName).Get([]byte(location))\n\t\tif len(itemBytes) == 0 {\n\t\t\treturn fmt.Errorf(\"couldn't get item for location %s\",\n\t\t\t\tlocation)\n\t\t}\n\n\t\titem = make([]byte, len(itemBytes))\n\t\tcopy(item, itemBytes)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(item), nil\n}", "title": "" }, { "docid": "12ebdc9ec4d98736d9d9c82789f1b16d", "score": "0.5475503", "text": "func (ldb *Null) Get(k string) (string, error) {\n\treturn \"\", nil\n}", "title": "" }, { "docid": "511342810bb7eaa75189090ff2602f2c", "score": "0.54663235", "text": "func (o *NFS) GetStringID() string {\n\treturn accessor.GetStringID(o)\n}", "title": "" }, { "docid": "00a65c01aa79e50b21c3a28e3bcae3f4", "score": "0.54625577", "text": "func (p Params) GetString(path string) (string, error) {\n\tv, err := p.Get(path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif s, ok := v.(string); ok {\n\t\treturn s, nil\n\t}\n\treturn \"\", fmt.Errorf(\"cannot convert %q to string\", v)\n}", "title": "" }, { "docid": "a423c4b8e843f976eecc3a7348e56a6d", "score": "0.5462275", "text": "func (c *StringNodeLocator) Get(name string) (string, bool) {\n\tnode, has := c.nl.GetPrimaryNode(name)\n\tif node == nil {\n\t\treturn \"\", has\n\t}\n\treturn nodeToString(node), has\n}", "title": "" }, { "docid": "f4e76d93300d14a2e38b3f1e1ea0a75e", "score": "0.5458877", "text": "func GetString (hash string) (string, error) {\n\n\t// Get shell\n\tsh := getShell(ipfsPath)\n\n\t// Get string from IPFS and store it in temp file to read it\n\ttmpFile := \"/tmp/\" + hash\n\tsh.Get(hash, tmpFile)\n\n\t// Read the string from temp file\n\tstr, err:= ioutil.ReadFile(tmpFile)\n if err != nil {\n log.Fatal(err)\n }\n\n\t// Delete temp file\n\tos.Remove(tmpFile)\n\n\treturn string(str), err\n}", "title": "" }, { "docid": "f6ea49732896a4c7b98c75aeb2e33b91", "score": "0.5455539", "text": "func String(langCode string, key string) string {\n langStrings := Strings(langCode)\n if langStrings != nil {\n s, ok := langStrings[key].(string)\n if ok {\n return s\n } else {\n return key\n }\n } else {\n return key\n }\n}", "title": "" }, { "docid": "3456ffe16d97fc54f7a96a6b5934d54c", "score": "0.54467744", "text": "func (m *PostgreSQLBackend) Get(ctx context.Context, fullPath string) (*physical.Entry, error) {\n\tdefer metrics.MeasureSince([]string{\"postgres\", \"get\"}, time.Now())\n\n\tm.permitPool.Acquire()\n\tdefer m.permitPool.Release()\n\n\t_, path, key := m.splitKey(fullPath)\n\n\tvar result []byte\n\terr := m.client.QueryRow(m.get_query, path, key).Scan(&result)\n\tif err == sql.ErrNoRows {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tent := &physical.Entry{\n\t\tKey: fullPath,\n\t\tValue: result,\n\t}\n\treturn ent, nil\n}", "title": "" }, { "docid": "b5755af7e8685190cd9275368e567530", "score": "0.54333", "text": "func (f *Flaggable) GetString(key string) (s string) {\n\tif val, ok := f.Get(key); ok && val != nil {\n\t\ts, _ = val.(string)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bef760b18112e9be7061adbec9ea7c28", "score": "0.5420954", "text": "func (self *Store) Get(key string) string {\n\tvalueInterface, ok := self.data.Get(key)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\tvalue, ok := valueInterface.(string)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn value\n}", "title": "" }, { "docid": "6557ac2a557ad60438254b6def50e04a", "score": "0.54119813", "text": "func (j *Json) GetString(pattern string, def ...interface{}) string {\n\treturn gconv.String(j.Get(pattern, def...))\n}", "title": "" }, { "docid": "413974cc04e14fb5836827c5e8a1b963", "score": "0.5410729", "text": "func (c *Config) GetString(key string) string {\n\tx, present := c.data[key]\n\tif !present {\n\t\treturn \"\"\n\t}\n\tif result, isString := x.(string); isString {\n\t\treturn result\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "7123041704418e9cf95005a7d75c85de", "score": "0.5409993", "text": "func (result ContractFunctionResult) GetString(index uint64) string {\n\treturn string(result.GetBytes(index))\n}", "title": "" }, { "docid": "03295e74acddd4e7e90a2e08a651b99d", "score": "0.53997797", "text": "func (s *Storage) Read(kg string, id string) (string, error) {\n\tvar value string\n\n\terr := s.db.View(func(txn *badger.Txn) error {\n\t\tkey := makeKeyName(kg, id)\n\n\t\tlog.Debug().Msgf(\"our key is %s (%#v)\", string(key), key)\n\n\t\titem, err := txn.Get(key)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tval, err := item.ValueCopy(nil)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvalue = string(val)\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\t// if the error is a \"KeyNotFound\", there is no need to add a stacktrace\n\t\tif errors.Is(err, badger.ErrKeyNotFound) {\n\t\t\treturn \"\", errors.Errorf(\"key not found in database: %s in keygroup %s\", id, kg)\n\t\t}\n\t\t// if we have a different error, debug with full stacktrace\n\t\treturn \"\", errors.New(err)\n\t}\n\n\treturn value, nil\n\n}", "title": "" }, { "docid": "69b10483ddc5f8c5b14868db1425727d", "score": "0.53990155", "text": "func GetString(key string) string {\r\n\tv := Get(key)\r\n\tif v == nil {\r\n\t\treturn \"\"\r\n\t}\r\n\tif s, ok := v.(string); ok {\r\n\t\treturn s\r\n\t}\r\n\r\n\treturn \"\"\r\n}", "title": "" }, { "docid": "1254541a0a50205f068cd828a9db2fe6", "score": "0.5396102", "text": "func getString(name string, data map[string][]string, required bool) (string, error) {\n\tres := data[name]\n\tif len(res) == 0 {\n\t\tif required {\n\t\t\treturn \"\", ApiError{\n\t\t\t\tHTTPStatus: http.StatusBadRequest,\n\t\t\t\tErr: fmt.Errorf(\"%s must me not empty\", name),\n\t\t\t}\n\t\t}\n\t\treturn \"\", nil\n\t}\n\treturn res[0], nil\n}", "title": "" }, { "docid": "46cd74d7af404a0f4247f7d04dd39b0c", "score": "0.53913474", "text": "func retrieveKey(path string) (string, string, error) {\n\tcomponents := strings.Split(path, \"/\")\n\tif len(components) != 2 {\n\t\treturn \"\", \"\", errors.New(\"Partial content\")\n\t}\n\n\tresource, key := components[0], components[1]\n\n\tif resource == \"\" || key == \"\" {\n\t\treturn \"\", \"\", errors.New(\"Empty content\")\n\t}\n\treturn resource, key, nil\n}", "title": "" }, { "docid": "b8684b59aba7f443a96eceec08934e33", "score": "0.5385227", "text": "func Get(c *consul.Client, key string) string {\n\tvar value string\n\tkv := c.KV()\n\tpair, _, err := kv.Get(key, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tif pair != nil {\n\t\t\tvalue = string(pair.Value[:])\n\t\t} else {\n\t\t\tvalue = \"\"\n\t\t}\n\t}\n\treturn value\n}", "title": "" }, { "docid": "d9deb30ec8090a1c80ee1595a50f9e57", "score": "0.5382703", "text": "func (db *RedicoDB) Get(k string) (string, error) {\n\tdb.master.Lock()\n\tdefer db.master.Unlock()\n\tif !db.exists(k) {\n\t\treturn \"\", ErrKeyNotFound\n\t}\n\treturn db.stringGet(k), nil\n}", "title": "" }, { "docid": "a210da6a92503812ec146ea003130c60", "score": "0.53766465", "text": "func (c ConfigMap) GetString(name string) string {\n\tval, ok := c.Get(name)\n\tif ok {\n\t\treturn val.(string)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "b8689ea8e12916a28ef584f1076619f2", "score": "0.536355", "text": "func (c *Context) GetString(key interface{}) string {\n\tcrc := getContextReadCloser(c.Request)\n\tif value, ok := crc.Context()[key]; ok {\n\t\tif typed, ok := value.(string); ok {\n\t\t\treturn typed\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "09b8a4034eee1b329279828d115857a5", "score": "0.5356749", "text": "func GetString(tag, lang string) (string, bool) {\n\tif table, ok := stringResources[lang]; ok {\n\t\tif text, ok := table[tag]; ok {\n\t\t\treturn text, true\n\t\t}\n\t\tDebugLogF(`There is no \"%s\" string resource`, tag)\n\t}\n\tDebugLogF(`There are no \"%s\" language resources`, lang)\n\treturn tag, false\n}", "title": "" }, { "docid": "77aad1021d80e8c0780b29caf73f7fd0", "score": "0.53552514", "text": "func Get(key string) string{\n\n\tif Fingerprint(){\n\t\treturn keyValue[key].val\n\t}else{\n\t\tDelete(key)\n\t\tupdate(key, LocalkeyValue[key].val)\n\t\treturn keyValue[key].val\n\t}\n}", "title": "" }, { "docid": "f8de0abaf7303495330105bdc8525cb3", "score": "0.5332045", "text": "func (r *Row) Get(idx int) string {\n\treturn r.items[idx]\n}", "title": "" }, { "docid": "5ad3e78a9a876cb7b27753df6fe69ac9", "score": "0.5330267", "text": "func (n FilePath) String() string { return string(n) }", "title": "" }, { "docid": "1ed9608d2b2ac7cecb3d7aef0df92258", "score": "0.5319286", "text": "func GetFromCache(key string) string {\n\tvar value string\n\tresult, found := C.Get(key)\n\tif found {\n\t\tvalue = result.(string)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "31e51ef47a8f60b51a07e08ec4e673d6", "score": "0.5317216", "text": "func (s *SessionManager) GetString(ctx context.Context, key string) string {\n\tval := s.Get(ctx, key)\n\tstr, ok := val.(string)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn str\n}", "title": "" }, { "docid": "1ec880f2f62f348ae743af14b5b986fb", "score": "0.5314011", "text": "func (rs *ResourceSelect) String(ctx context.Context) (_ string, err error) {\n\tvar v []string\n\tif v, err = rs.Strings(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{resource.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ResourceSelect.Strings returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "67c06bbb1792afdcaa2c7a9bdc2b2d40", "score": "0.530867", "text": "func (tb *AdsbTable) GetString(id adsb.IcaoId) string {\n\ttb.syn.Lock()\n\tdefer tb.syn.Unlock()\n\n\treturn tb.getString(id)\n}", "title": "" }, { "docid": "6b1ddfc17a5e14a01864f7793f7644e6", "score": "0.5305656", "text": "func (sf *StringFrontend) Get(key string, loader StringLoader) (string, error) {\n\tif entry, ok := sf.backend.Get(key); ok {\n\t\tif entry.Meta.lifetime.After(time.Now()) {\n\t\t\treturn entry.Data.(string), nil\n\t\t}\n\n\t\tif entry.Meta.gracetime.After(time.Now()) {\n\t\t\tgo sf.load(key, loader)\n\t\t\treturn entry.Data.(string), nil\n\t\t}\n\t}\n\n\treturn sf.load(key, loader)\n}", "title": "" }, { "docid": "e490a4107ac9217c8a65c63a22240c99", "score": "0.52979434", "text": "func JsonPath_StringAt(path *string) *string {\n\t_init_.Initialize()\n\n\tvar returns *string\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions.JsonPath\",\n\t\t\"stringAt\",\n\t\t[]interface{}{path},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "eed7191bd996765057fce154b831ea65", "score": "0.5276133", "text": "func Get(t, s string) (r []string) {\n\trx := Objects\n\tswitch t {\n\tcase \"cmnt\":\n\t\tr = rx.CMNT.FindStringSubmatch(s)\n\tcase \"desc\":\n\t\tr = rx.DESC.FindStringSubmatch(s)\n\tcase \"dsbl\":\n\t\tr = rx.DSBL.FindStringSubmatch(s)\n\tcase \"flip\":\n\t\tr = rx.FLIP.FindStringSubmatch(s)\n\tcase \"fqdn\":\n\t\tr = rx.FQDN.FindStringSubmatch(s)\n\tcase \"host\":\n\t\tr = rx.HOST.FindStringSubmatch(s)\n\tcase \"http\":\n\t\tr = rx.HTTP.FindStringSubmatch(s)\n\tcase \"ipbh\":\n\t\tr = rx.IPBH.FindStringSubmatch(s)\n\tcase \"lbrc\":\n\t\tr = rx.LBRC.FindStringSubmatch(s)\n\tcase \"leaf\":\n\t\tr = rx.LEAF.FindStringSubmatch(s)\n\tcase \"misc\":\n\t\tr = rx.MISC.FindStringSubmatch(s)\n\tcase \"mlti\":\n\t\tr = rx.MLTI.FindStringSubmatch(s)\n\tcase \"mpty\":\n\t\tr = rx.MPTY.FindStringSubmatch(s)\n\tcase \"name\":\n\t\tr = rx.NAME.FindStringSubmatch(s)\n\tcase \"node\":\n\t\tr = rx.NODE.FindStringSubmatch(s)\n\tcase \"rbrc\":\n\t\tr = rx.RBRC.FindStringSubmatch(s)\n\tcase \"sufx\":\n\t\tr = rx.SUFX.FindStringSubmatch(s)\n\t}\n\treturn\n}", "title": "" }, { "docid": "e573d66e96c85fe8e09bd15d126e6e23", "score": "0.5271682", "text": "func (o *BundleInfo) GetStringID() string {\n\treturn accessor.GetStringID(o)\n}", "title": "" }, { "docid": "e76fc5770a621499a712209e768bb5ad", "score": "0.526878", "text": "func (m *Redico) Get(k string) (string, error) {\n\treturn m.DB(m.selectedDB).Get(k)\n}", "title": "" }, { "docid": "14b2dd873d2f3828b601a815711dc184", "score": "0.52681303", "text": "func (c *Config) String(key string) (string, error) {\n\tif v, ok := c.data[key]; ok {\n\t\treturn v, nil\n\t} else {\n\t\treturn \"\", ErrNotFoundKey\n\t}\n}", "title": "" }, { "docid": "b7c9f8653f19409f256b40ad7dfd1eb8", "score": "0.526209", "text": "func GetString(key string) string {\n\treturn config.GetString(key)\n}", "title": "" }, { "docid": "9a31c0c8de6bd0f0faf1424feb0b8283", "score": "0.52612746", "text": "func (m Metadata) string(key, fallback string) string {\n\tv := m[key]\n\tswitch t := v.(type) {\n\tcase string:\n\t\treturn t\n\tdefault:\n\t\treturn fallback\n\t}\n}", "title": "" }, { "docid": "62ff71eccaf355d34c4d5d9c4d2a34b9", "score": "0.5255148", "text": "func (d *DB) Get(key string) (value string) {\n\tkeyB := []byte(key)\n\td.db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket(tableURLs)\n\t\tif b == nil {\n\t\t\treturn nil\n\t\t}\n\t\tc := b.Cursor()\n\t\tfor k, v := c.First(); k != nil; k, v = c.Next() {\n\t\t\tif bytes.Equal(keyB, k) {\n\t\t\t\tvalue = string(v)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "9c8c1f537fb99581d0adcfcc709412e4", "score": "0.5254777", "text": "func GetValueString(keyValueArr whisk.KeyValueArr, key string) (string, error) {\n\tvalue := keyValueArr.GetValue(key)\n\tif str, ok := value.(string); ok {\n\t\treturn str, nil\n\t}\n\treturn \"\", fmt.Errorf(\"missing string value '%v' for key '%s'\", value, key)\n}", "title": "" }, { "docid": "a0877ad435c04b8996ff4afbdae1116f", "score": "0.5245481", "text": "func (entry *Entry) String() (string, error) {\n\tserialized, err := entry.Bytes()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tstr := string(serialized)\n\treturn str, nil\n}", "title": "" }, { "docid": "75b0cc5b88035f3cc576aadee2b46fdf", "score": "0.52453244", "text": "func (p *Page) getPageStr(key string) (string, error) {\n\tif p.model {\n\t\treturn p.GetStr(\"model.\" + key)\n\t}\n\treturn p.GetStr(\"page.\" + key)\n}", "title": "" }, { "docid": "83771d3850996be8fa7f7dbaa2af2738", "score": "0.5236232", "text": "func (m Memcached) Get(hostname string, path string) (string, error) {\n\tkey := m.cacheKey(hostname, path)\n\n\titem, err := m.Client.Get(key)\n\n\t// Handle MISS without having to include memcache code everywhere.\n\tif err != nil {\n\t\tif err == memcache.ErrCacheMiss {\n\t\t\treturn \"\", NotFoundError\n\t\t}\n\n\t\treturn \"\", err\n\t}\n\n\treturn string(item.Value), nil\n}", "title": "" }, { "docid": "873baa2bca3dfbf296e71cd30dfaa8fe", "score": "0.52354693", "text": "func (m *MapStrStr) Get(k string) (v string, ok bool) {\n\tm.mux.RLock()\n\tdefer m.mux.RUnlock()\n\tv, ok = m.rel[k]\n\treturn\n}", "title": "" }, { "docid": "a3582821864bc15ae473170282b9f1b8", "score": "0.52303207", "text": "func (d *StringDatum) Get() string {\n\td.mu.RLock()\n\tdefer d.mu.RUnlock()\n\treturn d.Value\n}", "title": "" }, { "docid": "fe8080b0e7c2fd63d93a8066cf3022b5", "score": "0.52281636", "text": "func (f *folder) String() string { return f.name }", "title": "" }, { "docid": "6c41bea513356d955e7273b60ffbf1de", "score": "0.52267724", "text": "func (entry *MleRTPropertyEntry) String() string {\n\t// ToDo: return a usable string value.\n\treturn \"\"\n}", "title": "" }, { "docid": "6999e4772cc2b3da850686b53ce3ca4c", "score": "0.5226161", "text": "func (t *Template) GetStr(key string) (string, error) {\n\tpair, err := t.GetPair(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn pair.Value, nil\n}", "title": "" }, { "docid": "8caad7b50d149968640241ddc5f6dae3", "score": "0.522227", "text": "func (gp *GPath) GetStrings(path string, convertSingle ...bool) []string {\n\tif val, has := gp.get(path); has {\n\t\tif res := cast.CastStrings(val); res != nil {\n\t\t\treturn res\n\t\t} else if len(convertSingle) > 0 && convertSingle[0] {\n\t\t\tif sval, ok := cast.CastString(val); ok {\n\t\t\t\treturn []string{sval}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8f033b7770ea8bcee0bb4e8f68f5b72f", "score": "0.52208763", "text": "func GetString(RConn *redis.Conn, key string) (string, error) {\n\treturn redis.String((*RConn).Do(\"GET\", key))\n}", "title": "" }, { "docid": "f5222440077bdd29da7692f2e98e31cd", "score": "0.521888", "text": "func (i *Info) GetString(m *MapParams, field string) (string, error) {\n\t_, value, err := i.GetField(m, field)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn value[0], nil\n}", "title": "" }, { "docid": "1fa18eb90d8666544ee72c8c70232c51", "score": "0.52084345", "text": "func Get(key string) (value string) {\n\tkey = keyGenerate(key)\n\tval, err := RC.client.Get(key).Bytes()\n\tv, err := decode(val)\n\tif err != nil {\n\t\tlogs.Infof(\"key: %v | error info: %v\", key, err)\n\t}\n\tif v == nil {\n\t\treturn\n\t} else {\n\t\treturn v.(string)\n\t}\n}", "title": "" }, { "docid": "92b4935d1461b25f956a3395fc10d7c6", "score": "0.5193763", "text": "func (d *DBusObject) String() string {\n\treturn string(d.obj.Path())\n}", "title": "" }, { "docid": "6e0cc46245e22119853887eade97074b", "score": "0.51937145", "text": "func (f *Flash) GetString(key string) string {\n\treturn f.v.GetString(key)\n}", "title": "" }, { "docid": "e6745ee5f7b640efe0dfe50f2e550a1d", "score": "0.519066", "text": "func GetString(m map[string]interface{}, key string) (string, error) {\n\tif m == nil {\n\t\treturn \"\", fmt.Errorf(\"missing map\")\n\t}\n\tif key == \"\" {\n\t\treturn \"\", fmt.Errorf(\"missing key\")\n\t}\n\n\trawVal, ok := m[key]\n\tif !ok {\n\t\treturn \"\", nil\n\t}\n\n\tstr, ok := rawVal.(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"invalid value at %s: is a %T\", key, rawVal)\n\t}\n\treturn str, nil\n}", "title": "" }, { "docid": "e5e22c0a6b0d0b14c4d1f80f4911315b", "score": "0.5181791", "text": "func (this *LevelDBDatabase) get(namespace string, key string) (value string, err error) {\n\tdata, err := this.db.Get([]byte(namespace+\"\\n\"+key), nil)\n\treturn string(data), err\n}", "title": "" }, { "docid": "2ba0c1b1d6e760a026e980fd0e7f6274", "score": "0.5178364", "text": "func (c *Context) GetString(key string) (s string) {\n\tif val, ok := c.Get(key); ok && val != nil {\n\t\ts, _ = val.(string)\n\t}\n\treturn\n}", "title": "" }, { "docid": "2ba0c1b1d6e760a026e980fd0e7f6274", "score": "0.5178364", "text": "func (c *Context) GetString(key string) (s string) {\n\tif val, ok := c.Get(key); ok && val != nil {\n\t\ts, _ = val.(string)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b61eb26a3a98f3c5f5c52a36990b2e34", "score": "0.5175504", "text": "func (d *DB) Get(key string) (value string) {\n keyB := []byte(key)\n d.db.Update(func(tx *bbolt.Tx) error {\n b := tx.Bucket(tableURLs)\n if b == nil {\n return nil\n }\n c:= b.Cursor()\n for k, v := c.First(); k != nil; k, v = c.Next() {\n if bytes.Equal(keyB, k) {\n value = string(v)\n break\n }\n }\n return nil\n })\n\n return\n}", "title": "" }, { "docid": "dc03972e38b219173ff900f52c7d13bc", "score": "0.5173526", "text": "func (s *URLStore) Get(shorturl string) string {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\treturn s.store[shorturl]\n}", "title": "" }, { "docid": "bb2838f03887721b8f5a0750038a5f64", "score": "0.51678807", "text": "func (s *SimpleCache) Get(path string) json.RawMessage {\n\tval, ok := s.cache.Load(path)\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn val.(json.RawMessage)\n}", "title": "" }, { "docid": "cff9a0c3e2352f000b3bd86d95926769", "score": "0.5162838", "text": "func Get(key string) (string, error) {\r\n\tif db == nil {\r\n\t\treturn \"\", fmt.Errorf(\"database is not connected\")\r\n\t}\r\n\tvar valCopy []byte\r\n\terr := db.View(func(txn *badger.Txn) error {\r\n\t\titem, err := txn.Get([]byte(key))\r\n\t\tif err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\r\n\t\tvalCopy, err = item.ValueCopy(nil)\r\n\t\treturn err\r\n\t})\r\n\r\n\t// Not found (don't return an error, as we want to use this as cache)\r\n\tif errors.Is(err, badger.ErrKeyNotFound) {\r\n\t\terr = nil\r\n\t}\r\n\r\n\treturn string(valCopy), err\r\n}", "title": "" } ]
85412e7e4ac22fac214ae59e008d5a50
GetTokenFromSession gets a token from the session store using cookies.
[ { "docid": "268f0da742110a28264cd361dba24664", "score": "0.71341664", "text": "func GetTokenFromSession(env apienv.APIEnv, r *http.Request) (string, bool) {\n\tsession, err := GetDefaultSession(env, r)\n\tif err != nil {\n\t\treturn \"\", false\n\t}\n\n\taccessToken, ok := session.Values[\"_at\"].(string)\n\tif !ok {\n\t\treturn \"\", ok\n\t}\n\n\treturn accessToken, true\n}", "title": "" } ]
[ { "docid": "efe11c28259a9581f7b302a51bdaae49", "score": "0.65189314", "text": "func CSRFTokenFromSession(s *session.Session) (string, bool) {\n\treturn s.String(formLoginCsrfTokenKey)\n}", "title": "" }, { "docid": "f85482b80a271189c070e3fa62fe6c23", "score": "0.6474172", "text": "func RetrieveSessionToken(otpCode string, accessKeyID string, secretAccessKey string, durationSec int64, mfaSerial string) (*sts.GetSessionTokenOutput, error) {\n\tsess, err := session.NewSession(&aws.Config{\n\t\tCredentials: credentials.NewStaticCredentials(accessKeyID, secretAccessKey, \"\"),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsvc := sts.New(sess)\n\tinput := &sts.GetSessionTokenInput{\n\t\tDurationSeconds: aws.Int64(durationSec),\n\t\tSerialNumber: aws.String(mfaSerial),\n\t\tTokenCode: aws.String(otpCode),\n\t}\n\n\treturn svc.GetSessionToken(input)\n}", "title": "" }, { "docid": "abcd674fab41961d98d2d492efceb07f", "score": "0.6276991", "text": "func (c *Config) GetSessionToken() string {\n\tif val := c.values.Get(\"sessionToken\"); val != \"\" {\n\t\treturn val\n\t}\n\treturn GetFromEnvVal(credSessionEnvKey)\n}", "title": "" }, { "docid": "38995ff1eee666125f8c28910b7a0d7e", "score": "0.62706095", "text": "func (c *Client) SessionToken() string { return c.sessionToken }", "title": "" }, { "docid": "c988f31065450e04da4ac323ca597aa4", "score": "0.6222716", "text": "func (d *DiskBackedDatabase) GetCookieToken(cookieText string) *CookieToken {\n\tresult, err := d.db.Query(`select userID, isValidated, browser from Cookies where cookieToken = ? and timeNotInPast(validUntil);`, cookieText)\n\tif err != nil {\n\t\td.logger.Printf(\"Could not execute sql statement for CheckCookieToken, %v\", err)\n\t\treturn nil\n\t}\n\tdefer result.Close()\n\n\tif !result.Next() {\n\t\treturn nil\n\t}\n\n\tvar userID string\n\tvar browser string\n\tvar validated bool\n\tif err = result.Scan(&userID, &validated, &browser); err != nil {\n\t\treturn nil\n\t}\n\n\treturn &CookieToken{\n\t\tUserID: UserID(userID),\n\t\tIsValidated: validated,\n\t\tBrowserContext: browser,\n\t}\n}", "title": "" }, { "docid": "d869a7deac683ba16a8f94b63ca495d2", "score": "0.61866975", "text": "func SessionGet(token string) (*Session, bool) {\n\ts, ok := Sessions[token]\n\treturn s, ok\n}", "title": "" }, { "docid": "c6b08c932d6c55f37853bc9c5bedd9c4", "score": "0.6183694", "text": "func Session(w http.ResponseWriter, r *http.Request) {\n\tc, err := r.Cookie(\"token\")\n\tif err != nil {\n\t\tc = &http.Cookie{}\n\t}\n\n\tss := c.Value\n\ttoken, err := jwt.ParseWithClaims(\n\t\tss,\n\t\t&userClaims{},\n\t\tfunc(t *jwt.Token) (interface{}, error) {\n\t\t\tif t.Method != jwt.SigningMethodHS256 {\n\t\t\t\treturn nil, fmt.Errorf(\"Cookie had not been signed with SHA256\")\n\t\t\t}\n\n\t\t\treturn jwtKey, nil\n\t\t},\n\t)\n\tisValid := err == nil && token.Valid\n\n\tif !isValid {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\terr = json.NewEncoder(w).Encode(sessionResponse{Success: false, User: db.User{}, Message: \"Unauthenticated\"})\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Error while json encoding\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\treturn\n\t}\n\n\tclaims := token.Claims.(*userClaims)\n\tw.WriteHeader(http.StatusOK)\n\terr = json.NewEncoder(w).Encode(sessionResponse{Success: true, User: claims.User, Message: \"Authenticated\"})\n\tif err != nil {\n\t\thttp.Error(w, \"Error while json encoding\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "bbf01c5b3c0ac3f56c6cc43923c8c002", "score": "0.61543435", "text": "func SessionGet(token string) (*Session, bool) {\n\ts, ok := sessions[token]\n\treturn s, ok\n}", "title": "" }, { "docid": "f2b1f0371798922647e60d610d8d045d", "score": "0.611104", "text": "func TokenSession(endpoint, token string) (*Client, error) {\n\treturn TokenSessionProxy(endpoint, token, true)\n}", "title": "" }, { "docid": "68a4db2d152e8c9e55a48b43c633c809", "score": "0.6062976", "text": "func (s Storage) GetSessionByToken(token string) (models.Session, error) {\n\tsession := models.Session{}\n\terr := s.db.Get(&session, \"SELECT * FROM sessions WHERE token = ?\", token)\n\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn session, errors.ErrNotFound\n\t\t}\n\n\t\treturn session, fmt.Errorf(\"query session error: %v\", err)\n\t}\n\n\treturn session, nil\n}", "title": "" }, { "docid": "718c3ce8190691047d6f7ed4c3546fdf", "score": "0.60559684", "text": "func ExtractTokenFromCookie(r *http.Request) (string, error) {\n\tcookie, err := r.Cookie(CookieName)\n\tif err != nil {\n\t\treturn \"\", trace.Wrap(err)\n\t}\n\n\treturn cookie.Value, nil\n}", "title": "" }, { "docid": "7b7ca0721f57f13eddb4598f8b1bd411", "score": "0.6053428", "text": "func (m MongoStore) GetAccessTokenSession(ctx context.Context, signature string, session fosite.Session) (request fosite.Requester, err error) {\n\treturn m.Requests.GetAccessTokenSession(ctx, signature, session)\n}", "title": "" }, { "docid": "8dde55886629e4b852da79364decde76", "score": "0.6044817", "text": "func (s *AWSKeyringSession) GetSessionToken(sessionName string) (sts.Credentials, string, error) {\n\tvar session awsSession\n\n\titem, err := s.Keyring.Get(sessionName)\n\tif err != nil {\n\t\treturn session.Credentials, session.Name, err\n\t}\n\n\tif err = json.Unmarshal(item.Data, &session); err != nil {\n\t\treturn session.Credentials, session.Name, err\n\t}\n\n\treturn session.Credentials, session.Name, nil\n}", "title": "" }, { "docid": "9636265cc0a35d2d56974e3b1fd4babf", "score": "0.5992183", "text": "func TokenSession(endpoint, token string) (*Client, error) {\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\tMaxIdleConns: 100,\n\t\tIdleConnTimeout: 90 * time.Second,\n\t\tTLSHandshakeTimeout: 10 * time.Second,\n\t\tExpectContinueTimeout: 1 * time.Second,\n\t}\n\tc := &Client{\n\t\tmux: &sync.Mutex{},\n\t\tendpoint: endpoint,\n\t\tClient: &http.Client{Transport: tr},\n\t\tcloser: make(chan struct{}, 0),\n\t\ttoken: &models.UserToken{Token: token},\n\t}\n\tgo func() {\n\t\t<-c.closer\n\t}()\n\treturn c, nil\n}", "title": "" }, { "docid": "7cb2db1eb945e1d1b9b670833e072a6c", "score": "0.598704", "text": "func GetSessionFromCookie(cookie *http.Cookie) Session {\n\tsession := make(Session)\n\n\t// Separate the data from the signature.\n\thyphen := strings.Index(cookie.Value, \"-\")\n\tif hyphen == -1 || hyphen >= len(cookie.Value)-1 {\n\t\treturn session\n\t}\n\tsig, data := cookie.Value[:hyphen], cookie.Value[hyphen+1:]\n\n\t// Verify the signature.\n\tif !Verify(data, sig) {\n\t\tINFO.Println(\"Session cookie signature failed\")\n\t\treturn session\n\t}\n\n\tparseKeyValueCookie(data, func(key, val string) {\n\t\tsession[key] = val\n\t})\n\n\tif sessionTimeoutExpiredOrMissing(session) {\n\t\tsession = make(Session)\n\t}\n\n\treturn session\n}", "title": "" }, { "docid": "66b8359c3c29d7d628379394212a2d42", "score": "0.59609604", "text": "func GetUserFromCookie(ctx context.Context, ds Datastore, r *http.Request) (*User, *string) {\n\tlog := GetLogger(ctx)\n\tif cookie, err := r.Cookie(\"session\"); err == nil && cookie != nil {\n\t\tcookieValue := make(map[string]interface{})\n\t\tsc, err := GetSecureCookie(ctx, ds)\n\t\tif err != nil {\n\t\t\treturn nil, nil\n\t\t}\n\n\t\tif err = sc.Decode(\"session\", cookie.Value, &cookieValue); err == nil {\n\t\t\tdecodedUser, okUser := cookieValue[\"user\"].(User)\n\t\t\tdecodedToken, okToken := cookieValue[\"token\"].(string)\n\t\t\tif okUser && okToken {\n\t\t\t\treturn &decodedUser, &decodedToken\n\t\t\t} else if appengine.IsDevAppServer() {\n\t\t\t\tlog.Errorf(\"Failed to cast user or token\")\n\t\t\t}\n\t\t} else if appengine.IsDevAppServer() {\n\t\t\tlog.Errorf(\"Failed to Decode cookie: %s\", err.Error())\n\t\t}\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "cf628b3d1e97985cd998cd6d45534a5b", "score": "0.59438324", "text": "func TokenFromCookie(r *http.Request) string {\n\tcookie, err := r.Cookie(\"_pomerium\")\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn cookie.Value\n}", "title": "" }, { "docid": "26a45a6265671f5b95e0ca0106985128", "score": "0.58806753", "text": "func (s *Session) GetSessionTokens() {\n\trequestURL := oauthURL + \"token\"\n\tresp, err := http.PostForm(requestURL, url.Values{\n\t\t\"client_id\": {s.ClientID},\n\t\t\"client_secret\": {s.ClientSecret},\n\t\t\"code\": {s.AuthorizationCode},\n\t\t\"code_verifier\": {s.VerificationCode},\n\t\t\"grant_type\": {\"authorization_code\"},\n\t})\n\tif err != nil {\n\t\tapiLogger.WithFields(logrus.Fields{\n\t\t\t\"status\": \"GetSessionTokens\",\n\t\t\t\"step\": \"http.Get\",\n\t\t}).Fatal(err)\n\t}\n\n\traw, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tapiLogger.WithFields(logrus.Fields{\n\t\t\t\"status\": \"GetSessionTokens\",\n\t\t\t\"step\": \"ioutil.ReadAll\",\n\t\t}).Fatal(err)\n\t}\n\n\tdata := &authResponse{}\n\terr = json.Unmarshal(raw, data)\n\tif err != nil {\n\t\tapiLogger.WithFields(logrus.Fields{\n\t\t\t\"status\": \"GetSessionTokens\",\n\t\t\t\"step\": \"readResponse\",\n\t\t}).Fatal(err)\n\t}\n\n\ts.AccessToken = data.AccessToken\n\ts.RefreshToken = data.RefreshToken\n}", "title": "" }, { "docid": "e96e75bc8c46ba0d20bc1e3bd97e2793", "score": "0.5875283", "text": "func (o *APIRegistrationFlow) GetSessionToken() string {\n\tif o == nil || o.SessionToken == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SessionToken\n}", "title": "" }, { "docid": "59d3eaf23a663b8f7043a82794ba6ccf", "score": "0.58706564", "text": "func (m *MongoStore) GetRefreshTokenSession(ctx context.Context, signature string, session fosite.Session) (request fosite.Requester, err error) {\n\treturn m.Requests.GetRefreshTokenSession(ctx, signature, session)\n}", "title": "" }, { "docid": "7d2c2452f87582025fa956a8bd3b8be8", "score": "0.58669937", "text": "func (s *SessionStore) cookieForSession(ss *sessions.SessionState) ([]byte, error) {\n\tif s.Minimal && (ss.AccessToken != \"\" || ss.IDToken != \"\" || ss.RefreshToken != \"\") {\n\t\tminimal := *ss\n\t\tminimal.AccessToken = \"\"\n\t\tminimal.IDToken = \"\"\n\t\tminimal.RefreshToken = \"\"\n\n\t\treturn minimal.EncodeSessionState(s.CookieCipher, true)\n\t}\n\n\treturn ss.EncodeSessionState(s.CookieCipher, true)\n}", "title": "" }, { "docid": "fc60d55f19bd170d85246fdd66cfafab", "score": "0.5848096", "text": "func ParseSessionCookie(r *http.Request) (accessToken string, cookieAttributes SessionCookieAttributes) {\n\tif cookie, cookieErr := r.Cookie(\"access_token\"); cookieErr == nil {\n\t\taccessToken, cookieAttributes = unmarshalSessionCookieValue(cookie.Value)\n\t}\n\treturn accessToken, cookieAttributes\n}", "title": "" }, { "docid": "3a3e3c0c5a75d260f8d482daaab15808", "score": "0.57769394", "text": "func (s SimpleTokenExtractor) GetToken(r *http.Request) SessionHandler.Token {\n\treturn SessionHandler.Token(r.FormValue(\"password\"))\n}", "title": "" }, { "docid": "c4cc9b957d26cd4f07a70062e737a5a4", "score": "0.57757205", "text": "func GetSessionIdFromToken(c echo.Context) (string, error) {\n\tlogginghelper.LogDebug(\"IN : GetDecodedLoginFromToken\")\n\tdecodedToken, err := authhelper.DecodeToken(c.Request().Header.Get(\"Authorization\"), constants.JWT_SECRETKEY)\n\tif err != nil {\n\t\tlogginghelper.LogError(\"GetDecodedLoginFromToken DecodeToken() Error: \", err)\n\t\treturn \"\", errors.New(\"ERA_ERRORCODE_JWTUTILS_FAILED_TO_DECODE_TOKEN\")\n\t}\n\t// login ID is the compulsary field, so haven't added check for nil\n\tif decodedToken[\"sessionId\"] == nil || decodedToken[\"sessionId\"] == \"\" {\n\t\treturn \"\", errors.New(\"ERA_ERRORCODE_JWT_UTILS_SESSION_ID_NOT_FOUND\")\n\t}\n\tsessionId := decodedToken[\"sessionId\"].(string)\n\n\tlogginghelper.LogDebug(\"OUT : GetDecodedLoginFromToken\")\n\treturn sessionId, nil\n}", "title": "" }, { "docid": "954a93d29216943219d438662e61d30e", "score": "0.57093686", "text": "func getSession() (string, error) {\n\treq, err := http.NewRequest(\"GET\", SESSION_URL, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// Preventing mixed case field names\n\tbody = bytes.ToLower(body)\n\tvar s = new(Session)\n\terr = json.Unmarshal(body, s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn s.SessionID, nil\n}", "title": "" }, { "docid": "8205d92598732d801fe4791d5bd3daf8", "score": "0.56626004", "text": "func FindSessionByToken(token, tokenType string) models.Session {\n\tvar session models.Session\n\tdatastoreSession := datastore.GetDatastoreConnection()\n\tdatastoreSession.\n\t\tPreload(\"Client\").\n\t\tPreload(\"User\").\n\t\tPreload(\"User.Client\").\n\t\tPreload(\"User.Language\").\n\t\tWhere(\"token = ? AND token_type = ? AND invalidated = false\", token, tokenType).\n\t\tFirst(&session)\n\tif session.ID != 0 {\n\t\tif !session.WithinExpirationWindow() {\n\t\t\tInvalidateSession(session)\n\t\t\treturn models.Session{}\n\t\t}\n\t}\n\treturn session\n}", "title": "" }, { "docid": "c68c0a6483c59b0232453efe32654241", "score": "0.5618013", "text": "func (m *stsMock) GetSessionToken(_ context.Context, in *sts.GetSessionTokenInput, _ ...func(*sts.Options)) (*sts.GetSessionTokenOutput, error) {\n\td, err := validateDuration(in.DurationSeconds, 900*time.Second, 36*time.Hour, 12*time.Hour)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err = validateMfa(in.SerialNumber, in.TokenCode); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &sts.GetSessionTokenOutput{Credentials: buildCredentials(d)}, nil\n}", "title": "" }, { "docid": "e01b3839b0dccd2f09c5721d4961546c", "score": "0.5598609", "text": "func (response WidgetSessionResponse) GetSessionToken() string {\n\treturn response.sessionToken\n}", "title": "" }, { "docid": "3277738c5785f50cf559dc25f5a05291", "score": "0.5567783", "text": "func (rc *RedisClient) RetreiveSession(token string) (string, error) {\n\tres := rc.client.Get(token)\n\tif res.Err() != nil {\n\t\treturn \"\", res.Err()\n\t}\n\treturn res.Val(), nil\n}", "title": "" }, { "docid": "56231f4aeb7cb0169ae71f7f289aa4b0", "score": "0.5559963", "text": "func SessionGet(sessionKey string) (*Session, error) {\n\ts := &Session{}\n\terr := data.SessionGet(s, sessionKey)\n\tif err == data.ErrNotFound {\n\t\treturn nil, ErrSessionInvalid\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !s.Valid || s.Expires.Before(time.Now()) {\n\t\treturn nil, ErrSessionInvalid\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "510d40ad7f7664b4969aa2a6be3d5a3c", "score": "0.55416596", "text": "func TokenSessionProxy(endpoint, token string, proxy bool) (*Client, error) {\n\ttr := transport(proxy)\n\tc := DisconnectedClient()\n\tc.mux = &sync.Mutex{}\n\tc.endpoint = endpoint\n\tc.Client = &http.Client{Transport: tr}\n\tc.closeCtx, c.closeFn = context.WithCancel(context.Background())\n\tcf := c.closeFn\n\truntime.SetFinalizer(c, func(_ interface{}) { cf() })\n\tc.token = &models.UserToken{Token: token}\n\tc.iMux = &sync.Mutex{}\n\tc.neverProxy = !proxy\n\tgo connCleanup(tr, c.closeCtx)\n\treturn c, nil\n}", "title": "" }, { "docid": "a345a0f864725351d14ca1d7dd73b819", "score": "0.5534441", "text": "func (c CookieSessionProvider) GetSession(r *http.Request) (Session, error) {\n\tcookie, err := r.Cookie(c.Name)\n\tif err == http.ErrNoCookie {\n\t\treturn nil, ErrNoSession\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\tcookieList := strings.Split(cookie.Value, \",\")\n\tvar sessionValue string\n\tfor _, s := range cookieList {\n\t\tcookie, err := r.Cookie(s)\n\t\tif err == http.ErrNoCookie {\n\t\t\treturn nil, ErrNoSession\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsessionValue = sessionValue + cookie.Value\n\t}\n\n\tsession, err := c.Codec.Decode(sessionValue)\n\tif err != nil {\n\t\treturn nil, ErrNoSession\n\t}\n\treturn session, nil\n}", "title": "" }, { "docid": "0f27b52888e1b112e5f10856556dd87a", "score": "0.55310524", "text": "func (ms Store) LoadSession(*http.Request) (string, error) {\n\tvar signer encoding.MarshalUnmarshaler\n\tsigner, _ = jws.NewHS256Signer(ms.Secret)\n\tjwt, _ := signer.Marshal(ms.Session)\n\treturn string(jwt), ms.LoadError\n}", "title": "" }, { "docid": "06e47fecbe519da94ceedb66b070614e", "score": "0.550333", "text": "func getSession(w http.ResponseWriter, r *http.Request) *sessions.Session {\n session, _ := sessionStore.Get(r, config.sessionName)\n session.Options = &sessions.Options{\n Path: \"/\",\n MaxAge: 60 * config.maxAge,\n HttpOnly: true,\n }\n return session\n}", "title": "" }, { "docid": "59b1665ee389277e6bfce6840f63ed5c", "score": "0.54803854", "text": "func (impl *Auth) GetSessionByToken(token string) *model.Session {\n\tc := base.GetConnection()\n\tsession := new(entity.Session)\n\tif c.Where(\"\\\"Token\\\" = ?\", token).First(session).RecordNotFound() {\n\t\treturn nil\n\t}\n\treturn session.Model()\n}", "title": "" }, { "docid": "ee8dfc3bd837300a88e26c79526cbf8a", "score": "0.5465967", "text": "func GetToken(w http.ResponseWriter, r *http.Request) string {\n gob.Register(Tokens{})\n\n session := getSession(w, r)\n token := RandomHash()\n var t Tokens\n if session.Values[\"tokens\"] == nil {\n a := make([]Token, 1)\n a[0] = Token{token, time.Now()}\n t = Tokens{a}\n session.Values[\"tokens\"] = t\n } else {\n t = session.Values[\"tokens\"].(Tokens)\n t.T = append(t.T, Token{token, time.Now()})\n session.Values[\"tokens\"] = t\n\n }\n\n\n session.Save(r, w)\n\n\n // Return hex encoded token\n return token\n}", "title": "" }, { "docid": "9f6489e22cdd731ffdc73bbae2b71d6d", "score": "0.5446093", "text": "func sessionTokenParse(r *http.Request) (token *jwt.Token, err error) {\n\ttoken, err = request.ParseFromRequestWithClaims(r, request.OAuth2Extractor, &AppClaims{}, func(token *jwt.Token) (interface{}, error) {\n\t\t// since we only use the one private key to sign the tokens,\n\t\t// we also only use its public counter part to verify\n\t\treturn verifyKey, nil\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "520486ad027b8e598b4f4b539ce70efe", "score": "0.5423336", "text": "func ValidateSession(strSession, strUserAgent string) (crypt.JWTClaim, model.Session, error) {\r\n\tvar claim crypt.JWTClaim\r\n\tvar session model.Session\r\n\r\n\terr := crypt.JWTVerify(strSession)\r\n\tif err != nil {\r\n\t\treturn claim, session, err\r\n\t}\r\n\r\n\tparts := strings.Split(strSession, \".\")\r\n\r\n\tjsonBytes, err := crypt.DecodeSegment(parts[0])\r\n\tif err != nil {\r\n\t\treturn claim, session, errors.New(\"Can't Decode Claim\")\r\n\t}\r\n\r\n\terr = json.Unmarshal(jsonBytes, &claim)\r\n\tif err != nil {\r\n\t\treturn claim, session, errors.New(\"Can't Unmarshal Claim\")\r\n\t}\r\n\r\n\tsession, err = db.SelectSession(claim.Token, strUserAgent)\r\n\tif err != nil {\r\n\t\treturn claim, session, errors.New(\"No such session\")\r\n\t}\r\n\r\n\treturn claim, session, nil\r\n}", "title": "" }, { "docid": "918975a6c5696387c360b5581e331ce5", "score": "0.54172695", "text": "func (s Service) CheckSessionFromCookie(request request.SessionExists) responseFactory.Response {\n\tcookieToken, err := request.Context.Cookie(shared.CookieTokenKey)\n\tif err != nil {\n\t\treturn responseFactory.UnauthorizedError(sharedError.ServiceError{\n\t\t\tCode: missedTokenInCookiesCode,\n\t\t\tDescription: missedTokenInCookiesDescription,\n\t\t})\n\t}\n\n\treturn s.checkSession(request, cookieToken)\n}", "title": "" }, { "docid": "c518182e4035487ec66783aff9e4e28f", "score": "0.5390512", "text": "func NewSessionTokenClient(cfg aws.Config, clientCfg *SessionTokenClientConfig) *sessionTokenClient {\n\tc := &sessionTokenClient{newBaseIamClient(cfg, clientCfg.Logger), nil}\n\n\tp := credentials.NewSessionTokenProvider(cfg)\n\tp.Cache = clientCfg.Cache\n\tp.Duration = clientCfg.Duration\n\tp.SerialNumber = clientCfg.SerialNumber\n\tp.TokenCode = clientCfg.TokenCode\n\tp.TokenProvider = clientCfg.TokenProvider\n\tp.Logger = clientCfg.Logger\n\n\tc.provider = p\n\tc.creds = aws.NewCredentialsCache(p)\n\treturn c\n}", "title": "" }, { "docid": "ff2850a4966155375fc37ac1c437aae9", "score": "0.5385816", "text": "func GetToken(state string, r *http.Request) (*oauth2.Token, error) {\n\treturn auth.Token(state, r)\n}", "title": "" }, { "docid": "90211158e8c2c4f2ead94a544009bec8", "score": "0.5375788", "text": "func (sc *SessionController) Get(w http.ResponseWriter, r *http.Request) {\n\tsession, err := sc.Session.Get(r, \"user-session\")\n\tif err != nil {\n\t\tcore.Error(w, http.StatusInternalServerError, \"Session not found\")\n\t\treturn\n\t}\n\tvalue, ok := session.Values[\"user-token\"]\n\tvalueStr, ok := value.(string)\n\tif ok && valueStr != \"\" {\n\t\t_, err := models.GetSessionByToken(valueStr)\n\t\tif err == nil {\n\t\t\tcore.Data(w, struct {\n\t\t\t\tStatus bool `json:\"status\"`\n\t\t\t\tToken string `json:\"token\"`\n\t\t\t}{true, valueStr})\n\t\t\treturn\n\t\t}\n\t}\n\n\tcore.Data(w, struct {\n\t\tStatus bool `json:\"status\"`\n\t\tToken string `json:\"token\"`\n\t}{false, \"\"})\n}", "title": "" }, { "docid": "e42acdd8fe552999fbc99a6e803f5bae", "score": "0.53696305", "text": "func GetSessionByRefreshToken(ctx context.Context, refreshToken string) (*SessionModel, error) {\n\tcollection := db.Database(DatabaseTypers).Collection(CollectionsSessions)\n\n\tfilter := bson.M{\"refreshToken\": refreshToken}\n\n\tvar session SessionModel\n\terr := collection.FindOne(ctx, filter).Decode(&session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &session, nil\n}", "title": "" }, { "docid": "8b882d00e743579d293e5a9287d30ffc", "score": "0.53641754", "text": "func GetSession(user *User, tokenString string) *Session {\n\tvar session Session\n\tif err := dbAccess.SelectOne(&session, \"select * from sessions where user_id=? and token=?\", user.Id, tokenString); err != nil {\n\t\tlogger.Error(err)\n\t\treturn nil\n\t}\n\tif session.Token == \"\" {\n\t\tlogger.Warning(ErrEntityNotExists)\n\t\treturn nil\n\n\t}\n\treturn &session\n\n}", "title": "" }, { "docid": "9dd8044080f989426e587d34afeeddd0", "score": "0.53630596", "text": "func (s *Session) GetToken() (auth *KiteAuth, err error) {\n\n\tvar signature string\n\tif _, err = DB.Get(\"config\", \"signature_secret\", &signature); err != nil {\n\t\treturn nil, err\n\t}\n\n\tauth, err = s.reqToken(signature)\n\n\t// If refresh failed, try getting new token.\n\tif err != nil {\n\t\tif found, _ := DB.Get(\"tokens\", s.account, &auth); found {\n\t\t\tDB.Unset(\"tokens\", s.account)\n\t\t\treturn s.reqToken(signature)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "48db853db73e3888072c4bc6ba779de8", "score": "0.5354758", "text": "func getLoginToken(loginController controller.LoginController, c *gin.Context) string {\n\ttoken := loginController.Login(c)\n\tif token != \"\" {\n\t\tencToken := middleware.Encrypt(token)\n\t\t// Set token to cookie & send back home\n\t\tmessage := &Tokens.Token{Token: encToken}\n\t\tdata, err := proto.Marshal(message)\n\t\tstringarray := fmt.Sprint(data)\n\t\tstringarray = stringarray[1 : len(stringarray)-1]\n\t\tfmt.Println(stringarray)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"marshaling error: \", err)\n\t\t}\n\n\t\tc.SetCookie(\"token\", stringarray, 60*60*24, \"/\", \"\", false, false)\n\t\tc.Redirect(http.StatusFound, \"/\")\n\t}\n\treturn token\n}", "title": "" }, { "docid": "83a13613733733b4528f1640a6312375", "score": "0.53502864", "text": "func UserSessionToken(endpoint, username, password string, usetoken bool) (*Client, error) {\n\treturn UserSessionTokenProxy(endpoint, username, password, usetoken, true)\n}", "title": "" }, { "docid": "98a689d35bb9f15a7c5b3756ce20f910", "score": "0.5313257", "text": "func (s *AWSKeyringSession) SaveSessionToken(profile string, sessionName string, creds sts.Credentials) error {\n\tsession := awsSession{\n\t\tCredentials: creds,\n\t\tName: AWSSessionName,\n\t}\n\n\tbytes, err := json.Marshal(session)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Infof(\"Saving AWS session token to keyring-item: [aws-okta: (%s) - %s]\", session.Name, profile)\n\ts.Keyring.Set(\n\t\tkeyring.Item{\n\t\t\tKey: sessionName,\n\t\t\tData: []byte(bytes),\n\t\t\tLabel: fmt.Sprintf(\"%s: (%s) - %s\", AppName, AWSSessionName, profile),\n\t\t\tKeychainNotTrustApplication: false,\n\t\t},\n\t)\n\n\treturn nil\n}", "title": "" }, { "docid": "fa0f3bc9f27d5fd6b3d10580de8d1714", "score": "0.53068215", "text": "func GetRequestTokenCookie(req *http.Request) (string, error) {\n\tauthCookie, err := req.Cookie(\"pure1-unplugged-token\")\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn authCookie.Value, nil\n}", "title": "" }, { "docid": "cd7a1d98cad39affa6a852fe3d2917ef", "score": "0.5294406", "text": "func GetSessionID(cookie, key string) (string, error) {\n\n\tdecodeBytes, err := base64.StdEncoding.DecodeString(cookie)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"cookie value must in base64 format\")\n\t}\n\tvar payload struct {\n\t\tIV string\n\t\tValue string\n\t\tMac string\n\t}\n\terr = json.Unmarshal(decodeBytes, &payload)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"cookie value must be valid\")\n\t}\n\tencryptedText, err := base64.StdEncoding.DecodeString(payload.Value)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"encrypted text must be valid base64 format\")\n\t}\n\tiv, err := base64.StdEncoding.DecodeString(payload.IV)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"iv in payload must be valid base64 format\")\n\t}\n\n\tvar keyBytes []byte\n\tif strings.HasPrefix(key, \"base64:\") {\n\t\tkeyBytes, err = base64.StdEncoding.DecodeString(string(key[7:]))\n\t\tif err != nil {\n\t\t\treturn \"\", errors.New(\"seems like you provide a key in base64 format, but it's not valid\")\n\t\t}\n\t} else {\n\t\tkeyBytes = []byte(key)\n\t}\n\n\tblock, err := aes.NewCipher(keyBytes)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tmode := cipher.NewCBCDecrypter(block, iv)\n\n\tmode.CryptBlocks(encryptedText, encryptedText)\n\n\tunserializer := php_serialize.NewUnSerializer(string(encryptedText))\n\tvar sessionID php_serialize.PhpValue\n\tif sessionID, err = unserializer.Decode(); err != nil {\n\t\treturn \"\", fmt.Errorf(\"unserialize data error, raw value is %s\", string(encryptedText))\n\t}\n\n\treturn sessionID.(string), nil\n}", "title": "" }, { "docid": "c46e8b7cb4fba2669cd4921da5d24947", "score": "0.52682805", "text": "func getCookie(cookieName string , r *http.Request) (string, error) {\n cookie, err := r.Cookie(cookieName)\n if err != nil{\n //fmt.Println(\"Could not retrieve the cookie for \"+cookieName+\": \"+err.Error())\n return \"\", err \n } else{\n cookieValue:= cookie.Value\n //fmt.Println(\"A cookie exists, the token cookie is: '\"+ cookieValue+\"'\")\n return cookieValue, nil;\n }\n}", "title": "" }, { "docid": "d89c786468fc240a094ae18b6635144c", "score": "0.52614045", "text": "func FromCookies(cookies []*http.Cookie, cookieName string,\n\tsc *securecookie.Config) (*Session, error) {\n\n\tsesh := sessionFromCookies(cookies, cookieName, sc)\n\tif sesh != nil {\n\t\treturn sesh, nil\n\t}\n\n\t// This token is used for CSRF mitigation\n\ttoken := base64.RawStdEncoding.EncodeToString([]byte(uuid.NewNoDash()))\n\treturn &Session{\n\t\tID: uuid.NewNoDash(),\n\t\tToken: token,\n\t\tTimestamp: time.Now(),\n\t}, nil\n}", "title": "" }, { "docid": "c5f370647e1174bc8a81c3893878427b", "score": "0.5261013", "text": "func (p *ProviderData) CreateSessionFromToken(ctx context.Context, token string) (*sessions.SessionState, error) {\n\tif p.Verifier != nil {\n\t\treturn middleware.CreateTokenToSessionFunc(p.Verifier.Verify)(ctx, token)\n\t}\n\treturn nil, ErrNotImplemented\n}", "title": "" }, { "docid": "ed062edd8f1d998842fd2b265673c592", "score": "0.5242281", "text": "func GetCSRFToken(r *http.Request) (string, error) {\n\tval, ok := context.GetOk(r, csrfKey)\n\tif !ok {\n\t\treturn \"\", ErrCSRFTokenNotPresent\n\t}\n\n\ttoken, ok := val.(string)\n\tif !ok {\n\t\treturn \"\", ErrCSRFTokenNotPresent\n\t}\n\n\treturn token, nil\n}", "title": "" }, { "docid": "0d252513991de52fed43e5b43d7064e4", "score": "0.5240682", "text": "func NewSessionFromCookie(c *SessionCookie) *Session {\n\tvar email, passhash, firstname, preferredname string\n\tvar uid, RID int64\n\n\terr := PrepStmts.LoginInfo.QueryRow(c.UserName).Scan(&uid, &firstname, &preferredname, &email, &passhash, &RID)\n\tif err != nil {\n\t\ts := new(Session)\n\t\tlib.Ulog(\"Error reading person with username %s: %s\", c.UserName, err.Error())\n\t\treturn s // it's empty because of the error\n\t}\n\tif len(preferredname) > 0 {\n\t\tfirstname = preferredname\n\t}\n\treturn pvtNewSession(c, firstname, RID, false)\n}", "title": "" }, { "docid": "97652154e7cdceb94e180d19b5902e77", "score": "0.5233401", "text": "func (s *Session) Session(cache cache.Cache, redisdb string, r *http.Request, w http.ResponseWriter) error {\n\n\tcfg, err := config.GetConfig()\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"error getting configuration\")\n\t\treturn err\n\t}\n\n\t// Attempt to get the current cookie and if it does not exist, build a new cookie\n\tc, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\tlog.Info().Err(err).Msg(\"error finding coodie or cookie does not exist\")\n\t}\n\n\t// No cookie exists so we can create a new cookie\n\tif err == http.ErrNoCookie {\n\t\t// No cookie exists, create the new cookie.\n\t\tfmt.Printf(\"no cookie exists, need to create a new cookie: %s\\n\", err)\n\n\t\t// Generate session token\n\t\ts.SessionToken = uuid.NewV4().String()\n\n\t\t// Create a new cookie\n\t\tvar newCookie http.Cookie\n\t\tnewCookie.Name = \"session_token\"\n\t\tnewCookie.Value = s.SessionToken\n\t\tnewCookie.Path = \"/\"\n\t\tnewCookie.Expires = time.Now().Add(cfg.GetDurationTimeout())\n\n\t\t// Populate an anonymous user object\n\n\t\tvar user User\n\t\tuser.Username = \"anonymous\"\n\t\tuser.IsAuth = false\n\t\tuser.CreatedAt = time.Now()\n\n\t\tvar geoIP requestfilter.GeoIP\n\n\t\t// The context may exist, but maybe not....Try to get information from the context, if\n\t\t// not found then extract it manually by calling the API. There are conditions\n\t\t// where this can be pulled from the context, but most likely you can not. Maybe\n\t\t// we do not use the context route, since sessions come first...\n\t\ttype contextKey string\n\t\tvar ctxKey contextKey = \"geoip\"\n\t\t//ctxKey = \"geoip\"\n\n\t\tif result := r.Context().Value(ctxKey); result != nil {\n\t\t\tgeoIP, ok := result.(requestfilter.GeoIP)\n\t\t\tif !ok {\n\t\t\t\tlog.Info().Msg(\"could not perform type assertion on result to GeoIP type\")\n\t\t\t}\n\n\t\t\tuser.City = geoIP.City\n\t\t\tuser.TimeZone = geoIP.TimeZone\n\t\t\tuser.Country = geoIP.CountryName\n\t\t\tuser.IPAddress = geoIP.IPAddress.String()\n\t\t\tuser.Organization = geoIP.Organization\n\t\t\tuser.ASN = geoIP.ASN\n\t\t} else {\n\t\t\tlog.Info().Msgf(\"could not find ctxkey geoip during session %s, performing manual lookup\", s.SessionToken)\n\t\t\tipaddress, _ := requestfilter.GetIPAddress(r)\n\t\t\terr := geoIP.GeoIPSearch(ipaddress, cfg)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error().Err(err).Msgf(\"GeoIP Address search error: %s\", ipaddress)\n\n\t\t\t}\n\t\t\tuser.City = geoIP.City\n\t\t\tuser.TimeZone = geoIP.TimeZone\n\t\t\tuser.Country = geoIP.CountryName\n\t\t\tuser.IPAddress = geoIP.IPAddress.String()\n\t\t\tuser.Organization = geoIP.Organization\n\t\t\tuser.ASN = geoIP.ASN\n\n\t\t}\n\n\t\t// Set the user\n\t\ts.User = user\n\t\t//s.IsAuth = false\n\t\ts.TTL = int(cfg.GetIntegerSessionTimeout())\n\n\t\t// Place the cookie into the response header\n\t\tlog.Info().Msgf(\"Setting Cookie with id: %s\\n\", newCookie.Value)\n\t\thttp.SetCookie(w, &newCookie)\n\n\t\terr := s.Save(cache, cfg.RedisDB)\n\t\tif err != nil {\n\t\t\tlog.Error().Err(err).Msg(\"error saving new session to the redis cache\")\n\t\t}\n\n\t\treturn nil\n\n\t}\n\n\t//\n\t// Assume cookie exists\n\t//\n\n\t// Get the session token\n\t//s.SessionToken = c.Value\n\tlog.Info().Msgf(\"looking for redis cache object for token %s\", c.Value)\n\terr = s.Get(cache, cfg.RedisDB, c.Value)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting cache object for token %s with error %s\", c.Value, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "20a09443582594043503673c03b1930e", "score": "0.52287596", "text": "func GetSessionCookieName() string {\n\treturn SessionCookieName\n}", "title": "" }, { "docid": "851ba8b4e768d2d53abaa69b7cfc6bfb", "score": "0.5223567", "text": "func (s *API) GetToken(req *GetTokenRequest, opts ...scw.RequestOption) (*Token, error) {\n\tvar err error\n\n\tif fmt.Sprint(req.TokenID) == \"\" {\n\t\treturn nil, errors.New(\"field TokenID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"GET\",\n\t\tPath: \"/cockpit/v1beta1/tokens/\" + fmt.Sprint(req.TokenID) + \"\",\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp Token\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": "d49828d9f042c8ddbdd93a095ca10271", "score": "0.5201035", "text": "func GetSession(r *http.Request, w http.ResponseWriter, doLogin bool) (ppsession *Session, redirected bool, err error) {\n\tsession, _ := config.Store.Get(r, SessionName)\n\n\tmsession, ok := session.Values[\"session\"].(Session)\n\tif !ok || session.IsNew || time.Now().After(msession.DiscordToken.Expiry) {\n\t\tif !doLogin {\n\t\t\treturn nil, false, nil\n\t\t}\n\n\t\terr := oauthLogin(r, w)\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\treturn nil, true, nil\n\t}\n\n\treturn &msession, false, nil\n}", "title": "" }, { "docid": "70904b7ab7c3473b2f70a4c5a8417138", "score": "0.5196174", "text": "func (c *Client) SessionID() string {\n\tu, _ := url.Parse(c.baseURL + \"/enduserAPI\")\n\tfor _, cookie := range c.hc.Jar.Cookies(u) {\n\t\tif (cookie.Name == \"JSESSIONID\") && (cookie.Value != \"\") {\n\t\t\treturn cookie.Value\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "b3ac0d6cc6127abfe9b41316ceaf03a0", "score": "0.5179777", "text": "func SessionGet(result interface{}, sessionKey string) error {\n\treturn cacheGet(&cacheSession{\n\t\tsessionKey: sessionKey,\n\t}, result)\n}", "title": "" }, { "docid": "a461f11f108a54dc40735cf7bc219e10", "score": "0.5178896", "text": "func getToken() (string, error) {\n\tresp, err := http.Get(loginUrl)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\n\tb, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\ttoken := strings.SplitAfter(string(b), \"name=\\\"hash\\\" value=\\\"\")[1][:32]\n\n\treturn token, nil\n}", "title": "" }, { "docid": "64ff862d4bbbcf72446a4ef736ce31ea", "score": "0.51747537", "text": "func GetToken(r *http.Request) string {\n\treturn context.Get(r, TokenKey).(string)\n}", "title": "" }, { "docid": "e152f20520cdb3de42e3d445d2348153", "score": "0.51714414", "text": "func (u *UserClaims) GetToken(method string, secret []byte) (string, error) {\n\treturn GetToken(method, secret, *u)\n}", "title": "" }, { "docid": "56a66e2dc706812d61cf9713aee7b051", "score": "0.5169715", "text": "func setToken(username string) *http.Cookie {\r\n\texpireCookie := time.Now().Add(sessionTime)\r\n\texpireToken := expireCookie.Unix()\r\n\r\n\t// set new token claims\r\n\tclaims := claims{\r\n\t\tusername,\r\n\t\tjwt.StandardClaims{\r\n\t\t\tExpiresAt: expireToken,\r\n\t\t\tIssuer: addr,\r\n\t\t},\r\n\t}\r\n\r\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\r\n\tsignedToken, _ := token.SignedString(GetEnvJWT())\r\n\r\n\tcookie := &http.Cookie{\r\n\t\tName: cookieName,\r\n\t\tValue: signedToken,\r\n\t\tExpires: expireCookie,\r\n\t\tHttpOnly: true,\r\n\t\tPath: \"/\",\r\n\t\tDomain: \"127.0.0.1\",\r\n\t\tSecure: true,\r\n\t\tSameSite: http.SameSiteLaxMode,\r\n\t}\r\n\r\n\treturn cookie\r\n}", "title": "" }, { "docid": "d0991666643d56b45135792d0fb413ad", "score": "0.51658785", "text": "func (p *AzureProvider) extractClaimsIntoSession(ctx context.Context, session *sessions.SessionState) error {\n\n\tvar s *sessions.SessionState\n\n\t// First let's verify session token\n\tif err := p.verifySessionToken(ctx, session); err != nil {\n\t\treturn fmt.Errorf(\"unable to verify token: %v\", err)\n\t}\n\n\t// https://github.com/oauth2-proxy/oauth2-proxy/pull/914#issuecomment-782285814\n\t// https://github.com/AzureAD/azure-activedirectory-library-for-java/issues/117\n\t// due to above issues, id_token may not be signed by AAD\n\t// in that case, we will fallback to access token\n\tvar err error\n\ts, err = p.buildSessionFromClaims(session.IDToken, session.AccessToken)\n\tif err != nil || s.Email == \"\" {\n\t\ts, err = p.buildSessionFromClaims(session.AccessToken, session.AccessToken)\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to get claims from token: %v\", err)\n\t}\n\n\tsession.Email = s.Email\n\tif s.Groups != nil {\n\t\tsession.Groups = s.Groups\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6d57eb34a241a750b95a5a0a3c2a3b72", "score": "0.5165559", "text": "func (m *SessionManager) Get(authenticationToken ua.NodeID) (*Session, bool) {\n\tm.RLock()\n\tdefer m.RUnlock()\n\ts, ok := m.sessionsByToken[authenticationToken]\n\tif !ok {\n\t\treturn nil, false\n\t}\n\ts.SetLastAccess(time.Now())\n\treturn s, ok\n}", "title": "" }, { "docid": "de977df6b293c23984816bc16cb3da98", "score": "0.5160792", "text": "func (a *authUser) SessionAuth(token string) (*entity.User, error) {\n\tat := utils.ValidateJwt(token)\n\tif at == nil {\n\t\treturn nil, errors.New(\"invalid jwt\")\n\t}\n\n\tuser, err := userRepo.GetUserByUsername(at.Username)\n\n\treturn user, err\n}", "title": "" }, { "docid": "0abcafb45fb8544ff5ffeea323078923", "score": "0.5158304", "text": "func GetToken() (string, error) {\n\t// Create token\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\n\tclaims := token.Claims.(jwt.MapClaims)\n\tclaims[\"username\"] = \"spaas\"\n\tclaims[\"admin\"] = true\n\tclaims[\"exp\"] = time.Now().Add(time.Hour * 24 * 365).Unix()\n\t// Generate encoded token and send it as response.\n\tt, err := token.SignedString([]byte(config.Cfg.Config.GetString(\"secret\")))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn t, nil\n}", "title": "" }, { "docid": "43e76daefafccbb3085a79211eca0238", "score": "0.5157543", "text": "func GetToken(tokenFile string, config *oauth2.Config) (*oauth2.Token, error) {\n\t// Attempt to load token from local storage. Fallback to full auth cycle.\n\ttoken, err := LoadToken(tokenFile)\n\tif err != nil || !token.Valid() {\n\t\tif config.ClientID == \"\" || config.ClientSecret == \"\" {\n\t\t\treturn nil, errors.New(\"need ClientID and secret to generate a new token\")\n\t\t}\n\t\tgst, err := NewAuth(defaultPort, config)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfmt.Printf(\"Please login by visiting http://localhost:%d\\n\", defaultPort)\n\t\ttoken, err = gst.FetchOAuthToken()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Once we have the token, save it locally for future use.\n\t\terr = SaveToken(tokenFile, token)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn token, nil\n}", "title": "" }, { "docid": "0b2d807ba01b6d0afb9f9518f7299667", "score": "0.5150804", "text": "func GetBluecatGatewayToken(cfg BluecatConfig) (string, http.Cookie, error) {\n\tvar username string\n\tif cfg.GatewayUsername != \"\" {\n\t\tusername = cfg.GatewayUsername\n\t}\n\tif v, ok := os.LookupEnv(\"BLUECAT_USERNAME\"); ok {\n\t\tusername = v\n\t}\n\n\tvar password string\n\tif cfg.GatewayPassword != \"\" {\n\t\tpassword = cfg.GatewayPassword\n\t}\n\tif v, ok := os.LookupEnv(\"BLUECAT_PASSWORD\"); ok {\n\t\tpassword = v\n\t}\n\n\tbody, err := json.Marshal(map[string]string{\n\t\t\"username\": username,\n\t\t\"password\": password,\n\t})\n\tif err != nil {\n\t\treturn \"\", http.Cookie{}, errors.Wrap(err, \"could not unmarshal credentials for bluecat gateway config\")\n\t}\n\turl := cfg.GatewayHost + \"/rest_login\"\n\n\tresponse, err := executeHTTPRequest(cfg.SkipTLSVerify, http.MethodPost, url, \"\", bytes.NewBuffer(body), http.Cookie{})\n\tif err != nil {\n\t\treturn \"\", http.Cookie{}, errors.Wrap(err, \"error obtaining API token from bluecat gateway\")\n\t}\n\tdefer response.Body.Close()\n\n\tresponseBody, err := io.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn \"\", http.Cookie{}, errors.Wrap(err, \"failed to read login response from bluecat gateway\")\n\t}\n\n\tif response.StatusCode != http.StatusOK {\n\t\treturn \"\", http.Cookie{}, errors.Errorf(\"got HTTP response code %v, detailed message: %v\", response.StatusCode, string(responseBody))\n\t}\n\n\tjsonResponse := map[string]string{}\n\terr = json.Unmarshal(responseBody, &jsonResponse)\n\tif err != nil {\n\t\treturn \"\", http.Cookie{}, errors.Wrap(err, \"error unmarshaling json response (auth) from bluecat gateway\")\n\t}\n\n\t// Example response: {\"access_token\": \"BAMAuthToken: abc123\"}\n\t// We only care about the actual token string - i.e. abc123\n\t// The gateway also creates a cookie as part of the response. This seems to be the actual auth mechanism, at least\n\t// for now.\n\treturn strings.Split(jsonResponse[\"access_token\"], \" \")[1], *response.Cookies()[0], nil\n}", "title": "" }, { "docid": "dadb564c7d001eaaca2674fb98e368d5", "score": "0.51507014", "text": "func (c *Config) SetSessionToken(o string) {\n\tc.values.Set(\"sessionToken\", o)\n}", "title": "" }, { "docid": "43c7c006a799e1a8a6b7cccc61733e91", "score": "0.51499397", "text": "func (am AccountManager) GetAccountSession(session *types.Session, db *db.MySQL, cache *cache.Cache) (*types.Account, error) {\n\tcachedAccount, err := cache.Get(session.Token)\n\tif err == nil { //Check if cache is available.\n\t\tvar account *types.Account\n\t\tif json.Unmarshal([]byte(cachedAccount), &account) == nil {\n\t\t\treturn account, nil\n\t\t}\n\t}\n\tstmt, err := db.PreparedQuery(\"SELECT * FROM users WHERE token = ?\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trows, err := stmt.Query(session.Token)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstmt.Close()\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\taccount := types.Account{}\n\t\terr = sqlstruct.Scan(&account, rows)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tam.SaveToCache(&account, cache)\n\t\treturn &account, nil\n\t}\n\treturn nil, errors.New(\"No session found\")\n}", "title": "" }, { "docid": "0c96430044c2753760b1a7163acf85d5", "score": "0.51255834", "text": "func getSession(options session.Options) (*session.Session, error) {\n\tsess, err := session.NewSessionWithOptions(options)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tif _, err := sess.Config.Credentials.Get(); err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\treturn sess, nil\n}", "title": "" }, { "docid": "964b22965c9539aa305442a3dd25315c", "score": "0.511236", "text": "func CheckSession(w http.ResponseWriter, req *http.Request) (sess data.Session, err error) {\n\n\t// get cookie from request\n\tcookie,err := req.Cookie(\"_cookie\")\n\n\t// if no error and there's session, that means user have logged in, we retrieve the cookie stored \n\tif err == nil{\n\t\tsess = data.Session{\n\t\t\tUuid: cookie.Value,\n\t\t}\n\t\t\n\t\t// but if there's a session ,it checks the DB to see if the session Uuid exist\n\n\t\tif ok,_:= sess.CheckSessionInDB(); !ok {\n\t\t\terr = errors.New(\"invalid session\")\n\t\t}\n\t}\n\treturn\n\n}", "title": "" }, { "docid": "91bbe08790f9042389960feee4539cee", "score": "0.510788", "text": "func (aaa *SessionService) GetSession(input *session.GetSessionParams) (*sessionbrowserclientmodels.ModelsSessionResponse, error) {\n\ttoken, err := aaa.TokenRepository.GetToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tok, notFound, internalServerError, err := aaa.Client.Session.GetSession(input, client.BearerToken(*token.AccessToken))\n\tif notFound != nil {\n\t\treturn nil, notFound\n\t}\n\tif internalServerError != nil {\n\t\treturn nil, internalServerError\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ok.GetPayload(), nil\n}", "title": "" }, { "docid": "3530264d9ac3998490a7d1c3de53bdb1", "score": "0.51077235", "text": "func getSession() (*http.Request, error) {\n\tr, err := http.NewRequest(\"GET\", \"/some-url\", nil) // making request to url trying to get a request\n\t// NewRequest is a built-in func and it's not going to give error. However, checking error is a good habit.\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tctx := r.Context()\n\tctx, _ = session.Load(ctx, r.Header.Get(\"X-Session\")) // the second parameter makes it an active session\n\tr = r.WithContext(ctx) // put the context back into the request\n\n\treturn r, nil\n}", "title": "" }, { "docid": "01b56365875b04ad7a3b3c1c34399f70", "score": "0.50976783", "text": "func (s *AuthStore) GetToken(token string) (*jwt.Token, error) {\n\tt := &jwt.Token{}\n\terr := mgm.Coll(t).First(bson.M{\"token\": token}, t)\n\tif err != nil {\n\t\t//if err == mongo.ErrNoDocuments {\n\t\t//\treturn nil, nil\n\t\t//}\n\t\treturn nil, err\n\t}\n\treturn t, nil\n}", "title": "" }, { "docid": "38d4ff87daf0dc3e5907a6fdb5f6878f", "score": "0.5091814", "text": "func (t *SessionService) NewSession(user User) (string, error) {\n\tlog.Printf(\"NewSession Called for '%v' and secret %v\\n\", user.User, *SessionSecret)\n\n\t// Create a new token object, specifying signing method and the claims\n\t// you would like it to contain.\n\ttokenString, _ := CreateSession(user, *SessionPeriod, *SessionSecret)\n\treturn tokenString, nil\n\n}", "title": "" }, { "docid": "8e8a408492335efd6a069eb46ed8d627", "score": "0.5091415", "text": "func (app *App) Session(accessToken string) *Session {\n\treturn &Session{\n\t\taccessToken: accessToken,\n\t\tapp: app,\n\t\tenableAppsecretProof: app.EnableAppsecretProof,\n\t}\n}", "title": "" }, { "docid": "d8e5141a264dabc966fea51b3a38a3e2", "score": "0.5090106", "text": "func SessionTokenKey(tokenID string) string {\n\treturn key(Session, tokenID)\n}", "title": "" }, { "docid": "1729197b179a3b39d2289a46e7df7b92", "score": "0.5086252", "text": "func (s *SessionStore) makeSessionCookie(req *http.Request, value []byte, now time.Time) ([]*http.Cookie, error) {\n\tstrValue := string(value)\n\tif strValue != \"\" {\n\t\tvar err error\n\t\tstrValue, err = encryption.SignedValue(s.Cookie.Secret, s.Cookie.Name, value, now)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tc := s.makeCookie(req, s.Cookie.Name, strValue, s.Cookie.Expire, now)\n\tif len(c.String()) > maxCookieLength {\n\t\treturn splitCookie(c), nil\n\t}\n\treturn []*http.Cookie{c}, nil\n}", "title": "" }, { "docid": "ae9a801babeed1c45090110e79fe1316", "score": "0.50798327", "text": "func (am AuthManager) readSessionValue(ctx *Ctx) string {\n\treturn am.cookieValue(am.CookieDefaults.Name, ctx)\n}", "title": "" }, { "docid": "365bd1393c8dc67762275acf09556113", "score": "0.5075633", "text": "func loadSession(r *http.Request) (session.Session, error) {\n\tvar l = socketApiLogger.WithFields(logrus.Fields{\n\t\t\"method\": \"loadSession\",\n\t})\n\n\tsidCookie, _ := r.Cookie(\"sid\")\n\tif sidCookie != nil {\n\t\tl.Debugf(\"Found sid cookie\")\n\t\ts, err := session.Load(sidCookie.Value)\n\n\t\tif err != nil {\n\t\t\tl.Errorf(\"Error loading session data: '%s'\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tl.Debugf(\"Loaded session\")\n\t\treturn s, nil\n\t}\n\n\ts, err := session.New()\n\tif err != nil {\n\t\tl.Errorf(\"Error starting new session: '%s'\", err)\n\t\treturn nil, err\n\t}\n\tl.Debugf(\"Created new session\")\n\n\treturn s, nil\n}", "title": "" }, { "docid": "dd5fcd3f18e7e67d8f58ac0c0bb02e26", "score": "0.5074194", "text": "func (this *CookieStore) Get(sid interface{}) (*Session, error) {\n\tsession := NewSession(this, \"\", make(map[string]interface{})) // session id is empty for cookie store\n\n\tif values, ok := sid.(map[string]interface{}); ok {\n\t\tsession.Values = values\n\t}\n\n\treturn session, nil\n}", "title": "" }, { "docid": "fec9cc333447e375196080f976470ea8", "score": "0.5073452", "text": "func GetSession(w http.ResponseWriter, r *http.Request) *sessions.Session {\n session, err := sessionStore.Get(r, \"buzzer-session\")\n if err != nil {\n Handle500Error(w, err)\n }\n return session\n}", "title": "" }, { "docid": "7d2869e9961fd8b259fd903713da37dd", "score": "0.5071849", "text": "func (o *APIRegistrationFlow) SetSessionToken(v string) {\n\to.SessionToken = &v\n}", "title": "" }, { "docid": "3509d19a3d5e6a76553c3d542fb22de3", "score": "0.50704044", "text": "func (s *CookieStorer) GetValueForSessionName(r *http.Request, name string) (string, error) {\n\tc, err := r.Cookie(name)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn c.Value, nil\n}", "title": "" }, { "docid": "7419da14da9c3c98d9d35768e46304c8", "score": "0.50661147", "text": "func GetToken(method string, secret []byte, claims UserClaims) (string, error) {\n\tif _, exists := methods[method]; !exists {\n\t\treturn \"\", fmt.Errorf(\"unsupported signing method\")\n\t}\n\n\tif secret == nil {\n\t\treturn \"\", fmt.Errorf(\"empty secrets are not supported\")\n\t}\n\n\tsm := jwtlib.GetSigningMethod(method)\n\ttoken := jwtlib.NewWithClaims(sm, claims)\n\tsignedToken, err := token.SignedString(secret)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn signedToken, nil\n}", "title": "" }, { "docid": "9168dd6e8e83b265918168dab6a444fd", "score": "0.50637984", "text": "func GetSessionCookie(ctx context.Context, resp *http.Response) string {\n\tif ctx != nil {\n\t\treturn GetContextMetadata(ctx, common.LBSessionID)\n\t}\n\n\tif resp == nil {\n\t\topenlogging.GetLogger().Warnf(\"\", ErrResponseNil)\n\t\treturn \"\"\n\t}\n\n\tvalueChassisLb := GetSessionFromResp(common.LBSessionID, resp)\n\tif valueChassisLb != \"\" {\n\t\treturn valueChassisLb\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "d575612e7ad6588bd9547fe377640854", "score": "0.50616944", "text": "func SessionAuth() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tcookie, _ := c.Cookie(\"DM_SessionID\")\n\t\ts := GetSessionFromCookie(cookie)\n\n\t\tc.Set(\"session\", s)\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "2945fc68344ac81418b0f22504124910", "score": "0.50598294", "text": "func (u *User) GetAccessToken(session *mgo.Session, path string) (*Token, error) {\n\n\tdb := session.Copy()\n\tdefer db.Close()\n\n\tcollection := db.DB(\"directory\").C(\"tokens\")\n\n\tvar tokens []Token\n\tcollection.Find(bson.M{\n\t\t\"user_id\": u.ID,\n\t\t\"path\": path,\n\t}).All(&tokens)\n\n\tfor index := range tokens {\n\t\tif time.Now().After(tokens[index].Expires) {\n\t\t\t// Token has expired\n\t\t\tcontinue\n\t\t}\n\t\treturn &tokens[index], nil\n\t}\n\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "d6201064e1bc9e9409b6e358b4fa0e51", "score": "0.5051463", "text": "func GetSession(c *gin.Context) *Session {\r\n\tcustomField, _ := c.Get(SessionName)\r\n\treturn customField.(*Session)\r\n}", "title": "" }, { "docid": "d2945bacc0447020cf9680bbb8d7164b", "score": "0.50438887", "text": "func TokenAuth(usersSvc users.Service) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\trequestUser := new(models.UserAuthentication)\n\t\tdecoder := json.NewDecoder(req.Body)\n\t\tdecoder.Decode(&requestUser)\n\t\tresponseStatus, token, expirationTime := auth.Login(requestUser)\n\n\t\t// Setting token and expiration time in cookie\n\t\thttp.SetCookie(w, &http.Cookie{\n\t\t\tName: \"token\",\n\t\t\tValue: token,\n\t\t\tExpires: expirationTime,\n\t\t})\n\n\t\tif responseStatus == http.StatusOK {\n\t\t\tresponse := map[string]string{\"status\": \"success\", \"token\": token}\n\t\t\tutils.RespondJSON(w, responseStatus, response)\n\t\t\treturn\n\t\t}\n\n\t\tutils.RespondJSON(w, responseStatus, \"\")\n\t\treturn\n\t})\n}", "title": "" }, { "docid": "2bd4ee2e09c9ff096f400cf5c57c5ef3", "score": "0.50417817", "text": "func (s *session) Token() string {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\treturn s.token\n}", "title": "" }, { "docid": "f8334908c769951de19a9b6daa63efa2", "score": "0.5040416", "text": "func (am AuthManager) VerifySession(ctx *Ctx) (sessionValue string, session *Session, err error) {\n\tsessionValue = am.readSessionValue(ctx)\n\t// validate the sessionValue is set\n\tif len(sessionValue) == 0 {\n\t\treturn\n\t}\n\n\t// if we have a restore handler, call it.\n\tif am.FetchHandler != nil {\n\t\tsession, err = am.FetchHandler(ctx.Context(), sessionValue)\n\t\tif err != nil {\n\t\t\tif IsErrSessionInvalid(err) {\n\t\t\t\t_ = am.expire(ctx, sessionValue)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n\t// if the session is invalid, expire the cookie(s)\n\tif session == nil || session.IsZero() || session.IsExpired() {\n\t\t// return nil whenever the session is invalid\n\t\tsession = nil\n\t\terr = am.expire(ctx, sessionValue)\n\t\treturn\n\t}\n\n\t// call a custom validate handler if one's been provided.\n\tif am.ValidateHandler != nil {\n\t\terr = am.ValidateHandler(ctx.Context(), session)\n\t\tif err != nil {\n\t\t\tsession = nil\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b0112d0ff7d4407333da0d14184465b5", "score": "0.50264055", "text": "func NewSession(u *auth.User, token string) (*Session, error) {\n\tb := make([]byte, 32)\n\tif _, err := rand.Read(b); err != nil {\n\t\treturn nil, err\n\t}\n\n\tiat := time.Now()\n\tid := base64.StdEncoding.EncodeToString(b)\n\n\treturn &Session{\n\t\tID: id,\n\t\tUserID: u.UserId,\n\t\tEmail: u.Email,\n\t\tToken: token,\n\t\tCreatedAt: iat,\n\t\tUpdatedAt: iat,\n\t}, nil\n}", "title": "" }, { "docid": "5be5d93a3546a02592d2b329f764631b", "score": "0.5025945", "text": "func (kongojwt *KongoJWT) GetToken(username string, customID string) (string, error) {\n\tdata := KongData{Username: username, CustomID: customID, Server: kongojwt.Server}\n\n\tstatus, err := data.getJWTCredentials()\n\tif err != nil {\n\t\treturn \"\", err\n\t} else {\n\t\tif status == http.StatusNotFound {\n\t\t\t// Trying to create a new customer\n\t\t\terr = data.createCustomer()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\terr = data.createJWTCredentials()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t} else if status == http.StatusFound || status == http.StatusOK {\n\t\t\t// Select default token\n\t\t\terr = data.setDefaultJWTResult()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t}\n\t// Returns token\n\treturn data.Token, nil\n}", "title": "" }, { "docid": "9d4a221fdbf05b89d82b5a74fb90e364", "score": "0.50250447", "text": "func GetSession(r *http.Request) Session {\n\ts := httpcontext.Get(r, session_context_key)\n\treturn s.(Session)\n}", "title": "" }, { "docid": "ef66f84a43bb1b0e2fa849725434e68d", "score": "0.50181043", "text": "func UserSessionTokenContext(ctx context.Context, endpoint, username, password string, usetoken bool) (*Client, error) {\n\treturn UserSessionTokenProxyContext(ctx, endpoint, username, password, usetoken, true)\n}", "title": "" } ]
7624d72fa24630ea4ab25bc3ecbd5f79
String returns a loggingfriendly string for E_OpenconfigIsis_LinkAttributes_LocalProtection.
[ { "docid": "37848c3d8513db085bac998c592bffad", "score": "0.8554321", "text": "func (e E_OpenconfigIsis_LinkAttributes_LocalProtection) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OpenconfigIsis_LinkAttributes_LocalProtection\")\n}", "title": "" } ]
[ { "docid": "ba72a6eff848edddf09c5260290669dc", "score": "0.5767826", "text": "func (e E_OpenconfigIsis_Lsp_Flags) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OpenconfigIsis_Lsp_Flags\")\n}", "title": "" }, { "docid": "b051bf941e4b1f53ee2fd353d444ef9e", "score": "0.57615006", "text": "func (e E_OpenconfigIsis_LinkProtectionType_Type) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OpenconfigIsis_LinkProtectionType_Type\")\n}", "title": "" }, { "docid": "e1cfb7090435560a9014e0d305f4cff8", "score": "0.5758879", "text": "func (s LoggingEnabled) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3c666a7891a089c19a2d6e37e414a083", "score": "0.57061195", "text": "func (ls *linkState[LinkT]) String() string {\n\tif ls == nil {\n\t\treturn \"none\"\n\t}\n\n\tlinkName := \"\"\n\n\tif ls.link != nil {\n\t\tlinkName = ls.Link().LinkName()\n\t}\n\n\treturn formatLogPrefix(ls.connID, linkName, ls.partitionID)\n}", "title": "" }, { "docid": "14f111963ab7320e4ff42ff251860137", "score": "0.5642081", "text": "func (l *Link) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"Link(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v, \", l.ID))\n\tbuilder.WriteString(\"link_information=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", l.LinkInformation))\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "da314f0476053211fb02657d75a72c1f", "score": "0.5561921", "text": "func (l *Locality) String() string {\n\treturn fmt.Sprintf(\"provider=%s,area=%s,territory=%s,location=%s\", l.Provider, l.Area, l.Territory, l.Zone)\n}", "title": "" }, { "docid": "366ca6cfbdf95b44b962990719c12718", "score": "0.5512875", "text": "func (e E_OpenconfigIsis_LanAdjacencySid_Flags) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OpenconfigIsis_LanAdjacencySid_Flags\")\n}", "title": "" }, { "docid": "85947fd0282921f23cca1ac07980703b", "score": "0.55101335", "text": "func (s LocalNavigationConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fba9e4b3904104e5dc6816b2b22b6420", "score": "0.54699266", "text": "func (a ACL) String() string {\n\tb := new(bytes.Buffer)\n\tbitMaskStr := permString(a.Privileges, a.GrantOptions)\n\trole := a.Role\n\tgrantedBy := a.GrantedBy\n\n\tb.Grow(len(role) + len(\"=\") + len(bitMaskStr) + len(\"/\") + len(grantedBy))\n\n\tfmt.Fprint(b, role, \"=\", bitMaskStr)\n\n\tif grantedBy != \"\" {\n\t\tfmt.Fprint(b, \"/\", grantedBy)\n\t}\n\n\treturn b.String()\n}", "title": "" }, { "docid": "45e60d166726527472f5300f4b2ad917", "score": "0.546621", "text": "func (s LaunchPermissionConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1998bf7ca1c52e4710811e068971e529", "score": "0.5455293", "text": "func (lf LoggerFormat) String() string {\n\tif v, ok := lf[DefaultKeyLoggerPrefix]; ok {\n\t\treturn v + \" \"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "30f0310dd76ff896944683578b9715d1", "score": "0.5423933", "text": "func (s *SecurityGroup) PrintLocal() {\n\tmsg.Info(\"SecurityGroup Config\")\n\tmsg.Detail(\"%-20s\\t%s\", \"name\", s.Name())\n}", "title": "" }, { "docid": "4e4eebc1dfc30ab3d9f83f1fdd1783e2", "score": "0.54063755", "text": "func (d Trust) String() string {\n\tkey := \"<unauthorized>\"\n\tif Verify.MetBy(d.trusteeCert.Level) {\n\t\tkey = d.trustSigningKey.Pub.Id()\n\t}\n\n\treturn fmt.Sprintf(\"Trust(id=%v, key=%v): %v\", formatUUID(d.Id), key, d.trusteeCert)\n}", "title": "" }, { "docid": "a82c1ff97c1e793fa6192e5b210252aa", "score": "0.5378858", "text": "func (s KeyAttributes) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "97dd1ddcbd7c281fd206004352827d7a", "score": "0.5342927", "text": "func (s SignPermission) String() string {\n\treturn fmt.Sprintf(\"SignPermission(ID=%v, CertAuthorityID=%v, CommonName=%v, SignID=%v, TTL=%v)\",\n\t\ts.ID, s.CertAuthorityID, s.Org, s.SignID, s.MaxTTL)\n}", "title": "" }, { "docid": "01aa037bcf9fd0b9e60b6272af6870a4", "score": "0.5333125", "text": "func (p PermissionTag) String() string {\n\tvar buffer bytes.Buffer\n\ts := fmt.Sprintf(\"\\t* Name: %s\\n\",p.Name)\n\tbuffer.WriteString(s)\n\treturn buffer.String()\n}", "title": "" }, { "docid": "e4e3e987d6d3a10bcbf98e6b89ba4794", "score": "0.5323497", "text": "func (s UpdateLinkAttributesOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e3910dc6abad2aeba3399b1c3fc07eb4", "score": "0.5320275", "text": "func (s ServerCertificateScope) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "89ffd87cf05f2a346aa9d6762c6b7097", "score": "0.5318587", "text": "func (p Permission) String() string {\n\tvar str []string\n\tfor k, v := range PermissionNames {\n\t\tif p&v != 0 {\n\t\t\tstr = append(str, k)\n\t\t}\n\t}\n\n\treturn strings.Join(str, \", \")\n}", "title": "" }, { "docid": "b391ead4ca3652e02197c5ac29dfaa87", "score": "0.53139985", "text": "func (i Identity) String() string {\n\treturn \"uid \" + i.ID()\n}", "title": "" }, { "docid": "50140e412aeb48fe761219f6fb9c5629", "score": "0.5312613", "text": "func (p Permission) String() string {\n\treturn fmt.Sprintf(\"Permission(id=%v, action=%v, collection=%v, collectionID=%v)\", p.ID, p.Action, p.Collection, p.CollectionID)\n}", "title": "" }, { "docid": "950031ed35b0845e5bfe4ccbd00abc70", "score": "0.5306424", "text": "func (a Record) String() string {\n\treturn fmt.Sprintf(\"%s|%s|%s\", a.UASignature, a.RequestSignature, a.MitmInfo)\n}", "title": "" }, { "docid": "83a992b4cc7f7da5ee0265f8458d625a", "score": "0.5306304", "text": "func (s ColumnLevelPermissionRule) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fd93fe890366e87520121af6250936b6", "score": "0.5305205", "text": "func (p *Permission) String() string {\n\treturn Stringify(p)\n}", "title": "" }, { "docid": "57ecb29d49e7610f3584e153da736276", "score": "0.5303989", "text": "func (a *L3n4Addr) String() string {\n\tvar scope string\n\tif a.Scope == ScopeInternal {\n\t\tscope = \"/i\"\n\t}\n\tif a.IsIPv6() {\n\t\treturn fmt.Sprintf(\"[%s]:%d%s\", a.IP.String(), a.Port, scope)\n\t}\n\treturn fmt.Sprintf(\"%s:%d%s\", a.IP.String(), a.Port, scope)\n}", "title": "" }, { "docid": "91eeec43d7eb4551b51cc6f2d6b45bf3", "score": "0.53015", "text": "func (s LDAPSSettingInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d82459d25247332854d0ba3888b04901", "score": "0.5281456", "text": "func (e E_OpenconfigLldpTypes_LLDP_SYSTEM_CAPABILITY) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OpenconfigLldpTypes_LLDP_SYSTEM_CAPABILITY\")\n}", "title": "" }, { "docid": "cd095f229654c6dd1c4544495b6678f8", "score": "0.5278717", "text": "func (e E_OpenconfigIsis_Nlpid_Nlpid) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OpenconfigIsis_Nlpid_Nlpid\")\n}", "title": "" }, { "docid": "06882b7e8c7c54ad0b8840cbbd666d4b", "score": "0.5277466", "text": "func (p *AccessPolicyPermission) String() string {\n\tvar b bytes.Buffer\n\tif p.Read {\n\t\tb.WriteRune('r')\n\t}\n\tif p.Add {\n\t\tb.WriteRune('a')\n\t}\n\tif p.Create {\n\t\tb.WriteRune('c')\n\t}\n\tif p.Write {\n\t\tb.WriteRune('w')\n\t}\n\tif p.Delete {\n\t\tb.WriteRune('d')\n\t}\n\tif p.List {\n\t\tb.WriteRune('l')\n\t}\n\treturn b.String()\n}", "title": "" }, { "docid": "2739e9205561951228d75b090bd5b2f3", "score": "0.52771443", "text": "func (c localCode) String() string {\n\tif c.detail != nil {\n\t\treturn fmt.Sprintf(`%d:%s %v`, c.code, c.message, c.detail)\n\t}\n\tif c.message != \"\" {\n\t\treturn fmt.Sprintf(`%d:%s`, c.code, c.message)\n\t}\n\treturn fmt.Sprintf(`%d`, c.code)\n}", "title": "" }, { "docid": "eaedf63a11e65a862512b8f77a580be2", "score": "0.5268409", "text": "func (md *DILocation) LLString() string {\n\t// '!DILocation' '(' Fields=(DILocationField separator ',')* ')'\n\tbuf := &strings.Builder{}\n\tif md.Distinct {\n\t\tbuf.WriteString(\"distinct \")\n\t}\n\tvar fields []string\n\tif md.Line != 0 {\n\t\tfield := fmt.Sprintf(\"line: %d\", md.Line)\n\t\tfields = append(fields, field)\n\t}\n\tif md.Column != 0 {\n\t\tfield := fmt.Sprintf(\"column: %d\", md.Column)\n\t\tfields = append(fields, field)\n\t}\n\tfield := fmt.Sprintf(\"scope: %s\", md.Scope)\n\tfields = append(fields, field)\n\tif md.InlinedAt != nil {\n\t\tfield := fmt.Sprintf(\"inlinedAt: %s\", md.InlinedAt)\n\t\tfields = append(fields, field)\n\t}\n\tif md.IsImplicitCode {\n\t\tfield := fmt.Sprintf(\"isImplicitCode: %t\", md.IsImplicitCode)\n\t\tfields = append(fields, field)\n\t}\n\tfmt.Fprintf(buf, \"!DILocation(%s)\", strings.Join(fields, \", \"))\n\treturn buf.String()\n}", "title": "" }, { "docid": "493623c8fedd63fff46bd4ba28e15052", "score": "0.52553505", "text": "func (e E_OpenconfigIsis_Ipv4Srlg_Flags) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OpenconfigIsis_Ipv4Srlg_Flags\")\n}", "title": "" }, { "docid": "8123fa6154cdf0ec0f27684631177be6", "score": "0.5252074", "text": "func (s LoggingInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "be447f048c08d2e9ea3282d7fd57c9e2", "score": "0.5237263", "text": "func (s ResourcePermission) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "619f91c872b1bac6a6d507944a962fcc", "score": "0.5236905", "text": "func (o LunInfoType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "be447f048c08d2e9ea3282d7fd57c9e2", "score": "0.5235839", "text": "func (s ResourcePermission) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "be447f048c08d2e9ea3282d7fd57c9e2", "score": "0.5235839", "text": "func (s ResourcePermission) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "35f66ae60b049f38878674ac73c1d3a9", "score": "0.52302206", "text": "func (p *Permission) String() string {\n\treturn fmt.Sprintf(\"Permission{ID: %s, Description: %s}\", p.ID, p.Description)\n}", "title": "" }, { "docid": "605d3d1da0927f9986f216a94a9ff2d4", "score": "0.52272457", "text": "func (s TableFieldLinkConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "72ff94ce94ac9cf0927d71941835e512", "score": "0.52265364", "text": "func (s Link) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "34147b8cf497ba2a7015ef9c90bd7539", "score": "0.5217374", "text": "func (md *DINamespace) LLString() string {\n\t// '!DINamespace' '(' Fields=(DINamespaceField separator ',')* ')'\n\tbuf := &strings.Builder{}\n\tif md.Distinct {\n\t\tbuf.WriteString(\"distinct \")\n\t}\n\tvar fields []string\n\tfield := fmt.Sprintf(\"scope: %s\", md.Scope)\n\tfields = append(fields, field)\n\tif len(md.Name) > 0 {\n\t\tfield := fmt.Sprintf(\"name: %s\", quote(md.Name))\n\t\tfields = append(fields, field)\n\t}\n\tif md.ExportSymbols {\n\t\tfield := fmt.Sprintf(\"exportSymbols: %t\", md.ExportSymbols)\n\t\tfields = append(fields, field)\n\t}\n\tfmt.Fprintf(buf, \"!DINamespace(%s)\", strings.Join(fields, \", \"))\n\treturn buf.String()\n}", "title": "" }, { "docid": "fcf4a19f3f9338dfd53c8ecba967ed93", "score": "0.52135754", "text": "func (a *ACL) String() string {\n\ts := \"\"\n\ts += fmt.Sprintf(\"- management = %v\\n\", a.privileged)\n\tfor res, capTree := range a.capabilities {\n\t\ts += fmt.Sprintf(\"-- %s capabilities\\n\", res)\n\t\tcapTree.Walk(func(k string, v interface{}) bool {\n\t\t\ts += fmt.Sprintf(\" %s%s --> \", k, strings.Repeat(\" \", 18-len(k)))\n\t\t\tfor c := range v.(capMap) {\n\t\t\t\ts += fmt.Sprintf(\"%s \", c)\n\t\t\t}\n\t\t\ts += fmt.Sprintf(\"\\n\")\n\t\t\treturn false\n\t\t})\n\t}\n\treturn s\n}", "title": "" }, { "docid": "18e44e3d807b23a7d0e7f6b8147063c2", "score": "0.520933", "text": "func (l Lvl) String() string {\n\tswitch l {\n\tcase LvlDebug:\n\t\treturn \"dbug\"\n\tcase LvlInfo:\n\t\treturn \"info\"\n\tcase LvlWarn:\n\t\treturn \"warn\"\n\tcase LvlError:\n\t\treturn \"eror\"\n\tcase LvlCrit:\n\t\treturn \"crit\"\n\tdefault:\n\t\tpanic(\"bad level\")\n\t}\n}", "title": "" }, { "docid": "f29b23f1b131dd94a2fc5373e8a0a277", "score": "0.5205389", "text": "func (a Attribute) String() string {\n\treturn fmt.Sprintf(\"\\t%s %s `json:\\\"%s\\\" dynamo:\\\"%s\\\"`\", a.Ident.Pascalize(), a.GoType, a.Ident.Underscore(), a.Ident.Underscore())\n}", "title": "" }, { "docid": "eb1eb6ab129b30181c550bfc7ec5e2cd", "score": "0.5204045", "text": "func (e E_OpenconfigIsis_Topology_Attributes) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OpenconfigIsis_Topology_Attributes\")\n}", "title": "" }, { "docid": "304d30bd4edef4f0383dda999c640652", "score": "0.5198483", "text": "func (l *Lock) String() string {\n\treturn fmt.Sprintf(\n\t\t\"Lock { Type: %v, StartTS: %v, ForUpdateTS: %v, Primary: %v, UseAsyncCommit: %v }\",\n\t\tkvrpcpb.Op(l.Op).String(),\n\t\tl.StartTS,\n\t\tl.ForUpdateTS,\n\t\thex.EncodeToString(l.Primary),\n\t\tl.UseAsyncCommit,\n\t)\n}", "title": "" }, { "docid": "5deb3d3b5eb5870cb2730ec7d4182e87", "score": "0.51984036", "text": "func (o *Localencryptionkeyrequest) String() string {\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": "59b3976ea7d7124e465ea3c1d6b030a3", "score": "0.51868314", "text": "func (l *Log) String() string {\n\treturn Stringify(l)\n}", "title": "" }, { "docid": "7bdaee55e3b0cced2e183a6e24a99fdd", "score": "0.5186757", "text": "func (s ResourceSharePermissionDetail) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7231a2568218cf09163c3f8a98d291a5", "score": "0.5180451", "text": "func (s PrincipalPermissions) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d76a93a0f22702236585f78b00f4ef9f", "score": "0.51733094", "text": "func (s RowLevelPermissionTagConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c8c26c2617f63c1153af0cbfe5f43054", "score": "0.5169625", "text": "func (pi *PathDefault) String() string {\n\tstr := fmt.Sprintf(\"IPv4Path Source: %v, \", pi.GetSource())\n\tstr = str + fmt.Sprintf(\" NLRI: %s, \", pi.getPrefix())\n\tstr = str + fmt.Sprintf(\" nexthop: %s, \", pi.GetNexthop().String())\n\tstr = str + fmt.Sprintf(\" withdraw: %s, \", pi.IsWithdraw())\n\t//str = str + fmt.Sprintf(\" path attributes: %s, \", pi.getPathAttributeMap())\n\treturn str\n}", "title": "" }, { "docid": "87427b86298a5e27d135e8e42c39996d", "score": "0.516009", "text": "func (s SharedImagePermissions) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ab6c5911bb7f68f807fb8f52ae893893", "score": "0.5157038", "text": "func (l L) String() string {\n\tvar s string\n\tif l.note != \"\" {\n\t\ts = \"[\" + l.note + \"]: \"\n\t}\n\ts += fmt.Sprintf(\"%s:%d\", l.name, l.idx)\n\tif l.hasContent {\n\t\ts += \": \" + l.content\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "80019323ed60108eb35c23d60e481214", "score": "0.513805", "text": "func (tf TraceFlags) String() string {\n\treturn hex.EncodeToString([]byte{byte(tf)}[:])\n}", "title": "" }, { "docid": "370aa42e40b525e21718004397e1e3a4", "score": "0.51345646", "text": "func (s LabelingJobDataAttributes) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b80a0b1f7908fe683cddcfa6db11c214", "score": "0.5132919", "text": "func (s ProtectionConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7c3ab79b6d433bdb9fea795f10cd2b7b", "score": "0.51249695", "text": "func (s RowLevelPermissionTagRule) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c1da5f15d61406adbc66e6e129acee4a", "score": "0.5120193", "text": "func (f *loxFunction) String() string {\n\n\treturn fmt.Sprintf(\"<fun %s>\", f.decl.Name.Lexeme)\n}", "title": "" }, { "docid": "da7aa95f69267c87724e09dc695c6f32", "score": "0.51196665", "text": "func (l LogLevel) String() string {\n\tswitch l {\n\tcase LogLevelInfo:\n\t\treturn \"info\"\n\tcase LogLevelWarn:\n\t\treturn \"warn\"\n\tcase LogLevelError:\n\t\treturn \"error\"\n\tcase LogLevelAll:\n\t\treturn \"all\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"Level(%d)\", l)\n\t}\n}", "title": "" }, { "docid": "51271b616f3a22a21f0b3dfe6e86b772", "score": "0.51114845", "text": "func (l Link) String() string {\r\n\treturn fmt.Sprintf(\"Link: %s - Text: %s\", l.Link, l.Text)\r\n}", "title": "" }, { "docid": "629f895a4ad8ed7268a25ed5bd47369e", "score": "0.51021475", "text": "func (l Level) String() string {\n\tif name, ok := levelTags[l]; ok {\n\t\treturn name\n\t}\n\treturn \"[Unknown] \"\n}", "title": "" }, { "docid": "67c08f6274e53220e188893ed0fe09a6", "score": "0.5099172", "text": "func (l LogLevel) String() string {\n\tif int(l) < len(logLevelNames) {\n\t\treturn logLevelNames[l]\n\t}\n\treturn \"LogLevel\" + strconv.Itoa(int(l))\n}", "title": "" }, { "docid": "74125699a94323b1b1caeef94fda890f", "score": "0.50866777", "text": "func (e E_OpenconfigIsis_PrefixSid_Flags) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OpenconfigIsis_PrefixSid_Flags\")\n}", "title": "" }, { "docid": "001e235812c5b5db13d90e32baa9cd6d", "score": "0.5081486", "text": "func (s UpdateLinkAttributesInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9514da584231d7abcd10c716c8b5b75b", "score": "0.5074434", "text": "func (e E_OpenconfigIsis_AdjacencySid_Flags) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OpenconfigIsis_AdjacencySid_Flags\")\n}", "title": "" }, { "docid": "67bfde5189c30e4706b10cc4e6223899", "score": "0.5068509", "text": "func (s SslProperties) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "67bfde5189c30e4706b10cc4e6223899", "score": "0.5068509", "text": "func (s SslProperties) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "96105b4f05985c7feef5f6797137f581", "score": "0.50657964", "text": "func (a AuthorizationInfo) String() string {\n\treturn \"authorizationinfo(roles(\" + a.Roles() + \") allpermissions(\" + a.Permissions() + \"))\"\n}", "title": "" }, { "docid": "1b2be6746d28da027a937e37b4c542e7", "score": "0.5062844", "text": "func (me TxsdDbCommonAttributesDir) String() string { return xsdt.Token(me).String() }", "title": "" }, { "docid": "ab2da4956b6c31e183a76bd33ac57c09", "score": "0.50593483", "text": "func (f Flags) String() string {\n\tswitch f {\n\tcase SigningRequired:\n\t\treturn \"SigningRequired\"\n\tcase SigningEnabled:\n\t\treturn \"SigningEnabled\"\n\tdefault:\n\t\treturn \"SecMode \" + strconv.Itoa(int(f))\n\t}\n}", "title": "" }, { "docid": "62cc8f003efe72f2151e1d790aa07360", "score": "0.5054573", "text": "func (md *DILocalVariable) LLString() string {\n\t// '!DILocalVariable' '(' Fields=(DILocalVariableField separator ',')* ')'\n\tbuf := &strings.Builder{}\n\tif md.Distinct {\n\t\tbuf.WriteString(\"distinct \")\n\t}\n\tvar fields []string\n\t// Note, to match Clang output, the output order is changed to output name\n\t// before scope.\n\tif len(md.Name) > 0 {\n\t\tfield := fmt.Sprintf(\"name: %s\", quote(md.Name))\n\t\tfields = append(fields, field)\n\t}\n\tif md.Arg != 0 {\n\t\tfield := fmt.Sprintf(\"arg: %d\", md.Arg)\n\t\tfields = append(fields, field)\n\t}\n\tfield := fmt.Sprintf(\"scope: %s\", md.Scope)\n\tfields = append(fields, field)\n\tif md.File != nil {\n\t\tfield := fmt.Sprintf(\"file: %s\", md.File)\n\t\tfields = append(fields, field)\n\t}\n\tif md.Line != 0 {\n\t\tfield := fmt.Sprintf(\"line: %d\", md.Line)\n\t\tfields = append(fields, field)\n\t}\n\tif md.Type != nil {\n\t\tfield := fmt.Sprintf(\"type: %s\", md.Type)\n\t\tfields = append(fields, field)\n\t}\n\tif md.Flags != 0 {\n\t\tfield = fmt.Sprintf(\"flags: %s\", diFlagsString(md.Flags))\n\t\tfields = append(fields, field)\n\t}\n\tif md.Align != 0 {\n\t\tfield := fmt.Sprintf(\"align: %d\", md.Align)\n\t\tfields = append(fields, field)\n\t}\n\tif md.Annotations != nil {\n\t\tfield := fmt.Sprintf(\"annotations: %s\", md.Annotations)\n\t\tfields = append(fields, field)\n\t}\n\tfmt.Fprintf(buf, \"!DILocalVariable(%s)\", strings.Join(fields, \", \"))\n\treturn buf.String()\n}", "title": "" }, { "docid": "251ab300d98b426353afee41298b494f", "score": "0.50520253", "text": "func (s LinkSharingConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d78e4165f654e8e5bb717619a3929672", "score": "0.50504315", "text": "func (k TLSAssetKey) String() string {\n\treturn fmt.Sprintf(\"%s_%s_%s_%s\", k.from, k.ns, k.name, k.key)\n}", "title": "" }, { "docid": "2250dc928b1422ed45b66393f26d516a", "score": "0.5049653", "text": "func (s BatchPermissionsRequestEntry) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a95bee86aa744522b6ff175668afe4a4", "score": "0.50489193", "text": "func (s Trust) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "423917a75780907675673ff6bcbeb27e", "score": "0.504884", "text": "func (s FirewallPolicyMetadata) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ac8aa549f5236c21bac6f80c4bb5766b", "score": "0.50469166", "text": "func (u *UserIdentityLink) String() string {\n\treturn Stringify(u)\n}", "title": "" }, { "docid": "7c4519a0d432201459db34e3480c8070", "score": "0.5041964", "text": "func (s ConditionalForwarder) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a9acb66cedaa41569b4afe6ccf8f9abb", "score": "0.5038182", "text": "func (s PrincipalResourcePermissions) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9cc43adc95fac07186f9c0d8656c547f", "score": "0.5031786", "text": "func (c CommonNetworkRelativeLink) String() string {\n\tvar sb, flags strings.Builder\n\n\t// Append all flags.\n\tfor _, fl := range c.CommonNetworkRelativeLinkFlagsStr {\n\t\tflags.WriteString(fl)\n\t\tflags.WriteString(\"\\n\")\n\t}\n\n\ttable := tablewriter.NewWriter(&sb)\n\ttable.SetAlignment(tablewriter.ALIGN_LEFT)\n\ttable.SetRowLine(true)\n\n\ttable.SetHeader([]string{\"CommonNetworkRelativeLink\", \"Value\"})\n\n\ttable.Append([]string{\"Size\", uint32TableStr(c.Size)})\n\ttable.Append([]string{\"Flags\", flags.String()})\n\ttable.Append([]string{\"NetworkProviderType\", c.NetworkProviderType})\n\n\t// Only add rows that exist (their offset is not zero).\n\tif c.NetNameOffset != 0 {\n\t\ttable.Append([]string{\"NetNameOffset\", uint32TableStr(c.NetNameOffset)})\n\t\ttable.Append([]string{\"NetName\", c.NetName})\n\t}\n\n\tif c.DeviceNameOffset != 0 {\n\t\ttable.Append([]string{\"DeviceNameOffset\", uint32TableStr(c.DeviceNameOffset)})\n\t\ttable.Append([]string{\"DeviceName\", c.DeviceName})\n\t}\n\n\tif c.NetNameOffsetUnicode != 0 {\n\t\ttable.Append([]string{\"NetNameOffsetUnicode\", uint32TableStr(c.NetNameOffsetUnicode)})\n\t\ttable.Append([]string{\"NetNameUnicode\", c.NetNameUnicode})\n\t}\n\n\tif c.DeviceNameOffsetUnicode != 0 {\n\t\ttable.Append([]string{\"DeviceNameOffsetUnicode\", uint32TableStr(c.DeviceNameOffsetUnicode)})\n\t\ttable.Append([]string{\"DeviceNameUnicode\", c.DeviceNameUnicode})\n\t}\n\n\ttable.Render()\n\treturn sb.String()\n}", "title": "" }, { "docid": "9fea8a1edd3f405dac1d6243d23ce830", "score": "0.5030856", "text": "func (p *policy) String() string {\n\treturn fmt.Sprintf(policyDocument,\n\t\tp.Expiration,\n\t\tp.Bucket,\n\t\tp.Key,\n\t\tp.O.MaxFileSize,\n\t\tp.Credential,\n\t\tp.Date,\n\t)\n}", "title": "" }, { "docid": "23e18d11b3f9c195fda61ab5a0bb0ae9", "score": "0.50288165", "text": "func (l *Link) String() string {\n\tlink := fmt.Sprintf(`<%s>`, l.URI)\n\te := reflect.ValueOf(l).Elem()\n\tfor i := 1; i < e.NumField(); i++ {\n\t\tn, v := e.Type().Field(i).Name, e.Field(i).String()\n\t\tif v == \"\" {\n\t\t\tif n != \"Rel\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tv = \"alternate\"\n\t\t}\n\t\tlink += fmt.Sprintf(`; %s=%q`, strings.ToLower(n), v)\n\t}\n\treturn link\n}", "title": "" }, { "docid": "fdf676d152324f052cc9a4a3603515a0", "score": "0.5015332", "text": "func (l LogLevel) String() string {\n\tswitch l {\n\tcase DebugLevel:\n\t\treturn \"DEBUG\"\n\tcase InfoLevel:\n\t\treturn \"INFO\"\n\tcase WarnLevel:\n\t\treturn \"WARN\"\n\tcase ErrorLevel:\n\t\treturn \"ERROR\"\n\tcase PanicLevel:\n\t\treturn \"PANIC\"\n\tcase FatalLevel:\n\t\treturn \"FATAL\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"Level(%d)\", l)\n\t}\n}", "title": "" }, { "docid": "bf8a3975aa6d849eb82dd767bd360521", "score": "0.50101906", "text": "func (md *DILexicalBlockFile) LLString() string {\n\t// '!DILexicalBlockFile' '(' Fields=(DILexicalBlockFileField separator ',')* ')'\n\tbuf := &strings.Builder{}\n\tif md.Distinct {\n\t\tbuf.WriteString(\"distinct \")\n\t}\n\tvar fields []string\n\tfield := fmt.Sprintf(\"scope: %s\", md.Scope)\n\tfields = append(fields, field)\n\tif md.File != nil {\n\t\tfield := fmt.Sprintf(\"file: %s\", md.File)\n\t\tfields = append(fields, field)\n\t}\n\tfield = fmt.Sprintf(\"discriminator: %d\", md.Discriminator)\n\tfields = append(fields, field)\n\tfmt.Fprintf(buf, \"!DILexicalBlockFile(%s)\", strings.Join(fields, \", \"))\n\treturn buf.String()\n}", "title": "" }, { "docid": "bb2aeabc911e1f2a580ea0662ae4e6c7", "score": "0.5010057", "text": "func (s AddPermissionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0f790b99da6e699f5b0dc61c7867715e", "score": "0.50097495", "text": "func (s ImagePermissions) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5adb80c76466b6e58e94a7b22bd78791", "score": "0.5008107", "text": "func (s FirewallMetadata) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ca2d95dde3567b136bbd42e1cf67e3d5", "score": "0.5003621", "text": "func (this fixedHeader) String() string {\n\treturn fmt.Sprintf(\"Packet type: %s\\nFlags: %08b\\nRemaining Length: %d bytes\\n\", this.mtype.Name(), this.flags, this.remlen)\n}", "title": "" }, { "docid": "433d2940853875a14dde03f8ae84b540", "score": "0.5002238", "text": "func (w *wrapperAttr) DebugString() string {\n\treturn w.debugString()\n}", "title": "" }, { "docid": "3e1cd749bd5f3aba726bab8d302f81c9", "score": "0.49996603", "text": "func (ipv4vpnp *IPv4VPNPath) String() string {\n\tstr := fmt.Sprintf(\"IPv4VPNPath Source: %v, \", ipv4vpnp.GetSource())\n\tstr = str + fmt.Sprintf(\" NLRI: %s, \", ipv4vpnp.getPrefix())\n\tstr = str + fmt.Sprintf(\" nexthop: %s, \", ipv4vpnp.GetNexthop().String())\n\tstr = str + fmt.Sprintf(\" withdraw: %s, \", ipv4vpnp.IsWithdraw())\n\t//str = str + fmt.Sprintf(\" path attributes: %s, \", ipv4vpnp.getPathAttributeMap())\n\treturn str\n}", "title": "" }, { "docid": "7d2067591fd525e24727c697b0b845c5", "score": "0.4996956", "text": "func (s AttachmentInformation) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e40cb1b9575d341785d41fb6139e8c0d", "score": "0.49908754", "text": "func (s AccessLogSettings) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6100f1e19e334ec8dfa26bdb6e3ebd2e", "score": "0.49896267", "text": "func (s Attribute) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6100f1e19e334ec8dfa26bdb6e3ebd2e", "score": "0.49896267", "text": "func (s Attribute) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b62301df43828bfd97e0b06f74cc2d31", "score": "0.49838603", "text": "func (s GetExternalDataViewAccessDetailsOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f4ac4af70e13404856592570d81ede9f", "score": "0.49777403", "text": "func (md *DILocation) String() string {\n\treturn md.Ident()\n}", "title": "" }, { "docid": "e8611699edc8ccc44f20a7e8c1437188", "score": "0.49771166", "text": "func (n *SplitAndSizeRestrictions) String() string {\n\treturn fmt.Sprintf(\"SDF.SplitAndSizeRestrictions[%v] Out:%v\", path.Base(n.Fn.Name()), IDs(n.Out))\n}", "title": "" }, { "docid": "d137ab3ac0c9cebc9d078f677c5eeeed", "score": "0.49740523", "text": "func (k Key) String() string {\n\tfp := \"\"\n\tif len(k.Fingerprint) > 24 {\n\t\tfp = k.Fingerprint[24:]\n\t}\n\n\tout := fmt.Sprintf(\"%s %dD/0x%s %s\", k.KeyType, k.KeyLength, fp, k.CreationDate.Format(\"2006-01-02\"))\n\tif !k.ExpirationDate.IsZero() {\n\t\tout += fmt.Sprintf(\" [expires: %s]\", k.ExpirationDate.Format(\"2006-01-02\"))\n\t}\n\n\tout += \"\\n Key fingerprint = \" + k.Fingerprint\n\tfor _, id := range k.Identities {\n\t\tout += fmt.Sprintf(\"\\n\" + id.String())\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "868f6b5493e4d0ea77f1e95017a98fdc", "score": "0.49726105", "text": "func (s DomainJoinInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
d0724f29596846cb6619c620564f366d
CollectBillingInfoData collects billing information for linux
[ { "docid": "7f260eadc53338f0996d3056a4731f09", "score": "0.80629605", "text": "func CollectBillingInfoData(context context.T) (data []model.BillingInfoData) {\n\n\tlog := context.Log()\n\n\tvar output []byte\n\tvar err error\n\tcmd := curlCmd\n\targs := []string{curlCmdArgs}\n\n\tlog.Infof(\"Executing command: %v %v\", cmd, args)\n\tif output, err = cmdExecutor(cmd, args...); err != nil {\n\t\tlog.Errorf(\"Failed to execute command : %v %v; error: %v\", cmd, args, err.Error())\n\t\tlog.Debugf(\"Command Stderr: %v\", string(output))\n\t\treturn\n\t}\n\n\tlog.Infof(\"Parsing output %v\", string(output))\n\tr := parseCurlOutput(context, string(output))\n\tlog.Infof(\"Parsed BillingInfo output %v\", r)\n\treturn r\n}", "title": "" } ]
[ { "docid": "b656b4d79b2e8f59c7d03f7fdd92297d", "score": "0.5321174", "text": "func collectPlatformDependentInstanceData() (appData []model.InstanceDetailedInformation) {\n\tlog.GetLogger().Debugf(\"Getting %v data\", GathererName)\n\tvar instanceDetailedInfo model.InstanceDetailedInformation\n\terr1 := collectDataFromPowershell(CPUInfoScript, &instanceDetailedInfo)\n\terr2 := collectDataFromPowershell(OsInfoScript, &instanceDetailedInfo)\n\tif err1 != nil && err2 != nil {\n\t\t// if both commands fail, return no data\n\t\treturn\n\t}\n\tappData = append(appData, instanceDetailedInfo)\n\tstr, _ := json.Marshal(appData)\n\tlog.GetLogger().Debugf(\"%v gathered: %v\", GathererName, string(str))\n\treturn\n}", "title": "" }, { "docid": "1e9a063ca17abf598375a2fa715ed23e", "score": "0.51968676", "text": "func collectPlatformDependentApplicationData(context context.T) (appData []model.ApplicationData) {\n\n\tvar err error\n\tlog := context.Log()\n\n\tcmd := systemProfilerCmd\n\targs := []string{xmlFormatArg, applicationDataArg}\n\n\tif appData, err = getApplicationData(context, cmd, args); err != nil {\n\t\tlog.Info(\"system_profiler command failed!\")\n\t}\n\n\tpkgData, err := getInstalledPackages(context, pkgutilCmd)\n\tif err == nil {\n\t\tvar i int\n\t\tfor i = 0; i < len(pkgData); i++ {\n\t\t\tappData = append(appData, pkgData[i])\n\t\t}\n\t} else {\n\t\tlog.Info(\"pkgutil command failed!\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "bf82139426d4ae181f26e9fa10dcdf1b", "score": "0.51147693", "text": "func main() {\n\tlog.SetOutput(os.Stderr)\n\tctx := context.Background()\n\n\t// connect to DB\n\tdb := housedb.Connect(ctx)\n\tdefer db.Close()\n\n\tdata := make(map[string]map[string]interface{})\n\tfor _, cong := range congresses.GetAll() {\n\t\tstats := make(map[string]interface{})\n\t\tif nbrReps := db.NbrReps(ctx, cong.Number); nbrReps > 10 { // weed out implausible numbers\n\t\t\tstats[\"nbrReps\"] = nbrReps\n\t\t}\n\t\tif medianVoters, ok := db.MedianVotersPerRegDistrict(ctx, cong.Number); ok {\n\t\t\tstats[\"medianVoters\"] = medianVoters\n\t\t}\n\t\tif minVoters, ok := db.MinVotersPerRegDistrict(ctx, cong.Number); ok {\n\t\t\tstats[\"minVoters\"] = minVoters\n\t\t}\n\t\tif maxVoters, ok := db.MaxVotersPerRegDistrict(ctx, cong.Number); ok {\n\t\t\tstats[\"maxVoters\"] = maxVoters\n\t\t}\n\t\tif len(stats) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tdata[fmt.Sprintf(\"%v\", cong.Number)] = stats\n\t}\n\n\tos.Stdout.WriteString(\"/* Generated by compute-stats */\\nconst CongressStats = \")\n\tenc := json.NewEncoder(os.Stdout)\n\tif err := enc.Encode(data); err != nil {\n\t\tpanic(err)\n\t}\n\tos.Stdout.WriteString(\";\\nexport {CongressStats};\\n\")\n}", "title": "" }, { "docid": "9995c974859207abe84f11a8bc647f66", "score": "0.49297965", "text": "func generatePaymentDetails(db *bolt.DB, poolFeeAddr dcrutil.Address,\n\teligiblePmts []*PaymentBundle) (map[string]dcrutil.Amount, *dcrutil.Amount, error) {\n\tvar targetAmt dcrutil.Amount\n\tpmts := make(map[string]dcrutil.Amount)\n\tfor _, p := range eligiblePmts {\n\t\tif p.Account == poolFeesK {\n\t\t\tbundleAmt := p.Total()\n\t\t\tpmts[poolFeeAddr.String()] = bundleAmt\n\t\t\ttargetAmt += bundleAmt\n\t\t\tcontinue\n\t\t}\n\t\tacc, err := FetchAccount(db, []byte(p.Account))\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tbundleAmt := p.Total()\n\t\tpmts[acc.Address] = bundleAmt\n\t\ttargetAmt += bundleAmt\n\t}\n\treturn pmts, &targetAmt, nil\n}", "title": "" }, { "docid": "9b03c080ce3223950070e7f87023a0dc", "score": "0.49193463", "text": "func (c *Chain) checkBillingRequest(br *pt.BillingRequest) (err error) {\n\t// period of sqlchain;\n\t// TODO(lambda): get and check period and miner list of specific sqlchain\n\n\terr = br.VerifySignatures()\n\treturn\n}", "title": "" }, { "docid": "e903a1d2ca01f39f0dda5aad29e23154", "score": "0.4909742", "text": "func GetBillingDataLocation() string {\n\tbillingDirName := filepath.Join(\".\", \"billing\")\n\ts, _ := filepath.Abs(billingDirName)\n\treturn s\n}", "title": "" }, { "docid": "5b0127fc9afae0efb6ab157bf520e31e", "score": "0.49052918", "text": "func (r Network_Bandwidth_Version1_Allotment) GetBillingItem() (resp datatypes.Billing_Item, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Bandwidth_Version1_Allotment\", \"getBillingItem\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "1ad3130a44cdc6d4d565733f06e2d8ed", "score": "0.48914298", "text": "func getCrbInfo() (string, string, string, float64, float64, float64, float64, float64, float64, float64, float64) {\n url := \"https://ec2-13-114-249-134.ap-northeast-1.compute.amazonaws.com/api/data_reference/trakingdata_get\"\n\n\t\ttransport := &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\t}\n\t\t\n\t\tclient := &http.Client{\n\t\t\tTransport: transport,\n\t\t}\n\t\t\n\t\treq, err := http.NewRequest(\"GET\", url, nil)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t//取得範囲の指定\n\t\t//1. 直近10秒間\n\t\t_timestamp_to := time.Now().In(jst).Format(\"2006/01/02 15:04:05\")\n\t\t_timestamp_from := time.Now().In(jst).Add(time.Duration(-10) * time.Second).Format(\"2006/01/02 15:04:05\")\n\t\t//2. 全量取得(するけれども最初の1エントリのみ表示)\n\t\t//_timestamp_to := time.Now().Format(\"2006/01/02 15:04:05\")\n\t\t//_timestamp_from := \"2020/03/04 00:00:00\"\n\t\t\n\t\t//確認用\n\t\t//fmt.Println(_timestamp_from)\n\t\t//fmt.Println(_timestamp_to)\n\n\t\t//UTLクエリパラメータの設定\n\t\tparams := req.URL.Query()\n\t\tparams.Add(\"crb_id\",\"0123456789ABCDEFFEDA\")\n\t\tparams.Add(\"startDate\", _timestamp_from)\n\t\tparams.Add(\"endDate\", _timestamp_to)\n\t\treq.URL.RawQuery = params.Encode()\n\n\t\t//Basic認証\n\t\treq.SetBasicAuth(\"crb_iot\", \"D2018_0256\")\n\n\t\t//fmt.Println(req.URL.String())\n\t\tres, err_http := client.Do(req)\n\t\t//fmt.Println(res)\n\n\t\t//関数が複数の戻り値を返せるので、通常応答とエラーの場合の応答を2つ書いている\n\t\t//res, err_http := http.Get(url)\n\t\t//err_httpがnilでない場合、つまりエラーが発生している場合の処理\n if err_http != nil {\n\t\t\t\t//panicとはプログラムの継続的な実行が難しく、どうしよもなくなった時にプログラムを強制的に終了させるために発生するエラー\n panic(err_http.Error())\n\t\t}\n\n\t\t//引数の io.Reader から内容を全て読み込んでバイトスライスとして返す\n body, _ := ioutil.ReadAll(res.Body)\n\t\tfmt.Println(\"1 \" + string(body))\n\n\t\t//interface{}型 -> どんな型も格納できる特殊な型・型チェックや型変換などに使える\n var tempData interface{}\n err_json := json.Unmarshal(body, &tempData)\n if err_json != nil {\n panic(err_json.Error())\n }\n\n\t\tvicId, _ := dproxy.New(tempData).A(0).M(\"crbId\").String()\n\t\tserial_no, _ := dproxy.New(tempData).A(0).M(\"serial_no\").String()\n\t\ttimestamp, _ := dproxy.New(tempData).A(0).M(\"timestamp\").String() //\"timestamp\": \"2020/03/04 13:52:22\",\n\t\ttemperature1, _ := dproxy.New(tempData).A(0).M(\"temperature1\").String()\n\t\ttemperature2, _ := dproxy.New(tempData).A(0).M(\"temperature2\").String()\n\t\ttemperature3, _ := dproxy.New(tempData).A(0).M(\"temperature3\").String()\n\t\thumidity, _ := dproxy.New(tempData).A(0).M(\"humidity\").Float64()\n\t\tco2, _ := dproxy.New(tempData).A(0).M(\"co2\").Float64()\n\t\tx, _ := dproxy.New(tempData).A(0).M(\"x\").Float64()\n\t\ty, _ := dproxy.New(tempData).A(0).M(\"y\").Float64()\n\t\tz, _ := dproxy.New(tempData).A(0).M(\"z\").Float64()\n\t\t//fmt.Println(humidity, co2, x, y, z)\n\n\t\tvar _temperature1, _ = strconv.ParseFloat(temperature1, 64)\n\t\tvar _temperature2, _ = strconv.ParseFloat(temperature2, 64)\n\t\tvar _temperature3, _ = strconv.ParseFloat(temperature3, 64)\n\t\t//var _humidity, _ = strconv.ParseFloat(humidity, 64)\n\t\t//var _co2, _ = strconv.ParseFloat(co2, 64)\n\t\t//var _x, _ = strconv.ParseFloat(x, 64)\n\t\t//var _y, _ = strconv.ParseFloat(y, 64)\n\t\t//var _z, _ = strconv.ParseFloat(z, 64)\n\t\t//fmt.Println(humidity, co2, _x, _y, _z)\n\t\t//\n\t\t//minCelsius, _ := dproxy.New(tempData).M(\"forecasts\").A(1).M(\"temperature\").M(\"min\").M(\"celsius\").String()\n //var _fmic, _ = strconv.ParseFloat(minCelsius, 64)\n return vicId, serial_no, timestamp, _temperature1, _temperature2, _temperature3, humidity, co2, x, y, z\n}", "title": "" }, { "docid": "0b19363455700842ec536916a2889668", "score": "0.48831508", "text": "func getSystemData() map[string]string {\n\thost, err := os.Hostname()\n\tif err != nil {\n\t\thost = \"\"\n\t}\n\tmemstats := &runtime.MemStats{}\n\truntime.ReadMemStats(memstats)\n\tmem := fmt.Sprintf(\"Used: %s | Allocated: %s | Used-Heap: %s | Allocated-Heap: %s\",\n\t\thumanize.Bytes(memstats.Alloc),\n\t\thumanize.Bytes(memstats.TotalAlloc),\n\t\thumanize.Bytes(memstats.HeapAlloc),\n\t\thumanize.Bytes(memstats.HeapSys))\n\tplatform := fmt.Sprintf(\"Host: %s | OS: %s | Arch: %s\",\n\t\thost,\n\t\truntime.GOOS,\n\t\truntime.GOARCH)\n\tgoruntime := fmt.Sprintf(\"Version: %s | CPUs: %s\", runtime.Version(), strconv.Itoa(runtime.NumCPU()))\n\treturn map[string]string{\n\t\t\"PLATFORM\": platform,\n\t\t\"RUNTIME\": goruntime,\n\t\t\"MEM\": mem,\n\t}\n}", "title": "" }, { "docid": "a02e2a7ba4fad5f59de79fd95f43a5cc", "score": "0.48792797", "text": "func CollectData() (Data, error) {\n\td := make(Data)\n\td[\"modules\"] = make(map[string]interface{})\n\tmodules := d[\"modules\"].(map[string]interface{})\n\n\tfor k, v := range unameArgs {\n\t\tout, err := exec.Command(\"uname\", v).Output()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ts := strings.TrimSpace(string(out))\n\t\td[k] = s\n\t\tout, err = exec.Command(\"env\", \"lsmod\").Output()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlines := strings.Split(string(out), \"\\n\")\n\n\t\t// lines[0] contains column headings.\n\t\tfor _, line := range lines[1:] {\n\t\t\tl := strings.Fields(line)\n\t\t\tif len(l) >= 3 {\n\t\t\t\tmodules[l[0]] = map[string]string{\n\t\t\t\t\t\"size\": l[1],\n\t\t\t\t\t\"refcount\": l[2],\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\treturn d, nil\n}", "title": "" }, { "docid": "98cc70dbfe508e695d3c95e592d15ec9", "score": "0.4862434", "text": "func (t *SimpleChaincode) get_package_details(stub shim.ChaincodeStubInterface, v CargoPack, caller string) ([]byte, error) {\r\n\tfmt.Printf(\"Nihal Copy of chaincode running!\")\r\n\tbytes, err := json.Marshal(v)\r\n\t\r\n\tif err == nil { \r\n\t\r\n\t\treturn bytes, nil \r\n\t\t\r\n\t}\r\n\treturn nil, errors.New(\"GET_PKG_DETAILS: Invalid package object\") \r\n\t\r\n\t\r\n\t//if \t\tv.Owner\t== caller\t\t{\r\n\t//\t\t\t\r\n\t//\t\t\t\treturn bytes, nil\t\t\r\n\t//} else {\r\n\t//\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn nil, errors.New(\"Permission Denied6\")\t\r\n\t//}\r\n\r\n}", "title": "" }, { "docid": "1b012b8454f3bd6dacb09bee84060d75", "score": "0.482964", "text": "func getSystemData() map[string]string {\n\thost, e := os.Hostname()\n\tfatalIf(probe.NewError(e), \"Unable to determine the hostname.\")\n\n\tmemstats := &runtime.MemStats{}\n\truntime.ReadMemStats(memstats)\n\tmem := fmt.Sprintf(\"Used: %s | Allocated: %s | UsedHeap: %s | AllocatedHeap: %s\",\n\t\tpb.Format(int64(memstats.Alloc)).To(pb.U_BYTES),\n\t\tpb.Format(int64(memstats.TotalAlloc)).To(pb.U_BYTES),\n\t\tpb.Format(int64(memstats.HeapAlloc)).To(pb.U_BYTES),\n\t\tpb.Format(int64(memstats.HeapSys)).To(pb.U_BYTES))\n\tplatform := fmt.Sprintf(\"Host: %s | OS: %s | Arch: %s\", host, runtime.GOOS, runtime.GOARCH)\n\tgoruntime := fmt.Sprintf(\"Version: %s | CPUs: %s\", runtime.Version(), strconv.Itoa(runtime.NumCPU()))\n\treturn map[string]string{\n\t\t\"PLATFORM\": platform,\n\t\t\"RUNTIME\": goruntime,\n\t\t\"MEM\": mem,\n\t}\n}", "title": "" }, { "docid": "31d906c266b1544b6981935ba1147c9b", "score": "0.48253033", "text": "func GetPerfData() {\n\tfor {\n\t\tvar m runtime.MemStats\n\t\truntime.ReadMemStats(&m)\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"memory_alloc\": bToMB(m.Alloc),\n\t\t\t\"memory_total\": bToMB(m.TotalAlloc),\n\t\t\t\"memory_heap\": bToMB(m.HeapAlloc),\n\t\t\t\"memory_objects\": m.HeapObjects,\n\t\t\t\"memory_sys\": bToMB(m.Sys),\n\t\t\t\"memory_num_gc\": m.NumGC,\n\t\t}).Info(\"Memory Statistics\")\n\t\ttime.Sleep(time.Second * 5)\n\t}\n}", "title": "" }, { "docid": "e8f3c0d10ec7ff64d0b42b3f59a35a60", "score": "0.4793033", "text": "func NewBillingInfoRequest(firstName string, lastName string, email string, address string, city string, zip string, countryCode string) *BillingInfoRequest {\n\tthis := BillingInfoRequest{}\n\tthis.FirstName = firstName\n\tthis.LastName = lastName\n\tthis.Email = email\n\tthis.Address = address\n\tthis.City = city\n\tthis.Zip = zip\n\tthis.CountryCode = countryCode\n\treturn &this\n}", "title": "" }, { "docid": "90b8afc62f72de4d24a27ceb4e675fac", "score": "0.47643816", "text": "func (_OffchainAggregator *OffchainAggregatorCaller) GetBilling(opts *bind.CallOpts) (struct {\n\tMaximumGasPrice uint32\n\tReasonableGasPrice uint32\n\tMicroLinkPerEth uint32\n\tLinkGweiPerObservation uint32\n\tLinkGweiPerTransmission uint32\n}, error) {\n\tvar out []interface{}\n\terr := _OffchainAggregator.contract.Call(opts, &out, \"getBilling\")\n\n\toutstruct := new(struct {\n\t\tMaximumGasPrice uint32\n\t\tReasonableGasPrice uint32\n\t\tMicroLinkPerEth uint32\n\t\tLinkGweiPerObservation uint32\n\t\tLinkGweiPerTransmission uint32\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.MaximumGasPrice = *abi.ConvertType(out[0], new(uint32)).(*uint32)\n\toutstruct.ReasonableGasPrice = *abi.ConvertType(out[1], new(uint32)).(*uint32)\n\toutstruct.MicroLinkPerEth = *abi.ConvertType(out[2], new(uint32)).(*uint32)\n\toutstruct.LinkGweiPerObservation = *abi.ConvertType(out[3], new(uint32)).(*uint32)\n\toutstruct.LinkGweiPerTransmission = *abi.ConvertType(out[4], new(uint32)).(*uint32)\n\n\treturn *outstruct, err\n\n}", "title": "" }, { "docid": "38e4d714e53997c3bbbb190df4fb667a", "score": "0.47593778", "text": "func consoleBillingProcessHandler(w http.ResponseWriter, r *http.Request) (int, error) {\n\tvars := mux.Vars(r)\n\n\t// Check if logged in\n\t// TODO this should be a part of middleware (MustBeUser)\n\tsession := session.FromContext(r.Context())\n\tif !session.LoggedIn() {\n\t\thttp.Redirect(w, r, \"/\", http.StatusFound)\n\t\treturn 0, nil\n\t}\n\n\t// TODO maybe this should be handled in MustBeUser handler\n\tuser, err := um.GetUser(session.UserID)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\tr.ParseForm()\n\n\t// Ensure customer does not have any current subscriptions until we have the\n\t// ability to prorata subscriptions.\n\tsubs, err := user.StripeSubscriptions()\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\tfor _, sub := range subs {\n\t\tif sub.CancelledAt.IsZero() {\n\t\t\t// TODO flash message\n\t\t\treturn http.StatusBadRequest, errors.New(\"active subscription already exists\")\n\t\t}\n\t}\n\n\terr = user.ProcessStripePayment(r.Form.Get(\"stripeToken\"), vars[\"planID\"])\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, errors.Wrap(err, \"could not process stripe payment\")\n\t}\n\n\tuser.Logger.Infof(\"processed stripe subscription on plan %v\", vars[\"planID\"])\n\n\thttp.Redirect(w, r, \"/console/?success=1\", http.StatusFound)\n\treturn 0, nil\n}", "title": "" }, { "docid": "75800e1a6f40536aa441ecc1910baeb9", "score": "0.4758107", "text": "func (r Network_Tunnel_Module_Context) GetBillingItem() (resp datatypes.Billing_Item, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Tunnel_Module_Context\", \"getBillingItem\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ed9cac6839a070b2a657e4ab7e9d16d1", "score": "0.47347248", "text": "func (app *Application) CollectData() (errors []error) {\n\tapplog.Infof(\"collect data\")\n\n\terrors = make([]error, 0)\n\tfor name, prov := range providers {\n\n\t\terr := prov.CollectData()\n\n\t\tif err != nil {\n\t\t\terrors = append(errors,\n\t\t\t\tfmt.Errorf(\"provider %s :: %s\", name, err.Error()))\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d2ccd8037903e50ffbddf579477f8f44", "score": "0.4724198", "text": "func requestData(param string) (*BuffInfo, error) {\n\tresp, err := http.Get(SourceURL + param)\n\tcheckErr(err)\n\tdefer resp.Body.Close()\n\n\tresult, err := ioutil.ReadAll(resp.Body)\n\tcheckErr(err)\n\n\tvar data BuffInfo\n\tjson.Unmarshal(result, &(data))\n\n\treturn &data, nil\n}", "title": "" }, { "docid": "4f1c51d7dec8623fd27a9d5ffcf14b8b", "score": "0.47010016", "text": "func (e *Exporter) gatherData() error {\n\tvar err error\n\n\terr = e.getStatus()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = e.getMemPoolDepth()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = e.getPeers()\n\tif err != nil {\n\t\treturn err\n\t}\n\tblocks, err := e.getBlocks()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = e.getTxBuckets(blocks.BlockMetas)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = e.getBlockTimeBuckets(blocks.BlockMetas)\n\tif err != nil {\n\t\treturn err\n\t}\n\te.getAccountStats()\n\n\treturn nil\n}", "title": "" }, { "docid": "bf10d2a1a618e3d82b037ea82451a97e", "score": "0.46941188", "text": "func (c *Client) ViewBilling(ctx context.Context, params *ViewBillingInput, optFns ...func(*Options)) (*ViewBillingOutput, error) {\n\tif params == nil {\n\t\tparams = &ViewBillingInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ViewBilling\", params, optFns, c.addOperationViewBillingMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ViewBillingOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "0926a93d378d269e64090291b9dedfa9", "score": "0.46801436", "text": "func collectPlatformDependentApplicationData(context context.T) (appData []model.ApplicationData) {\n\n\tvar err error\n\tvar cmd string\n\tvar args []string\n\n\tlog := context.Log()\n\n\tplatformName, _ := platformInfoProvider(log)\n\tfor _, fileSupportedPlatform := range inventoryApplicationFileSupportedPlatforms {\n\t\tlowerPlatformName := strings.ToLower(platformName)\n\t\tformattedPlatformName := strings.ReplaceAll(lowerPlatformName, \" \", \"-\")\n\t\tinventoryApplicationFileLocation := \"/var/lib/\" + formattedPlatformName + \"/inventory/application.json\"\n\t\tif platformName == fileSupportedPlatform && fileExists(inventoryApplicationFileLocation) {\n\t\t\tvar inventoryApplicationFileBytes []byte\n\t\t\tif inventoryApplicationFileBytes, err = ioutil.ReadFile(inventoryApplicationFileLocation); err != nil {\n\t\t\t\tlog.Errorf(\"Unable to read inventory file - hence no inventory data for %v: %v\", GathererName, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif appData, err = getInventoryApplicationFileData(inventoryApplicationFileBytes); err != nil {\n\t\t\t\tlog.Errorf(\"Failed to gather inventory data from inventory file %v: %v\", GathererName, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Infof(\"Used file to gather application\")\n\t\t\treturn\n\n\t\t}\n\t}\n\n\tif checkCommandExists(dpkgCmd) {\n\t\tcmd = dpkgCmd\n\t\targs = []string{dpkgArgsToGetAllApplications, dpkgQueryFormat}\n\t} else if checkCommandExists(rpmCmd) {\n\t\tcmd = rpmCmd\n\t\targs = []string{rpmCmdArgToGetAllApplications, rpmQueryFormat, rpmQueryFormatArgs}\n\t} else {\n\t\tlog.Errorf(\"Unable to detect package manager - hence no inventory data for %v\", GathererName)\n\t\treturn\n\t}\n\n\tlog.Infof(\"Using '%s' to gather application information\", cmd)\n\tif appData, err = getApplicationData(context, cmd, args); err != nil {\n\t\tlog.Errorf(\"Failed to gather inventory data for %v: %v\", GathererName, err)\n\t\treturn\n\t}\n\n\t// Due to ubuntu 18 use snap, so add getApplicationData here\n\tif snapIsInstalled(appData) {\n\t\tcmd = snapCmd\n\t\targs = []string{snapArgsToGetAllInstalledSnaps}\n\t\tvar snapAppData []model.ApplicationData\n\t\tif snapAppData, err = getApplicationData(context, cmd, args); err != nil {\n\t\t\tlog.Errorf(\"Getting applications information using snap failed. Skipping.\")\n\t\t\treturn\n\t\t}\n\t\tlog.Infof(\"Appending application information found using snap to application data.\")\n\t\tappData = append(appData, snapAppData...)\n\t}\n\treturn\n}", "title": "" }, { "docid": "8662d0d93406d00f34e896401a018852", "score": "0.46648708", "text": "func (c *Client) CollectSysInfo(ctx context.Context, req *protocol.CollectSysInfoRequest) (res *protocol.CollectSysInfoResponse, retErr error) {\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tretErr = errors.Wrap(retErr, \"collecting sysinfo\")\n\t\t}\n\t}()\n\n\tconn, err := c.dial(ctx, &protocol.HandshakeRequest{RunnerInitParams: c.params})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer conn.Close(ctx)\n\n\tcl := protocol.NewTestServiceClient(conn.Conn())\n\treturn cl.CollectSysInfo(ctx, req)\n}", "title": "" }, { "docid": "fc033afe6c3586dd091893dd1289f28e", "score": "0.46497434", "text": "func meminfo() (total, free, buffers, cached ByteSize) {\n\tfd, err := os.Open(\"/proc/meminfo\")\n\tdefer fd.Close()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tmapping := map[string]*ByteSize{\n\t\t\"MemTotal\": &total,\n\t\t\"MemFree\": &free,\n\t\t\"Buffers\": &buffers,\n\t\t\"Cached\": &cached,\n\t}\n\n\tvar name, unit string\n\tvar value int64\n\n\tfor {\n\t\tn, err := fmt.Fscanln(fd, &name, &value, &unit)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif n < 2 {\n\t\t\tcontinue\n\t\t}\n\t\twhat, present := mapping[name[:len(name)-1]]\n\t\tif present {\n\t\t\t*what = ByteSize(value) * kiB\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e21747117779d250ca28b21c03e9371a", "score": "0.4639463", "text": "func extractCryptoDetails(inputData []byte) (data []byte, salt, iv *SecureData, N, r, p int, err error) {\n\tif len(inputData) < 12+(2*aes.BlockSize) {\n\t\treturn nil, nil, nil, 0, 0, 0, errors.New(\"Error: Input data is of insufficient length.\")\n\t}\n\tsalt = Secure(inputData[:aes.BlockSize])\n\tinputData = inputData[aes.BlockSize:]\n\tiv = Secure(inputData[:aes.BlockSize])\n\tinputData = inputData[aes.BlockSize:]\n\tconfig := inputData[:12]\n\tinputData = inputData[12:]\n\n\tN = int(bytesToUint32(config[0:4]))\n\tr = int(bytesToUint32(config[4:8]))\n\tp = int(bytesToUint32(config[8:12]))\n\n\treturn inputData, salt, iv, N, r, p, nil\n}", "title": "" }, { "docid": "2dcecd950a01942a5f98199a4cdfa831", "score": "0.4619408", "text": "func (o *UpgradeOrgBody) SetBillingInfo(v BillingInfo) {\n\to.BillingInfo = &v\n}", "title": "" }, { "docid": "12f3afaa87fd564779b27096e2a02e22", "score": "0.46105734", "text": "func CollectClusterInfo(ctx *CheckContext) error {\n\tcollectVCenterInfo(ctx)\n\treturn nil\n}", "title": "" }, { "docid": "b8e9cd8118ac8fde76d95ebed0b834d3", "score": "0.46071315", "text": "func ViewCutomerBills(custID int) {\n\n\tvar mdb sqldb.MysqlDriver\n\tsdbcf := sqldb.GetSQLDBConfig()\n\n\terr := mdb.Init(&sdbcf)\n\tif err != nil {\n\t\tfmt.Println(fmt.Errorf(\"Failed to view customer bill \", err))\n\t}\n\n\toQuery := \"SELECT checkout_date FROM orders WHERE customer_id=? order by checkout_date;\"\n\torows, serr := mdb.Query(oQuery, custID)\n\tif serr != nil {\n\t\tfmt.Println(fmt.Errorf(\"Failed to view customer bill \", serr))\n\t}\n\n\tdates := make([]string, 0)\n\tfor orows.Next() {\n\t\tvar date string\n\t\torows.Scan(&date)\n\t\tdates = append(dates, date)\n\t}\n\n\tfor index, date := range dates {\n\t\tfmt.Println(index+1, \". billed date -\", date)\n\t}\n\tfmt.Println(\"enter the bill number to view bill details : \")\n\tvar k int\n\tfmt.Scan(&k)\n\n\tberr := showbill(dates[k-1], mdb)\n\tif berr != nil {\n\t\tfmt.Println(fmt.Errorf(\"Error while showing bill details\"))\n\t\tcustomerWork(mdb)\n\t}\n\tcustomerWork(mdb)\n}", "title": "" }, { "docid": "a344a88f2dc0c5d274c5a77b8ceb5993", "score": "0.46053293", "text": "func osBillingName(os osType) string {\n\tif os == osLinux {\n\t\treturn \"Linux\"\n\t}\n\treturn string(os)\n}", "title": "" }, { "docid": "734a0f645d12dd809dd89492a3c527ad", "score": "0.45901823", "text": "func GetPromotionData(promo string, dateFrom, dateTo Date) ([]PromoData, map[int64]int64) {\n\tdefer utils.PrintTimeElapsed(time.Now(), \"GetPromotionData Elapsed Time:\")\n\tdb, err := sql.Open(\"postgres\", connDataWH)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\n\terr = db.Ping()\n\n\tif err != nil {\n\t\tlog.Fatal(\"Error: Could not establish a connection with the database\")\n\t\tpanic(err)\n\t}\n\n\tlog.Println(\"CONN SUCCESS\")\n\n\tfrom := time.Date(dateFrom.Year, dateFrom.Month, dateFrom.Day, 0, 0, 0, 0, time.UTC).Format(time.RFC3339)\n\tto := time.Date(dateTo.Year, dateTo.Month, dateTo.Day, 0, 0, 0, 0, time.UTC).Format(time.RFC3339)\n\n\tcount := getPaymentRefsCount(promo, from, to, db)\n\n\tlimit := 10000\n\toffset := 0\n\tN := count / limit\n\tif count%limit != 0 {\n\t\tN += 1\n\t}\n\n\ttype PromoDataWorker struct {\n\t\tpromodata []PromoData\n\t\tshopIds map[int64]bool\n\t}\n\tsem := make(chan PromoDataWorker, N)\n\n\tfor offset < count {\n\n\t\tgo func(offset int) {\n\t\t\tpromodata, shopIds := getPromotionDataWithOffset(promo, from, to, limit, offset, db)\n\t\t\tlog.Println(\"len:\", len(promodata), len(shopIds))\n\t\t\tsem <- PromoDataWorker{promodata: promodata, shopIds: shopIds}\n\t\t}(offset)\n\t\toffset += limit\n\t}\n\n\t// wait for goroutines to finish\n\tvar promoData []PromoData\n\tshopIdList := make(map[int64]bool)\n\tfor i := 0; i < N; {\n\t\ti++\n\t\tpromodataWorker := <-sem\n\t\tpromoData = append(promoData, promodataWorker.promodata...)\n\t\tupdateShopListMap(promodataWorker.shopIds, shopIdList)\n\t}\n\n\tshopSellerMap := getShopSellerMap(shopIdList, db)\n\tfmt.Println(\"TotalShopSellerLength:\", len(shopSellerMap))\n\n\treturn promoData, shopSellerMap\n\n}", "title": "" }, { "docid": "8116cdf5242c8af5f0b4dcc28c39946a", "score": "0.45883873", "text": "func (r Network_Bandwidth_Version1_Allotment) GetBillingCycleBandwidthUsage() (resp []datatypes.Network_Bandwidth_Usage, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Bandwidth_Version1_Allotment\", \"getBillingCycleBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ef4bb685c7115ce75e95e2f99c4c218b", "score": "0.45670477", "text": "func (s *systemInfo) collectPlatformInfo() error {\n\tvar err error\n\tif s.platform == \"\" {\n\t\ts.platform, s.family, s.osVersion, err = host.PlatformInformation()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e278b78a4a23db08684b26467c248ecc", "score": "0.45604324", "text": "func generateBaseData() {\n\tinitClient()\n\tinitUser()\n\tinitDownloader()\n\n\tparseUserDatabases()\n\tgetCollectionIDs()\n\tfetchDatabaseInfo()\n\tdownloadAllPages()\n\tfilterPublishedPages()\n\thandleTree()\n\tclearCache()\n}", "title": "" }, { "docid": "6a7de4296c1b52dfbeba80919a574494", "score": "0.454777", "text": "func (b *Billing) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {\n\tvar v struct {\n\t\tXMLName xml.Name `xml:\"billing_info\"`\n\t\tFirstName string `xml:\"first_name,omitempty\"`\n\t\tLastName string `xml:\"last_name,omitempty\"`\n\t\tCompany string `xml:\"company,omitempty\"`\n\t\tAddress string `xml:\"address1,omitempty\"`\n\t\tAddress2 string `xml:\"address2,omitempty\"`\n\t\tCity string `xml:\"city,omitempty\"`\n\t\tState string `xml:\"state,omitempty\"`\n\t\tZip string `xml:\"zip,omitempty\"`\n\t\tCountry string `xml:\"country,omitempty\"`\n\t\tPhone string `xml:\"phone,omitempty\"`\n\t\tVATNumber string `xml:\"vat_number,omitempty\"`\n\t\tIPAddress net.IP `xml:\"ip_address,omitempty\"`\n\t\tIPAddressCountry string `xml:\"ip_address_country,omitempty\"`\n\n\t\t// Credit Card Info\n\t\tFirstSix string `xml:\"first_six,omitempty\"`\n\t\tLastFour string `xml:\"last_four,omitempty\"`\n\t\tCardType string `xml:\"card_type,omitempty\"`\n\t\tNumber int `xml:\"number,omitempty\"`\n\t\tMonth NullInt `xml:\"month,omitempty\"`\n\t\tYear NullInt `xml:\"year,omitempty\"`\n\n\t\t// Paypal\n\t\tPaypalAgreementID string `xml:\"paypal_billing_agreement_id,omitempty\"`\n\n\t\t// Amazon\n\t\tAmazonAgreementID string `xml:\"amazon_billing_agreement_id,omitempty\"`\n\n\t\t// Bank Account\n\t\t// Note: routing numbers and account numbers may start with zeros, so need\n\t\t// to treat them as strings\n\t\tNameOnAccount string `xml:\"name_on_account,omitempty\"`\n\t\tRoutingNumber string `xml:\"routing_number,omitempty\"`\n\t\tAccountNumber string `xml:\"account_number,omitempty\"`\n\t\tAccountType string `xml:\"account_type,omitempty\"`\n\t}\n\tif err := d.DecodeElement(&v, &start); err != nil {\n\t\treturn err\n\t}\n\t*b = Billing{\n\t\tXMLName: v.XMLName,\n\t\tFirstName: v.FirstName,\n\t\tLastName: v.LastName,\n\t\tCompany: v.Company,\n\t\tAddress: v.Address,\n\t\tAddress2: v.Address2,\n\t\tCity: v.City,\n\t\tState: v.State,\n\t\tZip: v.Zip,\n\t\tCountry: v.Country,\n\t\tPhone: v.Phone,\n\t\tVATNumber: v.VATNumber,\n\t\tIPAddress: v.IPAddress,\n\t\tIPAddressCountry: v.IPAddressCountry,\n\n\t\tFirstSix: v.FirstSix,\n\t\tLastFour: v.LastFour,\n\t\tCardType: v.CardType,\n\t\tNumber: v.Number,\n\t\tMonth: v.Month.Int,\n\t\tYear: v.Year.Int,\n\n\t\tPaypalAgreementID: v.PaypalAgreementID,\n\t\tAmazonAgreementID: v.AmazonAgreementID,\n\n\t\tNameOnAccount: v.NameOnAccount,\n\t\tRoutingNumber: v.RoutingNumber,\n\t\tAccountNumber: v.AccountNumber,\n\t\tAccountType: v.AccountType,\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ddc0300d05c4b4a1bbcf0d38c792212", "score": "0.45477605", "text": "func (*Bucket_Billing) Descriptor() ([]byte, []int) {\n\treturn file_google_storage_v1_storage_resources_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "c1a8641311abd755650df3ae3181d2b8", "score": "0.45352557", "text": "func (ps *proportionScheduler) collectSchedulingInfo(jobGroup map[string][]*cache.QuotaAllocatorInfo, nodes []*cache.NodeInfo) (int64, int64, int64) {\n\ttotalCPU := int64(0)\n\ttotalMEM := int64(0)\n\ttotalWeight := int64(0)\n\n\tfor _, node := range nodes {\n\t\tif cpu, ok := node.Node().Status.Capacity[\"cpu\"]; ok {\n\t\t\tif capacity, ok := cpu.AsInt64(); ok {\n\t\t\t\ttotalCPU += capacity\n\t\t\t}\n\t\t}\n\t\tif memory, ok := node.Node().Status.Capacity[\"memory\"]; ok {\n\t\t\tif capacity, ok := memory.AsInt64(); ok {\n\t\t\t\ttotalMEM += capacity\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, jobs := range jobGroup {\n\t\tfor _, job := range jobs {\n\t\t\ttotalWeight += int64(job.QuotaAllocator().Spec.Weight)\n\t\t}\n\t}\n\n\treturn totalCPU, totalMEM, totalWeight\n}", "title": "" }, { "docid": "5dab112b8f439bca3b8f698bd7e44a1d", "score": "0.4528771", "text": "func (c *lmstatCollector) getLmstatLicensesInfo(ch chan<- prometheus.Metric) error {\n\tvar outBytes []byte\n\tvar err error\n\n\tfor _, licenses := range LicenseConfig.Licenses {\n\t\t// Call lmstat with -a (display everything)\n\t\tif licenses.LicenseFile != \"\" {\n\t\t\toutBytes, err = lmutilOutput(\"-c\", licenses.LicenseFile, \"-a\")\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else if licenses.LicenseServer != \"\" {\n\t\t\toutBytes, err = lmutilOutput(\"-c\", licenses.LicenseServer, \"-a\")\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Fatalf(\"couldn`t find `license_file` or `license_server` for %v\",\n\t\t\t\tlicenses.Name)\n\t\t\treturn nil\n\t\t}\n\n\t\toutStr, err := splitOutput(outBytes)\n\t\tif err != nil {\n\t\t\tlog.Errorln(err)\n\t\t\treturn err\n\t\t}\n\n\t\tservers = parseLmstatLicenseInfoServer(outStr)\n\t\tfor _, info := range servers {\n\t\t\tif info.status {\n\t\t\t\tch <- prometheus.MustNewConstMetric(c.lmstatServerStatus,\n\t\t\t\t\tprometheus.GaugeValue, 1.0, licenses.Name, info.fqdn,\n\t\t\t\t\tstrconv.FormatBool(info.master), info.port, info.version)\n\t\t\t} else {\n\t\t\t\tch <- prometheus.MustNewConstMetric(c.lmstatServerStatus,\n\t\t\t\t\tprometheus.GaugeValue, 0, licenses.Name, info.fqdn,\n\t\t\t\t\tstrconv.FormatBool(info.master), info.port, info.version)\n\t\t\t}\n\t\t}\n\t\tvendors = parseLmstatLicenseInfoVendor(outStr)\n\t\tfor name, info := range vendors {\n\t\t\tif info.status {\n\t\t\t\tch <- prometheus.MustNewConstMetric(c.lmstatVendorStatus,\n\t\t\t\t\tprometheus.GaugeValue, 1.0, licenses.Name, name,\n\t\t\t\t\tinfo.version)\n\t\t\t} else {\n\t\t\t\tch <- prometheus.MustNewConstMetric(c.lmstatVendorStatus,\n\t\t\t\t\tprometheus.GaugeValue, 0, licenses.Name, name, info.version)\n\t\t\t}\n\t\t}\n\t\t// features\n\t\tvar featuresToExclude = []string{}\n\t\tvar featuresToInclude = []string{}\n\t\tif licenses.FeaturesToExclude != \"\" && licenses.FeaturesToInclude != \"\" {\n\t\t\tlog.Fatalln(\"%v: can not define `features_to_include` and \"+\n\t\t\t\t\"`features_to_exclude` at the same time\", licenses.Name)\n\t\t\treturn nil\n\t\t} else if licenses.FeaturesToExclude != \"\" {\n\t\t\tfeaturesToExclude = strings.Split(licenses.FeaturesToExclude, \",\")\n\t\t} else if licenses.FeaturesToInclude != \"\" {\n\t\t\tfeaturesToInclude = strings.Split(licenses.FeaturesToInclude, \",\")\n\t\t}\n\t\tfeatures, licUsersByFeature, reservGroupByFeature = parseLmstatLicenseInfoFeature(outStr)\n\t\tfor name, info := range features {\n\t\t\tif contains(featuresToExclude, name) {\n\t\t\t\tcontinue\n\t\t\t} else if licenses.FeaturesToInclude != \"\" &&\n\t\t\t\t!contains(featuresToInclude, name) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tch <- prometheus.MustNewConstMetric(c.lmstatFeatureUsed,\n\t\t\t\tprometheus.GaugeValue, info.used, licenses.Name, name)\n\t\t\tch <- prometheus.MustNewConstMetric(c.lmstatFeatureIssued,\n\t\t\t\tprometheus.GaugeValue, info.issued, licenses.Name, name)\n\t\t\tif licenses.MonitorUsers && (licUsersByFeature[name] != nil) {\n\t\t\t\tfor username, licused := range licUsersByFeature[name] {\n\t\t\t\t\tch <- prometheus.MustNewConstMetric(\n\t\t\t\t\t\tc.lmstatFeatureUsedUsers, prometheus.GaugeValue,\n\t\t\t\t\t\tlicused, licenses.Name, name, username)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif licenses.MonitorReservations && (reservGroupByFeature[name] != nil) {\n\t\t\t\tfor group, licreserv := range reservGroupByFeature[name] {\n\t\t\t\t\tch <- prometheus.MustNewConstMetric(\n\t\t\t\t\t\tc.lmstatFeatureReservGroups, prometheus.GaugeValue,\n\t\t\t\t\t\tlicreserv, licenses.Name, name, group)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "19c8799bbd37ef55ca539b7ae492e207", "score": "0.45275444", "text": "func NewBilling(\n\tcustomer Customer,\n\tcustomerID string,\n\tdescription string,\n\tvalue,\n\tinstallmentValue float64,\n\tinstallmentCount int,\n\tbillingType string,\n\tcreditCardNumber string,\n\tcreditCardName string,\n\tcreditCardNameHolder string,\n\tcreditCardPhoneHolder string,\n\tcreditCardEmailHolder string,\n\tcreditCardExpiryMonth string,\n\tcreditCardExpiryYear string,\n\tccv string,\n) (*Billing, error) {\n\tb := &Billing{\n\t\tCustomer: customer,\n\t\tCustomerID: customerID,\n\t\tDueDate: time.Now().AddDate(0, 0, 3).Format(\"2006-01-02\"),\n\t\tDescription: description,\n\t\tValue: value,\n\t\tInstallmentValue: installmentValue,\n\t\tBillingType: billingType,\n\t\tInstallmentCount: installmentCount,\n\t\tCreditCardNumber: strings.TrimSpace(creditCardNumber),\n\t\tCreditCardName: strings.TrimSpace(creditCardName),\n\t\tCreditCardNameHolder: strings.TrimSpace(creditCardNameHolder),\n\t\tCreditCardPhoneHolder: strings.TrimSpace(creditCardPhoneHolder),\n\t\tCreditCardEmailHolder: strings.TrimSpace(creditCardEmailHolder),\n\t\tCreditCardExpiryMonth: creditCardExpiryMonth,\n\t\tCreditCardExpiryYear: creditCardExpiryYear,\n\t\tCCV: strings.TrimSpace(ccv),\n\t}\n\n\tif billingType == \"BOLETO\" {\n\t\terr := b.ValidateBankSlipPayment()\n\n\t\tif err != nil {\n\t\t\treturn nil, ErrInvalidEntity\n\t\t}\n\n\t\treturn b, nil\n\t}\n\n\terr := b.ValidateCreditCardPayment()\n\n\tif err != nil {\n\t\treturn nil, ErrInvalidEntity\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "d916e602bc33187aaac450d34ec4cea0", "score": "0.45179817", "text": "func getEntryData() (data []byte, file string, err error) {\n\t// return /sys file if could be used.\n\tfile = \"\"\n\n\t// Check for dmi in /sys\n\tdata, err = ioutil.ReadFile(\"/sys/firmware/dmi/tables/smbios_entry_point\")\n\tif err == nil {\n\t\tdata, err = anchor(data)\n\t\tif err == nil {\n\t\t\tfile = \"/sys/firmware/dmi/tables/DMI\"\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Check for efi\n\tdata, err = ioutil.ReadFile(\"/sys/firmware/efi/systab\")\n\tif err != nil {\n\t\tdata, err = ioutil.ReadFile(\"/proc/efi/systab\")\n\t}\n\t// we have a efi systab - look for address\n\tif err == nil {\n\t\tsdata := string(data)\n\t\tlines := strings.Split(sdata, \"\\n\")\n\n\t\tfor _, line := range lines {\n\t\t\tparts := strings.Split(line, \"=\")\n\t\t\tif len(parts) != 2 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif parts[0] == \"SMBIOS\" {\n\t\t\t\toffset, err2 := strconv.ParseUint(parts[1], 0, 32)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tdata, err = getMem(uint32(offset), 0x20)\n\t\t\t\tif err == nil {\n\t\t\t\t\tdata, err = anchor(data)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil, \"\", fmt.Errorf(\"EFI enabled, but table not found\\n\")\n\t}\n\n\t// Last ditch hope\n\tdata, err = getMem(0xF0000, 0x10000)\n\tif err == nil {\n\t\tdata, err = anchor(data)\n\t}\n\treturn\n}", "title": "" }, { "docid": "d273e4e51149d9ed0d5eb3f2bb0b9ac4", "score": "0.45113832", "text": "func (s Service) CertificatesInfoByExpiry(since time.Time, start string, limit int) (page *certificate.InfosPage, err error) {\n\terr = s.DB.View(func(tx *bolt.Tx) (err error) {\n\t\tpage, err = getCertificatesByExpiry(tx, since, []byte(start), limit)\n\t\treturn\n\t})\n\treturn\n}", "title": "" }, { "docid": "4e0cb01323a074fb4c3de8bcf40bd120", "score": "0.45106912", "text": "func (r Network_Storage_MassDataMigration_Request) GetBillingItem() (resp datatypes.Billing_Item, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Storage_MassDataMigration_Request\", \"getBillingItem\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "b625d9aa2099ae35a5dde30d4ffda628", "score": "0.45077556", "text": "func (r Network_Component_Firewall) GetBillingItem() (resp datatypes.Billing_Item, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Component_Firewall\", \"getBillingItem\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "8a69dee47ded5d383e36f4967728dfac", "score": "0.45028", "text": "func (alibaba *Alibaba) DownloadPricingData() error {\n\talibaba.DownloadPricingDataLock.Lock()\n\tdefer alibaba.DownloadPricingDataLock.Unlock()\n\n\tvar aak *credentials.AccessKeyCredential\n\tvar err error\n\n\tif !alibaba.accessKeyisLoaded() {\n\t\taak, err = alibaba.GetAlibabaAccessKey()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to get the access key information: %w\", err)\n\t\t}\n\t} else {\n\t\taak = alibaba.accessKey\n\t}\n\n\tc, err := alibaba.Config.GetCustomPricingData()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error downloading default pricing data: %w\", err)\n\t}\n\n\t// Get all the nodes from Alibaba cluster.\n\tnodeList := alibaba.Clientset.GetAllNodes()\n\n\tvar client *sdk.Client\n\tvar signer *signers.AccessKeySigner\n\tvar ok bool\n\tvar lookupKey string\n\talibaba.clients = make(map[string]*sdk.Client)\n\talibaba.Pricing = make(map[string]*AlibabaPricing)\n\n\tfor _, node := range nodeList {\n\t\tpricingObj := &AlibabaPricing{}\n\t\tslimK8sNode := generateSlimK8sNodeFromV1Node(node)\n\n\t\tif client, ok = alibaba.clients[slimK8sNode.RegionID]; !ok {\n\t\t\tclient, err = sdk.NewClientWithAccessKey(slimK8sNode.RegionID, aak.AccessKeyId, aak.AccessKeySecret)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to initiate alibaba cloud sdk client for region %s : %w\", slimK8sNode.RegionID, err)\n\t\t\t}\n\t\t\talibaba.clients[slimK8sNode.RegionID] = client\n\t\t}\n\t\tsigner = signers.NewAccessKeySigner(aak)\n\n\t\t// Adjust the system Disk information of a Node by retrieving the details of associated disk. If unable to retrieve set it to empty\n\t\t// system disk to pass through and use defaults with Alibaba pricing API.\n\t\tinstanceID := getInstanceIDFromProviderID(slimK8sNode.ProviderID)\n\t\tslimK8sNode.SystemDisk = getSystemDiskInfoOfANode(instanceID, slimK8sNode.RegionID, client, signer)\n\n\t\tlookupKey, err = determineKeyForPricing(slimK8sNode)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to determine key for pricing: %w\", err)\n\t\t}\n\n\t\tif _, ok := alibaba.Pricing[lookupKey]; ok {\n\t\t\tlog.Debugf(\"Pricing information for node with same features %s already exists hence skipping\", lookupKey)\n\t\t\tcontinue\n\t\t}\n\n\t\tpricingObj, err = processDescribePriceAndCreateAlibabaPricing(client, slimK8sNode, signer, c)\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create pricing information for node with type %s with error: %w\", slimK8sNode.InstanceType, err)\n\t\t}\n\t\talibaba.Pricing[lookupKey] = pricingObj\n\t}\n\n\t// set the first occurrence of region from the node\n\tif alibaba.ClusterRegion == \"\" {\n\t\tfor _, node := range nodeList {\n\t\t\tif regionID, ok := node.Labels[\"topology.kubernetes.io/region\"]; ok {\n\t\t\t\talibaba.ClusterRegion = regionID\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// PV pricing for only Cloud Disk for now.\n\t// TO-DO: Support both NAS(Network Attached storage) and OSS(Object Storage Service) type PVs\n\n\tpvList := alibaba.Clientset.GetAllPersistentVolumes()\n\n\tfor _, pv := range pvList {\n\t\tpvRegion := determinePVRegion(pv)\n\t\tif pvRegion == \"\" {\n\t\t\tpvRegion = alibaba.ClusterRegion\n\t\t}\n\t\tpricingObj := &AlibabaPricing{}\n\t\tslimK8sDisk := generateSlimK8sDiskFromV1PV(pv, pvRegion)\n\t\tlookupKey, err = determineKeyForPricing(slimK8sDisk)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to determine key for pricing: %w\", err)\n\t\t}\n\t\tif _, ok := alibaba.Pricing[lookupKey]; ok {\n\t\t\tlog.Debugf(\"Pricing information for pv with same features %s already exists hence skipping\", lookupKey)\n\t\t\tcontinue\n\t\t}\n\t\tif client, ok = alibaba.clients[slimK8sDisk.RegionID]; !ok {\n\t\t\tclient, err = sdk.NewClientWithAccessKey(slimK8sDisk.RegionID, aak.AccessKeyId, aak.AccessKeySecret)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to initiate alibaba cloud sdk client for region %s : %w\", slimK8sDisk.RegionID, err)\n\t\t\t}\n\t\t\talibaba.clients[slimK8sDisk.RegionID] = client\n\t\t}\n\t\tsigner = signers.NewAccessKeySigner(aak)\n\t\tpricingObj, err = processDescribePriceAndCreateAlibabaPricing(client, slimK8sDisk, signer, c)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create pricing information for pv with category %s with error: %w\", slimK8sDisk.DiskCategory, err)\n\t\t}\n\t\talibaba.Pricing[lookupKey] = pricingObj\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bedc707a0b0be84edee0a7ff0d929965", "score": "0.4495136", "text": "func (r Network_Storage_Iscsi) GetBillingItem() (resp datatypes.Billing_Item, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Storage_Iscsi\", \"getBillingItem\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ed62577fc69e76d4ee830891543fefde", "score": "0.4487563", "text": "func (r Network_LoadBalancer_Global_Account) GetBillingItem() (resp datatypes.Billing_Item, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_LoadBalancer_Global_Account\", \"getBillingItem\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ef782f89ddd5e56efa6201e461218742", "score": "0.4485864", "text": "func (g *Gateio) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error) {\n\tcreds, err := g.GetCredentials(ctx)\n\tif err != nil {\n\t\treturn account.Holdings{}, err\n\t}\n\tacc, err := account.GetHoldings(g.Name, creds, assetType)\n\tif err != nil {\n\t\treturn g.UpdateAccountInfo(ctx, assetType)\n\t}\n\treturn acc, nil\n}", "title": "" }, { "docid": "d0efd038483fb85ea949d56ef37f2d9d", "score": "0.44701216", "text": "func (bi *Binanceus) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error) {\n\tcreds, err := bi.GetCredentials(ctx)\n\tif err != nil {\n\t\treturn account.Holdings{}, err\n\t}\n\tacc, err := account.GetHoldings(bi.Name, creds, assetType)\n\tif err != nil {\n\t\treturn bi.UpdateAccountInfo(ctx, assetType)\n\t}\n\treturn acc, nil\n}", "title": "" }, { "docid": "c806dfba47081a1dacc79280cead0f2f", "score": "0.4463407", "text": "func (m *metadataVolume) collectData(data *map[string]string) error {\n\terrlist := []error{}\n\tfor fieldReference, fileName := range m.fieldReferenceFileNames {\n\t\tif values, err := fieldpath.ExtractFieldPathAsString(m.pod, fieldReference); err != nil {\n\t\t\tglog.Error(err)\n\t\t\terrlist = append(errlist, err)\n\t\t} else {\n\t\t\t(*data)[fileName] = sortLines(values)\n\t\t}\n\t}\n\treturn utilErrors.NewAggregate(errlist)\n}", "title": "" }, { "docid": "23e6158e78827af6272acb181f03fb52", "score": "0.44572467", "text": "func (state *ComputeDiskState) CompletePricingInfo(catalog *billing.ComputeEngineCatalog) error {\n\tif state.Before != nil {\n\t\tif err := state.Before.completePricingInfo(catalog); err != nil {\n\t\t\treturn fmt.Errorf(state.Before.Name + \"(\" + state.Before.Type + \")\" + \": \" + err.Error())\n\t\t}\n\t}\n\n\tif state.After != nil {\n\t\tif err := state.After.completePricingInfo(catalog); err != nil {\n\t\t\treturn fmt.Errorf(state.After.Name + \"(\" + state.After.Type + \")\" + \": \" + err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "10d1cfc130a3ac6beb775019d41d928e", "score": "0.444226", "text": "func (r Network_Storage_Hub_Cleversafe_Account) GetBillingItem() (resp datatypes.Billing_Item, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Storage_Hub_Cleversafe_Account\", \"getBillingItem\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "d4a2fb3d2e0be4e659d9da2196d6668b", "score": "0.44336247", "text": "func (r Network_LoadBalancer_VirtualIpAddress) GetBillingItem() (resp datatypes.Billing_Item, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_LoadBalancer_VirtualIpAddress\", \"getBillingItem\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "232bad00be6c19048b4aa07bf4435046", "score": "0.4431495", "text": "func (o *UpgradeOrgBody) HasBillingInfo() bool {\n\tif o != nil && o.BillingInfo != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1a47809ef923bfbde1f20d346cac0032", "score": "0.44165257", "text": "func (c *servicePlanAllocationCmd) makeRecord(o *models.ServicePlanAllocation) map[string]string {\n\tvar account, authAccount, cluster, domain, servicePlan string\n\tdomain = string(o.CspDomainID)\n\tif dn, ok := c.cspDomains[string(o.CspDomainID)]; ok { //assumes map present\n\t\tdomain = dn\n\t}\n\tif aac, ok := c.accounts[string(o.AuthorizedAccountID)]; ok {\n\t\tauthAccount = aac.name\n\t} else {\n\t\tauthAccount = string(o.AuthorizedAccountID)\n\t}\n\tif ac, ok := c.accounts[string(o.AccountID)]; ok {\n\t\taccount = ac.name\n\t} else {\n\t\taccount = string(o.AccountID)\n\t}\n\tif cl, ok := c.clusters[string(o.ClusterID)]; ok {\n\t\tcluster = cl.name\n\t} else {\n\t\tcluster = string(o.ClusterID)\n\t}\n\tif sp, ok := c.servicePlans[string(o.ServicePlanID)]; ok {\n\t\tservicePlan = sp\n\t} else {\n\t\tservicePlan = string(o.ServicePlanID)\n\t}\n\treturn map[string]string{\n\t\thID: string(o.Meta.ID),\n\t\thCluster: cluster,\n\t\thCspDomain: domain,\n\t\thAccount: account,\n\t\thStorageFormula: string(o.StorageFormula),\n\t\thAuthorizedAccount: authAccount,\n\t\thTotalCapacityBytes: sizeToString(*o.TotalCapacityBytes),\n\t\thReservableCapacityBytes: sizeToString(*o.ReservableCapacityBytes),\n\t\thServicePlan: servicePlan,\n\t\thState: o.ReservationState,\n\t\thTags: strings.Join(o.Tags, \", \"),\n\t}\n}", "title": "" }, { "docid": "2866bd42afaee40a0a6d64d4c7ca9b69", "score": "0.4412329", "text": "func (m *metricSaphanaServiceMemoryCompactorsAllocated) init() {\n\tm.data.SetName(\"saphana.service.memory.compactors.allocated\")\n\tm.data.SetDescription(\"The part of the memory pool that can potentially (if unpinned) be freed during a memory shortage.\")\n\tm.data.SetUnit(\"By\")\n\tm.data.SetEmptySum()\n\tm.data.Sum().SetIsMonotonic(false)\n\tm.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)\n\tm.data.Sum().DataPoints().EnsureCapacity(m.capacity)\n}", "title": "" }, { "docid": "01481b06569f43923aeaeae4f4b0926e", "score": "0.44122887", "text": "func (_Auto *AutoCaller) PoolInfo(opts *bind.CallOpts, arg0 *big.Int) (struct {\n\tWant common.Address\n\tAllocPoint *big.Int\n\tLastRewardBlock *big.Int\n\tAccAUTOPerShare *big.Int\n\tStrat common.Address\n}, error) {\n\tvar out []interface{}\n\terr := _Auto.contract.Call(opts, &out, \"poolInfo\", arg0)\n\n\toutstruct := new(struct {\n\t\tWant common.Address\n\t\tAllocPoint *big.Int\n\t\tLastRewardBlock *big.Int\n\t\tAccAUTOPerShare *big.Int\n\t\tStrat common.Address\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.Want = *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\toutstruct.AllocPoint = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\toutstruct.LastRewardBlock = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\toutstruct.AccAUTOPerShare = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int)\n\toutstruct.Strat = *abi.ConvertType(out[4], new(common.Address)).(*common.Address)\n\n\treturn *outstruct, err\n\n}", "title": "" }, { "docid": "81b34be36716022949efd96b33db7cd0", "score": "0.44115213", "text": "func getBillingEvent() (billEvent models.BillingEvent) {\n\tbillEvent.CallID = \"e21b0dda-6566-402a-8f8c-0657e5b87eeb\"\n\tbillEvent.UserID = 1\n\tbillEvent.ProductID = 2\n\tbillEvent.AnswerTime = \"2021-07-01 00:30:00\"\n\tbillEvent.HangupTime = \"2021-07-01 01:00:00\"\n\treturn\n}", "title": "" }, { "docid": "c6a330fcb19ce53ca12d339621316d9b", "score": "0.44075075", "text": "func processIPScanInformation(ipScanData []byte) string {\n\n\tipInformation := iPInformation{}\n\tjson.Unmarshal(ipScanData, &ipInformation)\n\n\tLatitude := strconv.FormatFloat(ipInformation.Latitude, 'f', 6, 64)\n\tLongitude := strconv.FormatFloat(ipInformation.Longitude, 'f', 6, 64)\n\tipInformation.URL = \"https://www.google.com.au/maps/@\" + Latitude + \",\" + Longitude + \"z\"\n\n\tipInfo := \"Host: \" + ipInformation.IP + \"\\n\"\n\tipInfo += \"Country: \" + ipInformation.CountryName + \"\\nRegion: \" + ipInformation.RegionName + \"\\n\"\n\tipInfo += \"City: \" + ipInformation.City + \"\\nZip Code: \" + ipInformation.ZipCode + \"\\n\"\n\tipInfo += \"Time Zone: \" + ipInformation.TimeZone + \"\\nLink to google maps with geolocation: \" + ipInformation.URL\n\n\treturn ipInfo\n}", "title": "" }, { "docid": "2141865d31481a8b813a363d9bdd6669", "score": "0.44073415", "text": "func ParseCheckinData(c *bspb.BatteryStats) Checkin {\n\tif c == nil {\n\t\treturn Checkin{}\n\t}\n\n\trealtime := time.Duration(c.System.Battery.GetBatteryRealtimeMsec()) * time.Millisecond\n\tif realtime < 0 {\n\t\tlog.Printf(\"realtime was negative: %v\\n\", realtime)\n\t}\n\n\tout := Checkin{\n\t\tDevice: c.Build.GetDevice(),\n\t\tBuild: c.Build.GetBuildId(),\n\t\tBuildFingerprint: c.Build.GetFingerprint(),\n\t\tReportVersion: c.GetReportVersion(),\n\n\t\tRealtime: realtime,\n\t\tScreenOffRealtime: time.Duration(c.System.Battery.GetScreenOffRealtimeMsec()) * time.Millisecond,\n\n\t\tScreenOffDischargePoints: c.System.BatteryDischarge.GetScreenOff(),\n\t\tScreenOnDischargePoints: c.System.BatteryDischarge.GetScreenOn(),\n\n\t\tEstimatedDischarge: c.System.PowerUseSummary.GetComputedPowerMah(),\n\t\tActualDischarge: (c.System.PowerUseSummary.GetMinDrainedPowerMah() + c.System.PowerUseSummary.GetMaxDrainedPowerMah()) / 2,\n\n\t\t// Uptime is the same as screen-off uptime + screen on time\n\t\tUptime: MDuration{\n\t\t\tV: (time.Duration(c.System.Battery.GetBatteryUptimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tScreenOffUptime: MDuration{\n\t\t\tV: (time.Duration(c.System.Battery.GetScreenOffUptimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tScreenOnTime: MDuration{\n\t\t\tV: (time.Duration(c.System.Misc.GetScreenOnTimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tPartialWakelockTime: MDuration{\n\t\t\tV: (time.Duration(c.System.Misc.GetPartialWakelockTimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tKernelOverheadTime: MDuration{\n\t\t\tV: (time.Duration(c.System.Battery.GetScreenOffUptimeMsec()-c.System.Misc.GetPartialWakelockTimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tSignalScanningTime: MDuration{\n\t\t\tV: (time.Duration(c.System.SignalScanningTime.GetTimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tMobileActiveTime: MDuration{\n\t\t\tV: (time.Duration(c.System.Misc.GetMobileActiveTimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tPhoneCallTime: MDuration{\n\t\t\tV: (time.Duration(c.System.Misc.GetPhoneOnTimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tWifiOnTime: MDuration{\n\t\t\tV: (time.Duration(c.System.Misc.GetWifiOnTimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tDeviceIdleModeEnabledTime: MDuration{\n\t\t\tV: (time.Duration(c.System.Misc.GetDeviceIdleModeEnabledTimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tDeviceIdlingTime: MDuration{\n\t\t\tV: (time.Duration(c.System.Misc.GetDeviceIdlingTimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tFullWakelockTime: MDuration{\n\t\t\tV: (time.Duration(c.System.Misc.GetFullWakelockTimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tInteractiveTime: MDuration{\n\t\t\tV: (time.Duration(c.System.Misc.GetInteractiveTimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tBluetoothOnTime: MDuration{\n\t\t\tV: (time.Duration(c.System.Misc.GetBluetoothOnTimeMsec()) * time.Millisecond),\n\t\t},\n\n\t\tLowPowerModeEnabledTime: MDuration{\n\t\t\tV: (time.Duration(c.System.Misc.GetLowPowerModeEnabledTimeMsec()) * time.Millisecond),\n\t\t},\n\t\tConnectivityChanges: c.System.Misc.GetConnectivityChanges(),\n\t}\n\tif realtime > 0 {\n\t\tout.ScreenOffUptimePercentage = (float32(out.ScreenOffUptime.V) / float32(realtime)) * 100\n\t\tout.ScreenOnTimePercentage = (float32(out.ScreenOnTime.V) / float32(realtime)) * 100\n\t\tout.PartialWakelockTimePercentage = (float32(out.PartialWakelockTime.V) / float32(realtime)) * 100\n\t\tout.KernelOverheadTimePercentage = (float32(out.KernelOverheadTime.V) / float32(realtime)) * 100\n\t\tout.SignalScanningTimePercentage = (float32(out.SignalScanningTime.V) / float32(realtime)) * 100\n\t\tout.MobileActiveTimePercentage = (float32(out.MobileActiveTime.V) / float32(realtime)) * 100\n\t\tout.FullWakelockTimePercentage = (float32(out.FullWakelockTime.V) / float32(realtime)) * 100\n\t\tout.PhoneCallTimePercentage = (float32(out.PhoneCallTime.V) / float32(realtime)) * 100\n\t\tout.DeviceIdleModeEnabledTimePercentage = (float32(out.DeviceIdleModeEnabledTime.V) / float32(realtime)) * 100\n\t\tout.DeviceIdlingTimePercentage = (float32(out.DeviceIdlingTime.V) / float32(realtime)) * 100\n\t\tout.InteractiveTimePercentage = (float32(out.InteractiveTime.V) / float32(realtime)) * 100\n\n\t\tout.BluetoothOnTimePercentage = (float32(out.BluetoothOnTime.V) / float32(realtime)) * 100\n\t\tout.LowPowerModeEnabledTimePercentage = (float32(out.LowPowerModeEnabledTime.V) / float32(realtime)) * 100\n\n\t\tout.MobileKiloBytesPerHr = MFloat32{V: (c.System.GlobalNetwork.GetMobileBytesRx() + c.System.GlobalNetwork.GetMobileBytesTx()) / (1024 * float32(realtime.Hours()))}\n\t\tout.WifiKiloBytesPerHr = MFloat32{V: (c.System.GlobalNetwork.GetWifiBytesRx() + c.System.GlobalNetwork.GetWifiBytesTx()) / (1024 * float32(realtime.Hours()))}\n\t}\n\n\tbCapMah := c.GetSystem().GetPowerUseSummary().GetBatteryCapacityMah()\n\tif bCapMah < 0 {\n\t\tlog.Printf(\"battery capacity mAh was negative: %v\\n\", bCapMah)\n\t}\n\tif c.GetReportVersion() >= 14 {\n\t\tout.WifiOnTime = MDuration{V: time.Duration(c.System.GlobalWifi.GetWifiOnTimeMsec()) * time.Millisecond}\n\t\tout.WifiIdleTime = MDuration{V: time.Duration(c.System.GlobalWifi.GetWifiIdleTimeMsec()) * time.Millisecond}\n\t\tout.WifiTransferTime = MDuration{V: time.Duration(c.System.GlobalWifi.GetWifiRxTimeMsec()+c.System.GlobalWifi.GetWifiTxTimeMsec()) * time.Millisecond}\n\t\tif realtime > 0 {\n\t\t\tout.WifiOnTimePercentage = (float32(out.WifiOnTime.V) / float32(realtime)) * 100\n\t\t\tout.WifiTransferTimePercentage = (float32(out.WifiTransferTime.V) / float32(realtime)) * 100\n\t\t}\n\t\tif bCapMah > 0 {\n\t\t\tout.WifiDischargePoints = 100 * c.System.GlobalWifi.GetWifiPowerMah() / bCapMah\n\t\t\tif realtime > 0 {\n\t\t\t\tout.WifiDischargeRatePerHr = MFloat32{\n\t\t\t\t\tV: out.WifiDischargePoints / float32(realtime.Hours()),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tout.BluetoothIdleTime = MDuration{V: time.Duration(c.System.GlobalBluetooth.GetBluetoothIdleTimeMsec()) * time.Millisecond}\n\t\tout.BluetoothTransferTime = MDuration{V: time.Duration(c.System.GlobalBluetooth.GetBluetoothRxTimeMsec()+c.System.GlobalBluetooth.GetBluetoothTxTimeMsec()) * time.Millisecond}\n\t\tif realtime > 0 {\n\t\t\tout.BluetoothTransferTimePercentage = (float32(out.BluetoothTransferTime.V) / float32(realtime)) * 100\n\t\t}\n\t\tif bCapMah > 0 {\n\t\t\tout.BluetoothDischargePoints = 100 * c.System.GlobalBluetooth.GetBluetoothPowerMah() / bCapMah\n\t\t\tif realtime > 0 {\n\t\t\t\tout.BluetoothDischargeRatePerHr = MFloat32{\n\t\t\t\t\tV: out.BluetoothDischargePoints / float32(realtime.Hours()),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif c.GetReportVersion() >= 17 {\n\t\tsumCtrlrTransferTime := func(ctrlr *bspb.BatteryStats_ControllerActivity) time.Duration {\n\t\t\tif ctrlr == nil {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tsum := ctrlr.GetRxTimeMsec()\n\t\t\tfor _, tx := range ctrlr.Tx {\n\t\t\t\tsum += tx.GetTimeMsec()\n\t\t\t}\n\t\t\treturn time.Duration(sum) * time.Millisecond\n\t\t}\n\n\t\tout.BluetoothIdleTime = MDuration{V: time.Duration(c.System.GlobalBluetoothController.GetIdleTimeMsec()) * time.Millisecond}\n\t\tout.ModemIdleTime = MDuration{V: time.Duration(c.System.GlobalModemController.GetIdleTimeMsec()) * time.Millisecond}\n\t\tout.WifiIdleTime = MDuration{V: time.Duration(c.System.GlobalWifiController.GetIdleTimeMsec()) * time.Millisecond}\n\n\t\tout.BluetoothTransferTime = MDuration{V: sumCtrlrTransferTime(c.System.GlobalBluetoothController)}\n\t\tout.ModemTransferTime = MDuration{V: sumCtrlrTransferTime(c.System.GlobalModemController)}\n\t\tout.WifiTransferTime = MDuration{V: sumCtrlrTransferTime(c.System.GlobalWifiController)}\n\n\t\tif realtime > 0 {\n\t\t\tout.BluetoothTransferTimePercentage = (float32(out.BluetoothTransferTime.V) / float32(realtime)) * 100\n\t\t\tout.ModemTransferTimePercentage = (float32(out.ModemTransferTime.V) / float32(realtime)) * 100\n\t\t\tout.WifiTransferTimePercentage = (float32(out.WifiTransferTime.V) / float32(realtime)) * 100\n\t\t}\n\t\tif bCapMah > 0 {\n\t\t\tout.BluetoothDischargePoints = 100 * float32(c.System.GlobalBluetoothController.GetPowerMah()) / bCapMah\n\t\t\tout.ModemDischargePoints = 100 * float32(c.System.GlobalModemController.GetPowerMah()) / bCapMah\n\t\t\tout.WifiDischargePoints = 100 * float32(c.System.GlobalWifiController.GetPowerMah()) / bCapMah\n\t\t\tif realtime > 0 {\n\t\t\t\tout.BluetoothDischargeRatePerHr = MFloat32{\n\t\t\t\t\tV: out.BluetoothDischargePoints / float32(realtime.Hours()),\n\t\t\t\t}\n\n\t\t\t\tout.ModemDischargeRatePerHr = MFloat32{\n\t\t\t\t\tV: out.ModemDischargePoints / float32(realtime.Hours()),\n\t\t\t\t}\n\n\t\t\t\tout.WifiDischargeRatePerHr = MFloat32{\n\t\t\t\t\tV: out.WifiDischargePoints / float32(realtime.Hours()),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif s := c.System.Battery.GetScreenOffRealtimeMsec(); s > 0 {\n\t\tout.ScreenOffDischargeRatePerHr = MFloat32{V: 60 * 60 * 1000 * c.System.BatteryDischarge.GetScreenOff() / s}\n\t}\n\tif s := c.System.Misc.GetScreenOnTimeMsec(); s > 0 {\n\t\tout.ScreenOnDischargeRatePerHr = MFloat32{V: 60 * 60 * 1000 * c.System.BatteryDischarge.GetScreenOn() / s}\n\t}\n\tif realtime > 0 {\n\t\t// Screen Brightness.\n\t\tout.ScreenBrightness = make(map[string]float32)\n\t\tfor _, sb := range c.System.ScreenBrightness {\n\t\t\tout.ScreenBrightness[sb.GetName().String()] += (sb.GetTimeMsec() / msecsInMinute) / float32(realtime.Hours())\n\t\t}\n\t\t// Signal Strength.\n\t\tout.SignalStrength = make(map[string]float32)\n\t\tfor _, ss := range c.System.SignalStrength {\n\t\t\tout.SignalStrength[ss.GetName().String()] += (ss.GetTimeMsec() / msecsInMinute) / float32(realtime.Hours())\n\t\t}\n\t\t// Wifi Signal Strength.\n\t\tout.WifiSignalStrength = make(map[string]float32)\n\t\tfor _, ws := range c.System.WifiSignalStrength {\n\t\t\tout.WifiSignalStrength[ws.GetName().String()] += (ws.GetTimeMsec() / msecsInMinute) / float32(realtime.Hours())\n\t\t}\n\t\t// Bluetooth States.\n\t\tout.BluetoothState = make(map[string]float32)\n\t\tfor _, bs := range c.System.BluetoothState {\n\t\t\tout.BluetoothState[bs.GetName().String()] += (bs.GetTimeMsec() / msecsInMinute) / float32(realtime.Hours())\n\n\t\t}\n\t\t// DataConnection\n\t\tout.DataConnection = make(map[string]float32)\n\t\tfor _, dc := range c.System.DataConnection {\n\t\t\tout.DataConnection[dc.GetName().String()] += (dc.GetTimeMsec() / msecsInMinute) / float32(realtime.Hours())\n\t\t}\n\t}\n\t// Kernel Wakelocks.\n\tvar kwl []*checkinparse.WakelockInfo\n\tfor _, kw := range c.System.KernelWakelock {\n\t\tif kw.GetName() != \"PowerManagerService.WakeLocks\" && kw.GetTimeMsec() >= 0.01 {\n\t\t\tkwl = append(kwl, &checkinparse.WakelockInfo{\n\t\t\t\tName: kw.GetName(),\n\t\t\t\tDuration: time.Duration(kw.GetTimeMsec()) * time.Millisecond,\n\t\t\t\tCount: kw.GetCount(),\n\t\t\t})\n\t\t}\n\t}\n\tout.AggKernelWakelocks = sumWakelockInfo(kwl, realtime)\n\t// Sorting Kernel Wakelocks by time.\n\tcheckinparse.SortByTime(kwl)\n\tfor _, kw := range kwl {\n\t\tout.KernelWakelocks = append(out.KernelWakelocks, activityData(kw, realtime))\n\t}\n\n\t// Wakeup Reasons.\n\tvar wrl []*checkinparse.WakelockInfo\n\tfor _, wr := range c.System.WakeupReason {\n\t\tif wr.GetTimeMsec() >= 0.01 {\n\t\t\twrl = append(wrl, &checkinparse.WakelockInfo{\n\t\t\t\tName: wr.GetName(),\n\t\t\t\tDuration: time.Duration(wr.GetTimeMsec()) * time.Millisecond,\n\t\t\t\tCount: wr.GetCount(),\n\t\t\t})\n\t\t}\n\t}\n\tout.AggWakeupReasons = sumWakelockInfo(wrl, realtime)\n\n\t// Sorting Wakeup Reasons by count.\n\tcheckinparse.SortByCount(wrl)\n\tfor _, wr := range wrl {\n\t\tout.WakeupReasons = append(out.WakeupReasons, activityData(wr, realtime))\n\t}\n\n\t// Power usage per app.\n\tvar e []*PowerUseData\n\t// Network usage per app.\n\tvar m []*checkinparse.WakelockInfo\n\tvar n []*NetworkTrafficData\n\t// App wakeup count.\n\t// wubn is wakeup alarms broken down by name.\n\tvar wu, wubn []*RateData\n\t// App ANR and crash count.\n\tvar ac []*ANRCrashData\n\t// CPU use per app.\n\tvar cpu []*CPUData\n\t// Wifi activity per app.\n\tvar wfScan []*checkinparse.WakelockInfo\n\tvar wfFull []*checkinparse.WakelockInfo\n\t// Scheduled Jobs (JobScheduler Jobs).\n\tvar sj []*checkinparse.WakelockInfo\n\t// SyncManager Tasks.\n\tvar stl []*checkinparse.WakelockInfo\n\t// Userspace Partial Wakelocks and GPS use.\n\tvar pwl []*checkinparse.WakelockInfo\n\tvar gps []*checkinparse.WakelockInfo\n\t// Camera use per app.\n\tvar ca []*checkinparse.WakelockInfo\n\t// Flashlight use per app.\n\tvar fla []*checkinparse.WakelockInfo\n\tau := make(map[string]int32)\n\tfor _, app := range c.App {\n\t\tif app.GetName() == \"\" {\n\t\t\tapp.Name = proto.String(fmt.Sprintf(\"UNKNOWN_%d\", app.GetUid()))\n\t\t}\n\t\tau[app.GetName()] = app.GetUid()\n\t\tthis := AppData{\n\t\t\tName: app.GetName(),\n\t\t\tUID: app.GetUid(),\n\t\t}\n\n\t\tif pct := 100 * app.PowerUseItem.GetComputedPowerMah() / bCapMah; pct >= 0.01 {\n\t\t\te = append(e, &PowerUseData{\n\t\t\t\tName: app.GetName(),\n\t\t\t\tUID: app.GetUid(),\n\t\t\t\tPercent: pct,\n\t\t\t})\n\t\t}\n\t\tif mat, mac := app.Network.GetMobileActiveTimeMsec(), app.Network.GetMobileActiveCount(); mat >= 0.01 || mac > 0 {\n\t\t\tm = append(m, &checkinparse.WakelockInfo{\n\t\t\t\tName: app.GetName(),\n\t\t\t\tUID: app.GetUid(),\n\t\t\t\tDuration: time.Duration(mat) * time.Millisecond,\n\t\t\t\tCount: mac,\n\t\t\t})\n\t\t}\n\t\twr := app.Network.GetWifiBytesRx()\n\t\twt := app.Network.GetWifiBytesTx()\n\t\tmt := app.Network.GetMobileBytesTx()\n\t\tmr := app.Network.GetMobileBytesRx()\n\t\tif wr+wt+mt+mr >= 0.01 {\n\t\t\tntd := NetworkTrafficData{\n\t\t\t\tName: app.GetName(),\n\t\t\t\tUID: app.GetUid(),\n\t\t\t\tWifiMegaBytes: (wr + wt) / (1024 * 1024),\n\t\t\t\tMobileMegaBytes: (mr + mt) / (1024 * 1024),\n\t\t\t}\n\t\t\tif realtime > 0 {\n\t\t\t\tntd.WifiMegaBytesPerHour = (wr + wt) / (1024 * 1024) / float32(realtime.Hours())\n\t\t\t\tntd.MobileMegaBytesPerHour = (mr + mt) / (1024 * 1024) / float32(realtime.Hours())\n\t\t\t}\n\t\t\tn = append(n, &ntd)\n\t\t\tthis.Network = ntd\n\t\t}\n\t\tif w := app.Apk.GetWakeups(); w > 0 {\n\t\t\trd := RateData{\n\t\t\t\tName: app.GetName(),\n\t\t\t\tUID: app.GetUid(),\n\t\t\t\tCount: w,\n\t\t\t}\n\t\t\tif realtime > 0 {\n\t\t\t\trd.CountPerHr = w / float32(realtime.Hours())\n\t\t\t}\n\t\t\twu = append(wu, &rd)\n\t\t\tthis.Alarms = rd\n\t\t}\n\t\tfor _, w := range app.WakeupAlarm {\n\t\t\tif wc := w.GetCount(); wc > 0 {\n\t\t\t\trd := RateData{\n\t\t\t\t\tName: fmt.Sprintf(\"%s : %s\", app.GetName(), w.GetName()),\n\t\t\t\t\tUID: app.GetUid(),\n\t\t\t\t\tCount: float32(wc),\n\t\t\t\t}\n\t\t\t\tif realtime > 0 {\n\t\t\t\t\trd.CountPerHr = float32(wc) / float32(realtime.Hours())\n\t\t\t\t}\n\t\t\t\twubn = append(wubn, &rd)\n\t\t\t}\n\t\t}\n\t\tfor _, p := range app.Process {\n\t\t\tif an, cr := p.GetAnrs(), p.GetCrashes(); an > 0 || cr > 0 {\n\t\t\t\tac = append(ac, &ANRCrashData{\n\t\t\t\t\tName: fmt.Sprintf(\"%s : %s\", app.GetName(), p.GetName()),\n\t\t\t\t\tUID: app.GetUid(),\n\t\t\t\t\tANRCount: int32(an),\n\t\t\t\t\tCrashCount: int32(cr),\n\t\t\t\t})\n\t\t\t\tout.TotalAppANRCount += int32(an)\n\t\t\t\tout.TotalAppCrashCount += int32(cr)\n\t\t\t}\n\t\t}\n\t\tif realtime > 0 {\n\t\t\tout.TotalAppANRRate = float32(out.TotalAppANRCount) / float32(realtime.Hours())\n\t\t\tout.TotalAppCrashRate = float32(out.TotalAppCrashCount) / float32(realtime.Hours())\n\t\t}\n\n\t\tif ut, st := app.Cpu.GetUserTimeMs(), app.Cpu.GetSystemTimeMs(); ut > 0 || st > 0 {\n\t\t\tcpud := CPUData{\n\t\t\t\tName: app.GetName(),\n\t\t\t\tUID: app.GetUid(),\n\t\t\t\tUserTime: time.Duration(ut) * time.Millisecond,\n\t\t\t\tSystemTime: time.Duration(st) * time.Millisecond,\n\t\t\t}\n\t\t\tif bCapMah > 0 {\n\t\t\t\tcpud.PowerPct = 100 * (app.Cpu.GetPowerMaMs() / (1000 * 60 * 60)) / bCapMah\n\t\t\t}\n\t\t\tcpu = append(cpu, &cpud)\n\t\t\tthis.CPU = cpud\n\n\t\t\tout.AggCPUUsage.UserTime += time.Duration(ut) * time.Millisecond\n\t\t\tout.AggCPUUsage.SystemTime += time.Duration(st) * time.Millisecond\n\t\t\tout.AggCPUUsage.PowerPct += cpud.PowerPct\n\t\t}\n\t\tif wfl := app.Wifi.GetFullWifiLockTimeMsec(); wfl > 0 {\n\t\t\twfFull = append(wfFull, &checkinparse.WakelockInfo{\n\t\t\t\tName: app.GetName(),\n\t\t\t\tUID: app.GetUid(),\n\t\t\t\tDuration: time.Duration(wfl) * time.Millisecond,\n\t\t\t})\n\t\t}\n\t\twst := app.Wifi.GetScanTimeMsec()\n\t\twsc := app.Wifi.GetScanCount()\n\t\tif wst > 0 || wsc > 0 {\n\t\t\twfScan = append(wfScan, &checkinparse.WakelockInfo{\n\t\t\t\tName: app.GetName(),\n\t\t\t\tUID: app.GetUid(),\n\t\t\t\tDuration: time.Duration(wst) * time.Millisecond,\n\t\t\t\tCount: wsc,\n\t\t\t})\n\t\t\tthis.WifiScan = ActivityData{\n\t\t\t\tName: app.GetName(),\n\t\t\t\tUID: app.GetUid(),\n\t\t\t\tCount: wsc,\n\t\t\t\tDuration: time.Duration(wst) * time.Millisecond,\n\t\t\t}\n\t\t\tif realtime > 0 {\n\t\t\t\tthis.WifiScan.CountPerHour = wsc / float32(realtime.Hours())\n\t\t\t\tthis.WifiScan.SecondsPerHr = float32(time.Duration(wst).Seconds()) / float32(realtime.Hours())\n\t\t\t}\n\t\t}\n\n\t\tvar sjt []*checkinparse.WakelockInfo\n\t\tfor _, jst := range app.ScheduledJob {\n\t\t\tsjt = append(sjt, &checkinparse.WakelockInfo{\n\t\t\t\tName: fmt.Sprintf(\"%s : %s\", app.GetName(), jst.GetName()),\n\t\t\t\tUID: app.GetUid(),\n\t\t\t\tDuration: time.Duration(jst.GetTotalTimeMsec()) * time.Millisecond,\n\t\t\t\tCount: jst.GetCount(),\n\t\t\t})\n\t\t}\n\t\tsj = append(sj, sjt...)\n\t\tthis.ScheduledJobs = sumWakelockInfo(sjt, realtime)\n\t\tthis.ScheduledJobs.Name = app.GetName()\n\t\tthis.ScheduledJobs.UID = app.GetUid()\n\n\t\tvar stlt []*checkinparse.WakelockInfo\n\t\tfor _, st := range app.Sync {\n\t\t\tstlt = append(stlt, &checkinparse.WakelockInfo{\n\t\t\t\tName: fmt.Sprintf(\"%s : %s\", app.GetName(), st.GetName()),\n\t\t\t\tUID: app.GetUid(),\n\t\t\t\tDuration: time.Duration(st.GetTotalTimeMsec()) * time.Millisecond,\n\t\t\t\tCount: st.GetCount(),\n\t\t\t})\n\t\t}\n\t\tstl = append(stl, stlt...)\n\t\tthis.Syncs = sumWakelockInfo(stlt, realtime)\n\t\tthis.Syncs.Name = app.GetName()\n\t\tthis.Syncs.UID = app.GetUid()\n\n\t\tvar pwlt []*checkinparse.WakelockInfo\n\t\tfor _, pw := range app.Wakelock {\n\t\t\tw := &checkinparse.WakelockInfo{\n\t\t\t\tName: fmt.Sprintf(\"%s : %s\", app.GetName(), pw.GetName()),\n\t\t\t\tUID: app.GetUid(),\n\t\t\t\tDuration: time.Duration(pw.GetPartialTimeMsec()) * time.Millisecond,\n\t\t\t\tCount: pw.GetPartialCount(),\n\t\t\t}\n\t\t\tif c.GetReportVersion() >= 20 {\n\t\t\t\t// The values are only valid in v20+.\n\t\t\t\tw.MaxDuration = time.Duration(pw.GetPartialMaxDurationMsec()) * time.Millisecond\n\t\t\t\tif c.GetReportVersion() >= 21 {\n\t\t\t\t\t// The values are only valid in v21+.\n\t\t\t\t\tw.TotalDuration = time.Duration(pw.GetPartialTotalDurationMsec()) * time.Millisecond\n\t\t\t\t}\n\t\t\t}\n\t\t\tpwlt = append(pwlt, w)\n\t\t}\n\t\tpwl = append(pwl, pwlt...)\n\t\tthis.PartialWakelocks = sumWakelockInfo(pwlt, realtime)\n\t\tthis.PartialWakelocks.Name = app.GetName()\n\t\tthis.PartialWakelocks.UID = app.GetUid()\n\n\t\tvar gpst []*checkinparse.WakelockInfo\n\t\tfor _, s := range app.Sensor {\n\t\t\tif s.GetNumber() == bugreportutils.GPSSensorNumber {\n\t\t\t\tgpst = append(gpst, &checkinparse.WakelockInfo{\n\t\t\t\t\tName: app.GetName(),\n\t\t\t\t\tUID: app.GetUid(),\n\t\t\t\t\tDuration: time.Duration(s.GetTotalTimeMsec()) * time.Millisecond,\n\t\t\t\t\tCount: s.GetCount(),\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tgps = append(gps, gpst...)\n\t\tthis.GPSUse = sumWakelockInfo(gpst, realtime)\n\t\tthis.GPSUse.Name = app.GetName()\n\t\tthis.GPSUse.UID = app.GetUid()\n\n\t\tif cat, cac := app.Camera.GetTotalTimeMsec(), app.Camera.GetCount(); cat > 0 || cac > 0 {\n\t\t\tca = append(ca, &checkinparse.WakelockInfo{\n\t\t\t\tName: app.GetName(),\n\t\t\t\tUID: app.GetUid(),\n\t\t\t\tDuration: time.Duration(cat) * time.Millisecond,\n\t\t\t\tCount: cac,\n\t\t\t})\n\t\t}\n\t\tif flt, flc := app.Flashlight.GetTotalTimeMsec(), app.Flashlight.GetCount(); flt > 0 || flc > 0 {\n\t\t\tfla = append(fla, &checkinparse.WakelockInfo{\n\t\t\t\tName: app.GetName(),\n\t\t\t\tUID: app.GetUid(),\n\t\t\t\tDuration: time.Duration(flt) * time.Millisecond,\n\t\t\t\tCount: flc,\n\t\t\t})\n\t\t}\n\n\t\tif c.GetReportVersion() >= 17 {\n\t\t\t// The data is only valid in v17+.\n\t\t\tbkg := app.GetStateTime().GetBackgroundTimeMsec()\n\t\t\tcch := app.GetStateTime().GetCachedTimeMsec()\n\t\t\tfre := app.GetStateTime().GetForegroundTimeMsec()\n\t\t\tfrs := app.GetStateTime().GetForegroundServiceTimeMsec()\n\t\t\ttop := app.GetStateTime().GetTopTimeMsec()\n\t\t\ttps := app.GetStateTime().GetTopSleepingTimeMsec()\n\t\t\tif bkg > 0 || cch > 0 || fre > 0 || frs > 0 || top > 0 || tps > 0 {\n\t\t\t\tout.AppStates = append(out.AppStates, stateData{\n\t\t\t\t\tName: app.GetName(),\n\t\t\t\t\tUID: app.GetUid(),\n\t\t\t\t\tBackground: MDuration{V: time.Duration(bkg) * time.Millisecond},\n\t\t\t\t\tCached: MDuration{V: time.Duration(cch) * time.Millisecond},\n\t\t\t\t\tForeground: MDuration{V: time.Duration(fre) * time.Millisecond},\n\t\t\t\t\tForegroundService: MDuration{V: time.Duration(frs) * time.Millisecond},\n\t\t\t\t\tTop: MDuration{V: time.Duration(top) * time.Millisecond},\n\t\t\t\t\tTopSleeping: MDuration{V: time.Duration(tps) * time.Millisecond},\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tout.AggregatedApps = append(out.AggregatedApps, this)\n\t}\n\tfor _, pwi := range c.System.PowerUseItem {\n\t\tif pwi.GetName() == bspb.BatteryStats_System_PowerUseItem_APP {\n\t\t\t// We have the apps split up in the preceding for loop, and the APP entry is just the sum of all of them, so we skip it here.\n\t\t\tcontinue\n\t\t}\n\t\tif pct := 100 * pwi.GetComputedPowerMah() / bCapMah; pct >= 0.01 {\n\t\t\te = append(e, &PowerUseData{\n\t\t\t\tName: pwi.GetName().String(),\n\t\t\t\tPercent: pct,\n\t\t\t})\n\t\t}\n\t}\n\n\tsort.Sort(byPercent(e))\n\tfor _, ent := range e {\n\t\tout.DevicePowerEstimates = append(out.DevicePowerEstimates, *ent)\n\t}\n\n\tcheckinparse.SortByTime(m)\n\tfor _, mad := range m {\n\t\tout.TopMobileActiveApps = append(out.TopMobileActiveApps, activityData(mad, realtime))\n\t}\n\n\tfor _, ntd := range n {\n\t\tif ntd.MobileMegaBytes >= 0.01 {\n\t\t\tout.TopMobileTrafficApps = append(out.TopMobileTrafficApps, *ntd)\n\t\t}\n\t}\n\tsort.Sort(ByMobileBytes(out.TopMobileTrafficApps))\n\n\tfor _, ntd := range n {\n\t\tif ntd.WifiMegaBytes >= 0.01 {\n\t\t\tout.TopWifiTrafficApps = append(out.TopWifiTrafficApps, *ntd)\n\t\t}\n\t}\n\tsort.Sort(ByWifiBytes(out.TopWifiTrafficApps))\n\n\tsort.Sort(byCount(wu))\n\tfor _, w := range wu {\n\t\tout.AppWakeups = append(out.AppWakeups, *w)\n\t\tout.AggAppWakeups.Count += w.Count\n\t}\n\tif realtime > 0 {\n\t\tout.AggAppWakeups.CountPerHr = out.AggAppWakeups.Count / float32(realtime.Hours())\n\t\tout.TotalAppWakeupsPerHr = out.AggAppWakeups.CountPerHr\n\t}\n\tsort.Sort(byCount(wubn))\n\tfor _, w := range wubn {\n\t\tout.AppWakeupsByAlarmName = append(out.AppWakeupsByAlarmName, *w)\n\t}\n\n\tsort.Sort(byCrashThenANR(ac))\n\tfor _, x := range ac {\n\t\tout.ANRAndCrash = append(out.ANRAndCrash, *x)\n\t}\n\n\tfor _, cp := range cpu {\n\t\tout.CPUUsage = append(out.CPUUsage, *cp)\n\t\tout.TotalAppCPUPowerPct += cp.PowerPct\n\t}\n\tsort.Sort(ByCPUUsage(out.CPUUsage))\n\n\tcheckinparse.SortByTime(wfScan)\n\tfor _, w := range wfScan {\n\t\tout.WifiScanActivity = append(out.WifiScanActivity, activityData(w, realtime))\n\t}\n\tout.AggWifiScanActivity = sumWakelockInfo(wfScan, realtime)\n\n\tcheckinparse.SortByTime(wfFull)\n\tfor _, w := range wfFull {\n\t\tout.WifiFullLockActivity = append(out.WifiFullLockActivity, activityData(w, realtime))\n\t}\n\tout.AggWifiFullLockActivity = sumWakelockInfo(wfFull, realtime)\n\n\t// Sorting JobScheduler Jobs by time.\n\tcheckinparse.SortByTime(sj)\n\tfor _, jst := range sj {\n\t\tout.ScheduledJobs = append(out.ScheduledJobs, activityData(jst, realtime))\n\t\tif realtime > 0 {\n\t\t\tout.TotalAppScheduledJobsPerHr += float32(jst.Duration.Seconds()) / float32(realtime.Hours())\n\t\t}\n\t}\n\tout.AggScheduledJobs = sumWakelockInfo(sj, realtime)\n\n\t// Sorting SyncManager Tasks by time.\n\tcheckinparse.SortByTime(stl)\n\tfor _, st := range stl {\n\t\tout.SyncTasks = append(out.SyncTasks, activityData(st, realtime))\n\t\tif realtime > 0 {\n\t\t\tout.TotalAppSyncsPerHr += float32(st.Duration.Seconds()) / float32(realtime.Hours())\n\t\t}\n\t}\n\tout.AggSyncTasks = sumWakelockInfo(stl, realtime)\n\n\t// Sorting Partial Wakelocks by time.\n\tcheckinparse.SortByTime(pwl)\n\tfor _, pw := range pwl {\n\t\tout.UserspaceWakelocks = append(out.UserspaceWakelocks, activityData(pw, realtime))\n\t}\n\n\t// Sort GPS use by time.\n\tcheckinparse.SortByTime(gps)\n\tfor _, g := range gps {\n\t\tout.GPSUse = append(out.GPSUse, activityData(g, realtime))\n\t\tif realtime > 0 {\n\t\t\tout.TotalAppGPSUseTimePerHour += float32(g.Duration.Seconds()) / float32(realtime.Hours())\n\t\t}\n\t}\n\tout.AggGPSUse = sumWakelockInfo(gps, realtime)\n\n\t// Sort camera use by time.\n\tcheckinparse.SortByTime(ca)\n\tfor _, c := range ca {\n\t\tout.CameraUse = append(out.CameraUse, activityData(c, realtime))\n\t\tif realtime > 0 {\n\t\t\tout.TotalAppCameraUsePerHr += float32(c.Duration.Seconds()) / float32(realtime.Hours())\n\t\t}\n\t}\n\tout.AggCameraUse = sumWakelockInfo(ca, realtime)\n\n\t// Sort flashlight use by time.\n\tcheckinparse.SortByTime(fla)\n\tfor _, f := range fla {\n\t\tout.FlashlightUse = append(out.FlashlightUse, activityData(f, realtime))\n\t}\n\tout.AggFlashlightUse = sumWakelockInfo(fla, realtime)\n\n\tsort.Sort(byState(out.AppStates))\n\n\treturn out\n}", "title": "" }, { "docid": "6d6d57ec41bdc613de7b2bef6c5729ca", "score": "0.4404643", "text": "func (m *Minicap) prepare() (mi MinicapInfo, err error) {\n\tif err = m.pushFiles(); err != nil {\n\t\treturn\n\t}\n\tout, err := m.RunCommand(\"LD_LIBRARY_PATH=/data/local/tmp\", \"/data/local/tmp/minicap\", \"-i\")\n\tif err != nil {\n\t\treturn\n\t}\n\t// log.Println(out)\n\terr = json.Unmarshal([]byte(out), &mi)\n\treturn\n}", "title": "" }, { "docid": "983f52c789db86bd9daac6bdba503091", "score": "0.4397632", "text": "func (a *AppStatistics) Collect() (map[string]string, map[string]interface{}) {\n\t// collect measurements\n\truntime.ReadMemStats(&a.memStats)\n\n\tfields := map[string]interface{}{\n\t\t\"alloc\": int(a.memStats.Alloc),\n\t\t\"total_alloc\": int(a.memStats.TotalAlloc),\n\t\t\"sys\": int(a.memStats.Sys),\n\t\t\"mallocs\": int(a.memStats.Mallocs),\n\t\t\"frees\": int(a.memStats.Frees),\n\t\t\"heap_alloc\": int(a.memStats.HeapAlloc),\n\t\t\"heap_sys\": int(a.memStats.HeapSys),\n\t\t\"heap_objects\": int(a.memStats.HeapObjects),\n\t\t\"next_gc\": int(a.memStats.NextGC),\n\t\t\"num_goroutine\": runtime.NumGoroutine(),\n\t}\n\n\treturn nil, fields\n}", "title": "" }, { "docid": "32c5c8b1bbf0a65486282db7d9921f2e", "score": "0.43949106", "text": "func StoreBillingSnapshots(regionInfo []RegionInfo, billingDirPath string) {\n\t//\n\t// TODO: Add ability to write to S3\n\t//\n\tnow := time.Now()\n\thour := now.Hour()\n\tymd := now.Format(\"01-02-2006\")\n\tvar dailyEntry BillingDailyEntry\n\n\tif _, err := os.Stat(billingDirPath); os.IsNotExist(err) {\n\t\terr = os.MkdirAll(billingDirPath, os.ModePerm)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tsnapshotFilename := fmt.Sprintf(\"%s/%s.json\", billingDirPath, ymd)\n\tdailyEntry = ReadSnapshotInfo(snapshotFilename)\n\n\tvar hourlyEntry BillingHourEntry\n\tvar regionEntry BillingRegionEntry\n\tvar ok bool\n\n\thourlyEntry, ok = dailyEntry[ymd]\n\tif !ok {\n\t\thourlyEntry = make(BillingHourEntry)\n\t}\n\n\tregionEntry, ok = hourlyEntry[hour]\n\tif !ok {\n\t\tregionEntry = make(BillingRegionEntry)\n\t}\n\n\tfor _, r := range regionInfo {\n\t\tvar instancesEntry BillingInstancesEntry\n\t\tinstancesEntry, ok = regionEntry[r.RegionName]\n\t\tif !ok {\n\t\t\tinstancesEntry = make(BillingInstancesEntry)\n\t\t}\n\t\tfor _, bSnap := range r.BillingSnapshots {\n\t\t\tinstancesEntry[bSnap.ID] = bSnap\n\t\t}\n\t\tregionEntry[r.RegionName] = instancesEntry\n\t}\n\n\thourlyEntry[hour] = regionEntry\n\tdailyEntry[ymd] = hourlyEntry\n\n\terr := writeSnapshotInfo(snapshotFilename, dailyEntry)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "a6afc40383368d8478e4eaf10caaa0cb", "score": "0.43795514", "text": "func CollectInfoMetrics(ch chan<- prometheus.Metric, device Device) {\n\tinfo, err := getDevInfo(device)\n\tif err != nil {\n\t\tlog.Infoln(\"error collecting device info for \"+device.Name+\":\", err)\n\t\treturn\n\t}\n\tcommonLabels := map[string]string{\n\t\t\"disk\": device.Name,\n\t\t\"type\": device.Type,\n\t}\n\tinfoLabels := mergeMaps(commonLabels, info.Attributes)\n\tdescInfo := prometheus.NewDesc(\"smartmon_device_info\", \"smartmon_device_info\", noLabels, infoLabels)\n\tch <- prometheus.MustNewConstMetric(descInfo, prometheus.GaugeValue, 1.0)\n\tdescAvailable := prometheus.NewDesc(\"smartmon_device_smart_available\", \"smartmon_device_smart_available\", noLabels, commonLabels)\n\tch <- prometheus.MustNewConstMetric(descAvailable, prometheus.GaugeValue, boolToMetric(info.Available))\n\tdescEnabled := prometheus.NewDesc(\"smartmon_device_smart_enabled\", \"smartmon_device_smart_enabled\", noLabels, commonLabels)\n\tch <- prometheus.MustNewConstMetric(descEnabled, prometheus.GaugeValue, boolToMetric(info.Enabled))\n\tdescHealthy := prometheus.NewDesc(\"smartmon_device_smart_healthy\", \"smartmon_device_smart_healthy\", noLabels, commonLabels)\n\tch <- prometheus.MustNewConstMetric(descHealthy, prometheus.GaugeValue, boolToMetric(info.Healthy))\n}", "title": "" }, { "docid": "2d12cb559b844d5391bd0841d2f98755", "score": "0.43788314", "text": "func NewServicePlanInfo()(*ServicePlanInfo) {\n m := &ServicePlanInfo{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "591dbcbfe387e7eb6a1bccb0942a1e0a", "score": "0.43723863", "text": "func subscriptionStat(db *sqlx.DB) ([]BaseStr, error) {\n\tvar s []BaseStr\n\terr := db.Select(&s, `SELECT group_field, req_count, resp_count, buy_count, click_count,\n if (buy_count = 0, 0, toFloat64(round(click_count / buy_count * 100, 3))) as ctr,\n if (buy_count = 0, 0, toFloat64(round(buyout_sum / buy_count * 1000, 3))) AS cpm,\n if (buy_count = 0, 0, toFloat64(round(first_sum / buy_count * 1000, 3))) AS first_price,\n if (click_count = 0, 0 , toFloat64(round(buyout_sum / click_count, 2))) AS click_price_ssp,\n if (click_count = 0, 0, toFloat64(round(click_sum / click_count, 2))) as click_price_dsp,\n\t round(buyout_sum, 2) as ssp_flow,\n\t round(click_sum, 2) as dsp_flow,\n\t round((dsp_flow - ssp_flow), 2) as profit\n FROM (\n\t SELECT dateDiff('day', toDate(extract(visitParamExtractRaw(req_user_ext, 'subscriptionDateTime'), '(\\\\d{4}-\\\\d{2}-\\\\d{2})')), (toDate(now()) - 1)) AS group_field , count(*) as req_count\n FROM bid_requests\n WHERE req_site_name != '' AND req_ssp_id IN (2) AND toDate(req_date_time) = (toDate(now()) - 1)\n GROUP BY group_field \n )\n ALL LEFT JOIN (\n SELECT group_field , resp_count, buy_count, click_count, buyout_sum, click_sum, first_sum\n FROM (\n SELECT dateDiff('day', toDate(extract(visitParamExtractRaw(req_user_ext, 'subscriptionDateTime'), '(\\\\d{4}-\\\\d{2}-\\\\d{2})')), (toDate(now()) - 1)) AS group_field, count(*) as resp_count\n FROM bid_responses\n WHERE req_site_name != '' AND req_ssp_id IN (2) AND toDate(resp_date_time) = (toDate(now()) - 1)\n GROUP BY group_field \n )\n ALL LEFT JOIN (\n \t SELECT group_field , buy_count, click_count, buyout_sum, click_sum, first_sum\n \t FROM (\n \t SELECT dateDiff('day', toDate(extract(visitParamExtractRaw(req_user_ext, 'subscriptionDateTime'), '(\\\\d{4}-\\\\d{2}-\\\\d{2})')), (toDate(now()) - 1)) AS group_field, count(*) as buy_count, sum(buyout_price) as buyout_sum, sum(resp_seat_bid_bid_price) as first_sum\n FROM buyouts\n WHERE req_site_name != '' AND req_ssp_id IN (2) AND toDate(buyout_date_time) = (toDate(now()) - 1)\n GROUP BY group_field\n )\n\t ALL LEFT JOIN (\n\t \t\t SELECT dateDiff('day', toDate(extract(visitParamExtractRaw(req_user_ext, 'subscriptionDateTime'), '(\\\\d{4}-\\\\d{2}-\\\\d{2})')), (toDate(now()) - 1)) AS group_field, count(*) as click_count, sum(click_price) as click_sum\n\t \t FROM clicks\n\t WHERE req_site_name != '' AND req_ssp_id IN (2) AND toDate(buyout_date_time) = (toDate(now()) - 1)\n\t GROUP BY group_field\n\t )\n\t USING(group_field)\n\t )\n\t USING(group_field)\n )\n\t\t\t\tUSING(group_field)`)\n\treturn s, err\n}", "title": "" }, { "docid": "2fd4f2e51ef96e796dc8559ac5ff529b", "score": "0.4368953", "text": "func (_OffchainAggregator *OffchainAggregatorSession) GetBilling() (struct {\n\tMaximumGasPrice uint32\n\tReasonableGasPrice uint32\n\tMicroLinkPerEth uint32\n\tLinkGweiPerObservation uint32\n\tLinkGweiPerTransmission uint32\n}, error) {\n\treturn _OffchainAggregator.Contract.GetBilling(&_OffchainAggregator.CallOpts)\n}", "title": "" }, { "docid": "39110ddbe512846e6978be654a2b2ef6", "score": "0.43678638", "text": "func (r Network_Bandwidth_Version1_Allotment) GetBillingCyclePrivateBandwidthUsage() (resp datatypes.Network_Bandwidth_Usage, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Bandwidth_Version1_Allotment\", \"getBillingCyclePrivateBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "d3457b9e616646009530565b325d3d27", "score": "0.43662688", "text": "func (_OffchainAggregator *OffchainAggregatorCallerSession) GetBilling() (struct {\n\tMaximumGasPrice uint32\n\tReasonableGasPrice uint32\n\tMicroLinkPerEth uint32\n\tLinkGweiPerObservation uint32\n\tLinkGweiPerTransmission uint32\n}, error) {\n\treturn _OffchainAggregator.Contract.GetBilling(&_OffchainAggregator.CallOpts)\n}", "title": "" }, { "docid": "6cdf49e0b702a21fdb7cd23ed6ecfeaa", "score": "0.4363914", "text": "func (m *CPU) CollectData() (string, map[string]*MetricValue, error) {\n\tidentifiers := map[string]string{\n\t\t\"real\": \"hw.physicalcpu\",\n\t\t\"total\": \"hw.logicalcpu\",\n\t\t\"mhz\": \"hw.cpufrequency\",\n\t\t\"vendor_id\": \"machdep.cpu.vendor\",\n\t\t\"model_name\": \"machdep.cpu.brand_string\",\n\t\t\"model\": \"machdep.cpu.model\",\n\t\t\"family\": \"machdep.cpu.family\",\n\t\t\"stepping\": \"machdep.cpu.stepping\",\n\t\t\"flags\": \"machdep.cpu.features\",\n\t}\n\n\tdata := make(map[string]*MetricValue)\n\n\tfor metric, sysMetric := range identifiers {\n\t\tval, err := GetCPUMetric(sysMetric)\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tdata[metric] = &MetricValue{val}\n\t}\n\n\t// Convert the mhz field from hertz to mhz\n\tmhz, err := strconv.Atoi((*data[\"mhz\"]).Val)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tmhzstr := strconv.Itoa(mhz / 1000000)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t(*data[\"mhz\"]).Val = mhzstr\n\n\treturn m.Name, data, nil\n}", "title": "" }, { "docid": "acfbf6201f09dc6e8722fb16350b1281", "score": "0.43628603", "text": "func CollectData() (Data, error) {\n\td := make(Data)\n\ttop, err := top.CollectData()\n\tif err != nil {\n\t\treturn d, err\n\t}\n\td.Merge(top)\n\tdisk, err := disk.CollectData()\n\tif err != nil {\n\t\treturn d, err\n\t}\n\td.Merge(disk)\n\treturn d, nil\n}", "title": "" }, { "docid": "ad24208dacc322240bd11e2d51225818", "score": "0.4360377", "text": "func (r *Recover) prepareData(d *inter.FileName, end int64, c *client.CFSClient, m *db.MetaConf) {\n\t// find each suitable table dir files\n\tr.SqlExecutor = m.Copy()\n\tr.maxPkgSize = r.SqlExecutor.GetMaxAllowedPackage()\n\n\t// init download file counter\n\tr.downCounter = &sync.WaitGroup{}\n\tr.downCounter.Add(1)\n\n\t// init tar file counter\n\tr.tarCounter = &sync.WaitGroup{}\n\tr.tarCounter.Add(1)\n\n\t// init parse file counter\n\tr.parseCounter = &sync.WaitGroup{}\n\tr.parseCounter.Add(1)\n\n\t// check\n\tr.check = &bpct.CheckPoint{\n\t\tTable: r.Table,\n\t}\n\n\t// day max\n\tvar dmax = int64(0)\n\t// find day files\n\tr.remoteDayFiles, dmax = c.SelectFiles(d, inter.DAY, inter.LogSuffix, 0, end)\n\n\t// filter day files\n\tr.remoteDayFiles = r.filterFiles(r.remoteDayFiles, inter.DAY)\n\n\tvar hmax = int64(0)\n\t// find hour files\n\tr.remoteHourTarFiles, hmax = c.SelectFiles(d, inter.HOUR, inter.TarSuffix, dmax, end)\n\n\tvar mMax = max(dmax, hmax)\n\t// find minute files\n\tr.remoteMinTarFiles, mMax = c.SelectFiles(d, inter.MINUTE, inter.TarSuffix, mMax, end)\n\n\tvar sMax = max(dmax, hmax, mMax)\n\t// find second files\n\tr.remoteSecTarFiles, _ = c.SelectFiles(d, inter.SECOND, inter.TarSuffix, sMax, end)\n\n\tr.Client = c\n\n\tr.buffer = bytes.NewBuffer(nil)\n\n\tr.logFileChan = make(chan *inter.FileName, 64)\n\n\tr.tarFileChan = make(chan *inter.FileName, 64)\n\n\tr.downFileChan = make(chan *inter.FileName, 64)\n\n\tr.parser = replication.NewBinlogParser()\n\n\tr.isEmpty = false\n}", "title": "" }, { "docid": "3f6b3edaba4fba4610d8d053c5d30b37", "score": "0.43598795", "text": "func (s *BasepowerbuilderListener) EnterRelease_information(ctx *Release_informationContext) {}", "title": "" }, { "docid": "539260f032a34e26d9ab02c0dc561ece", "score": "0.43579388", "text": "func newDetailsData(c contextInformation, err error, stack StackTrace) DetailsData {\n\thostname, e := os.Hostname()\n\tif e != nil {\n\t\thostname = \"not available\"\n\t}\n\n\treturn DetailsData{\n\t\tMachineName: hostname,\n\t\tVersion: c.Version,\n\t\tError: newErrorData(err, stack),\n\t\tTags: c.Tags,\n\t\tUserCustomData: c.CustomData,\n\t\tRequest: newRequestData(c.Request),\n\t\tUser: User{c.User},\n\t\tContext: Context{c.Identifier()},\n\t\tClient: ClientData{\"raygun4go\", packageVersion, \"https://github.com/MindscapeHQ/raygun4go\"},\n\t}\n}", "title": "" }, { "docid": "1e5da7c809bd0359e0db833725b06af2", "score": "0.43540716", "text": "func (sg *SGClient) ComponentDetails(appName string, compName string) error {\n\n\trelease, err := sg.GetRelease(appName, compName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(`\n---- Release Information ----\nApplication: ` + appName + `\nComponent: ` + compName + `\nCommited: ` + strconv.FormatBool(release.Committed) + `\nRetired: ` + strconv.FormatBool(release.Retired) + `\nInstances: ` + strconv.Itoa(release.InstanceCount) + `\nTermination Grace Period: ` + strconv.Itoa(release.TerminationGracePeriod) + `\n Tags:\n --------------`)\n\n\tw := new(tabwriter.Writer)\n\tw.Init(os.Stdout, 0, 8, 0, '\\t', 0)\n\tfmt.Fprintln(w, \" Key\\tValue\\t\")\n\n\tfor Key, value := range release.Tags {\n\t\tfmt.Fprintln(w, \" \"+Key+\"\\t\"+value+\"\\t\")\n\t}\n\tw.Flush()\n\n\tfmt.Println(\"External Addresses:\")\n\tcomp, err := sg.GetComponent(compName, appName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif comp.Addresses != nil {\n\t\tfor _, addr := range comp.Addresses.External {\n\t\t\tfmt.Println(` -` + addr.Address + ` -(container port)--> ` + addr.Port + ``)\n\t\t}\n\t} else {\n\t\tfmt.Println(` - None`)\n\t}\n\n\tfmt.Println(\"Internal Addresses:\")\n\tif comp.Addresses != nil {\n\t\tfor _, addr := range comp.Addresses.Internal {\n\t\t\tfmt.Println(` -` + addr.Address + ` -(container port)--> ` + addr.Port + ``)\n\t\t}\n\t} else {\n\t\tfmt.Println(` - None`)\n\t}\n\n\tfmt.Println(`\n Volumes:\n --------------`)\n\tif len(release.Volumes) == 0 {\n\t\tfmt.Println(` ` + noData + ``)\n\t}\n\n\tfor _, volume := range release.Volumes {\n\t\tname := checkForNilString(volume.Name)\n\t\tsize := strconv.Itoa(volume.Size)\n\t\tvtype := volume.Type\n\t\tfmt.Println(` Name: ` + name + ` Size: ` + size + ` Type: ` + vtype + ``)\n\t}\n\n\t// Containers\n\tfmt.Println(`\n Containers:`)\n\tif len(release.Containers) == 0 {\n\t\tfmt.Println(\" \" + noData + \"\")\n\t}\n\tfor _, container := range release.Containers {\n\t\tfmt.Println(\" **************\")\n\t\t// Build vars\n\t\tcpuMax := strconv.Itoa(int(container.CPU.Max.Cores()))\n\t\tcpuMin := strconv.Itoa(int(container.CPU.Min.Cores()))\n\t\tramMax := strconv.Itoa(int(container.RAM.Max.Mebibytes()))\n\t\tramMin := strconv.Itoa(int(container.RAM.Min.Mebibytes()))\n\n\t\tfmt.Println(` Container: ` + container.Name + `\n Image: ` + container.Image + `\n Resources: CPU: max ` + cpuMax + ` / min ` + cpuMin + ` RAM: max ` + ramMax + ` / min ` + ramMin + ``)\n\n\t\t//Mounts\n\n\t\tfmt.Println(` Mounts:\n --------------`)\n\t\tif len(container.Mounts) == 0 {\n\t\t\tfmt.Println(` ` + noData + ``)\n\t\t}\n\n\t\tfor _, mount := range container.Mounts {\n\t\t\tpath := mount.Path\n\t\t\tvolume := checkForNilString(mount.Volume)\n\t\t\tfmt.Println(` Path: ` + path + ` Volume: ` + volume + ``)\n\t\t}\n\n\t\t// Ports\n\n\t\tfmt.Println(`\n Ports:\n --------------`)\n\t\tif len(container.Ports) == 0 {\n\t\t\tfmt.Println(` ` + noData + ``)\n\t\t}\n\n\t\tfor _, port := range container.Ports {\n\t\t\tprotocal := port.Protocol\n\t\t\tpnumber := strconv.Itoa(port.Number)\n\t\t\tepnumber := strconv.Itoa(port.ExternalNumber)\n\t\t\tpublic := strconv.FormatBool(port.Public)\n\t\t\tentrypoint := checkForNilString(port.EntrypointDomain)\n\t\t\tfmt.Println(` --Protocol: ` + protocal + ` Public: ` + public + ` Entrypoint: ` + entrypoint + ``)\n\t\t\tfmt.Println(` Port Number: ` + pnumber + ` Ext Port: ` + epnumber + ``)\n\t\t}\n\n\t\t//ENV\n\n\t\tfmt.Println(`\n ENV Vars:\n --------------`)\n\t\tif len(container.Env) == 0 {\n\t\t\tfmt.Println(` ` + noData + ``)\n\t\t}\n\n\t\tfor _, env := range container.Env {\n\t\t\tname := env.Name\n\t\t\tvalue := env.Value\n\t\t\tfmt.Println(` Name: ` + name + ` Value: ` + value + ``)\n\t\t}\n\n\t\t//Mounts\n\n\t\tfmt.Println(`\n Commands:\n --------------`)\n\t\tif len(container.Command) == 0 {\n\t\t\tfmt.Println(` ` + noData + ``)\n\t\t}\n\n\t\tfor _, command := range container.Command {\n\t\t\tfmt.Println(` --- ` + command + ``)\n\t\t}\n\t\tfmt.Println(\" **************\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7a6f7976f3056a88b0d48f897e78bad8", "score": "0.43480733", "text": "func (s *postgres) GetUnhandledBilling() map[uint64]Unhandled {\n\tm := make(map[uint64]Unhandled)\n\trows, err := s.dbh.Query(\"SELECT id, payment_subject_id, payment_sum, payment_id, payment_channel, payment_direction, payment_vat FROM payments WHERE tstamp_billing is null\")\n if err != nil {\n\t\tlog.Error(\"Postgres: \" + err.Error())\n return nil\n }\n defer rows.Close()\n for rows.Next() {\n\n var id uint64\n var sum string\n var channel,cid,pid,t,vat string\n if err := rows.Scan(&id,&cid,&sum,&pid,&channel,&t,&vat); err != nil {\n\t\tlog.Error(\"Postgres: \" + err.Error())\n return nil\n }\n sum = strings.Replace(sum, \"$\", \"\", -1)\n sum = strings.Replace(sum, \",\", \"\", -1)\n\tvalue, _ := strconv.ParseFloat(sum, 32)\n sumFloat := float32(value)\n\n\t\tm[id] = Unhandled{\n\t\t\tCid: cid,\n\t\t\tSum: sumFloat,\n\t\t\tPaymentId: pid,\n\t\t\tVat: vat,\n\t\t\tChannel: channel,\n\t\t\tType: t,\n\t\t}\n }\n return m\n}", "title": "" }, { "docid": "4a93fbf03332cf2ba458607c61bc5e7d", "score": "0.43447223", "text": "func (ball *NBA_Team) get_data() {\n\n // We must first get the city abbrev in order to get the transaction data\n ball.get_abbrev()\n\n team_url := strings.Join([]string{espnUrl,ball.abbrev}, \"\")\n\n // We then scarpe ESPN for the transaction data\n ball.baseScrape(team_url, appendTransaction)\n}", "title": "" }, { "docid": "9abb237fa7af860e285ec8f8bbab9852", "score": "0.43412444", "text": "func (cg *CgroupV2) GetMemoryData(pid int, cgPath string) (*rspec.LinuxMemory, error) {\n\treturn nil, fmt.Errorf(\"unimplemented yet\")\n}", "title": "" }, { "docid": "0dbc6f48b2d11ea3da837a8c8891ade0", "score": "0.43300706", "text": "func (r *dpRepo) GetObjectDetails(domainName, objectClassName, objectName string) ([]byte, error) {\n\tlogging.LogDebugf(\"repo/dp/GetObjectDetails('%s', '%s', '%s')\",\n\t\tdomainName, objectClassName, objectName)\n\tswitch r.dataPowerAppliance.DpManagmentInterface() {\n\tcase config.DpInterfaceRest:\n\t\t// 1. Start export (send export request)\n\t\texportRequestJSON := fmt.Sprintf(`{\"Export\":\n\t\t {\n\t\t \"Format\":\"ZIP\",\n\t\t \"UserComment\":\"Created by dpcmder.\",\n\t\t \"AllFiles\":\"off\",\n\t\t \"Persisted\":\"off\",\n\t\t \"IncludeInternalFiles\":\"off\",\n\t\t\t\t\"Object\":\n\t\t [\n\t\t {\n\t\t \"class\":\"%s\",\n\t\t \"name\":\"%s\",\n\t\t \"ref-objects\":\"on\",\n\t\t \"ref-files\":\"off\",\n\t\t \"include-debug\":\"off\"\n\t\t }\n\t\t ]\n\t\t }\n\t\t}`, objectClassName, objectName)\n\t\tlocationURL, _, err := r.restPostForResult(\n\t\t\t\"/mgmt/actionqueue/\"+domainName,\n\t\t\texportRequestJSON,\n\t\t\t\"/Export/status\",\n\t\t\t\"Action request accepted.\",\n\t\t\t\"/_links/location/href\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttimeStart := time.Now()\n\t\tfor {\n\t\t\t// 2. Check for current status of export request\n\t\t\tstatus, exportResponseJSON, err := r.restGetForOneResult(locationURL, \"/status\")\n\t\t\tlogging.LogDebugf(\"repo/dp/GetObjectDetails() status: '%s'\", status)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tswitch status {\n\t\t\tcase \"started\":\n\t\t\t\tif time.Since(timeStart) > 120*time.Second {\n\t\t\t\t\tlogging.LogDebugf(\"repo/dp/GetObjectDetails() waiting for export since %v, giving up.\\n last exportResponseJSON: '%s'\", timeStart, exportResponseJSON)\n\t\t\t\t\treturn nil, errs.Errorf(\"Export didn't finish since %v, giving up.\", timeStart)\n\t\t\t\t}\n\t\t\t\ttime.Sleep(1 * time.Second)\n\t\t\tcase \"completed\":\n\t\t\t\t// 3. When export is completed get base64 result file from it\n\t\t\t\tlogging.LogDebugf(\"repo/dp/GetObjectDetails() export fetched after %d.\", time.Since(timeStart))\n\t\t\t\tfileB64, err := parseJSONFindOne(exportResponseJSON, \"/result/file\")\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tfileBytes, err := base64.StdEncoding.DecodeString(fileB64)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogging.LogDebug(\"repo/dp/GetObjectDetails() - Error decoding b64 encoded export file.\", err)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\t// 4. Extract export.xml from zip archive\n\t\t\t\texportBytesReader := bytes.NewReader(fileBytes)\n\t\t\t\texportZipReader, err := zip.NewReader(exportBytesReader, int64(len(fileBytes)))\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogging.LogDebug(\"repo/dp/GetObjectDetails() - Error unzipping export archive.\", err)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif len(exportZipReader.File) != 1 {\n\t\t\t\t\tlogging.LogDebugf(\"repo/dp/GetObjectDetails() - Unexpected number of compressed files (%d).\",\n\t\t\t\t\t\tlen(exportZipReader.File))\n\t\t\t\t\treturn nil, errs.Errorf(\"Unexpected number of compressed files (%d)\", len(exportZipReader.File))\n\t\t\t\t}\n\n\t\t\t\texportXMLFile := exportZipReader.File[0]\n\t\t\t\texportXMLReader, err := exportXMLFile.Open()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogging.LogDebug(\"repo/dp/GetObjectDetails() - Error opening export.xml from export archive for reading.\", err)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tdefer exportXMLReader.Close()\n\n\t\t\t\texportXMLBytes := make([]byte, exportXMLFile.UncompressedSize64)\n\t\t\t\tbytesRead, err := io.ReadFull(exportXMLReader, exportXMLBytes)\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\terr = nil\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogging.LogDebug(\"repo/dp/GetObjectDetails() - Error reading export.xml from export archive.\", err)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tif uint64(bytesRead) != exportXMLFile.UncompressedSize64 {\n\t\t\t\t\tlogging.LogDebug(\"repo/dp/GetObjectDetails() - Wrong number of bytes read for export.xml from export archive.\", err)\n\t\t\t\t\treturn nil, errs.Errorf(\"Error reading export.xml from DataPower export archive.\")\n\t\t\t\t}\n\n\t\t\t\treturn getObjectDetailsFromExportXML(exportXMLBytes, objectClassName, objectName)\n\t\t\tdefault:\n\t\t\t\treturn nil, errs.Errorf(\"Unexpected response from server ('%s').\", status)\n\t\t\t}\n\t\t}\n\tcase config.DpInterfaceSoma:\n\t\t// 1. Fetch export of domain\n\t\t// Backup contains domain export zip + export info and dp-aux files\n\t\texportRequestSoma := fmt.Sprintf(`<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n\txmlns:man=\"http://www.datapower.com/schemas/management\">\n <soapenv:Header/>\n <soapenv:Body>\n <man:request domain=\"%s\">\n <man:do-export format=\"ZIP\" all-files=\"false\"\n persisted=\"false\" deployment-policy=\"no-internal-files\">\n <man:user-comment>do-export</man:user-comment>\n <man:object class=\"%s\" name=\"%s\"\n ref-objects=\"true\" ref-files=\"false\" include-debug=\"false\"/>\n </man:do-export>\n </man:request>\n </soapenv:Body>\n</soapenv:Envelope>`, domainName, objectClassName, objectName)\n\t\texportResponseSoma, err := r.soma(exportRequestSoma)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\texportFileB64, err := parseSOMAFindOne(exportResponseSoma, \"//*[local-name()='file']\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\texportBytes, err := base64.StdEncoding.DecodeString(exportFileB64)\n\t\tif err != nil {\n\t\t\tlogging.LogDebug(\"repo/dp/GetObjectDetails() - Error decoding base64 file.\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// 2. Extract just export.xml file\n\t\texportBytesReader := bytes.NewReader(exportBytes)\n\t\texportZipReader, err := zip.NewReader(exportBytesReader, int64(len(exportBytes)))\n\t\tif err != nil {\n\t\t\tlogging.LogDebug(\"repo/dp/GetObjectDetails() - Error unzipping backup archive.\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tfor idx, file := range exportZipReader.File {\n\t\t\tlogging.LogDebugf(\"repo/dp/GetObjectDetails() - file[%d] : '%s'.\", idx, file.Name)\n\t\t\tif file.Name == \"export.xml\" {\n\t\t\t\texportXMLReader, err := file.Open()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogging.LogDebug(\"repo/dp/GetObjectDetails() - Error opening export.xml from export archive for reading.\", err)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tdefer exportXMLReader.Close()\n\n\t\t\t\texportXMLBytes := make([]byte, file.UncompressedSize64)\n\t\t\t\tbytesRead, err := io.ReadFull(exportXMLReader, exportXMLBytes)\n\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\terr = nil\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogging.LogDebug(\"repo/dp/GetObjectDetails() - Error reading export.xml from export archive.\", err)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tif uint64(bytesRead) != file.UncompressedSize64 {\n\t\t\t\t\tlogging.LogDebugf(\"repo/dp/GetObjectDetails() - Wrong number of bytes (%d/%d) read for export.xml from export archive, err: %v\",\n\t\t\t\t\t\tbytesRead, file.UncompressedSize64, err)\n\t\t\t\t\treturn nil, errs.Errorf(\"Error reading export.xml from DataPower export archive.\")\n\t\t\t\t}\n\n\t\t\t\treturn getObjectDetailsFromExportXML(exportXMLBytes, objectClassName, objectName)\n\t\t\t}\n\t\t}\n\n\t\treturn nil, errs.Errorf(\"Export failed, domain '%s' not found in DataPower backup.\", domainName)\n\tdefault:\n\t\treturn nil, errs.Errorf(\"DataPower management interface %s not supported.\", r.dataPowerAppliance.DpManagmentInterface())\n\t}\n}", "title": "" }, { "docid": "0c64ac0d1f416d2bcad289d7684f7da7", "score": "0.43267035", "text": "func (c *bytemarkClient) getBillingAccounts() (accounts []billing.Account, err error) {\n\tif c.urls.Billing == \"\" {\n\t\treturn make([]billing.Account, 0), nil\n\t}\n\treq, err := c.BuildRequest(\"GET\", BillingEndpoint, \"/api/v1/accounts\")\n\tif err != nil {\n\t\treturn\n\t}\n\toldfile := log.LogFile\n\tlog.LogFile = nil\n\t_, _, err = req.Run(nil, &accounts)\n\tlog.LogFile = oldfile\n\treturn\n}", "title": "" }, { "docid": "20c6afec962548a001819f204a7843a4", "score": "0.4325695", "text": "func cmdInfo() error {\n\tm, err := driver.GetMachine(&B2D)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to get machine %q: %s\", B2D.VM, err)\n\t}\n\tb, err := json.MarshalIndent(m, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to encode machine %q info: %s\", B2D.VM, err)\n\t}\n\n\tos.Stdout.Write(b)\n\n\treturn nil\n}", "title": "" }, { "docid": "8a8496eb8c5832edc939c6138b0617a5", "score": "0.43239117", "text": "func (r Network_Application_Delivery_Controller_LoadBalancer_VirtualIpAddress) GetBillingItem() (resp datatypes.Billing_Item, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Application_Delivery_Controller_LoadBalancer_VirtualIpAddress\", \"getBillingItem\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "8cea20530bf1d5caec2b5cc89addb3bc", "score": "0.43234158", "text": "func (r Network_Storage_Backup_Evault) GetBillingItem() (resp datatypes.Billing_Item, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Storage_Backup_Evault\", \"getBillingItem\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "12269e1bd0995cd0771e81a352264a0e", "score": "0.43227652", "text": "func (r Network_Vlan_Firewall) GetBillingItem() (resp datatypes.Billing_Item, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Vlan_Firewall\", \"getBillingItem\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "f72d5a5b7ceb890e9244ef189c32e3b6", "score": "0.43214384", "text": "func (m *metricSaphanaServiceMemoryCompactorsFreeable) init() {\n\tm.data.SetName(\"saphana.service.memory.compactors.freeable\")\n\tm.data.SetDescription(\"The memory that can be freed during a memory shortage.\")\n\tm.data.SetUnit(\"By\")\n\tm.data.SetEmptySum()\n\tm.data.Sum().SetIsMonotonic(false)\n\tm.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)\n\tm.data.Sum().DataPoints().EnsureCapacity(m.capacity)\n}", "title": "" }, { "docid": "935070ad97a2e5774e77aa016a75f938", "score": "0.43200126", "text": "func getVMInfo() map[string]uint64 {\n\tm := make(map[string]uint64)\n\tms := runtime.MemStats{}\n\truntime.ReadMemStats(&ms)\n\tm[\"ram.total\"] = ms.TotalAlloc\n\tm[\"ram.free\"] = ms.Frees\n\tsi := syscall.Sysinfo_t{}\n\t_ = syscall.Sysinfo(&si)\n\tm[\"swap.total\"] = si.Totalswap\n\tm[\"swap.total\"] = si.Freeswap\n\treturn m\n}", "title": "" }, { "docid": "9b545ab0ba4213f7ba61bdae6e0a3db1", "score": "0.43167806", "text": "func MemAuditReport() error { return nil }", "title": "" }, { "docid": "03395c9e84c5f2d7ce88811e3bbb9852", "score": "0.43127155", "text": "func CollectFromLibvirt(ch chan<- prometheus.Metric, e *LibvirtExporter) error {\r\n\tconn, err := net.DialTimeout(e.protocol, e.uri, 2*time.Second)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tl := libvirt.New(conn)\r\n\tif err := l.Connect(); err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tdefer conn.Close()\r\n\t\r\n\tdomains, err := l.Domains()\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\t\r\n\tstats, err := l.ConnectGetAllDomainStats(domains, uint32(libvirt.DomainStatsState | libvirt.DomainStatsCPUTotal | libvirt.DomainStatsVCPU | libvirt.DomainStatsInterface | libvirt.DomainStatsBalloon | libvirt.DomainStatsBlock), 0);\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tfor _, stat := range stats {\r\n\t\terr = CollectDomain(ch, stat)\r\n\t\tif err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "746b2554f898d60df2c56b9964145c97", "score": "0.4311965", "text": "func (a *DhcpApiService) DhcpLeaseInfo(ctx _context.Context) ApiDhcpLeaseInfoRequest {\n\treturn ApiDhcpLeaseInfoRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "f47b54ec96fa1315470a402a645f7cc4", "score": "0.43112847", "text": "func CCWContractStatusDump() {\n\turl := \"https://api.cisco.com/ccw/renewals/api/v1.0/search/contractSummary\"\n\tmethod := \"POST\"\n\n\tapiAuthToken()\n\n\tpayload := strings.NewReader(\"{\\n \\\"billToLocation\\\": [\\n 1397311\\n ],\t\\n \\\"offset\\\": 0,\\n \\\"limit\\\": 1000,\\n \\\"configurations\\\": false\\n}\")\n\t// For loop is necessary a maximum of 1000 records will be returned via the API on a single request. The offset is\n\t// used as a type of pagination and by setting it to 1000 on the second loop the records starting at 1000 will be\n\t// returned (1000 record number not page). At the time of this development - 1025 records exists and thus a loop thru\n\t// on a second iteration - changing only the offset in the POST payload - is sufficient.\n\tfor x := 1; x <= 2; x++ {\n\t\tif x == 1 {\n\t\t\t// No action necessary\n\t\t} else if x == 2 {\n\t\t\tpayload = strings.NewReader(\"{\\n \\\"billToLocation\\\": [\\n 1397311\\n ],\t\\n \\\"offset\\\": 1000,\\n \\\"limit\\\": 1000,\\n \\\"configurations\\\": false\\n}\")\n\t\t}\n\n\t\tclient := &http.Client{}\n\t\treq, err := http.NewRequest(method, url, payload)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\treq.Header.Add(\"Request-Id\", \"1397311\")\n\n\t\treq.Header.Add(\"Authorization\", \"Bearer \"+authToken)\n\n\t\t// req.Header.Add(\"Authorization\", \"Bearer 2wjiceJJpU3c41spLlJ6CLXg8EyU\")\n\t\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\t\tres, err := client.Do(req)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"within res reattempt conditional\")\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t\tres, err = client.Do(req)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"within res reattempt2 conditional\")\n\t\t\t\ttime.Sleep(1 * time.Second)\n\t\t\t\tres, err = client.Do(req)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"within res reattempt3 conditional\")\n\t\t\t\ttime.Sleep(1 * time.Second)\n\t\t\t\tres, err = client.Do(req)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"within res reattempt4 conditional\")\n\t\t\t\ttime.Sleep(1 * time.Second)\n\t\t\t\tres, err = client.Do(req)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t}\n\n\t\tdefer res.Body.Close()\n\t\tbody, err := ioutil.ReadAll(res.Body)\n\n\t\t// check for response error\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error:\", err)\n\t\t}\n\n\t\tContractsTotal1 = ContractsTotal{}\n\t\tjson.Unmarshal(body, &ContractsTotal1)\n\n\t\t//fmt.Println(\"Length of contracts: \", len(ContractsTotal1.Contracts))\n\t\tfor _, v := range ContractsTotal1.Contracts {\n\t\t\tIndividualContracts1 = IndividualContracts{}\n\t\t\t// BELIEVE THIS ONLY OCCURS FOR SMP CONTRACTS - NEED TO CONFIRM AND DEAL WITH THESE INSTANCES - TWO RECORDS MATCH\n\t\t\tif len(v.EndCustomers) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tIndividualContracts1.CustomerName = v.EndCustomers[0].Name\n\t\t\tIndividualContracts1.CustomerID = v.EndCustomers[0].ID\n\t\t\tIndividualContracts1.CustomerCountry = v.EndCustomers[0].Country\n\t\t\tIndividualContracts1.ContractNumber = v.ContractNumber\n\t\t\tIndividualContracts1.ContractStatus = v.ContractStatus\n\t\t\tIndividualContracts1.ContractBillToID = v.ContractBillToID\n\t\t\tIndividualContracts1.ContractBillToName = v.ContractBillToName\n\t\t\tIndividualContracts1.ContractBillToGUID = v.ContractBillToGUID\n\t\t\tIndividualContracts1.ContractBillToGUName = v.ContractBillToGUName\n\t\t\tIndividualContracts1.ContractEndDate = v.ContractEndDate\n\t\t\tIndividualContracts1.EarliestEndDate = v.EarliestEndDate\n\t\t\tIndividualContracts1.ListPrice = v.ListPrice\n\t\t\tIndividualContracts1.ContractLabel = v.ContractLabel\n\t\t\tIndividualContracts1.Currency = v.Currency\n\t\t\tIndividualContracts1.ContractStatus = v.ContractStatus\n\n\t\t\tCCWPerContractDetails(IndividualContracts1.ContractNumber)\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f13b157c15dd21acf0c9840ca6a8cb5f", "score": "0.4279893", "text": "func (client *LotsClient) listByBillingAccountCreateRequest(ctx context.Context, billingAccountID string, options *LotsListByBillingAccountOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/lots\"\n\tif billingAccountID == \"\" {\n\t\treturn nil, errors.New(\"parameter billingAccountID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{billingAccountId}\", url.PathEscape(billingAccountID))\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-10-01\")\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": "ac67e17b6efb40039a597b59e02b19ae", "score": "0.42772463", "text": "func CollectSystemInfo() message.Composer {\n\treturn MakeSystemInfo(\"\")\n}", "title": "" }, { "docid": "7af14b5caab03165ee19dc197b3265a7", "score": "0.4272967", "text": "func (r Network_Bandwidth_Version1_Allotment) GetBillingCyclePublicBandwidthUsage() (resp datatypes.Network_Bandwidth_Usage, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Bandwidth_Version1_Allotment\", \"getBillingCyclePublicBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "902fc160c92f58f895bba4b992cc2e95", "score": "0.427023", "text": "func CollectDomain(ch chan<- prometheus.Metric, domRec libvirt.DomainStatsRecord) error {\r\n\tdomainName := domRec.Dom.Name\r\n\tdomainUUID := fmt.Sprint(domRec.Dom.UUID)\r\n\r\n\tch <- prometheus.MustNewConstMetric(\r\n\t\tlibvirtDomainInfoMetaDesc,\r\n\t\tprometheus.GaugeValue,\r\n\t\tfloat64(1),\r\n\t\tdomainName,\r\n\t\tdomainUUID)\r\n\r\n\tvar totalMemory, unusedMemory float64\r\n\tvar currDiskName, currIfaceName string\r\n\tfor _, stat := range domRec.Params {\r\n\t\tif stat.Field == \"balloon.available\" {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainInfoMaxMemBytesDesc,\r\n\t\t\t\tprometheus.GaugeValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64))*1024,\r\n\t\t\t\tdomainName)\r\n\t\t} else if stat.Field == \"balloon.unused\" {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainInfoMemoryUnusedBytesDesc,\r\n\t\t\t\tprometheus.GaugeValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64))*1024,\r\n\t\t\t\tdomainName)\r\n\t\t}\r\n\t\t\r\n\t\tif stat.Field == \"vcpu.maximum\" {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainInfoNrVirtCPUDesc,\r\n\t\t\t\tprometheus.GaugeValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint32)),\r\n\t\t\t\tdomainName)\r\n\t\t} else if stat.Field == \"cpu.time\" {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainInfoCPUTimeDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64))/1000/1000/1000, // From nsec to sec\r\n\t\t\t\tdomainName)\r\n\t\t} else if stat.Field == \"state.state\" {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainInfoVirDomainState,\r\n\t\t\t\tprometheus.GaugeValue,\r\n\t\t\t\tfloat64(stat.Value.I.(int32)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tGetVirtStateStr(stat.Value.I.(int32)))\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"vcpu.\", \".state\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainVcpuStateDesc,\r\n\t\t\t\tprometheus.GaugeValue,\r\n\t\t\t\tfloat64(stat.Value.I.(int32)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tstring(stat.Field[5])) // 5th char in field name is vcpu #\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"vcpu.\", \".time\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainVcpuTimeDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64))/1000/1000/1000, // From nsec to sec\r\n\t\t\t\tdomainName,\r\n\t\t\t\tstring(stat.Field[5]))\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"block.\", \".name\") {\r\n\t\t\tcurrDiskName = fmt.Sprint(stat.Value.I)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"block.\", \".rd.bytes\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainBlockRdBytesDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrDiskName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"block.\", \".rd.reqs\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainBlockRdReqDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrDiskName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"block.\", \"rd.times\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainBlockRdTotalTimeSecondsDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64))/1e9,\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrDiskName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"block.\", \"wr.bytes\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainBlockWrBytesDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrDiskName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"block.\", \"wr.reqs\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainBlockWrReqDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrDiskName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"block.\", \"wr.times\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainBlockWrTotalTimesDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64))/1e9,\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrDiskName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"block.\", \"fl.reqs\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainBlockFlushReqDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrDiskName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"block.\", \"fl.times\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainBlockFlushTotalTimeSecondsDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64))/1e9,\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrDiskName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"block.\", \".allocation\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainBlockAllocationDesc,\r\n\t\t\t\tprometheus.GaugeValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrDiskName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"block.\", \".capacity\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainBlockCapacityBytesDesc,\r\n\t\t\t\tprometheus.GaugeValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrDiskName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"block.\", \".physical\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainBlockPhysicalSizeBytesDesc,\r\n\t\t\t\tprometheus.GaugeValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrDiskName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"net.\", \".name\") {\r\n\t\t\tcurrIfaceName = fmt.Sprint(stat.Value.I)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"net.\", \".rx.bytes\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainInterfaceRxBytesDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrIfaceName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"net.\", \".rx.pkts\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainInterfaceRxPacketsDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrIfaceName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"net.\", \"rx.errs\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainInterfaceRxErrsDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrIfaceName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"net.\", \"rx.drop\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainInterfaceRxDropDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrIfaceName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"net.\", \"tx.bytes\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainInterfaceTxBytesDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrIfaceName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"net.\", \"tx.pkts\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainInterfaceTxPacketsDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrIfaceName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"net.\", \"tx.errs\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainInterfaceTxErrsDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrIfaceName)\r\n\t\t} else if HasPrefixAndSuffix(stat.Field, \"net.\", \"tx.drop\") {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainInterfaceTxDropDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName,\r\n\t\t\t\tcurrIfaceName)\r\n\t\t} else if stat.Field == \"balloon.major_fault\" {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainMemoryStatMajorFaultTotalDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName)\r\n\t\t} else if stat.Field == \"balloon.minor_fault\" {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainMemoryStatMinorFaultTotalDesc,\r\n\t\t\t\tprometheus.CounterValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64)),\r\n\t\t\t\tdomainName)\r\n\t\t} else if stat.Field == \"balloon.unused\" {\r\n\t\t\tunusedMemory = float64(stat.Value.I.(uint64))*1024\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainMemoryStatUnusedBytesDesc,\r\n\t\t\t\tprometheus.GaugeValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64))*1024,\r\n\t\t\t\tdomainName)\r\n\t\t} else if stat.Field == \"balloon.available\" {\r\n\t\t\ttotalMemory = float64(stat.Value.I.(uint64))*1024\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainMemoryStatAvailableBytesDesc,\r\n\t\t\t\tprometheus.GaugeValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64))*1024,\r\n\t\t\t\tdomainName)\r\n\t\t} else if stat.Field == \"balloon.rss\" {\r\n\t\t\tch <- prometheus.MustNewConstMetric(\r\n\t\t\t\tlibvirtDomainMemoryStatRssBytesDesc,\r\n\t\t\t\tprometheus.GaugeValue,\r\n\t\t\t\tfloat64(stat.Value.I.(uint64))*1024,\r\n\t\t\t\tdomainName)\r\n\t\t}\r\n\t}\r\n\r\n\tusedPercent := (totalMemory - unusedMemory) / totalMemory\r\n\r\n\tch <- prometheus.MustNewConstMetric(\r\n\t\tlibvirtDomainMemoryStatUsedPercentDesc,\r\n\t\tprometheus.GaugeValue,\r\n\t\tfloat64(usedPercent),\r\n\t\tdomainName)\r\n\t\r\n\treturn nil\r\n}", "title": "" }, { "docid": "1daa282bd6232a2374467937314aea96", "score": "0.42683583", "text": "func getPurchases() PurchaseData {\n\turl := fmt.Sprintf(\"https://driftrock-dev-test.herokuapp.com/purchases?page=1&per_page=50\")\n\n\tclient := &http.Client{}\n\n\tempty := PurchaseData{}\n\t//build the request\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\tlog.Fatal(\"NewRequest: \", err)\n\t\treturn empty\n\t}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(\"Do: \", err)\n\t\treturn empty\n\t}\n\n\tdefer resp.Body.Close()\n\trecordPurchases := PurchaseData{}\n\n\tif err := json.NewDecoder(resp.Body).Decode(&recordPurchases); err != nil {\n\t\tlog.Println(err) //decode vs unmarshall (use decode when io is streaming from a source ie http and marshal when json is locally available)\n\t}\n\n\t// fmt.Println(resp.Status)\n\t//fmt.Println((recordPurchases.Data[0].Item[1]))\n\treturn recordPurchases\n}", "title": "" }, { "docid": "d327030d9880050125210802ce3ed352", "score": "0.42649972", "text": "func calculateCost(data *Data) {\n\tfor {\n\t\tcount := data.GetCount()\n\t\ttotal := data.getCost()\n\t\t// FLC explained:\n\t\t// https://smallbusiness.chron.com/calculate-fully-burdened-labor-costs-33072.html\n\t\t// TODO: Make FLC configurable via the config file.\n\t\tfullyLoadedCostMultiplier := float32(1.75)\n\t\tcps := float32(count) * fullyLoadedCostMultiplier * float32(150000) / 7200000 // 50 (weeks) * 40 (hours) * 60 (minutes) * 60 (seconds)\n\t\ttotal += cps\n\t\tdata.setCost(total)\n\t\ttime.Sleep(refreshInterval)\n\t}\n}", "title": "" }, { "docid": "729ad4e298f52c388693cbcc47eda02f", "score": "0.4260518", "text": "func (_Auto *AutoCallerSession) PoolInfo(arg0 *big.Int) (struct {\n\tWant common.Address\n\tAllocPoint *big.Int\n\tLastRewardBlock *big.Int\n\tAccAUTOPerShare *big.Int\n\tStrat common.Address\n}, error) {\n\treturn _Auto.Contract.PoolInfo(&_Auto.CallOpts, arg0)\n}", "title": "" }, { "docid": "56a7db52e1172a4a0be91f6d503029fb", "score": "0.42603457", "text": "func (a *AccountsApiService) GetPlanPurchases(ctx _context.Context, planId string, localVarOptionals *GetPlanPurchasesOpts) (BtListResponseBtPurchaseInfo, *_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 BtListResponseBtPurchaseInfo\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/accounts/plans/{planId}/purchases\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"planId\"+\"}\", _neturl.QueryEscape(parameterToString(planId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Offset.IsSet() {\n\t\tlocalVarQueryParams.Add(\"offset\", parameterToString(localVarOptionals.Offset.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Limit.IsSet() {\n\t\tlocalVarQueryParams.Add(\"limit\", parameterToString(localVarOptionals.Limit.Value(), \"\"))\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/vnd.onshape.v1+json;charset=UTF-8;qs=0.1\", \"application/json;charset=UTF-8; qs=0.09\"}\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\t\tvar v BtListResponseBtPurchaseInfo\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\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": "a4c993e1749cc3475daf273acebc459a", "score": "0.425828", "text": "func (o *OKGroup) GetAccountBillDetails(ctx context.Context, request GetAccountBillDetailsRequest) (resp []GetAccountBillDetailsResponse, _ error) {\n\trequestURL := fmt.Sprintf(\"%v%v\", OKGroupLedger, FormatParameters(request))\n\treturn resp, o.SendHTTPRequest(ctx, exchange.RestSpot, http.MethodGet, okGroupAccountSubsection, requestURL, nil, &resp, true)\n}", "title": "" }, { "docid": "b0bc2a66198eb2a2ade24082eea2514a", "score": "0.42559958", "text": "func theBillShouldBe(pounds, pence int) error {\n\tfmt.Printf(\"Running billing consolidation for interval: '%s' to '%s'.\\n\", startInterval.Format(\"2006-01-02\"), endInterval.Format(\"2006-01-02\"))\n\n\t// We need to run the billing consolidation here.\n\t// Original code taken from paas-billing/eventstore/store_consolidated_billable_events.go:consolidate() and paas-billing/eventstore/store_billable_events.go:WithBillableEvents()\n\tsqlQuery := fmt.Sprintf(`with\n\t\tfiltered_range as (\n\t\t\tselect tstzrange('%s', '%s') as filtered_range -- durationArgPosition\n\t\t),\n\t\tcomponents_with_price as (\n\t\t\tselect\n\t\t\t\tb.event_guid,\n\t\t\t\tb.resource_guid,\n\t\t\t\tb.resource_name,\n\t\t\t\tb.resource_type,\n\t\t\t\tb.org_guid,\n\t\t\t\tb.org_name,\n\t\t\t\tb.space_guid,\n\t\t\t\tb.space_name,\n\t\t\t\tb.plan_guid,\n\t\t\t\tb.plan_name,\n\t\t\t\tb.duration * filtered_range as duration,\n\t\t\t\tb.number_of_nodes,\n\t\t\t\tb.memory_in_mb,\n\t\t\t\tb.storage_in_mb,\n\t\t\t\tb.component_name,\n\t\t\t\tb.component_formula,\n\t\t\t\tb.vat_code,\n\t\t\t\tb.vat_rate,\n\t\t\t\t'GBP' as currency_code,\n\t\t\t\t(eval_formula(\n\t\t\t\t\tb.memory_in_mb,\n\t\t\t\t\tb.storage_in_mb,\n\t\t\t\t\tb.number_of_nodes,\n\t\t\t\t\tb.duration * filtered_range,\n\t\t\t\t\tb.component_formula\n\t\t\t\t) * b.currency_rate) as price_ex_vat\n\t\t\tfrom\n\t\t\t\tfiltered_range,\n\t\t\t\tbillable_event_components b\n\t\t\twhere\n\t\t\t\tduration && filtered_range\n\t\t\t\t-- filterQuery\n\t\t\torder by\n\t\t\t\tlower(duration) asc\n\t\t),\n\t\tbillable_events as (\n\t\t\tselect\n\t\t\t\tevent_guid,\n\t\t\t\tmin(lower(duration)) as event_start,\n\t\t\t\tmax(upper(duration)) as event_stop,\n\t\t\t\tresource_guid,\n\t\t\t\tresource_name,\n\t\t\t\tresource_type,\n\t\t\t\torg_guid,\n\t\t\t\torg_name,\n\t\t\t\tnull::uuid as quota_definition_guid,\n\t\t\t\tspace_guid,\n\t\t\t\tspace_name,\n\t\t\t\tplan_guid,\n\t\t\t\tnumber_of_nodes,\n\t\t\t\tmemory_in_mb,\n\t\t\t\tstorage_in_mb,\n\t\t\t\tjson_build_object(\n\t\t\t\t\t'ex_vat', (sum(price_ex_vat))::text,\n\t\t\t\t\t'inc_vat', (sum(price_ex_vat * (1 + vat_rate)))::text,\n\t\t\t\t\t'details', json_agg(json_build_object(\n\t\t\t\t\t\t'name', component_name,\n\t\t\t\t\t\t'start', lower(duration),\n\t\t\t\t\t\t'stop', upper(duration),\n\t\t\t\t\t\t'plan_name', plan_name,\n\t\t\t\t\t\t'ex_vat', (price_ex_vat)::text,\n\t\t\t\t\t\t'inc_vat', (price_ex_vat * (1 + vat_rate))::text,\n\t\t\t\t\t\t'vat_rate', (vat_rate)::text,\n\t\t\t\t\t\t'vat_code', vat_code,\n\t\t\t\t\t\t'currency_code', currency_code\n\t\t\t\t\t))\n\t\t\t\t) as price\n\t\t\tfrom\n\t\t\t\tcomponents_with_price\n\t\t\tgroup by\n\t\t\t\tevent_guid,\n\t\t\t\tresource_guid,\n\t\t\t\tresource_name,\n\t\t\t\tresource_type,\n\t\t\t\torg_guid,\n\t\t\t\torg_name,\n\t\t\t\tquota_definition_guid,\n\t\t\t\tspace_guid,\n\t\t\t\tspace_name,\n\t\t\t\tplan_guid,\n\t\t\t\tnumber_of_nodes,\n\t\t\t\tmemory_in_mb,\n\t\t\t\tstorage_in_mb\n\t\t\torder by\n\t\t\t\tevent_guid\n\t )\n\t `+`insert into consolidated_billable_events (\n\t\t\tconsolidated_range,\n\n\t\t\tevent_guid,\n\t\t\tduration,\n\t\t\tresource_guid,\n\t\t\tresource_name,\n\t\t\tresource_type,\n\t\t\torg_guid,\n\t\t\torg_name,\n\t\t\tspace_guid,\n\t\t\tspace_name,\n\t\t\tplan_guid,\n\t\t\tquota_definition_guid,\n\t\t\tnumber_of_nodes,\n\t\t\tmemory_in_mb,\n\t\t\tstorage_in_mb,\n\t\t\tprice\n\t\t)\n\t\tselect\n\t\t\tfiltered_range,\n\n\t\t\tbillable_events.event_guid,\n\t\t\ttstzrange(billable_events.event_start, billable_events.event_stop),\n\t\t\tbillable_events.resource_guid,\n\t\t\tbillable_events.resource_name,\n\t\t\tbillable_events.resource_type,\n\t\t\tbillable_events.org_guid,\n\t\t\tbillable_events.org_name,\n\t\t\tbillable_events.space_guid,\n\t\t\tbillable_events.space_name,\n\t\t\tbillable_events.plan_guid,\n\t\t\tbillable_events.quota_definition_guid,\n\t\t\tbillable_events.number_of_nodes,\n\t\t\tbillable_events.memory_in_mb,\n\t\t\tbillable_events.storage_in_mb,\n\t\t\tbillable_events.price\n\t\tfrom\n\t\t\tbillable_events,\n\t\t\tfiltered_range;`, startInterval.Format(\"2006-01-02\"), endInterval.Format(\"2006-01-02\"))\n\n\t_, err := db.Query(sqlQuery)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"Examining billing bill for time interval: '%s' to '%s'...\\n\", startInterval.Format(\"2006-01-02\"), endInterval.Format(\"2006-01-02\"))\n\n\t// Get the billing bill from the database\n\trows, err := db.Query(`SELECT price->'ex_vat' AS ex_vat, price->'inc_vat' AS inc_vat FROM consolidated_billable_events;`)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar intVATdb, exVATDB string\n\tvar incVAT, exVAT float64\n\tfor rows.Next() {\n\t\terr = rows.Scan(&exVATDB, &intVATdb)\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tincVATCharge, err := strconv.ParseFloat(strings.Replace(intVATdb, \"\\\"\", \"\", -1), 64)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\texVATCharge, err := strconv.ParseFloat(strings.Replace(exVATDB, \"\\\"\", \"\", -1), 64)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tincVAT += incVATCharge\n\t\texVAT += exVATCharge\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Now examine the billing bill calculated by billing and check it's the same as that specified in the Gherkin test\n\tfmt.Printf(\"Bill calculated by billing excluding vat = £%f and including vat = £%f\\n\", exVAT, incVAT)\n\n\texVAT = math.Round(exVAT*100) / 100\n\tincVAT = math.Round(incVAT*100) / 100\n\n\t// TODO: Investigate rounding in golang. The number 6.44448 is rounded to 6.44 not 6.45.\n\n\texpectedBill := float64((pounds*100)+pence) / 100\n\tif incVAT != expectedBill {\n\t\treturn fmt.Errorf(\"Billing calculation is not as expected. Expected bill (from Gherkin test) = £%f, bill calculated by Paas billing = £%f\\n\", expectedBill, incVAT)\n\t} else {\n\t\t// Print in green\n\t\tfmt.Print(\"\\033[32m\", \"\\n*** Test passed ***\\n\\n\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "125fae2749e531b89fd6cc1d133cd65f", "score": "0.42553726", "text": "func (p *dataProvisioner) provisionData() ([]string, error) {\n\tpaths := []string{}\n\n\tfor {\n\t\t// Download available files\n\t\tpaths = append(paths, p.fetchDataFromSources()...)\n\t\tif len(paths) == len(p.sources) {\n\t\t\tbreak\n\t\t}\n\n\t\t// Attempt to update data sources and fail if unsuccessful\n\t\tfor i, fact := 0, 1; i <= maxAttempts; i++ {\n\t\t\tfor idx, source := range p.sources {\n\t\t\t\tif source.status == done {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\thost := p.srvc.host(p.file, idx)\n\t\t\t\tif source.host == host || host == \"\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tsource.host = host\n\t\t\t\tsource.status = idle\n\t\t\t\tp.addTask(idx)\n\t\t\t}\n\n\t\t\tif p.queue.Len() > 0 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif i == maxAttempts {\n\t\t\t\treturn nil, errors.New(\"provisiondata: data unavailable\")\n\t\t\t}\n\t\t\ttime.Sleep(time.Duration(fact) * time.Millisecond)\n\t\t\tfact *= 2\n\t\t}\n\t}\n\treturn paths, nil\n}", "title": "" }, { "docid": "cf25f61eedad4cafff22b1419de37d10", "score": "0.42523706", "text": "func (o *ResourceService) SetBilling(v string) {\n\to.Billing = &v\n}", "title": "" } ]
bf2c392ddbf1d20ea863ea660c8caad8
Set stores value for a key to Hazelcast.
[ { "docid": "77c3dcf90fdaeaef6e7de789bc0e1757", "score": "0.72497195", "text": "func (store *Hazelcast) Set(req *state.SetRequest) error {\n\terr := state.CheckRequestOptions(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar value string\n\tb, ok := req.Value.([]byte)\n\tif ok {\n\t\tvalue = string(b)\n\t} else {\n\t\tvalue, err = store.json.MarshalToString(req.Value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"hazelcast error: failed to set key %s: %s\", req.Key, err)\n\t\t}\n\t}\n\t_, err = store.hzMap.Put(req.Key, value)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"hazelcast error: failed to set key %s: %s\", req.Key, err)\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "0a683771ecdb2bb53974fa76ab955f84", "score": "0.751789", "text": "func (s *HazelcastStore) Set(ctx context.Context, key any, value any, options ...lib_store.Option) error {\n\topts := lib_store.ApplyOptionsWithDefault(s.options, options...)\n\thzMap, err := s.mapProvider(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = hzMap.SetWithTTL(ctx, key, value, opts.Expiration)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tags := opts.Tags; len(tags) > 0 {\n\t\ts.setTags(ctx, hzMap, key, tags)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e57ef138dfe515db7baff348f26d3390", "score": "0.7397655", "text": "func (sm *ShardMap) Set(key string, value interface{}) {\n\tshard := sm.locate(key)\n\tshard.Lock()\n\tshard.store[key] = value\n\tshard.Unlock()\n}", "title": "" }, { "docid": "483ebc2d12f6c7239ec7720b59c1ec0d", "score": "0.71320325", "text": "func (m *MysqlStore) Set(key interface{}, value interface{}) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tm.sessionData[key] = value\n\treturn nil\n}", "title": "" }, { "docid": "e7b57e14bd381b4ffebef64110df00cd", "score": "0.71239233", "text": "func (m *ConcurrentMap) Set(key KeyType, value interface{}) {\n\tm.getShard(key).Set(key, value)\n}", "title": "" }, { "docid": "a162847c217cebc41fb45a1185fcd137", "score": "0.70588565", "text": "func (s *Store) Set(key string, value interface{}) error {\n\tif s.raft.State() != raft.Leader {\n\t\treturn fmt.Errorf(\"not leader\")\n\t}\n\n\tc := &command{\n\t\tOp: \"set\",\n\t\tKey: key,\n\t\tValue: value,\n\t}\n\tb, err := json.Marshal(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf := s.raft.Apply(b, raftTimeout)\n\treturn f.Error()\n}", "title": "" }, { "docid": "0a392bce14fd29aa12ced3b31018a060", "score": "0.70451784", "text": "func (m *SyncMap) Set(key string, value interface{}) {\n\tshard := m.locate(key)\n\tshard.Lock()\n\tshard.items[key] = value\n\tshard.Unlock()\n}", "title": "" }, { "docid": "4d339170f419c927af09523e509043e2", "score": "0.7040754", "text": "func (s *BoltStore) Set(key string, value interface{}) error {\n\ts.Lock()\n\tdefer s.Unlock()\n\tbValue, err := json.Marshal(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn s.db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(s.bucket))\n\t\terr := b.Put([]byte(key), bValue)\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "1bc436c9c2f3da3391bda7e848e4fe6c", "score": "0.70245343", "text": "func (st *SessionStore) Set(key, value interface{}) {\n\tst.value[key] = value\n\tprovider.SessionUpdate(st.sid)\n\treturn\n}", "title": "" }, { "docid": "a474888256c4d0c416ebc18998c41a4a", "score": "0.70089275", "text": "func (km *KeyManager) Set(key, value string) error {\n\tkm.lock.Lock()\n\tdefer km.lock.Unlock()\n\tkm.localData[key] = value\n\treturn nil\n}", "title": "" }, { "docid": "e9951daed97584ded1a89e4b742370f8", "score": "0.6951342", "text": "func (rs *MemcacheSessionStore) Set(key, value interface{}) error {\n\trs.lock.Lock()\n\tdefer rs.lock.Unlock()\n\trs.values[key] = value\n\treturn nil\n}", "title": "" }, { "docid": "cba1f0fc75d8305ce75c1022273bc3d1", "score": "0.69353205", "text": "func (st *SessionStore) Set(key, value interface{}) error {\n\tst.value[key] = value\n\tpder.sessionUpdate(st.sid)\n\treturn nil\n}", "title": "" }, { "docid": "08697b39ce00948d0e4a400c80865a5a", "score": "0.6931115", "text": "func (st *SessionStoreMem) Set(key, value interface{}) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tst.values[key] = value\n\treturn nil\n}", "title": "" }, { "docid": "8d6b04e32ff11c0c2aac667535567f6b", "score": "0.69278806", "text": "func (c *Store) Set(k string, v interface{}) error {\n\treturn c.SetEx(k, v, 0)\n}", "title": "" }, { "docid": "41d8bf82d5ef8199d75a74f1e523ef5f", "score": "0.6925033", "text": "func (ss *BoltStateStore) Set(key string, value string) error {\n\terr := ss.db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(ss.requestId))\n\t\terr := b.Put([]byte(key), []byte(value))\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to set key, error %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "368bcb19b6cacd17e024cf611c94a335", "score": "0.6924725", "text": "func (kvs *KeyValService) Set(args *api.SetArgs, reply *api.ValReply) error {\n\treply.Val = store.Set(args.Key, args.Val)\n\tdebugLog(\"Set(%s,%s) -> %s\\n\", args.Key, args.Val, reply.Val)\n\tgo nodeChain.Set(args, reply) // Propagate change to subsequent nodes\n\treturn nil\n}", "title": "" }, { "docid": "cbca079ce7be42fef2a4e9e758f587a5", "score": "0.69171125", "text": "func (rs *SessionStore) Set(key, value interface{}) error {\r\n\trs.lock.Lock()\r\n\tdefer rs.lock.Unlock()\r\n\trs.values[key.(string)] = value\r\n\trs.save()\r\n\treturn nil\r\n}", "title": "" }, { "docid": "7fddfd44335309fd76ca31adeff646bd", "score": "0.6914882", "text": "func (s *session) Set(key string, value interface{}) {\n\ts.mu.Lock()\n\ts.values[key] = value\n\ts.mu.Unlock()\n\ts.provider.update(s.sid)\n}", "title": "" }, { "docid": "ec173e366d27ffb2aa87c8b0edef96c0", "score": "0.6908619", "text": "func (f *Fenech) Set(key string, value []byte) error {\n\tif err := f.isClose(); err != nil {\n\t\treturn err\n\t}\n\tif err := putBinlog(f, key, value); err != nil {\n\t\treturn err\n\t}\n\t// Get map shard.\n\tshard := f.getShard(key)\n\tshard.Lock()\n\tshard.items[key] = value\n\tshard.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "f221ddf3fb2ae0094bce772f4845f670", "score": "0.6898986", "text": "func (cs *SessionStore) Set(ctx context.Context, key, value interface{}) error {\n\tcs.lock.Lock()\n\tdefer cs.lock.Unlock()\n\tcs.values[key] = value\n\treturn nil\n}", "title": "" }, { "docid": "8978ce33c47a8665d3047ab35ec57d84", "score": "0.6898507", "text": "func (store *MapStore) Set(key []byte, value []byte) error {\n\tstore.lock.Lock()\n\tstore.items[string(key)] = string(value)\n\tstore.lock.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "dc854ddba11fc7feb4db5d5dd725252e", "score": "0.68909985", "text": "func (s *Store) Set(k string, n interface{}) error {\n\tif k == \"\" {\n\t\treturn errors.New(\"key cannot be blank\")\n\t}\n\ts.Data[k] = n\n\treturn nil\n}", "title": "" }, { "docid": "9590347a98dc1dd7a17ffe3a3ab0d822", "score": "0.6883499", "text": "func (kvs *KVStore) Set(key string, value interface{}) {\n\t(*kvs)[key] = value\n}", "title": "" }, { "docid": "35c6163fe4ef69226d5242234da107ca", "score": "0.68770784", "text": "func (s *Store) Set(datatype, key string, v interface{}, indexData map[string]string) error {\n\tif err := s.checkInit(); err != nil {\n\t\treturn err\n\t}\n\n\tvbytes, err := s.codec.Marshal(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.backend.Set(datatype, key, vbytes, indexData); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "46290b9b4f03b07fa08b52df573fea07", "score": "0.6867747", "text": "func (this *ParallelMap) Set(key interface{}, value interface{}) {\n\tthis.wg.Add(1)\n\n\tc := make(chan bool)\n\tthis.Op <- func() error {\n\t\tthis.Map[key] = value\n\n\t\tc <- true\n\t\tthis.wg.Done()\n\t\treturn nil\n\t}\n\t<-c\n}", "title": "" }, { "docid": "e55ce5ab79bebca8133766e74d3a191a", "score": "0.6865004", "text": "func (rs *SessionStore) Set(ctx context.Context, key, value interface{}) error {\n\trs.lock.Lock()\n\tdefer rs.lock.Unlock()\n\trs.values[key] = value\n\treturn nil\n}", "title": "" }, { "docid": "47f5726fc5a05e0f62cd94eefb319899", "score": "0.68582714", "text": "func (s *Store) Set(k, v string) {\n\ts.data[k] = v\n}", "title": "" }, { "docid": "0f3ff54185525bdc92b14776179e9d7e", "score": "0.6841793", "text": "func (s *RedisStore) Set(key string, value interface{}) error {\n\treturn s.SetWithTTL(key, value, s.ttl)\n}", "title": "" }, { "docid": "8fc4a94775e00f4de22781b95456a1b3", "score": "0.6815182", "text": "func (rs *RedisUniversalSessionStore) Set(key, value interface{}) error {\n\tif key == versionKey {\n\t\treturn nil\n\t}\n\n\trs.lock.Lock()\n\tdefer rs.lock.Unlock()\n\trs.values[key] = value\n\trs.changed = true\n\treturn nil\n}", "title": "" }, { "docid": "b9adcd6e4b65fd18e78357bbf6f3cb95", "score": "0.6803594", "text": "func Set(key string, value interface{}) {\n\tStore.Set(key, value, cache.NoExpiration)\n}", "title": "" }, { "docid": "82c8d212c185faf71f1522479e1d1c81", "score": "0.68014", "text": "func (hm *Map) Set(key MonotonicallySerializable, value proto.Message) error {\n\tbyteKey := key.MonotonicMarshal()\n\n\tbyteValue, err := proto.Marshal(value)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"couldn't marshal value\")\n\t}\n\n\terr = hm.tx.Set(byteKey, byteValue)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"couldn't add element to map\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "694f9c2398e97749c7b4791667273c2e", "score": "0.6796149", "text": "func (m *ConcurrentUserMap) Set(key rose.UserID, value rose.User) {\n\t// Get map shard.\n\tshard := m.GetShard(key)\n\tshard.Lock()\n\tdefer shard.Unlock()\n\tshard.items[key] = value\n}", "title": "" }, { "docid": "b82e8ea33d8c12b61c1ca3a3e5e197f4", "score": "0.67861164", "text": "func (c *Cache) set(shardID uint32, key, value []byte, d time.Duration) error {\n\tif c == nil {\n\t\treturn errNotInitialized\n\t}\n\tif err := validateSet(key, value); err != nil {\n\t\treturn err\n\t}\n\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tif err := c.shards[shardID].set(key, value, d); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9e97f06eebc37b3d355f1228527589b3", "score": "0.67653877", "text": "func Set(key interface{}, data Data) {\n\tdm := fetchDataMap(false)\n\tdm.data[key] = data\n}", "title": "" }, { "docid": "7c051ebff638bf49fb22914700870055", "score": "0.67628574", "text": "func (g *Geymsla) Set(key string, value interface{}) error {\n\tif value == nil {\n\t\treturn errors.New(\"Bad value: Value cannot be nil\")\n\t}\n\t_bytes, err := msgpack.Marshal(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn g.store.Update(func(tx *bolt.Tx) error {\n\t\treturn tx.Bucket(bucketName).Put([]byte(key), _bytes)\n\t})\n}", "title": "" }, { "docid": "44fc122b67d8d070be603d1ffb9338f8", "score": "0.6748998", "text": "func (v *Map) Set(key string, value interface{}) {\n\tv.version[v.me]++\n\trecord := Record{Key: key, Value: value, Dot: VVDot{SourceID: v.me, Version: v.version[v.me]}}\n\tv.storage[key] = record\n}", "title": "" }, { "docid": "ac0d36a25be5ade62093424f7312f665", "score": "0.6748078", "text": "func (s *KademliaStore) Set(key, val []byte, ttl time.Duration) {\n\ts.Store.Set(s.dataKey(key), val, ttl)\n\tif b, err := time.Now().UTC().MarshalBinary(); err == nil {\n\t\ts.Store.Set(s.replicationKey(key), b, ttl)\n\t}\n}", "title": "" }, { "docid": "da158af7143cff752d028640397008fb", "score": "0.6734582", "text": "func SetKey(client hazelcast.IHazelcastInstance, routineIndex int) {\n\tstartTime := time.Now()\n\tmp, _ := client.GetMap(mapName)\n\tfor index := 0; index < maxKeyNumber; index++ {\n\t\tmp.SetWithTtl(fmt.Sprintf(\"%s%d-%d\", \"key_\", routineIndex,index), fmt.Sprintf(\"%s%d-%d\", \"value_\", routineIndex,index), keyLifeTime, time.Second)\n\t\tgo GetKey(client,index,routineIndex)\n\t}\n\tfmt.Printf(\"%s%d\", \"Set Key End:\", routineIndex)\n\t//calculate duraction time\n\tendTime := time.Now()\n\telapsed := endTime.Sub(startTime)\n\tfmt.Printf(\"%d%s%d\\n\", routineIndex, \" Duraction : \", elapsed.Seconds())\n}", "title": "" }, { "docid": "70f4e96a38a99dc626f780b1280c30c7", "score": "0.6722712", "text": "func (k *kvstore) Set(key []byte, value []byte, expirationTime time.Time, replicationInterval time.Duration) {\n\tk.mtx.Lock()\n\tdefer k.mtx.Unlock()\n\tk.table[string(key)] = &Value{Value: value, ExpirationTime: expirationTime, LastTimeReplicated: time.Now(), ReplicationInterval: replicationInterval}\n}", "title": "" }, { "docid": "d65d24ac248986fb3ba1a4d6c3b27830", "score": "0.67120284", "text": "func Set(key string, value string) error {\n\n conn := Pool.Get()\n defer conn.Close()\n\n _, err := conn.Do(\"SET\", key, value)\n if err != nil {\n return fmt.Errorf(\"error setting key %s to %s: %v\", key, value, err)\n }\n return err\n}", "title": "" }, { "docid": "a5f11649feb2dd7157aa1157cfe0d28a", "score": "0.6710698", "text": "func (ss *SecretStore) Set(key, value string) {\n\tss.mut.Lock()\n\tdefer ss.mut.Unlock()\n\n\tss.kv[key] = value\n}", "title": "" }, { "docid": "c2ff3cd3aa89ce1f31b344a5251933f7", "score": "0.67076766", "text": "func (s *Session) Set(key string, value interface{}) {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\ts.data[key] = value\n}", "title": "" }, { "docid": "eedae6c066598ffe5b6b92065bc410c3", "score": "0.670401", "text": "func (s *RistrettoStore) Set(key interface{}, value interface{}, options *Options) error {\n\tvar err error\n\n\tif options == nil {\n\t\toptions = s.options\n\t}\n\n\tif set := s.client.Set(key, value, options.CostValue()); !set {\n\t\terr = fmt.Errorf(\"An error has occured while setting value '%v' on key '%v'\", value, key)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "0997711425b8268559da21b142a07616", "score": "0.67037255", "text": "func Set(key string, value interface{}) (string, error) {\n\treturn globalClient.Set(key, value, 0).Result()\n}", "title": "" }, { "docid": "2df3cf43391f6bf01a4564142a430765", "score": "0.6698259", "text": "func (rs *SessionStore) Set(key, value interface{}) error {\n\treturn (*cluster.SessionStore)(rs).Set(context.Background(), key, value)\n}", "title": "" }, { "docid": "ccc3320d559dc606e3cc31be755b95f8", "score": "0.668265", "text": "func (kvs *KvStore) Set(key string, value string) {\r\n\tlog.Printf(\"Trying to set value for the %s key with value %s\", key, value)\r\n\tvar buf bytes.Buffer\r\n\tif err := gob.NewEncoder(&buf).Encode(kv{key, value, SET}); err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tlog.Printf(\"Here done\")\r\n\t//sending to raft to process and raft will reply on commit channel\r\n\tkvs.processC <- buf.Bytes()\r\n\tlog.Printf(\"Done\")\r\n}", "title": "" }, { "docid": "3f69215feefaa1ed89b189e18a8700e7", "score": "0.66821945", "text": "func (s *KVStore) Set(key string, value string) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\ts.m[key] = KVPair{key, value}\n}", "title": "" }, { "docid": "734b35d673d7a34236c8866baae3e81c", "score": "0.66756606", "text": "func (c *cache) Set(key string, value []byte) {\n\tc.cluster.Set(cacheKey(key), string(value), c.ttl)\n}", "title": "" }, { "docid": "279133739d0aec1d0010dfe588de4aa4", "score": "0.66728365", "text": "func (s *RaftStore) Set(key, value string) error {\n\tif !s.IsLeader() {\n\t\treturn ErrNotLeader\n\t}\n\n\tc := &Command{Op: \"set\", Key: key, Value: value, Time: FormatTime(time.Now())}\n\tf := s.raft.Apply(JsonifyBytes(c), raftTimeout)\n\n\treturn f.Error()\n}", "title": "" }, { "docid": "d105352241ab2a0ad267695f7357e4e0", "score": "0.66667414", "text": "func (s *RaftConsensusService) Set(key string, value []byte) error {\n\tif s.raft.State() != raft.Leader {\n\t\treturn ErrNotLeader\n\t}\n\n\tc := &command{\n\t\tOp: \"set\",\n\t\tKey: key,\n\t\tValue: value,\n\t}\n\tb, err := json.Marshal(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf := s.raft.Apply(b, raftTimeout)\n\treturn f.Error()\n}", "title": "" }, { "docid": "8f65d0e25c7b73479e7997e1e6ec789a", "score": "0.66562486", "text": "func Set(key string, value interface{}) { v.Set(key, value) }", "title": "" }, { "docid": "ebc4efa8370d73af8e741d3581817872", "score": "0.6652965", "text": "func (s *DBStore) Set(key, val any) error {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\ts.data[key] = val\n\treturn nil\n}", "title": "" }, { "docid": "95498f5b83fa33ad54fe61c0216d5f6e", "score": "0.66511965", "text": "func (s *CacheStore) Set(key string, value string) {\n now := time.Now()\n duration := time.Millisecond * time.Duration(s.GlobalExpiry)\n expiry := int64(now.Add(duration).UnixNano())\n\n cv := &CacheValue{\n Value: value,\n Expiry: expiry,\n }\n\n s.mutex.Lock()\n s.Cache.Add(key, cv)\n s.mutex.Unlock()\n}", "title": "" }, { "docid": "51273306114a7911cd9715d92a8116af", "score": "0.66510636", "text": "func (l *InMem) SetKey(key string, value string) {\n\tl.mutex.Lock()\n\tl.store[key] = value\n\tl.mutex.Unlock()\n}", "title": "" }, { "docid": "8d4322994a8aff2e026581722db6e157", "score": "0.66494584", "text": "func (s *RedisStore) Set(id session.Id, key string, val interface{}) error {\n\tbs, err := s.serialize(val)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = s.Do(\"HSET\", id, key, bs)\n\tif err == nil {\n\t\t// when write data, reset maxage\n\t\t_, err = s.Do(\"EXPIRE\", id, s.maxSeconds())\n\t}\n\treturn err\n}", "title": "" }, { "docid": "f3962a49dc35b6043d5e5026f53e6952", "score": "0.66481084", "text": "func (sm *merkleMap) set(key string, value []byte) {\n\tbyteKey := []byte(key)\n\tassertValidKey(byteKey)\n\n\tsm.sorted = false\n\n\t// The value is hashed, so you can check for equality with a cached value (say)\n\t// and make a determination to fetch or not.\n\tvhash := tmhash.Sum(value)\n\n\tsm.kvs.Pairs = append(sm.kvs.Pairs, kv.Pair{\n\t\tKey: byteKey,\n\t\tValue: vhash,\n\t})\n}", "title": "" }, { "docid": "d6775d877aad88fcbea7b200c00c8211", "score": "0.6632412", "text": "func (cli *Client) Set(key, value string) error {\n\tq := cli.Store.Query()\n\tq.Add(\"k\", key)\n\tq.Add(\"v\", value)\n\tcli.Store.RawQuery = q.Encode()\n\treq, err := http.NewRequest(\"PUT\", cli.Store.String(), nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to put to store: %v\", err)\n\t}\n\tresp, err := cli.client.Do(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid response from store: %v\", err)\n\t}\n\tdefer func() {\n\t\tif err := resp.Body.Close(); err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\t}()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"response from store not OK: %s\", http.StatusText(resp.StatusCode))\n\t}\n\tdat, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid response from store: %v\", err)\n\t}\n\twant := fmt.Sprintf(\"%s: %s\", key, value)\n\tif !bytes.Equal([]byte(want), dat) {\n\t\treturn fmt.Errorf(\"unable to set key value in store\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b870d0182b35f284dc84899de1f27152", "score": "0.66302216", "text": "func (g *gache) set(key string, val interface{}, expire int64) {\n\tif expire > 0 {\n\t\texpire = fastime.UnixNanoNow() + expire\n\t}\n\tatomic.AddUint64(&g.l, 1)\n\tg.shards[xxhash.Sum64(*(*[]byte)(unsafe.Pointer(&key)))&mask].Store(key, value{\n\t\texpire: expire,\n\t\tval: val,\n\t})\n}", "title": "" }, { "docid": "bd4abc2621b9578259138d8f942b1af1", "score": "0.6629958", "text": "func Set(key string, value []byte) error {\n\tif d.Has(key) {\n\t\treturn errors.New(\"value already exists\")\n\t}\n\terrWrite := d.Write(key, value)\n\tif errWrite != nil {\n\t\treturn errWrite\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c55cb862aecca43086f79d4f274da13a", "score": "0.66269696", "text": "func (c *MemoryCache) Set(key string, value interface{}) error {\n\tif !c.enabled {\n\t\treturn nil\n\t}\n\tDebug(\"setting value for key '%s' in cache\", key)\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\tc.datastore[key] = value\n\tc.expireStore[key] = time.Now()\n\treturn nil\n}", "title": "" }, { "docid": "253ff4909e3c4f29abcb64365c55e854", "score": "0.66118073", "text": "func (sm *simpleMap) Set(key string, value Hasher) {\n\tsm.sorted = false\n\n\t// The value is hashed, so you can\n\t// check for equality with a cached value (say)\n\t// and make a determination to fetch or not.\n\tvhash := value.Hash()\n\n\tsm.kvs = append(sm.kvs, cmn.KVPair{\n\t\tKey: []byte(key),\n\t\tValue: vhash,\n\t})\n}", "title": "" }, { "docid": "27cce71dabab6a0d3fa6122b9dec1964", "score": "0.6601355", "text": "func (d *Driver) Set(key []byte, value []byte) error {\n\tconn := d.Pool.Get()\n\tdefer conn.Close()\n\t_, err := conn.Do(\"SET\", d.getKey(key), value)\n\treturn convertError(err)\n}", "title": "" }, { "docid": "74fae03eed79f68de42947e6fe4341c3", "score": "0.6590874", "text": "func (m *memory) Set(key string, value []byte) error {\n\tif m.data == nil {\n\t\treturn errors.New(\"brain was already shut down\")\n\t}\n\n\tm.data[key] = value\n\treturn m.persist()\n}", "title": "" }, { "docid": "3b64c9880b2ce8e6bf6f380a16815e81", "score": "0.6569717", "text": "func (sm *simpleMap) Set(key string, value []byte) {\n\tbyteKey := []byte(key)\n\tassertValidKey(byteKey)\n\tsm.sorted = false\n\n\t// The value is hashed, so you can\n\t// check for equality with a cached value (say)\n\t// and make a determination to fetch or not.\n\tvhash := tmhash.Sum(value)\n\n\tsm.Kvs.Pairs = append(sm.Kvs.Pairs, kv.Pair{\n\t\tKey: byteKey,\n\t\tValue: vhash,\n\t})\n}", "title": "" }, { "docid": "d62676c10d6e25f95079cfd518f35199", "score": "0.6567904", "text": "func (c *Map) Set(key string, newValue interface{}) error {\n\tshard, err := c.getShard(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tshard.Lock()\n\tdefer shard.Unlock()\n\n\tshard.items[key] = newValue\n\treturn nil\n}", "title": "" }, { "docid": "f314b1bb76de31210fe944579fcbee80", "score": "0.6565237", "text": "func (db *Database) Set(sid string, key string, value interface{}, dur time.Duration, immutable bool) error {\n\tvalueBytes, err := sessions.DefaultTranscoder.Marshal(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// convert []byte slice to base64 string\n\tvalueBase := base64.StdEncoding.EncodeToString(valueBytes)\n\tctx := context.Background()\n\tquery := `\n\t{\n\t\t q(func: eq(skey, \"` + key + `\")) @filter(eq(sid, \"` + sid + `\")) {\n\t\t\tv as uid\n\t\t }\n\t}\n`\n\n\tmutation := `\n\tuid(v) <sid> \"` + sid + `\" .\n\tuid(v) <skey> \"` + key + `\" .\n\tuid(v) <svalue> \"` + valueBase + `\" . \n\tuid(v) <dgraph.type> \"SessionEntry\" . \n\t`\n\n\treq := &api.Request{\n\t\tQuery: query,\n\t\tMutations: []*api.Mutation{\n\t\t\t{\n\t\t\t\tSetNquads: []byte(mutation),\n\t\t\t},\n\t\t},\n\t\tCommitNow: true,\n\t}\n\n\t_, err = db.Service.NewTxn().Do(ctx, req)\n\treturn err\n}", "title": "" }, { "docid": "79ae75ad41ec0e71fe94a886955d0e02", "score": "0.65493226", "text": "func (conn *Conn) Set(key string, value interface{}) Reply {\n\treturn conn.Do(\"SET\", key, value)\n}", "title": "" }, { "docid": "d9ecbc7e4ced6325903a1651a5442011", "score": "0.6548337", "text": "func (d Database) Set(key KeyConvertible, value []byte) error {\n\t_, e := d.Transact(func (tr Transaction) (interface{}, error) {\n\t\ttr.Set(key, value)\n\t\treturn nil, nil\n\t})\n\tif e != nil {\n\t\treturn e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a921d1d8d644bdb1bf0835b6d0f8be8", "score": "0.65266114", "text": "func (m *SubscriberMap) SetValue(key int32, value Subscriber) {\n\t((*sync.Map)(m)).Store(key, value)\n}", "title": "" }, { "docid": "40fd92b7c953264ba70f566c517c6d99", "score": "0.6517251", "text": "func (db *DB) Set(key string, value []byte) (err error) {\n\tdb.statSet.Incr()\n\terr = db.Store.PutAsync([]byte(key), value)\n\treturn\n}", "title": "" }, { "docid": "ac61315116c3d61c533b6893bfae002b", "score": "0.6508452", "text": "func (s *Server) Set(key, value []byte) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\treturn s.setKeyValue(key, value)\n}", "title": "" }, { "docid": "a2edd2e40291bfd6c5e02c565583d222", "score": "0.650219", "text": "func (redisProvider *RedisProvider) Set(key string, value []byte) error {\n\tconn := redisProvider.redisPool.Get()\n\tdefer conn.Close()\n\n\t_, err := conn.Do(ACTION_SET, key, string(value))\n\treturn err\n}", "title": "" }, { "docid": "06c5b54686700b67b361939d37fd9613", "score": "0.6498124", "text": "func (store *store) Set(key []byte, value []byte) error {\n\tdb, err := store.getDb()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tupdateHandler := func(txn *badger.Txn) error {\n\t\te := badger.NewEntry(key, value)\n\t\terr := txn.SetEntry(e)\n\t\treturn err\n\t}\n\n\tif err := db.Update(updateHandler); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bf9b867dccd43fae5f15839637e561ae", "score": "0.64873654", "text": "func (p *ScopedBBoltPersister) Set(key string, val []byte) {\n\tp.cacheMux.Lock()\n\tp.cache[key] = val\n\tp.cacheMux.Unlock()\n}", "title": "" }, { "docid": "35b5c8ed8183ddfc85aa51177ba4dc93", "score": "0.64808816", "text": "func (s Session) Set(key string, value interface{}) {\n\ts.data.Values[key] = value\n}", "title": "" }, { "docid": "0f47ec2cfe9079f35f1ea95d8dc6141a", "score": "0.64808345", "text": "func (m *zkmap) Set(key string, value interface{}) error {\n\tt := reflect.ValueOf(value)\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tm.fields[key] = t\n\n\tvar data []byte\n\tswitch t.Kind() {\n\tcase reflect.Int, reflect.Int32:\n\t\tdata = []byte(strconv.FormatInt(t.Int(), 10))\n\tcase reflect.Bool:\n\t\tdata = []byte(strconv.FormatBool(t.Bool()))\n\tcase reflect.String:\n\t\tdata = []byte(t.String())\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported type %T value %v\", value, value)\n\t}\n\n\tflags := int32(0)\n\tacl := zk.WorldACL(zk.PermAll)\n\n\tpath := fmt.Sprintf(\"%s/%s\", m.root, key)\n\t_, err := m.zk.Create(path, data, flags, acl)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't create path %s: %v\", path, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "37552116c501457c49d52638bd1471d8", "score": "0.64747953", "text": "func (s *Store) Set(key string, value interface{}, expiration time.Duration) error {\n\treturn s.db.Update(func(tx *boltdb.Tx) error {\n\t\tb, err := tx.CreateBucketIfNotExists(bucket)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuf, err := store.Marshal(value)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := b.Put([]byte(key), buf); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tb, err = tx.CreateBucketIfNotExists(bucketTTL)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn b.Put([]byte(key), []byte(fmt.Sprintf(\"%d\", expiration)))\n\t})\n}", "title": "" }, { "docid": "cb3db86b6f160dca77d5dd44c32fc995", "score": "0.6470382", "text": "func (m *RedisStringMap) Set(key, value string) error {\n\t// Don't care about overwriting vs new.\n\tif result := m.redisClient.HSet(m.bucket, key, value); result.Err() != nil {\n\t\treturn result.Err()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "97e024fdabfa51c0417c917d568fdb98", "score": "0.6467695", "text": "func (m *DispatchMap) SetValue(key int32, value *SubscriberMap) {\n\t((*sync.Map)(m)).Store(key, value)\n}", "title": "" }, { "docid": "35f326fdc564afda50b8cc4ec0551b2e", "score": "0.64567345", "text": "func (n *HashMap[K, V]) Set(key K, value V) {\n\tn.data.Store(key, value)\n}", "title": "" }, { "docid": "58745e7fa46517329f95796dc6eca043", "score": "0.6451054", "text": "func (c *Context) Set(key interface{}, value interface{}) {\n\t// Get the namespace.\n\tns := c.ns\n\n\t// Lock the mutex.\n\tns.mutex.Lock()\n\tdefer ns.mutex.Unlock()\n\n\tns.values[key] = value\n}", "title": "" }, { "docid": "a5a16c2f22d7a8509fbe156266952184", "score": "0.64299697", "text": "func (c configMapStore) Set(ctx context.Context, key string, value interface{}) error {\n\t// Marshal the the given value as JSON.\n\tdata, err := json.Marshal(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Construct a patch for setting the data value.\n\tpatch := configMapPatch{\n\t\tData: map[string]interface{}{\n\t\t\tkey: string(data),\n\t\t},\n\t}\n\n\t// Convert the patch to JSON.\n\tpayload, err := json.Marshal(patch)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Use the Kuberneties API to patch the backing ConfigMap.\n\t_, err = c.client.Patch(ctx, c.name, types.MergePatchType, payload, metav1.PatchOptions{})\n\tif err != nil {\n\t\tif isResourceMissingError(err) {\n\t\t\t// If the backing ConfigMap does not exist, then create it\n\t\t\t// on-demand, and retry setting the value.\n\t\t\tif err := c.create(ctx); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn c.Set(ctx, key, value)\n\t\t}\n\t\t// Some other kind of error was encountered.\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "42470c4979667a4782015dd8a89b9b59", "score": "0.64232713", "text": "func (kvs *FileSystemKVStore) Set(key string, value []byte) error {\n\treturn lockedfile.Write(kvs.filename(key), bytes.NewReader(value), 0600)\n}", "title": "" }, { "docid": "16edbeaf3b53f477614dc6b41914f622", "score": "0.6422541", "text": "func (s Subspace) Set(ctx Ctx, key []byte, param interface{}) {\n\tstore := s.kvStore(ctx)\n\ts.checkType(store, key, param)\n\tbz, err := s.cdc.MarshalJSON(param)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = store.Set(key, bz)\n\ttstore := s.transientStore(ctx)\n\t_ = tstore.Set(key, []byte{})\n}", "title": "" }, { "docid": "184cb7b0c341c11d8a43c2fc9c9170e8", "score": "0.64223313", "text": "func (cs *CacheStorage) Set(key uint64, value uint64) error {\n\tcs.l.Lock()\n\tcs.stateCache[key] = value\n\tcs.l.Unlock()\n\treturn cs.s.Set(key, value)\n}", "title": "" }, { "docid": "86974db9518e07d52314e9891b6cb18f", "score": "0.64214766", "text": "func (m *DummyCache) Set(key string, value interface{}) {\n}", "title": "" }, { "docid": "dae8116eadb2e169c0abb8e15bcde834", "score": "0.6418676", "text": "func Set(k string, v interface{}) error {\n\tc, err := Pool.Dial()\n\tif err != nil {\n\t\treturn err\n\t}\n\t_v, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = c.Do(\"SET\", k, _v)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be269d9f748b3ba218aeb49fce564098", "score": "0.6417366", "text": "func (sess *Session) Set(k string, v interface{}) {\n\tsess.mu.Lock()\n\tdefer sess.mu.Unlock()\n\tsess.data[k] = v\n}", "title": "" }, { "docid": "660d90218cbbeb44e1b35de78205fed2", "score": "0.64118844", "text": "func (c *MemCache) Set(key string, data []byte) {\n\tc.dataMutex.Lock()\n\tdefer c.dataMutex.Unlock()\n\tc.vals[key] = data\n}", "title": "" }, { "docid": "d185e27967c0b2f18cf6c4ca15b89379", "score": "0.640633", "text": "func (s StorageMap) SetValue(interpreter *Interpreter, key StorageMapKey, value atree.Value) (existed bool) {\n\tinterpreter.recordStorageMutation()\n\n\texistingStorable, err := s.orderedMap.Set(\n\t\tkey.AtreeValueCompare,\n\t\tkey.AtreeValueHashInput,\n\t\tkey.AtreeValue(),\n\t\tvalue,\n\t)\n\tif err != nil {\n\t\tpanic(errors.NewExternalError(err))\n\t}\n\tinterpreter.maybeValidateAtreeValue(s.orderedMap)\n\n\texisted = existingStorable != nil\n\tif existed {\n\t\texistingValue := StoredValue(interpreter, existingStorable, interpreter.Storage())\n\t\texistingValue.DeepRemove(interpreter)\n\t\tinterpreter.RemoveReferencedSlab(existingStorable)\n\t}\n\treturn\n}", "title": "" }, { "docid": "53a4f3a5155067da63eb7a734b45d1fa", "score": "0.6404443", "text": "func Set(key, value string) error {\n\treturn client.Set(key, value, 0).Err()\n}", "title": "" }, { "docid": "f2af03136499f4d16a2c635da67cb742", "score": "0.64020437", "text": "func (cm *CMap) Set(key KT, val VT) {\n\th := hasher(key)\n\tcm.shards[h&uint32(len(cm.shards)-1)].Set(key, val)\n}", "title": "" }, { "docid": "3b0c6027e8520e19ff6ff38c1dca0bdc", "score": "0.63979125", "text": "func (r *Redis) Set(key, value string) error {\n\tfmt.Println(key, value)\n\treturn r.client.Set(key, value, 0).Err()\n}", "title": "" }, { "docid": "d7c61c9f9d7327b9b8ed43c1c5152820", "score": "0.6397558", "text": "func (m *lockingMap) Set(key string, val interface{}) {\n\tm.keyLocker.Lock(key)\n\tdefer m.keyLocker.Unlock(key)\n\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\tm.data[key] = val\n}", "title": "" }, { "docid": "81c69b6ca53277cfc0b5c56556eb2cda", "score": "0.6397369", "text": "func (s *Driver) Set(key string, value interface{}) error {\n\t_, err := r.Table(s.table).Insert(map[string]interface{}{\n\t\t\"id\": key,\n\t\t\"value\": value,\n\t}, r.InsertOpts{\n\t\tConflict: \"replace\",\n\t}).RunWrite(s.session)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b0367980aea4a9b7e063c8048f3d5dfa", "score": "0.63963944", "text": "func (container *LockFreeMap[Key, T]) Set(key Key, value T) {\n\tcontainer.lock.Store(true)\n\tcontainer.items[key] = value\n}", "title": "" }, { "docid": "95e41f3f56b3588f65698805f6b33799", "score": "0.6389941", "text": "func (m *EventTypeMap) SetValue(key string, value int32) {\n\t((*sync.Map)(m)).Store(key, value)\n}", "title": "" }, { "docid": "80f0b59a67bf09b471339d21d2dcef1a", "score": "0.63876456", "text": "func (c *Context) StoreSet(key interface{}, value interface{}) {\n\t// Get the data pointer.\n\tdata := c.data\n\n\t// Lock the mutex.\n\tdata.valuesMutex.Lock()\n\tdefer data.valuesMutex.Unlock()\n\n\t// Set the value.\n\tdata.createValuesMapIfNil()\n\tdata.Values[key] = value\n\n\t// Tell the session, that data might have changed.\n\tc.ns.s.Dirty()\n}", "title": "" }, { "docid": "e178f2b9a62e3f36716a743f36ec505b", "score": "0.6377661", "text": "func (conn *Connection) Set(key string, value interface{}) error {\n\tcn := conn.Pool.Get()\n\tif cn == nil {\n\t\treturn errors.New(\"error getting pool connection\")\n\t}\n\n\t_, err := cn.Do(\"SET\", key, value)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error SET (%s) on host: %s\", err, conn.Host)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6eefcd2b4c36dca53ee848c0b0134007", "score": "0.63770676", "text": "func Set(key string, val interface{}) {\n\tstateMachine.cmdChan <- &command{\n\t\tType: SET,\n\t\tKey: key,\n\t\tValue: val,\n\t}\n}", "title": "" }, { "docid": "626ed135431bbd3379e5e2fa376b8b64", "score": "0.6371807", "text": "func (_m *Manager) Set(ctx context.Context, key string, value interface{}) {\n\t_m.Called(ctx, key, value)\n}", "title": "" } ]
a2c6d11937dad5270653c6a82eb870dd
NewDefaultOCIormb creates a OCIbased ORMB client.
[ { "docid": "d75f5f904a57d6d24fdaaadffe694303", "score": "0.8630439", "text": "func NewDefaultOCIormb() (ORMB, error) {\n\tc, err := oci.NewClient(oci.ClientOptWriter(os.Stdout))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ociORMB{\n\t\tclient: c,\n\t}, nil\n}", "title": "" } ]
[ { "docid": "50525399fda6add0007688edd0b38ff7", "score": "0.62188005", "text": "func NewOCI() *OCI {\n\treturn &OCI{}\n}", "title": "" }, { "docid": "35d815d95c2371f9d8b4d9d3abffb901", "score": "0.6097293", "text": "func newOracleClient() *oracleClient {\n\tb, err := crypto.GetRandomBytes(4)\n\tif err != nil {\n\t\tlog.Panic(\"newOracleClient panicked: %v\", err)\n\t}\n\tworld := big.NewInt(0).SetBytes(b).Uint64()\n\treturn newClientWithWorldID(world)\n}", "title": "" }, { "docid": "e18fa39a62d3543c3f7064ab153bffd1", "score": "0.6033414", "text": "func NewCreateIOCDefault(code int) *CreateIOCDefault {\n\treturn &CreateIOCDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "532c17ecd604a4b703c84d2f82c42985", "score": "0.5964577", "text": "func New(name string, params chaincfg.Params, nRpoints int) (*Oracle, error) {\n\tif isMainNet(params) {\n\t\treturn nil, fmt.Errorf(\"mainnet isn't supported yet\")\n\t}\n\n\tmKey, err := randMasterKey(name, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toracle := &Oracle{name: name, nRpoints: nRpoints, masterKey: mKey}\n\treturn oracle, nil\n}", "title": "" }, { "docid": "8afdd358f9af44cc7a41f6ef9b184d08", "score": "0.5741579", "text": "func DefaultOracleParams() OracleParams {\n\treturn NewOracleParams(\n\t\t32,\n\t\t10,\n\t\t6,\n\t\t50_000,\n\t\t200_000,\n\t\t\"desmos-ibc-profiles\",\n\t\tsdk.NewCoin(\"band\", sdk.NewInt(10)),\n\t)\n}", "title": "" }, { "docid": "387a52430a56b5e699f31648857a20f9", "score": "0.57131976", "text": "func NewDefaultClient(key, secret string) *Client {\n\treturn &Client{\n\t\tapi: \"https://b2b.daowallet.com/api/v2\",\n\t\tapiKey: key,\n\t\tsecret: secret,\n\t\tclient: &http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tDialContext: (&net.Dialer{\n\t\t\t\t\tTimeout: 10 * time.Second,\n\t\t\t\t\tKeepAlive: 10 * time.Second,\n\t\t\t\t}).DialContext,\n\t\t\t\tTLSHandshakeTimeout: 10 * time.Second,\n\t\t\t\tExpectContinueTimeout: 4 * time.Second,\n\t\t\t\tResponseHeaderTimeout: 3 * time.Second,\n\t\t\t},\n\t\t\tTimeout: 10 * time.Minute,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "4630e53cf1c8f3f75a7a4473efc902bd", "score": "0.544471", "text": "func New(config model.Config) (model.Client, error) {\n\tconfig, err := validateConfig(config)\n\tif err != nil {\n\t\tWriteLogFile(err)\n\t\treturn nil, err\n\t}\n\tc := client{config}\n\tconn, err := connect(c.Host) // test connection\n\tif err != nil {\n\t\tWriteLogFile(err)\n\t\treturn nil, err\n\t}\n\tif err = conn.Bind(c.ROUser.Name, c.ROUser.Password); err != nil {\n\t\tWriteLogFile(err)\n\t\treturn nil, err\n\t}\n\tconn.Close()\n\treturn c, err\n}", "title": "" }, { "docid": "4608f09e8d9751d82e51625a15fe5701", "score": "0.54058933", "text": "func New(apiKey string) *Client {\n\tif apiKey == \"\" {\n\t\tpanic(\"can not create omdb client with empty apikey\")\n\t}\n\n\thttpClient := &http.Client{Timeout: time.Duration(10) * time.Second}\n\treturn &Client{httpClient, apiKey}\n}", "title": "" }, { "docid": "f007c6c2c61c0df774558014be3b28c5", "score": "0.5317668", "text": "func NewDefault(m map[string]interface{}) (share.Manager, error) {\n\tc := &config{}\n\tif err := mapstructure.Decode(m, c); err != nil {\n\t\terr = errors.Wrap(err, \"error creating a new manager\")\n\t\treturn nil, err\n\t}\n\n\ts, err := metadata.NewCS3Storage(c.GatewayAddr, c.ProviderAddr, c.ServiceUserID, c.ServiceUserIdp, c.MachineAuthAPIKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tindexer := indexer.CreateIndexer(s)\n\n\tclient, err := pool.GetGatewayServiceClient(c.GatewayAddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn New(client, s, indexer)\n}", "title": "" }, { "docid": "edb9d81e0ae82e1050671a4e4de6c96a", "score": "0.5293532", "text": "func ConnectDefault(dbName string, models []interface{}) (*gorm.DB, error) {\n\tconfig := CreateDefaultDBConfig()\n\tconfig.DBName = dbName\n\tclient := NewClientFromConfig(config)\n\treturn client.InitDB(models)\n}", "title": "" }, { "docid": "b77fc281cc5ec37cd0f8ab3d4727bf77", "score": "0.5257788", "text": "func NewDefaultClient(addr string, httpRetryAttempts int) (*DefaultClient, error) {\n\tclient, err := nomad.NewClient(&nomad.Config{\n\t\tAddress: addr,\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &DefaultClient{\n\t\tAddress: addr,\n\t\tClient: client,\n\t\thttpRetryAttempts: httpRetryAttempts,\n\t}, nil\n}", "title": "" }, { "docid": "419143ddb3c5c44d874d113cfbacf55a", "score": "0.52157515", "text": "func InitDefault(conn *Connection) error {\n\tSetDefault(conn)\n\t_, err := conn.Open()\n\treturn err\n}", "title": "" }, { "docid": "facc960e4e4fb33becfd5e1bb264527a", "score": "0.5209549", "text": "func OpenDefaultEngine() *Engine { return OpenEngine(tsdb.NewEngineOptions()) }", "title": "" }, { "docid": "733c6e60b8839a475bbf3d258a9341c7", "score": "0.5166635", "text": "func New(transport runtime.ClientTransport, formats strfmt.Registry) *OpenbankingPaymentsClient {\n\t// ensure nullable parameters have default\n\tif formats == nil {\n\t\tformats = strfmt.Default\n\t}\n\n\tcli := new(OpenbankingPaymentsClient)\n\tcli.Transport = transport\n\tcli.DomesticPayments = domestic_payments.New(transport, formats)\n\tcli.DomesticScheduledPayments = domestic_scheduled_payments.New(transport, formats)\n\tcli.DomesticStandingOrders = domestic_standing_orders.New(transport, formats)\n\tcli.FilePayments = file_payments.New(transport, formats)\n\tcli.InternationalPayments = international_payments.New(transport, formats)\n\tcli.InternationalScheduledPayments = international_scheduled_payments.New(transport, formats)\n\tcli.InternationalStandingOrders = international_standing_orders.New(transport, formats)\n\tcli.PaymentDetails = payment_details.New(transport, formats)\n\treturn cli\n}", "title": "" }, { "docid": "87fe177b21dbd7388586ae62500bde18", "score": "0.5143832", "text": "func New(opt ...Option) Client {\n\n\topts := &Options{}\n\tfor _, o := range opt {\n\t\to(opts)\n\t}\n\n\treturn &defaultClient {\n\t\topts: opts,\n\t\tTransport: transport.DefaultClientTransport,\n\t}\n}", "title": "" }, { "docid": "5d25aad1dd327dc9321364d48240e3ee", "score": "0.5109052", "text": "func New() *Bigo {\n\treturn NewWithLogger(DefaultLogger())\n}", "title": "" }, { "docid": "95143157f0e8fd7aba42e2a5fceeb057", "score": "0.509037", "text": "func UnsafeNewDefaultClient() (*Client, error) {\n\treturn dialClient(DefaultAddr())\n}", "title": "" }, { "docid": "ec3c3547ba21cf7c252089a366acf300", "score": "0.50886893", "text": "func (client IdentityClient) createTagDefault(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodPost, \"/tagDefaults\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response CreateTagDefaultResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "244730a837b3d950c1cb367b4342dae8", "score": "0.50859815", "text": "func Default() *Baa {\n\treturn Instance(defaultAppName)\n}", "title": "" }, { "docid": "a4d6a68937506eab1ddc559e7d0489c8", "score": "0.5077456", "text": "func CreateNewClient(database string) MongoInstance {\n\tmongoClient, err := mongo.NewClient(options.Client().ApplyURI(\"mongodb://localhost:27045/\"))\n\tmongoContext, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n\n\tdefer cancel()\n\n\terr = mongoClient.Connect(mongoContext)\n\tdb := mongoClient.Database(database)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := mongoClient.Ping(mongoContext, readpref.Primary()); err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"Successfully connected and pinged.\")\n\n\tmg := MongoInstance{\n\t\tClient: mongoClient,\n\t\tDb: db,\n\t}\n\n\treturn mg\n}", "title": "" }, { "docid": "69f00a0a8cfc9e3de9e54c9e9ec2cd27", "score": "0.5049902", "text": "func NewDefaultClient(t *testing.T) *Client {\n\tcl, err := NewClient(\"service\", \"hostname\", nil)\n\tif err != nil {\n\t\tt.Fatalf(\"could not create default client\")\n\t}\n\n\treturn cl\n}", "title": "" }, { "docid": "874b99924760b6754479a76fe117126f", "score": "0.50226444", "text": "func NewDefaultApiService(db *Database) DefaultApiServicer {\n\treturn &DefaultApiService{db: db}\n}", "title": "" }, { "docid": "41557d4a3e70af3cc84ec6862bb9c0be", "score": "0.5010916", "text": "func init() {\n\tdefaultClient = New(\"\")\n}", "title": "" }, { "docid": "5393e3d7010e1f21ad18306a9a456616", "score": "0.5009393", "text": "func NewDefault(db *bolt.DB) (q queue.WaitQueue, err error) {\n\treturn New(db, DefaultBucket, DefaultMemQueueSize, DefaultBufSize)\n}", "title": "" }, { "docid": "b27ab094ab43df3da2f6bda10ff11954", "score": "0.4997333", "text": "func NewDefault() *instance {\n\treturn New(\n\t\t[]factory.Contract{\n\t\t\texampleMetadataFactory.New(),\n\t\t\tiotaMetadataFactory.New(),\n\t\t\tipfsMetadataFactory.New(),\n\t\t},\n\t)\n}", "title": "" }, { "docid": "b24b97bb6abba01dc024fff60c4d121d", "score": "0.49929386", "text": "func NewCmdOradb(streams genericclioptions.IOStreams) *cobra.Command {\n\to := NewOradbOperations(streams)\n\n\tcmd := &cobra.Command{\n\t\tUse: \"kubectl-oradb list|create|delete [-c cdbname] [-p pdbname] [-w syspassword] [-n namespace]\",\n\t\tShort: \"create or delete Oracle DB statefulset in OKE cluster\",\n\t\tExample: fmt.Sprintf(config.OradbExample),\n\t\tSilenceUsage: true,\n\t\tRunE: func(c *cobra.Command, args []string) error {\n\t\t\t \n\t\t\tif err := o.Complete(c, args); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := o.Validate(c); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := o.Run(); 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\tcmd.Flags().StringVarP(&o.UserSpecifiedCdbname, \"cdbname\", \"c\", \"\", \"User specified CDB name\")\n\t_ = viper.BindEnv(\"cdbname\", \"KUBECTL_PLUGINS_CURRENT_CDBNAME\")\n\t_ = viper.BindPFlag(\"cdbname\", cmd.Flags().Lookup(\"cdbname\"))\n\n\tcmd.Flags().StringVarP(&o.UserSpecifiedPdbname, \"pdbname\", \"p\", \"\", \"User specified PDB name\")\n\t_ = viper.BindEnv(\"pdbname\", \"KUBECTL_PLUGINS_CURRENT_PDBNAME\")\n\t_ = viper.BindPFlag(\"pdbname\", cmd.Flags().Lookup(\"pdbname\"))\n\n\tcmd.Flags().StringVarP(&o.UserSpecifiedNamespace, \"namespace\", \"n\", \"default\", \"User specified namespace\")\n\t_ = viper.BindEnv(\"namespace\", \"KUBECTL_PLUGINS_CURRENT_NAMESPACE\")\n\t_ = viper.BindPFlag(\"namespace\", cmd.Flags().Lookup(\"namespace\"))\n\n\tcmd.Flags().StringVarP(&o.UserSpecifiedSyspassword, \"syspassword\", \"w\", \"H3YX5QRE\",\n\t\"sys system password of DB\")\n\t_ = viper.BindEnv(\"syspassword\", \"KUBECTL_PLUGINS_CURRENT_SYSPASSWORD\")\n\t_ = viper.BindPFlag(\"syspassword\", cmd.Flags().Lookup(\"syspassword\"))\n\n\treturn cmd\n}", "title": "" }, { "docid": "28bfd9b98a8f77dd2c88ed96f6d0fc29", "score": "0.497451", "text": "func NewDefaultClient(ctx context.Context) (*Client, error) {\n\tsock, token, err := DefaultSocketPath()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewClient(ctx, sock, token)\n}", "title": "" }, { "docid": "36bbb1c37209659a756b804370c7f069", "score": "0.49568176", "text": "func NewDefaultCouchbaseFactory() *DefaultCouchbaseFactory {\n\tc := &DefaultCouchbaseFactory{\n\t\tFactory: cbuild.NewFactory(),\n\t}\n\n\tcouchbaseConnectionDescriptor := cref.NewDescriptor(\"pip-services\", \"connection\", \"couchbase\", \"*\", \"1.0\")\n\tc.RegisterType(couchbaseConnectionDescriptor, connect.NewCouchbaseConnection)\n\n\treturn c\n}", "title": "" }, { "docid": "68ed8fa75db87907d75217f4b834ca03", "score": "0.49449536", "text": "func NewDefaultClient() *Client {\n\taddress := os.Getenv(\"VAULT_ADDR\")\n\tif address == \"\" {\n\t\taddress = \"http://127.0.0.1:8200\"\n\t}\n\treturn &Client{&http.Client{}, address, os.Getenv(\"VAULT_TOKEN\"), NewStdLogger()}\n}", "title": "" }, { "docid": "374b2bdad73f219d4730ccff467b1a8b", "score": "0.49322972", "text": "func Default() (e *Engine, ie *InternalEngine) {\n\n\t// setup database\n\tdb := database.DefaultSQL()\n\n\t// migrate cms db\n\tdb.SQL.MigrateSql()\n\n\t// check for rsa keys\n\tsecurity.CheckOrGenRSAKeysAndSecrets(db.SQL.Dbx)\n\n\t// setup log level\n\tswitch context.Config.EnvVars.LogLevel {\n\tcase log.LOG_LEVEL_CRITICAL:\n\t\tfallthrough\n\tcase log.LOG_LEVEL_ERROR:\n\t\tgin.SetMode(gin.ReleaseMode)\n\tcase log.LOG_LEVEL_WARNING:\n\t\tgin.SetMode(gin.TestMode)\n\tcase log.LOG_LEVEL_DEBUG:\n\t\tgin.SetMode(gin.DebugMode)\n\t}\n\tr := gin.Default()\n\tir := gin.Default()\n\n\t// setup repositories\n\trg := repository.DefaultRepositoriesGroup(db.SQL.Dbx)\n\n\t// setup services\n\tsg := service.DefaultServicesGroup(rg, db)\n\n\t// setup controllers\n\tcg := controller.DefaultControllerGroup(r, sg)\n\ticg := controller.DefaultInternalControllerGroup(ir, sg)\n\n\t// create engine\n\te = &Engine{\n\t\tGin: r,\n\t\tControllersGroup: cg,\n\t\tServicesGroup: sg,\n\t\tRepositoriesGroup: rg,\n\t\tDatabase: db,\n\t}\n\n\t// create engine\n\tie = &InternalEngine{\n\t\tGin: ir,\n\t\tInternalControllersGroup: icg,\n\t\tServicesGroup: sg,\n\t\tRepositoriesGroup: rg,\n\t\tDatabase: db,\n\t}\n\n\treturn e, ie\n}", "title": "" }, { "docid": "32384dd17e1e4ea6b19f1d8fb282bf23", "score": "0.4928719", "text": "func NewDefaultClient(svcURL ServiceURL, containerName ContainerName) (*container.Client, error) {\n\treturn newCredInfoFromEnv().NewClient(svcURL, containerName)\n}", "title": "" }, { "docid": "98b86c9d23ea7b25845e80618a96eab6", "score": "0.49275747", "text": "func New(s *service.Canal) (engine *bm.Engine, err error) {\n\tcs = s\n\tengine = bm.DefaultServer(conf.Conf.BM)\n\n\tinitRouter(engine)\n\terr = engine.Start()\n\treturn\n}", "title": "" }, { "docid": "e6a97778f4cfe10a950792f6e4e2d8cd", "score": "0.49260342", "text": "func Open(name string, syscallService *bridge.SyscallService, db db.Database) (InstanceCreator, error) {\n\treturn defaultRegistry.Open(name, syscallService, db)\n}", "title": "" }, { "docid": "0c922028e1f92758b5315865daf3702c", "score": "0.4920633", "text": "func NewDefault(name, URL, ownerUuid, ownerOrgn string, tags []string, isPrivate bool) (*App, error) {\n\tapp := App{\n\t\tName: name,\n\t\tURL: URL,\n\t\tOwnerUuid: ownerUuid,\n\t\tOwnerOrgn: ownerOrgn,\n\t\tTags: tags,\n\t\tMembers: []Member{ // Owner is listed as member per default\n\t\t\t{\n\t\t\t\tUuid: ownerUuid,\n\t\t\t\tStatus: InviteAccepted,\n\t\t\t},\n\t\t},\n\t\tLocked: false,\n\t\tIsPrivate: isPrivate,\n\t}\n\tapp.Init()\n\tif err := required.Atomic(&app); err != nil {\n\t\treturn nil, ErrRequiredFieldsMissing\n\t}\n\treturn &app, nil\n}", "title": "" }, { "docid": "8ab45b4d6dfe90987560624854d13179", "score": "0.49202475", "text": "func New(d database.Service, passphrase string) (*client, error) {\n\t// immediately return if a nil database Service is provided\n\tif d == nil {\n\t\treturn nil, fmt.Errorf(\"empty Database client passed to native secret engine\")\n\t}\n\n\t// create the client object\n\tclient := &client{\n\t\tNative: d,\n\t\tpassphrase: passphrase,\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "ebd28170cf7bc16b6415b34987a556d8", "score": "0.49000594", "text": "func New(cfg config.DB) (*gorm.DB, error) {\n\tdb, err := database.New(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := db.AutoMigrate(\n\t\trepository.Client{},\n\t\trepository.Deal{},\n\t\trepository.Position{},\n\t\trepository.OHLCV{},\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "f9fd398248ddbe810e3b3cf88798a86e", "score": "0.48957777", "text": "func New(config *connect.Config) Db {\n\tvar db Db\n\t// first find db in dbMap by DatabaseName\n\tdb = dbMap[config.DatabaseName]\n\t// find\n\tif db != nil {\n\t\treturn db\n\t}\n\t// not find in dbMap - New\n\tswitch config.DbType {\n\tcase connect.MONGODB:\n\t\t// init mongodb\n\t\tdb = mongo.New(config)\n\t}\n\tdbMap[config.DatabaseName] = db\n\treturn db\n}", "title": "" }, { "docid": "02ece51a9ad31f6921c6128f6564dcf5", "score": "0.48931098", "text": "func NewGetObmsLibraryIdentifierDefault(code int) *GetObmsLibraryIdentifierDefault {\n\treturn &GetObmsLibraryIdentifierDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "2bb4825acc09702d1097943adaaa64db", "score": "0.4877337", "text": "func NewClient(log logr.Logger, config *helmv1alpha1.Configuration) (*Client, error) {\n\tociClient, err := oci.NewClient(log, oci.WithConfiguration(config.OCI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{\n\t\toci: ociClient,\n\t}, nil\n}", "title": "" }, { "docid": "7ffb6aa184f8e73f797cc02fef800696", "score": "0.4876051", "text": "func Default() *oceanv1.OceanToolkit {\n\treturn &oceanv1.OceanToolkit{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"ocean.spot.io.Toolkit\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"ocean-toolkit\",\n\t\t\tNamespace: NamespaceOceanSystem,\n\t\t},\n\t\tSpec: oceanv1.OceanToolkitSpec{\n\t\t\tComponents: map[string]*oceanv1.OceanToolkitComponent{\n\t\t\t\t\"controller\": {\n\t\t\t\t\tEnabled: true,\n\t\t\t\t},\n\t\t\t\t\"operator\": {\n\t\t\t\t\tEnabled: true,\n\t\t\t\t},\n\t\t\t\t\"metrics-server\": {\n\t\t\t\t\tEnabled: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\tValues: map[string]interface{}{\n\t\t\t\t\"spot\": map[string]interface{}{\n\t\t\t\t\t\"token\": os.Getenv(credentials.EnvCredentialsVarToken),\n\t\t\t\t\t\"account\": os.Getenv(credentials.EnvCredentialsVarAccount),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "eb35e80a3570cabe5cff3ad8171247ef", "score": "0.4864222", "text": "func NewOracle(args OracleArgs) (*Oracle, error) {\n\tif err := SanityCheckLocalConfig(args.LocalConfig); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"bad local config while creating new oracle\")\n\t}\n\treturn &Oracle{\n\t\toracleArgs: args,\n\t\tstarted: semaphore.NewWeighted(1),\n\t}, nil\n}", "title": "" }, { "docid": "4f4dfa490fa42473c69913f257fa0544", "score": "0.48544323", "text": "func NewDefaultClient() *Client {\n\treturn &Client{\n\t\tcfg: NewDefaultConfig(),\n\t}\n}", "title": "" }, { "docid": "ab621107d662c60b702dcc748df9eff2", "score": "0.48514968", "text": "func defaultModel(namespaces []string, protocols []v1.Protocol, ports []int32) *Model {\n\tif framework.NodeOSDistroIs(\"windows\") {\n\t\treturn NewWindowsModel(namespaces, []string{\"a\", \"b\", \"c\"}, ports)\n\t}\n\treturn NewModel(namespaces, []string{\"a\", \"b\", \"c\"}, ports, protocols)\n}", "title": "" }, { "docid": "410d8d266b519a1e9ceaed37e43b3173", "score": "0.48404163", "text": "func NewDefaultCommand() *cobra.Command {\n\tcmd := cobra.Command{\n\t\tUse: path.Base(os.Args[0]),\n\t\tShort: \"kwir\",\n\t\tLong: \"Kube Webhook Image Rewriter (kwir) is a mutating admission webhook manager that rewrites container's images based on config rules\",\n\t\tSilenceUsage: true,\n\t}\n\n\tviper.SetEnvPrefix(\"KWIR\")\n\tviper.AutomaticEnv()\n\n\tcmd.AddCommand(newVersionCommand())\n\tcmd.AddCommand(newKwirCommand())\n\n\treturn &cmd\n}", "title": "" }, { "docid": "6aaa7c9b1585e3cd9ff942ac46158339", "score": "0.48393318", "text": "func NewDefaultClient() (Interface, error) {\n\tendpoint := utils.GetenvWithDefault(\"DOCKER_HOST\", constants.DockerEngineURL)\n\tclient, err := NewClient(endpoint)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "b390f49d0639227c011ec08c721d65ac", "score": "0.48298544", "text": "func New(config *Config) (client *Client, err error) {\n\n\tmycfg, err := config.NewMycfg()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tloggerConfig := logger.Config{\n\t\tSlowThreshold: config.SlowThreshold,\n\t\tColorful: false,\n\t\tLogLevel: logger.Silent,\n\t}\n\n\tswitch config.LogLevel {\n\tcase \"silent\":\n\t\tloggerConfig.LogLevel = logger.Silent\n\tcase \"error\":\n\t\tloggerConfig.LogLevel = logger.Error\n\tcase \"warn\":\n\t\tloggerConfig.LogLevel = logger.Warn\n\tcase \"info\":\n\t\tloggerConfig.LogLevel = logger.Info\n\tdefault:\n\t}\n\tnewLogger := logger.New(\n\t\tlog.New(os.Stdout, \"\\r\\n\", log.LstdFlags), // io writer\n\t\tloggerConfig,\n\t)\n\tdb, err := gogorm.Open(mysql.Open(mycfg.FormatDSN()), &gogorm.Config{\n\t\tLogger: newLogger,\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\n\tsqlDB, _ := db.DB()\n\n\tif config.MaxOpenConns > 0 {\n\t\tsqlDB.SetMaxOpenConns(config.MaxOpenConns)\n\t}\n\tif config.MaxIdleConns > 0 {\n\t\tsqlDB.SetMaxIdleConns(config.MaxIdleConns)\n\t}\n\tif config.MaxLifeConns > 0 {\n\t\tsqlDB.SetConnMaxLifetime(time.Duration(config.MaxLifeConns) * time.Second)\n\t}\n\n\terr = sqlDB.Ping()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconfig.mycfg = mycfg\n\n\tclient = &Client{\n\t\tDB: db,\n\t\tconfig: config,\n\t}\n\treturn\n}", "title": "" }, { "docid": "23ad081b3d4f5a5b81988fdf9e887074", "score": "0.48288506", "text": "func NewdefaultService() SampleService {\n\treturn &defaultService{\n\t\trepo: inmem.NewInmemRepository(),\n\t}\n}", "title": "" }, { "docid": "8a4a590744a17eac410e7651a3f8907f", "score": "0.48263803", "text": "func NewOCIRegistry(log logr.Logger, config *config.OCIConfiguration, cache cache.Cache, predefinedComponentDescriptors ...*cdv2.ComponentDescriptor) (TypedRegistry, error) {\n\tclient, err := ociclient.NewClient(log, utils.WithConfiguration(config), ociclient.WithCache{Cache: cache})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewOCIRegistryWithOCIClient(client, predefinedComponentDescriptors...)\n}", "title": "" }, { "docid": "6218ac1f6994131945f205dcc4a685dc", "score": "0.48240817", "text": "func newDefaultAdvisor(soarBin, configFile string) *DefaultAdvisor {\n\treturn &DefaultAdvisor{\n\t\tparser: parser.NewParserWithDefault(),\n\t\tsoarBin: soarBin,\n\t\tconfigFile: configFile,\n\t}\n}", "title": "" }, { "docid": "843c3f74766b948e8b51cd180cf657b5", "score": "0.48183376", "text": "func NewORM() ORMWrapper {\n\treturn &orm{\n\t\tdone: make(chan error),\n\t}\n}", "title": "" }, { "docid": "e40c07a474092826aebfc36d50ffa67a", "score": "0.4811822", "text": "func OpenBD(usr, pwd, host, port, bd, driver string) (*xorm.Engine, error) {\n\tswitch driver {\n\tcase \"mysql\":\n\t\tcharset := \"?charset=utf8&parseTime=true\"\n\t\tdsn := \"\"\n\t\tif config.DB_PWD != \"\" {\n\t\t\tdsn = fmt.Sprintf(\"%v:%v@tcp(%v:%v)/%v%v\", usr, pwd, host, port, bd, charset)\n\t\t} else {\n\t\t\tdsn = fmt.Sprintf(\"%v@tcp(%v:%v)/%v%v\", usr, host, host, port, charset)\n\t\t}\n\t\treturn xorm.NewEngine(driver, dsn)\n\tcase \"postgres\":\n\t\tdsn := \"\"\n\t\tif bd == \"\" {\n\t\t\tbd = \"postgres\"\n\t\t}\n\t\tif config.DB_PWD != \"\" {\n\t\t\tdsn = fmt.Sprintf(\"postgres://%v:%v@%v:%v/%v?sslmode=disable\", usr, pwd, host, port, bd)\n\t\t} else {\n\t\t\tdsn = fmt.Sprintf(\"user=%v dbname=%v host=%v port=%v password=paramore\", usr, bd, host, port)\n\t\t}\n\t\tfmt.Println(dsn)\n\t\treturn xorm.NewEngine(driver, dsn)\n\t}\n\treturn nil, fmt.Errorf(\"Could not connect\")\n}", "title": "" }, { "docid": "9b983948fe43b121d487f6db8a289b6c", "score": "0.48106405", "text": "func DefaultClient() ClientWrapper {\n\tghToken := os.Getenv(TokenEnvVar)\n\tctx := context.Background()\n\tts := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: ghToken},\n\t)\n\ttc := oauth2.NewClient(ctx, ts)\n\treturn Client(tc)\n}", "title": "" }, { "docid": "0aef1a6aa6a4a457fec4c63198417450", "score": "0.4809559", "text": "func GetDefaultDB() (interfaces.Database, error) {\n\treturn GetDB(\"localhost\", \"khan\", 5433, \"disable\", \"khan\", \"\")\n}", "title": "" }, { "docid": "1df23651e5a8b0905331dadce6bebdae", "score": "0.48016518", "text": "func NewDefaultClient() *Client {\n\turl := fmt.Sprintf(\"http://%s:%s/\", baseURL, strconv.Itoa(basePort))\n\n\treturn &Client{\n\t\thttpClient: &http.Client{Timeout: time.Minute},\n\t\turl: url,\n\t\tminVersion: minVersion,\n\t}\n}", "title": "" }, { "docid": "2cb3309e58894a2ecc8118cef2b09fd5", "score": "0.48001277", "text": "func New(driver string, conStr string) (*gorm.DB, error) {\n\tdb, err := gorm.Open(driver, conStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = db.DB().Ping()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "5d1e039bde1e46ec5809277cc6ce5a24", "score": "0.4795036", "text": "func DefaultDB() *DB {\n\treturn &DB{\n\t\tBackend: BoltBackend,\n\t\tBolt: &kvdb.BoltConfig{\n\t\t\tAutoCompactMinAge: kvdb.DefaultBoltAutoCompactMinAge,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "f24dab3d4966c31dfc162aa5fa0dba2a", "score": "0.47915703", "text": "func New(app *fiber.App, group *fiber.Group, db *gorm.DB) IBook {\n\tc := controller{app: app, group: group, db: db}\n\treturn c\n}", "title": "" }, { "docid": "2ae11b15cf012edc179c3db1f49d01b4", "score": "0.4789936", "text": "func NewDefaultClient(airshipConfigPath *string) (*Client, error) {\n\tif !configFileExists(airshipConfigPath) {\n\t\treturn nil, fmt.Errorf(AirshipConfigNotFoundErr)\n\t}\n\n\tcfgFactory := config.CreateFactory(airshipConfigPath)\n\n\t// TODO(mfuller): Factory doesn't throw an error if there's no\n\t// config file, it calls log.Fatal and kills the app. Not sure\n\t// how to handle this yet\n\tconf, err := cfgFactory()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\tConfig: conf,\n\t}\n\n\t// TODO(mfuller): how do you do this now?\n\t// set verbosity to true\n\n\treturn client, nil\n}", "title": "" }, { "docid": "a8e076222d569bafe9a2891e9839c4ea", "score": "0.47894603", "text": "func Default() *gorm.DB {\n\treturn defaultdb\n}", "title": "" }, { "docid": "675f6444e4ad777ec818a6c91a38c584", "score": "0.47759962", "text": "func NewDefaultCommand() *cobra.Command {\n\n\tc := &cobra.Command{\n\t\tUse: \"molamola\",\n\t\tShort: \"kustomize manages declarative configuration of Kubernetes\",\n\t\tLong: `\nkustomize manages declarative configuration of Kubernetes.\n\nSee https://github.com/yuanying/molamola\n`,\n\t}\n\n\t// c.AddCommand(\n\t// \t// TODO: Make consistent API for newCmd* functions.\n\t// \tnewCmdBuild(stdOut, fsys),\n\t// \tnewCmdDiff(stdOut, stdErr, fsys),\n\t// \tnewCmdEdit(fsys),\n\t// \tnewCmdVersion(stdOut),\n\t// )\n\tc.PersistentFlags().AddGoFlagSet(flag.CommandLine)\n\n\t// Workaround for this issue:\n\t// https://github.com/kubernetes/kubernetes/issues/17162\n\tflag.CommandLine.Parse([]string{})\n\treturn c\n}", "title": "" }, { "docid": "eac5288c2237405eb9dcbd69da1c7d3f", "score": "0.47755936", "text": "func getDefaultClient() Client {\n\treturn Client{\n\t\tServerKey: midtrans.ServerKey,\n\t\tClientKey: midtrans.ClientKey,\n\t\tEnv: midtrans.Environment,\n\t\tHttpClient: midtrans.GetHttpClient(midtrans.Environment),\n\t\tOptions: &midtrans.ConfigOptions{\n\t\t\tPaymentOverrideNotification: midtrans.PaymentOverrideNotification,\n\t\t\tPaymentAppendNotification: midtrans.PaymentAppendNotification,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "45fe7bbff7e7988a769b10d862a11260", "score": "0.47660378", "text": "func DefaultClient() *Client {\n\treturn &Client{Key}\n}", "title": "" }, { "docid": "b968243675009b8f47f17471eeb5bc2c", "score": "0.47637606", "text": "func New(c *conf.Config) (dao *Dao) {\n\tdao = &Dao{\n\t\tc: c,\n\t\tmc: memcache.NewPool(c.Memcache),\n\t\tclient: bm.NewClient(c.BMClient),\n\t\thbase: hbase.NewClient(c.HBase),\n\t}\n\n\tconn, err := v1.NewClient(c.Warden)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdao.xuser = conn\n\treturn\n}", "title": "" }, { "docid": "579419fd87242916b6273d48d34fccc2", "score": "0.47590384", "text": "func New(c client.Client) Generator {\n\tkatibClient := katibclient.NewWithGivenClient(c)\n\treturn &DefaultGenerator{\n\t\tclient: katibClient,\n\t}\n}", "title": "" }, { "docid": "d9d47a869382dcdcd29582ec8b117c07", "score": "0.4749592", "text": "func newDefaultHTTPClient() (cev2.Client, error) {\n\tp, err := cev2.NewHTTP()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cev2.NewClientObserved(p,\n\t\tcev2.WithUUIDs(),\n\t\tcev2.WithTimeNow(),\n\t\tcev2.WithTracePropagation,\n\t)\n}", "title": "" }, { "docid": "ade2819e4d28d437c0342a2c219e1492", "score": "0.4748695", "text": "func NewDefaultIAM() *IAM {\n\ti := &IAM{}\n\ti.k = kubernetes.GetKubeInstance()\n\n\ti.setenv()\n\treturn i\n}", "title": "" }, { "docid": "5e2b43c0192c209d8de72ced9edc11d3", "score": "0.47484207", "text": "func TestModel_DefaultBuilder(t *testing.T) {\n\tr := car{}\n\tb, err := r.DefaultBuilder()\n\tassert.NoError(t, err)\n\tassert.IsType(t, sqlquery.Builder{}, b)\n\n\trc := mockModel{}\n\tassert.IsType(t, sqlquery.Builder{}, rc.DefaultBuilder())\n}", "title": "" }, { "docid": "cdcb066478b7ab2cb5ff7230f6978504", "score": "0.47480845", "text": "func NewCTROracle() *CTROracle {\n\trand.Seed(time.Now().UnixNano())\n\tkey := make([]byte, 16)\n\trand.Read(key)\n\n\tnonce := rand.Intn(1 << 31)\n\n\treturn &CTROracle{Key: key, Nonce: uint64(nonce)}\n}", "title": "" }, { "docid": "8e30862e00b35f9589234e4bc92eb705", "score": "0.47381416", "text": "func newOIDCClient(tokens *oidc.Tokens[*oidc.IDTokenClaims]) *oidcClient {\n\tclient := oidcClient{\n\t\ttokens: tokens,\n\t\thttpClient: &http.Client{},\n\t\toidcTransport: &oidcTransport{},\n\t}\n\n\t// Ensure client.tokens is never nil otherwise authenticate() will panic.\n\tif client.tokens == nil {\n\t\tclient.tokens = &oidc.Tokens[*oidc.IDTokenClaims]{}\n\t}\n\n\treturn &client\n}", "title": "" }, { "docid": "d38d7f9dc51c417fd13d50192ba5ecf0", "score": "0.4724608", "text": "func DefaultClient() *Client {\n\tmongoidConfigMutex.Lock()\n\tdefer mongoidConfigMutex.Unlock()\n\tif mongoidConfig == nil {\n\t\treturn nil\n\t}\n\treturn mongoidConfig.DefaultClient\n}", "title": "" }, { "docid": "51799f156c36697a9bf11374c3bd02ca", "score": "0.4723553", "text": "func DefaultInstallGORM(\n\tdebug bool,\n\tsingular bool,\n\tdbType string,\n\ttablePrefix string,\n\tserver string,\n\tmaxIdleConn int,\n\tmaxOpenConn int,\n) *gorm.DB {\n\tdb, err := gorm.Open(dbType, server)\n\tif err != nil {\n\t\tlog.Fatal(fmt.Sprintf(\"db connect build failed %v\", err))\n\t}\n\tgorm.DefaultTableNameHandler = func(db *gorm.DB, defaultTableName string) string {\n\t\treturn fmt.Sprintf(\"%v%v\", tablePrefix, defaultTableName)\n\t}\n\tdb.SetLogger(&NilLogger{})\n\tdb.LogMode(debug)\n\tdb.SingularTable(singular)\n\tdb.Callback().Create().Replace(\"gorm:update_time_stamp\", updateTimeStampAndUUIDForCreateCallback)\n\tdb.Callback().Update().Replace(\"gorm:update_time_stamp\", updateTimeStampForUpdateCallback)\n\tdb.Callback().Delete().Replace(\"gorm:delete\", deleteCallback)\n\tdb.DB().SetMaxIdleConns(maxIdleConn)\n\tdb.DB().SetMaxOpenConns(maxOpenConn)\n\treturn db\n}", "title": "" }, { "docid": "c6861f994a3370468330dd926f249dc1", "score": "0.47164112", "text": "func NewGetHyperflexServerModelsMoidDefault(code int) *GetHyperflexServerModelsMoidDefault {\n\treturn &GetHyperflexServerModelsMoidDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "a0a9e53a5b9aed4e8ccd2569df96e0c5", "score": "0.4703493", "text": "func NewDefaultBootsrapper() *Bootstrapper {\n\treturn &Bootstrapper{\n\t\tChallengeKeyFile: \"/var/opt/magma/certs/gw_challenge.key\",\n\t\tCpConfig: ControlProxyCfg{\n\t\t\tNghttpxConfigLocation: \"/var/tmp/nghttpx.conf\",\n\t\t\tRootCaFile: \"/var/opt/magma/certs/rootCA.pem\",\n\t\t\tGwCertFile: \"/var/opt/magma/certs/gateway.crt\",\n\t\t\tGwCertKeyFile: \"/var/opt/magma/certs/gateway.key\",\n\t\t\tLocalPort: 8443,\n\t\t\tCloudAddr: \"\",\n\t\t\tCloudPort: 443,\n\t\t\tBootstrapAddr: \"\",\n\t\t\tBootstrapPort: 443,\n\t\t\tProxyCloudConnection: false,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "dd53ac1fc9b039c9a02d226d17f8d60f", "score": "0.46925446", "text": "func New(args ...string) Goose {\n\treturn Goose{\n\t\tconfig: GetDefaultConfiguration(args...),\n\t}\n}", "title": "" }, { "docid": "cbabe0fb345a4ec200f9ed70240ecd34", "score": "0.46833372", "text": "func New() (*OCMProvider, error) {\n\treturn NewWithEnv(viper.GetString(Env))\n}", "title": "" }, { "docid": "232a246bb39a56ebe3f1f70752d7aaa1", "score": "0.46624538", "text": "func New() RobotAccountDao {\n\treturn &robotAccountDao{}\n}", "title": "" }, { "docid": "590def88b7992c5c64cce1cdafb32483", "score": "0.466072", "text": "func New() *gorm.DB {\n\tvar driver string = viper.GetString(\"database_driver\")\n\tvar user string = viper.GetString(\"database_user\")\n\tvar password string = viper.GetString(\"database_password\")\n\tvar port string = viper.GetString(\"database_port\")\n\tvar host string = viper.GetString(\"database_host\")\n\tvar sslMode string = viper.GetString(\"database_ssl\")\n\tvar databaseName string = viper.GetString(\"database_name\")\n\tvar dbConn string = fmt.Sprintf(\"host=%s port=%s user=%s password=%s dbname=%s sslmode=%s\", host, port, user, password, databaseName, sslMode)\n\n\tvar maxIdleCons int = viper.GetInt(\"database_max_idle_conns\")\n\tvar maxOpenConns int = viper.GetInt(\"database_max_open_conns\")\n\n\tdb, err := gorm.Open(driver, dbConn)\n\tif err != nil {\n\t\tlogrus.Fatalf(\"Error connecting to database %s. %s.\", databaseName, err)\n\t}\n\n\tdb.SetLogger(gormlog.New(logrus.StandardLogger()))\n\tdb.LogMode(true)\n\n\tdb.DB().SetMaxIdleConns(maxIdleCons)\n\tdb.DB().SetMaxOpenConns(maxOpenConns)\n\n\treturn db\n}", "title": "" }, { "docid": "b6b036e8cfb06d1fda180b88acae89fa", "score": "0.46596313", "text": "func NewServiceController(connection_string string) (controller *ServiceController, err error){\n controller = new(ServiceController)\n controller.connection_string = connection_string\n con, err := sql.Open(\"mymysql\", controller.connection_string)\n if err != nil {\n return controller, err\n }\n defer con.Close()\n\n return controller, nil\n}", "title": "" }, { "docid": "a8ddaef99a377a0bafaf2205c4a6ff38", "score": "0.46558917", "text": "func New(opts Opts) (Service, error) {\n\tif err := defaultClientOptions(&opts); err != nil {\n\t\treturn nil, errcode.TODO.Wrap(err)\n\t}\n\n\todb, err := newBertyOrbitDB(opts.RootContext, opts.IpfsCoreAPI, opts.DeviceKeystore, opts.MessageKeystore, opts.Logger, &orbitdb.NewOrbitDBOptions{\n\t\tCache: opts.OrbitCache,\n\t})\n\tif err != nil {\n\t\treturn nil, errcode.TODO.Wrap(err)\n\t}\n\n\tacc, err := odb.OpenAccountGroup(opts.RootContext, nil)\n\tif err != nil {\n\t\treturn nil, errcode.TODO.Wrap(err)\n\t}\n\n\treturn &service{\n\t\tctx: opts.RootContext,\n\t\tipfsCoreAPI: opts.IpfsCoreAPI,\n\t\tlogger: opts.Logger,\n\t\todb: odb,\n\t\tdeviceKeystore: opts.DeviceKeystore,\n\t\tcreatedIPFSNode: opts.createdIPFSNode,\n\t\taccountGroup: acc,\n\t\tgroups: map[string]*bertytypes.Group{\n\t\t\tstring(acc.Group().PublicKey): acc.Group(),\n\t\t},\n\t\topenedGroups: map[string]*groupContext{\n\t\t\tstring(acc.Group().PublicKey): acc,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "7de5a5d0d671c6d4e17337f3a94e143b", "score": "0.46556532", "text": "func NewGormClient(dbtype string, dbconn string, config jobinator.ClientConfig) (*jobinator.Client, error) {\n\tdb, err := gorm.Open(dbtype, dbconn)\n\tdb.AutoMigrate(&jobinator.Job{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnewgc := &GormClient{\n\t\tdb: db,\n\t\twfList: []string{},\n\t}\n\tnewc := jobinator.NewClient(newgc, config)\n\treturn newc, nil\n}", "title": "" }, { "docid": "0c54ba9f1d8a89bf2ab7b296d7c0f378", "score": "0.465437", "text": "func newDefaultClient() *Client {\n\tcl := &Client{\n\t\tctx: frugal.NewFContext(\"\"),\n\t\tClientSetting: &ClientSetting{\n\t\t\tAppType: model.ApplicationType_ANDROID,\n\t\t\tKeeperDir: getHomeDir() + \"/.line-keepers/\",\n\t\t\tLogger: logger.New(),\n\t\t},\n\t\tClientInfo: &ClientInfo{\n\t\t\tDevice: newLineDevice(),\n\t\t},\n\t\tTokenManager: &TokenManager{},\n\t\tProfile: &model.Profile{},\n\t\tSettings: &model.Settings{},\n\t\tHeaderFactory: &HeaderFactory{\n\t\t\tAndroidVersion: getRandomAndroidVersion(),\n\t\t\tAndroidAppVersion: getRandomAndroidAppVersion(),\n\t\t\tAndroidLiteAppVersion: getRandomAndroidLiteAppVersion(),\n\t\t},\n\t\tE2EEKeyStore: NewE2EEKeyStore(),\n\t}\n\tcl.ClientSetting.AfterTalkError = map[model.TalkErrorCode]func(err *model.TalkException) error{\n\t\tmodel.TalkErrorCode_MUST_REFRESH_V3_TOKEN: func(talkErr *model.TalkException) error {\n\t\t\terr := cl.RefreshV3AccessToken()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn xerrors.Errorf(\"update v3 access token done: %w\", talkErr)\n\t\t},\n\t}\n\treturn cl\n}", "title": "" }, { "docid": "d314beec71e9d7135f698601c0a5236f", "score": "0.46526763", "text": "func New(dsn string) (*Client, error) {\n\tdb, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdb = db.Debug()\n\n\treturn &Client{db}, nil\n}", "title": "" }, { "docid": "d6575c6ac4ba6ff38c5c4d6b86dc30d9", "score": "0.46503103", "text": "func newMongoDB(addr string, cred *mgo.Credential) (ProductDatabase, error) {\n\tconn, err := mgo.Dial(addr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"mongo: could not dial: %v\", err)\n\t}\n\n\tif cred != nil {\n\t\tif err := conn.Login(cred); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &mongoDB{\n\t\tconn: conn,\n\t\tc: conn.DB(\"productshelf\").C(\"products\"),\n\t}, nil\n}", "title": "" }, { "docid": "f702ee8085b912f0ca5fe2227ff3373c", "score": "0.46446988", "text": "func main() {\n\tvar (\n\t\tdbc *obinary.DBClient\n\t\terr error\n\t)\n\n\tgo func() {\n\t\tlog.Println(http.ListenAndServe(\"localhost:6060\", nil))\n\t}()\n\n\t/* ---[ set ogl log level ]--- */\n\togl.SetLevel(ogl.NORMAL)\n\n\ttestType := \"dataOnly\"\n\n\tif len(os.Args) > 1 {\n\t\tif os.Args[1] == \"full\" || os.Args[1] == \"create\" {\n\t\t\ttestType = os.Args[1]\n\t\t}\n\t}\n\n\tdbc, err = obinary.NewDBClient(obinary.ClientOptions{})\n\tOk(err)\n\tdefer dbc.Close()\n\n\t/* ---[ run clean up in case of panics ]--- */\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\togl.Warn(\">> >> >> >> PANIC CAUGHT ----> cleanup called\") // DEBUG\n\t\t\tcleanUp(dbc, testType == \"full\")\n\t\t\tos.Exit(1)\n\t\t}\n\t}()\n\n\t/* ---[ Use \"native\" API ]--- */\n\tcreateOgonoriTestDB(dbc, adminUser, adminPassw, testType != \"dataOnly\")\n\tdefer cleanUp(dbc, testType == \"full\")\n\n\t// document database tests\n\togl.SetLevel(ogl.NORMAL)\n\tdbCommandsNativeAPI(dbc, testType != \"dataOnly\")\n\tif testType == \"full\" {\n\t\togl.SetLevel(ogl.WARN)\n\t\tdbClusterCommandsNativeAPI(dbc)\n\t}\n\n\t/* ---[ Use Go database/sql API on Document DB ]--- */\n\togl.SetLevel(ogl.WARN)\n\tconxStr := \"admin@admin:localhost/ogonoriTest\"\n\tdatabaseSqlAPI(conxStr)\n\tdatabaseSqlPreparedStmtAPI(conxStr)\n\n\t/* ---[ Graph DB ]--- */\n\t// graph database tests\n\togl.SetLevel(ogl.NORMAL)\n\tgraphCommandsNativeAPI(dbc, testType != \"dataOnly\")\n\n\t//\n\t// experimenting with JSON functionality\n\t//\n\t// ogl.Println(\"-------- JSON ---------\")\n\t// fld := oschema.OField{int32(44), \"foo\", oschema.LONG, int64(33341234)}\n\t// bsjson, err := fld.ToJSON()\n\t// Ok(err)\n\t// ogl.Printf(\"%v\\n\", string(bsjson))\n\n\t// doc := oschema.NewDocument(\"Coolio\")\n\t// doc.AddField(\"foo\", &fld)\n\t// bsjson, err = doc.ToJSON()\n\t// Ok(err)\n\t// ogl.Printf(\"%v\\n\", string(bsjson))\n\n\togl.Println(\"DONE\")\n}", "title": "" }, { "docid": "e671dda32fb2ea58005a530f29eec5f8", "score": "0.46441734", "text": "func newOAPI(c container.Container) (x OAPI, err error) {\n\tx = OAPI{c: c}\n\terr = json.Unmarshal(c.Bytes(), &x.o.OpenAPI)\n\treturn x, err\n}", "title": "" }, { "docid": "ef089fc0c00ed7c7a128ff4ab9774032", "score": "0.4638557", "text": "func (i *IAM) CreateAIB(useDefaultNS bool, aibName, aiName string) error {\n\n\t// Obtain the kubernetes cluster client connection\n\tc, _ := i.k.GetClient()\n\tnamespace := i.getNamespace(useDefaultNS)\n\n\tif !useDefaultNS {\n\t\t// Create the non-default namespace (will succeed if the ns already exists)\n\t\tapiNS := apiv1.Namespace{}\n\t\tapiNS.ObjectMeta.Name = namespace\n\t\tc.CoreV1().Namespaces().Create(context.TODO(), &apiNS, metav1.CreateOptions{})\n\t}\n\n\t// Create an runtime AIB object and assign attributes using input parameters\n\truntimeAib := i.createAIBObject(namespace, aibName, aiName)\n\n\t// set the api path for the aadpodidentity package which include the azureidentitybindings custom resource definition\n\tapiPath := \"apis/aadpodidentity.k8s.io/v1\"\n\n\t//\tCreate a rest api client Post request object\n\trequest := c.CoreV1().RESTClient().Post().AbsPath(apiPath).Namespace(namespace).Resource(\"azureidentitybindings\").Body(runtimeAib)\n\n\t//\tCall the api to execute the Post request and create the AIB in the cluster\n\tresponse := request.Do(context.TODO())\n\tlog.Printf(\"[DEBUG] RAW Result: %+v\", response)\n\n\t//\tHandle response error - ignore the error if the AIB already exists\n\tif (response.Error() != nil) && (!errors.IsAlreadyExists(response.Error())) {\n\t\tlog.Printf(\"[DEBUG] AIB creation Error: %+v\", response.Error())\n\t\treturn response.Error()\n\t}\n\n\tb, _ := response.Raw()\n\tbs := string(b)\n\tlog.Printf(\"[DEBUG] STRING result: %+v\", bs)\n\n\tj := kubernetes.K8SJSON{}\n\tjson.Unmarshal(b, &j)\n\n\tlog.Printf(\"[DEBUG] JSON result: %+v\", j)\n\n\treturn nil\n}", "title": "" }, { "docid": "ae97a99d609463e4389eb762f4211718", "score": "0.46338075", "text": "func NewDefaultClient(_ *http.Request) (Client, http.Header, error) {\n\treturn newClientWithOptions()\n}", "title": "" }, { "docid": "3ff8abf66e71e11584c173e7d167aa8e", "score": "0.4632907", "text": "func newClientMongoRepository() repository.ClientRepository {\n\tmongoAddr := os.Getenv(\"DATABASE_CONN\")\n\tfmt.Println(\"mongoAddr => \", mongoAddr)\n\tclient := repositoryimpl.Connect(mongoAddr)\n\treturn repositoryimpl.NewRepository(client)\n}", "title": "" }, { "docid": "e0f07aa618a1696f95b250ccda1794c8", "score": "0.46278858", "text": "func New(maybeConfig *iam.Config, options ...Option) Doer {\n\tdefaultClient := &http.Client{}\n\tfor i := range options {\n\t\tif options[i] != nil {\n\t\t\toptions[i](defaultClient)\n\t\t}\n\t}\n\tif maybeConfig != nil {\n\t\tauthClient := &authClient{\n\t\t\tclient: defaultClient,\n\t\t\tconfig: maybeConfig,\n\t\t}\n\t\treturn authClient\n\t}\n\treturn defaultClient\n}", "title": "" }, { "docid": "66f504d77583ffeecccb3e3c0259c363", "score": "0.46265143", "text": "func NewLob(baseAPI, apiKey, userAgent string) *lob {\n\treturn &lob{\n\t\tBaseAPI: baseAPI,\n\t\tAPIKey: apiKey,\n\t\tUserAgent: userAgent,\n\t}\n}", "title": "" }, { "docid": "4083aab751d856604300ca2d3a18382b", "score": "0.46244988", "text": "func New(stack consensus.Stack) consensus.Consenter {\n\t\n\tconfigLock.Lock()\n\tif config == nil{\n\t\tconfig = loadConfig()\n\t}\n\tdefer configLock.Unlock()\n\t\n\thandle, _, _ := stack.GetNetworkHandles()\n\tid, _ := getValidatorID(handle)\n\n\tswitch strings.ToLower(config.GetString(\"general.mode\")) {\n\tcase \"batch\":\n\t\treturn newObcBatch(id, config, stack)\n\tdefault:\n\t\tpanic(fmt.Errorf(\"Invalid PBFT mode: %s\", config.GetString(\"general.mode\")))\n\t}\n}", "title": "" }, { "docid": "4e039ba4a78da8964501fe6d3d829284", "score": "0.46210015", "text": "func (s *Service) NewDefaultProtocol(n *onet.TreeNodeInstance) (onet.ProtocolInstance, error) {\n\tsuite := pairing.NewSuiteBn256()\n\treturn simpleblscosi.NewProtocol(n, s.vf, n.Tree().ID, s.atomicCoinReserved, s.coinToAtomic, s.distances, suite)\n}", "title": "" }, { "docid": "3748eb9055f2c75bab44b035243159f4", "score": "0.46178216", "text": "func NewDefaultProtocol(n *onet.TreeNodeInstance) (onet.ProtocolInstance, error) {\n\tvf := func(a, b []byte) bool { return true }\n\treturn NewBlsCosi(n, vf, DefaultSubProtocolName, pairing.NewSuiteBn256())\n}", "title": "" }, { "docid": "0300e6d910185019d50f10a27ee83c69", "score": "0.46079415", "text": "func (_Mcapscontroller *McapscontrollerSession) Oracle() (common.Address, error) {\n\treturn _Mcapscontroller.Contract.Oracle(&_Mcapscontroller.CallOpts)\n}", "title": "" }, { "docid": "e50adc7bcd46f1fc7fa3d953e0ec9a8b", "score": "0.46042925", "text": "func New() *Client {\n\treturn &Client{\n\t\tClientInfo: ClientInfo{\n\t\t\t// api defaults\n\t\t\tdatatype: &defaultDatatype,\n\t\t\toutputsize: &defaultOutputsize,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "4dc452f12809cb002997a2a3b2185612", "score": "0.46019217", "text": "func New() (*Client, error) {\n\tdb, err := bolt.Open(\"my.db\", 0600, &bolt.Options{Timeout: defaultTimeout})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tb := &bolt.Bucket{}\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\tb, err = tx.CreateBucketIfNotExists([]byte(\"users\"))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{\n\t\tDB: db,\n\t}, nil\n}", "title": "" }, { "docid": "1e16cfe41e31fd12f5ac7c46454ba7ea", "score": "0.46018037", "text": "func New(opts ...OptionFunc) (*WorkOracle, error) {\n\toptions := &option{\n\t\tmaxRetries: 10,\n\t\tretryDelay: time.Second,\n\t\tlogger: zap.NewNop(),\n\t}\n\n\tfor _, opt := range opts {\n\t\tif err := opt(options); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif err := options.validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tscrypt := options.scrypter\n\tif scrypt == nil {\n\t\tscrypt = &LazyScrypter{init: func() (postrs.Scrypter, error) {\n\t\t\tif options.providerID == nil {\n\t\t\t\treturn nil, errors.New(\"no provider specified\")\n\t\t\t}\n\n\t\t\treturn postrs.NewScrypt(\n\t\t\t\tpostrs.WithProviderID(*options.providerID),\n\t\t\t\tpostrs.WithCommitment(options.commitment),\n\t\t\t\tpostrs.WithScryptN(options.n),\n\t\t\t\tpostrs.WithVRFDifficulty(options.vrfDifficulty),\n\t\t\t\tpostrs.WithLogger(options.logger),\n\t\t\t)\n\t\t}}\n\t}\n\n\treturn &WorkOracle{\n\t\toptions: options,\n\t\tscrypt: scrypt,\n\t}, nil\n}", "title": "" }, { "docid": "332a45fbbac48e5438e107d987141f0e", "score": "0.4601774", "text": "func NewDefaultRobot() *DefaultRobot {\n\treturn &DefaultRobot{\n\t\tpos: Node{X: 0, Y: 0},\n\t\tdirection: Up,\n\t}\n}", "title": "" }, { "docid": "1239fecef17715c6dcbc47c9bba59aaa", "score": "0.4600928", "text": "func newDBClient() connection {\n\tc := client{}\n\terr := c.connect()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\terr = c.applySchema()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn &c\n}", "title": "" }, { "docid": "45c4bad47daeeeafd5a7b59db05c8fdf", "score": "0.45986804", "text": "func newBkCli() (*bkCli, error) {\n\tconfig := config.CurrentConfig()\n\n\tclient, err := newClient(config)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &bkCli{config, client}, nil\n}", "title": "" } ]
b21c4cb12bee8c645f5dda1954c44207
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
[ { "docid": "93ef62b37dca407661e8eb62b486b867", "score": "0.0", "text": "func (in *GenericInfrastructureMachineTemplate) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "7bebf7be819b0242fe40d6281451d628", "score": "0.7300793", "text": "func (in *Extension) DeepCopyObject() runtime.Object {\n\treturn in.DeepCopy()\n}", "title": "" }, { "docid": "3731ef6c796be4e5c99d053c608a6298", "score": "0.7085761", "text": "func (in *Qperf) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "af539fa8d6c27fbcded493dff9d265e1", "score": "0.7071058", "text": "func (m *Managed) DeepCopyObject() runtime.Object {\n\tout := &Managed{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "af539fa8d6c27fbcded493dff9d265e1", "score": "0.7071058", "text": "func (m *Managed) DeepCopyObject() runtime.Object {\n\tout := &Managed{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "91461b983030f0600f48767a420dbd3a", "score": "0.70585036", "text": "func (in *ChaosEngine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "370e19f727cdb108c4722dcd3eff65ed", "score": "0.7051609", "text": "func (in *Podbuggertool) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "92acbf67a626e8434272d49dfed37898", "score": "0.7001799", "text": "func (in *Clock) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8990dba588b3ca4c14772f9f2e57cf35", "score": "0.6987812", "text": "func (in *RedisVersion) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "48d796d4a8734a130c47f8b2fc0e5ebb", "score": "0.6980622", "text": "func (in *VirtualApp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "abc6291036dcf8172e7d96fe92c908b6", "score": "0.69664514", "text": "func (in *DashbuilderObject) DeepCopy() *DashbuilderObject {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DashbuilderObject)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "16e522877692202190f36b46bc0cb7db", "score": "0.69661796", "text": "func (in *Invocation) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b13b2703e1976f046ef0241cba49e4ae", "score": "0.69618165", "text": "func (in *FluentBit) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3270fbfab195a44ba3d6f5d875e7088c", "score": "0.69590783", "text": "func (in *Kvm) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2edc16f30f0a7e90ae4feb4002b91259", "score": "0.69445175", "text": "func (m *Target) DeepCopyObject() runtime.Object {\n\tout := &Target{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "9dca188be47fd63d651d0d7eb59e0546", "score": "0.69258994", "text": "func (m *Composed) DeepCopyObject() runtime.Object {\n\tout := &Composed{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "9dca188be47fd63d651d0d7eb59e0546", "score": "0.69258994", "text": "func (m *Composed) DeepCopyObject() runtime.Object {\n\tout := &Composed{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "6aad13608341837dff05b17c368fc263", "score": "0.6918261", "text": "func (in *Core) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7acb3346a026b58df2d3ddb142188b07", "score": "0.69181716", "text": "func (in *Kubefate) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "765ae27369f5dec5e37255b20b4320c9", "score": "0.69165075", "text": "func (in *Qserv) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d08a6a9c4276be7cd5f8b96c2f1e504f", "score": "0.6913664", "text": "func (in *HookRunList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "91ba39651c6b20544fcbe73d43cb3517", "score": "0.6909683", "text": "func (in *DiscoveryService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3de000006c15e28fc38d2ab175ad073e", "score": "0.69092935", "text": "func (in *HookRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c91a138bb2882634b79249185177cbfa", "score": "0.6907134", "text": "func (in *CDI) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5e7ee69df6bdc2e1188b91b72425e7db", "score": "0.6891053", "text": "func (in *JointInferenceService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95238cc6bff859d5534920426cc89875", "score": "0.6888185", "text": "func (in *CinderAPI) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e9dbfcf5f541768d497fa1c4994289d6", "score": "0.6886799", "text": "func (in *QperfList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "90b39b231f6650132bdd1cc4005e649c", "score": "0.6874441", "text": "func (in *PortBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b301f9dcc87c7b3eeeb31dc7ec3f7932", "score": "0.68712765", "text": "func (in *RayWorker) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3c488269affc1272c12030827cc44ed5", "score": "0.6870566", "text": "func (in *APIcast) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "936fe0a13d89a613491cc82df7e2694d", "score": "0.6869673", "text": "func (in *Busybox) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3cc1db4bcd86e808735592fbd459cfcc", "score": "0.686197", "text": "func (in *Kubemanager) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "657831a1e0160184fdd5c11310b968d8", "score": "0.6858397", "text": "func (in *MemcachedVersion) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b37474055e4562788804f11897126a0d", "score": "0.68531376", "text": "func (in *AppEngineStandardAppVersion) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0b440cb829b3900423549539de3a36fb", "score": "0.68483645", "text": "func (in *VirtualAppList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3de10c3fd4d74e04ad823a886fd5a87c", "score": "0.6845457", "text": "func (in *Space) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "df69e69f0d32cb87f29b135174faf952", "score": "0.6829544", "text": "func (in *SrlTunnelinterface) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9ce4494bcf223366cae1a86094020740", "score": "0.6828783", "text": "func (in *TestRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "55b0be98d753baa0848b3c2786a21f8c", "score": "0.68274444", "text": "func (m *Composite) DeepCopyObject() runtime.Object {\n\tout := &Composite{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "55b0be98d753baa0848b3c2786a21f8c", "score": "0.68274444", "text": "func (m *Composite) DeepCopyObject() runtime.Object {\n\tout := &Composite{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "b40d62941763c1d416e9d31ab26c911f", "score": "0.6826851", "text": "func (in *Redis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b40d62941763c1d416e9d31ab26c911f", "score": "0.6826851", "text": "func (in *Redis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "662cc69dc31cab4e7bde2e440db71c6a", "score": "0.68193793", "text": "func (in *ServiceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "662cc69dc31cab4e7bde2e440db71c6a", "score": "0.68193793", "text": "func (in *ServiceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "662cc69dc31cab4e7bde2e440db71c6a", "score": "0.68193793", "text": "func (in *ServiceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "662cc69dc31cab4e7bde2e440db71c6a", "score": "0.68193793", "text": "func (in *ServiceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a32deaf3eeed41b501876f09b27cbade", "score": "0.6818626", "text": "func (in *HTTPProxy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "386de5718c4919430f59b24f37523f3f", "score": "0.68149394", "text": "func (in *Cinder) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0e19be244329785493997bdedfcdbc87", "score": "0.6814919", "text": "func (in *CRD1) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6aac3adb91ece013f35c1b2d5785ef80", "score": "0.6814614", "text": "func (in *JobRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00dc9ca6acc8104377f2fd22fcf2c58b", "score": "0.68145084", "text": "func (in *Box) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "62f7c802c833a12f16a4c20738ecd523", "score": "0.68109363", "text": "func (in *Test) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ab41fd9685a9c62079773d420702d98c", "score": "0.6801962", "text": "func (in *KvmList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b2468d8cbc090ed4c61d614995ef2f67", "score": "0.6795089", "text": "func (in *WorkflowRuntime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "41915907554c764bf0478ab82cf6f069", "score": "0.679259", "text": "func (in *Relay) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e4a069c05507bf2e8c0c3796b61e2141", "score": "0.67917657", "text": "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "08851f577beff8b9a55605234a10b571", "score": "0.67890483", "text": "func (in *Machine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "69873677637e7096c79ebbc283e462e3", "score": "0.6788984", "text": "func (in *Tunnel) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3b3b9ea2bcdf7e9e1d9cfe1e83aad516", "score": "0.6782317", "text": "func (in *ServiceMeshExtension) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3ce689156816a6e4f72bfa8fd2103d1", "score": "0.678209", "text": "func (in *Infinispan) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e1a132b4af7f55528161a0f94f124617", "score": "0.6781607", "text": "func (in *FluentBitList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c61140d7443b23183d74a27e9f4c0de", "score": "0.6778412", "text": "func (m *Machine) DeepCopyObject() runtime.Object {\n\tm1 := &Machine{\n\t\tVersion: m.Version,\n\t\tMachineIP: m.MachineIP,\n\t\tName: m.Name,\n\t\tNamespace: m.Namespace,\n\t\tClusterName: m.ClusterName,\n\t\tDeleting: m.Deleting,\n\t}\n\treturn m1\n}", "title": "" }, { "docid": "f2a5b69189aab3caa15c823d8b905504", "score": "0.6776537", "text": "func (in *PackageInstall) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cb3c9c9b5af3107b239a8f3255e23018", "score": "0.6775868", "text": "func (in *CurlTest) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dcc8fc7bfdea51655a0a04aeb0dddd67", "score": "0.6774822", "text": "func (in *Arcade) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5884cf4be95f33abeb1548f45b0d68ae", "score": "0.6766233", "text": "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5884cf4be95f33abeb1548f45b0d68ae", "score": "0.6766233", "text": "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9697ff49469d29543b6c1831b8e6ae26", "score": "0.67584795", "text": "func (in *DynaKube) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1b6c851e0dab042b31ba17902a0a3466", "score": "0.675748", "text": "func (in *Chaosmaster) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2773ff22f42e82387283ef238aab7d40", "score": "0.6751559", "text": "func (in *Pgbench) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "489ac2ef40f080225543e2e17c3bd783", "score": "0.67487484", "text": "func (in *EtcdVersion) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c78f75caaa730c54594a38a4c529cf7f", "score": "0.67478114", "text": "func (in *Builder) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f61c6bfb5b188c003f79a479c16861c", "score": "0.6746723", "text": "func (in *GitOps) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a32dbb0f0746f4d331d0770b2de710a3", "score": "0.6745423", "text": "func (in *KieApp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ddf5bb930952de1e4d7a9f725acee2a", "score": "0.6740652", "text": "func (in *ChaosEngineList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9adc39ec63009d613c77d91f85c43d7", "score": "0.6737726", "text": "func (in *CDIList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.67370975", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.67370975", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.67370975", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2dce76d7c9f55603b041e9ed5af5500f", "score": "0.673685", "text": "func (in *Memcached) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2dce76d7c9f55603b041e9ed5af5500f", "score": "0.673685", "text": "func (in *Memcached) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2dce76d7c9f55603b041e9ed5af5500f", "score": "0.673685", "text": "func (in *Memcached) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5bc98c1ff2d063db4c0b73e98f862f1", "score": "0.6730956", "text": "func (in *Cassandra) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "97d940e03b91ae8737af951f6807caba", "score": "0.67306197", "text": "func (in *KeptnService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aac72bc31b665911d836b3801b632cb6", "score": "0.67288876", "text": "func (m *Class) DeepCopyObject() runtime.Object {\n\tout := &Class{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "c1472e180b8d5c85a37780678edd2257", "score": "0.67284113", "text": "func (in *Iperf3) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "372bfcf115165dda2d8039086eef76ca", "score": "0.6727378", "text": "func (in *BusyboxList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "20986c2271614ac062e026acef32e687", "score": "0.6726471", "text": "func (in *Bundle) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0fd438407f33cd8e553c5d88d86825db", "score": "0.67236435", "text": "func (in *SyncBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ae0b87daedfd6537351a4c85a34bd8ea", "score": "0.6723604", "text": "func (in *PortBindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a809d76469f721763cca39a9263a39de", "score": "0.67233974", "text": "func (in *InvocationList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca15ecdf5db91acfa35f372a962726e2", "score": "0.6722397", "text": "func (in *RedisVersionList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d8cd1356e45661724614770c2b58e931", "score": "0.6721638", "text": "func (in *Panda) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3453d4c20c15e5a98700d5691c54ba94", "score": "0.6718869", "text": "func (in *Registry) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3453d4c20c15e5a98700d5691c54ba94", "score": "0.6718869", "text": "func (in *Registry) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2b62e5a400839376f11c374961f0d593", "score": "0.67142653", "text": "func (in *Dask) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "daf28bbf9c4b107d2a0b05318791131f", "score": "0.6712986", "text": "func (in *DiscoveryServiceCertificate) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a7c07c33740ae6f05124798affd4cb16", "score": "0.67128146", "text": "func (in *Redactor) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f0e3fba0a391303d0352cf2e51f29f5d", "score": "0.6711723", "text": "func (in *Webui) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "93f44f11b997403b028206c5cb9aa6b1", "score": "0.670866", "text": "func (in *YcsbBench) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be4cf0d77c97470e33b542733e7b5a8a", "score": "0.67070633", "text": "func (in *Manager) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c031c3b15f6f336e6379fd2c60dbbb71", "score": "0.67067975", "text": "func (in *PyTorchJob) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" } ]
bd4dcc32cf60c21334ee8874bbee3454
ListExecutions list all executions of a flow PARAMS: flowName: which flow to list executions RETURNS: api.ListExecutionsResult: information about the executions error: nil if success otherwise the specific error
[ { "docid": "d9d79c3f172d79244c9725042ad6731d", "score": "0.8525082", "text": "func (c *Client) ListExecutions(flowName string) (*api.ListExecutionsResult, error) {\n\treturn api.ListExecutions(c, flowName)\n}", "title": "" } ]
[ { "docid": "d23b858852b7f48c35198e8ac0a26c58", "score": "0.7498663", "text": "func (c *Client) ListExecutions(ctx context.Context, params *ListExecutionsInput, optFns ...func(*Options)) (*ListExecutionsOutput, error) {\n\tif params == nil {\n\t\tparams = &ListExecutionsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListExecutions\", params, optFns, addOperationListExecutionsMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListExecutionsOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "0e7a266f66f54d263b79e0f6cabe256f", "score": "0.6452478", "text": "func (local *Local) GetExecutions() ([]api.Execution, error) {\n\tdata, err := local.store.GetExecutions()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\texecutions := []api.Execution{}\n\tlog.Debugln(\"Executions from store: \", data)\n\tfor _, p := range data {\n\t\ttmp := api.Execution{}\n\t\texecutions = append(executions, tmp.FromStorage(p))\n\t}\n\n\treturn executions, nil\n}", "title": "" }, { "docid": "129731efe55eb4bc6044b8afcbfe275b", "score": "0.6311275", "text": "func (c *Client) SearchFlowExecutions(ctx context.Context, params *SearchFlowExecutionsInput, optFns ...func(*Options)) (*SearchFlowExecutionsOutput, error) {\n\tif params == nil {\n\t\tparams = &SearchFlowExecutionsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"SearchFlowExecutions\", params, optFns, addOperationSearchFlowExecutionsMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*SearchFlowExecutionsOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "8cd72b71860bab6a390bf3745d55f1b5", "score": "0.62896466", "text": "func (sm *StorageManager) GetExecutions(queryLimit int) ([]storage.Executions, error) {\n\texecutions := []storage.Executions{}\n\n\t// First search for all message with eventType: service_status\n\t// Second look for message which have the field ExecutionID\n\t// Third Order the ExecutionID by EventTime Desc\n\tsearchResult, err := sm.client.Search().Aggregation(\"orderedExecutionID\", elastic.NewFiltersAggregation().\n\t\tFilters(elastic.NewBoolQuery().Filter(elastic.NewBoolQuery().Should(elastic.NewTermQuery(\"EventType\", \"service_status\")))).\n\t\tSubAggregation(\"ExecutionIDDesc\", elastic.NewTermsAggregation().Field(\"ExecutionID\").Size(queryLimit).Order(\"MaxEventTime\", false).\n\t\t\tSubAggregation(\"MaxEventTime\", elastic.NewMaxAggregation().Field(\"EventTime\")))).\n\t\tDo(context.Background())\n\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"error when trying to get executions collectors\")\n\t\treturn executions, ErrInvalidQuery\n\t}\n\n\tresp, ok := searchResult.Aggregations.Terms(\"orderedExecutionID\")\n\tif !ok {\n\t\tlog.Error(\"orderedExecutionID field term does not exist\")\n\t\treturn executions, ErrAggregationTermNotFound\n\t}\n\n\tfor _, ExecutionIDBuckets := range resp.Buckets {\n\t\tdescOrderedExecutionIDs := ExecutionIDBuckets.Aggregations[\"ExecutionIDDesc\"]\n\n\t\tvar executionsIDs orderedExecutionIDs\n\t\terr := json.Unmarshal([]byte(string(descOrderedExecutionIDs)), &executionsIDs)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Error(\"error when trying to parse bucket aggregations execution ids\")\n\t\t\treturn executions, nil\n\t\t}\n\n\t\tfor _, executionIDValue := range executionsIDs.Buckets {\n\t\t\texecutionID := string(executionIDValue.Key)\n\n\t\t\texecutionName, err := interpolation.ExtractExecutionName(executionID)\n\t\t\tif err != nil {\n\t\t\t\tlog.WithError(err).WithField(\"execution_name\", executionName).Error(\"could not extract execution name\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcollectorExecutionTime, err := interpolation.ExtractTimestamp(executionID)\n\t\t\tif err != nil {\n\t\t\t\tlog.WithError(err).WithField(\"collector_execution_time\", collectorExecutionTime).Error(\"could not parse to int64\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\texecutions = append(executions, storage.Executions{\n\t\t\t\tID: executionID,\n\t\t\t\tName: executionName,\n\t\t\t\tTime: time.Unix(collectorExecutionTime, 0),\n\t\t\t})\n\t\t}\n\t}\n\treturn executions, nil\n}", "title": "" }, { "docid": "ffdb3b7070ecea0859fdea82c1d08d5d", "score": "0.57813334", "text": "func (s *ListQueryExecutionsStub) ListQueryExecutions(input *athena.ListQueryExecutionsInput) (*athena.ListQueryExecutionsOutput, error) {\n\tids := make([]*string, len(s.rs))\n\tfor i, r := range s.rs {\n\t\tif r.ErrMsg != \"\" {\n\t\t\treturn nil, errors.New(r.ErrMsg)\n\t\t}\n\t\tids[i] = &r.ID\n\t}\n\treturn &athena.ListQueryExecutionsOutput{QueryExecutionIds: ids}, nil\n}", "title": "" }, { "docid": "2ffa3bed99d795e04c1477de77c4f981", "score": "0.56241196", "text": "func (dbRepo *DatabaseRepository) GetExecutionLogList(limit int, status string) ([]domain.ExecutionLog, error) {\n\tvar DBExecutionLogs []database.ExecutionLog\n\n\tdb := dbRepo.GetDBHandle().Model(database.ExecutionLog{}).Order(\"start_time desc\")\n\tdb = db.Where(\"status != 'Recieved'\")\n\n\tif status != \"all\" {\n\t\tif status == \"succeeded\" {\n\t\t\tdb = db.Where(\"status like 'Completed%'\")\n\t\t}\n\t\tif status == \"failed\" {\n\t\t\tdb = db.Where(\"status like 'Failed%'\")\n\t\t}\n\t}\n\n\tif limit != 0 {\n\t\tdb = db.Limit(limit)\n\t}\n\n\terr := db.Find(&DBExecutionLogs).Error\n\n\tExecutionLogs := make([]domain.ExecutionLog, 0, len(DBExecutionLogs))\n\tfor _, DBExecutionLog := range DBExecutionLogs {\n\t\tvar ExecutionLog domain.ExecutionLog\n\t\tCopy(&ExecutionLog, DBExecutionLog)\n\t\tExecutionLogs = append(ExecutionLogs, ExecutionLog)\n\t}\n\n\treturn ExecutionLogs, err\n}", "title": "" }, { "docid": "8e0e5577f5912ea4021a3c9735e87adf", "score": "0.5588897", "text": "func (s *Client) ListQueryExecutions(input *athena.ListQueryExecutionsInput) (*athena.ListQueryExecutionsOutput, error) {\n\treturn s.ListQueryExecutionsStub.ListQueryExecutions(input)\n}", "title": "" }, { "docid": "aeccf951ba74ad3666bf7b85e10ff6a2", "score": "0.53652054", "text": "func (s *SharedFlowServiceOp) List() ([]string, *Response, error) {\n\treq, err := s.client.NewRequest(\"GET\", sharedFlows, nil, \"\")\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tnamelist := make([]string, 0)\n\tresp, err := s.client.Do(req, &namelist)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn namelist, resp, err\n}", "title": "" }, { "docid": "cd6a86727bea696b06d54c6734c5023e", "score": "0.53455997", "text": "func (client ReportsClient) GetExecutionHistory(ctx context.Context, reportName string) (result ReportExecutionListResult, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ReportsClient.GetExecutionHistory\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.GetExecutionHistoryPreparer(ctx, reportName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"costmanagement.ReportsClient\", \"GetExecutionHistory\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetExecutionHistorySender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"costmanagement.ReportsClient\", \"GetExecutionHistory\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetExecutionHistoryResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"costmanagement.ReportsClient\", \"GetExecutionHistory\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "6c9c6f75b20cba017b84f586a50f8053", "score": "0.5339193", "text": "func (a *PowerApiService) GetPowerPolicyInventoryListExecute(r ApiGetPowerPolicyInventoryListRequest) (*PowerPolicyInventoryResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *PowerPolicyInventoryResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"PowerApiService.GetPowerPolicyInventoryList\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/power/PolicyInventories\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.filter != nil {\n\t\tlocalVarQueryParams.Add(\"$filter\", parameterToString(*r.filter, \"\"))\n\t}\n\tif r.orderby != nil {\n\t\tlocalVarQueryParams.Add(\"$orderby\", parameterToString(*r.orderby, \"\"))\n\t}\n\tif r.top != nil {\n\t\tlocalVarQueryParams.Add(\"$top\", parameterToString(*r.top, \"\"))\n\t}\n\tif r.skip != nil {\n\t\tlocalVarQueryParams.Add(\"$skip\", parameterToString(*r.skip, \"\"))\n\t}\n\tif r.select_ != nil {\n\t\tlocalVarQueryParams.Add(\"$select\", parameterToString(*r.select_, \"\"))\n\t}\n\tif r.expand != nil {\n\t\tlocalVarQueryParams.Add(\"$expand\", parameterToString(*r.expand, \"\"))\n\t}\n\tif r.apply != nil {\n\t\tlocalVarQueryParams.Add(\"$apply\", parameterToString(*r.apply, \"\"))\n\t}\n\tif r.count != nil {\n\t\tlocalVarQueryParams.Add(\"$count\", parameterToString(*r.count, \"\"))\n\t}\n\tif r.inlinecount != nil {\n\t\tlocalVarQueryParams.Add(\"$inlinecount\", parameterToString(*r.inlinecount, \"\"))\n\t}\n\tif r.at != nil {\n\t\tlocalVarQueryParams.Add(\"at\", parameterToString(*r.at, \"\"))\n\t}\n\tif r.tags != nil {\n\t\tlocalVarQueryParams.Add(\"tags\", parameterToString(*r.tags, \"\"))\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\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\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, formFiles)\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 == 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\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\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": "9127c11205318cef88aaf2fb52c11d4b", "score": "0.5282916", "text": "func (a *ApiApiService) ListTasksExecute(r ApiListTasksRequest) ([]Task, *_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 []Task\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApiApiService.ListTasks\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/task/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\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": "f76d580d581a495817489d5e940bb87e", "score": "0.5259881", "text": "func (r *DefaultAPIController) ListRetentionExecs(policyID int64, query *q.Query) ([]*Execution, error) {\n\treturn r.manager.ListExecutions(policyID, query)\n}", "title": "" }, { "docid": "33b35f33dea26b9999fb4d25e88d73c9", "score": "0.5237823", "text": "func NewListExecutionsPaginator(client ListExecutionsAPIClient, params *ListExecutionsInput, optFns ...func(*ListExecutionsPaginatorOptions)) *ListExecutionsPaginator {\n\tif params == nil {\n\t\tparams = &ListExecutionsInput{}\n\t}\n\n\toptions := ListExecutionsPaginatorOptions{}\n\tif params.MaxResults != 0 {\n\t\toptions.Limit = params.MaxResults\n\t}\n\n\tfor _, fn := range optFns {\n\t\tfn(&options)\n\t}\n\n\treturn &ListExecutionsPaginator{\n\t\toptions: options,\n\t\tclient: client,\n\t\tparams: params,\n\t\tfirstPage: true,\n\t}\n}", "title": "" }, { "docid": "07893669712a4ed65f5332ad51bc52e8", "score": "0.51596624", "text": "func (a *WorkflowExecutionServiceApiService) ListRuns(ctx _context.Context, localVarOptionals *ListRunsOpts) (RunListResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarReturnValue RunListResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/runs\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tfiles := make(map[string][]byte)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.PageSize.IsSet() {\n\t\tlocalVarQueryParams.Add(\"page_size\", parameterToString(localVarOptionals.PageSize.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.PageToken.IsSet() {\n\t\tlocalVarQueryParams.Add(\"page_token\", parameterToString(localVarOptionals.PageToken.Value(), \"\"))\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\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, files)\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 == 400 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn 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": "4537f86e5b25a71c95fa36b7b396d671", "score": "0.5158737", "text": "func (a *PipelinesApiService) GetRepositoryPipelineScheduleExecutionsExecute(r ApiGetRepositoryPipelineScheduleExecutionsRequest) (PaginatedPipelineScheduleExecutions, *_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 PaginatedPipelineScheduleExecutions\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"PipelinesApiService.GetRepositoryPipelineScheduleExecutions\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/repositories/{workspace}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}/executions/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"workspace\"+\"}\", _neturl.PathEscape(parameterToString(r.workspace, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"repo_slug\"+\"}\", _neturl.PathEscape(parameterToString(r.repoSlug, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\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": "9f500ba49d240eb78945819d319999ca", "score": "0.51036555", "text": "func (a *ApiApiService) ListTasknamesExecute(r ApiListTasknamesRequest) ([]Taskname, *_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 []Taskname\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApiApiService.ListTasknames\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/taskname/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\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": "8b7c4b54467a2f779f48fb68dc771b15", "score": "0.50986344", "text": "func NewListExecutionsByJobRequest(server string, jobName string) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"job_name\", runtime.ParamLocationPath, jobName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/jobs/%s/executions\", pathParam0)\n\tif operationPath[0] == '/' {\n\t\toperationPath = operationPath[1:]\n\t}\n\toperationURL := url.URL{\n\t\tPath: operationPath,\n\t}\n\n\tqueryURL := serverURL.ResolveReference(&operationURL)\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "b62b14a6f6d007aaaacea0dd64d880b6", "score": "0.50730747", "text": "func ExtractExecutions(r pagination.Page) ([]Execution, error) {\n\tvar s struct {\n\t\tExecutions []Execution `json:\"executions\"`\n\t}\n\terr := (r.(ExecutionPage)).ExtractInto(&s)\n\treturn s.Executions, err\n}", "title": "" }, { "docid": "fa73092bee3673357fc34c1e51b94efe", "score": "0.50460875", "text": "func (c *Client) DescribeExecution(flowName, executionName string) (*api.Execution, error) {\n\treturn api.DescribeExecution(c, flowName, executionName)\n}", "title": "" }, { "docid": "0e608b9baa325a133a331e03200dbb44", "score": "0.5022523", "text": "func (a *ApiApiService) ListArtifactsExecute(r ApiListArtifactsRequest) ([]Artifact, *_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 []Artifact\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApiApiService.ListArtifacts\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/artifact/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\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": "20c055499d1a4704ce56480e8c11f38b", "score": "0.5020241", "text": "func (r *ProjectsLocationsModelsEvaluationsOperationsService) List(name string) *ProjectsLocationsModelsEvaluationsOperationsListCall {\n\tc := &ProjectsLocationsModelsEvaluationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "title": "" }, { "docid": "2bd7dec9dd4313414c2f9763cf53306c", "score": "0.50104934", "text": "func (l *StepList) Execute() error {\n\tvar (\n\t\twg sync.WaitGroup\n\t\thasError bool\n\t)\n\tfor s := l.Front(); s != nil; s = s.Next() {\n\t\t// Get the step from list\n\t\tstep, _ := s.Value.(Step)\n\t\tlog.Info(\"Step %q ...\", step)\n\n\t\tif step.IsParallel() {\n\t\t\twg.Add(1)\n\t\t\tgo func() {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tif err := step.Execute(); err != nil {\n\t\t\t\t\thasError = true\n\t\t\t\t\tlog.Error(\"Step %q failed to execute: %v\", step, err)\n\t\t\t\t}\n\t\t\t}()\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := step.Execute(); err != nil {\n\t\t\thasError = true\n\t\t\tlog.Error(\"Step %q failed to execute: %v\", step, err)\n\t\t}\n\t}\n\twg.Wait()\n\tif hasError {\n\t\treturn fmt.Errorf(\"Failed to execute steps during %q\", l.Name)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "81336bbe89c0cc08302b390a59324f08", "score": "0.5006947", "text": "func (a *LogsApiService) listLogsExecute(r apiListLogsRequest) (LogsListResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarReturnValue LogsListResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"LogsApiService.ListLogs\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/logs-queries/list\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.body == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"body is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// body params\n\tlocalVarPostBody = r.body\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[\"apiKeyAuth\"]; 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[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"appKeyAuth\"]; 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[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)\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 == 400 {\n\t\t\tvar v LogsAPIErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\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 == 429 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\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": "61a49aa3c9ebe400f9a290c06ce6de41", "score": "0.49505374", "text": "func (m *MockDB) SelectAllWorkflowExecutions(ctx context.Context, shardID int, pageToken []byte, pageSize int) ([]*persistence.InternalListConcreteExecutionsEntity, []byte, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SelectAllWorkflowExecutions\", ctx, shardID, pageToken, pageSize)\n\tret0, _ := ret[0].([]*persistence.InternalListConcreteExecutionsEntity)\n\tret1, _ := ret[1].([]byte)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "05c7f903f0c44de16d90f50aef23b6b8", "score": "0.49052614", "text": "func (a *ScopeApiService) ListScopesExecute(r ScopeApiListScopesRequest) ([]Scope, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue []Scope\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ScopeApiService.ListScopes\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/v1/scopes\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.limit != nil {\n\t\tparameterAddToHeaderOrQuery(localVarQueryParams, \"limit\", r.limit, \"\")\n\t}\n\tif r.offset != nil {\n\t\tparameterAddToHeaderOrQuery(localVarQueryParams, \"offset\", r.offset, \"\")\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, formFiles)\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 := io.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\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": "ee8368e431263326b2c2cdf3668be5d0", "score": "0.49010146", "text": "func (a *ViewsApiService) ListViewsExecute(r ApiListViewsRequest) (*ListViewsResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *ListViewsResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ViewsApiService.ListViews\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/v1/orgs/self/views\"\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\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\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 := io.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = io.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 == 400 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 405 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 406 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 408 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 409 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 415 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 429 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 501 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 502 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 503 {\n\t\t\tvar v ErrorModel\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\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": "0f057060edb8a1e4b0b2db0366400035", "score": "0.48920557", "text": "func (r *DefaultAPIController) ListRetentionExecTasks(executionID int64, query *q.Query) ([]*Task, error) {\n\tq1 := &q.TaskQuery{\n\t\tExecutionID: executionID,\n\t}\n\tif query != nil {\n\t\tq1.PageSize = query.PageSize\n\t\tq1.PageNumber = query.PageNumber\n\t}\n\treturn r.manager.ListTasks(q1)\n}", "title": "" }, { "docid": "49b21d4a6cadb9af4bf10a1260c50caa", "score": "0.48440138", "text": "func (c *Client) GetExecutionHistory(args *api.GetExecutionHistoryArgs) (*api.GetExecutionHistoryResult, error) {\n\treturn api.GetExecutionHistory(c, args)\n}", "title": "" }, { "docid": "14ee3e3b0a35646c6bd0ee457b79f52b", "score": "0.48422703", "text": "func (a *ErrataApiService) ListErratumSystemsExecute(r ApiListErratumSystemsRequest) (*SystemListMock, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *SystemListMock\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ErrataApiService.ListErratumSystems\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/errata/{AdvisoryID}/systems\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"AdvisoryID\"+\"}\", url.PathEscape(parameterValueToString(r.advisoryID, \"advisoryID\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.limit != nil {\n\t\tparameterAddToHeaderOrQuery(localVarQueryParams, \"limit\", r.limit, \"\")\n\t}\n\tif r.offset != nil {\n\t\tparameterAddToHeaderOrQuery(localVarQueryParams, \"offset\", r.offset, \"\")\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"Bearer\"]; 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, formFiles)\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 := io.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = io.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 == 400 {\n\t\t\tvar v ListAllocations400Response\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ListAllocations400Response\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v ListAllocations400Response\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ListAllocations400Response\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ListAllocations400Response\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\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": "3839644d70d4bbf7dc7f8972896a730e", "score": "0.48105243", "text": "func (a *ApiApiService) ListSystemsExecute(r ApiListSystemsRequest) ([]System, *_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 []System\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApiApiService.ListSystems\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/system/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\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": "20dc3c8e3e3cc4dfdcfbf429db90d553", "score": "0.48055744", "text": "func (m *MocktableCRUD) SelectAllWorkflowExecutions(ctx context.Context, shardID int, pageToken []byte, pageSize int) ([]*persistence.InternalListConcreteExecutionsEntity, []byte, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SelectAllWorkflowExecutions\", ctx, shardID, pageToken, pageSize)\n\tret0, _ := ret[0].([]*persistence.InternalListConcreteExecutionsEntity)\n\tret1, _ := ret[1].([]byte)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "88f9d1d0b35cfb247fdd7be46fa681cd", "score": "0.47966442", "text": "func (taskResultsService TaskResultsService) Get(w http.ResponseWriter, r *http.Request) {\n\tpartnerID := mux.Vars(r)[\"partnerID\"]\n\tctx := r.Context()\n\n\tendpointID, err := common.ExtractUUID(\"TaskResultsService.Get\", w, r, \"managedEndpointID\")\n\tif err != nil {\n\t\tlogger.Log.WarnfCtx(ctx, \"Results.Get: cant parse endpointID from req, err: %v\", err)\n\t\treturn\n\t}\n\tcount, _, err := common.ExtractOptionalCount(\"TaskResultsService.Get\", w, r)\n\tif err != nil {\n\t\tlogger.Log.WarnfCtx(ctx, \"Results.Get: cant parse count from req, err: %v\", err)\n\t\treturn\n\t}\n\n\tcurrentUser := taskResultsService.userService.GetUser(r, taskResultsService.httpClient)\n\n\texecutionResultsView, err := taskResultsService.executionResultViewRepo.Get(ctx, partnerID, endpointID, count, currentUser.HasNOCAccess())\n\tif err != nil {\n\t\tlogger.Log.ErrfCtx(ctx, errorcode.ErrorCantGetTaskExecutionResultsForManagedEndpoint, \"TaskResultsService.Get: can't get all task execution results for endpoint (UUID=%s) and partner (ID=%s). err=%v\", endpointID, partnerID, err)\n\t\tcommon.SendInternalServerError(w, r, errorcode.ErrorCantGetTaskExecutionResultsForManagedEndpoint)\n\t\treturn\n\t}\n\n\tlogger.Log.DebugfCtx(ctx, \"TaskResultsService.Get: successfully returned list of task execution results for endpoint (UUID=%s) and partner (ID=%s)\", endpointID, partnerID)\n\tcommon.RenderJSON(w, executionResultsView)\n}", "title": "" }, { "docid": "44abddfcf5253bf27ffb659c3643386e", "score": "0.4773135", "text": "func NewExecutor_execute_Results_List(s *capnp.Segment, sz int32) (Executor_execute_Results_List, error) {\n\tl, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz)\n\treturn Executor_execute_Results_List{l}, err\n}", "title": "" }, { "docid": "36bc836134c1314187bb1c97f124262e", "score": "0.47573644", "text": "func (s *Client) ListQueryExecutionsPages(input *athena.ListQueryExecutionsInput, fn func(*athena.ListQueryExecutionsOutput, bool) bool) error {\n\treturn s.ListQueryExecutionsStub.ListQueryExecutionsPages(input, fn)\n}", "title": "" }, { "docid": "73df60f461748bedf851b63d398515dc", "score": "0.47475782", "text": "func (v *RecordDecisionTaskStartedResponse) GetWorkflowExecutionTaskList() (o *shared.TaskList) {\n\tif v != nil && v.WorkflowExecutionTaskList != nil {\n\t\treturn v.WorkflowExecutionTaskList\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2c92b79a646253e0da826d2a69f4d8c7", "score": "0.47357097", "text": "func Getlist(client *ticketmatic.Client, params *ticketmatic.TicketsalesflowQuery) (*List, error) {\n\tr := client.NewRequest(\"GET\", \"/{accountname}/settings/system/ticketsalesflows\", \"json\")\n\tif params != nil {\n\t\tr.AddParameter(\"filter\", params.Filter)\n\t\tr.AddParameter(\"lastupdatesince\", params.Lastupdatesince)\n\t}\n\n\tvar obj *List\n\terr := r.Run(&obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn obj, nil\n}", "title": "" }, { "docid": "b9e5efa781aec5a61dc0916f980522ee", "score": "0.47293606", "text": "func (m *MockWorkflowCRUD) SelectAllWorkflowExecutions(ctx context.Context, shardID int, pageToken []byte, pageSize int) ([]*persistence.InternalListConcreteExecutionsEntity, []byte, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SelectAllWorkflowExecutions\", ctx, shardID, pageToken, pageSize)\n\tret0, _ := ret[0].([]*persistence.InternalListConcreteExecutionsEntity)\n\tret1, _ := ret[1].([]byte)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "33c850266c8dde565646eccd35ea1875", "score": "0.47155052", "text": "func (c *Client) GetAllByExecution(executionID int64) ([]*Entry, error) {\n\tvar dst []*Entry\n\tkeys, err := c.db.QueryFilter(c.ctx, kind, 0, 1000, \"ExecutionID=\", executionID, &dst)\n\tif err != nil {\n\t\treturn nil, errDatastore.WithError(err).Annotate(\"failed to db.QueryFilter\")\n\t}\n\tfor i := range dst {\n\t\tdst[i].ID = keys[i].IntID()\n\t}\n\tsort.Slice(dst, func(i, j int) bool {\n\t\treturn dst[j].Timestamp.Before(dst[i].Timestamp)\n\t})\n\treturn dst, nil\n}", "title": "" }, { "docid": "0f1c74a1694075b75b7ddeef32054f29", "score": "0.4698836", "text": "func (o FleetRuntimeConfigurationServerProcessOutput) ConcurrentExecutions() pulumi.IntOutput {\n\treturn o.ApplyT(func(v FleetRuntimeConfigurationServerProcess) int { return v.ConcurrentExecutions }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "0ccf504dad22173adc90b9639f0d8af9", "score": "0.46983367", "text": "func (c *Client) ListFlow() (*api.ListFlowResult, error) {\n\treturn api.ListFlow(c)\n}", "title": "" }, { "docid": "5cb7914be40f4d4ce01b942c5807daae", "score": "0.4684376", "text": "func (a *StorageProjectIsoApiService) StorageProjectIsoEventListExecute(r ApiStorageProjectIsoEventListRequest) ([]Event, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue []Event\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"StorageProjectIsoApiService.StorageProjectIsoEventList\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/storage/{locationId}/project/{projectId}/iso/{isoId}/event\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"projectId\"+\"}\", url.PathEscape(parameterToString(r.projectId, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"locationId\"+\"}\", url.PathEscape(parameterToString(r.locationId, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"isoId\"+\"}\", url.PathEscape(parameterToString(r.isoId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.limit != nil {\n\t\tlocalVarQueryParams.Add(\"$limit\", parameterToString(*r.limit, \"\"))\n\t}\n\tif r.skip != nil {\n\t\tlocalVarQueryParams.Add(\"$skip\", parameterToString(*r.skip, \"\"))\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, formFiles)\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\t\tvar v InlineResponseDefault\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\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": "f923627823f10d923e762b20d0782d49", "score": "0.4678755", "text": "func (r GetWorkflowExecutionHistoryRequest) Send(ctx context.Context) (*GetWorkflowExecutionHistoryResponse, 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 := &GetWorkflowExecutionHistoryResponse{\n\t\tGetWorkflowExecutionHistoryOutput: r.Request.Data.(*GetWorkflowExecutionHistoryOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "a51263b612de48fed7280430e276a5d7", "score": "0.46671876", "text": "func (a ListAddressExecutor) Execute(io workflow.WorkFlowData) (workflow.WorkFlowData, error) {\n\tprofiler := profiler.NewProfiler()\n\tprofiler.StartProfile(\"Address#ListAddressExecutor\")\n\n\tdefer func() {\n\t\tprofiler.EndProfileWithMetric([]string{\"ListAddressExecutor#Execute\"})\n\t}()\n\n\trc, _ := io.ExecContext.Get(constants.RequestContext)\n\tlogger.Info(\"Entered \"+a.Name(), rc)\n\tio.ExecContext.SetDebugMsg(\"List Address Executor\", \"List Address Executor Execute\")\n\n\tp, _ := io.IOData.Get(appconstant.IO_REQUEST_PARAMS)\n\tparams, pOk := p.(*RequestParams)\n\tif !pOk || params == nil {\n\t\tlogger.Error(\"ListAddressExecutor.invalid type of params\", rc)\n\t\treturn io, &constants.AppError{Code: constants.ParamsInValidErrorCode, Message: \"Invalid type of params\"}\n\t}\n\n\tdebugInfo := new(Debug)\n\taddressType := params.QueryParams.AddressType\n\tvar err error\n\tvar addressListResult *AddressResult\n\tif addressType == \"all\" || addressType == \"other\" || addressType == \"\" {\n\t\taddressListResult, err = GetAddressList(params, debugInfo)\n\t} else {\n\t\taddressListResult, err = GetAddressTypeList(params, debugInfo)\n\t}\n\tif err != nil {\n\t\tlogger.Error(\"unable to get address\")\n\t\treturn io, &constants.AppError{Code: constants.IncorrectDataErrorCode, Message: err.Error()}\n\t}\n\taddDebugContents(io, debugInfo)\n\tderr := io.IOData.Set(appconstant.IO_ADDRESS_RESULT, addressListResult)\n\tif derr != nil {\n\t\tlogger.Error(fmt.Sprintf(\"Error in setting address list result to workflow data- %v\", derr), rc)\n\t\treturn io, &constants.AppError{Code: constants.IncorrectDataErrorCode, Message: derr.Error()}\n\t}\n\n\treturn io, nil\n}", "title": "" }, { "docid": "136ae495b64b156bd283f421f71370d6", "score": "0.46624848", "text": "func (a *RecoveryApiService) GetRecoveryRestoreListExecute(r ApiGetRecoveryRestoreListRequest) (*RecoveryRestoreResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *RecoveryRestoreResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"RecoveryApiService.GetRecoveryRestoreList\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/recovery/Restores\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.filter != nil {\n\t\tlocalVarQueryParams.Add(\"$filter\", parameterToString(*r.filter, \"\"))\n\t}\n\tif r.orderby != nil {\n\t\tlocalVarQueryParams.Add(\"$orderby\", parameterToString(*r.orderby, \"\"))\n\t}\n\tif r.top != nil {\n\t\tlocalVarQueryParams.Add(\"$top\", parameterToString(*r.top, \"\"))\n\t}\n\tif r.skip != nil {\n\t\tlocalVarQueryParams.Add(\"$skip\", parameterToString(*r.skip, \"\"))\n\t}\n\tif r.select_ != nil {\n\t\tlocalVarQueryParams.Add(\"$select\", parameterToString(*r.select_, \"\"))\n\t}\n\tif r.expand != nil {\n\t\tlocalVarQueryParams.Add(\"$expand\", parameterToString(*r.expand, \"\"))\n\t}\n\tif r.apply != nil {\n\t\tlocalVarQueryParams.Add(\"$apply\", parameterToString(*r.apply, \"\"))\n\t}\n\tif r.count != nil {\n\t\tlocalVarQueryParams.Add(\"$count\", parameterToString(*r.count, \"\"))\n\t}\n\tif r.inlinecount != nil {\n\t\tlocalVarQueryParams.Add(\"$inlinecount\", parameterToString(*r.inlinecount, \"\"))\n\t}\n\tif r.at != nil {\n\t\tlocalVarQueryParams.Add(\"at\", parameterToString(*r.at, \"\"))\n\t}\n\tif r.tags != nil {\n\t\tlocalVarQueryParams.Add(\"tags\", parameterToString(*r.tags, \"\"))\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\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\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, formFiles)\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 == 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\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\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": "3597b69ab3c7e18444741ee59d6789a9", "score": "0.46617657", "text": "func (s ListWorkflowExecutionsInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "352a7b74fca1a1403bc6d7ef915a01b0", "score": "0.46592277", "text": "func (s *Store) Execute(queries []string, timings, tx bool) ([]*sql.Result, error) {\n\tif s.raft.State() != raft.Leader {\n\t\treturn nil, ErrNotLeader\n\t}\n\n\tc := &command{\n\t\tTyp: execute,\n\t\tTx: tx,\n\t\tQueries: queries,\n\t\tTimings: timings,\n\t}\n\tb, err := json.Marshal(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tf := s.raft.Apply(b, raftTimeout)\n\tif e := f.(raft.Future); e.Error() != nil {\n\t\treturn nil, e.Error()\n\t}\n\n\tr := f.Response().(*fsmExecuteResponse)\n\treturn r.results, r.error\n}", "title": "" }, { "docid": "4d0d4169a3d31fa89863a28ac2b15c7e", "score": "0.46498835", "text": "func (c *Imagebuilder) ListWorkflowExecutionsPagesWithContext(ctx aws.Context, input *ListWorkflowExecutionsInput, fn func(*ListWorkflowExecutionsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListWorkflowExecutionsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListWorkflowExecutionsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListWorkflowExecutionsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "d59e93676f27f71a14a5580de7b95537", "score": "0.46409583", "text": "func (v *RecordDecisionTaskStartedResponse) GetWorkflowExecutionTaskList() (o *TaskList) {\n\tif v != nil && v.WorkflowExecutionTaskList != nil {\n\t\treturn v.WorkflowExecutionTaskList\n\t}\n\treturn\n}", "title": "" }, { "docid": "205170d0786ce820353cb6492b0391e9", "score": "0.46289605", "text": "func (c *Athena) ListQueryExecutionsPagesWithContext(ctx aws.Context, input *ListQueryExecutionsInput, fn func(*ListQueryExecutionsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListQueryExecutionsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListQueryExecutionsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListQueryExecutionsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "8c454a66d3cb621de643bedc8e611d6d", "score": "0.46213958", "text": "func (client EvaluationsClient) List(ctx context.Context) (result ListEvaluation, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/EvaluationsClient.List\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.ListPreparer(ctx)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"personalizer.EvaluationsClient\", \"List\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"personalizer.EvaluationsClient\", \"List\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.ListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"personalizer.EvaluationsClient\", \"List\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9f75b022a0bfa26c9abcd6f29c054646", "score": "0.46174514", "text": "func (s *ListQueryExecutionsStub) ListQueryExecutionsPages(input *athena.ListQueryExecutionsInput, fn func(*athena.ListQueryExecutionsOutput, bool) bool) error {\n\tcont := true\n\tfor cont {\n\t\tlqx, err := s.ListQueryExecutions(input)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlastPage := lqx.NextToken == nil\n\t\tcont = fn(lqx, lastPage)\n\t\tcont = cont && !lastPage\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e298afe713abdc52c0b0da206e138f30", "score": "0.46135786", "text": "func (c *ListCommand) Exec(in io.Reader, out io.Writer) error {\n\tserviceID, source := c.manifest.ServiceID()\n\tif source == manifest.SourceUndefined {\n\t\treturn errors.ErrNoServiceID\n\t}\n\tc.Input.ServiceID = serviceID\n\n\thealthChecks, err := c.Globals.Client.ListHealthChecks(&c.Input)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !c.Globals.Verbose() {\n\t\ttw := text.NewTable(out)\n\t\ttw.AddHeader(\"SERVICE\", \"VERSION\", \"NAME\", \"METHOD\", \"HOST\", \"PATH\")\n\t\tfor _, healthCheck := range healthChecks {\n\t\t\ttw.AddLine(healthCheck.ServiceID, healthCheck.ServiceVersion, healthCheck.Name, healthCheck.Method, healthCheck.Host, healthCheck.Path)\n\t\t}\n\t\ttw.Print()\n\t\treturn nil\n\t}\n\n\tfmt.Fprintf(out, \"Service ID: %s\\n\", c.Input.ServiceID)\n\tfmt.Fprintf(out, \"Version: %d\\n\", c.Input.ServiceVersion)\n\tfor i, healthCheck := range healthChecks {\n\t\tfmt.Fprintf(out, \"\\tHealthcheck %d/%d\\n\", i+1, len(healthChecks))\n\t\ttext.PrintHealthCheck(out, \"\\t\\t\", healthCheck)\n\t}\n\tfmt.Fprintln(out)\n\n\treturn nil\n}", "title": "" }, { "docid": "73f136aa1a05d047e28b53f69598ba3f", "score": "0.4608471", "text": "func NewListQueryExecutionsStub(rs ...*Result) *ListQueryExecutionsStub {\n\treturn &ListQueryExecutionsStub{rs: rs}\n}", "title": "" }, { "docid": "1da9a44ea132c0dabad5a6fc18d890a4", "score": "0.45663497", "text": "func (e *Executor) executeList(ctx context.Context, typ *List, source interface{}, selectionSet *SelectionSet) (interface{}, error) {\n\tif reflect.ValueOf(source).IsNil() {\n\t\treturn emptyList, nil\n\t}\n\n\t// iterate over arbitrary slice types using reflect\n\tslice := reflect.ValueOf(source)\n\titems := make([]interface{}, slice.Len())\n\n\t// resolve every element in the slice\n\tfor i := 0; i < slice.Len(); i++ {\n\t\tvalue := slice.Index(i)\n\t\tresolved, err := e.execute(ctx, typ.Type, value.Interface(), selectionSet)\n\t\tif err != nil {\n\t\t\tif err == ErrNoUpdate {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn nil, internal.NestErrorPaths(err, fmt.Sprint(i))\n\t\t}\n\t\titems[i] = resolved\n\t}\n\n\treturn items, nil\n}", "title": "" }, { "docid": "3d2fa494ee5f40dd72d5ebfb081bfe88", "score": "0.45652398", "text": "func NewExecutor_execute_Params_List(s *capnp.Segment, sz int32) (Executor_execute_Params_List, error) {\n\tl, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz)\n\treturn Executor_execute_Params_List{l}, err\n}", "title": "" }, { "docid": "58429fd91a3ab6d35fc5f2ddc1718f86", "score": "0.45651883", "text": "func (client ReportsClient) GetExecutionHistoryByResourceGroupNameResponder(resp *http.Response) (result ReportExecutionListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "6da76a23a8727780a60743adfb3f7b31", "score": "0.45598838", "text": "func ValidateExecution(execution *genev1alpha1.Execution) error {\n\tif msgs := validation.IsDNS1123Label(execution.Name); len(msgs) > 0 {\n\t\treturn fmt.Errorf(\"name is not valid %v\", msgs)\n\t}\n\n\tif execution.Spec.Parallelism != nil && *execution.Spec.Parallelism < 0 {\n\t\treturn fmt.Errorf(\"parallelism must be greater than or equal to 0\")\n\t}\n\tif len(execution.Spec.Tasks) == 0 {\n\t\treturn fmt.Errorf(\"tasks of execution must not be empty\")\n\t}\n\tif err := validateTasks(execution.Spec.Tasks); err != nil {\n\t\treturn err\n\t}\n\tif ok := validateNoCycle(execution); !ok {\n\t\treturn fmt.Errorf(\"dependents of execution exist cycle\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ad745d6208bc70d8f59a42e2d16d1b59", "score": "0.45518866", "text": "func List(c *gophercloud.ServiceClient,opts ListOpts)([]EVS, error){\n\tu :=EvsListURL(c)\n\n\tpages, err := pagination.NewPager(c, u, func(r pagination.PageResult) pagination.Page {\n\t\treturn EVSPage{pagination.LinkedPageBase{PageResult: r}}\n\t}).AllPages()\n\n\tallEvs, err := ExtractEVS(pages)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn FilterEVS(allEvs, opts)\n\n}", "title": "" }, { "docid": "5f39d1728fd90e08701a21221dddca5b", "score": "0.45508456", "text": "func (a *OrdersApiService) ListOrdersBySupplierExecute(r ApiListOrdersBySupplierRequest) (MainOrderListOutput, *_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 MainOrderListOutput\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"OrdersApiService.ListOrdersBySupplier\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/integration/v1/orders/list\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.xREKKIAuthorizationType == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"xREKKIAuthorizationType is required and must be specified\")\n\t}\n\tif r.input == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"input is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tlocalVarHeaderParams[\"X-REKKI-Authorization-Type\"] = parameterToString(*r.xREKKIAuthorizationType, \"\")\n\t// body params\n\tlocalVarPostBody = r.input\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[\"ApiKeyAuth\"]; 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\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 == 400 {\n\t\t\tvar v MainGenericErrorResponse\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 == 401 {\n\t\t\tvar v string\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v string\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": "4273bb4e4386f07735c64c035e14cc34", "score": "0.4540749", "text": "func (s *EscalationService) List(opt *EscalationOptions) (*EscalationPolicies, *http.Response, error) {\n\turi, err := addOptions(\"escalation_policies\", opt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tescalationpolicies := new(EscalationPolicies)\n\tres, err := s.client.Get(uri, escalationpolicies)\n\tif err != nil {\n\t\treturn nil, res, err\n\t}\n\n\treturn escalationpolicies, res, err\n}", "title": "" }, { "docid": "0883281074f73c7614d03eb301eb43a9", "score": "0.45391944", "text": "func (a *RecoveryApiService) GetRecoveryConfigResultListExecute(r ApiGetRecoveryConfigResultListRequest) (*RecoveryConfigResultResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *RecoveryConfigResultResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"RecoveryApiService.GetRecoveryConfigResultList\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/recovery/ConfigResults\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.filter != nil {\n\t\tlocalVarQueryParams.Add(\"$filter\", parameterToString(*r.filter, \"\"))\n\t}\n\tif r.orderby != nil {\n\t\tlocalVarQueryParams.Add(\"$orderby\", parameterToString(*r.orderby, \"\"))\n\t}\n\tif r.top != nil {\n\t\tlocalVarQueryParams.Add(\"$top\", parameterToString(*r.top, \"\"))\n\t}\n\tif r.skip != nil {\n\t\tlocalVarQueryParams.Add(\"$skip\", parameterToString(*r.skip, \"\"))\n\t}\n\tif r.select_ != nil {\n\t\tlocalVarQueryParams.Add(\"$select\", parameterToString(*r.select_, \"\"))\n\t}\n\tif r.expand != nil {\n\t\tlocalVarQueryParams.Add(\"$expand\", parameterToString(*r.expand, \"\"))\n\t}\n\tif r.apply != nil {\n\t\tlocalVarQueryParams.Add(\"$apply\", parameterToString(*r.apply, \"\"))\n\t}\n\tif r.count != nil {\n\t\tlocalVarQueryParams.Add(\"$count\", parameterToString(*r.count, \"\"))\n\t}\n\tif r.inlinecount != nil {\n\t\tlocalVarQueryParams.Add(\"$inlinecount\", parameterToString(*r.inlinecount, \"\"))\n\t}\n\tif r.at != nil {\n\t\tlocalVarQueryParams.Add(\"at\", parameterToString(*r.at, \"\"))\n\t}\n\tif r.tags != nil {\n\t\tlocalVarQueryParams.Add(\"tags\", parameterToString(*r.tags, \"\"))\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\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\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, formFiles)\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 == 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\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\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": "593ff9f1904cb8fbf0feafa81c24b318", "score": "0.4505495", "text": "func (fetq *FlowExecutionTemplateQuery) All(ctx context.Context) ([]*FlowExecutionTemplate, error) {\n\tif err := fetq.prepareQuery(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn fetq.sqlAll(ctx)\n}", "title": "" }, { "docid": "9ca927d34700b486ed16ac7776d7769c", "score": "0.44990405", "text": "func (a *ApiApiService) ListIpsExecute(r ApiListIpsRequest) ([]Ip, *_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 []Ip\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApiApiService.ListIps\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/ip/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\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": "91183c79020e1b227da866a353603349", "score": "0.4495005", "text": "func (a *PowerApiService) GetPowerPolicyListExecute(r ApiGetPowerPolicyListRequest) (*PowerPolicyResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *PowerPolicyResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"PowerApiService.GetPowerPolicyList\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/power/Policies\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.filter != nil {\n\t\tlocalVarQueryParams.Add(\"$filter\", parameterToString(*r.filter, \"\"))\n\t}\n\tif r.orderby != nil {\n\t\tlocalVarQueryParams.Add(\"$orderby\", parameterToString(*r.orderby, \"\"))\n\t}\n\tif r.top != nil {\n\t\tlocalVarQueryParams.Add(\"$top\", parameterToString(*r.top, \"\"))\n\t}\n\tif r.skip != nil {\n\t\tlocalVarQueryParams.Add(\"$skip\", parameterToString(*r.skip, \"\"))\n\t}\n\tif r.select_ != nil {\n\t\tlocalVarQueryParams.Add(\"$select\", parameterToString(*r.select_, \"\"))\n\t}\n\tif r.expand != nil {\n\t\tlocalVarQueryParams.Add(\"$expand\", parameterToString(*r.expand, \"\"))\n\t}\n\tif r.apply != nil {\n\t\tlocalVarQueryParams.Add(\"$apply\", parameterToString(*r.apply, \"\"))\n\t}\n\tif r.count != nil {\n\t\tlocalVarQueryParams.Add(\"$count\", parameterToString(*r.count, \"\"))\n\t}\n\tif r.inlinecount != nil {\n\t\tlocalVarQueryParams.Add(\"$inlinecount\", parameterToString(*r.inlinecount, \"\"))\n\t}\n\tif r.at != nil {\n\t\tlocalVarQueryParams.Add(\"at\", parameterToString(*r.at, \"\"))\n\t}\n\tif r.tags != nil {\n\t\tlocalVarQueryParams.Add(\"tags\", parameterToString(*r.tags, \"\"))\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\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\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, formFiles)\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 == 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\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\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": "271bc24fc9a45027797fa2c0f9dd0a24", "score": "0.4494872", "text": "func (a *ApiApiService) ListSystemusersExecute(r ApiListSystemusersRequest) ([]Systemuser, *_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 []Systemuser\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApiApiService.ListSystemusers\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/systemuser/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\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": "aa24a97b722fe894c80a176aec73f96b", "score": "0.4493222", "text": "func (s *TimeTransactionsEndpoint) List(ctx context.Context, division int, all bool, o *api.ListOptions) ([]*TimeTransactions, error) {\n\tvar entities []*TimeTransactions\n\tu, _ := s.client.ResolvePathWithDivision(\"/api/v1/{division}/manufacturing/TimeTransactions\", division) // #nosec\n\tapi.AddListOptionsToURL(u, o)\n\n\tif all {\n\t\terr := s.client.ListRequestAndDoAll(ctx, u.String(), &entities)\n\t\treturn entities, err\n\t}\n\t_, _, err := s.client.NewRequestAndDo(ctx, \"GET\", u.String(), nil, &entities)\n\treturn entities, err\n}", "title": "" }, { "docid": "30adc7312ec6c0d85d1ca94e422bd248", "score": "0.44919744", "text": "func (a *StorageProjectIsoApiService) StorageProjectIsoServiceListExecute(r ApiStorageProjectIsoServiceListRequest) ([]ResourceService, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue []ResourceService\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"StorageProjectIsoApiService.StorageProjectIsoServiceList\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/storage/{locationId}/project/{projectId}/iso/{isoId}/service\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"projectId\"+\"}\", url.PathEscape(parameterToString(r.projectId, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"locationId\"+\"}\", url.PathEscape(parameterToString(r.locationId, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"isoId\"+\"}\", url.PathEscape(parameterToString(r.isoId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\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\t\tvar v InlineResponseDefault\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\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": "ac414f265d964806733339b2506f0b86", "score": "0.44859016", "text": "func (client ReportsClient) GetExecutionHistoryByResourceGroupNameSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tazure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "7b06ad1768ada97c05e6950578e83ea9", "score": "0.44853708", "text": "func (client ReportsClient) GetExecutionHistoryByResourceGroupName(ctx context.Context, resourceGroupName string, reportName string) (result ReportExecutionListResult, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ReportsClient.GetExecutionHistoryByResourceGroupName\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.GetExecutionHistoryByResourceGroupNamePreparer(ctx, resourceGroupName, reportName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"costmanagement.ReportsClient\", \"GetExecutionHistoryByResourceGroupName\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetExecutionHistoryByResourceGroupNameSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"costmanagement.ReportsClient\", \"GetExecutionHistoryByResourceGroupName\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetExecutionHistoryByResourceGroupNameResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"costmanagement.ReportsClient\", \"GetExecutionHistoryByResourceGroupName\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c5f010f9f09893346039347af9cec49b", "score": "0.44704998", "text": "func (v *HistoryResetStickyTaskListRequest) GetExecution() (o *WorkflowExecution) {\n\tif v != nil && v.Execution != nil {\n\t\treturn v.Execution\n\t}\n\treturn\n}", "title": "" }, { "docid": "410edc723432372f19bcff92540c7149", "score": "0.44621807", "text": "func (w *waitForNodesMeasurement) Execute(config *measurement.MeasurementConfig) ([]measurement.Summary, error) {\n\tminNodeCount, maxNodeCount, err := getMinMaxDesiredNodeCount(config.Params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tselector := measurementutil.NewObjectSelector()\n\tif err := selector.Parse(config.Params); err != nil {\n\t\treturn nil, err\n\t}\n\n\ttimeout, err := util.GetDurationOrDefault(config.Params, \"timeout\", defaultWaitForNodesTimeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstopCh := make(chan struct{})\n\ttime.AfterFunc(timeout, func() {\n\t\tclose(stopCh)\n\t})\n\n\toptions := &measurementutil.WaitForNodeOptions{\n\t\tSelector: selector,\n\t\tMinDesiredNodeCount: minNodeCount,\n\t\tMaxDesiredNodeCount: maxNodeCount,\n\t\tEnableLogging: true,\n\t\tCallerName: w.String(),\n\t\tWaitForNodesInterval: defaultWaitForNodesInterval,\n\t}\n\treturn nil, measurementutil.WaitForNodes(config.ClusterFramework.GetClientSets().GetClient(), stopCh, options)\n}", "title": "" }, { "docid": "beaaf07f55531dc13d0a151c275a72b7", "score": "0.44587234", "text": "func (a *ApiApiService) ListCasesExecute(r ApiListCasesRequest) ([]Case, *_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 []Case\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApiApiService.ListCases\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/case/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\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": "a8451eba20258359fd1f67517e533749", "score": "0.44577193", "text": "func (a *ApiApiService) ListOsarchsExecute(r ApiListOsarchsRequest) ([]Osarch, *_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 []Osarch\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApiApiService.ListOsarchs\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/osarch/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\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": "c1eacd7defef2445d75a876ac02c7fcb", "score": "0.44413877", "text": "func (s *Service) dequeueTaskExecutions(ctx context.Context) error {\n\tfor {\n\t\tif ctx.Err() != nil {\n\t\t\treturn ctx.Err()\n\t\t}\n\t\tsize, err := s.Dao.QueueLen()\n\t\tif err != nil {\n\t\t\tlog.Error(ctx, \"dequeueTaskExecutions > Unable to get queueLen: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tlog.Debug(ctx, \"dequeueTaskExecutions> current queue size: %d\", size)\n\n\t\tif s.Maintenance {\n\t\t\tlog.Info(ctx, \"Maintenance enable, wait 1 minute. Queue %d\", size)\n\t\t\ttime.Sleep(1 * time.Minute)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Dequeuing context\n\t\tvar taskKey string\n\t\tif ctx.Err() != nil {\n\t\t\treturn ctx.Err()\n\t\t}\n\t\tif err := s.Cache.DequeueWithContext(ctx, schedulerQueueKey, 250*time.Millisecond, &taskKey); err != nil {\n\t\t\tcontinue\n\t\t}\n\t\ts.Dao.dequeuedIncr()\n\t\tif taskKey == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tlog.Info(ctx, \"dequeueTaskExecutions> work on taskKey: %s\", taskKey)\n\n\t\t// Load the task execution\n\t\tvar t = sdk.TaskExecution{}\n\t\tfind, err := s.Cache.Get(taskKey, &t)\n\t\tif err != nil {\n\t\t\tlog.Error(ctx, \"cannot get from cache %s: %v\", taskKey, err)\n\t\t}\n\t\tif !find {\n\t\t\tcontinue\n\t\t}\n\t\tt.ProcessingTimestamp = time.Now().UnixNano()\n\t\tt.LastError = \"\"\n\t\tt.Status = TaskExecutionDoing\n\t\ts.Dao.SaveTaskExecution(&t)\n\n\t\tvar restartTask bool\n\t\tvar saveTaskExecution bool\n\n\t\ttask := s.Dao.FindTask(ctx, t.UUID)\n\t\tif task == nil {\n\t\t\tlog.Error(ctx, \"dequeueTaskExecutions failed: Task %s not found - deleting this task execution\", t.UUID)\n\t\t\tt.LastError = \"Internal Error: Task not found\"\n\t\t\tt.NbErrors++\n\t\t\tif err := s.Dao.DeleteTaskExecution(&t); err != nil {\n\t\t\t\tlog.Error(ctx, \"dequeueTaskExecutions > error on DeleteTaskExecution: %v\", err)\n\t\t\t}\n\t\t\tcontinue\n\n\t\t} else if t.NbErrors >= s.Cfg.RetryError {\n\t\t\tlog.Info(ctx, \"dequeueTaskExecutions> Deleting task execution %s cause: to many errors:%d lastError:%s\", t.UUID, t.NbErrors, t.LastError)\n\t\t\tif err := s.Dao.DeleteTaskExecution(&t); err != nil {\n\t\t\t\tlog.Error(ctx, \"dequeueTaskExecutions > error on DeleteTaskExecution: %v\", err)\n\t\t\t}\n\t\t\tcontinue\n\n\t\t} else if task.Stopped {\n\t\t\tt.LastError = \"Executions skipped: Task has been stopped\"\n\t\t\tt.NbErrors++\n\t\t\tsaveTaskExecution = true\n\t\t} else {\n\t\t\tsaveTaskExecution = true\n\t\t\tlog.Debug(ctx, \"dequeueTaskExecutions> call doTask on taskKey: %s\", taskKey)\n\t\t\tvar err error\n\t\t\trestartTask, err = s.doTask(ctx, task, &t)\n\t\t\tif err != nil {\n\t\t\t\tif strings.Contains(err.Error(), \"Unsupported task type\") {\n\t\t\t\t\t// delete this task execution, as it will never work\n\t\t\t\t\tlog.Info(ctx, \"dequeueTaskExecutions> Deleting task execution %s as err:%v\", t.UUID, err)\n\t\t\t\t\tif err := s.Dao.DeleteTaskExecution(&t); err != nil {\n\t\t\t\t\t\tlog.Error(ctx, \"dequeueTaskExecutions > error on DeleteTaskExecution: %v\", err)\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t} else {\n\t\t\t\t\tlog.Warn(ctx, \"dequeueTaskExecutions> %s failed err[%d]: %v\", t.UUID, t.NbErrors, err)\n\t\t\t\t\tt.LastError = err.Error()\n\t\t\t\t\tt.NbErrors++\n\t\t\t\t\tsaveTaskExecution = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Save the execution\n\t\tif saveTaskExecution {\n\t\t\tt.Status = TaskExecutionDone\n\t\t\tt.ProcessingTimestamp = time.Now().UnixNano()\n\t\t\ts.Dao.SaveTaskExecution(&t)\n\t\t}\n\n\t\t//Start (or restart) the task\n\t\tif restartTask {\n\t\t\t_, err := s.startTask(ctx, task)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(ctx, \"dequeueTaskExecutions> unable to restart the task %+v after execution: %v\", task, err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "43bc93e2f231ad6622a53bc68accebbc", "score": "0.44373858", "text": "func (wc *WorkflowClient) ListRuns(name, codesetProject, codesetName, status string) ([]*workflow.WorkflowRun, error) {\n\trequest, err := workflowc.BuildListRunsPayload(name, codesetProject, codesetName, status)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := wc.c.ListRuns()(context.Background(), request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\twrs := res.([]*workflow.WorkflowRun)\n\tsortWorkflowRunsByStartTime(wrs)\n\n\treturn wrs, nil\n}", "title": "" }, { "docid": "8573e0877449741f57a650d91c0faf95", "score": "0.4436594", "text": "func (client ReportsClient) GetExecutionHistoryResponder(resp *http.Response) (result ReportExecutionListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "9af7018ba52cf9a8ab7f14c5393027dd", "score": "0.44327024", "text": "func (s *sandboxStore) List(ctx context.Context, fields ...string) ([]api.Sandbox, error) {\n\tns, err := namespaces.NamespaceRequired(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfilter, err := filters.ParseAll(fields...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", err.Error(), errdefs.ErrInvalidArgument)\n\t}\n\n\tvar (\n\t\tlist []api.Sandbox\n\t)\n\n\tif err := view(ctx, s.db, func(tx *bbolt.Tx) error {\n\t\tbucket := getSandboxBucket(tx, ns)\n\t\tif bucket == nil {\n\t\t\t// We haven't created any sandboxes yet, just return empty list\n\t\t\treturn nil\n\t\t}\n\n\t\tif err := bucket.ForEach(func(k, v []byte) error {\n\t\t\tinfo, err := s.read(bucket, k)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to read bucket %q: %w\", string(k), err)\n\t\t\t}\n\n\t\t\tif filter.Match(adaptSandbox(&info)) {\n\t\t\t\tlist = append(list, info)\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn list, nil\n}", "title": "" }, { "docid": "32a376bb55cdc91c85687d4239115538", "score": "0.441991", "text": "func (a *ApiApiService) ListOsExecute(r ApiListOsRequest) ([]Os, *_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 []Os\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApiApiService.ListOs\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/os/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\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": "272e621c8e76ba4ccf6dd4311de5c7d3", "score": "0.44133174", "text": "func (sm *storageMock) List(offset, limit int64, expireAtFrom, expireAtTo *time.Time) ([]*Session, error) {\n\targs := sm.Called(offset, limit, expireAtFrom, expireAtTo)\n\n\tses, ok := args.Get(0).([]*Session)\n\tif !ok {\n\t\treturn nil, args.Error(1)\n\t}\n\treturn ses, args.Error(1)\n}", "title": "" }, { "docid": "389127429a4c4f2a234cdee3f1fe0f6d", "score": "0.44110867", "text": "func (a *RecurrencesApiService) ListTransactionByRecurrenceExecute(r ApiListTransactionByRecurrenceRequest) (TransactionArray, *_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 TransactionArray\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"RecurrencesApiService.ListTransactionByRecurrence\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/recurrences/{id}/transactions\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.PathEscape(parameterToString(r.id, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.page != nil {\n\t\tlocalVarQueryParams.Add(\"page\", parameterToString(*r.page, \"\"))\n\t}\n\tif r.start != nil {\n\t\tlocalVarQueryParams.Add(\"start\", parameterToString(*r.start, \"\"))\n\t}\n\tif r.end != nil {\n\t\tlocalVarQueryParams.Add(\"end\", parameterToString(*r.end, \"\"))\n\t}\n\tif r.type_ != nil {\n\t\tlocalVarQueryParams.Add(\"type\", parameterToString(*r.type_, \"\"))\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/vnd.api+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": "9d4ac71eb92ed0f256ea64d2ebf1a73d", "score": "0.44109458", "text": "func (o *svcLogsOpts) Execute() error {\n\tif err := o.initRuntimeClients(); err != nil {\n\t\treturn err\n\t}\n\teventsWriter := logging.WriteHumanLogs\n\tif o.shouldOutputJSON {\n\t\teventsWriter = logging.WriteJSONLogs\n\t}\n\tvar limit *int64\n\tif o.limit != 0 {\n\t\tlimit = aws.Int64(int64(o.limit))\n\t}\n\tif o.previous {\n\t\ttaskID, err := o.latestStoppedTaskID()\n\t\tif err != nil {\n\t\t\tif errors.Is(err, noPreviousTasksErr) {\n\t\t\t\tlog.Warningln(\"no previously stopped tasks found\")\n\t\t\t\treturn nil // return nil as we have no stopped tasks.\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\to.taskIDs = []string{taskID}\n\t\tlog.Infoln(\"previously stopped task:\", taskID)\n\t}\n\terr := o.logsSvc.WriteLogEvents(logging.WriteLogEventsOpts{\n\t\tFollow: o.follow,\n\t\tLimit: limit,\n\t\tEndTime: o.endTime,\n\t\tStartTime: o.startTime,\n\t\tTaskIDs: o.taskIDs,\n\t\tOnEvents: eventsWriter,\n\t\tContainerName: o.containerName,\n\t\tLogGroup: o.logGroup,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"write log events for service %s: %w\", o.name, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ad864009f160fff59b5e25e324a3f12a", "score": "0.44102785", "text": "func (r *GetListsRequest) Execute() (lists []GetListsResult, err error) {\n\terr = r.request.Execute(\"getLists\", &lists)\n\treturn\n}", "title": "" }, { "docid": "0b7e7f4b470ef61cceaaca0fa11fcee8", "score": "0.44074818", "text": "func (a *RecoveryApiService) GetRecoveryScheduleConfigPolicyListExecute(r ApiGetRecoveryScheduleConfigPolicyListRequest) (*RecoveryScheduleConfigPolicyResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *RecoveryScheduleConfigPolicyResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"RecoveryApiService.GetRecoveryScheduleConfigPolicyList\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/recovery/ScheduleConfigPolicies\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.filter != nil {\n\t\tlocalVarQueryParams.Add(\"$filter\", parameterToString(*r.filter, \"\"))\n\t}\n\tif r.orderby != nil {\n\t\tlocalVarQueryParams.Add(\"$orderby\", parameterToString(*r.orderby, \"\"))\n\t}\n\tif r.top != nil {\n\t\tlocalVarQueryParams.Add(\"$top\", parameterToString(*r.top, \"\"))\n\t}\n\tif r.skip != nil {\n\t\tlocalVarQueryParams.Add(\"$skip\", parameterToString(*r.skip, \"\"))\n\t}\n\tif r.select_ != nil {\n\t\tlocalVarQueryParams.Add(\"$select\", parameterToString(*r.select_, \"\"))\n\t}\n\tif r.expand != nil {\n\t\tlocalVarQueryParams.Add(\"$expand\", parameterToString(*r.expand, \"\"))\n\t}\n\tif r.apply != nil {\n\t\tlocalVarQueryParams.Add(\"$apply\", parameterToString(*r.apply, \"\"))\n\t}\n\tif r.count != nil {\n\t\tlocalVarQueryParams.Add(\"$count\", parameterToString(*r.count, \"\"))\n\t}\n\tif r.inlinecount != nil {\n\t\tlocalVarQueryParams.Add(\"$inlinecount\", parameterToString(*r.inlinecount, \"\"))\n\t}\n\tif r.at != nil {\n\t\tlocalVarQueryParams.Add(\"at\", parameterToString(*r.at, \"\"))\n\t}\n\tif r.tags != nil {\n\t\tlocalVarQueryParams.Add(\"tags\", parameterToString(*r.tags, \"\"))\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\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\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, formFiles)\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 == 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\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\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": "f51a57338c4c5618b70cf0387d75a54c", "score": "0.44009367", "text": "func (v *ResetStickyTaskListRequest) GetExecution() (o *shared.WorkflowExecution) {\n\tif v != nil && v.Execution != nil {\n\t\treturn v.Execution\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8ef9b9ec9f62cc4a303170660efe6ac8", "score": "0.4399635", "text": "func (client ScheduleOperationsClient) List(resourceGroupName string, labName string, filter string, top *int32, orderBy string) (result ResponseWithContinuationSchedule, err error) {\n\treq, err := client.ListPreparer(resourceGroupName, labName, filter, top, orderBy)\n\tif err != nil {\n\t\treturn result, autorest.NewErrorWithError(err, \"devtestlabs.ScheduleOperationsClient\", \"List\", nil, \"Failure preparing request\")\n\t}\n\n\tresp, err := client.ListSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\treturn result, autorest.NewErrorWithError(err, \"devtestlabs.ScheduleOperationsClient\", \"List\", resp, \"Failure sending request\")\n\t}\n\n\tresult, err = client.ListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"devtestlabs.ScheduleOperationsClient\", \"List\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "0ed01d6c523232538768bfdc9a3eefb2", "score": "0.4397881", "text": "func (sm *StorageManager) GetSummary(executionID string, filters map[string]string) (map[string]storage.CollectorsSummary, error) {\n\tsummary := map[string]storage.CollectorsSummary{}\n\texecutionIDQuery := elastic.NewTermQuery(\"ExecutionID\", executionID)\n\teventTypeQuery := elastic.NewTermQuery(\"EventType\", \"service_status\")\n\n\tlog.WithFields(log.Fields{\n\t\t\"execution_id\": executionIDQuery,\n\t\t\"event_type\": eventTypeQuery,\n\t}).Debug(\"Going to get get summary with the following fields\")\n\n\tsearchQuery := sm.client.Search().\n\t\tQuery(elastic.NewBoolQuery().Must(eventTypeQuery, executionIDQuery))\n\n\tsearchResultTotalHits, err := searchQuery.Size(0).Do(context.Background())\n\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"error when trying get total hits summary\")\n\t\treturn summary, err\n\t}\n\n\tsearchResult, err := searchQuery.Size(int(searchResultTotalHits.TotalHits())).Do(context.Background())\n\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"error when trying to get summary data\")\n\t\treturn summary, err\n\t}\n\n\tlog.WithFields(log.Fields{\n\t\t\"milliseconds\": searchResult.TookInMillis,\n\t\t\"hits\": len(searchResult.Hits.Hits),\n\t}).Debug(\"get all executions id response time\")\n\n\tvar summaryData storage.Summary\n\tfor _, item := range searchResult.Each(reflect.TypeOf(summaryData)) {\n\t\tsummaryRow, ok := item.(storage.Summary)\n\t\tif !ok {\n\t\t\tlog.Error(\"could not parse summary row\")\n\t\t\tcontinue\n\t\t}\n\n\t\t// check if the resource status already exists, if yes we check if have latest event\n\t\tval, found := summary[summaryRow.ResourceName]\n\t\tif found {\n\t\t\tif summaryRow.EventTime < val.EventTime {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdelete(summary, summaryRow.ResourceName)\n\t\t}\n\n\t\tsummary[summaryRow.ResourceName] = storage.CollectorsSummary{\n\t\t\tEventTime: summaryRow.EventTime,\n\t\t\tStatus: summaryRow.Data.Status,\n\t\t\tResourceName: summaryRow.ResourceName,\n\t\t\tErrorMessage: summaryRow.Data.ErrorMessage,\n\t\t}\n\t}\n\n\tfor resourceName, resourceData := range summary {\n\t\tfilters[\"ResourceName\"] = resourceName\n\t\tlog.WithField(\"filters\", filters).Debug(\"Going to get resources summary details with the following filters\")\n\t\ttotalSpent, resourceCount, err := sm.getResourceSummaryDetails(executionID, filters)\n\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tnewResourceData := resourceData\n\t\tnewResourceData.TotalSpent = totalSpent\n\t\tnewResourceData.ResourceCount = resourceCount\n\t\tsummary[resourceName] = newResourceData\n\n\t}\n\n\treturn summary, nil\n\n}", "title": "" }, { "docid": "146a4ef286aabe9ff16b004a0b2c930e", "score": "0.43889", "text": "func (a *ApiApiService) ListTaskprioritysExecute(r ApiListTaskprioritysRequest) ([]Taskpriority, *_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 []Taskpriority\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApiApiService.ListTaskprioritys\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/taskpriority/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\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": "7405a336f595ebb0fff70daf3e77a596", "score": "0.43830833", "text": "func (f *FUOTADeploymentAPI) List(ctx context.Context, req *pb.ListFUOTADeploymentRequest) (*pb.ListFUOTADeploymentResponse, error) {\n\tvar err error\n\tvar idFilter bool\n\n\tfilters := storage.FUOTADeploymentFilters{\n\t\tLimit: int(req.Limit),\n\t\tOffset: int(req.Offset),\n\t}\n\n\tif req.ApplicationId != 0 {\n\t\tidFilter = true\n\t\tfilters.ApplicationID = req.ApplicationId\n\n\t\t// validate that the client has access to the given application\n\t\tif err := f.validator.Validate(ctx,\n\t\t\tauth.ValidateApplicationAccess(req.ApplicationId, auth.Read),\n\t\t); err != nil {\n\t\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t\t}\n\t}\n\n\tif req.DevEui != \"\" {\n\t\tidFilter = true\n\t\tif err := filters.DevEUI.UnmarshalText([]byte(req.DevEui)); err != nil {\n\t\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"dev_eui: %s\", err)\n\t\t}\n\n\t\t// validate that the client has access to the given devEUI\n\t\tif err := f.validator.Validate(ctx,\n\t\t\tauth.ValidateNodeAccess(filters.DevEUI, auth.Read),\n\t\t); err != nil {\n\t\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t\t}\n\t}\n\n\tif !idFilter {\n\t\tuser, err := f.validator.GetUser(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, helpers.ErrToRPCError(err)\n\t\t}\n\n\t\tif !user.IsAdmin {\n\t\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"client must be global admin for unfiltered request\")\n\t\t}\n\t}\n\n\tcount, err := storage.GetFUOTADeploymentCount(ctx, storage.DB(), filters)\n\tif err != nil {\n\t\treturn nil, helpers.ErrToRPCError(err)\n\t}\n\n\tdeployments, err := storage.GetFUOTADeployments(ctx, storage.DB(), filters)\n\tif err != nil {\n\t\treturn nil, helpers.ErrToRPCError(err)\n\t}\n\n\treturn f.returnList(count, deployments)\n}", "title": "" }, { "docid": "e5a2b0fec8a2269928e186d09c0371ad", "score": "0.4376955", "text": "func (c *Client) FlowsList() (*FlowsList, error) {\n\tres, err := c.req(\"GET\", \"/flows\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlist := new(FlowsList)\n\terr = json.Unmarshal(res, list)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn list, nil\n}", "title": "" }, { "docid": "fe0e02f4b5026362fc750bc91ca93344", "score": "0.43690053", "text": "func (a *ErrataApiService) ListErrataExecute(r ApiListErrataRequest) (*MyErrataListMock, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *MyErrataListMock\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ErrataApiService.ListErrata\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/errata\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.limit != nil {\n\t\tparameterAddToHeaderOrQuery(localVarQueryParams, \"limit\", r.limit, \"\")\n\t}\n\tif r.offset != nil {\n\t\tparameterAddToHeaderOrQuery(localVarQueryParams, \"offset\", r.offset, \"\")\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"Bearer\"]; 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, formFiles)\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 := io.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = io.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 == 400 {\n\t\t\tvar v ListAllocations400Response\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ListAllocations400Response\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v ListAllocations400Response\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ListAllocations400Response\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ListAllocations400Response\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\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": "0fdcf8ccc4bbc4e99eda3e7314cacac8", "score": "0.43678418", "text": "func (a *ApiApiService) ListReasonsExecute(r ApiListReasonsRequest) ([]Reason, *_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 []Reason\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApiApiService.ListReasons\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/reason/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\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": "52e364d164d8774e7b16d032263e9b25", "score": "0.43630266", "text": "func (m *MockedVM) ExecuteTransaction(transaction utxo.Transaction, inputs *utxo.Outputs, _ ...uint64) (outputs []utxo.Output, err error) {\n\tmockedTransaction := transaction.(*MockedTransaction)\n\n\toutputs = make([]utxo.Output, mockedTransaction.M.OutputCount)\n\tfor i := uint16(0); i < mockedTransaction.M.OutputCount; i++ {\n\t\toutputs[i] = NewMockedOutput(mockedTransaction.ID(), i, uint64(i))\n\t\toutputs[i].SetID(utxo.NewOutputID(mockedTransaction.ID(), i))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d9d5c5369ca8f71549da995b8ace5198", "score": "0.4356741", "text": "func (s ListQueryExecutionsInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "50161c92eafb7283f2583f9bef76ed8c", "score": "0.43564177", "text": "func (a *ApiApiService) ListRecommendationsExecute(r ApiListRecommendationsRequest) ([]Recommendation, *_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 []Recommendation\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApiApiService.ListRecommendations\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/recommendation/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\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": "19c92b9d05f86be8883a854cbc3de5cd", "score": "0.43554845", "text": "func newExecutionGraph(workflowConfig *model.Configuration, actionNames ...string) [][]string {\n\t// first, build a list of all the necessary actions to run, and their dependencies\n\tactionDependencies := make(map[string][]string)\n\tfor len(actionNames) > 0 {\n\t\tnewActionNames := make([]string, 0)\n\t\tfor _, aName := range actionNames {\n\t\t\t// make sure we haven't visited this action yet\n\t\t\tif _, ok := actionDependencies[aName]; !ok {\n\t\t\t\taction := workflowConfig.GetAction(aName)\n\t\t\t\tif action != nil {\n\t\t\t\t\tactionDependencies[aName] = action.Needs\n\t\t\t\t\tnewActionNames = append(newActionNames, action.Needs...)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tactionNames = newActionNames\n\t}\n\n\t// next, build an execution graph\n\tgraph := make([][]string, 0)\n\tfor len(actionDependencies) > 0 {\n\t\tstage := make([]string, 0)\n\t\tfor aName, aDeps := range actionDependencies {\n\t\t\t// make sure all deps are in the graph already\n\t\t\tif listInLists(aDeps, graph...) {\n\t\t\t\tstage = append(stage, aName)\n\t\t\t\tdelete(actionDependencies, aName)\n\t\t\t}\n\t\t}\n\t\tif len(stage) == 0 {\n\t\t\tlog.Fatalf(\"Unable to build dependency graph!\")\n\t\t}\n\t\tgraph = append(graph, stage)\n\t}\n\n\treturn graph\n}", "title": "" }, { "docid": "d22e4b6d3c5c2dc37aaf4ddfbf2947af", "score": "0.4355042", "text": "func (r *ProjectsLocationsTensorboardsExperimentsRunsTimeSeriesOperationsService) List(name string) *ProjectsLocationsTensorboardsExperimentsRunsTimeSeriesOperationsListCall {\n\tc := &ProjectsLocationsTensorboardsExperimentsRunsTimeSeriesOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "title": "" }, { "docid": "4de55c0419283ba0e1033dd8bafa83ad", "score": "0.4354999", "text": "func (s ListWorkflowStepExecutionsInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "161c8a82fe60f5cb5861fb594268dff0", "score": "0.43525916", "text": "func (biz *BizAction) List(ctx context.Context, exe base.Executor,\n\tqry base.ClientQuery, moduleID string,\n) (coremodel.Actions, error) {\n\trecs, err := biz.dal.List(ctx, exe, qry, moduleID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbiz.setRecordActionsActions(ctx, recs)\n\treturn recs, nil\n}", "title": "" }, { "docid": "d32236a800539a9b19b93b964c96313f", "score": "0.43503657", "text": "func (e *historyEngineImpl) DescribeWorkflowExecution(ctx context.Context,\n\trequest *h.DescribeWorkflowExecutionRequest) (retResp *workflow.DescribeWorkflowExecutionResponse, retError error) {\n\tdomainID, err := validateDomainUUID(request.DomainUUID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\texecution := *request.Request.Execution\n\n\tcontext, release, err0 := e.historyCache.getOrCreateWorkflowExecutionWithTimeout(ctx, domainID, execution)\n\tif err0 != nil {\n\t\treturn nil, err0\n\t}\n\tdefer func() { release(retError) }()\n\n\tmsBuilder, err1 := context.loadWorkflowExecution()\n\tif err1 != nil {\n\t\treturn nil, err1\n\t}\n\texecutionInfo := msBuilder.GetExecutionInfo()\n\n\tresult := &workflow.DescribeWorkflowExecutionResponse{\n\t\tExecutionConfiguration: &workflow.WorkflowExecutionConfiguration{\n\t\t\tTaskList: &workflow.TaskList{Name: common.StringPtr(executionInfo.TaskList)},\n\t\t\tExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(executionInfo.WorkflowTimeout),\n\t\t\tTaskStartToCloseTimeoutSeconds: common.Int32Ptr(executionInfo.DecisionTimeoutValue),\n\t\t\tChildPolicy: common.ChildPolicyPtr(workflow.ChildPolicyTerminate),\n\t\t},\n\t\tWorkflowExecutionInfo: &workflow.WorkflowExecutionInfo{\n\t\t\tExecution: &workflow.WorkflowExecution{\n\t\t\t\tWorkflowId: common.StringPtr(executionInfo.WorkflowID),\n\t\t\t\tRunId: common.StringPtr(executionInfo.RunID),\n\t\t\t},\n\t\t\tType: &workflow.WorkflowType{Name: common.StringPtr(executionInfo.WorkflowTypeName)},\n\t\t\tStartTime: common.Int64Ptr(executionInfo.StartTimestamp.UnixNano()),\n\t\t\tHistoryLength: common.Int64Ptr(msBuilder.GetNextEventID() - common.FirstEventID),\n\t\t},\n\t}\n\tif executionInfo.State == persistence.WorkflowStateCompleted {\n\t\t// for closed workflow\n\t\tcloseStatus := getWorkflowExecutionCloseStatus(executionInfo.CloseStatus)\n\t\tresult.WorkflowExecutionInfo.CloseStatus = &closeStatus\n\t\tcompletionEvent, ok := msBuilder.GetCompletionEvent()\n\t\tif !ok {\n\t\t\treturn nil, &workflow.InternalServiceError{Message: \"Unable to get workflow completion event.\"}\n\t\t}\n\t\tresult.WorkflowExecutionInfo.CloseTime = common.Int64Ptr(completionEvent.GetTimestamp())\n\t}\n\n\tif len(msBuilder.GetPendingActivityInfos()) > 0 {\n\t\tfor _, ai := range msBuilder.GetPendingActivityInfos() {\n\t\t\tp := &workflow.PendingActivityInfo{\n\t\t\t\tActivityID: common.StringPtr(ai.ActivityID),\n\t\t\t}\n\t\t\tstate := workflow.PendingActivityStateScheduled\n\t\t\tif ai.CancelRequested {\n\t\t\t\tstate = workflow.PendingActivityStateCancelRequested\n\t\t\t} else if ai.StartedID != common.EmptyEventID {\n\t\t\t\tstate = workflow.PendingActivityStateStarted\n\t\t\t}\n\t\t\tp.State = &state\n\t\t\tlastHeartbeatUnixNano := ai.LastHeartBeatUpdatedTime.UnixNano()\n\t\t\tif lastHeartbeatUnixNano > 0 {\n\t\t\t\tp.LastHeartbeatTimestamp = common.Int64Ptr(lastHeartbeatUnixNano)\n\t\t\t\tp.HeartbeatDetails = ai.Details\n\t\t\t}\n\t\t\t// TODO: move to mutable state instead of loading it from event\n\t\t\tscheduledEvent, ok := msBuilder.GetActivityScheduledEvent(ai.ScheduleID)\n\t\t\tif !ok {\n\t\t\t\treturn nil, &workflow.InternalServiceError{Message: \"Unable to get activity schedule event.\"}\n\t\t\t}\n\t\t\tp.ActivityType = scheduledEvent.ActivityTaskScheduledEventAttributes.ActivityType\n\t\t\tp.LastStartedTimestamp = common.Int64Ptr(ai.StartedTime.UnixNano())\n\t\t\tp.Attempt = common.Int32Ptr(ai.Attempt)\n\t\t\tresult.PendingActivities = append(result.PendingActivities, p)\n\t\t}\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "e9512706147ddf05018bc5d9863d94b8", "score": "0.4343451", "text": "func (t *TaskService) List(workspaceID string, projectID string, filter *TaskListFilter) (*[]Task, error) {\n\tpath := fmt.Sprintf(\"workspaces/%s/projects/%s/tasks\", workspaceID, projectID)\n\treq, err := t.client.newAPIRequest(\"GET\", path, filter.ToQuery(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar tasks []Task\n\t_, err = t.client.do(req, &tasks)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &tasks, nil\n}", "title": "" } ]
8c37b2b6e935e7ba11c7af94b311aaec
Creates the frontend service, following the Hello World specification: always on port 8080, named helloworldfrontend, using http, checking whether it works and responding taking the 'allowed' configuration into consideration.
[ { "docid": "d1ff985b077c59e8bbc5e1f8e16ab69a", "score": "0.5413015", "text": "func serviceCreateFrontTestScenario(pub *base.ClusterContext, prefix string, allowed bool) (scenario cli.TestScenario) {\n\n\tscenario = cli.TestScenario{\n\n\t\tName: \"service-create-frontend\",\n\t\tTasks: []cli.SkupperTask{\n\t\t\t{\n\t\t\t\tCtx: pub, Commands: []cli.SkupperCommandTester{\n\t\t\t\t\t// skupper service create - creates the frontend service and verify\n\t\t\t\t\t&service.CreateTester{\n\t\t\t\t\t\tName: \"hello-world-frontend\",\n\t\t\t\t\t\tPort: 8080,\n\t\t\t\t\t\tMapping: \"http\",\n\t\t\t\t\t\tPolicyProhibits: !allowed,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "5bb6f21c50cae161f3897d56b29cfdf4", "score": "0.62905765", "text": "func HelloworldRestAPIWebserver(pNum uint) {\n\thttp.HandleFunc(\"/api/v1/helloworld\", HelloworldRestAPIHandler)\n\n\thttp.ListenAndServe(\":\"+fmt.Sprint(pNum), nil)\n}", "title": "" }, { "docid": "7e01e544741b0ed113aa7725f3edc33d", "score": "0.6182477", "text": "func main() {\n\n\tflag.BoolVar(&bLocalDev, \"local\", false, \"If Present Uses localhost instead of service names\")\n\tflag.Parse()\n\tif bLocalDev {\n\t\tapi = \"localhost\"\n\t\twebfront = \"localhost\"\n\t}\n\thttp.HandleFunc(\"/api\", apiHandler)\n\thttp.HandleFunc(\"/api/\", apiHandler)\n\thttp.HandleFunc(\"/\", webpageHandler)\n\tlog.Fatal(http.ListenAndServe(\":8000\", nil))\n\n}", "title": "" }, { "docid": "20af08aefb3be5995103e4c3e0187eb1", "score": "0.61035556", "text": "func NewFrontend(services be.ActionController, port int, timeout time.Duration) *http.Server {\n\trouter := httprouter.New()\n\n\t// middleware which only tags requests for GET\n\ttag := func(h httprouter.Handle) httprouter.Handle {\n\t\treturn WithTag(h)\n\t}\n\n\t// middleware which tags requests and performs HMAC authorization\n\tmw := func(h httprouter.Handle) httprouter.Handle {\n\t\treturn WithTag(WithAuthz(services, h))\n\t}\n\n\t// middleware with tagging and admin authorization\n\tamw := func(h httprouter.Handle) httprouter.Handle {\n\t\treturn WithTag(WithAdminAuthz(services, h))\n\t}\n\n\t// Regular routes\n\n\t// Root handler\n\trouter.GET(APIRoot, tag(NewRootHandler()))\n\n\t// Repositories\n\trouter.GET(APIRoot+\"/repos\", tag(MakeReposHandler(services)))\n\trouter.GET(APIRoot+\"/repos/:name\", tag(MakeReposHandler(services)))\n\n\t// Leases\n\trouter.GET(APIRoot+\"/leases\", tag(MakeLeasesHandler(services)))\n\trouter.GET(APIRoot+\"/leases/:token\", tag(MakeLeasesHandler(services)))\n\trouter.POST(APIRoot+\"/leases\", mw(MakeLeasesHandler(services)))\n\trouter.POST(APIRoot+\"/leases/:token\", mw(MakeLeasesHandler(services)))\n\trouter.DELETE(APIRoot+\"/leases/:token\", mw(MakeLeasesHandler(services)))\n\n\t// Payloads (legacy endpoint)\n\trouter.POST(APIRoot+\"/payloads\", mw(MakePayloadsHandler(services)))\n\t// Payloads (new and improved)\n\trouter.POST(APIRoot+\"/payloads/:token\", mw(MakePayloadsHandler(services)))\n\n\t// Notification system endpoints\n\trouter.POST(APIRoot+\"/notifications/publish\", tag(MakeNotificationsHandler(services)))\n\trouter.GET(APIRoot+\"/notifications/subscribe\", tag(MakeNotificationsHandler(services)))\n\n\t// Admin routes\n\trouter.POST(APIRoot+\"/repos/:name\", amw(MakeAdminReposHandler(services)))\n\trouter.DELETE(APIRoot+\"/leases-by-path/*path\", amw(MakeAdminLeasesHandler(services)))\n\trouter.POST(APIRoot+\"/gc\", amw(MakeGCHandler(services)))\n\n\t// Configure and start the HTTP server\n\tsrv := &http.Server{\n\t\tHandler: router,\n\t\tAddr: fmt.Sprintf(\":%d\", port),\n\t\tWriteTimeout: timeout,\n\t\tReadTimeout: timeout,\n\t}\n\n\treturn srv\n}", "title": "" }, { "docid": "7bfec522e0bcbac4d720de7360e31607", "score": "0.6085987", "text": "func createFrontendService(frontend *crd.Frontend, cache *resCache.ObjectCache) error {\n\t// Create empty service\n\ts := &v1.Service{}\n\n\t// Define name of resource\n\tnn := types.NamespacedName{\n\t\tName: frontend.Name,\n\t\tNamespace: frontend.Namespace,\n\t}\n\n\t// Create object in cache (will populate cache if exists)\n\tif err := cache.Create(CoreService, nn, s); err != nil {\n\t\treturn err\n\t}\n\n\tservicePorts := []v1.ServicePort{}\n\n\tappProtocol := \"http\"\n\n\tlabels := make(map[string]string)\n\tlabels[\"frontend\"] = frontend.Name\n\tlabeler := utils.GetCustomLabeler(labels, nn, frontend)\n\tlabeler(s)\n\t// We should also set owner reference to the pod\n\n\tport := v1.ServicePort{\n\t\tName: \"public\",\n\t\tPort: 8000,\n\t\tTargetPort: intstr.FromInt(8000),\n\t\tProtocol: \"TCP\",\n\t\tAppProtocol: &appProtocol,\n\t}\n\n\tservicePorts = append(servicePorts, port)\n\ts.Spec.Selector = labels\n\n\tutils.MakeService(s, nn, labels, servicePorts, frontend, false)\n\n\t// Inform the cache that our updates are complete\n\tif err := cache.Update(CoreService, s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fba6657ffa4db890466d0ea9472ef630", "score": "0.60442644", "text": "func NewFrontend(ctx context.Context, baseLog *logrus.Entry, env env.Interface, db *database.Database) (Runnable, error) {\n\tvar err error\n\n\tf := &frontend{\n\t\tbaseLog: baseLog,\n\t\tenv: env,\n\t\tdb: db,\n\t}\n\n\tl, err := f.env.Listen()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkey, certs, err := f.env.GetSecret(ctx, \"rp-server\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconfig := &tls.Config{\n\t\tCertificates: []tls.Certificate{\n\t\t\t{\n\t\t\t\tPrivateKey: key,\n\t\t\t},\n\t\t},\n\t\tNextProtos: []string{\"h2\", \"http/1.1\"},\n\t\tClientAuth: tls.RequestClientCert,\n\t\tCipherSuites: []uint16{\n\t\t\ttls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,\n\t\t},\n\t\tPreferServerCipherSuites: true,\n\t\tSessionTicketsDisabled: true,\n\t\tMinVersion: tls.VersionTLS12,\n\t\tCurvePreferences: []tls.CurveID{\n\t\t\ttls.CurveP256,\n\t\t\ttls.X25519,\n\t\t},\n\t}\n\n\tfor _, cert := range certs {\n\t\tconfig.Certificates[0].Certificate = append(config.Certificates[0].Certificate, cert.Raw)\n\t}\n\n\tf.l = tls.NewListener(l, config)\n\n\tf.ready.Store(true)\n\n\treturn f, nil\n}", "title": "" }, { "docid": "6f3ff57480140f5dc732d34abaa31b40", "score": "0.5970925", "text": "func (f *Frontend) Start(args ...string) error {\n\tal:=len(args)\n\n\tif (al > 0) {\n\t\tf.addr = args[0]\n\t}\n\n\tif (al > 1) {\n\t\tf.context = args[1]\n\t}\n\n\t// Setup gotojs engine handler.\n\tf.mux.Handle(f.context + \"/\",f)\n\n\t//final http handler\n\tvar handler http.Handler\n\tif f.flags & F_ENABLE_ACCESSLOG > 0{\n\t\thandler = NewLogWraper(f.mux)\n\t} else {\n\t\thandler = f.mux\n\t}\n\n\tf.httpd = &http.Server{\n\t\tAddr:\t\tf.addr,\n\t\tHandler:\thandler,\n\t\tReadTimeout:\t5 * time.Second,\n\t\tWriteTimeout:\t10 * time.Second,\n\t\tMaxHeaderBytes: 1 << 20,\n\t}\n\n\tlog.Printf(\"Starting server at \\\"%s\\\".\",f.addr)\n\treturn f.httpd.ListenAndServe()\n}", "title": "" }, { "docid": "05cb03e30dc72b89d001c1e973aaa370", "score": "0.5950005", "text": "func initHTTPServer() {\n\tlog.Println(\"Starting pack service\")\n\tport := viper.GetString(\"service.app.port\")\n\tlog.Println(\"Starting application on \", port)\n\tcontroller.StartWebServer(port)\n}", "title": "" }, { "docid": "92c57752ed1a812aef2733e968a9c882", "score": "0.59426373", "text": "func main() {\n a := App{}\n a.Start(\":8080\") // start application server on port 8080\n}", "title": "" }, { "docid": "0fbb49f8ed1a9b29afac643bf62eaf9c", "score": "0.5939377", "text": "func main() {\n\t// Set the port.\n\tport := 8080\n\n\t// Register the services and load the routes.\n\thttp.Handle(\"/\", boot.RegisterServices(\"html\").LoadRoutes())\n\n\t// Display message on the server.\n\tlog.Printf(\"webapp started on port %v\\n\", port)\n\n\t// Run the web listener.\n\tlog.Fatal(http.ListenAndServe(fmt.Sprintf(\":%v\", port), nil))\n}", "title": "" }, { "docid": "4640b2045bcdee7093e6a61f98269780", "score": "0.5923045", "text": "func main(){\n http.HandleFunc(\"/\", handler)\n http.ListenAndServe(\":8000\", nil)\n}", "title": "" }, { "docid": "7d5b3408d82cd250fc9bd01ce78ce2f0", "score": "0.5908502", "text": "func main() {\n\thttp.HandleFunc(\"/\", myHandleFunc)\n\tlog.Fatalln(http.ListenAndServe(\":8080\", nil))\n\t//http.ListenAndServe(\":8080\", nil)\n\n}", "title": "" }, { "docid": "070596cdce18a3141397ed03821faeb2", "score": "0.590655", "text": "func (ptr *Node) startHTTP(endpoint string, apis []rpcPtr.apiPtr, modules []string, cors []string) error {\n\t\n\n\t// Short circuit if the HTTP endpoint isn't being exposed\n\tif endpoint == \"\" {\n\t\treturn nil\n\t}\n\t// Generate the whitelist based on the allowed modules\n\twhitelist := make(map[string]bool)\n\tfor _, module := range modules {\n\t\twhitelist[module] = true\n\t}\n\t// Register all the APIs exposed by the services\n\tstr2 := fmt.Sprintf(\"%-d\", len(apis))\n\tbgmlogs.Info(\"startHTTP new rpc server !!\" + str2);\n\thandler := rpcPtr.NewServer()\n\tfor _, apiPtr := range apis {\n\t\tif whitelist[apiPtr.Namespace] || (len(whitelist) == 0 && apiPtr.Public) {\n\t\t\tbgmlogs.Info(\"apiPtr.Namespace:\"+apiPtr.Namespace)\n\t\t\tif err := handler.RegisterName(apiPtr.Namespace, apiPtr.Service); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbgmlogs.Debug(fmt.Sprintf(\"HTTP registered %T under '%-s'\", apiPtr.Service, apiPtr.Namespace))\n\t\t}\n\t}\n\t// All APIs registered, start the HTTP listener\n\tvar (\n\t\tlistener net.Listener\n\t\terr error\n\t)\n\tif listener, err = net.Listen(\"tcp\", endpoint); err != nil {\n\t\treturn err\n\t}\n\tgo rpcPtr.NewHTTPServer(cors, handler).Serve(listener)\n\tbgmlogs.Info(fmt.Sprintf(\"HTTP endpoint opened: http://%-s\", endpoint))\n\n\t// All listeners booted successfully\n\tptr.httpEndpoint = endpoint\n\tptr.httpListener = listener\n\tptr.httpHandler = handler\n\n\treturn nil\n}", "title": "" }, { "docid": "91bf4d8a6ceba85bad40d200165de6a5", "score": "0.5878188", "text": "func mainServeHTTP(proto, bindHTTP string, anyHostPorts map[string]bool) {\n\tif bindHTTP[0] == ':' && proto == \"http\" {\n\t\tbindHTTP = \"localhost\" + bindHTTP\n\t}\n\n\tbar := \"main: ------------------------------------------------------\"\n\n\tif anyHostPorts != nil && len(bindHTTP) > 0 {\n\t\t// If we've already bound to 0.0.0.0 or [::] on the same port, then\n\t\t// skip this hostPort.\n\t\tportIndex := strings.LastIndex(bindHTTP, \":\") + 1\n\t\tif portIndex > 0 && portIndex < len(bindHTTP) {\n\t\t\t// Possibly valid port available.\n\t\t\tport := bindHTTP[portIndex:]\n\t\t\tif _, err := strconv.Atoi(port); err == nil {\n\t\t\t\t// Valid port.\n\t\t\t\thost := \"0.0.0.0\"\n\t\t\t\tif net.ParseIP(bindHTTP[:portIndex-1]).To4() == nil && // Not an IPv4\n\t\t\t\t\tipv6 == \"true\" {\n\t\t\t\t\thost = \"[::]\"\n\t\t\t\t}\n\n\t\t\t\tanyHostPort := host + \":\" + port\n\t\t\t\tif anyHostPorts[anyHostPort] {\n\t\t\t\t\tif anyHostPort != bindHTTP {\n\t\t\t\t\t\tlog.Printf(bar)\n\t\t\t\t\t\tlog.Printf(\"init_http: web UI / REST API is available\"+\n\t\t\t\t\t\t\t\" (via %v): %s://%s\", host, proto, bindHTTP)\n\t\t\t\t\t\tlog.Printf(bar)\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t} // Else port not found.\n\t}\n\n\tlog.Printf(bar)\n\tlog.Printf(\"init_http: web UI / REST API is available: %s://%s\", proto, bindHTTP)\n\tlog.Printf(bar)\n\n\tnwps := getNetworkProtocols()\n\tfor p, nwp := range nwps {\n\t\tlistener, err := getListener(bindHTTP, nwp)\n\t\tif listener == nil && err == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif err != nil {\n\t\t\tif p == 0 {\n\t\t\t\t// Fail the service as the listen failed on the primary protocol.\n\t\t\t\t// If ipv6=true,\n\t\t\t\t//\t-start listening to ipv6 - fail service if listen fails\n\t\t\t\t//\t-try to listen to ipv4 - don't fail service even if listen fails.\n\t\t\t\t// If ipv6=false,\n\t\t\t\t//\t-start listening to ipv4 - fail service if listen fails\n\t\t\t\t//\t-try to listen to ipv6 - don't fail service even if listen fails.\n\t\t\t\tlog.Fatalf(\"init_http: listen, err: %v\", err)\n\t\t\t}\n\t\t\tlog.Errorf(\"init_http: listen, err: %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tserver := &http.Server{Addr: bindHTTP,\n\t\t\tHandler: routerInUse,\n\t\t\tReadTimeout: httpReadTimeout,\n\t\t\tReadHeaderTimeout: httpReadHeaderTimeout,\n\t\t\tWriteTimeout: httpWriteTimeout,\n\t\t\tIdleTimeout: httpIdleTimeout,\n\t\t\tConnContext: func(ctx context.Context, conn net.Conn) context.Context {\n\t\t\t\treturn context.WithValue(ctx, \"conn\", conn)\n\t\t\t},\n\t\t}\n\n\t\tif proto == \"http\" {\n\t\t\tlimitListener := netutil.LimitListener(listener, httpMaxConnections)\n\t\t\tgo func(nwp string, listener net.Listener) {\n\t\t\t\tlog.Printf(\"init_http: Setting up a http limit listener at %q,\"+\n\t\t\t\t\t\" proto: %q\", bindHTTP, nwp)\n\t\t\t\tatomic.AddUint64(&cbft.TotHTTPLimitListenersOpened, 1)\n\t\t\t\terr = server.Serve(limitListener)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"init_http: Serve, err: %v;\\n\"+\n\t\t\t\t\t\t\" Please check that your -bindHttp parameter (%q)\\n\"+\n\t\t\t\t\t\t\" is correct and available.\", err, bindHTTP)\n\t\t\t\t}\n\t\t\t\tatomic.AddUint64(&cbft.TotHTTPLimitListenersClosed, 1)\n\t\t\t}(nwp, limitListener)\n\t\t} else {\n\t\t\taddToHTTPSServerList(server)\n\t\t\t// Initialize server.TLSConfig to the listener's TLS Config before calling\n\t\t\t// server for HTTP/2 support.\n\t\t\t// See: https://golang.org/pkg/net/http/#Server.Serve\n\t\t\tconfig := cloneTLSConfig(server.TLSConfig)\n\t\t\tif !strSliceContains(config.NextProtos, \"http/1.1\") {\n\t\t\t\tconfig.NextProtos = append(config.NextProtos, \"http/1.1\")\n\t\t\t}\n\t\t\tif !strSliceContains(config.NextProtos, \"h2\") {\n\t\t\t\tconfig.NextProtos = append(config.NextProtos, \"h2\")\n\t\t\t}\n\n\t\t\tconfig.Certificates = make([]tls.Certificate, 1)\n\t\t\tconfig.Certificates[0], err = tls.LoadX509KeyPair(\n\t\t\t\tcbgt.TLSCertFile, cbgt.TLSKeyFile)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"init_http: LoadX509KeyPair, err: %v\", err)\n\t\t\t}\n\n\t\t\tif authType == \"cbauth\" {\n\t\t\t\tss := cbgt.GetSecuritySetting()\n\t\t\t\tif ss != nil && ss.TLSConfig != nil {\n\t\t\t\t\t// Set MinTLSVersion and CipherSuites to what is provided by\n\t\t\t\t\t// cbauth if authType were cbauth (cached locally).\n\t\t\t\t\tconfig.MinVersion = ss.TLSConfig.MinVersion\n\t\t\t\t\tconfig.CipherSuites = ss.TLSConfig.CipherSuites\n\t\t\t\t\tconfig.PreferServerCipherSuites = ss.TLSConfig.PreferServerCipherSuites\n\n\t\t\t\t\tif ss.ClientAuthType != nil && *ss.ClientAuthType != tls.NoClientCert {\n\t\t\t\t\t\tcaCertPool := x509.NewCertPool()\n\t\t\t\t\t\tvar certBytes []byte\n\t\t\t\t\t\tif len(ss.CertInBytes) != 0 {\n\t\t\t\t\t\t\tcertBytes = ss.CertInBytes\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// if no CertInBytes found in settings, then fallback\n\t\t\t\t\t\t\t// to reading directly from file. Upon any certs change\n\t\t\t\t\t\t\t// callbacks later, reboot of servers will ensure the\n\t\t\t\t\t\t\t// latest certificates in the servers.\n\t\t\t\t\t\t\tcertBytes, err = ioutil.ReadFile(cbgt.TLSCertFile)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\tlog.Fatalf(\"init_http: ReadFile of cacert, err: %v\", err)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tok := caCertPool.AppendCertsFromPEM(certBytes)\n\t\t\t\t\t\tif !ok {\n\t\t\t\t\t\t\tlog.Fatalf(\"init_http: error in appending certificates\")\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconfig.ClientCAs = caCertPool\n\t\t\t\t\t\tconfig.ClientAuth = *ss.ClientAuthType\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconfig.ClientAuth = tls.NoClientCert\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconfig.ClientAuth = tls.NoClientCert\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tkeepAliveListener := tcpKeepAliveListener{listener.(*net.TCPListener)}\n\t\t\tlimitListener := netutil.LimitListener(keepAliveListener, httpMaxConnections)\n\t\t\ttlsListener := tls.NewListener(limitListener, config)\n\t\t\tgo func(nwp string, tlsListener net.Listener) {\n\t\t\t\tlog.Printf(\"init_http: Setting up a https limit listener at %q,\"+\n\t\t\t\t\t\" proto: %q\", bindHTTP, nwp)\n\t\t\t\tatomic.AddUint64(&cbft.TotHTTPSLimitListenersOpened, 1)\n\t\t\t\terr = server.Serve(tlsListener)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"init_http: Serve, err: %v;\"+\n\t\t\t\t\t\t\" HTTPS listeners closed, likely to be re-initialized, \"+\n\t\t\t\t\t\t\" -bindHttp(s) (%q) on nwp: %s\\n\", err, bindHTTP, nwp)\n\t\t\t\t}\n\t\t\t\tatomic.AddUint64(&cbft.TotHTTPSLimitListenersClosed, 1)\n\t\t\t}(nwp, tlsListener)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "77f9772479d2b88dd7cc64e8aa0a8778", "score": "0.58514965", "text": "func main() {\n service.CreateAndRun(3000)\n}", "title": "" }, { "docid": "efcca4b4b3bad6c178682c2b31da28ad", "score": "0.5781282", "text": "func main() {\n\n\t//Set flags\n\tportNumPtr := flag.Int(\"listen\", 8080, \"The port number the server will listen at\")\n\tbackendPtr := flag.String(\"backend\", \"localhost:8090\", \"The address of the backend server\")\n\tflag.Parse()\n\n\t//Parse any command-line arguments\n\tport := *portNumPtr\n\tbackend = *backendPtr\n\n\t//Initialize the server\n\tapp := iris.New()\n\tapp.Use(recover.New())\n\tapp.Use(logger.New())\n\n\t//Set up handle\n\tapp.Handle(\"GET\", \"/\", handleHome)\n\tapp.Get(\"/edit\", handleEdit)\n\tapp.Get(\"/edit_form\", handleEditForm)\n\tapp.Get(\"/create\", handleCreate)\n\tapp.Get(\"/create_form\", handleCreateForm)\n\tapp.Get(\"/delete\", handleDelete)\n\n\tgo ping()\n\n\t//Run the server\n\tapp.Run(iris.Addr(\":\" + strconv.Itoa(port)))\n}", "title": "" }, { "docid": "878e70d8442ffdf8ea18296e61f66d24", "score": "0.5776609", "text": "func NewFrontend(logic frontend.TrackerLogic, provided Config) (*Frontend, error) {\n\tcfg := provided.Validate()\n\n\tf := &Frontend{\n\t\tlogic: logic,\n\t\tConfig: cfg,\n\t}\n\n\tif cfg.Addr == \"\" && cfg.HTTPSAddr == \"\" {\n\t\treturn nil, errors.New(\"must specify addr or https_addr or both\")\n\t}\n\n\tif len(cfg.AnnounceRoutes) < 1 || len(cfg.ScrapeRoutes) < 1 {\n\t\treturn nil, errors.New(\"must specify routes\")\n\t}\n\n\t// If TLS is enabled, create a key pair.\n\tif cfg.TLSCertPath != \"\" && cfg.TLSKeyPath != \"\" {\n\t\tvar err error\n\t\tf.tlsCfg = &tls.Config{\n\t\t\tMinVersion: tls.VersionTLS12,\n\t\t\tCertificates: make([]tls.Certificate, 1),\n\t\t}\n\t\tf.tlsCfg.Certificates[0], err = tls.LoadX509KeyPair(cfg.TLSCertPath, cfg.TLSKeyPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif cfg.HTTPSAddr != \"\" && f.tlsCfg == nil {\n\t\treturn nil, errors.New(\"must specify tls_cert_path and tls_key_path when using https_addr\")\n\t}\n\tif cfg.HTTPSAddr == \"\" && f.tlsCfg != nil {\n\t\treturn nil, errors.New(\"must specify https_addr when using tls_cert_path and tls_key_path\")\n\t}\n\n\tvar listenerHTTP, listenerHTTPS net.Listener\n\tvar err error\n\tif cfg.Addr != \"\" {\n\t\tlistenerHTTP, err = net.Listen(\"tcp\", f.Addr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif cfg.HTTPSAddr != \"\" {\n\t\tlistenerHTTPS, err = net.Listen(\"tcp\", f.HTTPSAddr)\n\t\tif err != nil {\n\t\t\tif listenerHTTP != nil {\n\t\t\t\tlistenerHTTP.Close()\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif cfg.Addr != \"\" {\n\t\tgo func() {\n\t\t\tif err := f.serveHTTP(listenerHTTP); err != nil {\n\t\t\t\tlog.Fatal(\"failed while serving http\", log.Err(err))\n\t\t\t}\n\t\t}()\n\t}\n\n\tif cfg.HTTPSAddr != \"\" {\n\t\tgo func() {\n\t\t\tif err := f.serveHTTPS(listenerHTTPS); err != nil {\n\t\t\t\tlog.Fatal(\"failed while serving https\", log.Err(err))\n\t\t\t}\n\t\t}()\n\t}\n\n\treturn f, nil\n}", "title": "" }, { "docid": "4055d97e4b27b997f883c3dbf267374c", "score": "0.5772121", "text": "func main() {\n\thttp.ListenAndServe(\":5000\", http.HandlerFunc(MyGreeterHandle))\n}", "title": "" }, { "docid": "158cffd0f9915f99c0ad7304d285fa88", "score": "0.57633185", "text": "func main() {\n\tif (len(os.Args) == 2){\n\t\tfmt.Println(\"Routing Requests to \"+os.Args[1])\n\t\tstaticService = &ServiceConfig{ServiceTargetEndpoint: os.Args[1]}\n\t}else {\n\t\tcfgStr := \"config.gcfg\"\n\t\terr := gcfg.ReadFileInto(&config, cfgStr)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to parse gcfg data: %s\", err)\n\t\t}\n\t}\n\trouter := mux.NewRouter()\n\torigin, _ := url.Parse(\"\")\n\treverseProxy := appProxy(origin)\n\treverseProxy.Transport = &proxyTransport{} // Custom transport is needed for purpose like logging the response, measuring the latency etc\n\trouter.PathPrefix(\"/\").Handler(reverseProxy);\n\terror := http.ListenAndServe(appEndPoint, router)\n\tlog.Println(error)\n}", "title": "" }, { "docid": "451be618a0a1405b572b2eac8a39ab5d", "score": "0.5742038", "text": "func (service *Service) ServeHttp(address, clientDir string) {\n\tif address == \"\" {\n\t\taddress = DefaultWebAddress\n\t}\n\tservice.WebAddress = address\n\tservice.WebClientPath = clientDir\n\tfmt.Printf(\"Web server listening at %s ...\\n\", address)\n\n\tsrc := &http.Server{\n\t\tAddr: address,\n\t\tReadTimeout: 1 * time.Hour,\n\t}\n\n\t// Handle Level 2 REST API.\n\tif GzipAPI {\n\t\tfmt.Println(\"HTTP server will return gzip values if permitted by browser.\")\n\t\thttp.HandleFunc(WebAPIPath, logHttpPanics(makeGzipHandler(apiHandler)))\n\t} else {\n\t\thttp.HandleFunc(WebAPIPath, logHttpPanics(apiHandler))\n\t}\n\n\t// Handle static files through serving embedded files\n\t// via nrsc or loading files from a specified web client directory.\n\tif clientDir == \"\" {\n\t\terr := nrsc.Handle(ConsolePath)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"ERROR with nrsc trying to serve web pages:\", err.Error())\n\t\t\tfmt.Println(webClientUnavailableMessage)\n\t\t\tfmt.Println(\"HTTP server will be started without webclient...\\n\")\n\t\t\thttp.HandleFunc(ConsolePath, logHttpPanics(mainHandler))\n\t\t} else {\n\t\t\tfmt.Println(\"Serving web client from embedded files...\")\n\t\t}\n\t} else {\n\t\thttp.HandleFunc(ConsolePath, logHttpPanics(mainHandler))\n\t\tdvid.Log(dvid.Debug, \"Serving web pages from %s\\n\", clientDir)\n\t}\n\n\t// Manage redirection from / to the ConsolePath.\n\thttp.HandleFunc(\"/\", logHttpPanics(func(w http.ResponseWriter, r *http.Request) {\n\t\tvar urlStr string\n\t\tif r.URL.Path == \"/\" {\n\t\t\turlStr = ConsolePath + \"index.html\"\n\t\t} else {\n\t\t\turlStr = ConsolePath + strings.TrimLeft(r.URL.Path, \"/\")\n\t\t}\n\t\tdvid.Log(dvid.Debug, \"REDIRECT %s -> %s\\n\", r.URL.Path, urlStr)\n\t\thttp.Redirect(w, r, urlStr, http.StatusMovedPermanently)\n\t}))\n\n\t// Serve it up!\n\tsrc.ListenAndServe()\n}", "title": "" }, { "docid": "e16748d7dcdf51f048201296fa7bd5c6", "score": "0.57398826", "text": "func main() {\n\tport := os.Getenv(\"PORT\")\n\tif port == \"\" {\n\t\tport = \"8080\"\n\t}\n\n\tenvConfig := common.LoadEnvironmentVariables()\n\tregisterHandlers(envConfig)\n\n\tlog.Fatal(http.ListenAndServe(fmt.Sprintf(\":%s\", port), nil))\n}", "title": "" }, { "docid": "c91938ec001f4c442b61cd4cfd653414", "score": "0.5732274", "text": "func main() {\n\tdata := NewData()\n\tlog.Print(\"Data created\")\n\n\tgo func() {\n\t\tlog.Printf(\"Pure REST server started on port %s\", PortRest)\n\t\tlog.Fatal(StartPureRestServer(data, PortRest))\n\t}()\n\n\tgo func() {\n\t\tlog.Printf(\"gRPC server started on port %s\", PortRpc)\n\t\tlog.Fatal(ServeRPC(data, PortRpc))\n\t}()\n\n\tlog.Printf(\"Proxy REST server started on port %s\", PortRestProxy)\n\tlog.Fatal(StartRestProxy(PortRestProxy))\n}", "title": "" }, { "docid": "07aaa8da98a334277a088d7672a7d1f7", "score": "0.57316", "text": "func CreateHTTPServer(svc service.MentionService) (*httprouter.Router, error) {\n\n\trouter := httprouter.New()\n\trouter.GET(\"/find/:name\", createFindHandler(svc))\n\trouter.GET(\"/create/:name\", createCreateHandler(svc))\n\trouter.GET(\"/increase/:name\", createIncreaseHandler(svc))\n\n\tlog.Println(\"HTTPServer created...\")\n\treturn router, nil\n}", "title": "" }, { "docid": "0261642a3ba69ff5c2da5d41473437cd", "score": "0.5724301", "text": "func main(){\n\tport := 8080\n\thttp.HandleFunc(\"/helloworld\",helloWorldHandler)\n\tlog.Printf(\"server staring on port %v\\n\",8080)\n\n\t// start the http server\n\t// first paramter port\n\t// second parameter is nil , using DdefaultServeMux\n\t// later\n\t// bind to a port that is already in use on the server\n\t// log.Fatal(err)\n\n\tlog.Fatal(http.ListenAndServe(fmt.Sprintf(\":%v\",port),nil))\n}", "title": "" }, { "docid": "e27cfe2674c09b0ff5b5c1d726663ee5", "score": "0.5722917", "text": "func main() {\n\t// Get the mux router object\n\trouter := router.InitRoutes()\n\tport := 3000\n\tlog.Printf(\"Service Starting on Port : %d ...\", port)\n\tif err := http.ListenAndServe(fmt.Sprintf(\":%d\", port), router); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "89f83bee764f6af552ac73674137413b", "score": "0.5702021", "text": "func (f *httpFrontend) Serve() {\n\t// serve http\n\tfor {\n\t\terr := http.ListenAndServe(f.addr, f.httpmux)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"failed to listen and serve with frontend: %s\", err)\n\t\t}\n\t\ttime.Sleep(time.Second)\n\t}\n}", "title": "" }, { "docid": "1f66180d5481681a67e89b9a84efad4d", "score": "0.5673706", "text": "func deployFrontend(ctx *base.ClusterContext) (err error) {\n\terr = KubeDeploy{\n\t\timage: \"quay.io/skupper/hello-world-frontend\",\n\t\tlabels: map[string]string{\"app\": \"hello-world-frontend\"},\n\t\tname: \"hello-world-frontend\",\n\t}.deploy(ctx)\n\treturn\n}", "title": "" }, { "docid": "c779202387d9c3fbacd6340ac85c2874", "score": "0.56720763", "text": "func httpServer8080() {\n l := newLogger(\"SERVER-8080\")\n\n handler := newCustomHandler(l)\n\n server := &http.Server{\n Addr: \":8080\",\n Handler: handler,\n }\n\n l.Print(\"Listening on \", server.Addr)\n err := server.ListenAndServe()\n l.Fatal(\"Stopped. \", err)\n}", "title": "" }, { "docid": "400a9cbf9e5372b6c1788acae6b8afcf", "score": "0.56689155", "text": "func main() {\n\tport := os.Getenv(\"PORT\")\n\n\tif port == \"\" {\n\t\tlog.Fatal(\"$PORT must be set\")\n\t}\n\tendpoint := create()\n\thttp.HandleFunc(\"/events-endpoint\", endpoint.eventsEndpoint)\n\thttp.HandleFunc(\"/ctf\", endpoint.ctfEndpoint)\n\n\thttp.HandleFunc(\"/674958312\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.ServeFile(w, r, \"./flag.png\")\n\t})\n\thttp.HandleFunc(\"/audio\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.ServeFile(w, r, \"./audio.wav\")\n\t})\n\thttp.HandleFunc(\"/submit\", endpoint.submitEndpoint)\n\tfmt.Println(\"[INFO] Server listening\")\n\thttp.ListenAndServe(\":\"+port, nil)\n}", "title": "" }, { "docid": "c4773be069c3fa3b49ba2e68bc990ada", "score": "0.5662884", "text": "func (c *Component) Serve() {\n\tserver := &http.Server{\n\t\tAddr: com.GetString(\"listen_addr\"),\n\t\tHandler: context.ClearHandler(\n\t\t\thttp.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\tt := time.Now()\n\t\t\t\tlw := log.WrapResponseWriter(w)\n\t\t\t\tdefer log.Info(r, lw, time.Now().Sub(t))\n\n\t\t\t\tif maint.Active() {\n\t\t\t\t\thttp.Error(lw, maint.Notice(), http.StatusServiceUnavailable)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// serve static\n\t\t\t\tstaticPrefix := com.GetString(\"static_path\") + \"/\"\n\t\t\t\tif strings.HasPrefix(r.URL.Path, staticPrefix) {\n\t\t\t\t\thttp.StripPrefix(staticPrefix,\n\t\t\t\t\t\thttp.FileServer(http.Dir(com.GetString(\"static_dir\")))).ServeHTTP(lw, r)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// serve semantic ui src. TODO: make dev only\n\t\t\t\tif strings.HasPrefix(r.URL.Path, \"/_semantic/\") {\n\t\t\t\t\thttp.StripPrefix(\"/_semantic/\",\n\t\t\t\t\t\thttp.FileServer(http.Dir(\"ui/semantic/src\"))).ServeHTTP(lw, r)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// serve component\n\t\t\t\tfor _, handler := range Handlers() {\n\t\t\t\t\tif handler.MatchHTTP(r) {\n\t\t\t\t\t\thandler.ServeHTTP(lw, r)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tr.URL.Fragment = \"NotFound\"\n\t\t\t\tfor _, handler := range Handlers() {\n\t\t\t\t\tif handler.MatchHTTP(r) {\n\t\t\t\t\t\thandler.ServeHTTP(lw, r)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\thttp.NotFound(lw, r)\n\t\t\t})),\n\t}\n\thd := &httpdown.HTTP{\n\t\tStopTimeout: 10 * time.Second,\n\t\tKillTimeout: 1 * time.Second,\n\t}\n\tvar err error\n\tlog.Info(\"listening on\", server.Addr)\n\tc.http, err = hd.ListenAndServe(server) // TODO: replace with actual serving goroutine\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tc.http.Wait()\n}", "title": "" }, { "docid": "adebe96e437134d8cdace892c0ef95d6", "score": "0.5653657", "text": "func main() {\n\toptions := []web.Option{\n\t\tweb.Name(\"shanxing.api.\" + ServiceName),\n\t\tweb.Version(\"latest\"),\n\t\tweb.Flags(cli.StringFlag{Name: \"c\"}),\n\t\tweb.RegisterTTL(config.Cfg.RegisterTTL * time.Second),\n\t\tweb.RegisterInterval(config.Cfg.RegisterInterval * time.Second),\n\t}\n\tif config.Cfg.RegEtcd {\n\t\t//reg := consul.NewRegistry(func(op *registry.Options) {\n\t\t//\top.Addrs = config.Cfg.Consuls\n\t\t//})\n\t\treg := etcd.NewRegistry(func(op *registry.Options) {\n\t\t\top.Addrs = config.Cfg.Etcd\n\t\t})\n\t\toptions = append(options, web.Registry(reg))\n\t}\n\n\tservice := web.NewService(options...)\n\n\t_, err := slog.NewLog(\"Info\", true, 10)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\terr = service.Init(\n\t\tweb.Action(func(c *cli.Context) {\n\t\t\t//db.Init()\n\t\t\tslog.Info(ServiceName + \" api is start ...\")\n\t\t}),\n\t\tweb.AfterStop(func() error {\n\t\t\tslog.Info(ServiceName + \" api is stop ...\")\n\t\t\tslog.Close()\n\t\t\treturn nil\n\t\t}),\n\t)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tservice.Handle(\"/\", router.Init(ServiceName))\n\tif err := service.Run(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n}", "title": "" }, { "docid": "63bd9d3c6c450c6fa4468fafce2d7f73", "score": "0.5652888", "text": "func main() {\n\tlistenAddr := \":8080\"\n\thttp.HandleFunc(\"/hello\", helloWorldHandler)\n\tlog.Printf(\"Starting server... try navigating to http://localhost%v/hello to be greeted\", listenAddr)\n\tlog.Fatal(http.ListenAndServe(listenAddr, nil))\n}", "title": "" }, { "docid": "4c9ef33f568c39b28ab462b3fa5c5087", "score": "0.5651909", "text": "func New(ags *AutograderService, public, httpAddr string) {\n\tentryPoint := filepath.Join(public, \"index.html\")\n\tif _, err := os.Stat(entryPoint); os.IsNotExist(err) {\n\t\tags.logger.Fatalf(\"file not found %s\", entryPoint)\n\t}\n\n\tsecret := rand.String()\n\tstore := newStore([]byte(secret))\n\tgothic.Store = store\n\te := newServer(ags, store)\n\n\tenabled := enableProviders(ags.logger, ags.bh.BaseURL)\n\tregisterWebhooks(ags, e, enabled)\n\tregisterAuth(ags, e)\n\n\tregisterFrontend(e, entryPoint, public)\n\trunWebServer(ags.logger, e, httpAddr)\n}", "title": "" }, { "docid": "9c6a076d243d0a9de898a95a4af123e5", "score": "0.56461746", "text": "func main() {\n\thttp.HandleFunc(\"/\", handler)\n\tlog.Fatal(http.ListenAndServe(\"localhost:8000\", nil))\n}", "title": "" }, { "docid": "c3d3b36f4b7ee537f98a8fc3fe765f19", "score": "0.5643245", "text": "func (s Server) Run() {\n\tlog.Printf(\"[INFO] activate rest server\")\n\n\trouter := chi.NewRouter()\n\trouter.Use(middleware.RealIP, Recoverer)\n\trouter.Use(middleware.Throttle(1000), middleware.Timeout(60*time.Second))\n\trouter.Use(AppInfo(\"strawberry\", s.Version), Ping)\n\n\trouter.Route(\"/api/v1\", func(r chi.Router) {\n\t\tr.Use(Logger())\n\t\tr.Get(\"/resource/{id}\", s.getResourceCtrl)\n\t\tr.Post(\"/resource\", s.postResourceCtrl)\n\t\tr.Get(\"/list\", s.getListCtrl)\n\t})\n\n\trouter.Get(\"/robots.txt\", func(w http.ResponseWriter, r *http.Request) {\n\t\trender.PlainText(w, r, \"User-agent: *\\nDisallow: /api/\\n\")\n\t})\n\n\ts.fileServer(router, \"/\", http.Dir(filepath.Join(\".\", \"docroot\")))\n\n\tlog.Fatal(http.ListenAndServe(\":8080\", router))\n}", "title": "" }, { "docid": "13c3394a8bd933d4fac8367977fd0d83", "score": "0.56421655", "text": "func startListening() {\n\thttp.HandleFunc(\"/\", newPatient)\n\tlog.Fatal(http.ListenAndServe(\":3000\", nil))\n}", "title": "" }, { "docid": "936d794481e8ba92f5ec5188a978077c", "score": "0.5630411", "text": "func ListenAndServe() {\n\thandleBowerDist := func(name string) {\n\t\th := http.StripPrefix(\n\t\t\t\"/\"+name+\"/\",\n\t\t\tFileServerNoReaddir(http.Dir(\"webapp/bower_components/\"+name+\"/dist\")),\n\t\t)\n\n\t\thttp.Handle(\"/\"+name+\"/\", h)\n\t}\n\n\t// bower components\n\thandleBowerDist(\"bootstrap\")\n\thandleBowerDist(\"jquery\")\n\thandleBowerDist(\"bacon\")\n\n\t// local assets\n\thttp.Handle(\"/js/\", FileServerNoReaddir(http.Dir(\"webapp\")))\n\thttp.Handle(\"/\", FileServerNoReaddir(http.Dir(\"webapp/html\")))\n\n\t// endpoints\n\thttp.Handle(\"/ws\", HandlerIgnoreErr(DecorateHandler(HandlerErrFunc(wsHandler), logger)))\n\n\thttp.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "8047d428a34c46599bcabc04f023d7b8", "score": "0.5629377", "text": "func newRestAPI(connections *websockets.Connections, configFile *config.ConfigurationFile, servicesRunner *runner.Runner) *RestServer {\n\n\te := echo.New()\n\n\te.Use(middleware.CORS())\n\te.HTTPErrorHandler = errors.HTTPErrorHandler\n\te.Use(errors.PanicMiddleware)\n\te.GET(\"/ws\", websocketHandler(connections))\n\te.GET(\"/healthcheck\", func(c echo.Context) error {\n\t\treturn c.String(http.StatusOK, \"\")\n\t})\n\te.GET(\"/state\", func(c echo.Context) error {\n\t\tfor _, service := range configFile.Services {\n\t\t\tservice.IsWatching = servicesRunner.IsWatching(service.Name)\n\t\t\tservice.IsRunning = servicesRunner.IsRunning(service.Name)\n\t\t}\n\t\treturn c.JSON(http.StatusOK, configFile)\n\t})\n\te.GET(\"/logs\", func(c echo.Context) error {\n\t\t// we only return the last 1000 logs\n\t\tminIndex := len(servicesRunner.Logs) - 1000\n\t\tif minIndex < 0 {\n\t\t\tminIndex = 0\n\t\t}\n\t\treturn c.JSON(http.StatusOK, servicesRunner.Logs[minIndex:])\n\t})\n\te.POST(\"/restart/:name\", func(c echo.Context) error {\n\t\tserviceName := c.Param(\"name\")\n\t\tservicesRunner.Restart(serviceName)\n\t\treturn c.NoContent(http.StatusOK)\n\t})\n\te.POST(\"/setWatching/:name\", func(c echo.Context) error {\n\t\tserviceName := c.Param(\"name\")\n\t\tvar body SetWatchingBody\n\t\tif err := c.Bind(&body); err != nil {\n\t\t\treturn errors.Wrap(err)\n\t\t}\n\t\tservicesRunner.SetWatching(serviceName, body.IsWatching)\n\t\treturn c.NoContent(http.StatusOK)\n\t})\n\n\te.POST(\"/setRunning/:name\", func(c echo.Context) error {\n\t\tserviceName := c.Param(\"name\")\n\t\tvar body SetRunningBody\n\t\tif err := c.Bind(&body); err != nil {\n\t\t\treturn errors.Wrap(err)\n\t\t}\n\t\tservicesRunner.SetIsRunning(serviceName, body.IsRunning)\n\t\treturn c.NoContent(http.StatusOK)\n\t})\n\n\treturn &RestServer{\n\t\techoServer: e,\n\t}\n}", "title": "" }, { "docid": "ab3b0a4fed1e0b9a47e2e749b491f83f", "score": "0.5627762", "text": "func main() {\n\tport := os.Getenv(\"PORT\")\n\tif port == \"\" {\n\t\tport = \"8080\"\n\t}\n\tprojectID := os.Getenv(\"GOOGLE_CLOUD_PROJECT\")\n\tif projectID == \"\" {\n\t\tlog.Fatal(\"GOOGLE_CLOUD_PROJECT must be set\")\n\t}\n\n\ta, err := newApp(projectID)\n\tif err != nil {\n\t\tlog.Fatalf(\"newApp: %v\", err)\n\t}\n\n\thttp.HandleFunc(\"/\", a.index)\n\n\tlog.Printf(\"Listening on port %s\", port)\n\tif err := http.ListenAndServe(\":\"+port, nil); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "813009022959bafa71d99fb08c450ce0", "score": "0.5617124", "text": "func main(){\n http.HandleFunc(\"/\", Handler)\nerr := http.ListenAndServe(\":8081\", nil)\nif err != nil {\n log.Fatal(\"ListenAndServe: \", err)\n}\n}", "title": "" }, { "docid": "1556ff0b67dc4eeeb0c943199fc4b9a1", "score": "0.56153136", "text": "func (api *API) WebService() error {\n\tmux := http.NewServeMux()\n\thost := api.Settings.Host\n\t// Define Routes here.\n\tmux.HandleFunc(\"/api/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tapi.Router(w, r)\n\t})\n\tif api.Settings.Htdocs != \"\" {\n\t\tmux.Handle(\"/\", staticRouter(http.FileServer(http.Dir(api.Settings.Htdocs))))\n\t}\n\tlog.Printf(\"%s start, listening on %s\", api.AppName, api.Settings.Host)\n\treturn http.ListenAndServe(host, requestLogger(mux))\n}", "title": "" }, { "docid": "9370bca8cec5e11d7d745a1790648abd", "score": "0.56134933", "text": "func main() {\n\tport := os.Getenv(\"SERVICE_PORT\")\n\tif len(port) == 0 {\n\t\tlog.Fatal(\"Required parameter service port is not set\")\n\t}\n\n\tr := router.New()\n\tr.Logger = logger\n\tr.GET(\"/\", home)\n\n\t// Readiness and liveness probes for Kubernetes\n\tr.GET(\"/info\", func(c *router.Control) {\n\t\tcommon_handlers.Info(c, version.RELEASE, version.REPO, version.COMMIT)\n\t})\n\tr.GET(\"/healthz\", func(c *router.Control) {\n\t\tc.Code(http.StatusOK).Body(http.StatusText(http.StatusOK))\n\t})\n\n\tr.Listen(\"0.0.0.0:\" + port)\n}", "title": "" }, { "docid": "afdb79c91519faab59239092c1b972a0", "score": "0.5610489", "text": "func main() {\n\tfmt.Println(\"APPLICATION BEGIN\")\n\twebserver := new(service.Webserver)\n\tregisterConfig()\n\tregisterErrors()\n\tregisterBuckets()\n\tregisterAllApis()\n\tregisterCustomInitFunc()\n\twebserver.Start()\n}", "title": "" }, { "docid": "bcad1f67179dcba72997fad73819f495", "score": "0.5604044", "text": "func main() {\n\thttp.Handle(\"/hello\", http.HandlerFunc(helloHandler))\n\n\thttp.ListenAndServe(\"localhost:8181\", http.DefaultServeMux)\n}", "title": "" }, { "docid": "dca56e9705be98da4dcf70bcafae6ef8", "score": "0.56010634", "text": "func (rest *RestApi) Run(host string, port string) {\n log.Fatal(http.ListenAndServe(host + \":\" + port, rest.router))\n}", "title": "" }, { "docid": "24e45a5969d2287384fa065b7d3a5710", "score": "0.5599782", "text": "func main() {\n\t// add the /test endpoint\n\troute := gmicro.Route{\n\t\tMethod: \"GET\",\n\t\tPath: \"/test\",\n\t\tHandler: func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) {\n\t\t\tw.Write([]byte(\"Hello!\"))\n\t\t},\n\t}\n\n\t// test Option func\n\ts := gmicro.NewService(\n\t\tgmicro.WithRouteOpt(route),\n\t\tgmicro.WithShutdownFunc(shutdownFunc),\n\t\tgmicro.WithPreShutdownDelay(2*time.Second),\n\t\tgmicro.WithShutdownTimeout(6*time.Second),\n\t\tgmicro.WithHandlerFromEndpoint(pb.RegisterGreeterServiceHandlerFromEndpoint),\n\t\tgmicro.WithLogger(gmicro.LoggerFunc(log.Printf)),\n\t\tgmicro.WithRequestAccess(true),\n\t\tgmicro.WithPrometheus(true),\n\t\tgmicro.WithGRPCServerOption(grpc.ConnectionTimeout(10*time.Second)),\n\t\tgmicro.WithGRPCNetwork(\"tcp\"), // grpc server start network\n\t\tgmicro.WithStaticAccess(true), // enable static file access,if use http gw\n\t)\n\n\t// register grpc service\n\tpb.RegisterGreeterServiceServer(s.GRPCServer, &greeterService{})\n\n\tnewRoute := gmicro.Route{\n\t\tMethod: \"GET\",\n\t\tPath: \"health\",\n\t\tHandler: func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) {\n\t\t\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\tw.Write([]byte(\"OK\"))\n\t\t},\n\t}\n\n\ts.AddRoute(newRoute)\n\n\tnewRoute2 := gmicro.Route{\n\t\tMethod: \"GET\",\n\t\tPath: \"/info\",\n\t\tHandler: func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) {\n\t\t\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\tw.Write([]byte(\"OK\"))\n\t\t},\n\t}\n\n\ts.AddRoute(newRoute2)\n\n\t// you can start grpc server and http gateway on one port\n\tlog.Fatalln(s.StartGRPCAndHTTPServer(sharePort))\n\n\t// you can also specify ports for grpc and http gw separately\n\t// log.Fatalln(s.Start(sharePort, 50051))\n\n\t// you can start server without http gateway\n\t// log.Fatalln(s.StartGRPCWithoutGateway(50051))\n}", "title": "" }, { "docid": "2f833676e0cc528e687b913bcb678da5", "score": "0.5590007", "text": "func main() {\n\thttp.HandleFunc(\"/\", Home)\n\thttp.HandleFunc(\"/about\", About)\n\n\tfmt.Println(fmt.Sprintf(\"Staring application on port %s\", portNumber))\n\t_ = http.ListenAndServe(portNumber, nil)\n}", "title": "" }, { "docid": "ffd68feee6fe1c3bc960d00928506986", "score": "0.5584299", "text": "func startHTTP(port string) error {\n\tr := chi.NewRouter()\n\n\tr.Use(middleware.RequestID)\n\tr.Use(middleware.RealIP)\n\tr.Use(middleware.Logger)\n\tr.Use(middleware.Recoverer)\n\tr.Use(cors.Default().Handler)\n\n\tcontroller.RegisterBaseRoutes(r)\n\n\tr.Mount(\"/v1\", controller.RegisterRoutesV1())\n\n\tfmt.Printf(\"Server listen at :%v\\n\", port)\n\treturn http.ListenAndServe(fmt.Sprintf(\":%s\", port), r)\n}", "title": "" }, { "docid": "331be47885c4a161fdf5efe1ed11e67f", "score": "0.5577382", "text": "func startWebServer() {\n\tlog.Println(\"Sentinel listening on port\", strconv.Itoa(listenPort))\n\thttp.HandleFunc(\"/\", indexHandler)\n\thttp.HandleFunc(\"/delete\", deleteHandler)\n\terr := http.ListenAndServe(listenIP+\":\"+strconv.Itoa(listenPort), nil)\n\tif err != nil {\n\t\tlog.Println(\"Error with sentintel web service:\", err)\n\t}\n}", "title": "" }, { "docid": "a00210ab5ce8edb25ff60e6341f56098", "score": "0.5574562", "text": "func main() {\n\tlog.Println(\"Serving content on\", \"http://localhost:8080\")\n\tlog.Fatalln(http.ListenAndServe(\":8080\", nil))\n}", "title": "" }, { "docid": "e31fb73283fa5f9502a6ae48b2a0fe7b", "score": "0.5560471", "text": "func createWebServer() net.Listener {\n\n\thandler := func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintf(w, r.URL.Path[1:])\n\t}\n\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/\", handler)\n\n\tserver := &http.Server{\n\t\tHandler: mux,\n\t}\n\n\tl, _ := net.Listen(\"tcp\", \"127.0.0.1:0\")\n\n\tgo server.Serve(l)\n\n\treturn l\n}", "title": "" }, { "docid": "17b753f7e9731d5171639647475d7322", "score": "0.55510384", "text": "func main() {\n\n\t// Initialize Logger instance\n\tlog, err := logger.New(serviceName)\n\tif err != nil {\n\t\tfmt.Println(\"Logger Init Failed\", err.Error())\n\t\tos.Exit(1)\n\t}\n\n\t// Initialize application specific configs and dependencies\n\t// App and request config\n\tcfg, err := config.New(configProvider)\n\tif err != nil {\n\t\tlog.Err(\"Config Init Failed\", err.Error())\n\t\tos.Exit(1)\n\t}\n\tservice := &grpc.Service{}\n\t_ = cfg.Server(&service)\n\terr = cfg.SetKey(\"kube-config-path\", kubeConfigPath)\n\tif err != nil {\n\t\tlog.Err(\"Cannot set kubeconfig path\", err.Error())\n\t\tos.Exit(1)\n\t}\n\n\t// // Initialize Tracing instance\n\t// tracer, err := tracing.New(service.Name, service.TraceURL)\n\t// if err != nil {\n\t// \tlog.Err(\"Tracing Init Failed\", err.Error())\n\t// \tos.Exit(1)\n\t// }\n\n\t// Initialize Handler intance\n\thandler := nginx.New(cfg, log)\n\thandler = nginx.AddLogger(log, handler)\n\tservice.Handler = handler\n\tservice.Channel = make(chan interface{}, 100)\n\tservice.StartedAt = time.Now()\n\n\t// Server Initialization\n\tlog.Info(fmt.Sprintf(\"Adaptor Started at: %s\", service.Port))\n\terr = grpc.Start(service)\n\tif err != nil {\n\t\tlog.Err(\"adapter crashed!!\", err.Error())\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "2a848f887854fd9c532a7fb465c961c0", "score": "0.55501175", "text": "func createAndStartServer(api *models.API) {\n\ta := *api\n\ta.Start()\n\n\tconfig := a.GetConfig()\n\tgostServer = http.CreateServer(\n\t\tconfig.Server.Host,\n\t\tconfig.Server.Port,\n\t\tapi,\n\t\tconfig.Server.HTTPS,\n\t\tconfig.Server.HTTPSCert,\n\t\tconfig.Server.HTTPSKey)\n\tgostServer.Start()\n}", "title": "" }, { "docid": "0b79fb33970847c50808bf81998be57e", "score": "0.5537463", "text": "func NewFrontend(name string, config *Config, replicas []common.ReplicaInterface) *Frontend {\n\tfe := &Frontend{}\n\tfe.log = log.New(os.Stdout, \"[Frontend:\"+name+\"] \", log.Ldate|log.Ltime|log.Lshortfile)\n\tfe.name = name\n\tfe.Config = config\n\tfe.replicas = replicas\n\tfe.readChan = make(chan *readRequest, 10)\n\n\t// Periodically serialize database epoch advances.\n\tgo fe.periodicWrite()\n\t// Batch incoming reads into combined requests to replicas.\n\tgo fe.batchReads()\n\n\treturn fe\n}", "title": "" }, { "docid": "3cccef1a78be817ca69906cf7db1d82d", "score": "0.5533989", "text": "func Start() {\n\tport, ok := os.LookupEnv(\"PORT\")\n\tif !ok {\n\t\tprintln(\"PORT is required\\nFor localhosts setup sys env \\\"PORT\\\" as 8080 and reload IDE\")\n\t\tlog.Fatal(\"PORT is required\\nFor localhosts setup sys env \\\"PORT\\\" as 8080 and reload IDE\")\n\t}\n\n\tgin.SetMode(gin.ReleaseMode)\n\tRouter = gin.Default()\n\tRouter.Use(gin.Logger())\n\tRouter.Use(gin.Recovery())\n\tif !TestCaseFlag {\n\t\tRouter.Static(\"/static\", \"./static\")\n\t\tRouter.LoadHTMLGlob(\"templates/*.html\")\n\t}\n\n\tRouter.GET(\"/\", IndexHandler)\n\tRouter.GET(\"/location\", LocationHandler)\n\tRouter.GET(\"/search\", SearchHandler)\n\n\tservice := NewUserService(postgres.NewPostgresUsersRepo(dataBase.Connection))\n\tjwtMiddleware = &jwt.GinJWTMiddleware{\n\n\t\tRealm: \"Name\",\n\t\tKey: []byte(dataBase.TokenKeyLookUp()),\n\t\tTimeout: time.Hour,\n\t\tMaxRefresh: time.Hour * 24,\n\t\tAuthenticator: service.CheckCredentials,\n\t\tAuthorizator: service.Authorization,\n\t\tUnauthorized: func(c *gin.Context, code int, message string) {\n\t\t\tc.JSON(code, gin.H{\n\t\t\t\t\"code\": code,\n\t\t\t\t\"message\": message,\n\t\t\t})\n\t\t},\n\t\tTokenLookup: \"cookie:token\",\n\t\t//\tTokenHeadName: \"Bearer\",\n\t\tTimeFunc: time.Now,\n\t\tPayloadFunc: service.Payload,\n\t}\n\n\tRouter.GET(apiRoute, ApIIndexHandler)\n\tinitUserProfileRoutes()\n\tinitBooksRoutes()\n\tinitTagsRoutes()\n\n\tsrv := &http.Server{\n\t\tAddr: \":\" + port,\n\t\tHandler: Router,\n\t}\n\tRouter.GET(\"/serverStatus\", ServerIsOn)\n\n\tgo func() {\n\t\t// Starting server\n\t\tif err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {\n\t\t\tlog.Fatalf(\"listen: %s\\n\", err)\n\t\t}\n\t}()\n\n\tShutdown = make(chan int)\n\t<-Shutdown\n\tlog.Println(\"Shutdown Server ...\")\n}", "title": "" }, { "docid": "e11c61b34877f27a0831c98f8a88adb2", "score": "0.5532605", "text": "func main() {\n\thttp.ListenAndServe(\":\" + getenv(\"PORT\", \"3000\"), nil)\n}", "title": "" }, { "docid": "382c612578f9f78210ebd6eab8590765", "score": "0.55297256", "text": "func main() {\n\thttp.HandleFunc(\"/audit\", handleAudit)\n\thttp.HandleFunc(\"/_ah/start\", ok)\n\thttp.HandleFunc(\"/_ah/stop\", ok)\n\thttp.HandleFunc(\"/_ah/health\", ok)\n\n\terr := http.ListenAndServe(\":8080\", nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "f2996536ea2dc5fe4161c2553864e04d", "score": "0.55268776", "text": "func (s *SysServices) run(hostAddr string, grpcWebServer *grpcweb.WrappedGrpcServer, httpServer *http.Server, certFile, keyFile string) error {\n\tif httpServer == nil {\n\t\thttpServer = &http.Server{\n\t\t\tHandler: h2c.NewHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\t\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE, PATCH\")\n\t\t\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Cache-Control, Keep-Alive, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, X-User-Agent, X-Grpc-Web\")\n\t\t\t\tw.Header().Set(\"Access-Control-Expose-Headers\", \"grpc-status, grpc-message\")\n\t\t\t\ts.logger.Infof(\"Request Endpoint: %s\", r.URL)\n\t\t\t\t// if r.Method == \"OPTIONS\" {\n\t\t\t\t// \treturn\n\t\t\t\t// }\n\t\t\t\tgrpcWebServer.ServeHTTP(w, r)\n\t\t\t}), &http2.Server{}),\n\t\t}\n\t}\n\n\thttpServer.Addr = hostAddr\n\tif certFile != \"\" && keyFile != \"\" {\n\t\treturn httpServer.ListenAndServeTLS(certFile, keyFile)\n\t}\n\treturn httpServer.ListenAndServe()\n}", "title": "" }, { "docid": "f737edbbbb46f9f8d2ccfc06791fd444", "score": "0.5526493", "text": "func ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tif !baseApp.isInit {\n\t\tif err := baseApp.Init(); err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\tbaseApp.ServeHTTP(w, r)\n}", "title": "" }, { "docid": "014d7ae6ef28a141e14d937f0c444789", "score": "0.55258316", "text": "func (a *service) Run() error {\n\treturn http.ListenAndServe(a.conf.Port, a.server)\n}", "title": "" }, { "docid": "0c5199ec742f485b7cb63b0e21f79241", "score": "0.55184734", "text": "func HTTP(port string) {\n\thttp.HandleFunc(\"/\", HandleHello)\n\tlog.Printf(\"HTTP server listen on port: %s\", port)\n\terr := http.ListenAndServe(\":\"+port, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\tos.Exit(2)\n\t}\n}", "title": "" }, { "docid": "98dc679503cbd50ec75601ceca3b679d", "score": "0.55107576", "text": "func main() {\n\t// add handler function\n\thttp.HandleFunc(\"/contact\", contactHandler)\n\n\t// specify address and start listening\n\taddr := \"127.0.0.1:8080\"\n\tlog.Printf(\"Attempting to listen on: %s\", addr)\n\tlog.Fatal(http.ListenAndServe(addr, nil))\n}", "title": "" }, { "docid": "b16aa4924aee9069117f5082d4bdb6eb", "score": "0.5503206", "text": "func startServer(port int) {\n\n\thttp.HandleFunc(\"/\", webserviceHandler)\n\thttp.ListenAndServe(fmt.Sprintf(\":%v\", port), nil)\n}", "title": "" }, { "docid": "7eb4b580a05e5164e99d0470ad891cc9", "score": "0.5495919", "text": "func (f *Frontend) serveHTTP(l net.Listener) error {\n\tf.srv = &http.Server{\n\t\tAddr: f.Addr,\n\t\tHandler: f.handler(),\n\t\tReadTimeout: f.ReadTimeout,\n\t\tWriteTimeout: f.WriteTimeout,\n\t\tIdleTimeout: f.IdleTimeout,\n\t}\n\n\tf.srv.SetKeepAlivesEnabled(f.EnableKeepAlive)\n\n\t// Start the HTTP server.\n\tif err := f.srv.Serve(l); !errors.Is(err, http.ErrServerClosed) {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7350eb8aadcb289ee1e0f44d10c00935", "score": "0.5493985", "text": "func (c *CCServer) Start() error {\n\trouter := c.NewRouter()\n\thttp.Handle(\"/\", router)\n\tc.printStartMsg()\n\n\tstatikFS, err := fs.New()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tstaticServer := http.FileServer(statikFS)\n\tsh := http.StripPrefix(\"/swaggerui/\", staticServer)\n\thttp.Handle(\"/swaggerui/\", sh)\n\n\treturn http.ListenAndServe(fmt.Sprintf(\":%d\", c.config.Port), nil)\n}", "title": "" }, { "docid": "4402d7ca7d8cf8c63199671fe269050d", "score": "0.54905236", "text": "func main() {\n\t// Create a TCP listener like you normally would\n\tlistener, err := net.Listen(\"tcp\", \":1234\")\n\tif err != nil {\n\t\tgrpclog.Fatalf(\"failed to listen: %v\", err)\n\t}\n\n\t// Create a gRPC server and attach our service to it\n\tserver := grpc.NewServer()\n\tpb.RegisterBetterTestServer(server, &testBetterService{})\n\n\t// Start handling requests\n\tgrpclog.Printf(\"Starting to listen on %s\", listener.Addr())\n\terr = server.Serve(listener)\n\tif err != nil {\n\t\tgrpclog.Fatalf(\"failed to serve: %v\", err)\n\t}\n}", "title": "" }, { "docid": "79ae3de9d64e8ee513ada2b262f8d31a", "score": "0.5489808", "text": "func Example() {\n\tcreate := func(ctx context.Context, addr string) (DSP, error) {\n\t\treturn &qsc.DSP{\n\t\t\tAddress: addr,\n\t\t}, nil\n\t}\n\n\t// bind a net.Listener to :8080\n\tlis, err := net.Listen(\"tcp\", \":8080\")\n\tif err != nil {\n\t\t// handle error\n\t}\n\n\tserver, err := CreateDSPServer(create)\n\tif err != nil {\n\t\t// handle error\n\t}\n\n\tif err = server.Serve(lis); err != nil {\n\t\t// handle error\n\t}\n}", "title": "" }, { "docid": "4619c6b4fde4b9009313b7383118a228", "score": "0.5487592", "text": "func main() {\n\t//fmt.Println(\"starting...\")\n\tlogger := servicelog.GetInstance()\n\tlogger.Println(time.Now().UTC(), \"Starting service\")\n\t// routes defined in routes.go\n\trouter := NewRouter()\n\thttp.ListenAndServe(\":8080\", router)\n}", "title": "" }, { "docid": "d6ada5863a6bc0a6eaf24e519f88b546", "score": "0.54847425", "text": "func Start(listenAddress, payloadDir string) {\n\tr := mux.NewRouter()\n\tr.HandleFunc(\"/api/v1.0/version\", GetVersion).Methods(\"GET\")\n\tr.HandleFunc(\"/api/v1.0/config\", GetConfig).Methods(\"GET\")\n\tr.HandleFunc(\"/api/v1.0/sessions\", GetSessions).Methods(\"GET\")\n\tr.HandleFunc(\"/api/v1.0/session\", CreateSession).Methods(\"POST\")\n\tr.HandleFunc(\"/api/v1.0/session/{guid}\", GetSessionByName).Methods(\"GET\")\n\tr.HandleFunc(\"/api/v1.0/session/delete/{guid}\", RemoveSession).Methods(\"DELETE\")\n\tr.HandleFunc(\"/api/v1.0/task/{guid}\", GetTask).Methods(\"GET\")\n\tr.HandleFunc(\"/api/v1.0/task/{guid}\", SetTask).Methods(\"POST\")\n\tr.HandleFunc(\"/api/v1.0/task/{guid}\", RemoveTask).Methods(\"DELETE\")\n\tr.HandleFunc(\"/api/v1.0/bootstraptask/{handler}\", GetBootstrapTask).Methods(\"GET\")\n\tr.HandleFunc(\"/api/v1.0/bootstraptask/{handler}\", SetBootstrapTask).Methods(\"POST\")\n\tr.HandleFunc(\"/api/v1.0/bootstraptask/{handler}\", RemoveBootstrapTask).Methods(\"DELETE\")\n\tr.HandleFunc(\"/api/v1.0/task/output/{guid}\", GetTaskOutput).Methods(\"GET\")\n\tr.HandleFunc(\"/api/v1.0/task/output/{guid}\", SetTaskOutput).Methods(\"POST\")\n\tr.HandleFunc(\"/api/v1.0/task/output/{guid}\", RemoveTaskOutput).Methods(\"DELETE\")\n\tr.HandleFunc(\"/api/v1.0/upload/{file}\", UploadFile).Methods(\"POST\")\n\n\t// serve files located in specified payload directory\n\tr.PathPrefix(\"/api/v1.0/files/\").Handler(http.StripPrefix(\"/api/v1.0/files/\", http.FileServer(http.Dir(payloadDir))))\n\n\tServer = &http.Server{\n\t\tAddr: listenAddress,\n\t\tWriteTimeout: time.Second * 15,\n\t\tReadTimeout: time.Second * 15,\n\t\tIdleTimeout: time.Second * 60,\n\t\tHandler: r,\n\t}\n\t// start rest api in goroutine so it doesn't block\n\tgo func() {\n\t\terr := Server.ListenAndServe()\n\t\tif err != nil && err.Error() != \"http: Server closed\" {\n\n\t\t\tif strings.Contains(err.Error(), fmt.Sprintf(\"listen tcp %s: bind: address already in use\", listenAddress)) {\n\t\t\t\tlogger.Warning(err)\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tlogger.Error(err)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "8d3e1987342f42a0a615f747d4443cb1", "score": "0.5483858", "text": "func main() {\n\thttp.HandleFunc(\"/\", HomeRouterHandler) // установим роутер\n\terr := http.ListenAndServe(\":8800\", nil) // задаем слушать порт\n\tif err != nil {\n\t\tlog.Fatal(\"ListenAndServe: \", err)\n\t}\n}", "title": "" }, { "docid": "b365f59b4f01f768c798983434c0634e", "score": "0.547395", "text": "func (api *API) Run(context.Context) error {\n\treturn http.ListenAndServe(\":8080\", api.router)\n}", "title": "" }, { "docid": "14c91ef34af055de5e604d4b856bfc95", "score": "0.54702526", "text": "func main() {\n\tlog.Println(\"Starting dictionary client\")\n\tctx := context.Background()\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tgw := runtime.NewServeMux()\n\topts := []grpc.DialOption{grpc.WithInsecure()}\n\t// REST to gRPC handling\n\terr := api.RegisterDictionaryServiceHandlerFromEndpoint(ctx, gw, \"localhost\"+config.GrpcPort, opts)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// adding swagger-ui handling\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/api/\", gw)\n\tmux.HandleFunc(\"/swagger/\", serveSwagger)\n\n\tlog.Println(\"Starting HTTP client on port \" + config.HttpPort)\n\tlog.Println(\"Swagger REST API documentation available at: \" + \"localhost\" + config.HttpPort + \"/swagger\")\n\tif err = http.ListenAndServe(config.HttpPort, mux); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "06c3d9c8cb90a092b0aa57ee8e23ec2d", "score": "0.5469886", "text": "func startHTTPServer(\n\tctx *TestContext,\n\tlistenConf *tor.ListenConf,\n\thandlePattern string,\n\thandler func(http.ResponseWriter, *http.Request),\n) (*http.Client, *http.Server, *tor.OnionService) {\n\thttpClient := httpClient(ctx, nil)\n\t// Wait at most a few minutes for the entire test\n\tlistenCtx, listenCancel := context.WithTimeout(context.Background(), 4*time.Minute)\n\tdefer listenCancel()\n\t// Create an onion service to listen on random port but show as 80\n\tonion, err := ctx.Listen(listenCtx, listenConf)\n\tctx.Require.NoError(err)\n\t// Make HTTP server\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(handlePattern, handler)\n\thttpServer := &http.Server{Handler: mux}\n\tgo func() { ctx.Require.Equal(http.ErrServerClosed, httpServer.Serve(onion)) }()\n\treturn httpClient, httpServer, onion\n}", "title": "" }, { "docid": "bf07ed4405f16012593bf52da16d47f0", "score": "0.5469578", "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\tif h.Assets404 != \"\" {\n\t\t\tlog.Printf(\"[DEBUG] assets 404 file enabled for %s\", h.Assets404)\n\t\t}\n\t}\n\n\tif h.LBSelector == nil {\n\t\th.LBSelector = rand.Intn\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()), // recover on errors\n\t\tsignatureHandler(h.Signature, h.Version), // send app signature\n\t\th.pingHandler, // respond to /ping\n\t\tbasicAuthHandler(h.BasicAuthEnabled, h.BasicAuthAllowed), // basic auth\n\t\th.healthMiddleware, // respond to /health\n\t\th.matchHandler, // set matched routes to context\n\t\tlimiterSystemHandler(h.ThrottleSystem), // limit total requests/sec\n\t\tlimiterUserHandler(h.ThrottleUser), // req/seq per user/route match\n\t\th.mgmtHandler(), // handles /metrics and /routes for prometheus\n\t\th.pluginHandler(), // prc to external plugins\n\t\theadersHandler(h.ProxyHeaders, h.DropHeader), // add response headers and delete some request headers\n\t\taccessLogHandler(h.AccessLog), // apache-format log file\n\t\tstdoutLogHandler(h.StdOutEnabled, logger.New(logger.Log(log.Default()), logger.Prefix(\"[INFO]\")).Handler),\n\t\tmaxReqSizeHandler(h.MaxBodySize), // limit request max size\n\t\tgzipHandler(h.GzEnabled), // gzip response\n\t)\n\n\t// no FQDNs defined, use the list of discovered servers\n\tif len(h.SSLConfig.FQDNs) == 0 && h.SSLConfig.SSLMode == SSLAuto {\n\t\th.SSLConfig.FQDNs = h.discoveredServers(ctx, 50*time.Millisecond)\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": "29ef1e4c46800b63c6981cf84ff4d1f5", "score": "0.5467773", "text": "func (n *Node) startHTTP(endpoint string, apis []rpc.API, modules []string, cors []string, vhosts []string) error {\n\t// Short circuit if the HTTP endpoint isn't being exposed\n\tif endpoint == \"\" {\n\t\treturn nil\n\t}\n\tlistener, handler, err := rpc.StartHTTPEndpoint(endpoint, apis, modules, cors, vhosts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn.log.Info(\"HTTP endpoint opened\", \"url\", fmt.Sprintf(\"http://%s\", endpoint), \"cors\", strings.Join(cors, \",\"), \"vhosts\", strings.Join(vhosts, \",\"))\n\tn.log.Debug(\"HTTP endpoint opened\", \"url\", fmt.Sprintf(\"http://%s\", endpoint), \"cors\", strings.Join(cors, \",\"), \"vhosts\", strings.Join(vhosts, \",\"))\n\n\t// All listeners booted successfully\n\tn.httpEndpoint = endpoint\n\tn.httpListener = listener\n\tn.httpHandler = handler\n\n\treturn nil\n}", "title": "" }, { "docid": "3dbdd7d03679300161d74311d59ee1fd", "score": "0.54595786", "text": "func Serve(\n\tctx context.Context,\n\tcreateService interface{},\n) {\n\tsrv, err := NewServer(ctx, createService)\n\tswitch err.(type) {\n\tcase core.ErrDisplayHelp:\n\t\treturn\n\tcase nil:\n\t\tsignalChan := make(chan os.Signal, 1)\n\t\tsignal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM)\n\n\t\terrChan := make(chan error, 1)\n\t\tgo func() {\n\t\t\tdefer func() {\n\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\terrChan <- fmt.Errorf(\"Server panic: %v\", r)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\terrChan <- srv.Start()\n\t\t}()\n\n\t\tselect {\n\t\tcase <-signalChan:\n\t\t\terr = srv.GracefulStop()\n\t\tcase err = <-errChan:\n\t\t}\n\t}\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "70bb5eafa9ee0d8ad640741648cf745f", "score": "0.54578286", "text": "func main() {\n\n\tlog.Println(\"HTTP Server\")\n\n\tportPtr := flag.String(\"port\", \"8288\", \"port number\")\n\tfinalUrlPtr := flag.String(\"finalRedirectUrl\", \"https://dzone.com/refcardz/getting-started-with-etherium-private-blockchain\", \"the final redirect URL to be returned to gateway router.\")\n\tflag.Parse()\n\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/ping\", pingHandler())\n\tmux.Handle(\"/hello\", helloHandler())\n\n\tfinalRedirectUrl = *finalUrlPtr\n\tport := *portPtr\n\thost := \"0.0.0.0:\" + port\n\tlog.Println(\"The final redirect URL for gateway router will be: \" + finalRedirectUrl)\n\tlog.Println(host + \" up and listening\")\n\n\terr := http.ListenAndServe(host, mux)\n\tif err != nil {\n\t\tlog.Fatal(\"Error creating server. \", err)\n\t}\n}", "title": "" }, { "docid": "3c9988e8e103f091becf08623f20c5d4", "score": "0.5457497", "text": "func main() {\n\ts := &server{}\n\thttpSrv := http.NewServer(\n\t\thttp.Address(\":8000\"),\n\t\thttp.Middleware(\n\t\t\t// add service filter\n\t\t\tserviceMiddleware,\n\t\t\tserviceMiddleware2,\n\t\t),\n\t\t// add global filter\n\t\thttp.Filter(globalFilter, globalFilter2),\n\t)\n\t// register http hanlder to http server\n\thelloworld.RegisterGreeterHTTPServer(httpSrv, s)\n\n\t// add route filter\n\tr := httpSrv.Route(\"/\", routeFilter, routeFilter2)\n\t// add path filter to custom route\n\tr.GET(\"/hello/{name}\", sayHelloHandler, pathFilter, pathFilter2)\n\n\t// add path filter to router group\n\tr2 := r.Group(\"/v2\", pathFilter, pathFilter2)\n\tr2.GET(\"/say/{name}\", sayHelloHandler)\n\n\tapp := kratos.New(\n\t\tkratos.Name(\"helloworld\"),\n\t\tkratos.Server(\n\t\t\thttpSrv,\n\t\t),\n\t)\n\tif err := app.Run(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "65e2a22aa7835ea1f819c87938eb7c3b", "score": "0.54534066", "text": "func ListenAndServe(args ...interface{}) {\n\tapplyPatchToDom(fullDomPatch())\n\n\tactiveConnections = map[*websocket.Conn]int{}\n\n\tcomponentUpdate = make(chan Component, 10)\n\tgo componentUpdateListen(componentUpdate)\n\n\t// fs := http.FileServer(http.Dir(\"../../assets/files\"))\n\tfs := http.FileServer(assets.Assets)\n\thttp.Handle(\"/\", fs)\n\thttp.HandleFunc(\"/client\", clientHandler)\n\n\t// Add optional resource handlers\n\tif len(args) == 2 {\n\t\tprefix := args[0].(string)\n\t\tresourceFS := args[1].(http.FileSystem)\n\n\t\thttp.Handle(prefix, http.StripPrefix(prefix, http.FileServer(resourceFS)))\n\t}\n\n\tlog.Fatal(http.ListenAndServe(\":8080\", nil))\n}", "title": "" }, { "docid": "c008602b548621e71a1e60e3f11fd2bb", "score": "0.5451969", "text": "func serveAndListen() {\n\thttp.Handle(\"/\", http.FileServer(http.Dir(\"server\")))\n\thttp.HandleFunc(\"/welcome\", welcome)\n\thttp.HandleFunc(\"/register\", register)\n\thttp.HandleFunc(\"/newmachine\", newMachine)\n\thttp.HandleFunc(\"/signin\", enter)\n\thttp.HandleFunc(\"/stats\", getStats)\n\thttp.HandleFunc(\"/installapps\", installApps)\n\thttp.HandleFunc(\"/typedprogs\", typedprogs)\n\thttp.HandleFunc(\"/uninstall\", uninstall)\n\thttp.ListenAndServe(\":80\", nil)\n}", "title": "" }, { "docid": "e5cafe086caf888a8136369267ea13b2", "score": "0.54512787", "text": "func NewFrontend(logic frontend.TrackerLogic, provided Config) (*Frontend, error) {\n\tcfg := provided.Validate()\n\n\tf := &Frontend{\n\t\tclosing: make(chan struct{}),\n\t\tlogic: logic,\n\t\tConfig: cfg,\n\t\tgenPool: &sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn NewConnectionIDGenerator(cfg.PrivateKey)\n\t\t\t},\n\t\t},\n\t}\n\n\tif err := f.listen(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tgo func() {\n\t\tif err := f.serve(); err != nil {\n\t\t\tlog.Fatal(\"failed while serving udp\", log.Err(err))\n\t\t}\n\t}()\n\n\treturn f, nil\n}", "title": "" }, { "docid": "322642fcc5ee5909a56bf32a5677cc54", "score": "0.5450046", "text": "func main() {\n\thttp.HandleFunc(\"/\", handler)\n\tlog.Fatal(http.ListenAndServe(\"localhost:8080\", nil))\n}", "title": "" }, { "docid": "15bc3698e16df44279ce8fb9e645eeb3", "score": "0.54292107", "text": "func startHTTP() {\n\tvar err error\n\n\t// create listener\n\thttpListener, err = net.Listen(\"tcp\", httpListen)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// start listening\n\thttp.HandleFunc(\"/\", handleHTTP)\n\tgo http.Serve(httpListener, nil)\n}", "title": "" }, { "docid": "0a33dc686d1bc8ec4a4098705c5b2d2e", "score": "0.5425645", "text": "func main() {\n\tif err := http.InitHttpServer(); err != nil {\n\t\tlog.Fatalf(\"ERROR: %s\", err)\n\t}\n}", "title": "" }, { "docid": "33b2f496af008726fe4fe4fb67280372", "score": "0.54238343", "text": "func startServer() {\n\thttp.HandleFunc(\"/public/\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.ServeFile(w, r, r.URL.Path[1:])\n\t})\n\n\thttp.HandleFunc(\"/new\", func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method == \"POST\" {\n\t\t\t// HTML forms use '\\r\\n' instead of '\\n'\n\t\t\tr.ParseForm()\n\t\t\tbody := strings.Replace(r.Form[\"body\"][0], \"\\r\\n\", \"\\n\", -1)\n\n\t\t\t// make new page, redirect to confirmation\n\t\t\tnewPage, err := createPage([]byte(body))\n\t\t\tif err != nil {\n\t\t\t\thttp.ServeFile(w, r, \"resources/error.html\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconfirmPage.Execute(w, newPage)\n\t\t} else {\n\t\t\thttp.ServeFile(w, r, \"resources/404.html\")\n\t\t}\n\t})\n\n\thttp.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\taddress := r.URL.Path[1:]\n\t\tif len(address) == 0 {\n\t\t\thttp.ServeFile(w, r, \"resources/home.html\")\n\t\t\treturn\n\t\t}\n\t\tif len(address) != idLength || !pageInRegister(address) {\n\t\t\thttp.ServeFile(w, r, \"resources/404.html\")\n\t\t\treturn\n\t\t}\n\t\thttp.ServeFile(w, r, pagesDir+address+\".html\")\n\t})\n\n\tlog.Printf(\"Starting server on port %s...\\n\", port)\n\tfmt.Printf(\"Starting server on port %s...\\n\", port)\n\n\tgo http.ListenAndServe(\":80\", http.HandlerFunc(redirect)) // redirect http to https\n\tlog.Fatal(http.ListenAndServeTLS(\":\"+port, \"whisk.ws.crt\", \"whisk.ws.key\", nil))\n}", "title": "" }, { "docid": "51be7bc78083668947d92544d05c1db1", "score": "0.5421184", "text": "func main() {\n\tlog.Fatal(http.ListenAndServe(\":8080\", nil))\n}", "title": "" }, { "docid": "317e9648bf70cd76f44204b7b6e395e8", "score": "0.5416665", "text": "func (s *Server) Start() (err error) {\n\t// TODO: read from cfg\n\tcorsWrapper := cors.New(cors.Options{\n\t\tAllowedOrigins: []string{\"http://localhost:3000\"},\n\t\tAllowedMethods: []string{\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\", \"HEAD\", \"OPTIONS\"},\n\t\tAllowedHeaders: []string{\"Content-Type\", \"Authorization\", \"X-CSRF-Token\"},\n\t\tExposedHeaders: []string{\"Content-Length\", \"Cache-Control\", \"Content-Language\", \"Content-Type\", \"Expires\", \"Last-Modified\", \"Pragma\", \"Authorization\"},\n\t\tMaxAge: 86400,\n\t\tAllowCredentials: true,\n\t\tDebug: false,\n\t})\n\n\thandler := corsWrapper.Handler(s.Router)\n\n\t// if ratelimit set it here...\n\n\tlistenAddr := \":3001\"\n\n\ts.Server = &http.Server{\n\t\t// ErrorLog: logger\n\t\tHandler: handler,\n\t\tAddr: listenAddr,\n\t\tReadHeaderTimeout: 3 * time.Second,\n\t\tReadTimeout: 5 * time.Second,\n\t\tWriteTimeout: 7 * time.Second,\n\t\tIdleTimeout: 30 * time.Second,\n\t}\n\n\t// autocert manager later...\n\t// if UseLetsEncrypt...\n\n\tgo func() {\n\t\tif err = s.Server.ListenAndServe(); err != nil && err != http.ErrServerClosed {\n\t\t\tlog.Fatalf(\"could not listen on %s: %v\\n\", listenAddr, err)\n\t\t}\n\t}()\n\tlog.Printf(\"server started\")\n\n\tgracefullShutdown(s.Server)\n\n\treturn\n}", "title": "" }, { "docid": "556551db35839f5ff7dfacc8b55936c3", "score": "0.54165846", "text": "func main() {\n\tvar Port = getConfig(\"PORT\")\n\thttp.HandleFunc(\"/\", handler)\n\tlog.Fatal(http.ListenAndServe(fmt.Sprintf(\":%v\", Port), nil))\n}", "title": "" }, { "docid": "fe50417bf8b5a8baf5ecef0195333ecd", "score": "0.5409463", "text": "func StartHTTP() {\n\tgo func() {\n\t\tbox := packr.NewBox(\"../web\")\n\n\t\t// stats controller\n\t\thttp.HandleFunc(\"/stats/\", basicAuthWrapper(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tstatsController(w, r)\n\t\t}))\n\n\t\t// websocket route\n\t\thttp.HandleFunc(\"/stream\", basicAuthWrapper(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tstreamController(w, r)\n\t\t}))\n\n\t\t// everything else handled by static files\n\t\thttp.HandleFunc(\"/\", basicAuthWrapper(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tgziphandler.GzipHandler(http.FileServer(box)).ServeHTTP(w, r)\n\t\t}))\n\n\t\tif Config.SSLCert != \"\" && Config.SSLKey != \"\" {\n\t\t\tfmt.Println(\"HTTPS listening on\", Config.Listen)\n\t\t\tlog.Fatal(http.ListenAndServeTLS(Config.Listen, Config.SSLCert, Config.SSLKey, nil))\n\t\t} else {\n\t\t\tfmt.Println(\"HTTP listening on\", Config.Listen)\n\t\t\tlog.Fatal(http.ListenAndServe(Config.Listen, nil))\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "2a9df8799bd6d4142bb3743897b13d77", "score": "0.54069406", "text": "func MainStartHTTPServer(port string, signals *chan os.Signal, rt *mux.Router, f *Basemethods, rm *Room) {\n\tfmt.Println(\"STARTING WEB SERVICE ON PORT\", port)\n\n\trt.HandleFunc(\"/socket\", func(w http.ResponseWriter, r *http.Request) {\n\t\tupgrader.CheckOrigin = func(r *http.Request) bool { return true }\n\t\tsocket, err := upgrader.Upgrade(w, r, nil)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"ServeHTTP:\", err)\n\t\t\treturn\n\t\t}\n\t\tclient := &client{\n\t\t\tsocket: socket,\n\t\t\tsend: make(chan []byte, messageBufferSize),\n\t\t\troom: rm,\n\t\t}\n\t\trm.join <- client\n\t\tdefer func() { rm.leave <- client }()\n\t\tgo client.write()\n\t\tclient.read()\n\t})\n\trt.HandleFunc(\"/\", defaultRoute)\n\trt.HandleFunc(\"/c\", func(w http.ResponseWriter, r *http.Request) {\n\t\tio.WriteString(w, strconv.Itoa(f.Count()))\n\t})\n\trt.HandleFunc(\"/delete\", func(w http.ResponseWriter, r *http.Request) {\n\t\tEnableCors(&w)\n\t\tqueryValues := r.URL.Query()\n\t\tid := queryValues.Get(\"id\")\n\t\tf.Delete(id)\n\t\tio.WriteString(w, \"Deleted item\")\n\t})\n\trt.HandleFunc(\"/list\", func(w http.ResponseWriter, r *http.Request) {\n\t\tEnableCors(&w)\n\n\t\tqueryValues := r.URL.Query()\n\t\tskip := queryValues.Get(\"skip\")\n\t\tsearchterm := strings.ToLower(queryValues.Get(\"searchterm\"))\n\t\tpagesize := queryValues.Get(\"pagesize\")\n\n\t\tskipInt, errInt := strconv.Atoi(skip)\n\t\tif errInt != nil {\n\t\t\tfmt.Println(\"OOOPS\")\n\t\t\tskipInt = 0\n\t\t}\n\t\tpageSizeInt, errPageSize := strconv.Atoi(pagesize)\n\t\tif errPageSize != nil {\n\t\t\tfmt.Println(\"OOOPS\")\n\t\t\tpageSizeInt = 5\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tjsonData, listLength := f.Search(searchterm, skipInt, pageSizeInt)\n\t\tw.Header().Set(\"List-Length\", strconv.Itoa(listLength))\n\t\tio.WriteString(w, string(jsonData))\n\t})\n\tsrv := &http.Server{\n\t\tAddr: port,\n\t\tHandler: rt,\n\t}\n\tgo func() {\n\t\tif err := srv.ListenAndServe(); err != http.ErrServerClosed {\n\t\t\tlog.Fatalf(\"ListenAndServe(): %s\", err)\n\t\t}\n\t}()\n\tselect {\n\tcase <-*signals:\n\t\tfmt.Println(\"server going to shut down\")\n\t\tctx, cancel := context.WithTimeout(context.Background(), time.Second*5)\n\t\tdefer cancel()\n\t\terr := srv.Shutdown(ctx)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6ffbebdbc7a38b411b3885e9c0dfa524", "score": "0.5404914", "text": "func main() {\n\thttp.HandleFunc(\"/\", handler) // each request calls handler\n\tlog.Fatal(http.ListenAndServe(\"localhost:8000\", nil))\n}", "title": "" }, { "docid": "973a9e5bcf398fa617be5bb5de076e4d", "score": "0.5404817", "text": "func init() {\n\tgo http.ListenAndServe(\"localhost:11299\", nil)\n}", "title": "" }, { "docid": "b107aecd89e517c8ffa7d7c41d22cc86", "score": "0.5399893", "text": "func main() {\n\thttp.HandleFunc(\"/\", handler)\n\thttp.ListenAndServe(\":9811\", nil)\n}", "title": "" }, { "docid": "d2b159ed19d6fa6d88c66533cfa36924", "score": "0.53990966", "text": "func main() {\n\tflag.Parse()\n\n\tlis, err := net.Listen(\"tcp\", fmt.Sprintf(\":%d\", servicePort))\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to listen: %v\", err)\n\t}\n\n\tctx, cancel := context.WithCancel(context.TODO())\n\tdefer cancel()\n\n\tetcdRegister := discovery.NewRegister(etcdAddrs, -1)\n\tif err := etcdRegister.Register(ctx, discovery.ServiceDesc{\n\t\tServiceName: serviceName,\n\t\tHost: serviceIp,\n\t\tPort: servicePort,\n\t\tTTL: time.Second * 3,\n\t}); err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\n\ts := grpc.NewServer()\n\n\t//pb register service\n\tproto.RegisterHelloServiceServer(s, &Hello{})\n\n\tlog.Println(\"server start\")\n\tlog.Fatal(s.Serve(lis).Error())\n}", "title": "" }, { "docid": "356530fcff15ba8f2c00257c56a243e5", "score": "0.539567", "text": "func NewWebApp(opts ...web.Option) web.Service {\n\n\t// create new service\n\tservice := NewService()\n\tmicroApp := getMicroApp()\n\n\t// prepend option\n\toptions := []web.Option{\n\t\tweb.MicroService(service),\n\t\tweb.Address(microApp.port),\n\t}\n\n\t// append user options\n\toptions = append(options, opts...)\n\n\t// return new service\n\treturn web.NewService(options...)\n}", "title": "" }, { "docid": "0a93b523c23ef5ed40df034a30250995", "score": "0.53951454", "text": "func main() {\n\t// Serve 200 status on /health for k8s health checks\n\thttp.HandleFunc(\"/health\", handleHealth)\n\n\t// Return the target replica count which is used by Webhook fleet autoscaling policy\n\thttp.HandleFunc(\"/scale\", handleAutoscale)\n\n\tlogger.Info(\"Starting HTTP server on port 8000\")\n\tif err := http.ListenAndServe(\":8000\", nil); err != nil {\n\t\tlogger.WithError(err).Fatal(\"HTTP server failed to run\")\n\t}\n}", "title": "" }, { "docid": "7ac334395be74354e9478525aac83b28", "score": "0.539252", "text": "func (p *service) HTTP(port int) error {\n\tgin.SetMode(\"debug\")\n\n\tp.engine.GET(\"/api/swagger.json\", p.SwaggerModel())\n\tp.engine.Run(\":\" + strconv.Itoa(port))\n\treturn nil\n}", "title": "" }, { "docid": "c174dbd892706918afe73f07712ac80f", "score": "0.5391746", "text": "func ListenAndServe() {\n\tglog.V(3).Infof(\"Start simple web server\\n\")\n\thandler := NewServer()\n\ts := &http.Server{\n\t\tAddr: net.JoinHostPort(\"0.0.0.0\", \"9090\"),\n\t\tHandler: &handler,\n\t\tMaxHeaderBytes: 1 << 20,\n\t}\n\tglog.Fatal(s.ListenAndServe())\n}", "title": "" }, { "docid": "ee367f3edd3d734d193a61be568147da", "score": "0.5387536", "text": "func Listen(cfg Config) {\n\n\t// If the env hasn't been loaded yet, then load it now\n\t//if Config.EnvLoaded == false {\n\t//\tLoadEnv()\n\t//}\n\n\t// Add some system errors\n\tAddError(\"RouteNotFound\", 404, \"The route does not exist\")\n\tAddError(\"ValidationError\", 422, \"Input validation error\")\n\n\t// Add the response middleware\n\tAddMiddleware(responseMiddleware)\n\n\t// Load all the configured endpoints\n\tloadEndpoints()\n\n\t// Load all the configured middleware\n\tloadMiddleware()\n\n\t// A catch all for 404 route not found error\n\tcatchAllNonRoutes()\n\n\t// Build and log the address\n\taddress := fmt.Sprintf(\":%s\", cfg.Port)\n\tlogStartMessage(address)\n\n\t// Start the server and listen to port\n\tlog.Fatal(http.ListenAndServe(address, router))\n}", "title": "" }, { "docid": "c1491a0b37a2c7fe7b785fe8d9e11914", "score": "0.53850096", "text": "func StartWebServer(port string) {\n\thttp.Handle(\"/\", NewRouter())\n\n\tlog.Info(\"Starting HTTP service at \", port)\n\terr := http.ListenAndServe(\":\"+port, nil)\n\n\tif err != nil {\n\t\tlog.Panicf(\"An error occured starting HTTP listener at port %s, error %s\", port, err)\n\t}\n}", "title": "" }, { "docid": "fb20bce2cb3a48cdaac44013c5e0c7ad", "score": "0.5380717", "text": "func (s *Server) Start() {\n\trouter := mux.NewRouter()\n\n\t// TODO: the actual inventory API should be /v2/services[/...] and\n\t// /v2/service_plans[/...].\n\trouter.HandleFunc(\"/v2/service_plans\", s.controller.Inventory).Methods(\"GET\")\n\n\t// Broker related stuff\n\trouter.HandleFunc(\"/v2/service_brokers\", s.controller.ListServiceBrokers).Methods(\"GET\")\n\trouter.HandleFunc(\"/v2/service_brokers\", s.httpHandler.CreateServiceBroker).Methods(\"POST\")\n\trouter.HandleFunc(\"/v2/service_brokers/{broker}\", s.controller.GetServiceBroker).Methods(\"GET\")\n\trouter.HandleFunc(\"/v2/service_brokers/{broker}\", s.controller.DeleteServiceBroker).Methods(\"DELETE\")\n\trouter.HandleFunc(\"/v2/service_brokers/{broker}:refresh\", s.controller.RefreshServiceBroker).Methods(\"POST\")\n\t// TODO: implement updating a service broker.\n\t// router.HandleFunc(\"/v2/service_brokers/{broker_id}\", s.Controller.UpdateServiceBroker).Methods.(\"PUT\")\n\n\trouter.HandleFunc(\"/v2/service_instances\", s.controller.ListServiceInstances).Methods(\"GET\")\n\trouter.HandleFunc(\"/v2/service_instances\", s.httpHandler.CreateServiceInstance).Methods(\"POST\")\n\trouter.HandleFunc(\"/v2/service_instances/{service}\", s.controller.GetServiceInstance).Methods(\"GET\")\n\trouter.HandleFunc(\"/v2/service_instances/{service}\", s.controller.DeleteServiceInstance).Methods(\"DELETE\")\n\t// TODO: implement list service bindings for this service instance.\n\t// router.HandleFunc(\"/v2/service_instances/{service_id}/service_bindings\", s.controller.ListServiceInstanceBindings).Methods(\"GET\")\n\n\trouter.HandleFunc(\"/v2/service_bindings\", s.controller.ListServiceBindings).Methods(\"GET\")\n\trouter.HandleFunc(\"/v2/service_bindings\", s.httpHandler.CreateServiceBinding).Methods(\"POST\")\n\trouter.HandleFunc(\"/v2/service_bindings/{binding}\", s.controller.GetServiceBinding).Methods(\"GET\")\n\trouter.HandleFunc(\"/v2/service_bindings/{binding}\", s.controller.DeleteServiceBinding).Methods(\"DELETE\")\n\n\thttp.Handle(\"/\", handlers.LoggingHandler(os.Stderr, router))\n\n\tport := strconv.Itoa(s.port)\n\tlog.Println(\"Server started on port \" + port)\n\terr := http.ListenAndServe(\":\"+port, nil)\n\tlog.Println(err.Error())\n}", "title": "" } ]
524cce0a063c82163a8e3b3b59b39135
main is the entry point for all Go programs.
[ { "docid": "0b0e5d17ea7a002b0977c1778bf8c05b", "score": "0.0", "text": "func main() {\n\t// Create a work pool with 2 goroutines.\n\tp := New(2)\n\tvar wg sync.WaitGroup\n\twg.Add(len(names))\n\t// Iterate over the slice of names.\n\tfor _, name := range names {\n\t\t// Create a namePrinter and provide the\n\t\t// specific name.\n\t\tnp := namePrinter{\n\t\t\tname: name,\n\t\t}\n\t\tgo func() {\n\t\t\t// Submit the task to be worked on. When RunTask\n\t\t\t// returns we know it is being handled.\n\t\t\tif err := p.Run(&np); err != nil {\n\t\t\t\tspew.Dump(err)\n\t\t\t}\n\t\t\twg.Done()\n\t\t}()\n\n\t}\n\twg.Wait()\n\t// Shutdown the work pool and wait for all existing work\n\t// to be completed.\n\tp.Shutdown()\n}", "title": "" } ]
[ { "docid": "84bfc93ddfd48dc4a11e52d0c54a43ab", "score": "0.83789605", "text": "func main() {\n\tif err := RunMain(os.Args); err != nil {\n\t\tutil.Fatal(\"%s\", err)\n\t}\n}", "title": "" }, { "docid": "d530ae6d500fe4e85e69f0e0e96c2736", "score": "0.82746667", "text": "func main() {\n\tif err := RunMain(os.Args); err != nil {\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "d530ae6d500fe4e85e69f0e0e96c2736", "score": "0.82746667", "text": "func main() {\n\tif err := RunMain(os.Args); err != nil {\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "bbe51c2a99d5266e77fa2ea1ffd8f55d", "score": "0.7926115", "text": "func main() {\n\tgimain.Main(func() {\n\t\tmainrun()\n\t})\n}", "title": "" }, { "docid": "bbe51c2a99d5266e77fa2ea1ffd8f55d", "score": "0.7926115", "text": "func main() {\n\tgimain.Main(func() {\n\t\tmainrun()\n\t})\n}", "title": "" }, { "docid": "bbe51c2a99d5266e77fa2ea1ffd8f55d", "score": "0.7926115", "text": "func main() {\n\tgimain.Main(func() {\n\t\tmainrun()\n\t})\n}", "title": "" }, { "docid": "bbe51c2a99d5266e77fa2ea1ffd8f55d", "score": "0.7926115", "text": "func main() {\n\tgimain.Main(func() {\n\t\tmainrun()\n\t})\n}", "title": "" }, { "docid": "bbe51c2a99d5266e77fa2ea1ffd8f55d", "score": "0.7926115", "text": "func main() {\n\tgimain.Main(func() {\n\t\tmainrun()\n\t})\n}", "title": "" }, { "docid": "79db31f60fa136151b974561e1ef3795", "score": "0.7822115", "text": "func main() {\n\tif err := server.Main(); err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\tlog.Println(\"Program exited\")\n}", "title": "" }, { "docid": "cac54b940922fe0b5df36a656936f669", "score": "0.7698652", "text": "func main() {\n\t// ?\n}", "title": "" }, { "docid": "a973dfb5e5b61a72db8121dc825a1e2a", "score": "0.76830393", "text": "func main() {\n\n\tsetAppInfo()\n\tsetCommands()\n\n\tsetDebug(false)\n\n\terr := app.Run(os.Args)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"app.Run: %s\", err)\n\t}\n}", "title": "" }, { "docid": "f398daa711a1d760c84ff3711b3b01f7", "score": "0.7664377", "text": "func main() {\n\tfmt.Println(\"Hello from Go!\")\n}", "title": "" }, { "docid": "7245efc768e11f78351185552e55a03b", "score": "0.7645498", "text": "func main() {\n\terr := _main()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"%v\")\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "d6b63afa51af3faa2f4b57c3c9e1255b", "score": "0.76037246", "text": "func main() {\n\tstart()\n}", "title": "" }, { "docid": "e28512a64506b94e21ffb03d77f66a5d", "score": "0.7602514", "text": "func Main() {\n\tmain()\n}", "title": "" }, { "docid": "fe3a2594f48d7a7644f0ff6f5d3a0ead", "score": "0.7599891", "text": "func main() {\n\tfmt.Println(\"You just run your first GO code on your\", runtime.GOOS)\n}", "title": "" }, { "docid": "4f74176dd6dc06d5789137ba041b114b", "score": "0.7493547", "text": "func main() {\n\tfmt.Println(\"Hello, world!\")\n}", "title": "" }, { "docid": "69d959688a4aabb377a3d280e32ed78b", "score": "0.7481578", "text": "func main() {\n\n\t// Setup signal handlers.\n\t//ctx, _ := context.WithCancel(context.Background())\n\tctx := context.Background()\n\tm := NewMain()\n\n\t// Parse command line flags & load configuration.\n\tif err := m.ParseFlags(ctx, os.Args[1:]); err == flag.ErrHelp {\n\t\tos.Exit(1)\n\t} else if err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(1)\n\t}\n\n\t// Execute program.\n\tif err := m.Run(ctx); err != nil {\n\t\tm.Close()\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(1)\n\t}\n\n}", "title": "" }, { "docid": "db95b88e794a5e6e99feb4204baa6002", "score": "0.7476673", "text": "func main() {\n\tfmt.Println(\"Hi there!\")\n}", "title": "" }, { "docid": "a322829a6c2e1b78b4e43eb6bb589cf5", "score": "0.7463272", "text": "func main() {\n\tPrintln(\"hello world\")\n}", "title": "" }, { "docid": "4da077facadaf5597177b94e32f937c6", "score": "0.7442802", "text": "func main() {\n\t// Initialize .data and .bss sections.\n\tpreinit()\n\n\t// Run initializers of all packages.\n\tinitAll()\n\n\t// Compiler-generated call to main.main().\n\tcallMain()\n}", "title": "" }, { "docid": "a783c144e8e9de0ae34ad887c6e97337", "score": "0.7431916", "text": "func main() {\n\tos.Exit(realMain())\n}", "title": "" }, { "docid": "eef4753121d7e1c0c87f9c6de5603d71", "score": "0.7403726", "text": "func Main() {\n\t// TODO: Prevent from running twice.\n\terr := start()\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "abbd90e553a9a088b715246fd80d678d", "score": "0.7401035", "text": "func Main() {\n\t// Write the application code here.\n\tfmt.Println(\"Yo, I'm da app!👍 \")\n\treturn\n}", "title": "" }, { "docid": "6a87f999f5a25070f74391605aae22a3", "score": "0.7392317", "text": "func main() {\n\tfmt.Println(\"Hello world\")\n}", "title": "" }, { "docid": "f4a37f5f248c51d21f827b48fa7cf2cf", "score": "0.73835117", "text": "func main() {\n\tif err := run(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n}", "title": "" }, { "docid": "d4209aa0c4d1aee8d9762ac624433b4f", "score": "0.7380545", "text": "func main() { // entry point\n\tfmt.Println(\"Hello World\")\n\n}", "title": "" }, { "docid": "246ae2e2be039f9836ddf275a2ae15e3", "score": "0.7368393", "text": "func main() {\n\tif err := run(os.Args[1:]); err != nil {\n\t\tlog.Fatalf(\"!! %+v\", err)\n\t}\n}", "title": "" }, { "docid": "9066970f91d8d9bee28beb8a59d93a71", "score": "0.7362877", "text": "func main() {\n\tfmt.Println(\"Hello, World this is Go\")\n}", "title": "" }, { "docid": "c943d0633ef2230548836b5fbb736bff", "score": "0.7357485", "text": "func main() {\n\t// your code here\n}", "title": "" }, { "docid": "db1213db2da4370f0e70af6b9b8d95e1", "score": "0.7349104", "text": "func main() {\n\tfmt.Println(\"Hello, World\")\n}", "title": "" }, { "docid": "7203d66b495144f893722662ece45735", "score": "0.734481", "text": "func main() {\n\tfmt.Println(\"Hello World\")\n}", "title": "" }, { "docid": "7203d66b495144f893722662ece45735", "score": "0.734481", "text": "func main() {\n\tfmt.Println(\"Hello World\")\n}", "title": "" }, { "docid": "7203d66b495144f893722662ece45735", "score": "0.734481", "text": "func main() {\n\tfmt.Println(\"Hello World\")\n}", "title": "" }, { "docid": "7203d66b495144f893722662ece45735", "score": "0.734481", "text": "func main() {\n\tfmt.Println(\"Hello World\")\n}", "title": "" }, { "docid": "642938885d16472b027c23c723c91300", "score": "0.73417026", "text": "func main() {\n\tfmt.Println(\"Hello World!\")\n}", "title": "" }, { "docid": "642938885d16472b027c23c723c91300", "score": "0.73417026", "text": "func main() {\n\tfmt.Println(\"Hello World!\")\n}", "title": "" }, { "docid": "642938885d16472b027c23c723c91300", "score": "0.73417026", "text": "func main() {\n\tfmt.Println(\"Hello World!\")\n}", "title": "" }, { "docid": "2f2a3229e9a8dbffa491edb764a5a809", "score": "0.72854096", "text": "func main() {\n\tcli.Main(Version)\n}", "title": "" }, { "docid": "771305b01de275212da7f06457e4dbab", "score": "0.72755957", "text": "func main() {\n\tfmt.Println(\"Hello, Gophers! How's it going?!\")\n}", "title": "" }, { "docid": "50755ee2e51aebb5d312cae8ffd7928d", "score": "0.7266995", "text": "func main() {\n\tfmt.Println(\"Hello Sarah\")\n}", "title": "" }, { "docid": "7ea09d0233493a335c386c37f855f529", "score": "0.7193841", "text": "func Main() {\n\tif len(os.Args) == 1 {\n\t\tos.Args = append(os.Args, \"help\")\n\t}\n\tif err := Run(os.Args[1:]); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Failed running %q\\n\", os.Args[1])\n\t\tos.Exit(ErrorCode)\n\t}\n}", "title": "" }, { "docid": "5abdb863d65d40a25587486617b6e948", "score": "0.7192038", "text": "func main() {\n\tfmt.Println(\"hello\")\n}", "title": "" }, { "docid": "5abdb863d65d40a25587486617b6e948", "score": "0.7192038", "text": "func main() {\n\tfmt.Println(\"hello\")\n}", "title": "" }, { "docid": "f0f9c22af03c52932c1a1ce8d022dca5", "score": "0.71803874", "text": "func main() {\n\ts := server.NewServer()\n\ts.Run()\n}", "title": "" }, { "docid": "503ffa849cd9c36cd12fde2b9119fd75", "score": "0.717912", "text": "func main() {\n\ta := cli.NewApp()\n\ta.Name = appName\n\ta.Usage = appUsage\n\ta.Version = appVersion\n\ta.Author = appAuthor\n\ta.Email = appEmail\n\ta.Commands = appCommands\n\n\ta.Run(os.Args)\n\n}", "title": "" }, { "docid": "6f33a6ccab553061951cb7a872327a38", "score": "0.7169152", "text": "func main() {\n\tvar err error\n\tif err = main2(); err != nil {\n\t\tos.Stderr.WriteString(err.Error()+\"\\n\")\n\t\tos.Exit(2)\n\t}\n}", "title": "" }, { "docid": "467cccc768b584ac97f75f7e970244a2", "score": "0.7168211", "text": "func main() {\n\tbeego.Run()\n}", "title": "" }, { "docid": "74cfb00e0d78d63c99237a95d7ffec0e", "score": "0.71589744", "text": "func main() {\n\tfmt.Println(\"Hello World\")\n\n}", "title": "" }, { "docid": "8fd13f4f752e57d20949e890d79f3fa5", "score": "0.71532565", "text": "func main() {\n\tfmt.Println()\n}", "title": "" }, { "docid": "48f96e91483e12d5a82cf56ca02f27d3", "score": "0.7145288", "text": "func main() {\n\tswitch os.Args[1] {\n\tcase \"run\":\n\t\trun()\n\tcase \"child\":\n\t\tchild()\n\tdefault:\n\t\tpanic(\"unknown\")\n\t}\n}", "title": "" }, { "docid": "908208fcc6c12e708d5c3fbe999631f8", "score": "0.71300673", "text": "func Main() {\n\t// Set log level\n\tlogrus.SetLevel(logrus.ErrorLevel)\n\n\t// Load translation files\n\terr := utils.LoadLocales(\"\")\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn\n\t}\n\n\t// Set default translation language\n\tT := utils.Language(common.DefaultLanguage) // TODO: Add more languages\n\n\t// Create the CLI App\n\tapp := cli.NewApp()\n\t// Terminal\n\tterm := terminal.NewUI(nil, app.Writer)\n\tapp.Name = T(\"app_name\")\n\tapp.Usage = T(\"app_usage\")\n\tapp.Version = T(\"app_version\")\n\tapp.Metadata = map[string]interface{}{}\n\tapp.Flags = config.GlobalFlags()\n\tapp.Commands = config.GlobalCommands(term)\n\tapp.Before = config.Before\n\tapp.Action = config.DefaultAction\n\tapp.OnUsageError = config.OnUsageError\n\n\terr = app.Run(os.Args)\n\tif err != nil {\n\t\tlogrus.Error(err.Error())\n\t}\n}", "title": "" }, { "docid": "44a95a277805465ad73115834f636285", "score": "0.71241754", "text": "func main() {\n\tprintln(\"Hello World!\")\n}", "title": "" }, { "docid": "8b099a5fbfc060f09c763269e2d36694", "score": "0.71193475", "text": "func main() {\n\trunstring()\n\trunprogram()\n}", "title": "" }, { "docid": "5f523ecf240c5c40bb3054ab31df1169", "score": "0.7103857", "text": "func main() {\n\t// Build the binary to run web server\n\tbeego.Run()\n}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.71003145", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.71003145", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.71003145", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.71003145", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.71003145", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.71003145", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.71003145", "text": "func main() {}", "title": "" }, { "docid": "b9b1622fe6b674edd0cf1d58a5ce49b7", "score": "0.70807064", "text": "func main() {\n\n\t// Delegate this run to the SDK. InvokeMap takes a map of test case names\n\t// and test case functions, and dispatches accordingly depending on the test\n\t// case being run. The run.Invoke* functions are entrypoint functions.\n\trun.InvokeMap(testcases)\n}", "title": "" }, { "docid": "56eeb916128011453c8b0832726fa4ef", "score": "0.7079045", "text": "func main() {\n\n\tswitch os.Args[1] {\n\n\tcase \"run\":\n\n\t\trun()\n\n\t\tdefault:\n\n\t\t\tpanic(\"bad command\")\n\n\t\t}\n\n\t}", "title": "" }, { "docid": "fe9d8d5e1b4b64c2d519242cce849e07", "score": "0.70458513", "text": "func main() {\n\tif err := run(); err != nil {\n\t\t_, _ = fmt.Fprintf(os.Stderr, \"%s\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tos.Exit(0)\n}", "title": "" }, { "docid": "5d3dae1f37297d69542748241070d97d", "score": "0.70181155", "text": "func main() {\n\tdefer exitOnPanic() // fatal error handler: log and exit\n\n\terr := mainBody(os.Args)\n\tif err != nil {\n\t\tomppLog.Log(err.Error())\n\t\tos.Exit(1)\n\t}\n\tomppLog.Log(\"Done.\") // compeleted OK\n}", "title": "" }, { "docid": "7ffb5d13ff85d24e75db0b5f59a50b37", "score": "0.7014385", "text": "func main() {\n\tif err := run(); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"this is the startup err: %s\\\\n\", err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "8ba0a28f4365694ec8df87c0f2b7f144", "score": "0.7003203", "text": "func main() {\n\terr := clientMain()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "4bde1eb1121d89cc96b7402b637b034c", "score": "0.69993174", "text": "func main() {\n\tfmt.Println(\"Starting agent...\")\n\n\teventFileName, contextFileName := parseCommandLineArguments()\n\n\trun(eventFileName, contextFileName, cronTopic, instancesURL)\n\n\tfmt.Println(\"Exiting main, nothing left to do\")\n}", "title": "" }, { "docid": "4026172d38bd49cd931e6239f655fa9e", "score": "0.6991351", "text": "func main() {\n\tpterm.Info.Println(\"Fast Builder Lambda: Starting ... \")\n\tpterm.Info.Println(\"Author: CAIMEO\")\n\tminecraft.Run(\"config.toml\")\n}", "title": "" }, { "docid": "22262302ea296ebbdd002525a773db59", "score": "0.6988582", "text": "func main() {\n\t\n}", "title": "" }, { "docid": "22262302ea296ebbdd002525a773db59", "score": "0.6988582", "text": "func main() {\n\t\n}", "title": "" }, { "docid": "22262302ea296ebbdd002525a773db59", "score": "0.6988582", "text": "func main() {\n\t\n}", "title": "" }, { "docid": "22262302ea296ebbdd002525a773db59", "score": "0.6988582", "text": "func main() {\n\t\n}", "title": "" }, { "docid": "22262302ea296ebbdd002525a773db59", "score": "0.6988582", "text": "func main() {\n\t\n}", "title": "" }, { "docid": "e038cbea44d7bbcb188a331d40388bec", "score": "0.6987374", "text": "func main() {\n\tfmt.Println(\"Hello Work\")\n}", "title": "" }, { "docid": "08a196cf8ce00d0d673d76511371de3b", "score": "0.6978748", "text": "func Main(d DetectFn, b BuildFn) {\n\tswitch filepath.Base(os.Args[0]) {\n\tcase \"detect\":\n\t\tdetect(d)\n\tcase \"build\":\n\t\tbuild(b)\n\tdefault:\n\t\tdefaultLogger.Print(\"Unknown command, expected 'detect' or 'build'.\")\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "d242f3fb517bbeb9036870f8eac13ca4", "score": "0.69733095", "text": "func main(){\n\t// runtime.GOOS gives us the running program OS\n\tfmt.Println(\"Hello from\", runtime.GOOS)\n\n}", "title": "" }, { "docid": "dd8d5eba685300b60d3dc0a5d5ee6246", "score": "0.6963528", "text": "func main() {\n fmt.Println(\"hello world\")\n}", "title": "" }, { "docid": "598a7a28e435926cd1b54bfad09c935a", "score": "0.6960186", "text": "func main() {\n\tcli.NewApp(&_Crawler{}).Run(os.Args)\n}", "title": "" }, { "docid": "598a7a28e435926cd1b54bfad09c935a", "score": "0.6960186", "text": "func main() {\n\tcli.NewApp(&_Crawler{}).Run(os.Args)\n}", "title": "" }, { "docid": "598a7a28e435926cd1b54bfad09c935a", "score": "0.6960186", "text": "func main() {\n\tcli.NewApp(&_Crawler{}).Run(os.Args)\n}", "title": "" }, { "docid": "598a7a28e435926cd1b54bfad09c935a", "score": "0.6960186", "text": "func main() {\n\tcli.NewApp(&_Crawler{}).Run(os.Args)\n}", "title": "" }, { "docid": "598a7a28e435926cd1b54bfad09c935a", "score": "0.6960186", "text": "func main() {\n\tcli.NewApp(&_Crawler{}).Run(os.Args)\n}", "title": "" }, { "docid": "598a7a28e435926cd1b54bfad09c935a", "score": "0.6960186", "text": "func main() {\n\tcli.NewApp(&_Crawler{}).Run(os.Args)\n}", "title": "" }, { "docid": "598a7a28e435926cd1b54bfad09c935a", "score": "0.6960186", "text": "func main() {\n\tcli.NewApp(&_Crawler{}).Run(os.Args)\n}", "title": "" }, { "docid": "20501c551d0a1f0dfeb5207564d3c20f", "score": "0.69581974", "text": "func main() {\n\t// call xerMain in a separate function\n\t// so that it can use defer and have them\n\t// run before the exit.\n\tsetup()\n\txerMain()\n\tos.Exit(exitCode)\n}", "title": "" }, { "docid": "21cf52815df014d5049362312f8875bc", "score": "0.69562745", "text": "func main() {\n fmt.Println(\"Hello world\")\n}", "title": "" }, { "docid": "7fd1e6afddfd70838ff2b147500a54d5", "score": "0.6947866", "text": "func main() {\n\tif len(os.Args) > 1 {\n\t\tcommand := os.Args[1]\n\t\tif command == \"build\" {\n\t\t\tCompileAllFiles()\n\t\t} else if command == \"watch\" {\n\t\t\tCreateWatcher()\n\t\t} else {\n\t\t\tlog.Fatal(\"unknown argument: \" + command)\n\t\t}\n\t} else {\n\t\tCompileAllFiles()\n\t\tCreateWatcher()\n\t}\n}", "title": "" }, { "docid": "2c0cf8a87451702db328d18448743fed", "score": "0.6946149", "text": "func main() {\r\n}", "title": "" }, { "docid": "57d6723affd40322ceb031fe17db6d46", "score": "0.69418174", "text": "func main() {\n}", "title": "" }, { "docid": "57d6723affd40322ceb031fe17db6d46", "score": "0.69418174", "text": "func main() {\n}", "title": "" }, { "docid": "57d6723affd40322ceb031fe17db6d46", "score": "0.69418174", "text": "func main() {\n}", "title": "" }, { "docid": "57d6723affd40322ceb031fe17db6d46", "score": "0.69418174", "text": "func main() {\n}", "title": "" }, { "docid": "57d6723affd40322ceb031fe17db6d46", "score": "0.69418174", "text": "func main() {\n}", "title": "" }, { "docid": "57d6723affd40322ceb031fe17db6d46", "score": "0.69418174", "text": "func main() {\n}", "title": "" }, { "docid": "57d6723affd40322ceb031fe17db6d46", "score": "0.69418174", "text": "func main() {\n}", "title": "" }, { "docid": "57d6723affd40322ceb031fe17db6d46", "score": "0.69418174", "text": "func main() {\n}", "title": "" }, { "docid": "57d6723affd40322ceb031fe17db6d46", "score": "0.69418174", "text": "func main() {\n}", "title": "" }, { "docid": "57d6723affd40322ceb031fe17db6d46", "score": "0.69418174", "text": "func main() {\n}", "title": "" }, { "docid": "57d6723affd40322ceb031fe17db6d46", "score": "0.69418174", "text": "func main() {\n}", "title": "" } ]
26df73fd5311242eac9776569a4157c3
DescribeReservedInstancesListingsWithContext mocks base method
[ { "docid": "27f4192a48f18ce4f9087e39ef2b3b7f", "score": "0.6624359", "text": "func (m *MockEC2Client) DescribeReservedInstancesListingsWithContext(arg0 aws.Context, arg1 *ec2.DescribeReservedInstancesListingsInput, arg2 ...request.Option) (*ec2.DescribeReservedInstancesListingsOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeReservedInstancesListingsWithContext\", varargs...)\n\tret0, _ := ret[0].(*ec2.DescribeReservedInstancesListingsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" } ]
[ { "docid": "8ab3ded34595a04c923e50dbbb58734f", "score": "0.66563356", "text": "func (m *MockEC2Client) DescribeReservedInstancesListings(arg0 *ec2.DescribeReservedInstancesListingsInput) (*ec2.DescribeReservedInstancesListingsOutput, error) {\n\tret := m.ctrl.Call(m, \"DescribeReservedInstancesListings\", arg0)\n\tret0, _ := ret[0].(*ec2.DescribeReservedInstancesListingsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f60b203f6752f66002a3ca99f7b56cc1", "score": "0.627757", "text": "func (mr *MockEC2ClientMockRecorder) DescribeReservedInstancesListingsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeReservedInstancesListingsWithContext\", reflect.TypeOf((*MockEC2Client)(nil).DescribeReservedInstancesListingsWithContext), varargs...)\n}", "title": "" }, { "docid": "a303d1edcc8bb91787759f5e54f5fba0", "score": "0.60977614", "text": "func (m *MockEC2Client) DescribeReservedInstancesOfferingsWithContext(arg0 aws.Context, arg1 *ec2.DescribeReservedInstancesOfferingsInput, arg2 ...request.Option) (*ec2.DescribeReservedInstancesOfferingsOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeReservedInstancesOfferingsWithContext\", varargs...)\n\tret0, _ := ret[0].(*ec2.DescribeReservedInstancesOfferingsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7be04982afa64824c2acde809db23760", "score": "0.6059661", "text": "func (m *MockCloudMap) ListInstancesWithContext(arg0 aws.Context, arg1 *servicediscovery.ListInstancesInput, arg2 ...request.Option) (*servicediscovery.ListInstancesOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListInstancesWithContext\", varargs...)\n\tret0, _ := ret[0].(*servicediscovery.ListInstancesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "38a85d639745aeb6c54b5655d0deee58", "score": "0.59592164", "text": "func (m *MockEC2Client) DescribeReservedInstancesListingsRequest(arg0 *ec2.DescribeReservedInstancesListingsInput) (*request.Request, *ec2.DescribeReservedInstancesListingsOutput) {\n\tret := m.ctrl.Call(m, \"DescribeReservedInstancesListingsRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*ec2.DescribeReservedInstancesListingsOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b406596972c575c275d16204df9bdafd", "score": "0.5881441", "text": "func (mr *MockEC2ClientMockRecorder) DescribeReservedInstancesOfferingsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeReservedInstancesOfferingsWithContext\", reflect.TypeOf((*MockEC2Client)(nil).DescribeReservedInstancesOfferingsWithContext), varargs...)\n}", "title": "" }, { "docid": "af827940c93f2f435ccdc73d3725fdf2", "score": "0.58751595", "text": "func (m *MockEC2Client) DescribeReservedInstancesOfferings(arg0 *ec2.DescribeReservedInstancesOfferingsInput) (*ec2.DescribeReservedInstancesOfferingsOutput, error) {\n\tret := m.ctrl.Call(m, \"DescribeReservedInstancesOfferings\", arg0)\n\tret0, _ := ret[0].(*ec2.DescribeReservedInstancesOfferingsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d857c0d00c4ac00e2ca40404930a170e", "score": "0.58288705", "text": "func (mr *MockEC2ClientMockRecorder) DescribeReservedInstancesListings(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeReservedInstancesListings\", reflect.TypeOf((*MockEC2Client)(nil).DescribeReservedInstancesListings), arg0)\n}", "title": "" }, { "docid": "147691b24b4d61fe6337662ca5ea38cd", "score": "0.57976544", "text": "func (m *MockEC2Client) DescribeReservedInstancesWithContext(arg0 aws.Context, arg1 *ec2.DescribeReservedInstancesInput, arg2 ...request.Option) (*ec2.DescribeReservedInstancesOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeReservedInstancesWithContext\", varargs...)\n\tret0, _ := ret[0].(*ec2.DescribeReservedInstancesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7077be5344987294746cdff338b52907", "score": "0.57746136", "text": "func (m *MockEC2Client) DescribeReservedInstancesOfferingsPagesWithContext(arg0 aws.Context, arg1 *ec2.DescribeReservedInstancesOfferingsInput, arg2 func(*ec2.DescribeReservedInstancesOfferingsOutput, bool) bool, arg3 ...request.Option) error {\n\tvarargs := []interface{}{arg0, arg1, arg2}\n\tfor _, a := range arg3 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeReservedInstancesOfferingsPagesWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "99f80de1f2caf2166c9af3a2a8142c60", "score": "0.5711196", "text": "func (m *MockCloudMap) ListInstancesPagesWithContext(arg0 aws.Context, arg1 *servicediscovery.ListInstancesInput, arg2 func(*servicediscovery.ListInstancesOutput, bool) bool, arg3 ...request.Option) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1, arg2}\n\tfor _, a := range arg3 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListInstancesPagesWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "532f786d65d38737e9de7e4c5796260b", "score": "0.5567693", "text": "func (mr *MockEC2ClientMockRecorder) DescribeReservedInstancesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeReservedInstancesWithContext\", reflect.TypeOf((*MockEC2Client)(nil).DescribeReservedInstancesWithContext), varargs...)\n}", "title": "" }, { "docid": "5ed12f6b14f957487901aa6fd147dba1", "score": "0.5465589", "text": "func (m *MockEC2Client) ModifyReservedInstancesWithContext(arg0 aws.Context, arg1 *ec2.ModifyReservedInstancesInput, arg2 ...request.Option) (*ec2.ModifyReservedInstancesOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ModifyReservedInstancesWithContext\", varargs...)\n\tret0, _ := ret[0].(*ec2.ModifyReservedInstancesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "67984049c26dde49b6e57b7e4f66366a", "score": "0.5420042", "text": "func (m *MockEC2Client) DescribeReservedInstances(arg0 *ec2.DescribeReservedInstancesInput) (*ec2.DescribeReservedInstancesOutput, error) {\n\tret := m.ctrl.Call(m, \"DescribeReservedInstances\", arg0)\n\tret0, _ := ret[0].(*ec2.DescribeReservedInstancesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d23fa320c321f6490a75052b0484b967", "score": "0.5386489", "text": "func (m *MockEC2Client) DescribeReservedInstancesOfferingsRequest(arg0 *ec2.DescribeReservedInstancesOfferingsInput) (*request.Request, *ec2.DescribeReservedInstancesOfferingsOutput) {\n\tret := m.ctrl.Call(m, \"DescribeReservedInstancesOfferingsRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*ec2.DescribeReservedInstancesOfferingsOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "78e4fbc144821608441f1ac10bbc81cf", "score": "0.53560424", "text": "func (m *MockEC2Client) DescribeReservedInstancesModificationsWithContext(arg0 aws.Context, arg1 *ec2.DescribeReservedInstancesModificationsInput, arg2 ...request.Option) (*ec2.DescribeReservedInstancesModificationsOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeReservedInstancesModificationsWithContext\", varargs...)\n\tret0, _ := ret[0].(*ec2.DescribeReservedInstancesModificationsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b486de8664853912bc232f6aa28d5b63", "score": "0.53369653", "text": "func (m *MockSpokeK8sClient) List(arg0 context.Context, arg1 client.ObjectList, arg2 ...client.ListOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"List\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "273f02c807649437efbd28dc4164661a", "score": "0.53369313", "text": "func (m *MockEC2Client) DescribeReservedInstancesModificationsPagesWithContext(arg0 aws.Context, arg1 *ec2.DescribeReservedInstancesModificationsInput, arg2 func(*ec2.DescribeReservedInstancesModificationsOutput, bool) bool, arg3 ...request.Option) error {\n\tvarargs := []interface{}{arg0, arg1, arg2}\n\tfor _, a := range arg3 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeReservedInstancesModificationsPagesWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "9a7336be070c80f6f4b742e8502067fe", "score": "0.53363", "text": "func (mr *MockEC2ClientMockRecorder) DescribeReservedInstancesOfferingsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1, arg2}, arg3...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeReservedInstancesOfferingsPagesWithContext\", reflect.TypeOf((*MockEC2Client)(nil).DescribeReservedInstancesOfferingsPagesWithContext), varargs...)\n}", "title": "" }, { "docid": "2a9f28a2f08cb568c5b6be09c552858c", "score": "0.52846247", "text": "func (mr *MockEC2ClientMockRecorder) DescribeReservedInstancesOfferings(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeReservedInstancesOfferings\", reflect.TypeOf((*MockEC2Client)(nil).DescribeReservedInstancesOfferings), arg0)\n}", "title": "" }, { "docid": "c13873c67df0073430b05aebf01b0296", "score": "0.5280015", "text": "func (m *MockCloudMap) ListInstances(arg0 *servicediscovery.ListInstancesInput) (*servicediscovery.ListInstancesOutput, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListInstances\", arg0)\n\tret0, _ := ret[0].(*servicediscovery.ListInstancesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "907675ed4e657561ef64a3910184a8e0", "score": "0.5214393", "text": "func (m *MockEC2Client) DescribeReservedInstancesRequest(arg0 *ec2.DescribeReservedInstancesInput) (*request.Request, *ec2.DescribeReservedInstancesOutput) {\n\tret := m.ctrl.Call(m, \"DescribeReservedInstancesRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*ec2.DescribeReservedInstancesOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9b7ce5b7d8b708dcf06cec5f6f94f8bd", "score": "0.5197322", "text": "func (m *MockClient) DescribeDBInstancesAll(ctx context.Context) ([]*rds.DBInstance, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DescribeDBInstancesAll\", ctx)\n\tret0, _ := ret[0].([]*rds.DBInstance)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0eb90c5bff7548694e68b76ef82b4d9e", "score": "0.5195128", "text": "func (mr *MockEC2ClientMockRecorder) DescribeReservedInstancesListingsRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeReservedInstancesListingsRequest\", reflect.TypeOf((*MockEC2Client)(nil).DescribeReservedInstancesListingsRequest), arg0)\n}", "title": "" }, { "docid": "bd5d2562b5e3ecb4f3c7265c80584158", "score": "0.5176924", "text": "func (mr *MockEC2ClientMockRecorder) DescribeReservedInstancesModificationsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeReservedInstancesModificationsWithContext\", reflect.TypeOf((*MockEC2Client)(nil).DescribeReservedInstancesModificationsWithContext), varargs...)\n}", "title": "" }, { "docid": "fe8ddb88b9fd96f26baedd158738ba56", "score": "0.51744604", "text": "func (m *MockSNSClient) ListPhoneNumbersOptedOutWithContext(arg0 context.Context, arg1 *sns.ListPhoneNumbersOptedOutInput, arg2 ...request.Option) (*sns.ListPhoneNumbersOptedOutOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListPhoneNumbersOptedOutWithContext\", varargs...)\n\tret0, _ := ret[0].(*sns.ListPhoneNumbersOptedOutOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "fc36d4e42a6490a84ef0c73214d7acfd", "score": "0.5173445", "text": "func (m *MockDeployer) List(ctx context.Context, name string) ([]types.Service, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", ctx, name)\n\tret0, _ := ret[0].([]types.Service)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0621e25cc849aabf9fe70aacbf0b415c", "score": "0.5160761", "text": "func (m *MockStore) ListServices(appName string) ([]*config.Workload, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListServices\", appName)\n\tret0, _ := ret[0].([]*config.Workload)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e1606588458b68b33247de8d2f2f6a95", "score": "0.51403093", "text": "func (m *MockInfra) List(ctx context.Context, name string) ([]types.Service, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", ctx, name)\n\tret0, _ := ret[0].([]types.Service)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8f8dadae205fbb2b75581dd710486c7f", "score": "0.5137552", "text": "func (m *MockEC2Client) DescribeReservedInstancesOfferingsPages(arg0 *ec2.DescribeReservedInstancesOfferingsInput, arg1 func(*ec2.DescribeReservedInstancesOfferingsOutput, bool) bool) error {\n\tret := m.ctrl.Call(m, \"DescribeReservedInstancesOfferingsPages\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "57a828285559c093313a80189745ab9c", "score": "0.5137548", "text": "func (m *MockEC2Client) CancelReservedInstancesListing(arg0 *ec2.CancelReservedInstancesListingInput) (*ec2.CancelReservedInstancesListingOutput, error) {\n\tret := m.ctrl.Call(m, \"CancelReservedInstancesListing\", arg0)\n\tret0, _ := ret[0].(*ec2.CancelReservedInstancesListingOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1e50167549f50093568dbd39d87f892a", "score": "0.5134168", "text": "func (mr *MockEC2ClientMockRecorder) ModifyReservedInstancesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ModifyReservedInstancesWithContext\", reflect.TypeOf((*MockEC2Client)(nil).ModifyReservedInstancesWithContext), varargs...)\n}", "title": "" }, { "docid": "4c1d2ef841920a089b3cb589beea9020", "score": "0.5133761", "text": "func (m *Mockapi) ListStackInstances(arg0 *cloudformation.ListStackInstancesInput) (*cloudformation.ListStackInstancesOutput, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListStackInstances\", arg0)\n\tret0, _ := ret[0].(*cloudformation.ListStackInstancesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "49dc34d8c2c09d62e6f67f80085a4c18", "score": "0.512819", "text": "func (m *MockEC2Client) DescribeScheduledInstanceAvailabilityWithContext(arg0 aws.Context, arg1 *ec2.DescribeScheduledInstanceAvailabilityInput, arg2 ...request.Option) (*ec2.DescribeScheduledInstanceAvailabilityOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeScheduledInstanceAvailabilityWithContext\", varargs...)\n\tret0, _ := ret[0].(*ec2.DescribeScheduledInstanceAvailabilityOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "43c588cceec909db28a10376ba86ff52", "score": "0.51188546", "text": "func MockDescribeDBInstances(t *testing.T, mockMatcher *sdk.MockRDSAPI, wantError bool, testInstances ...types.DBInstance) {\n\tvar err error\n\tif wantError {\n\t\terr = errors.New(\"DescribeDBInstances wrong!\")\n\t}\n\trIds := []*(rds.DBInstance){}\n\n\tfor _, instance := range testInstances {\n\n\t\tb := int64(instance.AllocatedStorage)\n\t\tc := int64(instance.Iops)\n\n\t\trdsInstance := &rds.DBInstance{\n\t\t\tAllocatedStorage: &b,\n\t\t\tDBInstanceIdentifier: aws.String(instance.Identifier),\n\t\t\tIops: &c,\n\t\t}\n\n\t\trIds = append(rIds, rdsInstance)\n\t}\n\n\t// builds mock output based on the input\n\tresult := &rds.DescribeDBInstancesOutput{\n\t\tDBInstances: rIds,\n\t}\n\tmockMatcher.EXPECT().DescribeDBInstances(gomock.Any()).Do(func(input interface{}) {\n\t}).AnyTimes().Return(result, err)\n\n}", "title": "" }, { "docid": "edc83c3e520f2a58e25a4e34469e9248", "score": "0.5105999", "text": "func (m *MockSealedSecretInterface) List(arg0 v1.ListOptions) (*v1alpha1.SealedSecretList, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", arg0)\n\tret0, _ := ret[0].(*v1alpha1.SealedSecretList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "26bac1615a78359acee237fdae20c065", "score": "0.51020557", "text": "func (m *MockCloudMap) ListInstancesRequest(arg0 *servicediscovery.ListInstancesInput) (*request.Request, *servicediscovery.ListInstancesOutput) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListInstancesRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*servicediscovery.ListInstancesOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8fe151814f6d25c29775385c81b2ecc2", "score": "0.50948954", "text": "func (m *MockSecretClient) List(arg0 string, arg1 clients.ListOpts) (v1.SecretList, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", arg0, arg1)\n\tret0, _ := ret[0].(v1.SecretList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3d22cad97e3a6b11f2a963d921149403", "score": "0.5061636", "text": "func (mr *MockEC2ClientMockRecorder) DescribeReservedInstances(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeReservedInstances\", reflect.TypeOf((*MockEC2Client)(nil).DescribeReservedInstances), arg0)\n}", "title": "" }, { "docid": "f6238de2f423d786a16b46fc678b6ba4", "score": "0.5054328", "text": "func (_m *ServiceDiscoveryAPI) ListInstancesWithContext(_a0 context.Context, _a1 *servicediscovery.ListInstancesInput, _a2 ...request.Option) (*servicediscovery.ListInstancesOutput, error) {\n\t_va := make([]interface{}, len(_a2))\n\tfor _i := range _a2 {\n\t\t_va[_i] = _a2[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, _a0, _a1)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 *servicediscovery.ListInstancesOutput\n\tif rf, ok := ret.Get(0).(func(context.Context, *servicediscovery.ListInstancesInput, ...request.Option) *servicediscovery.ListInstancesOutput); ok {\n\t\tr0 = rf(_a0, _a1, _a2...)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*servicediscovery.ListInstancesOutput)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, *servicediscovery.ListInstancesInput, ...request.Option) error); ok {\n\t\tr1 = rf(_a0, _a1, _a2...)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "13466ca10c084399dce1edafb1d57e94", "score": "0.5028888", "text": "func (m *MockIAMAPI) ListPolicyVersionsPagesWithContext(arg0 context.Context, arg1 *iam.ListPolicyVersionsInput, arg2 func(*iam.ListPolicyVersionsOutput, bool) bool, arg3 ...request.Option) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1, arg2}\n\tfor _, a := range arg3 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListPolicyVersionsPagesWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "3999dfa8d45aed88301e732e9835f20e", "score": "0.50187814", "text": "func TESTINSTANCETEST(context.Context, *State) {}", "title": "" }, { "docid": "fdb66af24ce9ad282dd3b7c4763af20c", "score": "0.50106543", "text": "func (mr *MockEC2ClientMockRecorder) DescribeReservedInstancesModificationsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1, arg2}, arg3...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeReservedInstancesModificationsPagesWithContext\", reflect.TypeOf((*MockEC2Client)(nil).DescribeReservedInstancesModificationsPagesWithContext), varargs...)\n}", "title": "" }, { "docid": "ebcadc187db8ddf7e374c0eee3977f9d", "score": "0.5005473", "text": "func (m *MockEC2Client) CreateReservedInstancesListingRequest(arg0 *ec2.CreateReservedInstancesListingInput) (*request.Request, *ec2.CreateReservedInstancesListingOutput) {\n\tret := m.ctrl.Call(m, \"CreateReservedInstancesListingRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*ec2.CreateReservedInstancesListingOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f87b9352c75b02e956a866d79e5bad11", "score": "0.49930537", "text": "func (m *MockEC2Client) CreateReservedInstancesListing(arg0 *ec2.CreateReservedInstancesListingInput) (*ec2.CreateReservedInstancesListingOutput, error) {\n\tret := m.ctrl.Call(m, \"CreateReservedInstancesListing\", arg0)\n\tret0, _ := ret[0].(*ec2.CreateReservedInstancesListingOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "613109e72b16d5bdbd9a723fe7c881f7", "score": "0.4991787", "text": "func (m *MockClient) DescribeDBInstancesPagesWithContext(ctx aws.Context, input *rds.DescribeDBInstancesInput, fn func(*rds.DescribeDBInstancesOutput, bool) bool, opts ...request.Option) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, input, fn}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeDBInstancesPagesWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "2c74ca789123ded41d11a5a024618998", "score": "0.4991651", "text": "func (m *MockEC2Client) DescribeHostReservationOfferingsWithContext(arg0 aws.Context, arg1 *ec2.DescribeHostReservationOfferingsInput, arg2 ...request.Option) (*ec2.DescribeHostReservationOfferingsOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeHostReservationOfferingsWithContext\", varargs...)\n\tret0, _ := ret[0].(*ec2.DescribeHostReservationOfferingsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "4d6ab045e682079607513443a151ee76", "score": "0.49809068", "text": "func (m *MockManagedClustersClient) List(arg0 context.Context) (containerservice.ManagedClusterListResultPage, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", arg0)\n\tret0, _ := ret[0].(containerservice.ManagedClusterListResultPage)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3088ee983594a22a37eb5410a2e4b632", "score": "0.4979011", "text": "func (m *MockAzureActions) VMSizeList(arg0 context.Context) ([]compute.ResourceSku, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VMSizeList\", arg0)\n\tret0, _ := ret[0].([]compute.ResourceSku)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "489720b215fe7a6ac375d714bd34d319", "score": "0.49757534", "text": "func (m *MockEC2Client) CancelReservedInstancesListingWithContext(arg0 aws.Context, arg1 *ec2.CancelReservedInstancesListingInput, arg2 ...request.Option) (*ec2.CancelReservedInstancesListingOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CancelReservedInstancesListingWithContext\", varargs...)\n\tret0, _ := ret[0].(*ec2.CancelReservedInstancesListingOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "95afacafdd4a8f1ff2f3b3c6e6d73d5e", "score": "0.49645057", "text": "func (m *MockOntapAPI) VolumeSnapshotList(arg0 context.Context, arg1 string) (api.Snapshots, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VolumeSnapshotList\", arg0, arg1)\n\tret0, _ := ret[0].(api.Snapshots)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0ab5be5c06ea281356b54dc38b264cd5", "score": "0.49626192", "text": "func (m *MockOpenShiftClustersClient) List(arg0 context.Context) ([]redhatopenshift.OpenShiftCluster, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", arg0)\n\tret0, _ := ret[0].([]redhatopenshift.OpenShiftCluster)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b2e6ed592e1ec5b52ba57f7380d54637", "score": "0.4961443", "text": "func (m *MockRouteGuide_ListFeaturesServer) 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": "7518b6504ab9d4784d47dd2c9218fa43", "score": "0.49590498", "text": "func (m *MockRepository) List(arg0 context.Context) ([]beershop.Beer, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", arg0)\n\tret0, _ := ret[0].([]beershop.Beer)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5211d42d60edadc37ce6a58d2ad293e5", "score": "0.49523053", "text": "func (m *MockLedgers) List(arg0 context.Context) (entities.Ledgers, error) {\n\tret := m.ctrl.Call(m, \"List\", arg0)\n\tret0, _ := ret[0].(entities.Ledgers)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3cae5e28ed0a6c77b9378a85236a1cc6", "score": "0.4946759", "text": "func (m *MockOntapAPI) FlexgroupSnapshotList(arg0 context.Context, arg1 string) (api.Snapshots, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"FlexgroupSnapshotList\", arg0, arg1)\n\tret0, _ := ret[0].(api.Snapshots)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f1203de850e809e9a034cbc86c4d82b2", "score": "0.4944815", "text": "func (m *MockOntapAPI) GetSVMAggregateNames(arg0 context.Context) ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetSVMAggregateNames\", arg0)\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "14defc2a011c6eba158bdccc2051d61c", "score": "0.49413654", "text": "func (m *MockMeshCataloger) ListMonitoredNamespaces() []string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListMonitoredNamespaces\")\n\tret0, _ := ret[0].([]string)\n\treturn ret0\n}", "title": "" }, { "docid": "1231227172962f06d170b2867d2e7273", "score": "0.49389493", "text": "func (m *MockEquipmentHandler) AdminGetAll(w http.ResponseWriter, r *http.Request) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"AdminGetAll\", w, r)\n}", "title": "" }, { "docid": "1147470889cd5abab035b3906c4da4b9", "score": "0.49364704", "text": "func (m *MockOperationsClient) List(arg0 context.Context) ([]redhatopenshift.Operation, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", arg0)\n\tret0, _ := ret[0].([]redhatopenshift.Operation)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "901ad6b1e91ae9f896381af7f0532550", "score": "0.4912884", "text": "func TestCPUManagerAddWithResvList(t *testing.T) {\n\ttestPolicy, _ := NewStaticPolicy(\n\t\t&topology.CPUTopology{\n\t\t\tNumCPUs: 4,\n\t\t\tNumSockets: 1,\n\t\t\tNumCores: 4,\n\t\t\tCPUDetails: map[int]topology.CPUInfo{\n\t\t\t\t0: {CoreID: 0, SocketID: 0},\n\t\t\t\t1: {CoreID: 1, SocketID: 0},\n\t\t\t\t2: {CoreID: 2, SocketID: 0},\n\t\t\t\t3: {CoreID: 3, SocketID: 0},\n\t\t\t},\n\t\t},\n\t\t1,\n\t\tcpuset.New(0),\n\t\ttopologymanager.NewFakeManager(),\n\t\tnil)\n\ttestCases := []struct {\n\t\tdescription string\n\t\tupdateErr error\n\t\tpolicy Policy\n\t\texpCPUSet cpuset.CPUSet\n\t\texpAllocateErr error\n\t\texpAddContainerErr error\n\t}{\n\t\t{\n\t\t\tdescription: \"cpu manager add - no error\",\n\t\t\tupdateErr: nil,\n\t\t\tpolicy: testPolicy,\n\t\t\texpCPUSet: cpuset.New(0, 3),\n\t\t\texpAllocateErr: nil,\n\t\t\texpAddContainerErr: nil,\n\t\t},\n\t}\n\n\tfor _, testCase := range testCases {\n\t\tmgr := &manager{\n\t\t\tpolicy: testCase.policy,\n\t\t\tstate: &mockState{\n\t\t\t\tassignments: state.ContainerCPUAssignments{},\n\t\t\t\tdefaultCPUSet: cpuset.New(0, 1, 2, 3),\n\t\t\t},\n\t\t\tlastUpdateState: state.NewMemoryState(),\n\t\t\tcontainerRuntime: mockRuntimeService{\n\t\t\t\terr: testCase.updateErr,\n\t\t\t},\n\t\t\tcontainerMap: containermap.NewContainerMap(),\n\t\t\tpodStatusProvider: mockPodStatusProvider{},\n\t\t\tsourcesReady: &sourcesReadyStub{},\n\t\t}\n\n\t\tpod := makePod(\"fakePod\", \"fakeContainer\", \"2\", \"2\")\n\t\tcontainer := &pod.Spec.Containers[0]\n\t\tmgr.activePods = func() []*v1.Pod { return nil }\n\n\t\terr := mgr.Allocate(pod, container)\n\t\tif !reflect.DeepEqual(err, testCase.expAllocateErr) {\n\t\t\tt.Errorf(\"CPU Manager Allocate() error (%v). expected error: %v but got: %v\",\n\t\t\t\ttestCase.description, testCase.expAllocateErr, err)\n\t\t}\n\n\t\tmgr.AddContainer(pod, container, \"fakeID\")\n\t\t_, _, err = mgr.containerMap.GetContainerRef(\"fakeID\")\n\t\tif !reflect.DeepEqual(err, testCase.expAddContainerErr) {\n\t\t\tt.Errorf(\"CPU Manager AddContainer() error (%v). expected error: %v but got: %v\",\n\t\t\t\ttestCase.description, testCase.expAddContainerErr, err)\n\t\t}\n\t\tif !testCase.expCPUSet.Equals(mgr.state.GetDefaultCPUSet()) {\n\t\t\tt.Errorf(\"CPU Manager AddContainer() error (%v). expected cpuset: %v but got: %v\",\n\t\t\t\ttestCase.description, testCase.expCPUSet, mgr.state.GetDefaultCPUSet())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e85b4a4d4d9c536e8a6755165cf90a4a", "score": "0.4911883", "text": "func (m *MockRepo) ListClassrooms(arg0 context.Context, arg1, arg2 uint64) ([]models.Classroom, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListClassrooms\", arg0, arg1, arg2)\n\tret0, _ := ret[0].([]models.Classroom)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9dd2b695999cbccbe7c06c52525cbc17", "score": "0.4908702", "text": "func (m *MockCloudWatchAPI) ListDashboardsWithContext(arg0 context.Context, arg1 *cloudwatch.ListDashboardsInput, arg2 ...request.Option) (*cloudwatch.ListDashboardsOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListDashboardsWithContext\", varargs...)\n\tret0, _ := ret[0].(*cloudwatch.ListDashboardsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3a2c5da5666bea87a1a4b2bd3e53f825", "score": "0.49086806", "text": "func (m *MockEC2Client) CreateReservedInstancesListingWithContext(arg0 aws.Context, arg1 *ec2.CreateReservedInstancesListingInput, arg2 ...request.Option) (*ec2.CreateReservedInstancesListingOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CreateReservedInstancesListingWithContext\", varargs...)\n\tret0, _ := ret[0].(*ec2.CreateReservedInstancesListingOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "31d6fba85c4988db76161d454da81dfb", "score": "0.49076495", "text": "func (m *MockOntapAPI) QuotaEntryList(arg0 context.Context, arg1 string) (api.QuotaEntries, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"QuotaEntryList\", arg0, arg1)\n\tret0, _ := ret[0].(api.QuotaEntries)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b4129eca84416326535861793115e1f6", "score": "0.49066663", "text": "func (m *MockIAMAPI) ListPolicyVersionsWithContext(arg0 context.Context, arg1 *iam.ListPolicyVersionsInput, arg2 ...request.Option) (*iam.ListPolicyVersionsOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListPolicyVersionsWithContext\", varargs...)\n\tret0, _ := ret[0].(*iam.ListPolicyVersionsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "77e9b673c07dbedb5d6f26c40d0a0cbe", "score": "0.48997727", "text": "func TestListOutsideRoot(t *testing.T) {\n\tlister := mock.NewLister()\n\n\t// Instantiate in the current working directory, with no name.\n\tclient := fn.New(fn.WithLister(lister))\n\n\tif _, err := client.List(context.Background()); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif !lister.ListInvoked {\n\t\tt.Fatal(\"list did not invoke lister implementation\")\n\t}\n}", "title": "" }, { "docid": "86ef994d73608925b36b4cf3f61a6c35", "score": "0.48961842", "text": "func TestCSIHook_claimVolumesFromAlloc_Validation(t *testing.T) {\n\tci.Parallel(t)\n\n\talloc := mock.Alloc()\n\tlogger := testlog.HCLogger(t)\n\tvolumeRequests := map[string]*structs.VolumeRequest{\n\t\t\"vol0\": {\n\t\t\tName: \"vol0\",\n\t\t\tType: structs.VolumeTypeCSI,\n\t\t\tSource: \"testvolume0\",\n\t\t\tReadOnly: true,\n\t\t\tAccessMode: structs.CSIVolumeAccessModeSingleNodeReader,\n\t\t\tAttachmentMode: structs.CSIVolumeAttachmentModeFilesystem,\n\t\t\tMountOptions: &structs.CSIMountOptions{},\n\t\t\tPerAlloc: false,\n\t\t},\n\t}\n\n\ttype testCase struct {\n\t\tname string\n\t\tcaps *drivers.Capabilities\n\t\tcapFunc func() (*drivers.Capabilities, error)\n\t\texpectedClaimErr error\n\t}\n\n\ttestcases := []testCase{\n\t\t{\n\t\t\tname: \"invalid - driver does not support CSI\",\n\t\t\tcaps: &drivers.Capabilities{\n\t\t\t\tMountConfigs: drivers.MountConfigSupportNone,\n\t\t\t},\n\t\t\tcapFunc: nil,\n\t\t\texpectedClaimErr: errors.New(\"claim volumes: no task supports CSI\"),\n\t\t},\n\n\t\t{\n\t\t\tname: \"invalid - driver error\",\n\t\t\tcaps: &drivers.Capabilities{},\n\t\t\tcapFunc: func() (*drivers.Capabilities, error) {\n\t\t\t\treturn nil, errors.New(\"error thrown by driver\")\n\t\t\t},\n\t\t\texpectedClaimErr: errors.New(\"claim volumes: could not validate task driver capabilities: error thrown by driver\"),\n\t\t},\n\n\t\t{\n\t\t\tname: \"valid - driver supports CSI\",\n\t\t\tcaps: &drivers.Capabilities{\n\t\t\t\tMountConfigs: drivers.MountConfigSupportAll,\n\t\t\t},\n\t\t\tcapFunc: nil,\n\t\t\texpectedClaimErr: nil,\n\t\t},\n\t}\n\n\tfor _, tc := range testcases {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\talloc.Job.TaskGroups[0].Volumes = volumeRequests\n\n\t\t\tcallCounts := map[string]int{}\n\t\t\tmgr := mockPluginManager{mounter: mockVolumeMounter{callCounts: callCounts}}\n\n\t\t\trpcer := mockRPCer{\n\t\t\t\talloc: alloc,\n\t\t\t\tcallCounts: callCounts,\n\t\t\t\thasExistingClaim: pointer.Of(false),\n\t\t\t\tschedulable: pointer.Of(true),\n\t\t\t}\n\n\t\t\tar := mockAllocRunner{\n\t\t\t\tres: &cstructs.AllocHookResources{},\n\t\t\t\tcaps: tc.caps,\n\t\t\t\tcapFunc: tc.capFunc,\n\t\t\t}\n\n\t\t\thook := newCSIHook(alloc, logger, mgr, rpcer, ar, ar, \"secret\")\n\t\t\trequire.NotNil(t, hook)\n\n\t\t\tif tc.expectedClaimErr != nil {\n\t\t\t\trequire.EqualError(t, hook.Prerun(), tc.expectedClaimErr.Error())\n\t\t\t\tmounts := ar.GetAllocHookResources().GetCSIMounts()\n\t\t\t\trequire.Nil(t, mounts)\n\t\t\t} else {\n\t\t\t\trequire.NoError(t, hook.Prerun())\n\t\t\t\tmounts := ar.GetAllocHookResources().GetCSIMounts()\n\t\t\t\trequire.NotNil(t, mounts)\n\t\t\t\trequire.NoError(t, hook.Postrun())\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "72adab803c95b566254442a700c6f64e", "score": "0.48894787", "text": "func (m *MockEC2Client) MonitorInstancesWithContext(arg0 aws.Context, arg1 *ec2.MonitorInstancesInput, arg2 ...request.Option) (*ec2.MonitorInstancesOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"MonitorInstancesWithContext\", varargs...)\n\tret0, _ := ret[0].(*ec2.MonitorInstancesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "a9d03490d55d456640a7eac421d123f0", "score": "0.4877857", "text": "func TestGetAllInstances(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip(\"Skipping test in short mode\")\n\t}\n\tsessions, err := BuildSessions(GetAllRegions())\n\tif err != nil {\n\t\tt.Errorf(\"Unable to get sessions: %v\", err)\n\t}\n\tfor r, sess := range sessions {\n\t\tinstances, err := GetAllInstances(sess)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Failed to get Instances for region: %s because %v\", r, err)\n\t\t}\n\t\tt.Logf(\"Found %d instances in %s\", len(instances), r)\n\t}\n}", "title": "" }, { "docid": "8383a25fc41dfcd23967975bbc9b4a9e", "score": "0.4874402", "text": "func (m *MockOntapAPI) LunList(arg0 context.Context, arg1 string) (api.Luns, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LunList\", arg0, arg1)\n\tret0, _ := ret[0].(api.Luns)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "750a90969930d47bfb48535f16291e20", "score": "0.48631904", "text": "func (m *MockEC2Client) DescribeHostReservationsWithContext(arg0 aws.Context, arg1 *ec2.DescribeHostReservationsInput, arg2 ...request.Option) (*ec2.DescribeHostReservationsOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeHostReservationsWithContext\", varargs...)\n\tret0, _ := ret[0].(*ec2.DescribeHostReservationsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0eb861753f10e27af4b1c27004934d6d", "score": "0.48573115", "text": "func (m *MockInstanaAPI) BuiltinEventSpecifications() restapi.ReadOnlyRestResource {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"BuiltinEventSpecifications\")\n\tret0, _ := ret[0].(restapi.ReadOnlyRestResource)\n\treturn ret0\n}", "title": "" }, { "docid": "c3b3b04778eede3cd0b4b4a15f6a531e", "score": "0.4857029", "text": "func (m *MockIAMAPI) ListSSHPublicKeysWithContext(arg0 context.Context, arg1 *iam.ListSSHPublicKeysInput, arg2 ...request.Option) (*iam.ListSSHPublicKeysOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListSSHPublicKeysWithContext\", varargs...)\n\tret0, _ := ret[0].(*iam.ListSSHPublicKeysOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "35555a5338330688f42452c5f6616ed4", "score": "0.48544297", "text": "func (mr *MockEC2ClientMockRecorder) DescribeScheduledInstanceAvailabilityWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeScheduledInstanceAvailabilityWithContext\", reflect.TypeOf((*MockEC2Client)(nil).DescribeScheduledInstanceAvailabilityWithContext), varargs...)\n}", "title": "" }, { "docid": "de83738bcb4e104d6728ab6d1c05094e", "score": "0.48539227", "text": "func (m *MockIAMAPI) ListPolicyTagsWithContext(arg0 context.Context, arg1 *iam.ListPolicyTagsInput, arg2 ...request.Option) (*iam.ListPolicyTagsOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListPolicyTagsWithContext\", varargs...)\n\tret0, _ := ret[0].(*iam.ListPolicyTagsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "39b5ed6af29b3ab7c648fc01fc18ef1a", "score": "0.48533362", "text": "func (m *MockNetworkV1VirtualRouterPeeringGroupInterface) List(ctx context.Context, options *api.ListWatchOptions) ([]*network.VirtualRouterPeeringGroup, error) {\n\tret := m.ctrl.Call(m, \"List\", ctx, options)\n\tret0, _ := ret[0].([]*network.VirtualRouterPeeringGroup)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "38e624dbaca282f59c2a95d3b034eb1a", "score": "0.48532003", "text": "func (mr *MockEC2ClientMockRecorder) CreateReservedInstancesListingWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateReservedInstancesListingWithContext\", reflect.TypeOf((*MockEC2Client)(nil).CreateReservedInstancesListingWithContext), varargs...)\n}", "title": "" }, { "docid": "5c290affbecee6647cd142fcfb74526f", "score": "0.48485303", "text": "func (m *MockIAMAPI) ListAccessKeysWithContext(arg0 context.Context, arg1 *iam.ListAccessKeysInput, arg2 ...request.Option) (*iam.ListAccessKeysOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListAccessKeysWithContext\", varargs...)\n\tret0, _ := ret[0].(*iam.ListAccessKeysOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "340fe8bc3943dd5bebd55a1b75f89398", "score": "0.48415446", "text": "func (m *MockOntapAPI) NVMeNamespaceList(arg0 context.Context, arg1 string) (api.NVMeNamespaces, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NVMeNamespaceList\", arg0, arg1)\n\tret0, _ := ret[0].(api.NVMeNamespaces)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "88fb15e0f24694f8014dbd1f2cd2c491", "score": "0.4838863", "text": "func (m *MockEC2Client) DescribeReservedInstancesModifications(arg0 *ec2.DescribeReservedInstancesModificationsInput) (*ec2.DescribeReservedInstancesModificationsOutput, error) {\n\tret := m.ctrl.Call(m, \"DescribeReservedInstancesModifications\", arg0)\n\tret0, _ := ret[0].(*ec2.DescribeReservedInstancesModificationsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5c5cc5aa7e3cf9fcd4ed1e3467a4f065", "score": "0.4837497", "text": "func (m *FakeClient) List(arg0 context.Context, arg1 string) ([]v1.NetworkPolicy, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", arg0, arg1)\n\tret0, _ := ret[0].([]v1.NetworkPolicy)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ad5645fd54081341d40069e0dcbb98c6", "score": "0.48295632", "text": "func (m *MockClusterRoleBindingLister) List(arg0 string, arg1 labels.Selector) ([]*v10.ClusterRoleBinding, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", arg0, arg1)\n\tret0, _ := ret[0].([]*v10.ClusterRoleBinding)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "26253b32634bbb2f0bb836ca576e9c60", "score": "0.48252207", "text": "func (m *MockRateLimitConfigSet) List(filterResource ...func(*v1alpha1.RateLimitConfig) bool) []*v1alpha1.RateLimitConfig {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{}\n\tfor _, a := range filterResource {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"List\", varargs...)\n\tret0, _ := ret[0].([]*v1alpha1.RateLimitConfig)\n\treturn ret0\n}", "title": "" }, { "docid": "7ebad647e8e0040cf4101de1e8137dd2", "score": "0.48200577", "text": "func (m *MockMeshCataloger) ListAllowedOutboundServicesForIdentity(arg0 service.K8sServiceAccount) []service.MeshService {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListAllowedOutboundServicesForIdentity\", arg0)\n\tret0, _ := ret[0].([]service.MeshService)\n\treturn ret0\n}", "title": "" }, { "docid": "680e30ae6b2e03f08631cac9b3d9a3cb", "score": "0.48048705", "text": "func (m *MockINamingProxy) QueryInstancesOfService(serviceName, groupName, clusters string, udpPort int, healthyOnly bool) (*model.Service, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"QueryInstancesOfService\", serviceName, groupName, clusters, udpPort, healthyOnly)\n\tret0, _ := ret[0].(*model.Service)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "bddb00f9ce87a4e2f0121434cc64633c", "score": "0.47940955", "text": "func (m *MockAppClient) List(ctx context.Context, filter string) ([]graphrbac.Application, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", ctx, filter)\n\tret0, _ := ret[0].([]graphrbac.Application)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "6d9e61d6540074de6425f2b6718f489c", "score": "0.47819108", "text": "func (m *MockEC2Client) DescribeCapacityReservationsWithContext(arg0 aws.Context, arg1 *ec2.DescribeCapacityReservationsInput, arg2 ...request.Option) (*ec2.DescribeCapacityReservationsOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeCapacityReservationsWithContext\", varargs...)\n\tret0, _ := ret[0].(*ec2.DescribeCapacityReservationsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3b8b9ff169839fa80f9d670b54b40cbb", "score": "0.47787133", "text": "func (_m *MerlinClient) List(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*types.ListResponse, error) {\n\t_va := make([]interface{}, len(opts))\n\tfor _i := range opts {\n\t\t_va[_i] = opts[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, ctx, in)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 *types.ListResponse\n\tif rf, ok := ret.Get(0).(func(context.Context, *empty.Empty, ...grpc.CallOption) *types.ListResponse); ok {\n\t\tr0 = rf(ctx, in, opts...)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*types.ListResponse)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, *empty.Empty, ...grpc.CallOption) error); ok {\n\t\tr1 = rf(ctx, in, opts...)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "d5ed63a1a542023d23de3916cfec5046", "score": "0.47761494", "text": "func (m *MockCloudWatchAPI) ListMetricsWithContext(arg0 context.Context, arg1 *cloudwatch.ListMetricsInput, arg2 ...request.Option) (*cloudwatch.ListMetricsOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListMetricsWithContext\", varargs...)\n\tret0, _ := ret[0].(*cloudwatch.ListMetricsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "93da933514c46302b714e424bd578e44", "score": "0.47744662", "text": "func TestMemoryManagerRequestMemoryWithContext(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\tt.Parallel()\n\n\t// Create memory manager\n\tstopChan := make(chan struct{})\n\tmm := newMemoryManager(repairMemoryDefault, repairMemoryPriorityDefault, stopChan)\n\n\t// Get the total available memory\n\tmm.mu.Lock()\n\tavailable := mm.available\n\tmm.mu.Unlock()\n\n\t// Request all available memory\n\trequested := mm.Request(context.Background(), available, memoryPriorityHigh)\n\tif !requested {\n\t\tt.Fatal(\"Priority request should have succeeded\")\n\t}\n\n\t// Validate that requesting more memory blocks\n\tdoneChan := make(chan struct{})\n\tgo func() {\n\t\tmm.Request(context.Background(), 1, memoryPriorityHigh)\n\t\tclose(doneChan)\n\t}()\n\tselect {\n\tcase <-doneChan:\n\t\tt.Fatal(\"Priority request should have been blocking...\")\n\tcase <-time.After(time.Second):\n\t}\n\n\t// Validate the current status\n\tstatus := mm.callStatus()\n\tif status.PriorityAvailable != 0 || status.PriorityRequested != 1 {\n\t\tt.Fatal(\"unexpected\")\n\t}\n\n\t// Return some memory, this should unblock the previously queued request\n\tmm.Return(1)\n\tselect {\n\tcase <-time.After(time.Second):\n\t\tt.Fatal(\"Request should have been unblocked now\")\n\tcase <-doneChan:\n\t}\n\n\t// Validate the current status\n\tstatus = mm.callStatus()\n\tif status.PriorityAvailable != 0 || status.PriorityRequested != 0 {\n\t\tt.Fatal(\"unexpected\")\n\t}\n\n\t// Request some memory, this time pass a context that times out\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond)\n\tdefer cancel()\n\trequested = mm.Request(ctx, 10, memoryPriorityHigh)\n\tif requested {\n\t\tt.Fatal(\"Priority request should have timed out\")\n\t}\n\n\t// Validate the current status\n\tstatus = mm.callStatus()\n\tif status.PriorityAvailable != 0 || status.PriorityRequested != 0 {\n\t\tt.Fatal(\"unexpected\")\n\t}\n\n\t// Return all available memory\n\tmm.Return(available)\n\tstatus = mm.callStatus()\n\tif status.PriorityAvailable != available {\n\t\tt.Fatal(\"unexpected\")\n\t}\n}", "title": "" }, { "docid": "379d4a2618198d7cc9fd65198af39309", "score": "0.47742715", "text": "func (m *MockMeshCatalogDebugger) ListMonitoredNamespaces() []string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListMonitoredNamespaces\")\n\tret0, _ := ret[0].([]string)\n\treturn ret0\n}", "title": "" }, { "docid": "b5acaebf0f0e21453555794d9f9a6b4d", "score": "0.47734553", "text": "func (m *MockProvider) ListBlockVolumesForPod(podUID types.UID) (map[string]volume.BlockVolume, bool) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListBlockVolumesForPod\", podUID)\n\tret0, _ := ret[0].(map[string]volume.BlockVolume)\n\tret1, _ := ret[1].(bool)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9a595d0b047bb8a156daf2ae061a3a5e", "score": "0.4773075", "text": "func (m *MockRouteGuide_ListFeaturesClient) 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": "acd9b11d1dcb770d49f096df47c50e4f", "score": "0.47697255", "text": "func TestGetAvailableVersions(t *testing.T) {\n\tmock := getMockComponentVersions()\n\tvar mockVersions []types.ComponentVersion\n\t_ = json.Unmarshal(mock, &mockVersions)\n\tversions, err := GetAvailableVersions(testAvailableVersions{})\n\tassert.NoErr(t, err)\n\tassert.Equal(t, versions, mockVersions, \"component versions data\")\n\tversions, err = GetAvailableVersions(shouldBypassAvailableVersions{})\n\tassert.NoErr(t, err)\n\tassert.Equal(t, versions, mockVersions, \"component versions data\")\n}", "title": "" }, { "docid": "5bbfdc74b7364c44ce5a26873db11eca", "score": "0.47673586", "text": "func (m *MockRoleAssignmentsClient) List(ctx context.Context, filter string) ([]authorization.RoleAssignment, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", ctx, filter)\n\tret0, _ := ret[0].([]authorization.RoleAssignment)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "33e1f85cbc32b8d455a18d3aa3b0fccf", "score": "0.4761225", "text": "func (m *MockOntapAPI) GetSVMPeers(arg0 context.Context) ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetSVMPeers\", arg0)\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3390788e09775dc0368ee0f4bdfb9db0", "score": "0.47596154", "text": "func (m *MockVolumesService) List() ([]do.Volume, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\")\n\tret0, _ := ret[0].([]do.Volume)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7f34e1ae0b9af1591b230679735b1cbf", "score": "0.47582614", "text": "func (m *MockServiceFacilitator) GetReservationsAtSource(arg0 context.Context) ([]*segment.Reservation, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetReservationsAtSource\", arg0)\n\tret0, _ := ret[0].([]*segment.Reservation)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ec3f1ea8ff36b8a50fc546636f8f7ada", "score": "0.47545713", "text": "func (m *MockService) List(ctx context.Context, options api.ListOptions) ([]api.Stack, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", ctx, options)\n\tret0, _ := ret[0].([]api.Stack)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" } ]
78d651d786075b06b319cd850542f523
SetConfigFile provides a mock function with given fields: _a0
[ { "docid": "97f679568569d9e449c11e1a81936730", "score": "0.7390055", "text": "func (_m *Environment) SetConfigFile(_a0 string) {\n\t_m.Called(_a0)\n}", "title": "" } ]
[ { "docid": "52feee4ae15eb7b5398ec81488f596f1", "score": "0.66551113", "text": "func (_m *Repository) SetConfig(_a0 *config.Config) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*config.Config) error); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "3bdfce6285a0c574d8313f04a6fbdc1d", "score": "0.59104276", "text": "func (client *Client) SetConfigFile(fpath string) error {\n\tinfo, err := os.Stat(fpath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif info.IsDir() {\n\t\treturn fmt.Errorf(\"the specified config file path seems to be a directory\")\n\t}\n\tclient.ConfigFilePath = fpath\n\n\tclient.flagForInit()\n\n\treturn nil\n}", "title": "" }, { "docid": "d5787086734eaa8293beafe9645012ad", "score": "0.57887083", "text": "func (_m *CognitoIdentityProviderAPI) SetUserPoolMfaConfig(_a0 *cognitoidentityprovider.SetUserPoolMfaConfigInput) (*cognitoidentityprovider.SetUserPoolMfaConfigOutput, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *cognitoidentityprovider.SetUserPoolMfaConfigOutput\n\tif rf, ok := ret.Get(0).(func(*cognitoidentityprovider.SetUserPoolMfaConfigInput) *cognitoidentityprovider.SetUserPoolMfaConfigOutput); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*cognitoidentityprovider.SetUserPoolMfaConfigOutput)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*cognitoidentityprovider.SetUserPoolMfaConfigInput) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "964e11b5003a54b8f2e38e8c4c96b63e", "score": "0.5785213", "text": "func (cfg *BaseConfig) SetConfigFile(file string) {\n\tcfg.ConfigFile = file\n}", "title": "" }, { "docid": "6d7b5df6d13da240026b44c53e3966d3", "score": "0.5695805", "text": "func setFakeCredentials() {\n\n\t// Start with an empty configuration file content structure\n\tcfg := ini.Empty()\n\n\t// Populate it with the basics\n\tdefaultSection, err := cfg.NewSection(mfile.DefaultSectionName)\n\tdefaultSection.NewKey(mfile.AccessKeyIDKey, fakeAccessKeyID)\n\tdefaultSection.NewKey(mfile.SecretAccessKeyKey, fakeSecretAccessKey)\n\tdefaultSection.NewKey(mfile.MfaDeviceIDKey, fakeMFADeviceID)\n\n\t// Write the file\n\terr = cfg.SaveTo(fakeCredentialsFilePath)\n\n\t// That really should not faile to wrote, but if it did abort the tests\n\t// cos nothing will work after this\n\tif err != nil {\n\t\tfmt.Printf(\"\\nFailed to write fake credentials: %s\\n\", err.Error())\n\t\tos.Exit(999)\n\t}\n\n\t// All looks good - trick the package into using the fake file we just wrote\n\tmfile.OverrideDefaultCredentialsFilepath(fakeCredentialsFilePath)\n}", "title": "" }, { "docid": "db99007e49f835cfa9c79bd85c117514", "score": "0.56797373", "text": "func (mmUploadLogFile *mLogUploaderMockUploadLogFile) Set(f func(payload map[string]io.Reader) (err error)) *LogUploaderMock {\n\tif mmUploadLogFile.defaultExpectation != nil {\n\t\tmmUploadLogFile.mock.t.Fatalf(\"Default expectation is already set for the LogUploader.UploadLogFile method\")\n\t}\n\n\tif len(mmUploadLogFile.expectations) > 0 {\n\t\tmmUploadLogFile.mock.t.Fatalf(\"Some expectations are already set for the LogUploader.UploadLogFile method\")\n\t}\n\n\tmmUploadLogFile.mock.funcUploadLogFile = f\n\treturn mmUploadLogFile.mock\n}", "title": "" }, { "docid": "a3f9c33eed37692fbfff3e5cc809976b", "score": "0.5523092", "text": "func (_m *mockContext) SetState(_a0 map[string][]byte) ([]string, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 []string\n\tif rf, ok := ret.Get(0).(func(map[string][]byte) []string); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]string)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(map[string][]byte) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "7e8c2cca4ac288b3ef7342a75b25803a", "score": "0.54888123", "text": "func SetConfigFile(s string) func(*WholeGame) error {\n\treturn func(w *WholeGame) error {\n\t\tw.configfile = s\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "97e146a5ede053a59ec5b7dbf1b1d347", "score": "0.54412675", "text": "func mockConfigDir() (string, error) {\n\treturn \"/tmp/CONFIG/datamaps/\", nil\n}", "title": "" }, { "docid": "467e7515f44b37e0f27f2d8aabdfdb0d", "score": "0.54184747", "text": "func (_m *Knapsack) SetLogIngestServerURL(url string) error {\n\tret := _m.Called(url)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(url)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "a96ac566abfed0d05ee13f1f5d55f42d", "score": "0.5415673", "text": "func (_m *Keyring) Set(_a0 keyring.Item) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(keyring.Item) error); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "f752f7d783ad77506a2c29095ac89f16", "score": "0.53956205", "text": "func (_m *CognitoIdentityProviderAPI) SetRiskConfiguration(_a0 *cognitoidentityprovider.SetRiskConfigurationInput) (*cognitoidentityprovider.SetRiskConfigurationOutput, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *cognitoidentityprovider.SetRiskConfigurationOutput\n\tif rf, ok := ret.Get(0).(func(*cognitoidentityprovider.SetRiskConfigurationInput) *cognitoidentityprovider.SetRiskConfigurationOutput); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*cognitoidentityprovider.SetRiskConfigurationOutput)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*cognitoidentityprovider.SetRiskConfigurationInput) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "70164549386c12e667776704db0d4a4e", "score": "0.53804064", "text": "func (_m *CognitoIdentityProviderAPI) SetUserPoolMfaConfigRequest(_a0 *cognitoidentityprovider.SetUserPoolMfaConfigInput) (*request.Request, *cognitoidentityprovider.SetUserPoolMfaConfigOutput) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *request.Request\n\tif rf, ok := ret.Get(0).(func(*cognitoidentityprovider.SetUserPoolMfaConfigInput) *request.Request); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*request.Request)\n\t\t}\n\t}\n\n\tvar r1 *cognitoidentityprovider.SetUserPoolMfaConfigOutput\n\tif rf, ok := ret.Get(1).(func(*cognitoidentityprovider.SetUserPoolMfaConfigInput) *cognitoidentityprovider.SetUserPoolMfaConfigOutput); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(*cognitoidentityprovider.SetUserPoolMfaConfigOutput)\n\t\t}\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "50c484aab35e3c58594f2b10b1c877ba", "score": "0.53796935", "text": "func setConfigFile(etcdConf *embetcd.Config, max int, min int, check int) (configFilePath string, tempDir string) {\n\t// get a temporary directory for the etcd data directory\n\ttempDir, err := ioutil.TempDir(\"\", \"TestProxyCluster\")\n\tSo(err, ShouldBeNil)\n\tSo(os.RemoveAll(tempDir), ShouldBeNil)\n\n\t// get a temporary filename for the config file\n\tfileObj, err := ioutil.TempFile(\"\", \"TestProxyClusterConfig\")\n\tSo(err, ShouldBeNil)\n\tconfigFilePath = fileObj.Name()\n\t// remove the temp file so we can overwrite it\n\tSo(os.Remove(configFilePath), ShouldBeNil)\n\n\t//// remove the temp dir so we can recreate it\n\n\tproxyConf := configEtcd\n\tproxyConf = strings.Replace(proxyConf, \"<<MAX>>\", strconv.FormatInt(int64(max), 10), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<MIN>>\", strconv.FormatInt(int64(min), 10), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<CHECK>>\", strconv.FormatInt(int64(check), 10), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<LPADDRESS>>\", etcdConf.LPUrls[0].String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<APADDRESS>>\", etcdConf.APUrls[0].String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<LCADDRESS>>\", etcdConf.LCUrls[0].String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<ACADDRESS>>\", etcdConf.ACUrls[0].String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<MADDRESS>>\", etcdConf.ListenMetricsUrls[0].String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<UNHEALTHYTTL>>\", etcdConf.UnhealthyTTL.String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<REMOVEMEMBERTIMEOUT>>\", etcdConf.RemoveMemberTimeout.String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<DATADIR>>\", filepath.Join(tempDir, etcdConf.Dir), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<CLUSTEROP>>\", etcdConf.ClusterState, -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<TARGETADDRESSES>>\", formatTargetAddresses(etcdConf.InitialCluster), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<SERVERNAME>>\", etcdConf.Name, -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<CLUSTERNAME>>\", etcdConf.ClusterName, -1)\n\n\tSo(ioutil.WriteFile(path.Join(configFilePath), []byte(proxyConf), os.FileMode(0666)), ShouldBeNil)\n\treturn configFilePath, tempDir\n}", "title": "" }, { "docid": "e4697e4990158474154dd24319f8cfe7", "score": "0.53340286", "text": "func (_m *Driver) SetClient(cfg config.DatabaseConfig) error {\n\tret := _m.Called(cfg)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(config.DatabaseConfig) error); ok {\n\t\tr0 = rf(cfg)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "6299bda5a89167fe7b4a87ad364d1aa5", "score": "0.5333596", "text": "func SetConfig(file string) {\n\tPath.configFile = file\n}", "title": "" }, { "docid": "faf5267895b40fa5b0b68dc3e2d8c424", "score": "0.533277", "text": "func (_m *ServerConnexion) FileSize(path string) (int64, error) {\n\tret := _m.Called(path)\n\n\tvar r0 int64\n\tif rf, ok := ret.Get(0).(func(string) int64); ok {\n\t\tr0 = rf(path)\n\t} else {\n\t\tr0 = ret.Get(0).(int64)\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string) error); ok {\n\t\tr1 = rf(path)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "ead49fc62c6b7d796705c66af03905ec", "score": "0.53269815", "text": "func (_m *LambdaAPI) UpdateFunctionConfiguration(_a0 *lambda.UpdateFunctionConfigurationInput) (*lambda.FunctionConfiguration, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *lambda.FunctionConfiguration\n\tif rf, ok := ret.Get(0).(func(*lambda.UpdateFunctionConfigurationInput) *lambda.FunctionConfiguration); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*lambda.FunctionConfiguration)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*lambda.UpdateFunctionConfigurationInput) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "68903f6c826a0522fbe0cca782330224", "score": "0.5314376", "text": "func (m *GGCRImage) ConfigFile() (*v1.ConfigFile, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ConfigFile\")\n\tret0, _ := ret[0].(*v1.ConfigFile)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "73886e29c5095ad204687aeb31093ff3", "score": "0.53046054", "text": "func (_m *Knapsack) SetTraceIngestServerURL(url string) error {\n\tret := _m.Called(url)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(url)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "e9657e38970b86d142bf38b1989d62c3", "score": "0.53039813", "text": "func (m *MockTenantServiceConfigFileDao) GetConfigFileByServiceID(serviceID string) ([]*model.TenantServiceConfigFile, error) {\n\tret := m.ctrl.Call(m, \"GetConfigFileByServiceID\", serviceID)\n\tret0, _ := ret[0].([]*model.TenantServiceConfigFile)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3119a31de58388bda1496e55311796c5", "score": "0.52908105", "text": "func (m *MockManager) SerializeConfig(arg0 []api.Asset, arg1 api.ReleaseMetadata, arg2 map[string]interface{}) error {\n\tret := m.ctrl.Call(m, \"SerializeConfig\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "9a04f01834fc6773f82cd4be21911c63", "score": "0.52621186", "text": "func (_m *CognitoIdentityProviderAPI) SetUserSettings(_a0 *cognitoidentityprovider.SetUserSettingsInput) (*cognitoidentityprovider.SetUserSettingsOutput, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *cognitoidentityprovider.SetUserSettingsOutput\n\tif rf, ok := ret.Get(0).(func(*cognitoidentityprovider.SetUserSettingsInput) *cognitoidentityprovider.SetUserSettingsOutput); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*cognitoidentityprovider.SetUserSettingsOutput)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*cognitoidentityprovider.SetUserSettingsInput) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "b632e50f7ecd6060e6531747c08749e9", "score": "0.52518815", "text": "func (_m *DirectRepositoryWriter) ConfigFilename() 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": "7d512021c39b73ebaf69abd1582facb5", "score": "0.52499664", "text": "func (_m *Knapsack) SetControlServerURL(url string) error {\n\tret := _m.Called(url)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(url)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "73b6597fd1be2a4c2aef2ce2a0854c34", "score": "0.52285033", "text": "func (_m *Knapsack) SetMirrorServerURL(url string) error {\n\tret := _m.Called(url)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(url)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "d19233f4d57149a65bac57a88d0083ab", "score": "0.5220184", "text": "func (_m *OSIOAPI) WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tret := _m.Called(filename, data, perm)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, []byte, os.FileMode) error); ok {\n\t\tr0 = rf(filename, data, perm)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "10ea50ae6ad5998356e0eb1f54d7ce6b", "score": "0.5211227", "text": "func TestSetConfigFromFlags(t *testing.T) {\n\t// create a test file and open it\n\ttmpfile, err := ioutil.TempFile(\"\", \"mockconfig\") //create tempfile and open it\n\tif err != nil {\n\t\tt.Errorf(\"failed to open temp file\")\n\t}\n\n\t// defer close and remove\n\tdefer func() {\n\t\terr := tmpfile.Close() //closes file\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Failed to remove database: %s\", err)\n\t\t}\n\n\t\terr = os.Remove(tmpfile.Name()) //deletes the file\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Failed to remove database: %s\", err)\n\n\t\t}\n\t}()\n\n\t// create config to be loaded into file\n\texpectedCfg := config.Config{1, 20, \"5000\", \"40s\", false, \"\"}\n\n\t// convert to bytes\n\tmarshalledCfg, err := json.Marshal(expectedCfg)\n\tif err != nil {\n\t\tt.Errorf(\"failed to marshall configuration struct: %v\", err)\n\t}\n\n\t// write to temp file\n\terr = ioutil.WriteFile(tmpfile.Name(), marshalledCfg, 0644)\n\tif err != nil {\n\t\tt.Errorf(\"failed to write file %v\", err)\n\t}\n\n\tactualCfg, err := SetConfigFromFlags(tmpfile)\n\n\tif !reflect.DeepEqual(actualCfg, expectedCfg) {\n\t\tt.Errorf(\"the Config structs are not equal: Wanted %v, Got %v\", actualCfg, expectedCfg)\n\t}\n\n}", "title": "" }, { "docid": "3769aec95dfb69a8f187976494744327", "score": "0.51623493", "text": "func (_m *MockENotifyingList) Set(_a0 int, _a1 interface{}) interface{} {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 interface{}\n\tif rf, ok := ret.Get(0).(func(int, interface{}) interface{}); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(interface{})\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "b63d2cbc83ad7b221fdc1dd8cba6b95a", "score": "0.51586086", "text": "func (_m *Knapsack) SetKolideServerURL(url string) error {\n\tret := _m.Called(url)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(url)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "86f0e910df2fc04a8d6eb33a9fc0ac64", "score": "0.5152104", "text": "func (_m *HadolintPiperFileUtils) FileWrite(filename string, data []byte, perm os.FileMode) error {\n\tret := _m.Called(filename, data, perm)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, []byte, os.FileMode) error); ok {\n\t\tr0 = rf(filename, data, perm)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "2fb3e2082f9d164a7ecfe1dd26ed7872", "score": "0.51516205", "text": "func (_m *RunInterface) PutOutputFromFile(path string) error {\n\tret := _m.Called(path)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(path)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "eb7bc36954724c1dd6fab839ec1c04da", "score": "0.51485276", "text": "func mockFile() *File {\n\tf := NewFile()\n\tf.SetHeader(mockFileHeader())\n\tclh := mockCashLetterHeader()\n\tmockCashLetter := NewCashLetter(clh)\n\tmockCashLetter.CashLetterControl = mockCashLetterControl()\n\tf.AddCashLetter(mockCashLetter)\n\tif err := f.Create(); err != nil {\n\t\tpanic(err)\n\t}\n\treturn f\n}", "title": "" }, { "docid": "e21f257e15998d2af5ec707bb5133b1d", "score": "0.5127962", "text": "func (_m *IRsaClientDeps) AwsConfig(_a0 log.T, appConfig appconfig.SsmagentConfig, service string, region string) *aws.Config {\n\tret := _m.Called(_a0, appConfig, service, region)\n\n\tvar r0 *aws.Config\n\tif rf, ok := ret.Get(0).(func(log.T, appconfig.SsmagentConfig, string, string) *aws.Config); ok {\n\t\tr0 = rf(_a0, appConfig, service, region)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*aws.Config)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "b917f83bb6447286b4f8a358a9e7b198", "score": "0.5113375", "text": "func (m *MockConn) Set(path string, data []byte, version int32) (*zk.Stat, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Set\", path, data, version)\n\tret0, _ := ret[0].(*zk.Stat)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "809ce278d5fca2f5d723926c5660174a", "score": "0.5112188", "text": "func (_m *CognitoIdentityProviderAPI) SetRiskConfigurationRequest(_a0 *cognitoidentityprovider.SetRiskConfigurationInput) (*request.Request, *cognitoidentityprovider.SetRiskConfigurationOutput) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *request.Request\n\tif rf, ok := ret.Get(0).(func(*cognitoidentityprovider.SetRiskConfigurationInput) *request.Request); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*request.Request)\n\t\t}\n\t}\n\n\tvar r1 *cognitoidentityprovider.SetRiskConfigurationOutput\n\tif rf, ok := ret.Get(1).(func(*cognitoidentityprovider.SetRiskConfigurationInput) *cognitoidentityprovider.SetRiskConfigurationOutput); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(*cognitoidentityprovider.SetRiskConfigurationOutput)\n\t\t}\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "cbb3cbd4fc3c13699bcdb500dc8d5ecd", "score": "0.5105249", "text": "func (_m *MockBackend) Set(key string, entry *Entry) error {\n\tret := _m.Called(key, entry)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, *Entry) error); ok {\n\t\tr0 = rf(key, entry)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "9b5d1762c014581f840327eca9055eee", "score": "0.5084279", "text": "func (_m *SecretClient) Set(name string, val string) error {\n\tret := _m.Called(name, val)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, string) error); ok {\n\t\tr0 = rf(name, val)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "78d0e6c953e976871ac6b1e3c66c3456", "score": "0.5063278", "text": "func (_m *DynamoDBAPIMock) UpdateGlobalTableSettings(_a0 *dynamodb.UpdateGlobalTableSettingsInput) (*dynamodb.UpdateGlobalTableSettingsOutput, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *dynamodb.UpdateGlobalTableSettingsOutput\n\tif rf, ok := ret.Get(0).(func(*dynamodb.UpdateGlobalTableSettingsInput) *dynamodb.UpdateGlobalTableSettingsOutput); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*dynamodb.UpdateGlobalTableSettingsOutput)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*dynamodb.UpdateGlobalTableSettingsInput) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "da864b197c69442cb1768300ba28e9a2", "score": "0.50462145", "text": "func (_m *LambdaAPI) UpdateFunctionCode(_a0 *lambda.UpdateFunctionCodeInput) (*lambda.FunctionConfiguration, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *lambda.FunctionConfiguration\n\tif rf, ok := ret.Get(0).(func(*lambda.UpdateFunctionCodeInput) *lambda.FunctionConfiguration); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*lambda.FunctionConfiguration)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*lambda.UpdateFunctionCodeInput) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "34c4f0d3bb00e770551e09969a2efa49", "score": "0.50406706", "text": "func ensureConfigFile(files map[string][]CfgMeta, fileName string, configDir string) (map[string][]CfgMeta, error) {\n\tif _, ok := files[fileName]; ok {\n\t\treturn files, nil\n\t}\n\tif configDir == \"\" {\n\t\treturn files, errors.New(\"required file '\" + fileName + \"' has no location Parameter, and ATS config directory not found.\")\n\t}\n\tfiles[fileName] = []CfgMeta{{\n\t\tName: fileName,\n\t\tPath: configDir,\n\t}}\n\treturn files, nil\n}", "title": "" }, { "docid": "6f7fa2420f0b00c67e7ad4b0f060b291", "score": "0.50365174", "text": "func TestGetConfigFile(t *testing.T) {\n\tvar md toml.MetaData\n\tfor _, testFile := range TestFiles {\n\t\tos.Args = []string{os.Args[0], \"--conf=\" + testFile.filename}\n\t\treturnedmd, res := getConfigFile()\n\t\tif res != testFile.passing {\n\t\t\tif testFile.passing {\n\t\t\t\tassert.NotEqual(t, md, returnedmd, \"The config from the PagerDutyConfig should not be empty\")\n\t\t\t} else {\n\t\t\t\tt.Errorf(\"Expected %s to fail, but it did not\", testFile.filename)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "73b613fe8a09da6e3dde14a109a318d4", "score": "0.50260544", "text": "func (mmUploadLogFile *mLogUploaderMockUploadLogFile) When(payload map[string]io.Reader) *LogUploaderMockUploadLogFileExpectation {\n\tif mmUploadLogFile.mock.funcUploadLogFile != nil {\n\t\tmmUploadLogFile.mock.t.Fatalf(\"LogUploaderMock.UploadLogFile mock is already set by Set\")\n\t}\n\n\texpectation := &LogUploaderMockUploadLogFileExpectation{\n\t\tmock: mmUploadLogFile.mock,\n\t\tparams: &LogUploaderMockUploadLogFileParams{payload},\n\t}\n\tmmUploadLogFile.expectations = append(mmUploadLogFile.expectations, expectation)\n\treturn expectation\n}", "title": "" }, { "docid": "b5f267f9b6b746e7d5423264657d5e33", "score": "0.5014109", "text": "func (_m *LambdaAPI) UpdateEventSourceMapping(_a0 *lambda.UpdateEventSourceMappingInput) (*lambda.EventSourceMappingConfiguration, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *lambda.EventSourceMappingConfiguration\n\tif rf, ok := ret.Get(0).(func(*lambda.UpdateEventSourceMappingInput) *lambda.EventSourceMappingConfiguration); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*lambda.EventSourceMappingConfiguration)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*lambda.UpdateEventSourceMappingInput) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "3ada04bb7ee64d451b64f065c134d445", "score": "0.501101", "text": "func (_m *Forge) File(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]byte, error) {\n\tret := _m.Called(ctx, u, r, b, f)\n\n\tvar r0 []byte\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) ([]byte, error)); ok {\n\t\treturn rf(ctx, u, r, b, f)\n\t}\n\tif rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) []byte); ok {\n\t\tr0 = rf(ctx, u, r, b, f)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]byte)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) error); ok {\n\t\tr1 = rf(ctx, u, r, b, f)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "92ab4f2973e01614a3d28a4313c3aa10", "score": "0.50016797", "text": "func (cli *FakeDatabaseClient) RecoverConfigFile(ctx context.Context, in *dbdpb.RecoverConfigFileRequest, opts ...grpc.CallOption) (*dbdpb.RecoverConfigFileResponse, error) {\n\tpanic(\"implement me\")\n}", "title": "" }, { "docid": "57b24855b6c9a935ea0ec360e5049dd3", "score": "0.4999412", "text": "func (_m *Remote) File(u *model.User, r *model.Repo, b *model.Build, f string) ([]byte, error) {\n\tret := _m.Called(u, r, b, f)\n\n\tvar r0 []byte\n\tif rf, ok := ret.Get(0).(func(*model.User, *model.Repo, *model.Build, string) []byte); ok {\n\t\tr0 = rf(u, r, b, f)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]byte)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*model.User, *model.Repo, *model.Build, string) error); ok {\n\t\tr1 = rf(u, r, b, f)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "80773b7234bb8ad125cdbbc297e18af0", "score": "0.49931136", "text": "func mockEdit() {\n\tEdit = func(path string, filedata []byte) ([]byte, error) {\n\t\treturn filedata, nil\n\t}\n}", "title": "" }, { "docid": "75e9c97e947c8a85a4fac4c4f2ff35fd", "score": "0.4991078", "text": "func SetConfig() {\n\tdata := openFile()\n\t&Cfg = data\n}", "title": "" }, { "docid": "668b424e9841515c59a249228a787673", "score": "0.49843106", "text": "func (_m *Knapsack) SetTufServerURL(url string) error {\n\tret := _m.Called(url)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(url)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "de8edf7c438a20c910cca28ebd2cfc9c", "score": "0.49824807", "text": "func (_m *DataStoreTxn) Set(key []byte, value []byte) error {\n\tret := _m.Called(key, value)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func([]byte, []byte) error); ok {\n\t\tr0 = rf(key, value)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "70481f674db9f644332b52836720a3ba", "score": "0.497269", "text": "func (t *DataProcessorTask) SetConfigFile(file ...string) *DataProcessorTask {\n\treturn t.Set(ConfigFiles, file...)\n}", "title": "" }, { "docid": "9f2626b20e6cdc209f1e46506c39b1d1", "score": "0.49710476", "text": "func (_m *MockAggregate) setVersion(_a0 int) {\n\t_m.Called(_a0)\n}", "title": "" }, { "docid": "ae099f6d3346656763b2f6f54d3054a6", "score": "0.49639243", "text": "func (_m *ICacheInteractor) Set(key string, value cache.CachedResponse) error {\n\tret := _m.Called(key, value)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, cache.CachedResponse) error); ok {\n\t\tr0 = rf(key, value)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "cd44aed58ddb90b63683aa497c9a68a6", "score": "0.49609038", "text": "func (_m *LambdaAPI) UpdateFunctionConfigurationRequest(_a0 *lambda.UpdateFunctionConfigurationInput) (*request.Request, *lambda.FunctionConfiguration) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *request.Request\n\tif rf, ok := ret.Get(0).(func(*lambda.UpdateFunctionConfigurationInput) *request.Request); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*request.Request)\n\t\t}\n\t}\n\n\tvar r1 *lambda.FunctionConfiguration\n\tif rf, ok := ret.Get(1).(func(*lambda.UpdateFunctionConfigurationInput) *lambda.FunctionConfiguration); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(*lambda.FunctionConfiguration)\n\t\t}\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "4d6811a16f49a7e04daeb279768099c0", "score": "0.494861", "text": "func (m *MockCacheOptions) SetFilesystemOptions(value fs.Options) CacheOptions {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetFilesystemOptions\", value)\n\tret0, _ := ret[0].(CacheOptions)\n\treturn ret0\n}", "title": "" }, { "docid": "62983486c591abbed7b5bb9b184beda8", "score": "0.4941058", "text": "func (_m *Client) GetFile(_a0 context.Context, _a1 build.GetFileArgs) (io.ReadCloser, error) {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 io.ReadCloser\n\tif rf, ok := ret.Get(0).(func(context.Context, build.GetFileArgs) io.ReadCloser); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(io.ReadCloser)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, build.GetFileArgs) error); ok {\n\t\tr1 = rf(_a0, _a1)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "a5bffd3a7a5a3ec4d0cdf2e63a6f6f21", "score": "0.4929801", "text": "func mockFileControl() FileControl {\n\tfc := NewFileControl()\n\tfc.CashLetterCount = 1\n\tfc.TotalRecordCount = 7\n\tfc.TotalItemCount = 1\n\tfc.FileTotalAmount = 100000 //1000.00\n\tfc.ImmediateOriginContactName = \"Contact Name\"\n\tfc.ImmediateOriginContactPhoneNumber = \"5558675552\"\n\tfc.CreditTotalIndicator = 0\n\treturn fc\n}", "title": "" }, { "docid": "d8c0fbae9bf62476ec6bd4ecde46b6eb", "score": "0.49281228", "text": "func (_m *Knapsack) SetNotaryServerURL(url string) error {\n\tret := _m.Called(url)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(url)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "f20b47e792663300cdf0f8da97a66052", "score": "0.4905795", "text": "func (_m *CognitoIdentityProviderAPI) GetUserPoolMfaConfig(_a0 *cognitoidentityprovider.GetUserPoolMfaConfigInput) (*cognitoidentityprovider.GetUserPoolMfaConfigOutput, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *cognitoidentityprovider.GetUserPoolMfaConfigOutput\n\tif rf, ok := ret.Get(0).(func(*cognitoidentityprovider.GetUserPoolMfaConfigInput) *cognitoidentityprovider.GetUserPoolMfaConfigOutput); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*cognitoidentityprovider.GetUserPoolMfaConfigOutput)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*cognitoidentityprovider.GetUserPoolMfaConfigInput) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "8a3f0d2d99b6ead474100fabe72f50c8", "score": "0.48956117", "text": "func (_m *CognitoIdentityProviderAPI) SetUserSettingsRequest(_a0 *cognitoidentityprovider.SetUserSettingsInput) (*request.Request, *cognitoidentityprovider.SetUserSettingsOutput) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *request.Request\n\tif rf, ok := ret.Get(0).(func(*cognitoidentityprovider.SetUserSettingsInput) *request.Request); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*request.Request)\n\t\t}\n\t}\n\n\tvar r1 *cognitoidentityprovider.SetUserSettingsOutput\n\tif rf, ok := ret.Get(1).(func(*cognitoidentityprovider.SetUserSettingsInput) *cognitoidentityprovider.SetUserSettingsOutput); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(*cognitoidentityprovider.SetUserSettingsOutput)\n\t\t}\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "74f16f3b95d8e929b29b448e6ba7ae61", "score": "0.4889275", "text": "func (_m *Asconn) SetTimeout(_a0 time.Time, _a1 time.Duration) aerospike.Error {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 aerospike.Error\n\tif rf, ok := ret.Get(0).(func(time.Time, time.Duration) aerospike.Error); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(aerospike.Error)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "a8f96165d2085b51bd7ac1c63cf46373", "score": "0.4887084", "text": "func (_m *CognitoIdentityProviderAPI) AdminSetUserSettings(_a0 *cognitoidentityprovider.AdminSetUserSettingsInput) (*cognitoidentityprovider.AdminSetUserSettingsOutput, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *cognitoidentityprovider.AdminSetUserSettingsOutput\n\tif rf, ok := ret.Get(0).(func(*cognitoidentityprovider.AdminSetUserSettingsInput) *cognitoidentityprovider.AdminSetUserSettingsOutput); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*cognitoidentityprovider.AdminSetUserSettingsOutput)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*cognitoidentityprovider.AdminSetUserSettingsInput) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "a0eced6588ade699a95d00c4de715449", "score": "0.48688826", "text": "func (m *MockLoadedConfigurations) ConfigurationPath(arg0 string) *string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ConfigurationPath\", arg0)\n\tret0, _ := ret[0].(*string)\n\treturn ret0\n}", "title": "" }, { "docid": "9a55c4570a8389e1901c4820f3bbaffc", "score": "0.48647004", "text": "func (_m *Worktree) Commit(_a0 string, _a1 *git.CommitOptions) (plumbing.Hash, error) {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 plumbing.Hash\n\tif rf, ok := ret.Get(0).(func(string, *git.CommitOptions) plumbing.Hash); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(plumbing.Hash)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string, *git.CommitOptions) error); ok {\n\t\tr1 = rf(_a0, _a1)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "258d6304d336b448a468b3d9110ce9c1", "score": "0.4862247", "text": "func (m *MockSettings) SetMaxLineSize(arg0 int) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetMaxLineSize\", arg0)\n}", "title": "" }, { "docid": "0dcdea941252000643b9ed44661da46a", "score": "0.48606616", "text": "func NewConfigFile(path string) (self *ConfigFile, err error) {\n\tself = &ConfigFile{\n\t\tLocalSmartServer: \"127.0.0.1:1315\",\n\t\tLocalNormalServer: \"127.0.0.1:1316\",\n\t}\n\tbuf, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = json.Unmarshal(buf, self)\n\tif err != nil {\n\t\treturn\n\t}\n\tself.PrivateKey = os.ExpandEnv(self.PrivateKey)\n\tsort.Strings(self.BlockedList)\n\treturn\n}", "title": "" }, { "docid": "f9e0a81c483f4c6ace4c953fc3097aff", "score": "0.48520887", "text": "func (m *MockFullNode) MpoolSetConfig(arg0 context.Context, arg1 *types0.MpoolConfig) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"MpoolSetConfig\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "91003315f953cdc8f7e52996441983f7", "score": "0.48448193", "text": "func (_m *MockRepository) UpdateACO(ctx context.Context, acoUUID uuid.UUID, fieldsAndValues map[string]interface{}) error {\n\tret := _m.Called(ctx, acoUUID, fieldsAndValues)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, uuid.UUID, map[string]interface{}) error); ok {\n\t\tr0 = rf(ctx, acoUUID, fieldsAndValues)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "71e349252506047104eb554d66a96b05", "score": "0.48437664", "text": "func setupFileConfiguration(t *testing.T, configContent string) string {\n\tfile, err := ioutil.TempFile(\"\", \"ecs-test\")\n\trequire.NoError(t, err, \"creating temp file for configuration failed\")\n\n\t_, err = file.Write([]byte(configContent))\n\trequire.NoError(t, err, \"writing configuration to file failed\")\n\n\treturn file.Name()\n}", "title": "" }, { "docid": "16d9f01867664cace6a8907de29477e6", "score": "0.4831872", "text": "func (_m *Cache) Set(key string, value interface{}) error {\n\tret := _m.Called(key, value)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, interface{}) error); ok {\n\t\tr0 = rf(key, value)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "1192061e50baaf9e2b253f96f1b58222", "score": "0.4830037", "text": "func (mmClone *mStorageMockClone) Set(f func(ctx context.Context, from insolar.PulseNumber, to insolar.PulseNumber, keepActual bool) (err error)) *StorageMock {\n\tif mmClone.defaultExpectation != nil {\n\t\tmmClone.mock.t.Fatalf(\"Default expectation is already set for the Storage.Clone method\")\n\t}\n\n\tif len(mmClone.expectations) > 0 {\n\t\tmmClone.mock.t.Fatalf(\"Some expectations are already set for the Storage.Clone method\")\n\t}\n\n\tmmClone.mock.funcClone = f\n\treturn mmClone.mock\n}", "title": "" }, { "docid": "0bb2ecb1aad49ccdf25103fafe46fd77", "score": "0.4828308", "text": "func (_m *MockDataReceiverService_PutMetricServer) SetHeader(_a0 metadata.MD) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(metadata.MD) error); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "774835e7ee4dd3e234bbc6223433539c", "score": "0.48217785", "text": "func (m *MockTx) Config() (map[string]string, error) {\n\tret := m.ctrl.Call(m, \"Config\")\n\tret0, _ := ret[0].(map[string]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9fe2543da1eb61245358dc68a071ed03", "score": "0.48157635", "text": "func TestConfigSet(t *testing.T) {\n\tis := is.New(t)\n\n\tCleanEnv()\n\tdir, fixture, err := FixtureDir()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tconfig, err := New(dir)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tis.Equal(fixture[\"endpoint\"], config.GetIgnoreErr(\"endpoint\"))\n\tis.Equal(fixture[\"auth-endpoint\"], config.GetIgnoreErr(\"auth-endpoint\"))\n\tis.Equal(fixture[\"user\"], config.GetIgnoreErr(\"user\"))\n\tis.Equal(fixture[\"account\"], config.GetIgnoreErr(\"account\"))\n\tis.Equal(fixture[\"debug-level\"], config.GetIgnoreErr(\"debug-level\"))\n\n\tconfig.Set(\"user\", \"test-user\", \"TEST\")\n\tfixture[\"user\"] = \"test-user\"\n\n\tis.Equal(fixture[\"endpoint\"], config.GetIgnoreErr(\"endpoint\"))\n\tis.Equal(fixture[\"auth-endpoint\"], config.GetIgnoreErr(\"auth-endpoint\"))\n\tis.Equal(fixture[\"user\"], config.GetIgnoreErr(\"user\"))\n\tis.Equal(fixture[\"account\"], config.GetIgnoreErr(\"account\"))\n\tis.Equal(fixture[\"debug-level\"], config.GetIgnoreErr(\"debug-level\"))\n\t_ = os.RemoveAll(dir)\n}", "title": "" }, { "docid": "9c710331ca38c06d5e18b798b3b2fff2", "score": "0.48135024", "text": "func (_m *Service) ChangeThumbnail(ctx context.Context, unitID string, file *multipart.FileHeader) error {\n\tret := _m.Called(ctx, unitID, file)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, string, *multipart.FileHeader) error); ok {\n\t\tr0 = rf(ctx, unitID, file)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "49a02876c9909ee54abdda21dfba8d9c", "score": "0.48098868", "text": "func TestConfigure(t *testing.T) {\n\tprops := map[string]interface{}{\n\t\t\"interval\": 500,\n\t\t\"path\": \"test\",\n\t}\n\tm := File().(*fileSink)\n\terr := m.Configure(props)\n\tif err != nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr nil\", err)\n\t}\n\tif m.c.Path != \"test\" {\n\t\tt.Errorf(\"Configure() Path = %v, want test\", m.c.Path)\n\t}\n\terr = m.Configure(map[string]interface{}{\"interval\": 500, \"path\": \"\"})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"fileType\": \"csv2\"})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\n\t\t\"interval\": 500,\n\t\t\"path\": \"test\",\n\t\t\"fileType\": \"csv\",\n\t})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"interval\": 60, \"path\": \"test\", \"checkInterval\": -1})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"rollingInterval\": -1})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"rollingCount\": -1})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"rollingCount\": 0, \"rollingInterval\": 0})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"RollingNamePattern\": \"test\"})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"RollingNamePattern\": 0})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\n\tfor k := range compressionTypes {\n\t\terr = m.Configure(map[string]interface{}{\n\t\t\t\"interval\": 500,\n\t\t\t\"path\": \"test\",\n\t\t\t\"compression\": k,\n\t\t\t\"rollingNamePattern\": \"suffix\",\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Configure() error = %v, wantErr nil\", err)\n\t\t}\n\t\tif m.c.Compression != k {\n\t\t\tt.Errorf(\"Configure() Compression = %v, want %v\", m.c.Compression, k)\n\t\t}\n\t}\n\n\terr = m.Configure(map[string]interface{}{\n\t\t\"interval\": 500,\n\t\t\"path\": \"test\",\n\t\t\"compression\": \"\",\n\t\t\"rollingNamePattern\": \"suffix\",\n\t})\n\tif err != nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr nil\", err)\n\t}\n\tif m.c.Compression != \"\" {\n\t\tt.Errorf(\"Configure() Compression = %v, want %v\", m.c.Compression, \"\")\n\t}\n\n\terr = m.Configure(map[string]interface{}{\n\t\t\"interval\": 500,\n\t\t\"path\": \"test\",\n\t\t\"compression\": \"not_exist_algorithm\",\n\t})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n}", "title": "" }, { "docid": "c3614e699a72621d215962e4e3e9b525", "score": "0.4802348", "text": "func (_m *RunInterface) GetCacheToFile(path string) error {\n\tret := _m.Called(path)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(path)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "1c671ea5d4bc09be75f2ade133c94759", "score": "0.48004836", "text": "func (_m *Knapsack) SetDebugServerData(debug bool) error {\n\tret := _m.Called(debug)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(bool) error); ok {\n\t\tr0 = rf(debug)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "ecdd18820bc409f51792f9c84964351d", "score": "0.47990137", "text": "func (_m *Repository) Config() (*config.Config, error) {\n\tret := _m.Called()\n\n\tvar r0 *config.Config\n\tif rf, ok := ret.Get(0).(func() *config.Config); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*config.Config)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func() error); ok {\n\t\tr1 = rf()\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "86543dcda55bc3baa22efdde80d66c2e", "score": "0.47970605", "text": "func (mmMakeMultipartMap *mLogUploaderMockMakeMultipartMap) Set(f func(matcher stats.Matcher, buf bytes.Buffer) (m1 map[string]io.Reader)) *LogUploaderMock {\n\tif mmMakeMultipartMap.defaultExpectation != nil {\n\t\tmmMakeMultipartMap.mock.t.Fatalf(\"Default expectation is already set for the LogUploader.MakeMultipartMap method\")\n\t}\n\n\tif len(mmMakeMultipartMap.expectations) > 0 {\n\t\tmmMakeMultipartMap.mock.t.Fatalf(\"Some expectations are already set for the LogUploader.MakeMultipartMap method\")\n\t}\n\n\tmmMakeMultipartMap.mock.funcMakeMultipartMap = f\n\treturn mmMakeMultipartMap.mock\n}", "title": "" }, { "docid": "fb69b182c6f2d892686dd8a0186d837c", "score": "0.47954124", "text": "func (m *MockScraper) WriteToFile(arg0 map[int]map[string]int, arg1 int) (string, error) {\n\tret := m.ctrl.Call(m, \"WriteToFile\", arg0, arg1)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9936de7037ae1eecc73efa0610dcd3de", "score": "0.47944653", "text": "func WithConfigFile(name string) Option {\n\treturn func(o *options) {\n\t\to.configFile = name\n\t}\n}", "title": "" }, { "docid": "9c7e556cb26ea003c70ff74025ae188a", "score": "0.47916594", "text": "func (m *MockClient) Config() *sarama.Config {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Config\")\n\tret0, _ := ret[0].(*sarama.Config)\n\treturn ret0\n}", "title": "" }, { "docid": "85ff61cdbf7bc6f8921160f33bd34d11", "score": "0.477528", "text": "func TestSetWrongArgs(t *testing.T) {\n\tfmt.Println(\"Entering the test method for SetWrongArgs\")\n\tprovcc := new(SimpleAsset)\n\tstub := shim.NewMockStub(\"ANY_PARAM\", provcc)\n\t\n\tcheckInit(t, stub, [][]byte{[]byte(\"init\")})\n\n\tres := stub.MockInvoke(\"1\", [][]byte{[]byte(\"set\"), []byte(\"S52fkpF2rCEArSuwqyDA9tVjawUdrkGzbNQLaa7xJfA=\")})\n\n\tif res.Status != shim.ERROR {\n\t\tfmt.Println(\"Invoke failed\", string(res.Message))\n\t\tt.FailNow()\n\t}\n\t\n}", "title": "" }, { "docid": "bed434ef8e41abdcd6768822b28d5877", "score": "0.47737777", "text": "func (mmUploadLogFile *mLogUploaderMockUploadLogFile) Expect(payload map[string]io.Reader) *mLogUploaderMockUploadLogFile {\n\tif mmUploadLogFile.mock.funcUploadLogFile != nil {\n\t\tmmUploadLogFile.mock.t.Fatalf(\"LogUploaderMock.UploadLogFile mock is already set by Set\")\n\t}\n\n\tif mmUploadLogFile.defaultExpectation == nil {\n\t\tmmUploadLogFile.defaultExpectation = &LogUploaderMockUploadLogFileExpectation{}\n\t}\n\n\tmmUploadLogFile.defaultExpectation.params = &LogUploaderMockUploadLogFileParams{payload}\n\tfor _, e := range mmUploadLogFile.expectations {\n\t\tif minimock.Equal(e.params, mmUploadLogFile.defaultExpectation.params) {\n\t\t\tmmUploadLogFile.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmUploadLogFile.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmUploadLogFile\n}", "title": "" }, { "docid": "cbc147bc9d2272aba52f57e40b38178c", "score": "0.47732407", "text": "func (_m *MockHTTPServerInterface) SetAddr(_a0 string) {\n\t_m.Called(_a0)\n}", "title": "" }, { "docid": "c7358eedd425e74e79dc7e33350e4372", "score": "0.47718075", "text": "func (_m *MockDataRegistryService_CreateOrUpdateMetricsServer) SetHeader(_a0 metadata.MD) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(metadata.MD) error); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "d330419bcb844fc5d49128c9e0a2c56f", "score": "0.47614363", "text": "func TestReadConfigFile(t *testing.T) {\n\tpwd, _ := os.Getwd()\n\tfor _, testFile := range TestFiles {\n\t\t_, res := readConfigFile(pwd + testFile.filename)\n\t\tb.Reset()\n\t\ttraceBuffer.Flush()\n\t\t// If the result is not the expected result of the test\n\t\tif res != testFile.passing {\n\t\t\tif testFile.passing {\n\t\t\t\tt.Errorf(\"Expected %s to pass, but it did not\", testFile.filename)\n\t\t\t} else {\n\t\t\t\tt.Errorf(\"Expected %s to fail, but it did not\", testFile.filename)\n\t\t\t}\n\t\t}\n\t\t// Check if error message contains intended string(s)\n\t\tif !testFile.passing {\n\t\t\tfor _, errorString := range testFile.errorString {\n\t\t\t\tif !strings.Contains(b.String(), errorString) {\n\t\t\t\t\tt.Errorf(\"Expected %s in the error message, but it's missing: %s\", errorString, b.String())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3097a092cae5dbc08a018deda339991c", "score": "0.47569922", "text": "func (deb *DebPkg) MarkConfigFile(dest string) error {\n\treturn deb.control.markConfigFile(dest)\n}", "title": "" }, { "docid": "ac5dd165ca32c6d08af572cba0dd2224", "score": "0.47532144", "text": "func (_m *LambdaAPI) UpdateAlias(_a0 *lambda.UpdateAliasInput) (*lambda.AliasConfiguration, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *lambda.AliasConfiguration\n\tif rf, ok := ret.Get(0).(func(*lambda.UpdateAliasInput) *lambda.AliasConfiguration); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*lambda.AliasConfiguration)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*lambda.UpdateAliasInput) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "04c11df17c1530b2a531569087ce1c8a", "score": "0.47463804", "text": "func (_m *AllocationChange) ProcessChange(rootRef *fileref.Ref, fileIDMeta map[string]string) error {\n\tret := _m.Called(rootRef, fileIDMeta)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*fileref.Ref, map[string]string) error); ok {\n\t\tr0 = rf(rootRef, fileIDMeta)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "ea2ef4a8f69ecd27723af097e00ad89d", "score": "0.47428665", "text": "func (m *mIndexCollectionAccessorMockForJet) Set(f func(p context.Context, p1 insolar.JetID) (r map[insolar.ID]LifelineMeta)) *IndexCollectionAccessorMock {\n\tm.mainExpectation = nil\n\tm.expectationSeries = nil\n\n\tm.mock.ForJetFunc = f\n\treturn m.mock\n}", "title": "" }, { "docid": "1a27af27fb2564814391c382d8fd91a8", "score": "0.4742364", "text": "func (m *mIndexCollectionAccessorMockForPulseAndJet) Set(f func(p context.Context, p1 insolar.PulseNumber, p2 insolar.JetID) (r map[insolar.ID]Lifeline)) *IndexCollectionAccessorMock {\n\tm.mainExpectation = nil\n\tm.expectationSeries = nil\n\n\tm.mock.ForPulseAndJetFunc = f\n\treturn m.mock\n}", "title": "" }, { "docid": "1f2867637f8158d1bcec2f6d9182700d", "score": "0.47416556", "text": "func (m *MockTx) UpdateConfig(arg0 map[string]string) error {\n\tret := m.ctrl.Call(m, \"UpdateConfig\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "1aa4a73ebfd737aca843e9927f8e16fa", "score": "0.47416413", "text": "func (m *MockOptions) SetBlockDataExpiry(on bool) Options {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetBlockDataExpiry\", on)\n\tret0, _ := ret[0].(Options)\n\treturn ret0\n}", "title": "" }, { "docid": "1c06df1b06d2ece328112b534e2ce7ec", "score": "0.47333622", "text": "func (_m *Operator) SetOutputs(_a0 []operator.Operator) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func([]operator.Operator) error); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "b65e67a40ad3e313ede04aec185fcda4", "score": "0.473255", "text": "func (c FakeConfig) Set(key, val string) error {\n return nil\n}", "title": "" }, { "docid": "e8b1b057cd4a538cc8b1d0634a4d7d49", "score": "0.47289595", "text": "func (m *mSignatureKeyHolderMockWriteTo) Set(f func(p io.Writer) (r int64, r1 error)) *SignatureKeyHolderMock {\n\tm.mainExpectation = nil\n\tm.expectationSeries = nil\n\n\tm.mock.WriteToFunc = f\n\treturn m.mock\n}", "title": "" }, { "docid": "4168ec1a320c2e3dd77673b287013d48", "score": "0.47248036", "text": "func updateConfigFile(context *cli.Context) {\n\tconfig, configFilename, err := lib.GetConfig(context)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tif configFilename == \"\" {\n\t\tfmt.Println(\"Could not find a config file to update\")\n\t\treturn\n\t}\n\n\t// Same config in []byte format.\n\tconfigRaw, err := ioutil.ReadFile(configFilename)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// Same config in map format so that we can detect missing keys.\n\tvar configMap map[string]interface{}\n\tif err = json.Unmarshal(configRaw, &configMap); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tdirty := updateConfig(config, configMap)\n\n\tif dirty {\n\t\tconfig.ToFile(context)\n\t\tfmt.Printf(\"Wrote %s\\n\", configFilename)\n\t} else {\n\t\tfmt.Println(\"Nothing to update\")\n\t}\n}", "title": "" } ]
1276543b27b9d6b7824b01c796ce5e50
TestZapLoggerEnabled test ZapLogger enabled
[ { "docid": "7d6e7fa9bf80c01c3ea2f326dfeedb17", "score": "0.82665306", "text": "func TestZapLoggerEnabled(t *testing.T) {\n\tverbosityLevel := 10\n\tsampleInfoLogger, _ := NewJSONLogger(logsapi.VerbosityLevel(verbosityLevel), nil, nil, nil)\n\tfor v := 0; v <= verbosityLevel; v++ {\n\t\tenabled := sampleInfoLogger.V(v).Enabled()\n\t\texpectEnabled := v <= verbosityLevel\n\t\tif !expectEnabled && enabled {\n\t\t\tt.Errorf(\"V(%d).Info should be disabled\", v)\n\t\t}\n\t\tif expectEnabled && !enabled {\n\t\t\tt.Errorf(\"V(%d).Info should be enabled\", v)\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "aead35015767123eaa39d66abc57817c", "score": "0.6875675", "text": "func TestGRPCLogCompatZap(t *testing.T) {\n\tlevelsWeCareAbout := []string{\"debug\", \"info\", \"warn\", \"error\"}\n\toutputInLoggerLevel := [...]map[string]bool{\n\t\t// 0 is always output\n\t\tmap[string]bool{\"debug\": true, \"info\": true, \"warn\": true, \"error\": true},\n\t\t// 1 is always output\n\t\tmap[string]bool{\"debug\": true, \"info\": true, \"warn\": true, \"error\": true},\n\t\t// 2 and 3 are only output for debug\n\t\tmap[string]bool{\"debug\": true},\n\t\tmap[string]bool{\"debug\": true},\n\t}\n\t// grpc verbosity levels\n\tfor lvl := 0; lvl <= 3; lvl++ {\n\t\tt.Run(fmt.Sprintf(\"V(%d)\", lvl), func(t *testing.T) {\n\t\t\tfor _, loggerLvl := range levelsWeCareAbout {\n\t\t\t\tt.Run(fmt.Sprintf(\"level %s\", loggerLvl), func(t *testing.T) {\n\t\t\t\t\texpected := outputInLoggerLevel[lvl][loggerLvl]\n\t\t\t\t\tl, err := newLogger(loggerLvl)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\tlw := logger.WrapZapGRPC(l)\n\t\t\t\t\tassert.Equalf(t, expected, lw.V(lvl), \"level %q: expected V(%d) to be %v\", loggerLvl, lvl, expected)\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "eadcddbb25f75b663f956db25f103003", "score": "0.6355823", "text": "func NewZapLogger() {\n\tif logger != nil {\n\t\treturn\n\t}\n\topts := []zap.Option{\n\t\tzap.AddCallerSkip(2),\n\t}\n\tl, err := newProductionConfig().Build(opts...)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tzapLogger = &zapLog{logger: l}\n\tlogger = zapLogger\n}", "title": "" }, { "docid": "944ab8a72db0e2f020fab4e7a172f419", "score": "0.63349986", "text": "func ZapLogger() *zaplog.Builder { return zaplog.NewZap() }", "title": "" }, { "docid": "b402a5720aa62a4d725d83c19e6d4a16", "score": "0.6308308", "text": "func newZapLogger(cfg *Config) (Logger, error) {\n\tencoder := getJSONEncoder()\n\n\tvar cores []zapcore.Core\n\tvar options []zap.Option\n\toption := zap.Fields(zap.String(\"ip\", utils.GetLocalIP()), zap.String(\"app\", viper.GetString(\"name\")))\n\toptions = append(options, option)\n\n\tallLevel := zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {\n\t\treturn lvl <= zapcore.FatalLevel\n\t})\n\n\twriters := strings.Split(cfg.Writers, \",\")\n\tfor _, w := range writers {\n\t\tif w == WriterStdOut {\n\t\t\tcore := zapcore.NewCore(encoder, zapcore.AddSync(os.Stdout), zapcore.DebugLevel)\n\t\t\tcores = append(cores, core)\n\t\t}\n\t\tif w == WriterFile {\n\t\t\tinfoFilename := cfg.LoggerFile\n\t\t\tinfoWrite := getLogWriterWithTime(infoFilename)\n\t\t\twarnFilename := cfg.LoggerWarnFile\n\t\t\twarnWrite := getLogWriterWithTime(warnFilename)\n\t\t\terrorFilename := cfg.LoggerErrorFile\n\t\t\terrorWrite := getLogWriterWithTime(errorFilename)\n\n\t\t\tinfoLevel := zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {\n\t\t\t\treturn lvl <= zapcore.InfoLevel\n\t\t\t})\n\t\t\twarnLevel := zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {\n\t\t\t\tstacktrace := zap.AddStacktrace(zapcore.WarnLevel)\n\t\t\t\toptions = append(options, stacktrace)\n\t\t\t\treturn lvl == zapcore.WarnLevel\n\t\t\t})\n\t\t\terrorLevel := zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {\n\t\t\t\tstacktrace := zap.AddStacktrace(zapcore.ErrorLevel)\n\t\t\t\toptions = append(options, stacktrace)\n\t\t\t\treturn lvl >= zapcore.ErrorLevel\n\t\t\t})\n\n\t\t\tcore := zapcore.NewCore(encoder, zapcore.AddSync(infoWrite), infoLevel)\n\t\t\tcores = append(cores, core)\n\t\t\tcore = zapcore.NewCore(encoder, zapcore.AddSync(warnWrite), warnLevel)\n\t\t\tcores = append(cores, core)\n\t\t\tcore = zapcore.NewCore(encoder, zapcore.AddSync(errorWrite), errorLevel)\n\t\t\tcores = append(cores, core)\n\t\t}\n\t\tif w != WriterFile && w != WriterStdOut {\n\t\t\tcore := zapcore.NewCore(encoder, zapcore.AddSync(os.Stdout), zapcore.DebugLevel)\n\t\t\tcores = append(cores, core)\n\t\t\tallWriter := getLogWriterWithTime(cfg.LoggerFile)\n\t\t\tcore = zapcore.NewCore(encoder, zapcore.AddSync(allWriter), allLevel)\n\t\t\tcores = append(cores, core)\n\t\t}\n\t}\n\n\tcombinedCore := zapcore.NewTee(cores...)\n\n\t// debug\n\tcaller := zap.AddCaller()\n\toptions = append(options, caller)\n\tdevelopment := zap.Development()\n\toptions = append(options, development)\n\taddCallerSkip := zap.AddCallerSkip(2)\n\toptions = append(options, addCallerSkip)\n\n\tlogger := zap.New(combinedCore, options...).Sugar()\n\n\treturn &zapLogger{sugaredLogger: logger}, nil\n}", "title": "" }, { "docid": "c6276f3be70cf9b96f4224cf667e96dc", "score": "0.6237724", "text": "func TestZapLoggerInfo(t *testing.T) {\n\ttimeNow = func() time.Time {\n\t\treturn time.Date(1970, time.January, 1, 0, 0, 0, 123, time.UTC)\n\t}\n\tvar testDataInfo = []struct {\n\t\tmsg string\n\t\tformat string\n\t\tkeysValues []interface{}\n\t\tnames []string\n\t}{\n\t\t{\n\t\t\tmsg: \"test\",\n\t\t\tformat: \"{\\\"ts\\\":%f,\\\"caller\\\":\\\"json/json_test.go:%d\\\",\\\"msg\\\":\\\"test\\\",\\\"v\\\":0,\\\"ns\\\":\\\"default\\\",\\\"podnum\\\":2}\\n\",\n\t\t\tkeysValues: []interface{}{\"ns\", \"default\", \"podnum\", 2},\n\t\t},\n\t\t{\n\t\t\tmsg: \"test for strongly typed Zap field\",\n\t\t\tformat: \"{\\\"ts\\\":%f,\\\"caller\\\":\\\"json/json_test.go:%d\\\",\\\"msg\\\":\\\"strongly-typed Zap Field passed to logr\\\",\\\"zap field\\\":{\\\"Key\\\":\\\"attempt\\\",\\\"Type\\\":11,\\\"Integer\\\":3,\\\"String\\\":\\\"\\\",\\\"Interface\\\":null}}\\n{\\\"ts\\\":%f,\\\"caller\\\":\\\"json/json_test.go:%d\\\",\\\"msg\\\":\\\"test for strongly typed Zap field\\\",\\\"v\\\":0,\\\"ns\\\":\\\"default\\\",\\\"podnum\\\":2}\\n\",\n\t\t\tkeysValues: []interface{}{\"ns\", \"default\", \"podnum\", 2, zap.Int(\"attempt\", 3), \"attempt\", \"Running\", 10},\n\t\t},\n\t\t{\n\t\t\tmsg: \"test for non-string key argument\",\n\t\t\tformat: \"{\\\"ts\\\":%f,\\\"caller\\\":\\\"json/json_test.go:%d\\\",\\\"msg\\\":\\\"non-string key argument passed to logging, ignoring all later arguments\\\",\\\"invalid key\\\":200}\\n{\\\"ts\\\":%f,\\\"caller\\\":\\\"json/json_test.go:%d\\\",\\\"msg\\\":\\\"test for non-string key argument\\\",\\\"v\\\":0,\\\"ns\\\":\\\"default\\\",\\\"podnum\\\":2}\\n\",\n\t\t\tkeysValues: []interface{}{\"ns\", \"default\", \"podnum\", 2, 200, \"replica\", \"Running\", 10},\n\t\t},\n\t\t{\n\t\t\tmsg: \"test for duration value argument\",\n\t\t\tformat: \"{\\\"ts\\\":%f,\\\"caller\\\":\\\"json/json_test.go:%d\\\",\\\"msg\\\":\\\"test for duration value argument\\\",\\\"v\\\":0,\\\"duration\\\":\\\"5s\\\"}\\n\",\n\t\t\tkeysValues: []interface{}{\"duration\", time.Duration(5 * time.Second)},\n\t\t},\n\t\t{\n\t\t\tmsg: \"test for WithName\",\n\t\t\tnames: []string{\"hello\", \"world\"},\n\t\t\tformat: \"{\\\"ts\\\":%f,\\\"logger\\\":\\\"hello.world\\\",\\\"caller\\\":\\\"json/json_test.go:%d\\\",\\\"msg\\\":\\\"test for WithName\\\",\\\"v\\\":0}\\n\",\n\t\t},\n\t\t{\n\t\t\tmsg: \"test for duplicate keys\",\n\t\t\tformat: \"{\\\"ts\\\":%f,\\\"caller\\\":\\\"json/json_test.go:%d\\\",\\\"msg\\\":\\\"test for duplicate keys\\\",\\\"v\\\":0,\\\"akey\\\":\\\"avalue\\\",\\\"akey\\\":\\\"anothervalue\\\"}\\n\",\n\t\t\tkeysValues: []interface{}{\"akey\", \"avalue\", \"akey\", \"anothervalue\"},\n\t\t},\n\t\t{\n\t\t\tmsg: \"test for NamespacedName argument\",\n\t\t\tformat: \"{\\\"ts\\\":%f,\\\"caller\\\":\\\"json/json_test.go:%d\\\",\\\"msg\\\":\\\"test for NamespacedName argument\\\",\\\"v\\\":0,\\\"obj\\\":{\\\"name\\\":\\\"kube-proxy\\\",\\\"namespace\\\":\\\"kube-system\\\"}}\\n\",\n\t\t\tkeysValues: []interface{}{\"obj\", types.NamespacedName{Name: \"kube-proxy\", Namespace: \"kube-system\"}},\n\t\t},\n\t\t{\n\t\t\tmsg: \"test for NamespacedName argument with no namespace\",\n\t\t\tformat: \"{\\\"ts\\\":%f,\\\"caller\\\":\\\"json/json_test.go:%d\\\",\\\"msg\\\":\\\"test for NamespacedName argument with no namespace\\\",\\\"v\\\":0,\\\"obj\\\":{\\\"name\\\":\\\"kube-proxy\\\"}}\\n\",\n\t\t\tkeysValues: []interface{}{\"obj\", types.NamespacedName{Name: \"kube-proxy\"}},\n\t\t},\n\t}\n\n\tfor _, data := range testDataInfo {\n\t\tvar buffer bytes.Buffer\n\t\twriter := zapcore.AddSync(&buffer)\n\t\tsampleInfoLogger, _ := NewJSONLogger(0, writer, nil, nil)\n\t\tfor _, name := range data.names {\n\t\t\t// nolint:logcheck // This intentionally ignore the feature gate and always tests with a name.\n\t\t\tsampleInfoLogger = sampleInfoLogger.WithName(name)\n\t\t}\n\t\t// nolint:logcheck // The linter cannot and doesn't need to check the key/value pairs.\n\t\tsampleInfoLogger.Info(data.msg, data.keysValues...)\n\t\tlogStr := buffer.String()\n\n\t\tlogStrLines := strings.Split(logStr, \"\\n\")\n\t\tdataFormatLines := strings.Split(data.format, \"\\n\")\n\t\tif !assert.Equal(t, len(logStrLines), len(dataFormatLines)) {\n\t\t\tt.Errorf(\"Info has wrong format: no. of lines in log is incorrect \\n expect:%d\\n got:%d\", len(dataFormatLines), len(logStrLines))\n\t\t}\n\n\t\tfor i := range logStrLines {\n\t\t\tif len(logStrLines[i]) == 0 && len(dataFormatLines[i]) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar ts float64\n\t\t\tvar lineNo int\n\t\t\tn, err := fmt.Sscanf(logStrLines[i], dataFormatLines[i], &ts, &lineNo)\n\t\t\tif n != 2 || err != nil {\n\t\t\t\tt.Errorf(\"log format error: %d elements, error %s:\\n%s\", n, err, logStrLines[i])\n\t\t\t}\n\t\t\texpect := fmt.Sprintf(dataFormatLines[i], ts, lineNo)\n\t\t\tif !assert.Equal(t, expect, logStrLines[i]) {\n\t\t\t\tt.Errorf(\"Info has wrong format \\n expect:%s\\n got:%s\", expect, logStrLines[i])\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fe47a9bb152a48d2c87440efd0dfe8f1", "score": "0.6161789", "text": "func NewWithZap(l *zap.Logger) Logger {\n return &logger{l.Sugar()}\n}", "title": "" }, { "docid": "ab4a544ef56d245aba083dd02fffde2f", "score": "0.6063636", "text": "func (n NoopInfoLogger) Enabled() bool { return false }", "title": "" }, { "docid": "f31642d3d587a9b0ffbfec5b624b452c", "score": "0.6052065", "text": "func TestLogOperationForEnabledClient(t *testing.T) {\n\tc := constructEnabledClient()\n\terr := c.Log(\"foo\", \"bar\")\n\tif err == nil {\n\t\tt.Fatal(\"Error should be returned for enabled client with improper address\")\n\t}\n}", "title": "" }, { "docid": "aa2dc306fde984a9bf57aebb13b26c41", "score": "0.60494655", "text": "func TestLogger(t *testing.T) *zap.SugaredLogger {\n\tlogger := zaptest.NewLogger(t, zaptest.WrapOptions(zap.AddCaller()))\n\treturn logger.Sugar().Named(t.Name())\n}", "title": "" }, { "docid": "47d72ea5803f874e56465e721a1174f6", "score": "0.60254985", "text": "func Logger(cfg Config) gin.HandlerFunc {\n\tlogger, _ := NewZapConfig(cfg).Build()\n\n\tvar skipURLs map[string]struct{}\n\tif length := len(cfg.SkipURLs); length > 0 {\n\t\tskipURLs = make(map[string]struct{}, length)\n\t\tfor _, u := range cfg.SkipURLs {\n\t\t\tskipURLs[u] = struct{}{}\n\t\t}\n\t}\n\tvar skipMethods map[string]struct{}\n\tif length := len(cfg.SkipMethods); length > 0 {\n\t\tskipMethods = make(map[string]struct{}, length)\n\t\tfor _, m := range cfg.SkipMethods {\n\t\t\tskipMethods[m] = struct{}{}\n\t\t}\n\t}\n\n\treturn func(c *gin.Context) {\n\t\tstart := time.Now()\n\n\t\turl := c.Request.URL.EscapedPath()\n\t\tfor _, p := range c.Params {\n\t\t\turl = strings.Replace(url, p.Value, \":\"+p.Key, 1)\n\t\t}\n\n\t\tc.Next()\n\n\t\tif _, ok := skipMethods[c.Request.Method]; ok {\n\t\t\treturn\n\t\t}\n\t\tif _, ok := skipURLs[url]; ok {\n\t\t\treturn\n\t\t}\n\t\tif cfg.SkipURLRegexp != nil && cfg.SkipURLRegexp.MatchString(url) {\n\t\t\treturn\n\t\t}\n\n\t\tmsg := \"Request\"\n\t\tif len(c.Errors) > 0 {\n\t\t\tmsg = strings.Join(c.Errors.Errors(), \";\")\n\t\t}\n\n\t\tfields := []zap.Field{\n\t\t\tzap.Int(\"s\", c.Writer.Status()),\n\t\t\tzap.String(\"m\", c.Request.Method),\n\t\t\tzap.String(\"p\", url),\n\t\t\tzap.String(\"ip\", c.ClientIP()),\n\t\t\tzap.Duration(\"l\", time.Now().Sub(start)),\n\t\t\tzap.String(\"ua\", c.Request.UserAgent()),\n\t\t}\n\t\tswitch {\n\t\tcase c.Writer.Status() >= http.StatusBadRequest && c.Writer.Status() < http.StatusInternalServerError:\n\t\t\tlogger.Warn(msg, fields...)\n\t\tcase c.Writer.Status() >= http.StatusInternalServerError:\n\t\t\tlogger.Error(msg, fields...)\n\t\tdefault:\n\t\t\tlogger.Info(msg, fields...)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5db9aefd3d48a6cf3f8c26444e9c7d02", "score": "0.5987478", "text": "func InitZapLog() *zap.Logger {\n\tw := zapcore.AddSync(&lumberjack.Logger{\n\t\tFilename: \"prod.log\",\n\t\tMaxSize: 1, // megabytes\n\t\tMaxBackups: 30,\n\t\tMaxAge: 30, // days\n\t})\n\n\tconfig := zapcore.EncoderConfig{\n\t\tMessageKey: viper.GetString(\"MessageKey\"),\n\n\t\tLevelKey: viper.GetString(\"LevelKey\"),\n\t\tEncodeLevel: zapcore.CapitalLevelEncoder,\n\n\t\tTimeKey: viper.GetString(\"TimeKey\"),\n\t\tEncodeTime: zapcore.ISO8601TimeEncoder,\n\n\t\tCallerKey: viper.GetString(\"CallerKey\"),\n\t\tEncodeCaller: zapcore.ShortCallerEncoder,\n\t}\n\tcore := zapcore.NewCore(\n\t\tzapcore.NewJSONEncoder(config),\n\t\tzapcore.NewMultiWriteSyncer(w),\n\t\tzap.InfoLevel,\n\t)\n\tlogger := zap.New(core, zap.AddCaller(), zap.Development())\n\tlogger.Sugar()\n\treturn logger\n}", "title": "" }, { "docid": "4c03eef4d589d2f04648fe2e9ed23ca2", "score": "0.59457785", "text": "func NewWithZap(l *zap.Logger) Logger {\n\treturn &logger{l.Sugar()}\n}", "title": "" }, { "docid": "4c03eef4d589d2f04648fe2e9ed23ca2", "score": "0.59457785", "text": "func NewWithZap(l *zap.Logger) Logger {\n\treturn &logger{l.Sugar()}\n}", "title": "" }, { "docid": "6f0fb2209f3c68ab4ecb88595f44a740", "score": "0.5941865", "text": "func NewZapLogger(lc fx.Lifecycle, cfg Configuration) (logger *zap.Logger, err error) {\n\tif cfg.IsProd() {\n\t\tlogger, err = zap.NewProduction()\n\t} else {\n\t\tlogger, err = zap.NewDevelopment()\n\t}\n\n\tvar stdClose func()\n\tif logger != nil {\n\t\tstdClose = zap.RedirectStdLog(logger)\n\t}\n\n\tlc.Append(fx.Hook{\n\t\tOnStart: nil,\n\t\tOnStop: func(ctx context.Context) error {\n\t\t\tif err := logger.Sync(); logger != nil && err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif stdClose != nil {\n\t\t\t\tstdClose()\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t})\n\treturn\n}", "title": "" }, { "docid": "50707693ade5c8d6e01bba766db5f9d2", "score": "0.5935146", "text": "func TestZapLoggerV(t *testing.T) {\n\ttimeNow = func() time.Time {\n\t\treturn time.Date(1970, time.January, 1, 0, 0, 0, 123, time.UTC)\n\t}\n\n\tverbosityLevel := 10\n\tfor v := 0; v <= verbosityLevel; v++ {\n\t\tvar buffer bytes.Buffer\n\t\twriter := zapcore.AddSync(&buffer)\n\t\tsampleInfoLogger, _ := NewJSONLogger(logsapi.VerbosityLevel(verbosityLevel), writer, nil, nil)\n\t\tsampleInfoLogger.V(v).Info(\"test\", \"ns\", \"default\", \"podnum\", 2, \"time\", time.Microsecond)\n\t\tlogStr := buffer.String()\n\n\t\tshouldHaveLogged := v <= verbosityLevel\n\t\tif logged := logStr != \"\"; logged != shouldHaveLogged {\n\t\t\tif logged {\n\t\t\t\tt.Fatalf(\"Expected no output at v=%d, got: %s\", v, logStr)\n\t\t\t}\n\t\t\tt.Fatalf(\"Expected output at v=%d, got none.\", v)\n\t\t}\n\t\tif !shouldHaveLogged {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar actualV, lineNo int\n\t\texpectFormat := \"{\\\"ts\\\":0.000123,\\\"caller\\\":\\\"json/json_test.go:%d\\\",\\\"msg\\\":\\\"test\\\",\\\"v\\\":%d,\\\"ns\\\":\\\"default\\\",\\\"podnum\\\":2,\\\"time\\\":\\\"1µs\\\"}\\n\"\n\t\tn, err := fmt.Sscanf(logStr, expectFormat, &lineNo, &actualV)\n\t\tif n != 2 || err != nil {\n\t\t\tt.Errorf(\"log format error: %d elements, error %s:\\n%s\", n, err, logStr)\n\t\t}\n\t\tif actualV != v {\n\t\t\tt.Errorf(\"V(%d).Info...) returned v=%d. expected v=%d\", v, actualV, v)\n\t\t}\n\t\texpect := fmt.Sprintf(expectFormat, lineNo, v)\n\t\tif !assert.Equal(t, expect, logStr) {\n\t\t\tt.Errorf(\"V(%d).Info has wrong format \\n expect:%s\\n got:%s\", v, expect, logStr)\n\t\t}\n\t\tbuffer.Reset()\n\t}\n}", "title": "" }, { "docid": "00dd94fac0ebd5df630ae0d7edca8553", "score": "0.5898514", "text": "func setupLogger(loggingLevel int) {\n\tencoding := \"console\"\n\tencoderConfig := zap.NewDevelopmentEncoderConfig()\n\tif !IsDevelopment() {\n\t\tencoding = \"json\"\n\t\tencoderConfig = zap.NewProductionEncoderConfig()\n\t}\n\tzapLogger, _ := zap.Config{\n\t\tLevel: zap.NewAtomicLevelAt(zapcore.Level(loggingLevel)),\n\t\tDevelopment: IsDevelopment(),\n\t\tEncoding: encoding,\n\t\tEncoderConfig: encoderConfig,\n\t\tOutputPaths: []string{\"stdout\"},\n\t\tErrorOutputPaths: []string{\"stderr\"},\n\t}.Build()\n\tlogger = zapLogger.Sugar()\n}", "title": "" }, { "docid": "097843b4c9df933581fd8e8a490876be", "score": "0.5884342", "text": "func NewForTest() (Logger, *observer.ObservedLogs) {\n core, recorded := observer.New(zapcore.InfoLevel)\n return NewWithZap(zap.New(core)), recorded\n}", "title": "" }, { "docid": "5aa4d01e74945022bfd4af3810b55f2f", "score": "0.5858831", "text": "func Setup(level, format string) {\n\tzapEncoderCfg := zap.NewProductionEncoderConfig()\n\tzapEncoderCfg.TimeKey = \"timestamp\"\n\tzapEncoderCfg.EncodeTime = zapcore.ISO8601TimeEncoder\n\n\tisDevelopment := false\n\tif level == \"debug\" {\n\t\tisDevelopment = true\n\t}\n\n\tzapConfig := zap.Config{\n\t\tLevel: parseLevel(level),\n\t\tDevelopment: isDevelopment,\n\t\tEncoding: format,\n\t\tEncoderConfig: zapEncoderCfg,\n\t\tOutputPaths: []string{\"stderr\"},\n\t\tErrorOutputPaths: []string{\"stderr\"},\n\t\tSampling: &zap.SamplingConfig{\n\t\t\tInitial: 100,\n\t\t\tThereafter: 100,\n\t\t},\n\t}\n\n\tlogger, err := zapConfig.Build(zap.AddCaller(), zap.AddCallerSkip(1))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer logger.Sync()\n\n\tzap.ReplaceGlobals(logger)\n}", "title": "" }, { "docid": "221fb737843938bbdab400ba1978c106", "score": "0.5843705", "text": "func TestLoggerWrite_NoSessions(t *testing.T) {\n\tlogger := NewLogger()\n\tzlog := zerolog.New(logger).With().Timestamp().Logger().Level(zerolog.InfoLevel)\n\n\tzlog.Info().Msg(\"hello\")\n}", "title": "" }, { "docid": "10129729ecc1645bc26c35f36790bf82", "score": "0.5810153", "text": "func setupLogger(debug bool) {\n\n\tzerolog.TimeFieldFormat = zerolog.TimeFormatUnix\n\tzerolog.SetGlobalLevel(zerolog.InfoLevel)\n\tif debug {\n\t\tzerolog.SetGlobalLevel(zerolog.DebugLevel)\n\t}\n\n}", "title": "" }, { "docid": "582dc3cb01c602e6293aacdb5a296fd2", "score": "0.58058935", "text": "func NewTestLogger() (log.Logger, *bytes.Buffer) {\n\tec := uber_zap.NewDevelopmentEncoderConfig()\n\tec.TimeKey = \"\"\n\tenc := zapcore.NewConsoleEncoder(ec)\n\tbuf := &zaptest.Buffer{}\n\tl := zap.New(enc, buf, log.DebugLevel)\n\treturn l, &buf.Buffer\n}", "title": "" }, { "docid": "e0c8d4fa8638784f6619a280b7fe0454", "score": "0.5790592", "text": "func NewZapLogger(name string, config *Config) (*zap.Logger, error) {\n\t// Return a nop logger if logger is not enabled.\n\tif !config.Enabled {\n\t\treturn zap.NewNop(), nil\n\t}\n\n\t// if Pretty flag in config is enabled use a ConsoleEncoder which is human readable.\n\tvar encoder zapcore.Encoder\n\tif config.Pretty {\n\t\tencoder = zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig())\n\t} else {\n\t\tencoder = zapcore.NewJSONEncoder(zap.NewDevelopmentEncoderConfig())\n\t}\n\n\tzapLvl := parseLevel(config.Level)\n\tdefaultCore := zapcore.NewCore(encoder, zapcore.Lock(zapcore.AddSync(os.Stdout)), zapLvl)\n\tcores := []zapcore.Core{defaultCore}\n\n\t// If FileRedirectEnabled flag in config is enabled add a core with a file writer to zap logger cores.\n\tif config.FileRedirectEnabled {\n\t\t// Check existence of file.\n\t\tfileName := fmt.Sprintf(\"%s/%s.log\", config.FileRedirectPath, config.FileRedirectPrefix)\n\t\tbasePath := filepath.Dir(fileName)\n\t\tif _, err := os.Stat(basePath); os.IsNotExist(err) {\n\t\t\treturn nil, fmt.Errorf(\"base path `%s` is not exist, error: %v\", basePath, err)\n\t\t}\n\t\t// Open the file.\n\t\tfile, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0755)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error while openning file `%s` for logging, err: %v\", fileName, err)\n\t\t}\n\n\t\t// Append new core to zap logger cores.\n\t\tfileLoggerCore := zapcore.NewCore(encoder, zapcore.Lock(zapcore.AddSync(file)), zapLvl)\n\t\tcores = append(cores, fileLoggerCore)\n\t}\n\n\tcore := zapcore.NewTee(cores...)\n\tlogger := zap.New(core, zap.AddCaller(), zap.AddStacktrace(zap.ErrorLevel)).Named(name)\n\n\treturn logger, nil\n}", "title": "" }, { "docid": "0a3b91ce3f7cb13303f061c5005d8d6f", "score": "0.5782193", "text": "func TestChaincodeLogging(t *testing.T) {\n\n\t// From start() - We can't call start() from this test\n\tformat := logging.MustStringFormatter(\"%{time:15:04:05.000} [%{module}] %{level:.4s} : %{message}\")\n\tbackend := logging.NewLogBackend(os.Stderr, \"\", 0)\n\tbackendFormatter := logging.NewBackendFormatter(backend, format)\n\tlogging.SetBackend(backendFormatter).SetLevel(logging.Level(shimLoggingLevel), \"shim\")\n\n\tfoo := NewLogger(\"foo\")\n\tbar := NewLogger(\"bar\")\n\n\tfoo.Debugf(\"Foo is debugging: %d\", 10)\n\tbar.Infof(\"Bar is informational? %s.\", \"Yes\")\n\tfoo.Noticef(\"NOTE NOTE NOTE\")\n\tbar.Warningf(\"Danger, Danger %s %s\", \"Will\", \"Robinson!\")\n\tfoo.Errorf(\"I'm sorry Dave, I'm afraid I can't do that.\")\n\tbar.Criticalf(\"PI is not equal to 3.14, we computed it as %.2f\", 4.13)\n\n\tbar.Debug(\"Foo is debugging:\", 10)\n\tfoo.Info(\"Bar is informational?\", \"Yes.\")\n\tbar.Notice(\"NOTE NOTE NOTE\")\n\tfoo.Warning(\"Danger, Danger\", \"Will\", \"Robinson!\")\n\tbar.Error(\"I'm sorry Dave, I'm afraid I can't do that.\")\n\tfoo.Critical(\"PI is not equal to\", 3.14, \", we computed it as\", 4.13)\n\n\tfoo.SetLevel(LogWarning)\n\tif foo.IsEnabledFor(LogDebug) {\n\t\tt.Errorf(\"'foo' should not be enabled for LogDebug\")\n\t}\n\tif !foo.IsEnabledFor(LogCritical) {\n\t\tt.Errorf(\"'foo' should be enabled for LogCritical\")\n\t}\n\tbar.SetLevel(LogCritical)\n\tif bar.IsEnabledFor(LogDebug) {\n\t\tt.Errorf(\"'bar' should not be enabled for LogDebug\")\n\t}\n\tif !bar.IsEnabledFor(LogCritical) {\n\t\tt.Errorf(\"'bar' should be enabled for LogCritical\")\n\t}\n}", "title": "" }, { "docid": "e400f636ba5093d1923ec65e2d138852", "score": "0.57741106", "text": "func Test(t *testing.T) { \n InitLogging(false, false, false, nil)\n TestingT(t) \n}", "title": "" }, { "docid": "1312635db4c4827bf114af76ff7bdc38", "score": "0.5750217", "text": "func NewZapLogger() *zap.SugaredLogger {\n\tlogConfig := zap.NewDevelopmentConfig()\n\tlogConfig.Sampling = nil\n\tlogger, err := logConfig.Build()\n\tif err != nil {\n\t\tlog.Fatalln(\"failed to init zap logging\")\n\t}\n\treturn logger.Sugar()\n}", "title": "" }, { "docid": "8af4f15b20f9bea5ffb501fdfb22a962", "score": "0.57413745", "text": "func SetupZapSDLogging(devel bool) {\n\tvar (\n\t\tlogger *zap.Logger\n\t\terr error\n\t)\n\n\tif devel {\n\t\tlogger, err = zapdriver.NewDevelopment()\n\t} else {\n\t\tlogger, err = zapdriver.NewProduction()\n\t}\n\n\tzap.ReplaceGlobals(logger)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n}", "title": "" }, { "docid": "f3d46357d1069a8f3095b510b8be2a56", "score": "0.5732432", "text": "func (d *ZapDriver) Print(l *slog.Log) {\n\tpLogger := d.Logger\n\t// 处理field\n\tif l.Fields != nil {\n\t\tfields := make([]zap.Field, 0, len(l.Fields))\n\t\tfor k, v := range l.Fields {\n\t\t\tfields = append(fields, zap.Any(k, v))\n\t\t}\n\t\tpLogger = d.Logger.With(fields...)\n\t}\n\n\tdefer pLogger.Sync()\n\tswitch l.Level {\n\tcase slog.TraceLevel:\n\t\tif l.Format == nil {\n\t\t\tpLogger.Sugar().Debug(l.Args...)\n\t\t} else {\n\t\t\tpLogger.Sugar().Debugf(*l.Format, l.Args...)\n\t\t}\n\tcase slog.DebugLevel:\n\t\tif l.Format == nil {\n\t\t\tpLogger.Sugar().Debug(l.Args...)\n\t\t} else {\n\t\t\tpLogger.Sugar().Debugf(*l.Format, l.Args...)\n\t\t}\n\tcase slog.InfoLevel:\n\t\tif l.Format == nil {\n\t\t\tpLogger.Sugar().Info(l.Args...)\n\t\t} else {\n\t\t\tpLogger.Sugar().Infof(*l.Format, l.Args...)\n\t\t}\n\tcase slog.WarnLevel:\n\t\tif l.Format == nil {\n\t\t\tpLogger.Sugar().Warn(l.Args...)\n\t\t} else {\n\t\t\tpLogger.Sugar().Warnf(*l.Format, l.Args...)\n\t\t}\n\tcase slog.ErrorLevel:\n\t\tif l.Format == nil {\n\t\t\tpLogger.Sugar().Error(l.Args...)\n\t\t} else {\n\t\t\tpLogger.Sugar().Errorf(*l.Format, l.Args...)\n\t\t}\n\tcase slog.PanicLevel:\n\t\tif l.Format == nil {\n\t\t\tpLogger.Sugar().Panic(l.Args...)\n\t\t} else {\n\t\t\tpLogger.Sugar().Panicf(*l.Format, l.Args...)\n\t\t}\n\tcase slog.FatalLevel:\n\t\tif l.Format == nil {\n\t\t\tpLogger.Sugar().Fatal(l.Args...)\n\t\t} else {\n\t\t\tpLogger.Sugar().Fatalf(*l.Format, l.Args...)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "11f542450e7ce3a85fbd04bdfcafcdca", "score": "0.57243764", "text": "func newLogger(logFormat, logLevel string, enableTime bool) *zap.Logger {\n return buildLoggerInstance(\n logConfig{\n level: logLevel,\n format: logFormat,\n enableTime: enableTime,\n },\n )\n}", "title": "" }, { "docid": "2137c49864c098b179066f51e2bd960a", "score": "0.56967175", "text": "func (s *LoggerTestSuite) TestLevelEnabler(t *testing.T) {\n\tif s.LoggerFactory == nil {\n\t\tt.Fatal(\"logger factory is not configured\")\n\t}\n\n\tconformance.TestSuite{\n\t\tLoggerFactory: wrapLoggerFactory(s.LoggerFactory),\n\t\tNoTraceLevel: s.TraceFallbackToDebug,\n\t}.RunLevelEnablerTest(t)\n}", "title": "" }, { "docid": "b1e5e43bda5648a5b362ed4c28b87b91", "score": "0.5677437", "text": "func new(level ...zapcore.LevelEnabler) *zap.Logger {\n\tencoderCfg := zapcore.EncoderConfig{\n\t\tMessageKey: \"summary\",\n\t\tLevelKey: \"level\",\n\t\tNameKey: \"logger\",\n\t\tStacktraceKey: \"stackTraceArray\",\n\t\tEncodeLevel: zapcore.LowercaseLevelEncoder,\n\t\tEncodeTime: zapcore.RFC3339TimeEncoder,\n\t\tEncodeDuration: zapcore.StringDurationEncoder,\n\t\tTimeKey: \"sortDate\",\n\t}\n\tvar zcLevel zapcore.LevelEnabler\n\tif level == nil {\n\t\tzcLevel = zapcore.InfoLevel\n\t} else {\n\t\tzcLevel = level[0]\n\t}\n\tcore := zapcore.NewCore(zapcore.NewJSONEncoder(encoderCfg), os.Stdout, zcLevel)\n\n\treturn zap.New(core)\n}", "title": "" }, { "docid": "3c48e38ebad3d183265cdcf62709730a", "score": "0.5667469", "text": "func TestSetupLogging(t *testing.T) {\n\n\tlp := []loggingPair{\n\t\t{\n\t\t\tloglevelFromFlag: \"trace\",\n\t\t\texpectedLoglevel: log.TraceLevel,\n\t\t},\n\t\t{\n\t\t\tloglevelFromFlag: \"debug\",\n\t\t\texpectedLoglevel: log.DebugLevel,\n\t\t},\n\t\t{\n\t\t\tloglevelFromFlag: \"info\",\n\t\t\texpectedLoglevel: log.InfoLevel,\n\t\t},\n\t\t{\n\t\t\tloglevelFromFlag: \"panic\",\n\t\t\texpectedLoglevel: log.PanicLevel,\n\t\t},\n\t\t{\n\t\t\tloglevelFromFlag: \"fatal\",\n\t\t\texpectedLoglevel: log.FatalLevel,\n\t\t},\n\t}\n\n\tlc := &logConfig{}\n\n\tfor _, logPair := range lp {\n\t\tlc.LogLevel = logPair.loglevelFromFlag\n\t\terr := setupLogging(lc)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Error! %s\", err)\n\t\t}\n\n\t\tif log.GetLevel() != logPair.expectedLoglevel {\n\t\t\tt.Errorf(\"Error! Log level not expected. Got \" + string(log.GetLevel()) + \" Expected: \" + string(logPair.expectedLoglevel))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "44cce8174e40cf416ead52de28cf58b1", "score": "0.56670517", "text": "func NTNUZap(files []string, level zapcore.Level, development bool, utc bool) (*zap.Logger, error) {\n return NTNUConfig(files, level, development, utc).Build()\n}", "title": "" }, { "docid": "08db79a0ca74e6888368f876e7cbf801", "score": "0.56373835", "text": "func (l *AppLogger) setupLogger(ws zapcore.WriteSyncer, logLevel log.Level) {\n\tatom := zap.NewAtomicLevel()\n\n\tencoderCfg := zap.NewProductionEncoderConfig()\n\tencoderCfg.TimeKey = \"timestamp\"\n\tencoderCfg.EncodeTime = zapcore.ISO8601TimeEncoder\n\n\tlogger := zap.New(\n\t\tzapcore.NewCore(\n\t\t\tzapcore.NewJSONEncoder(encoderCfg),\n\t\t\tzapcore.Lock(ws),\n\t\t\tatom),\n\t\tzap.AddCaller(),\n\t\tzap.AddCallerSkip(2))\n\n\tl.zapLogger = logger\n\tl.zapSugarLogger = logger.Sugar()\n\tl.setLogLevel(atom, logLevel)\n}", "title": "" }, { "docid": "c5b2dcf0e2b8c1d5da7bfddf88bb0b45", "score": "0.56181943", "text": "func (zl *zerologLogger) Enabled() bool {\n\tif zl.lvl < zl.l.GetLevel() || zl.lvl < zerolog.GlobalLevel() {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d30cce72213a5e67ea7ab1e180c9c903", "score": "0.5605155", "text": "func NewViewersZapLogger() *ViewersLog {\n\t//TODO(student) finish constructor\n\tchViewers := make(map[string]*ChannelViewers)\n\treturn &ViewersLog{chansViewers: chViewers}\n}", "title": "" }, { "docid": "7033d08865840f3c24667d325cf50fcd", "score": "0.5593078", "text": "func TestLogOperationForDisabledClient(t *testing.T) {\n\tc := constructDisabledClient()\n\terr := c.Log(\"foo\", \"bar\")\n\tif err != nil {\n\t\tt.Fatal(\"Error should not be returned for disabled client\")\n\t}\n}", "title": "" }, { "docid": "2520493e18c8dec77dc1a8d36a6c559c", "score": "0.5588093", "text": "func (l TChannelLogger) Enabled(tlevel tchannel.LogLevel) bool {\n\tvar zlevel zapcore.Level\n\n\t// Log level mapping:\n\t//\n\t// TChannel Zap\n\t// all 0 n/a\n\t// debug 1 -1\n\t// info 2 0\n\t// warn 3 1\n\t// error 4 2\n\t// dpanic n/a 3\n\t// panic n/a 4\n\t// fatal 5 5\n\t//\n\tswitch tlevel {\n\tcase tchannel.LogLevelAll:\n\t\t// zap does not have a log all level, zap minimum log level is debug\n\t\treturn false\n\tcase tchannel.LogLevelFatal:\n\t\tzlevel = zapcore.Level(tlevel)\n\tdefault:\n\t\tzlevel = zapcore.Level(tlevel - 2)\n\t}\n\n\treturn l.logger.Check(zlevel, \"\") != nil\n}", "title": "" }, { "docid": "180f12716975457f6dec8f009a2795d8", "score": "0.55846643", "text": "func TestConsoleLogger(t *testing.T) {\n\ttests := getConsoleLoggerTests()\n\tbuff := new(bytes.Buffer)\n\n\tcLog := New()\n\tcLog.SetWriter(buff)\n\tcLog.SetDisplayColor(false)\n\tcLog.SetBuffersAndWorkers(3, 0)\n\tcLog.SetTimestampFormat(\"MST\")\n\tlog.SetCallerInfoLevels(log.WarnLevel, log.ErrorLevel, log.PanicLevel, log.AlertLevel, log.FatalLevel)\n\tlog.RegisterHandler(cLog, log.AllLevels...)\n\n\tfor i, tt := range tests {\n\n\t\tbuff.Reset()\n\t\tvar l log.LeveledLogger\n\n\t\tif tt.flds != nil {\n\t\t\tl = log.WithFields(tt.flds...)\n\t\t} else {\n\t\t\tl = log.Logger\n\t\t}\n\n\t\tswitch tt.lvl {\n\t\tcase log.DebugLevel:\n\t\t\tif len(tt.printf) == 0 {\n\t\t\t\tl.Debug(tt.msg)\n\t\t\t} else {\n\t\t\t\tl.Debugf(tt.printf, tt.msg)\n\t\t\t}\n\t\tcase log.TraceLevel:\n\t\t\tif len(tt.printf) == 0 {\n\t\t\t\tl.Trace(tt.msg).End()\n\t\t\t} else {\n\t\t\t\tl.Tracef(tt.printf, tt.msg).End()\n\t\t\t}\n\t\tcase log.InfoLevel:\n\t\t\tif len(tt.printf) == 0 {\n\t\t\t\tl.Info(tt.msg)\n\t\t\t} else {\n\t\t\t\tl.Infof(tt.printf, tt.msg)\n\t\t\t}\n\t\tcase log.NoticeLevel:\n\t\t\tif len(tt.printf) == 0 {\n\t\t\t\tl.Notice(tt.msg)\n\t\t\t} else {\n\t\t\t\tl.Noticef(tt.printf, tt.msg)\n\t\t\t}\n\t\tcase log.WarnLevel:\n\t\t\tif len(tt.printf) == 0 {\n\t\t\t\tl.Warn(tt.msg)\n\t\t\t} else {\n\t\t\t\tl.Warnf(tt.printf, tt.msg)\n\t\t\t}\n\t\tcase log.ErrorLevel:\n\t\t\tif len(tt.printf) == 0 {\n\t\t\t\tl.Error(tt.msg)\n\t\t\t} else {\n\t\t\t\tl.Errorf(tt.printf, tt.msg)\n\t\t\t}\n\t\tcase log.PanicLevel:\n\t\t\tfunc() {\n\t\t\t\tdefer func() {\n\t\t\t\t\trecover()\n\t\t\t\t}()\n\n\t\t\t\tif len(tt.printf) == 0 {\n\t\t\t\t\tl.Panic(tt.msg)\n\t\t\t\t} else {\n\t\t\t\t\tl.Panicf(tt.printf, tt.msg)\n\t\t\t\t}\n\t\t\t}()\n\t\tcase log.AlertLevel:\n\t\t\tif len(tt.printf) == 0 {\n\t\t\t\tl.Alert(tt.msg)\n\t\t\t} else {\n\t\t\t\tl.Alertf(tt.printf, tt.msg)\n\t\t\t}\n\t\t}\n\n\t\tif buff.String() != tt.want {\n\n\t\t\tif tt.lvl == log.TraceLevel {\n\t\t\t\tif !strings.HasPrefix(buff.String(), tt.want) {\n\t\t\t\t\tt.Errorf(\"test %d: Expected '%s' Got '%s'\", i, tt.want, buff.String())\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tt.Errorf(\"test %d: Expected '%s' Got '%s'\", i, tt.want, buff.String())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e482907c2be8a63c1e3c0d99b20d44f6", "score": "0.55820495", "text": "func TraceLogger(cfg greenery.Config) greenery.Logger {\n\treturn &zapLogger{zl: zap.New(\n\t\tzapcore.NewCore(\n\t\t\tzapcore.NewConsoleEncoder(zapcore.EncoderConfig{\n\t\t\t\tTimeKey: \"T\",\n\t\t\t\tLevelKey: \"L\",\n\t\t\t\tNameKey: \"N\",\n\t\t\t\tCallerKey: \"C\",\n\t\t\t\tMessageKey: \"M\",\n\t\t\t\tLineEnding: zapcore.DefaultLineEnding,\n\t\t\t\tEncodeLevel: func(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder) {\n\t\t\t\t\t// Zap does not support trace as a level, let's fake it in\n\t\t\t\t\t// our console output as a green TRACE\n\t\t\t\t\tenc.AppendString(fmt.Sprintf(\"\\x1b[%dm%s\\x1b[0m\", uint8(32), \"TRACE\"))\n\t\t\t\t},\n\t\t\t\tEncodeTime: zapcore.ISO8601TimeEncoder,\n\t\t\t\tEncodeDuration: zapcore.StringDurationEncoder,\n\t\t\t\tEncodeCaller: zapcore.ShortCallerEncoder,\n\t\t\t}),\n\t\t\tzap.CombineWriteSyncers(zapcore.AddSync(os.Stdout)),\n\t\t\tzapcore.DebugLevel),\n\t\tzap.AddCallerSkip(2),\n\t\tzap.Development(),\n\t\tzap.AddCaller())}\n}", "title": "" }, { "docid": "c0569202355774cb936128739fc7f705", "score": "0.55625343", "text": "func (s *LoggerTestSuite) TestLevelEnablerUnknownReturnsTrue(t *testing.T) {\n\tt.Skip(\"this test case is deprecated and is already covered by TestLevelEnabler\")\n}", "title": "" }, { "docid": "cd0c20c63e9859e725b92b69c48039d5", "score": "0.5552921", "text": "func TestConfigA(test *testing.T) {\n\tvar logger Logger\n\tlogger = New(\"main\", DEBUG, nil)\n\tlogger.JsonConfig([]byte(`\n { \"level\": \"INFO\"\n }\n `))\n\tif logger.Level() != INFO {\n\t\ttest.Error(\"Expected log level to be INFO for `main`\")\n\t}\n\n\tlogger = logger.New(\"main.test\")\n\tif logger.Level() != INFO {\n\t\ttest.Error(\"Expected log level to be INFO for `main.test`\")\n\t}\n}", "title": "" }, { "docid": "717fe9402bef53e47b6492f68aba4640", "score": "0.5515646", "text": "func TestLoggerCore(t *testing.T) {\n\n\tlogger := NewLogger()\n\tlogger.SetLevel(DebugLevel)\n\n\tbuffer := bytes.NewBuffer(make([]byte, 0))\n\tlogger.SetEncoder(func(log *Log, timeFormat string) []byte {\n\t\treturn []byte(log.msg)\n\t})\n\tlogger.SetWriter(buffer)\n\n\tlogger.Debug(DebugLevel.String())\n\tlogger.Info(InfoLevel.String())\n\tlogger.Warn(WarnLevel.String())\n\tlogger.Error(ErrorLevel.String())\n\n\ts := buffer.String()\n\tif s != DebugLevel.String()+InfoLevel.String()+WarnLevel.String()+ErrorLevel.String() {\n\t\tt.Fatalf(\"core log %s is wrong\", s)\n\t}\n}", "title": "" }, { "docid": "fb82b56cf58c6fa9914d27449412179d", "score": "0.54862994", "text": "func createZapLogDirs() {\n\tif zlogDir != \"\" {\n\t\tzlogDirs = append(zlogDirs, zlogDir)\n\t}\n\tzlogDirs = append(zlogDirs, os.TempDir())\n}", "title": "" }, { "docid": "7150da3f31a8f0fc8c1a9fe9f080af90", "score": "0.54790694", "text": "func TestNilLogger(t *testing.T) {\n\tvar log *Logger\n\n\tlog.Debugf(\"prefix\", \"Hello %s\", \"there\")\n\tlog.Infof(\"prefix\", \"Hello %s\", \"there\")\n\tlog.Warnf(\"prefix\", \"Hello %s\", \"there\")\n\tlog.Errorf(\"prefix\", \"Hello %s\", \"there\")\n\tlog.Panicf(\"prefix\", \"Hello %s\", \"there\")\n}", "title": "" }, { "docid": "24bd7c93f731272ee4b31d75765361a6", "score": "0.54756594", "text": "func New(logger logur.Logger) *zap.Logger {\n\tz := &zapper{\n\t\tlogger: logger,\n\t}\n\n\tif levelEnabler, ok := logger.(logur.LevelEnabler); ok {\n\t\tz.levelEnabler = levelEnabler\n\t}\n\n\treturn zap.New(z)\n}", "title": "" }, { "docid": "e45a3a95325f1659c8b06a1ace5ef6bc", "score": "0.5471918", "text": "func setUpLogger() {\n\tfileName := \"frontier\" + time.Now().Format(\"20060102150405\") + \".log\"\n\twriter := zapcore.AddSync(\n\t\t&lumberjack.Logger{\n\t\t\tFilename: \"/tmp/\" + fileName,\n\t\t\tMaxSize: 50, // megabytes\n\t\t\tMaxBackups: 3,\n\t\t\tMaxAge: 28, // days\n\t\t},\n\t)\n\topt := zap.ErrorOutput(writer)\n\tencoderConfig := zap.NewProductionEncoderConfig()\n\tencoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder\n\tencoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder\n\tencoderConfig.EncodeCaller = zapcore.ShortCallerEncoder\n\tcfg := zap.Config{\n\t\tEncoding: \"console\",\n\t\tLevel: zap.NewAtomicLevelAt(getLogLevel(configs.LOG_LEVEL)),\n\t\tOutputPaths: []string{\"stderr\", \"/tmp/\" + fileName},\n\t\tErrorOutputPaths: []string{\"stderr\", \"/tmp/\" + fileName},\n\t\tEncoderConfig: encoderConfig,\n\t}\n\t_logger, _ := cfg.Build(opt)\n\tLOGGER = _logger.Sugar()\n}", "title": "" }, { "docid": "aeddc73c0fcb8916f54a6a5fe67ca54f", "score": "0.54670817", "text": "func New(logFormat, logLevel string) error {\n\tvar zapConfig zap.Config\n\tswitch logFormat {\n\tcase \"json\":\n\t\tzapConfig = zap.NewProductionConfig()\n\t\tzapConfig.DisableStacktrace = true\n\tdefault:\n\t\tzapConfig = zap.NewDevelopmentConfig()\n\t\tzapConfig.DisableStacktrace = true\n\t\tzapConfig.DisableCaller = true\n\t\tzapConfig.EncoderConfig.EncodeTime = func(t time.Time, enc zapcore.PrimitiveArrayEncoder) {}\n\t\tzapConfig.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder\n\t}\n\n\tzapConfig.EncoderConfig.TimeKey = \"timestamp\"\n\tzapConfig.EncoderConfig.LevelKey = \"log_level\"\n\tzapConfig.EncoderConfig.MessageKey = \"message\"\n\tzapConfig.EncoderConfig.EncodeTime = func(t time.Time, encoder zapcore.PrimitiveArrayEncoder) {\n\t\tencoder.AppendString(t.Format(\"2006-01-02T15:04:05.000Z07:00\"))\n\t}\n\n\t// Set the logger\n\tswitch logLevel {\n\tcase \"debug\":\n\t\tzapConfig.Level = zap.NewAtomicLevelAt(zap.DebugLevel)\n\tcase \"info\":\n\t\tzapConfig.Level = zap.NewAtomicLevelAt(zap.InfoLevel)\n\tcase \"warn\":\n\t\tzapConfig.Level = zap.NewAtomicLevelAt(zap.WarnLevel)\n\tcase \"error\":\n\t\tzapConfig.Level = zap.NewAtomicLevelAt(zap.ErrorLevel)\n\tcase \"fatal\":\n\t\tzapConfig.Level = zap.NewAtomicLevelAt(zap.FatalLevel)\n\tdefault:\n\t\tzapConfig.Level = zap.NewAtomicLevelAt(zap.InfoLevel)\n\t}\n\tlogger, err := zapConfig.Build()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo func(config zap.Config) {\n\n\t\tdefaultLevel := config.Level\n\t\tvar elevated bool\n\n\t\tc := make(chan os.Signal, 1)\n\t\tsignal.Notify(c, os.Interrupt, syscall.SIGUSR1)\n\t\tfor s := range c {\n\t\t\tif s == syscall.SIGINT {\n\t\t\t\treturn\n\t\t\t}\n\t\t\televated = !elevated\n\n\t\t\tif elevated {\n\t\t\t\tconfig.Level.SetLevel(zap.DebugLevel)\n\t\t\t\tlogger.Info(\"Log level elevated to debug\")\n\t\t\t} else {\n\t\t\t\tlogger.Info(\"Log level restored to original configuration\", zap.String(\"level\", logLevel))\n\t\t\t\tconfig.Level.SetLevel(defaultLevel.Level())\n\t\t\t}\n\t\t}\n\t}(zapConfig)\n\twrappedLogger.zap = logger\n\treturn nil\n}", "title": "" }, { "docid": "7ab2c1ed4615f00a23862a0a1b5f2397", "score": "0.54549587", "text": "func setupLogger() {\n\tlog.SetOutput(ioutil.Discard)\n\n\t// set log level\n\tlog.SetLevel(log.InfoLevel)\n\tif *debug {\n\t\tlog.SetLevel(log.DebugLevel)\n\t}\n\n\t// add hook to send info, debug, warn level logs to stdout\n\tlog.AddHook(&LogHook{\n\t\tWriter: os.Stdout,\n\t\tLoglevels: []log.Level{\n\t\t\tlog.InfoLevel,\n\t\t\tlog.DebugLevel,\n\t\t\tlog.WarnLevel,\n\t\t},\n\t})\n\n\t// add hook to send panic, fatal, error logs to stderr\n\tlog.AddHook(&LogHook{\n\t\tWriter: os.Stderr,\n\t\tLoglevels: []log.Level{\n\t\t\tlog.PanicLevel,\n\t\t\tlog.FatalLevel,\n\t\t\tlog.ErrorLevel,\n\t\t},\n\t})\n}", "title": "" }, { "docid": "ef5f4be31208418e408e404ae191a437", "score": "0.54504085", "text": "func TestLogActionOperationForEnabledClient(t *testing.T) {\n\tc := constructEnabledClient()\n\terr := c.LogAction(\"foo\", \"bar\", \"description\")\n\tif err == nil {\n\t\tt.Fatal(\"Error should be returned for enabled client with improper address\")\n\t}\n}", "title": "" }, { "docid": "4a0e3a0b92a0164c1367c9a7c702c157", "score": "0.54370284", "text": "func TestLogLevel(t *testing.T) {\n\toldLogger := logger\n\tdefer func() { logger = oldLogger }()\n\tlogger = &mockLogger{}\n\n\t// logs below info(like debug) won't print\n\tSetLevel(\"info\")\n\n\ttests := []struct {\n\t\tname string\n\t\tlogFunc func(context.Context, any)\n\t\tlogMsg string\n\t\texpected bool\n\t}{\n\t\t{name: \"debug\", logFunc: Debug, logMsg: debugMsg, expected: false},\n\t\t{name: \"info\", logFunc: Info, logMsg: infoMsg, expected: true},\n\t\t{name: \"warning\", logFunc: Warning, logMsg: infoMsg, expected: true},\n\t\t{name: \"error\", logFunc: Error, logMsg: errorMsg, expected: true},\n\t}\n\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\n\t\t\ttest.logFunc(context.Background(), test.logMsg)\n\t\t\tlogs := logger.(*mockLogger).logs\n\t\t\tgot := strings.Contains(logs, test.logMsg)\n\n\t\t\tif got != test.expected {\n\t\t\t\tt.Errorf(\"expected : %v, got %v\", test.expected, got)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "5b3010c5a2faf5c89c2b2eea3228a42f", "score": "0.543379", "text": "func TestLoggerNeedCaller(t *testing.T) {\n\n\tlogger := NewLogger()\n\n\tlogger.NeedCaller(true)\n\tif logger.needCaller != true {\n\t\tt.Fatal(\"needCaller set is wrong\")\n\t}\n}", "title": "" }, { "docid": "d32a8796e7fd996dafdec8f98cfdf3e4", "score": "0.54190403", "text": "func configureLogp() {\n\toneTimeLogpInit.Do(func() {\n\t\tif testing.Verbose() {\n\t\t\tlogp.DevelopmentSetup(logp.WithSelectors(\"aalog\"))\n\t\t\tlogp.Info(\"DEBUG enabled for aalog.\")\n\t\t} else {\n\t\t\tlogp.DevelopmentSetup(logp.WithLevel(logp.WarnLevel))\n\t\t}\n\t})\n}", "title": "" }, { "docid": "8fe1dd11b6a1054762af2bd8fecc9826", "score": "0.54113716", "text": "func _TestLogsNoDebug(t *testing.T) {\n // init\n DebugLogs = false\n\n logPerfs.Reset()\n\n doLogRun()\n\n if logPerfs.Value(PERF_LOG_DEBUG) != 0 {\n t.Fatalf(\n \"TestLogsNoDebug failed: debug count %d\",\n logPerfs.Value(PERF_LOG_DEBUG) ,\n )\n }\n\n fmt.Println(\"TestLogsNoDebug: passed\")\n}", "title": "" }, { "docid": "4d5a6b575162ab6931d84cd0b50d8ba2", "score": "0.53990906", "text": "func setLogs(logFormat, logLevel string) error {\n\tvar zapConfig zap.Config\n\n\tswitch logFormat {\n\tcase \"json\":\n\t\tzapConfig = zap.NewProductionConfig()\n\t\tzapConfig.DisableStacktrace = true\n\tdefault:\n\t\tzapConfig = zap.NewDevelopmentConfig()\n\t\tzapConfig.DisableStacktrace = true\n\t\tzapConfig.DisableCaller = true\n\t\tzapConfig.EncoderConfig.EncodeTime = func(t time.Time, enc zapcore.PrimitiveArrayEncoder) {}\n\t\tzapConfig.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder\n\t}\n\n\t// Set the logger\n\tswitch logLevel {\n\tcase \"trace\":\n\t\tzapConfig.Level = zap.NewAtomicLevelAt(zap.DebugLevel)\n\tcase \"debug\":\n\t\tzapConfig.Level = zap.NewAtomicLevelAt(zap.DebugLevel)\n\tcase \"info\":\n\t\tzapConfig.Level = zap.NewAtomicLevelAt(zap.InfoLevel)\n\tcase \"warn\":\n\t\tzapConfig.Level = zap.NewAtomicLevelAt(zap.WarnLevel)\n\tcase \"error\":\n\t\tzapConfig.Level = zap.NewAtomicLevelAt(zap.ErrorLevel)\n\tcase \"fatal\":\n\t\tzapConfig.Level = zap.NewAtomicLevelAt(zap.FatalLevel)\n\tdefault:\n\t\tzapConfig.Level = zap.NewAtomicLevelAt(zap.InfoLevel)\n\t}\n\n\tlogger, err := zapConfig.Build()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tzap.ReplaceGlobals(logger)\n\treturn nil\n}", "title": "" }, { "docid": "3159961a671ad5cd95487724fd72f298", "score": "0.5397665", "text": "func EnableDebug() {\n\tl := zerolog.New(os.Stdout).With().Timestamp().Logger().Output(zerolog.ConsoleWriter{Out: os.Stdout})\n\tSetLogger(&l)\n\tzapLevel.SetLevel(zapcore.DebugLevel)\n}", "title": "" }, { "docid": "0370e6165520d8a47e373f95aade1022", "score": "0.5395982", "text": "func testLogger(t *testing.T) *log.Logger {\n\treturn log.New(testWriter{t}, \"\", log.LstdFlags)\n}", "title": "" }, { "docid": "7f75dc3795cfe4087f4d41946c1aa64c", "score": "0.53834045", "text": "func (l *Logging) ZapLogger(name string) *zap.Logger {\n\tif !isValidLoggerName(name) {\n\t\tpanic(fmt.Sprintf(\"invalid logger name: %s\", name))\n\t}\n\n\tl.mutex.RLock()\n\tcore := &Core{\n\t\tLevelEnabler: l.LoggerLevels,\n\t\tLevels: l.LoggerLevels,\n\t\tEncoders: map[Encoding]zapcore.Encoder{\n\t\t\tJSON: zapcore.NewJSONEncoder(l.encoderConfig),\n\t\t\tCONSOLE: fabenc.NewFormatEncoder(l.multiFormatter),\n\t\t\tLOGFMT: zaplogfmt.NewEncoder(l.encoderConfig),\n\t\t},\n\t\tSelector: l,\n\t\tOutput: l,\n\t\tObserver: l,\n\t}\n\tl.mutex.RUnlock()\n\n\treturn NewZapLogger(core).Named(name)\n}", "title": "" }, { "docid": "d6ff6d8b57555c2c892d9c3f42066029", "score": "0.5379358", "text": "func TestTelemetryEnabled(t *testing.T) {\n\n\tt.Run(\"tracer start, profiler start\", func(t *testing.T) {\n\t\ttelemetryClient := new(telemetrytest.MockClient)\n\t\tdefer telemetry.MockGlobalClient(telemetryClient)()\n\n\t\ttracer.Start()\n\t\tdefer tracer.Stop()\n\n\t\tStart(\n\t\t\tWithProfileTypes(\n\t\t\t\tHeapProfile,\n\t\t\t),\n\t\t)\n\t\tdefer Stop()\n\n\t\tassert.True(t, telemetryClient.ProfilerEnabled)\n\t\ttelemetry.Check(t, telemetryClient.Configuration, \"heap_profile_enabled\", true)\n\t})\n\tt.Run(\"only profiler start\", func(t *testing.T) {\n\t\ttelemetryClient := new(telemetrytest.MockClient)\n\t\tdefer telemetry.MockGlobalClient(telemetryClient)()\n\t\tStart(\n\t\t\tWithProfileTypes(\n\t\t\t\tHeapProfile,\n\t\t\t),\n\t\t)\n\t\tdefer Stop()\n\n\t\tassert.True(t, telemetryClient.ProfilerEnabled)\n\t\ttelemetry.Check(t, telemetryClient.Configuration, \"heap_profile_enabled\", true)\n\t})\n}", "title": "" }, { "docid": "6ebf556523976ee7e1922506d418b113", "score": "0.53772426", "text": "func SetLogger(logLevel string, debugMode bool) {\n\n\t// new *zap.Logger\n\t// new zapcore.EncoderConfig for the logger\n\tvar logger *zap.Logger\n\tvar encoderCfg zapcore.EncoderConfig\n\n\t// new AtomicLevel for dynamic logging level\n\tatom := zap.NewAtomicLevel()\n\n\t// switch on debug mode\n\tswitch debugMode {\n\tcase true:\n\n\t\t// set the log level\n\t\tatom.SetLevel(zap.DebugLevel)\n\n\t\t// configure the logger\n\t\tencoderCfg = zap.NewDevelopmentEncoderConfig()\n\n\tdefault:\n\n\t\t// set the log level\n\t\tswitch logLevel {\n\t\tcase \"panic\":\n\t\t\tatom.SetLevel(zap.PanicLevel)\n\t\tcase \"fatal\":\n\t\t\tatom.SetLevel(zap.FatalLevel)\n\t\tcase \"error\":\n\t\t\tatom.SetLevel(zap.ErrorLevel)\n\t\tcase \"warn\":\n\t\t\tatom.SetLevel(zap.WarnLevel)\n\t\tcase \"debug\":\n\t\t\tatom.SetLevel(zap.DebugLevel)\n\t\tdefault:\n\t\t\tatom.SetLevel(zap.InfoLevel)\n\t\t}\n\n\t\t// configure the logger\n\t\tencoderCfg = zap.NewProductionEncoderConfig()\n\t}\n\n\t// encodings\n\tencoderCfg.EncodeTime = syslogTimeEncoder\n\tencoderCfg.EncodeCaller = zapcore.ShortCallerEncoder\n\tencoderCfg.EncodeLevel = zapcore.CapitalColorLevelEncoder\n\n\t// keys\n\tencoderCfg.CallerKey = \"caller\"\n\tencoderCfg.TimeKey = \"ts\"\n\tencoderCfg.LevelKey = \"lvl\"\n\tencoderCfg.MessageKey = \"msg\"\n\n\t// create the logger\n\tenc := zapcore.NewConsoleEncoder(encoderCfg)\n\tlogger = zap.New(zapcore.NewCore(\n\t\tenc,\n\t\tzapcore.Lock(os.Stdout),\n\t\tatom,\n\t), zap.AddCaller())\n\n\t// set the global logger\n\t_ = zap.ReplaceGlobals(logger)\n}", "title": "" }, { "docid": "aa355d928e82b3f3fe296a02a652a882", "score": "0.5375475", "text": "func TestDefaultLogEntry(t *testing.T) {\n\topts := []Option{\n\t\tWithLogDir(\"./logs\"), // 日志目录\n\t\tWithLogFilename(\"zap-web.log\"), // 日志文件名,默认zap.log\n\t\tWithStdout(false), // 一般生产环境,建议不输出到stdout\n\t\tWithJsonFormat(true), // json格式化\n\t\tWithAddCaller(true), // 打印行号\n\t\tWithCallerSkip(2), // 如果基于这个Logger包,再包装一次,这个skip = 2,以此类推\n\t\tWithEnableColor(false), // 日志是否染色,默认不染色\n\t\tWithLogLevel(zap.DebugLevel), // 设置日志打印最低级别,如果不设置默认为info级别\n\t\tWithMaxAge(3), // 最大保存3天\n\t\tWithMaxSize(20), // 每个日志文件最大20MB\n\t\tWithCompress(false), // 日志不压缩\n\t\t// WithHostname(\"myapp.com\"), // 设置hostname\n\t}\n\n\t// 生成默认的日志句柄对象\n\tDefault(opts...)\n\n\t// 模拟请求id\n\treqId := RndUUIDMd5()\n\tctx := context.Background()\n\tctx = context.WithValue(ctx, XRequestID, reqId)\n\n\tDebug(ctx, \"hello daheige\", map[string]interface{}{\n\t\t\"a\": 1,\n\t})\n\n\tInfo(ctx, \"hello\", map[string]interface{}{\n\t\t\"a\": 1,\n\t\t\"b\": 2,\n\t\t\"c\": \"world\",\n\t})\n\n\tError(ctx, \"exec error\", zap.Any(\"details\", map[string]interface{}{\n\t\t\"name\": \"zap\",\n\t\t\"age\": 30,\n\t}))\n\n\tWarn(ctx, \"run warning\", \"key\", 1234, \"abc\", \"hello world\")\n\n\t// DPanic调试信息\n\tDPanic(ctx, \"panic debug\", \"abc\", 23456, \"message\", \"hello world\")\n}", "title": "" }, { "docid": "5a54e65b7dd9650a686b96655bc57c0f", "score": "0.53720963", "text": "func SetUpLogger(config *LoggerConfig) {\n\tcfg := zap.NewProductionEncoderConfig()\n\tcfg.EncodeLevel = zapcore.CapitalLevelEncoder\n\tcfg.EncodeTime = zapcore.ISO8601TimeEncoder\n\n\tcores := []zapcore.Core{}\n\n\tif config.File.Enabled {\n\t\tcore := createFileLoggerCore(&config.File, zapcore.NewJSONEncoder(cfg))\n\t\tcores = append(cores, core)\n\t}\n\n\tif config.Console.Enabled {\n\t\tconsoleLevel := ParseLevels(config.Console.Level)\n\t\tcore := zapcore.NewCore(zapcore.NewConsoleEncoder(cfg), zapcore.Lock(os.Stdout), consoleLevel)\n\t\tcores = append(cores, core)\n\t}\n\n\textras := len(config.extraFiles)\n\tif extras > 0 {\n\t\tfor i := 0; i < extras; i++ {\n\t\t\tfileCfg := config.extraFiles[i]\n\t\t\tif fileCfg.Enabled {\n\t\t\t\tcore := createFileLoggerCore(fileCfg, zapcore.NewJSONEncoder(cfg))\n\t\t\t\tcores = append(cores, core)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(cores) > 0 {\n\t\tcore := zapcore.NewTee(cores...)\n\n\t\tlogger := zap.New(core)\n\t\tLogger = logger\n\n\t\tSLogger = logger.Sugar()\n\t}\n}", "title": "" }, { "docid": "a6e120ffb1dcdb734e9751632c160322", "score": "0.5367673", "text": "func TestGoLogger(t *testing.T) {\n\tlevel := logger.Level()\n\tdefer logger.SetLevel(level)\n\n\tlog.SetOutput(os.Stdout)\n\n\tlogger.SetLevel(logger.LevelDebug)\n\tlogger.SetLogger(logger.NewGoLogger())\n\n\tlogger.Debugf(\"Debug.\")\n\tlogger.Infof(\"Info.\")\n\tlogger.Warningf(\"Warning.\")\n\tlogger.Errorf(\"Error.\")\n\tlogger.Criticalf(\"Critical.\")\n}", "title": "" }, { "docid": "701eec638272f2e322dd800efc5a74b5", "score": "0.53581804", "text": "func init() {\n\tlogger := GetLogger(true)\n\tLog = logger.WithFields(logrus.Fields{\n\t\t\"env\": \"testing\",\n\t})\n}", "title": "" }, { "docid": "e6723058e6c1a286008ad9893f31bb5c", "score": "0.53573287", "text": "func WithZapLogger(lg *zap.Logger) Option {\n\treturn func(c *Client) {\n\t\tc.lg = lg\n\t}\n}", "title": "" }, { "docid": "2ed04f64f026b868b069b0be1afbae0d", "score": "0.53549623", "text": "func TestLoggerLevel(t *testing.T) {\n\n\tlogger := NewLogger()\n\n\tif logger.Level() != logger.level {\n\t\tt.Fatalf(\"level returned %v is wrong\", logger.Level())\n\t}\n\n\trealOldLevel := logger.level\n\tif oldLevel := logger.SetLevel(InfoLevel); oldLevel != realOldLevel || logger.level != InfoLevel {\n\t\tt.Fatalf(\"level set or old level %v is wrong\", oldLevel)\n\t}\n}", "title": "" }, { "docid": "3416626f8dc112220bed2a2e177f0d29", "score": "0.5352161", "text": "func NewForTest() (Logger, *observer.ObservedLogs) {\n\tcore, recorded := observer.New(zapcore.InfoLevel)\n\treturn NewWithZap(zap.New(core)), recorded\n}", "title": "" }, { "docid": "3416626f8dc112220bed2a2e177f0d29", "score": "0.5352161", "text": "func NewForTest() (Logger, *observer.ObservedLogs) {\n\tcore, recorded := observer.New(zapcore.InfoLevel)\n\treturn NewWithZap(zap.New(core)), recorded\n}", "title": "" }, { "docid": "f05794601a3fd864b4416d16c1230c6b", "score": "0.53477424", "text": "func SetupLogs(logFileName string) {\n\tlogger := zap.New(zapcore.NewTee(\n\t\tzapcore.NewCore(zapcore.NewConsoleEncoder(zapcore.EncoderConfig{\n\t\t\tMessageKey: \"msg\",\n\t\t\tLevelKey: \"level\",\n\t\t\tTimeKey: \"ts\",\n\t\t\tCallerKey: \"file\",\n\t\t\tEncodeLevel: zapcore.CapitalLevelEncoder,\n\t\t\tEncodeTime: func(time time.Time, encoder zapcore.PrimitiveArrayEncoder) {\n\t\t\t\tencoder.AppendString(time.Format(\"2006-01-02 15:04:05\"))\n\t\t\t},\n\t\t\tEncodeDuration: func(duration time.Duration, encoder zapcore.PrimitiveArrayEncoder) {\n\t\t\t\tencoder.AppendInt64(int64(duration) / 1000000)\n\t\t\t},\n\t\t\tEncodeCaller: zapcore.ShortCallerEncoder,\n\t\t}), zapcore.AddSync(&lumberjack.Logger{\n\t\t\tFilename: logFileName, // 日志路径\n\t\t\tMaxSize: 5, // 日志大小, 单位是M\n\t\t\tMaxAge: 7, // 最多保存多少天\n\t\t\tMaxBackups: 5, // 最多备份多少个\n\t\t\tCompress: true, // 压缩\n\t\t}), zap.LevelEnablerFunc(func(level zapcore.Level) bool {\n\t\t\treturn level >= zapcore.DebugLevel\n\t\t})),\n\t\tzapcore.NewCore(zapcore.NewConsoleEncoder(zapcore.EncoderConfig{\n\t\t\tMessageKey: \"M\",\n\t\t\tLevelKey: \"\",\n\t\t\tTimeKey: \"\",\n\t\t\tNameKey: \"\",\n\t\t\tCallerKey: \"\",\n\t\t\tStacktraceKey: \"\",\n\t\t}), zapcore.Lock(os.Stdout), zap.LevelEnablerFunc(func(level zapcore.Level) bool {\n\t\t\treturn level >= zapcore.ErrorLevel\n\t\t})),\n\t), zap.AddCaller())\n\tzap.ReplaceGlobals(logger)\n}", "title": "" }, { "docid": "ea22e85e8d2733d1e33e082b14e174bd", "score": "0.5343849", "text": "func NewZapNopLogger() *ZapNopLogger {\n\treturn &ZapNopLogger{\n\t\tLogger: zap.NewNop(),\n\t\tlevel: zap.DebugLevel,\n\t}\n}", "title": "" }, { "docid": "1a3365d7ce769339fe34188b52e2c11f", "score": "0.5340308", "text": "func traceEnabled() bool {\n\treturn trace.enabled\n}", "title": "" }, { "docid": "ab0da2dfb26a1eb46361f71d5bd3113c", "score": "0.5338241", "text": "func TestLogLevel(t *testing.T) {\n\n\tb := new(bytes.Buffer)\n\tl := New(log.New(b, \"\", 0), WARN)\n\tInfo(WithLogger(context.Background(), l), \"test info\")\n\tif got, want := b.String(), \"\"; got != want {\n\t\tt.Fatalf(\"ontext Logger => %q; want %q\", got, want)\n\t}\n\tWarn(WithLogger(context.Background(), l), \"test info\")\n\tif got, want := b.String(), \"status=warn test info \\n\"; got != want {\n\t\tt.Fatalf(\"ontext Logger => %q; want %q\", got, want)\n\t}\n}", "title": "" }, { "docid": "957101e4b009710524ce5a5381b24983", "score": "0.5331056", "text": "func (logInstance *LogInstance) GetLogger() *zap.Logger {\n logInstance.logInitialized.Do(func() {\n log.Fatal(\"Get logger called before logger initialization!\")\n })\n return logInstance.log\n}", "title": "" }, { "docid": "d710a5fafa95c1d32d9573ddc49e2cf9", "score": "0.5322525", "text": "func CreateZapLogger(name string) (*SyncLogger, error) {\n\tzLog, err := createZapLogger()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create zap logger %w\", err)\n\t}\n\tlog := zapr.NewLogger(zLog).WithName(name)\n\treturn &SyncLogger{\n\t\tLog: log,\n\t\tSync: zLog.Sync,\n\t}, nil\n}", "title": "" }, { "docid": "a0362fde26b43220db950c5e07351cb4", "score": "0.5316422", "text": "func TestSysLogger(t *testing.T) {\n\tassert := audit.NewTestingAssertion(t, true)\n\tlevel := logger.Level()\n\tdefer logger.SetLevel(level)\n\n\tlogger.SetLevel(logger.LevelDebug)\n\n\tsl, err := logger.NewSysLogger(\"GOAS\")\n\tassert.Nil(err)\n\tlogger.SetLogger(sl)\n\n\tlogger.Debugf(\"Debug.\")\n\tlogger.Infof(\"Info.\")\n\tlogger.Warningf(\"Warning.\")\n\tlogger.Errorf(\"Error.\")\n\tlogger.Criticalf(\"Critical.\")\n}", "title": "" }, { "docid": "5dc14351792e1d21a73ac8575be24592", "score": "0.53057694", "text": "func Setup(enableDebugOptions bool, enableVerboseLogging bool) {\n\t// Create the logging directory if needed\n\tloggingDirectory := filepath.Dir(getLogFilePath())\n\tif !utils.DoesFileExists(loggingDirectory) {\n\t\tif err := os.Mkdir(loggingDirectory, 0700); err != nil {\n\t\t\tlogger.Errorln(\"unable to create logs directory\", loggingDirectory, err)\n\t\t}\n\t}\n\n\t// Write logs to a file\n\tpath := getLogFilePath()\n\twriter, _ := rotatelogs.New(\n\t\tpath+\".%Y%m%d%H%M\",\n\t\trotatelogs.WithLinkName(path),\n\t\trotatelogs.WithMaxAge(time.Duration(86400)*time.Second),\n\t\trotatelogs.WithRotationTime(time.Duration(604800)*time.Second),\n\t)\n\n\tlogMapping := lfshook.WriterMap{\n\t\tlogrus.InfoLevel: writer,\n\t\tlogrus.DebugLevel: writer,\n\t\tlogrus.TraceLevel: writer,\n\t\tlogrus.WarnLevel: writer,\n\t\tlogrus.ErrorLevel: writer,\n\t\tlogrus.FatalLevel: writer,\n\t}\n\n\tlogger.AddHook(lfshook.NewHook(\n\t\tlogMapping,\n\t\t&logger.TextFormatter{},\n\t))\n\n\tif enableVerboseLogging {\n\t\tlogrus.SetLevel(logrus.TraceLevel)\n\t} else {\n\t\tlogrus.SetLevel(logrus.InfoLevel)\n\t}\n\n\t// Write to stdout console\n\tlogger.SetOutput(os.Stdout)\n\n\t// Write to our custom logging hook for the log API\n\t_logger := new(OCLogger)\n\tlogger.AddHook(_logger)\n\n\tif enableDebugOptions {\n\t\tlogrus.SetReportCaller(true)\n\t}\n\n\tLogger = _logger\n}", "title": "" }, { "docid": "7c4faf46c2d4c650dae6e2791803529e", "score": "0.5288982", "text": "func New() *zap.Logger {\n\n\tlvl := zap.NewAtomicLevelAt(zapcore.InfoLevel)\n\tvar encoderConfig zapcore.EncoderConfig\n\tencoderConfig = zap.NewProductionEncoderConfig()\n\tencoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder\n\tencoderConfig.EncodeDuration = zapcore.StringDurationEncoder\n\n\tzconf := zap.Config{\n\t\tDisableCaller: true,\n\t\tDisableStacktrace: true,\n\t\tLevel: lvl,\n\t\tEncoding: \"json\",\n\t\tEncoderConfig: encoderConfig,\n\t\tOutputPaths: []string{\"stdout\"},\n\t\tErrorOutputPaths: []string{\"stderr\"},\n\t}\n\n\tlogger, err := l.New(zconf)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Build:%v\", err))\n\t}\n\n\treturn logger\n}", "title": "" }, { "docid": "0934833637465e5a6d00836b80ef61ee", "score": "0.5282963", "text": "func TestShimLogging(t *testing.T) {\n\tSetLoggingLevel(LogCritical)\n\tif shimLoggingLevel != LogCritical {\n\t\tt.Errorf(\"shimLoggingLevel is not LogCritical as expected\")\n\t}\n\tif chaincodeLogger.IsEnabledFor(logging.DEBUG) {\n\t\tt.Errorf(\"The chaincodeLogger should not be enabled for DEBUG\")\n\t}\n\tif !chaincodeLogger.IsEnabledFor(logging.CRITICAL) {\n\t\tt.Errorf(\"The chaincodeLogger should be enabled for CRITICAL\")\n\t}\n\tvar level LoggingLevel\n\tvar err error\n\tlevel, err = LogLevel(\"debug\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(debug) failed\")\n\t}\n\tif level != LogDebug {\n\t\tt.Errorf(\"LogLevel(debug) did not return LogDebug\")\n\t}\n\tlevel, err = LogLevel(\"INFO\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(INFO) failed\")\n\t}\n\tif level != LogInfo {\n\t\tt.Errorf(\"LogLevel(INFO) did not return LogInfo\")\n\t}\n\tlevel, err = LogLevel(\"Notice\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(Notice) failed\")\n\t}\n\tif level != LogNotice {\n\t\tt.Errorf(\"LogLevel(Notice) did not return LogNotice\")\n\t}\n\tlevel, err = LogLevel(\"WaRnInG\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(WaRnInG) failed\")\n\t}\n\tif level != LogWarning {\n\t\tt.Errorf(\"LogLevel(WaRnInG) did not return LogWarning\")\n\t}\n\tlevel, err = LogLevel(\"ERRor\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(ERRor) failed\")\n\t}\n\tif level != LogError {\n\t\tt.Errorf(\"LogLevel(ERRor) did not return LogError\")\n\t}\n\tlevel, err = LogLevel(\"critiCAL\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(critiCAL) failed\")\n\t}\n\tif level != LogCritical {\n\t\tt.Errorf(\"LogLevel(critiCAL) did not return LogCritical\")\n\t}\n\tlevel, err = LogLevel(\"foo\")\n\tif err == nil {\n\t\tt.Errorf(\"LogLevel(foo) did not fail\")\n\t}\n\tif level != LogError {\n\t\tt.Errorf(\"LogLevel(foo) did not return LogError\")\n\t}\n}", "title": "" }, { "docid": "90c1165a82b3fff0f5bdce4ddbd47614", "score": "0.52747416", "text": "func TestFileLogger(t *testing.T) {\n\tlogger := NewFileLogger(LogLevelDebug, \"/Users/linger/logs/\",\"test\")\n\tlogger.Debug(\"user id[%d] is come from china\", 123)\n\tlogger.Warn(\"test warn log\")\n\tlogger.Fatal(\"test fatal log\")\n\tlogger.Close()\n\n}", "title": "" }, { "docid": "c3429f2e065505572e690ef4e0fc97aa", "score": "0.52701217", "text": "func SetupLogger() {\n\tlog.SetFormatter(&log.TextFormatter{})\n\tif DEBUG == 1 {\n\t\tlog.SetLevel(log.DebugLevel)\n\t} else {\n\t\tlog.SetLevel(log.InfoLevel)\n\t}\n}", "title": "" }, { "docid": "cdbe23ab28cb9fafc764e739506794ce", "score": "0.5254332", "text": "func (w *Writer) LogEnabled(Entry) bool { return true }", "title": "" }, { "docid": "b3a8f5e94e77232dddf06bda14d87dc4", "score": "0.5240359", "text": "func Get() *zap.Logger {\n\treturn wrappedLogger.zap\n}", "title": "" }, { "docid": "ecf5de36b4d817787e3dd4d945409fe6", "score": "0.5236541", "text": "func setupLogger(flags Flags) func() {\n\tlevel := clog.LevelInfo\n\tif flags.debug {\n\t\tlevel = clog.LevelTrace\n\t} else if flags.verbose {\n\t\tlevel = clog.LevelDebug\n\t} else if flags.quiet {\n\t\tlevel = clog.LevelWarning\n\t}\n\tclog.SetDefaultLogger(clog.NewFilteredConsoleLogger(level))\n\treturn nil\n}", "title": "" }, { "docid": "5c52cc3d4acc368f4ca99c4bf9b5fa3e", "score": "0.5235379", "text": "func TestNewLogger(t *testing.T) {\n\tnewLogger(nil)\n}", "title": "" }, { "docid": "60506c7ae8412bfcca08e914157f49c7", "score": "0.5230917", "text": "func TestVmoduleOn(t *testing.T) {\n\tlogging := newLog(t)\n\tdefer logging.Close()\n\tdefer logging.swap(logging.newBuffers())\n\tlogging.SetVModule(\"glog_test=2\")\n\tdefer logging.SetVModule(\"\")\n\tif logging.V(1) == nil {\n\t\tt.Error(\"V not enabled for 1\")\n\t}\n\tif logging.V(2) == nil {\n\t\tt.Error(\"V not enabled for 2\")\n\t}\n\tif logging.V(3) != nil {\n\t\tt.Error(\"V enabled for 3\")\n\t}\n\tlogging.V(2).Info(\"test\")\n\tif !logging.contains(LevelInfo, \"I\", t) {\n\t\tt.Errorf(\"Info has wrong character: %q\", logging.contents(LevelInfo))\n\t}\n\tif !logging.contains(LevelInfo, \"test\", t) {\n\t\tt.Error(\"Info failed\")\n\t}\n}", "title": "" }, { "docid": "2e1720ab24fa3f47db0210e7c6479bf5", "score": "0.5226484", "text": "func EnableLogs() {\n\tEnableLog = true\n}", "title": "" }, { "docid": "ee2fc5d5c2a5e44b35920e6bc8bab4ca", "score": "0.522624", "text": "func TestLogWithTimeOperationForEnabledClient(t *testing.T) {\n\tc := constructEnabledClient()\n\terr := c.LogWithTime(123, \"bar\", \"description\")\n\tif err == nil {\n\t\tt.Fatal(\"Error should be returned for enabled client with improper address\")\n\t}\n}", "title": "" }, { "docid": "c709f89d93e4dbfcb13531172505ff79", "score": "0.52127457", "text": "func TestLog(t *testing.T) {\n\tl := GetLogger(nil)\n\tl.WithFields(logrus.Fields{\n\t\t\"animal\": \"walrus\",\n\t}).Info(\"A walrus appears\")\n\tcontextLogger := l.WithFields(logrus.Fields{\n\t\t\"common\": \"this is a common field\",\n\t\t\"other\": \"I also should be logged always\",\n\t})\n\tcontextLogger.Info(\"I'll be logged with common and other field\")\n\tcontextLogger.Info(\"Me too\")\n\tl.Trace(\"Something very low level.\")\n\tl.Debug(\"Useful debugging information.\")\n\tl.Info(\"Something noteworthy happened!\")\n\tl.Warn(\"You should probably take a look at this.\")\n\tl.Error(\"Something failed but I'm not quitting.\")\n\t// Calls os.Exit(1) after logging\n\t// log.Fatal(\"Bye.\")\n\t// Calls panic() after logging\n\t// log.Panic(\"I'm bailing.\")\n}", "title": "" }, { "docid": "3e2d7691e119d5920ab289214867a7ee", "score": "0.52099633", "text": "func logSetup() {\n\tlogrus.Infof(\"Listening on port: %d\\n\", configuration.Port())\n\tlogrus.Infof(\"Redirecting all requests to url: %s\\n\", configuration.URL)\n}", "title": "" }, { "docid": "3dbded62718f592804ffa314103c02c1", "score": "0.5206609", "text": "func NewZapLoggerWithLevel(lvl Level) Logger {\n\tlevel := levelToZapLevel(lvl)\n\tcfg := zapConfig(level, \"\")\n\tl, err := cfg.Build()\n\tif err != nil {\n\t\tlog.Panic(err.Error())\n\t\treturn nil\n\t}\n\treturn &zapLogger{\n\t\tl.Sugar(),\n\t\tlvl,\n\t\t\"\",\n\t}\n}", "title": "" }, { "docid": "add843388249b6263d6650d046116bc5", "score": "0.52035016", "text": "func TestDebugOn(t *testing.T) {\n\ttestDebugLogger = NewFromOptions(&Options{\n\t\tSyncWriter: &flushBuffer{},\n\t\tIncludeDebug: true,\n\t})\n\ttestDebugLogger.Debug(\"test\")\n\tif !debugContains(\"D\", t) {\n\t\tt.Errorf(\"Info has wrong character: %q\", debugContents())\n\t}\n\tif !debugContains(\"test\", t) {\n\t\tt.Error(\"Info failed\")\n\t}\n}", "title": "" }, { "docid": "8a191344b205f6733ef5e393352a35b3", "score": "0.52013844", "text": "func New() *zap.Logger {\n\n\tconf := config.Load()\n\tvar lvl zap.AtomicLevel\n\terr := lvl.UnmarshalText([]byte(conf.LoggerConfig.LogLevel))\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"UnmarshalText:%v\", err))\n\t}\n\n\tvar encoderConfig zapcore.EncoderConfig\n\tif conf.Prod {\n\t\tencoderConfig = zap.NewProductionEncoderConfig()\n\t\tencoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder\n\t\tencoderConfig.EncodeDuration = zapcore.StringDurationEncoder\n\t} else {\n\t\tencoderConfig = zap.NewDevelopmentEncoderConfig()\n\t}\n\n\tzconf := zap.Config{\n\t\tDisableCaller: true,\n\t\tDisableStacktrace: true,\n\t\tLevel: lvl,\n\t\tDevelopment: !conf.Prod,\n\t\tEncoding: \"json\",\n\t\tEncoderConfig: encoderConfig,\n\t\tOutputPaths: []string{\"stdout\"},\n\t\tErrorOutputPaths: []string{\"stderr\"},\n\t}\n\n\tlogger, err := l.New(zconf)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Build:%v\", err))\n\t}\n\n\treturn logger\n}", "title": "" }, { "docid": "08c5c9f7f6127a948f7844cf3daffd16", "score": "0.517218", "text": "func DebugMode() {\n\tlogMu.Lock()\n\tdefer logMu.Unlock()\n\n\tloglevel = zap.DebugLevel\n\tcreateLogger(output, loglevel)\n}", "title": "" }, { "docid": "55214ce2ea00855ee1db09dc338759ae", "score": "0.51638585", "text": "func TestGetSetLevel(t *testing.T) {\n\tassert := audit.NewTestingAssertion(t, true)\n\tlevel := logger.Level()\n\tdefer logger.SetLevel(level)\n\n\ttl := logger.NewTestLogger()\n\tol := logger.SetLogger(tl)\n\tdefer logger.SetLogger(ol)\n\n\tlogger.SetLevel(logger.LevelDebug)\n\tlogger.Debugf(\"Debug.\")\n\tlogger.Infof(\"Info.\")\n\tlogger.Warningf(\"Warning.\")\n\tlogger.Errorf(\"Error.\")\n\tlogger.Criticalf(\"Critical.\")\n\n\tassert.Length(tl, 5)\n\ttl.Reset()\n\n\tlogger.SetLevel(logger.LevelError)\n\tlogger.Debugf(\"Debug.\")\n\tlogger.Infof(\"Info.\")\n\tlogger.Warningf(\"Warning.\")\n\tlogger.Errorf(\"Error.\")\n\tlogger.Criticalf(\"Critical.\")\n\n\tassert.Length(tl, 2)\n\ttl.Reset()\n}", "title": "" }, { "docid": "ec95194742dc1b2ba72d3e32429a75e0", "score": "0.5157548", "text": "func LoggerFlags(pf *flag.FlagSet, argToEnv map[string]string) {\n\tpf.IntP(\"trace-level\", \"\", 0, \"Only print trace messages at or above this level (0 to 2, default 0)\")\n\tviper.BindPFlag(\"trace-level\", pf.Lookup(\"trace-level\"))\n\targToEnv[\"trace-level\"] = \"TRACE_LEVEL\"\n}", "title": "" }, { "docid": "c220a5d7c9f87bfb8e42eda45b14b31b", "score": "0.51523256", "text": "func (l logger) Enabled() bool {\n\treturn l.level <= l.verbosity\n}", "title": "" }, { "docid": "a9e0d71c7c9566f1393015eb3a00df45", "score": "0.5151369", "text": "func DisableDebug() {\n\tl := zerolog.New(os.Stdout).With().Timestamp().Logger()\n\tSetLogger(&l)\n\tzapLevel.SetLevel(zapcore.InfoLevel)\n}", "title": "" }, { "docid": "1bf733a79e294432bb482641c010cb92", "score": "0.51463723", "text": "func New(format Format, level Level, additionalCores ...zapcore.Core) (*Logger, error) {\n\tfilterLevel, err := level.ToZapLevel()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"while getting zap log level\")\n\t}\n\n\tlevelEnabler := zap.LevelEnablerFunc(func(incomingLevel zapcore.Level) bool {\n\t\treturn incomingLevel >= filterLevel\n\t})\n\n\treturn new(format, levelEnabler, additionalCores...)\n}", "title": "" }, { "docid": "f06025f528a0a3c13f88f8fdfdbae7de", "score": "0.5145184", "text": "func init() {\n\n isEnable, ok := conf.Get[\"EnableFileLogger\"]\n if isEnable != \"0\" && ok {\n fileLogger, err:= NewFileLogger()\n if err != nil {\n fmt.Printf(\"init File Logger fail: %v\\n\", err)\n return\n }\n register(fileLogger)\n }\n\n}", "title": "" }, { "docid": "17cb4198a2e5a34106779ad8ad216ece", "score": "0.5143797", "text": "func TestLogActionOperationForDisabledClient(t *testing.T) {\n\tc := constructDisabledClient()\n\terr := c.LogAction(\"foo\", \"bar\", \"description\")\n\tif err != nil {\n\t\tt.Fatal(\"Error should not be returned for disabled client\")\n\t}\n}", "title": "" }, { "docid": "de08e137867dbd59199d8f4535bfda1e", "score": "0.5141041", "text": "func Setup(debug bool) *zap.SugaredLogger {\n\tif debug {\n\t\tdevLogger, _ := zap.NewDevelopment()\n\t\tlogger = devLogger.Sugar()\n\t} else {\n\t\tprodLogger, _ := zap.NewProduction()\n\t\tlogger = prodLogger.Sugar()\n\t}\n\n\treturn logger\n}", "title": "" } ]
575a282f4e7f8a579c38f0cd5ffc40f1
GetSizeOk returns a tuple with the Size field value if set, nil otherwise and a boolean to check if the value has been set.
[ { "docid": "8039001956d4efb6605fd4a15f2f6943", "score": "0.774385", "text": "func (o *Anchors) GetSizeOk() (*int32, bool) {\n\tif o == nil || o.Size == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Size, true\n}", "title": "" } ]
[ { "docid": "ad98663477371e0843024b0be3b80e6c", "score": "0.7963778", "text": "func (o *Log4host) GetSizeOk() (*int64, bool) {\n\tif o == nil || o.Size == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Size, true\n}", "title": "" }, { "docid": "3ce2cd0da696dc9070f0278b0b07afa0", "score": "0.7825744", "text": "func (o *VolumeUsageData) GetSizeOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Size, true\n}", "title": "" }, { "docid": "94eeafb57c75926dc39de28d17c428ad", "score": "0.7764774", "text": "func (o *ResourceAllOf) GetSizeOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Size, true\n}", "title": "" }, { "docid": "6b492420163fd5ef63fe017618dc2b00", "score": "0.7758594", "text": "func (o *StorageProjectVaultCreate) GetSizeOk() (*float32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Size, true\n}", "title": "" }, { "docid": "35026d216b617c23721f52f322827f50", "score": "0.7717398", "text": "func (o *SearchResultPage) GetSizeOk() (*int64, bool) {\n\tif o == nil || o.Size == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Size, true\n}", "title": "" }, { "docid": "7e49708dd4ae02d9016830c10e8901eb", "score": "0.76310706", "text": "func (o *HostMapWidgetDefinitionRequests) GetSizeOk() (*HostMapRequest, bool) {\n\tif o == nil || o.Size == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Size, true\n}", "title": "" }, { "docid": "905bb2df4e24ce561d030c995322417f", "score": "0.7561967", "text": "func (o *ImageSummary) GetSizeOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Size, true\n}", "title": "" }, { "docid": "652a5a56fa0f3a62af9c5f1a6e98e662", "score": "0.75594944", "text": "func (o *Disk) GetSizeOk() (*float32, bool) {\n\tif o == nil || o.Size == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Size, true\n}", "title": "" }, { "docid": "7e025d0bb8b8727f7eca719e70527102", "score": "0.75128794", "text": "func (o *NodeFile) GetSizeOk() (*string, bool) {\n\tif o == nil || o.Size == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Size, true\n}", "title": "" }, { "docid": "9bab8e7207cd7d186f1419aac44c4e64", "score": "0.7493188", "text": "func (o *MicrosoftGraphFileAttachment) GetSizeOk() (int32, bool) {\n\tif o == nil || o.Size == nil {\n\t\tvar ret int32\n\t\treturn ret, false\n\t}\n\treturn *o.Size, true\n}", "title": "" }, { "docid": "8e01881b718ec7e1d62c6ae9c171f702", "score": "0.74489176", "text": "func (h *HostmapRequests) GetSizeOk() (HostmapRequest, bool) {\n\tif h == nil || h.Size == nil {\n\t\treturn HostmapRequest{}, false\n\t}\n\treturn *h.Size, true\n}", "title": "" }, { "docid": "2ca1a0aefb81907f7ec35cfa487f58d6", "score": "0.7320287", "text": "func (o *ConsumerGroupResetOffsetResult) GetSizeOk() (*float32, bool) {\n\tif o == nil || o.Size == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Size, true\n}", "title": "" }, { "docid": "90df8c0adb57589ce7d5220bd55ba47e", "score": "0.7213253", "text": "func (o *With) GetResponseSizeOk() (*bool, bool) {\n\tif o == nil || o.ResponseSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ResponseSize, true\n}", "title": "" }, { "docid": "861993ac72efac59a8d62682b550ed5a", "score": "0.7004841", "text": "func (o *Lwm2mDevicePageWeb) GetSizeOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Size, true\n}", "title": "" }, { "docid": "8a250f2d7185a5cf200aea54a0734ea6", "score": "0.69783515", "text": "func (w *Widget) GetSizingOk() (string, bool) {\n\tif w == nil || w.Sizing == nil {\n\t\treturn \"\", false\n\t}\n\treturn *w.Sizing, true\n}", "title": "" }, { "docid": "6953ae693e486162435a8c914e4428bf", "score": "0.69394994", "text": "func (o *SyntheticsAPITestResultData) GetResponseSizeOk() (*int64, bool) {\n\tif o == nil || o.ResponseSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ResponseSize, true\n}", "title": "" }, { "docid": "dcc0279a3b1d9ee47e9cf63a26cf0cfb", "score": "0.68964404", "text": "func (w *Widget) GetFontSizeOk() (string, bool) {\n\tif w == nil || w.FontSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *w.FontSize, true\n}", "title": "" }, { "docid": "d4735ddbecd03398e18888bd9d8bc8dd", "score": "0.6880967", "text": "func (o *CreateDatasetParams) GetRecordsizeOk() (*string, bool) {\n\tif o == nil || o.Recordsize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Recordsize, true\n}", "title": "" }, { "docid": "d036ff8ee4737253bd44257f61dcdb21", "score": "0.68475395", "text": "func (t *TraceServiceDefinition) GetSizeFormatOk() (string, bool) {\n\tif t == nil || t.SizeFormat == nil {\n\t\treturn \"\", false\n\t}\n\treturn *t.SizeFormat, true\n}", "title": "" }, { "docid": "18b4f86c813fec1522883995b83d3881", "score": "0.6846733", "text": "func (a *Attributes) GetSize() (size uint64, ok bool) {\n\treturn a.Size, a.Flags&AttrSize != 0\n}", "title": "" }, { "docid": "e41a6d48fa003424ef53a5bacc4e6310", "score": "0.68428266", "text": "func (o *OnpremImagePackage) GetFileSizeOk() (*int64, bool) {\n\tif o == nil || o.FileSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FileSize, true\n}", "title": "" }, { "docid": "ec2ec0afd8c7ef041723813289c1e430", "score": "0.6833235", "text": "func (w *Widget) GetSizeVersionOk() (string, bool) {\n\tif w == nil || w.SizeVersion == nil {\n\t\treturn \"\", false\n\t}\n\treturn *w.SizeVersion, true\n}", "title": "" }, { "docid": "72846eaaf2790f04c183300de793002d", "score": "0.6815322", "text": "func (o *FreeTextWidgetDefinition) GetFontSizeOk() (*string, bool) {\n\tif o == nil || o.FontSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FontSize, true\n}", "title": "" }, { "docid": "084e0f97f21150afb25a849e4abe9fa8", "score": "0.6800051", "text": "func (o *SourceFileUpload) GetFileSizeOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.FileSize, true\n}", "title": "" }, { "docid": "592886e548b405dcfd1c7e58b21ee0ad", "score": "0.6782151", "text": "func (o *PipelineCacheAllOf) GetFileSizeBytesOk() (*int32, bool) {\n\tif o == nil || o.FileSizeBytes == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FileSizeBytes, true\n}", "title": "" }, { "docid": "2d22e24a446f2f81ed54bcf689c511be", "score": "0.6734803", "text": "func (o *CreateDatasetParams) GetVolsizeOk() (*int64, bool) {\n\tif o == nil || o.Volsize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Volsize, true\n}", "title": "" }, { "docid": "c9315a806c3d69b69f32e2299f03b3f5", "score": "0.67303747", "text": "func (e *EventStreamDefinition) GetEventSizeOk() (string, bool) {\n\tif e == nil || e.EventSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *e.EventSize, true\n}", "title": "" }, { "docid": "4bff267555766aeede19077af155c45f", "score": "0.6709145", "text": "func (i *ImageDefinition) GetSizingOk() (string, bool) {\n\tif i == nil || i.Sizing == nil {\n\t\treturn \"\", false\n\t}\n\treturn *i.Sizing, true\n}", "title": "" }, { "docid": "fc80f95e003df9254dcba1cb2a0ca15f", "score": "0.66749424", "text": "func (o *DataStoreConfig) GetMaxSizeOk() (*string, bool) {\n\tif o == nil || o.MaxSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MaxSize, true\n}", "title": "" }, { "docid": "7e3188c18654100bdcce58740dfe75fa", "score": "0.6666064", "text": "func (o *HostMapWidgetDefinitionRequests) HasSize() bool {\n\tif o != nil && o.Size != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "de5dfb1c6f2567c21194950d5f6bb415", "score": "0.66637135", "text": "func (o *ModelsBackupJob) GetFileSizeOk() (*int32, bool) {\n\tif o == nil || o.FileSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FileSize, true\n}", "title": "" }, { "docid": "e27d9ff3fab31ae257840be32fad36b4", "score": "0.6662779", "text": "func (w *Widget) GetEventSizeOk() (string, bool) {\n\tif w == nil || w.EventSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *w.EventSize, true\n}", "title": "" }, { "docid": "c2bcb4dd87f1857adf8df5d4a61f3121", "score": "0.6646503", "text": "func (o *ConsumerGroupResetOffsetResult) HasSize() bool {\n\tif o != nil && o.Size != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2b32381260b943ac55312f0d33387402", "score": "0.6619223", "text": "func (o *ProvenanceEventDTO) GetFileSizeOk() (*string, bool) {\n\tif o == nil || o.FileSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FileSize, true\n}", "title": "" }, { "docid": "4b1e3766004e44f86c0646f786a69e4b", "score": "0.66065115", "text": "func (o *With) GetQueryPayloadSizeOk() (*bool, bool) {\n\tif o == nil || o.QueryPayloadSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.QueryPayloadSize, true\n}", "title": "" }, { "docid": "8c6bb6165515791ad138e4ff59995fa3", "score": "0.658539", "text": "func (r *AddOnsListServerRequest) GetSize() (value int, ok bool) {\n\tok = r != nil && r.size != nil\n\tif ok {\n\t\tvalue = *r.size\n\t}\n\treturn\n}", "title": "" }, { "docid": "16789664251c294b8292375105ec97eb", "score": "0.65743494", "text": "func (r *UsersListServerRequest) GetSize() (value int, ok bool) {\n\tok = r != nil && r.size != nil\n\tif ok {\n\t\tvalue = *r.size\n\t}\n\treturn\n}", "title": "" }, { "docid": "4b8d927ecf24c59b8468f5ecb74b4209", "score": "0.65384454", "text": "func (o *CreateDatasetParams) GetForceSizeOk() (*bool, bool) {\n\tif o == nil || o.ForceSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ForceSize, true\n}", "title": "" }, { "docid": "002272c126ff7cb52a82ff96303dbb53", "score": "0.6535685", "text": "func (h *HostmapRequests) HasSize() bool {\n\tif h != nil && h.Size != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a13372da19ebb08bff81589ba0c9fa8e", "score": "0.6528639", "text": "func (o *Snapshot) GetVolumeSizeOk() (*int32, bool) {\n\tif o == nil || o.VolumeSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.VolumeSize, true\n}", "title": "" }, { "docid": "3ed4cba7a2e4098037176a8d8acfee6d", "score": "0.6523948", "text": "func (o *MonitorRequestExecutionResult) GetResponseSizeOk() (*int64, bool) {\n\tif o == nil || o.ResponseSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ResponseSize, true\n}", "title": "" }, { "docid": "47476965ef1ce4289ef2aea8229ccfbe", "score": "0.6517607", "text": "func (w *Widget) GetTextSizeOk() (string, bool) {\n\tif w == nil || w.TextSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *w.TextSize, true\n}", "title": "" }, { "docid": "8aaa62710206f86523bf3b80fb0da139", "score": "0.65174603", "text": "func (o *SearchResultPage) HasSize() bool {\n\tif o != nil && o.Size != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "438c6a7fec202f942807dd9a6c3a160f", "score": "0.64985013", "text": "func (o *DhcpScopeDataData) GetScopeSizeOk() (*string, bool) {\n\tif o == nil || o.ScopeSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ScopeSize, true\n}", "title": "" }, { "docid": "a1197737a76d56ff62b1439501796a5b", "score": "0.64903516", "text": "func (r *RoleBindingsListServerRequest) GetSize() (value int, ok bool) {\n\tok = r != nil && r.size != nil\n\tif ok {\n\t\tvalue = *r.size\n\t}\n\treturn\n}", "title": "" }, { "docid": "b5e42c40be8e20781df75645f5bf496a", "score": "0.64864606", "text": "func (n *NoteDefinition) GetFontSizeOk() (string, bool) {\n\tif n == nil || n.FontSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *n.FontSize, true\n}", "title": "" }, { "docid": "de826ebfb7f756edd4e780b5bb1690de", "score": "0.64675516", "text": "func (o *ProvenanceEventDTO) GetFileSizeBytesOk() (*int64, bool) {\n\tif o == nil || o.FileSizeBytes == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FileSizeBytes, true\n}", "title": "" }, { "docid": "588abbf161cd3e477087a98fc16fd93d", "score": "0.64645976", "text": "func (f *FreeTextDefinition) GetFontSizeOk() (string, bool) {\n\tif f == nil || f.FontSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *f.FontSize, true\n}", "title": "" }, { "docid": "c8efdbfe4285eb332c4e4af6bc389e81", "score": "0.6449349", "text": "func (o *CreateSnapshotRequest) GetSnapshotSizeOk() (int64, bool) {\n\tif o == nil || o.SnapshotSize == nil {\n\t\tvar ret int64\n\t\treturn ret, false\n\t}\n\treturn *o.SnapshotSize, true\n}", "title": "" }, { "docid": "68103d46bb9b7a68d60a6ad1f7b5be88", "score": "0.64126545", "text": "func (r *QuotaSummaryListServerRequest) GetSize() (value int, ok bool) {\n\tok = r != nil && r.size != nil\n\tif ok {\n\t\tvalue = *r.size\n\t}\n\treturn\n}", "title": "" }, { "docid": "45243c2f98cc327095a91934bbd52d02", "score": "0.63966227", "text": "func (q *QueryValueDefinition) GetTitleSizeOk() (string, bool) {\n\tif q == nil || q.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *q.TitleSize, true\n}", "title": "" }, { "docid": "4e3ef9cbaa160d64b80d11fc134df244", "score": "0.63936293", "text": "func (t *TimeseriesDefinition) GetLegendSizeOk() (string, bool) {\n\tif t == nil || t.LegendSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *t.LegendSize, true\n}", "title": "" }, { "docid": "87117aeace3347d4fa0368d4be439da6", "score": "0.6352288", "text": "func (o *DhcpLeaseDataData) GetScopeSizeOk() (*string, bool) {\n\tif o == nil || o.ScopeSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ScopeSize, true\n}", "title": "" }, { "docid": "6cbd3477bdabec0c98c011d8a7379eff", "score": "0.6342763", "text": "func (o *V1Image) GetVolumeSizeOk() (*string, bool) {\n\tif o == nil || o.VolumeSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.VolumeSize, true\n}", "title": "" }, { "docid": "999dc5e231114eb4bd24a6b42b8768f9", "score": "0.63298213", "text": "func (o *Log4host) HasSize() bool {\n\tif o != nil && o.Size != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9d7aed2588af0ddca36dc1611a2c467c", "score": "0.63179123", "text": "func (o *ImageSummary) GetVirtualSizeOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.VirtualSize, true\n}", "title": "" }, { "docid": "eece71c9af8b3df5abc7178193c85020", "score": "0.6316572", "text": "func (o *BsuToCreate) GetVolumeSizeOk() (*int32, bool) {\n\tif o == nil || o.VolumeSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.VolumeSize, true\n}", "title": "" }, { "docid": "a514b82cd6dfe1a9d33336998b1eccf2", "score": "0.63100487", "text": "func (w *Widget) GetLegendSizeOk() (string, bool) {\n\tif w == nil || w.LegendSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *w.LegendSize, true\n}", "title": "" }, { "docid": "ef31a9769387f2836c8bb6665e8660ad", "score": "0.6308952", "text": "func (t *ToplistDefinition) GetTitleSizeOk() (string, bool) {\n\tif t == nil || t.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *t.TitleSize, true\n}", "title": "" }, { "docid": "9764bb0680d83a7de6e7814b086ded47", "score": "0.62953985", "text": "func (o *DimensionsDTO) GetWidthOk() (*float64, bool) {\n\tif o == nil || o.Width == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Width, true\n}", "title": "" }, { "docid": "b04dac010fd308f37ca593f6f37b4635", "score": "0.62887156", "text": "func (s *Series) GetLengthOk() (int, bool) {\n\tif s == nil || s.Length == nil {\n\t\treturn 0, false\n\t}\n\treturn *s.Length, true\n}", "title": "" }, { "docid": "a11b7a9a4a6ff6da10d9e272f0227aeb", "score": "0.6277357", "text": "func (o *V1Image) GetImageSizeOk() (*string, bool) {\n\tif o == nil || o.ImageSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ImageSize, true\n}", "title": "" }, { "docid": "eec77285d57d542530868f15daa9fea9", "score": "0.6275784", "text": "func (o *IpamAddressDataData) GetNetworkSizeOk() (*string, bool) {\n\tif o == nil || o.NetworkSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NetworkSize, true\n}", "title": "" }, { "docid": "ea7ba61159b7293e8707a3e0a72e6f1c", "score": "0.6268095", "text": "func (o *KubernetesInstanceTypeDetails) GetDiskSizeOk() (*int64, bool) {\n\tif o == nil || o.DiskSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DiskSize, true\n}", "title": "" }, { "docid": "efc1c93a5d444b9e00c9aee231b1f34a", "score": "0.6264439", "text": "func (o *With) GetResponseSize() bool {\n\tif o == nil || o.ResponseSize == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.ResponseSize\n}", "title": "" }, { "docid": "14b1aaab56935aef40bf4fcb1bdd4e7c", "score": "0.62613475", "text": "func (o *NodeFile) HasSize() bool {\n\tif o != nil && o.Size != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fd988c5ea693bbf5619c367426109cdb", "score": "0.62587935", "text": "func (o *ImageSummary) GetSharedSizeOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.SharedSize, true\n}", "title": "" }, { "docid": "4d17669d7d77cee46e0b9066ee816806", "score": "0.6252844", "text": "func (w *Widget) GetTitleSizeOk() (int, bool) {\n\tif w == nil || w.TitleSize == nil {\n\t\treturn 0, false\n\t}\n\treturn *w.TitleSize, true\n}", "title": "" }, { "docid": "1b8be96e090cc142e39053f1fe6fb219", "score": "0.62511307", "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": "c6ded4399ec3cf9fd7c948a3f31dd0bd", "score": "0.62235963", "text": "func (t *TimeseriesDefinition) GetTitleSizeOk() (string, bool) {\n\tif t == nil || t.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *t.TitleSize, true\n}", "title": "" }, { "docid": "c2895f8db4c5eaf2a5e8ecfc0844e566", "score": "0.621989", "text": "func (l *LogStreamDefinition) GetTitleSizeOk() (string, bool) {\n\tif l == nil || l.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *l.TitleSize, true\n}", "title": "" }, { "docid": "4be0c9d61a9aa8319689aeaf3aea8957", "score": "0.62167084", "text": "func (w *WidgetLayout) GetWidthOk() (float64, bool) {\n\tif w == nil || w.Width == nil {\n\t\treturn 0, false\n\t}\n\treturn *w.Width, true\n}", "title": "" }, { "docid": "22e771a476d930fdff545d74134387e2", "score": "0.6208905", "text": "func (o *Anchors) HasSize() bool {\n\tif o != nil && o.Size != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "948753ca803044f65885a67eef3fb26f", "score": "0.62034357", "text": "func (e *EventStreamDefinition) GetTitleSizeOk() (string, bool) {\n\tif e == nil || e.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *e.TitleSize, true\n}", "title": "" }, { "docid": "fc4807346400e7e662c50d9950b9f9bc", "score": "0.6200381", "text": "func (q *QueryTableDefinition) GetTitleSizeOk() (string, bool) {\n\tif q == nil || q.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *q.TitleSize, true\n}", "title": "" }, { "docid": "1786268540e600f5b5fdbd9818d4456d", "score": "0.61986333", "text": "func (t *TraceServiceDefinition) GetTitleSizeOk() (string, bool) {\n\tif t == nil || t.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *t.TitleSize, true\n}", "title": "" }, { "docid": "f52c78205cdedab8d8b1cf98e4b0c6b8", "score": "0.61433446", "text": "func (s StringValue) HasSize(length int) bool {\n\treturn s.Size() == length\n}", "title": "" }, { "docid": "07252be3e52999910cff5bc0c1ae2801", "score": "0.6141465", "text": "func (t *TileDefRequestStyle) GetWidthOk() (string, bool) {\n\tif t == nil || t.Width == nil {\n\t\treturn \"\", false\n\t}\n\treturn *t.Width, true\n}", "title": "" }, { "docid": "bebc5363669ffd1474de1274fd88de18", "score": "0.6133834", "text": "func (h *HostmapDefinition) GetTitleSizeOk() (string, bool) {\n\tif h == nil || h.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *h.TitleSize, true\n}", "title": "" }, { "docid": "3569d421e92b6abccdb94411dd5206ea", "score": "0.61331713", "text": "func (o *FiltersVmType) GetMemorySizesOk() (*[]float32, bool) {\n\tif o == nil || o.MemorySizes == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MemorySizes, true\n}", "title": "" }, { "docid": "b0f4cf6040608942d15b45aacbdffd6b", "score": "0.6128009", "text": "func (s *ScatterplotDefinition) GetTitleSizeOk() (string, bool) {\n\tif s == nil || s.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *s.TitleSize, true\n}", "title": "" }, { "docid": "b0add03ff2c92a8148f267b1e88840d8", "score": "0.6124246", "text": "func (o *Disk) HasSize() bool {\n\tif o != nil && o.Size != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "978572f8776e71b0f0a863cc996731f8", "score": "0.61235833", "text": "func (o *DimensionsDTO) GetHeightOk() (*float64, bool) {\n\tif o == nil || o.Height == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Height, true\n}", "title": "" }, { "docid": "a5367fafe669d721fc0731c2a8500e96", "score": "0.61172247", "text": "func TestGetSize(t *testing.T) {\n\tassert := assert.New(t)\n\tm, _ := New(min, min)\n\n\twidth, height := m.GetSize()\n\tassert.Equal(width, min, \"Invalid width.\")\n\tassert.Equal(height, min, \"Invalid height.\")\n}", "title": "" }, { "docid": "2b0cedfbfb144e20fcd14493e4b2bc6e", "score": "0.61073846", "text": "func (o *MicrosoftGraphFileAttachment) HasSize() bool {\n\tif o != nil && o.Size != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b7e96c8fe4f7e724c5a64dbf54c80fb5", "score": "0.61040235", "text": "func (c *CheckStatusDefinition) GetTitleSizeOk() (string, bool) {\n\tif c == nil || c.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *c.TitleSize, true\n}", "title": "" }, { "docid": "cbca5168e34f9aae902a25ef0cd52f8e", "score": "0.6102948", "text": "func (w *WidgetLayout) GetHeightOk() (float64, bool) {\n\tif w == nil || w.Height == nil {\n\t\treturn 0, false\n\t}\n\treturn *w.Height, true\n}", "title": "" }, { "docid": "3b76446b0e9c4e289e7bf18256a3c36d", "score": "0.60933685", "text": "func (m *ManageStatusDefinition) GetTitleSizeOk() (string, bool) {\n\tif m == nil || m.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *m.TitleSize, true\n}", "title": "" }, { "docid": "539d2ab0f6cc2bc666c1c9bd3096f04a", "score": "0.6086891", "text": "func (w *Widget) GetHeightOk() (int, bool) {\n\tif w == nil || w.Height == nil {\n\t\treturn 0, false\n\t}\n\treturn *w.Height, true\n}", "title": "" }, { "docid": "0d068f592f9f4da8b77ea8ed807f1126", "score": "0.60762674", "text": "func (e *EventTimelineDefinition) GetTitleSizeOk() (string, bool) {\n\tif e == nil || e.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *e.TitleSize, true\n}", "title": "" }, { "docid": "0a3465b643e6f6d42046c28b0cf10574", "score": "0.60710496", "text": "func (d *DistributionDefinition) GetTitleSizeOk() (string, bool) {\n\tif d == nil || d.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *d.TitleSize, true\n}", "title": "" }, { "docid": "7113d329107e6c6cc75b460a55d6b214", "score": "0.6064807", "text": "func (g *GraphDefinitionRequestStyle) GetWidthOk() (string, bool) {\n\tif g == nil || g.Width == nil {\n\t\treturn \"\", false\n\t}\n\treturn *g.Width, true\n}", "title": "" }, { "docid": "f6637a6feb6f49b2e468cf5eb9e99624", "score": "0.6033125", "text": "func (s *SyntheticsDevice) GetWidthOk() (int, bool) {\n\tif s == nil || s.Width == nil {\n\t\treturn 0, false\n\t}\n\treturn *s.Width, true\n}", "title": "" }, { "docid": "ac2868a23a7952af8e370077a69d604d", "score": "0.6031085", "text": "func (o *With) HasResponseSize() bool {\n\tif o != nil && o.ResponseSize != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a998314efabd06599857cc212bdb21ff", "score": "0.6027986", "text": "func (a *AlertValueDefinition) GetTitleSizeOk() (string, bool) {\n\tif a == nil || a.TitleSize == nil {\n\t\treturn \"\", false\n\t}\n\treturn *a.TitleSize, true\n}", "title": "" }, { "docid": "8eaebd4dbbda14a4db055f4b3428d186", "score": "0.6016689", "text": "func (o *ResourceAllOf) GetSize() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.Size\n}", "title": "" }, { "docid": "dbc10a909deadce3e32238d47cb34f12", "score": "0.6015131", "text": "func (o *IpamAddress6DataData) GetNetworkSizeOk() (*string, bool) {\n\tif o == nil || o.NetworkSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NetworkSize, true\n}", "title": "" }, { "docid": "80e7756ccd98023afa71086613fd9ace", "score": "0.60070276", "text": "func (o *VersionedLabel) GetWidthOk() (*float64, bool) {\n\tif o == nil || o.Width == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Width, true\n}", "title": "" }, { "docid": "e9d4654fea0c920d4c35f1057c011f49", "score": "0.600302", "text": "func (t TTuple) Size() (uintptr, bool) {\n\tsz := uintptr(0)\n\tvariable := false\n\tfor _, typ := range t {\n\t\ttypsz, typvariable := typ.Size()\n\t\tsz += typsz\n\t\tvariable = variable || typvariable\n\t}\n\treturn sz, variable\n}", "title": "" }, { "docid": "a5b7c803f3b52b904d7d634647abb316", "score": "0.6000567", "text": "func (s *SyntheticsDevice) GetHeightOk() (int, bool) {\n\tif s == nil || s.Height == nil {\n\t\treturn 0, false\n\t}\n\treturn *s.Height, true\n}", "title": "" } ]
2694454df025c0333a7b41e14d17f751
NewRichTextURL creates a new RichTextURL
[ { "docid": "7f078828b2bc16afd422920cec5f3445", "score": "0.7105853", "text": "func NewRichTextURL(text RichText, uRL string) *RichTextURL {\n\trichTextURLTemp := RichTextURL{\n\t\ttdCommon: tdCommon{Type: \"richTextUrl\"},\n\t\tText: text,\n\t\tURL: uRL,\n\t}\n\n\treturn &richTextURLTemp\n}", "title": "" } ]
[ { "docid": "94982bc96fd06019d8c1e414f48f8fba", "score": "0.5973628", "text": "func NewRichText(elements *RGATreeSplit, createdAt *time.Ticket) *RichText {\n\treturn &RichText{\n\t\trgaTreeSplit: elements,\n\t\tselectionMap: make(map[string]*Selection),\n\t\tcreatedAt: createdAt,\n\t}\n}", "title": "" }, { "docid": "e1a1a0d347e71ca3be3be7f9334db894", "score": "0.56565994", "text": "func NewInitialRichText(elements *RGATreeSplit, createdAt *time.Ticket) *RichText {\n\ttext := NewRichText(elements, createdAt)\n\tfromPos, toPos := text.CreateRange(0, 0)\n\ttext.Edit(fromPos, toPos, nil, \"\\n\", nil, createdAt)\n\treturn text\n}", "title": "" }, { "docid": "3e07dff1b96094e9712d03e736709589", "score": "0.54863507", "text": "func (d *Doc) NewText(text string) js.Value {\n\treturn d.doc.Call(\"createTextNode\", text)\n}", "title": "" }, { "docid": "64bbf861cd529d150b27970dc4df93f8", "score": "0.5314604", "text": "func UnmarshalRichTextURL(data json.RawMessage) (*RichTextURL, error) {\n\tvar response RichTextURL\n\n\terr := json.Unmarshal(data, &response)\n\n\treturn &response, err\n}", "title": "" }, { "docid": "90507d9d7dd7c9ae6602e84f3c220e1b", "score": "0.5122274", "text": "func NewTextEntityTypeTextURL(uRL string) *TextEntityTypeTextURL {\n\ttextEntityTypeTextURLTemp := TextEntityTypeTextURL{\n\t\ttdCommon: tdCommon{Type: \"textEntityTypeTextUrl\"},\n\t\tURL: uRL,\n\t}\n\n\treturn &textEntityTypeTextURLTemp\n}", "title": "" }, { "docid": "7e5baac5dfdbf0ce262c676ffb57fbbd", "score": "0.5075628", "text": "func (gtk *Gtk) NewText() *Text {\r\n\tid := gtk.Guify(\"gtk_button_new\", nil, nil).String()\r\n\treturn NewText(gtk, id)\r\n}", "title": "" }, { "docid": "7ac1131af2a7d05d96c737d6877cfe19", "score": "0.5003347", "text": "func NewText(originalText string, words *Words) *Text {\n\treturn &Text{\n\t\toriginalText: originalText,\n\t\tdata: words,\n\t}\n}", "title": "" }, { "docid": "7385f91c7d969ab3f3c9f1a3814b0706", "score": "0.49294618", "text": "func (richTextURL *RichTextURL) UnmarshalJSON(b []byte) error {\n\tvar objMap map[string]*json.RawMessage\n\terr := json.Unmarshal(b, &objMap)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttempObj := struct {\n\t\ttdCommon\n\t\tURL string `json:\"url\"` // URL\n\t}{}\n\terr = json.Unmarshal(b, &tempObj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trichTextURL.tdCommon = tempObj.tdCommon\n\trichTextURL.URL = tempObj.URL\n\n\tfieldText, _ := unmarshalRichText(objMap[\"text\"])\n\trichTextURL.Text = fieldText\n\n\treturn nil\n}", "title": "" }, { "docid": "f1d20c262d9e4e2389a24b95c3dcfbbe", "score": "0.4907819", "text": "func NewTextSubmission(sr, title, text string, replies bool, c *Captcha) *NewSubmission {\n\treturn &NewSubmission{sr, title, text, true, replies, true, true, c}\n}", "title": "" }, { "docid": "11835fd5748dc518235def92f36c5d69", "score": "0.48006216", "text": "func NewRichTextValue(attrs *RHT, value string) *RichTextValue {\n\treturn &RichTextValue{\n\t\tattrs: attrs,\n\t\tvalue: value,\n\t}\n}", "title": "" }, { "docid": "8825e26b754a5cc55d812a620d92f9b5", "score": "0.4791223", "text": "func newClientURL(urlStr string) *mc.ClientURL {\n\tscheme, rest := getScheme(urlStr)\n\tif strings.HasPrefix(rest, \"//\") {\n\t\t// if rest has '//' prefix, skip them\n\t\tvar authority string\n\t\tauthority, rest = splitSpecial(rest[2:], \"/\", false)\n\t\tif rest == \"\" {\n\t\t\trest = \"/\"\n\t\t}\n\t\thost := getHost(authority)\n\t\tif host != \"\" && (scheme == \"http\" || scheme == \"https\") {\n\t\t\treturn &mc.ClientURL{\n\t\t\t\tScheme: scheme,\n\t\t\t\tType: objectStorage,\n\t\t\t\tHost: host,\n\t\t\t\tPath: rest,\n\t\t\t\tSchemeSeparator: \"://\",\n\t\t\t\tSeparator: '/',\n\t\t\t}\n\t\t}\n\t}\n\treturn &mc.ClientURL{\n\t\tType: fileSystem,\n\t\tPath: rest,\n\t\tSeparator: filepath.Separator,\n\t}\n}", "title": "" }, { "docid": "b38b2a6c38476be80b1acb0e228a5839", "score": "0.4773254", "text": "func NewText(text string) *Text {\n\tt := &Text{\n\t\tText: text,\n\t\tWrap: true,\n\t}\n\tt.parent = newParent(t)\n\treturn t\n}", "title": "" }, { "docid": "3a65d3359d6494d5ca9d1b5edc74e3a6", "score": "0.4766802", "text": "func NewTextEntityTypeURL() *TextEntityTypeURL {\n\ttextEntityTypeURLTemp := TextEntityTypeURL{\n\t\ttdCommon: tdCommon{Type: \"textEntityTypeUrl\"},\n\t}\n\n\treturn &textEntityTypeURLTemp\n}", "title": "" }, { "docid": "b5b6491d9b7a087a346948602532b3f2", "score": "0.4711231", "text": "func url(text, url string) (string, error) {\n\tif url == \"\" {\n\t\treturn text, nil\n\t}\n\t_, err := link.ParseRequestURI(url)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn fmt.Sprintf(\"«%s»(%s)\", text, url), nil\n}", "title": "" }, { "docid": "33c254d8d5c9370ce5e50483ac2b5ebe", "score": "0.4687475", "text": "func newLinkStyle(font *model.PdfFont) TextStyle {\n\treturn TextStyle{\n\t\tColor: ColorRGBFrom8bit(0, 0, 238),\n\t\tFont: font,\n\t\tFontSize: 10,\n\t}\n}", "title": "" }, { "docid": "6653fc532139517efcf7cfa63d8dc85f", "score": "0.46703085", "text": "func NewRobotsTxtFromText(rawurl, contents string) *RobotsTxt {\n\tparsedUrl, _ := url.Parse(rawurl)\n\tr := &RobotsTxt{\n\t\tUrl: parsedUrl,\n\t}\n\tr.contents = contents\n\tr.Rules = GetRules(r.contents)\n\treturn r\n}", "title": "" }, { "docid": "5a9be78dea5bef19f8d67073a850977c", "score": "0.46433902", "text": "func createURL (callfunction string, params map[string]string) string {\n\treturn URL_WORDPRESS + callfunction + \"/\" + parseParams(params)\n}", "title": "" }, { "docid": "726f32b5096d9274a32b3a921dd7a6e4", "score": "0.46405426", "text": "func NewURL(url string) URL {\n\treturn URL(url)\n}", "title": "" }, { "docid": "caadc562aa1ae6d2e85f62a2484cd1f1", "score": "0.46343413", "text": "func NewRichTextPlain(text string) *RichTextPlain {\n\trichTextPlainTemp := RichTextPlain{\n\t\ttdCommon: tdCommon{Type: \"richTextPlain\"},\n\t\tText: text,\n\t}\n\n\treturn &richTextPlainTemp\n}", "title": "" }, { "docid": "5f9b3af97bcc3dcb5dededc09c6cc89f", "score": "0.4599579", "text": "func getLinkedTemplateTextForURL(rootURL, orchestrator, extensionName, version, query string) (string, error) {\n\tsupportsExtension, err := orchestratorSupportsExtension(rootURL, orchestrator, extensionName, version, query)\n\tif !supportsExtension {\n\t\treturn \"\", errors.Wrap(err, \"Extension not supported for orchestrator\")\n\t}\n\n\ttemplateLinkBytes, err := getExtensionResource(rootURL, extensionName, version, \"template-link.json\", query)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(templateLinkBytes), nil\n}", "title": "" }, { "docid": "5f9b3af97bcc3dcb5dededc09c6cc89f", "score": "0.4599579", "text": "func getLinkedTemplateTextForURL(rootURL, orchestrator, extensionName, version, query string) (string, error) {\n\tsupportsExtension, err := orchestratorSupportsExtension(rootURL, orchestrator, extensionName, version, query)\n\tif !supportsExtension {\n\t\treturn \"\", errors.Wrap(err, \"Extension not supported for orchestrator\")\n\t}\n\n\ttemplateLinkBytes, err := getExtensionResource(rootURL, extensionName, version, \"template-link.json\", query)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(templateLinkBytes), nil\n}", "title": "" }, { "docid": "d4c3d28e6fba71c9c03d5295eaa9b016", "score": "0.4556132", "text": "func (c *Connector) GetNewTagURL(TagName string) (string, error) {\n\treturn c.getTagURL(TagName)\n}", "title": "" }, { "docid": "2196f9c4810e6181ed0195ee5da2e2b8", "score": "0.455538", "text": "func CreateURL(URLIn string) string {\n\tfmt.Printf(\"\\nCreateURL():\\n\\tInputURL: \" + URLIn)\n\tvar parts []string\n\tparts = strings.Split(URLIn, \"/\")\n\n\tvar site, user, repo string //Will store each part of the URL that will be used to GET the jsons.\n\tif len(parts) != 6 { //Error if wrong num of parameters.\n\t\treturn \"\"\n\t}\n\n\tsite = parts[3]\n\tuser = parts[4]\n\trepo = parts[5]\n\toutputURL := \"http://api.\" + site + \"/repos/\" + user + \"/\" + repo\n\n\tfmt.Printf(\"\\n\\tOutputURL: \" + outputURL)\n\n\treturn outputURL //Rebuild the URL to it can be used with the git api.\n}", "title": "" }, { "docid": "aa133cd6e63bdc0ebb9b733f1cb9b61d", "score": "0.45514974", "text": "func (client *Client) PostNew(text string, imageURL string) (tweetID int64, exists bool, err error) {\n\tif client.Exists(text) {\n\t\treturn 0, true, nil\n\t}\n\tmedia, err := client.uploadExternalImg(imageURL)\n\tif err != nil {\n\t\treturn 0, false, err\n\t}\n\tmediaIds := []string{strconv.FormatInt(media.MediaID, 10)}\n\ttweet, err := client.client.PostTweet(text, url.Values{\"media_ids\": mediaIds})\n\tif err != nil {\n\t\treturn 0, false, err\n\t}\n\tclient.existedLinks[text] = true\n\treturn tweet.Id, false, nil\n}", "title": "" }, { "docid": "8f3a324cb785efb53611605b1144c945", "score": "0.45319468", "text": "func newTextNode(text string) *TextNode {\n\treturn &TextNode{Value: text}\n}", "title": "" }, { "docid": "dd63ee759e1d8b63618fd78aaa57cbc4", "score": "0.4503811", "text": "func (r *HarvestedResource) OriginalURLText() string {\n\treturn r.origURLtext\n}", "title": "" }, { "docid": "75a38a2be3e76d3aa540cc75ce68159b", "score": "0.44856292", "text": "func (r *rally) generateURL(uri string) string {\n\tvar buffer bytes.Buffer\n\n\tbuffer.WriteString(r.url)\n\tbuffer.WriteString(uri)\n\n\treturn buffer.String()\n}", "title": "" }, { "docid": "ce89a3ecbd561ae3c0a394afa66ef2e9", "score": "0.44582906", "text": "func NewURL(method string, qsp *url.Values) url.URL {\n\tif qsp == nil {\n\t\tqsp = &url.Values{}\n\t}\n\n\tqsp.Set(\"token\", apiToken)\n\treturn url.URL{\n\t\tScheme: \"https\",\n\t\tHost: team + \".slack.com\",\n\t\tPath: \"api/\" + method,\n\t\tRawQuery: qsp.Encode(),\n\t}\n}", "title": "" }, { "docid": "f0c19162401c04383e078d0d63bd76a0", "score": "0.44509253", "text": "func (r *Representation) AddNewBaseURL(baseURL string) error {\n\tif baseURL == \"\" {\n\t\treturn ErrBaseURLEmpty\n\t}\n\tr.BaseURL = append(r.BaseURL, baseURL)\n\treturn nil\n}", "title": "" }, { "docid": "f4b06474e988b80165ce32ee9280d7f9", "score": "0.44439965", "text": "func NewURLTemplate(tmpl string) URLTemplate {\n\treturn URLTemplate(tmpl)\n}", "title": "" }, { "docid": "cbfa2208f440081bcdfcd420b676f74b", "score": "0.4431089", "text": "func createURL(u string, pos string, prov string, tyype string) string {\n u = strings.Replace(u, \"{{prov}}\", prov, -1)\n u = strings.Replace(u, \"{{type}}\", tyype, -1)\n u = strings.Replace(u, \"{{pos}}\", pos, -1)\n return u\n}", "title": "" }, { "docid": "42057eadc10ecc2a6ea2ed3899c98b06", "score": "0.44266504", "text": "func NewSetURL(ds database.IDataStore) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"set-url\",\n\t\tShort: \"set jira api info\",\n\t\tLong: \"Able to set ipi nfo by using this command\",\n\t\tArgs: cobra.MinimumNArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tzap.S().Info(args)\n\t\t\tcontroller.SetJiraURL(args[0], jiraURL, ds)\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.Flags().StringVarP(&jiraURL, \"url\", \"u\", \"\", \"set jira url\")\n\treturn cmd\n}", "title": "" }, { "docid": "1e965fd97c612cd7766ee85a4dde0b5d", "score": "0.4425289", "text": "func NewRichTexts(texts []RichText) *RichTexts {\n\trichTextsTemp := RichTexts{\n\t\ttdCommon: tdCommon{Type: \"richTexts\"},\n\t\tTexts: texts,\n\t}\n\n\treturn &richTextsTemp\n}", "title": "" }, { "docid": "bc457e66ab74217961e523ef2db3e7c0", "score": "0.44241986", "text": "func FormatTweetFactory(conf *Config) func(text string) template.HTML {\n\tisLocal := func(url string) bool {\n\t\tif NormalizeURL(url) == \"\" {\n\t\t\treturn false\n\t\t}\n\t\treturn strings.HasPrefix(NormalizeURL(url), NormalizeURL(conf.BaseURL))\n\t}\n\n\treturn func(text string) template.HTML {\n\t\trenderHookProcessURLs := func(w io.Writer, node ast.Node, entering bool) (ast.WalkStatus, bool) {\n\t\t\tspan, ok := node.(*ast.HTMLSpan)\n\t\t\tif !ok {\n\t\t\t\treturn ast.GoToNext, false\n\t\t\t}\n\n\t\t\tleaf := span.Leaf\n\t\t\tdoc, err := goquery.NewDocumentFromReader(bytes.NewReader(leaf.Literal))\n\t\t\tif err != nil {\n\t\t\t\tlog.WithError(err).Warn(\"error parsing HTMLSpan\")\n\t\t\t\treturn ast.GoToNext, false\n\t\t\t}\n\n\t\t\ta := doc.Find(\"a\")\n\t\t\thref, ok := a.Attr(\"href\")\n\t\t\tif !ok {\n\t\t\t\treturn ast.GoToNext, false\n\t\t\t}\n\n\t\t\tif isLocal(href) {\n\t\t\t\thref = UserURL(href)\n\t\t\t} else {\n\t\t\t\treturn ast.GoToNext, false\n\t\t\t}\n\n\t\t\thtml := fmt.Sprintf(`<a href=\"%s\">`, href)\n\n\t\t\tio.WriteString(w, html)\n\n\t\t\treturn ast.GoToNext, true\n\t\t}\n\n\t\thtmlFlags := html.CommonFlags | html.HrefTargetBlank\n\t\topts := html.RendererOptions{\n\t\t\tFlags: htmlFlags,\n\t\t\tRenderNodeHook: renderHookProcessURLs,\n\t\t}\n\t\trenderer := html.NewRenderer(opts)\n\n\t\tmd := []byte(FormatMentions(text))\n\t\tmaybeUnsafeHTML := markdown.ToHTML(md, nil, renderer)\n\t\tp := bluemonday.UGCPolicy()\n\t\tp.AllowAttrs(\"target\").OnElements(\"a\")\n\t\thtml := p.SanitizeBytes(maybeUnsafeHTML)\n\n\t\treturn template.HTML(html)\n\t}\n}", "title": "" }, { "docid": "7c544853267b16e2eac69b904879a24d", "score": "0.44143516", "text": "func newText(res http.ResponseWriter, req *http.Request) {\n\n\t//First get the session..\n\tsession, err := getSession(req)\n\tif err != nil {\n\t\thttp.Error(res, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t//..and check if user is logged in.\n\tuser, message, loggedin := testLoginStatus(\"newText\", session)\n\tif loggedin {\n\t\tlog.Println(message)\n\t} else {\n\t\tlog.Println(message)\n\t\tLogout(res, req)\n\t\treturn\n\t}\n\n\tvars := mux.Vars(req)\n\tnewkey := vars[\"key\"]\n\tnewbucket := strings.Join(strings.Split(newkey, \":\")[0:4], \":\") + \":\"\n\tdbname := user + \".db\"\n\tretrievedjson := gocite.Passage{}\n\tretrievedjson.PassageID = newkey\n\tnewnode, _ := json.Marshal(retrievedjson)\n\tdb, err := openBoltDB(dbname) //open bolt DB using helper function\n\tif err != nil {\n\t\tlog.Println(fmt.Printf(\"newText: error opening userDB: %s\", err))\n\t\thttp.Error(res, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer db.Close()\n\tkey := []byte(newkey) //\n\tvalue := []byte(newnode) //\n\t// store some data\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\tbucket, err := tx.CreateBucketIfNotExists([]byte(newbucket))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = bucket.Put(key, value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\thttp.Redirect(res, req, \"/view/\"+newkey, http.StatusFound)\n}", "title": "" }, { "docid": "da6c6e2da037a71751dabe5f7ccee6dc", "score": "0.4389339", "text": "func NewText(ctx context.Context, s interface{}) *Response {\n\treturn NewTextWithStatus(ctx, s, HTTPStatusOK)\n}", "title": "" }, { "docid": "d12ad5bc254f33a700aef0db0317b96c", "score": "0.43879402", "text": "func (c *Client) AddURL(link, title string) error {\n\tif c.consumerKey == \"\" || c.accessToken == \"\" {\n\t\treturn fmt.Errorf(\"pocket: missing credentials\")\n\t}\n\n\ttype body struct {\n\t\tAccessToken string `json:\"access_token\"`\n\t\tConsumerKey string `json:\"consumer_key\"`\n\t\tTitle string `json:\"title,omitempty\"`\n\t\tURL string `json:\"url\"`\n\t}\n\n\tdata := &body{\n\t\tAccessToken: c.accessToken,\n\t\tConsumerKey: c.consumerKey,\n\t\tTitle: title,\n\t\tURL: link,\n\t}\n\n\tclt := client.New(\"https://getpocket.com/v3/add\")\n\tresponse, err := clt.PostJSON(data)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"pocket: unable to send url: %v\", err)\n\t}\n\n\tif response.HasServerFailure() {\n\t\treturn fmt.Errorf(\"pocket: unable to send url, status=%d\", response.StatusCode)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1bad92e0e641f9d9fc3999c9d7d45a48", "score": "0.4385169", "text": "func TextToNewNote(name, title, text string) NewNoteRequestBody {\n\treturn NewNoteRequestBody{\n\t\tname,\n\t\t[]struct {\n\t\t\tTitle string `json:\"title\"`\n\t\t\tText string `json:\"text\"`\n\t\t}{\n\t\t\t{title, text},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "d95c70bef6148a8527ac9965d11045a7", "score": "0.4380574", "text": "func (v *HistoryWidget) StartNewNode(parent forest.Node, startText string) error {\n\tfile, err := ioutil.TempFile(\"\", \"arbor-msg\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"couldn't create temporary file for reply: %v\", err)\n\t}\n\t// ensure this file descriptor is closed\n\tfile.Close()\n\t// populate the file, but keep it closed\n\terr = ioutil.WriteFile(file.Name(), []byte(startText), 0660)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"couldn't write template into temporary file: %v\", err)\n\t}\n\teditor := v.Config.EditFile(file.Name())\n\tif err := editor.Start(); err != nil {\n\t\treturn fmt.Errorf(\"failed to start editor command: %v\", err)\n\t}\n\tgo v.FinishReply(parent, file.Name(), editor)\n\treturn nil\n}", "title": "" }, { "docid": "78836e0e092bec566a3ba49da1fa4e76", "score": "0.4367744", "text": "func (ls *FakeLinkService) GetNewSlug(ctx context.Context, size int) (string, error) {\n\tls.GetNewSlugCalled = true\n\treturn ls.GetNewSlugFn(ctx, size)\n}", "title": "" }, { "docid": "c7552f0c5b92b3e651801bd91e37517c", "score": "0.4342221", "text": "func NewHTML(v HTML) *HTML { return &v }", "title": "" }, { "docid": "21a535178eb54968c66b0341b1d5ff35", "score": "0.43415046", "text": "func NewText(writer io.Writer) *Text {\n\treturn &Text{\n\t\twriter: writer,\n\t}\n}", "title": "" }, { "docid": "544ac88375b1c41cd47be782984050f5", "score": "0.4338683", "text": "func NewText(text string) *Element {\n\treturn &Element{nodeType: html.TextNode, data: elementText(text)}\n}", "title": "" }, { "docid": "414972f717abd38f6f4aed4ef41644fb", "score": "0.43369913", "text": "func newRefSecret(namespace string, name string, snitchURL string) *corev1.Secret {\n\n\tnewRefSecret := &corev1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tData: map[string][]byte{\n\t\t\tconfig.KeySnitchURL: []byte(snitchURL),\n\t\t},\n\t}\n\n\treturn newRefSecret\n\n}", "title": "" }, { "docid": "8269ac76a4a5cbdf7a21e1c76718ba64", "score": "0.43359447", "text": "func CellRendererTextNew() (*CellRendererText, error) {\n\tc := C.gtk_cell_renderer_text_new()\n\tif c == nil {\n\t\treturn nil, nilPtrErr\n\t}\n\tobj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}\n\tcrt := wrapCellRendererText(obj)\n\tobj.RefSink()\n\truntime.SetFinalizer(obj, (*glib.Object).Unref)\n\treturn crt, nil\n}", "title": "" }, { "docid": "efb4de29b428609576f89d1070c0c3f6", "score": "0.43314913", "text": "func (b *StoriesGetPhotoUploadServerBuilder) LinkText(v string) *StoriesGetPhotoUploadServerBuilder {\n\tb.Params[\"link_text\"] = v\n\treturn b\n}", "title": "" }, { "docid": "3a260d079e5bbbdaaaec1ec3ab4267e1", "score": "0.43296197", "text": "func (c *Client) CreateResourceURL(path string, query string) (*url.URL, error) {\n\n\tbaseURL := c.OVCIP\n\tif !strings.HasPrefix(c.OVCIP, \"http\") {\n\t\tbaseURL = fmt.Sprintf(\"https://%s/api\", c.OVCIP)\n\t}\n\n\tresourceURL, err := url.Parse(baseURL + path)\n\tif err != nil {\n\t\t//log.Fatal(err)\n\t\treturn nil, err\n\t}\n\n\tif query != \"\" {\n\t\tresourceURL.RawQuery = query\n\t}\n\n\treturn resourceURL, nil\n}", "title": "" }, { "docid": "454f39564f69f35e20171398309c8b97", "score": "0.4310742", "text": "func NewTextButton(str string, w int, h int, btnFont font.Face, actionFn func(), i *Input) *TextButton {\n\n\ttb := &TextButton{text: str, width: w, height: h, font: btnFont, action: actionFn}\n\n\tdc := gg.NewContext(w, h)\n\tdc.SetRGB(0, 0, 0)\n\tdc.DrawRoundedRectangle(0, 0, float64(w), float64(h), float64(w/20))\n\tdc.Fill()\n\tdc.SetRGB(1, 1, 1)\n\tdc.SetFontFace(tb.font)\n\tdc.DrawStringAnchored(tb.text, float64(w/2), float64(h/2), 0.5, 0.333)\n\tdc.Stroke()\n\ttb.img = ebiten.NewImageFromImage(dc.Image())\n\n\ti.Add(tb)\n\n\treturn tb\n}", "title": "" }, { "docid": "6eb3f6d21ef3696a8eb77755384f9d51", "score": "0.42997992", "text": "func CellRendererTextNew() (*CellRendererText, error) {\n\tc := C.gtk_cell_renderer_text_new()\n\tif c == nil {\n\t\treturn nil, nilPtrErr\n\t}\n\tobj := glib.Take(unsafe.Pointer(c))\n\treturn wrapCellRendererText(obj), nil\n}", "title": "" }, { "docid": "2e4296b3764559b8ee2635e0a4c421cf", "score": "0.42856234", "text": "func URLAttachment(name string, contents Contents) Attachment {\n\treturn Attachment{\n\t\tContents: contents,\n\t\tName: name,\n\t\tType: AttachmentTypeURL,\n\t}\n}", "title": "" }, { "docid": "91a41f1402db4ca2c2666156108f24f9", "score": "0.4283127", "text": "func NewHTML(docType string) *HTML {\n\treturn &HTML{\n\t\tdocType: docType,\n\t\tcontent: &Contents{},\n\t}\n}", "title": "" }, { "docid": "91161401d038b32949dd87c706a0b942", "score": "0.42809725", "text": "func make_url(title, year string) (URL string) {\n base_url := \"http://omdbapi.com/\"\n URL = base_url + \"?t=\" + url.QueryEscape(title) + \"&y=\" + year\n return URL\n}", "title": "" }, { "docid": "ab96b28e9de21c6deb2fd434bef7ed73", "score": "0.42702475", "text": "func (vi *VoiceIt2) CreateVoiceEnrollmentByUrl(userId string, contentLanguage string, fileUrl string) string {\n\n body := &bytes.Buffer{}\n writer := multipart.NewWriter(body)\n\n _ = writer.WriteField(\"userId\", userId)\n _ = writer.WriteField(\"contentLanguage\", contentLanguage)\n _ = writer.WriteField(\"fileUrl\", fileUrl)\n writer.Close()\n\n req, _ := http.NewRequest(\"POST\", vi.BaseUrl + \"/enrollments/byUrl\", body)\n req.SetBasicAuth(vi.ApiKey, vi.ApiToken)\n req.Header.Add(\"Content-Type\", writer.FormDataContentType())\n\n client := &http.Client{}\n resp, _ := client.Do(req)\n defer resp.Body.Close()\n reply, _ := ioutil.ReadAll(resp.Body)\n return string(reply)\n}", "title": "" }, { "docid": "d71f9e8f4d1819f968f509008c9f0871", "score": "0.42571786", "text": "func (this *outputT) addLink(url, title estring) {\n\n\tif this.needSpace {\n\t\tthis.needSpace = false\n\t\tthis.addText(\" \")\n\t}\n\twebpage.addLink(url, title)\n}", "title": "" }, { "docid": "e36ffeebc41f81ab16f1ab32ab3b144d", "score": "0.42529285", "text": "func NewRichTextUnderline(text RichText) *RichTextUnderline {\n\trichTextUnderlineTemp := RichTextUnderline{\n\t\ttdCommon: tdCommon{Type: \"richTextUnderline\"},\n\t\tText: text,\n\t}\n\n\treturn &richTextUnderlineTemp\n}", "title": "" }, { "docid": "bf40bdf541d1418e52c15c867b7de149", "score": "0.42500395", "text": "func (f *Font) NewText(str string, x, y float64) *Text {\n\treturn f.NewStringerText(stringStringer(str), x, y)\n}", "title": "" }, { "docid": "95b625d756489d80be85e9c489ed0bc1", "score": "0.4230773", "text": "func createPushUrl(apiKey string, title string, content string, link string) string {\n\ttitle = url.QueryEscape(title)\n\tcontent = url.QueryEscape(content)\n\tlink = url.QueryEscape(link)\n\n\tif link == \"\" {\n\t\treturn fmt.Sprintf(\"%s?k=%s&t=%s&c=%s\", pushServiceUrlBase, apiKey, title, content)\n\t} else {\n\t\treturn fmt.Sprintf(\"%s?k=%s&t=%s&c=%s&u=%s\", pushServiceUrlBase, apiKey, title, content, link)\n\t}\n}", "title": "" }, { "docid": "4f0582b451f2c5f051a8c33a83e598ed", "score": "0.42063504", "text": "func ConvertArtworkURL(url string, w int, h int) string {\n\tr := url\n\tr = strings.Replace(r, \"{w}\", strconv.Itoa(w), 1)\n\tr = strings.Replace(r, \"{h}\", strconv.Itoa(w), 1)\n\tr = strings.Replace(r, \"{c}\", \"bb\", 1)\n\tr = strings.Replace(r, \"{f}\", \"png\", 1)\n\treturn r\n}", "title": "" }, { "docid": "d44ffcba6bdb49e1da03c64ce9fd60d9", "score": "0.42045918", "text": "func (m *EducationChannelResource) SetUrl(value *string)() {\n err := m.GetBackingStore().Set(\"url\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9c2f3bbdf737946cc11be7e7c8c94887", "score": "0.42042693", "text": "func (c *SSOAuthenticator) newRequest(method, urlStr string, body interface{}, mediaType string) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tif body != nil {\n\t\terr = json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, rel.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "801a4bad29c81e13495e5f9d157e5e9c", "score": "0.4202021", "text": "func (s *Server) CreateOrUpdateLink(w http.ResponseWriter, r *http.Request) {\n\tbody, err := ioutil.ReadAll(http.MaxBytesReader(w, r.Body, maxFileSize))\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tl := models.Link{}\n\terr = json.Unmarshal(body, &l)\n\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tlink, err := l.CreateOrUpdateLink(s.DB, l.URL, l.Interval)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusRequestEntityTooLarge, err)\n\t\treturn\n\t}\n\ts.addJob(link)\n\tresponses.JSON(w, http.StatusOK, link.ID)\n}", "title": "" }, { "docid": "32511e0c43e8356a04b1e914bbc89d2e", "score": "0.42017677", "text": "func NewText(text string) *Text {\n\ttextTemp := Text{\n\t\ttdCommon: tdCommon{Type: \"text\"},\n\t\tText: text,\n\t}\n\n\treturn &textTemp\n}", "title": "" }, { "docid": "83c14f760058e774c29e2f7564fb3aaa", "score": "0.41948494", "text": "func CreateURL(client *gophercloud.ServiceClient) string {\n\treturn client.ServiceURL(\"tokens\")\n}", "title": "" }, { "docid": "f3dd1e952f056380ad1ba25c77a2ab3d", "score": "0.41928485", "text": "func NewLink(tag html.Token, text string, depth int) Link {\n\tlink := Link{text: strings.TrimSpace(text), depth: depth}\n\tfor i := range tag.Attr {\n\t\tif tag.Attr[i].Key == \"href\" {\n\t\t\tlink.url = strings.TrimSpace(tag.Attr[i].Val)\n\t\t}\n\t}\n\treturn link\n}", "title": "" }, { "docid": "d4345d99b0b3ad1557ac80f217990014", "score": "0.4189467", "text": "func (c *URLApiController) CreateUrl(w http.ResponseWriter, r *http.Request) {\n\turlParam := Url{}\n\td := json.NewDecoder(r.Body)\n\td.DisallowUnknownFields()\n\tif err := d.Decode(&urlParam); err != nil {\n\t\tc.errorHandler(w, r, &ParsingError{Err: err}, nil)\n\t\treturn\n\t}\n\tif err := AssertUrlRequired(urlParam); err != nil {\n\t\tc.errorHandler(w, r, err, nil)\n\t\treturn\n\t}\n\tresult, err := c.service.CreateUrl(r.Context(), urlParam)\n\t// If an error occurred, encode the error with the status code\n\tif err != nil {\n\t\tc.errorHandler(w, r, err, &result)\n\t\treturn\n\t}\n\t// If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, result.Headers, w)\n\n}", "title": "" }, { "docid": "2baee4d1b858ae64daf1661b03a2ad22", "score": "0.41814572", "text": "func PostURL(paramTexts Params, URL string) (ProcessedDoc, error) {\n\tparamTexts[\"apikey\"] = DefaultConfig.apikey\n\tparamTexts[\"url\"] = URL\n\tdoc := ProcessedDoc{}\n\turl := \"https://api.ocr.space/parse/image\"\n\tform, contentType, err := buildForm(paramTexts, File{})\n\tresp, err := http.Post(url, contentType, form)\n\tif err != nil {\n\t\treturn doc, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode < 200 || resp.StatusCode >= 300 {\n\t\tb, _ := ioutil.ReadAll(resp.Body)\n\t\treturn doc, fmt.Errorf(\"[%d %s]%s\", resp.StatusCode, resp.Status, string(b))\n\t}\n\terr = json.NewDecoder(resp.Body).Decode(&doc)\n\tif err != nil {\n\t\treturn ProcessedDoc{}, err\n\t}\n\treturn doc, nil\n}", "title": "" }, { "docid": "9baaa5130f217079afbba3a632b03d4f", "score": "0.4171995", "text": "func (r *Representation) SetNewBaseURL(baseURL string) error {\n\tif baseURL == \"\" {\n\t\treturn ErrBaseURLEmpty\n\t}\n\t// overwrite for backwards compatability\n\tr.BaseURL = []string{baseURL}\n\treturn nil\n}", "title": "" }, { "docid": "39954030137482013af13f9dfbd8ec38", "score": "0.41697893", "text": "func PostText(text string) string {\n\ttext = strings.ReplaceAll(text, \"http://\", \"https://\")\n\ttext = strings.TrimSpace(text)\n\treturn text\n}", "title": "" }, { "docid": "6baf58f7d27010e3cf3c9318559343e5", "score": "0.41605812", "text": "func (c *Client) newRequest(method, urlStr string, auth Authenticator, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turl := c.BaseURL.ResolveReference(rel)\n\n\tbuf := &bytes.Buffer{}\n\tif body != nil {\n\t\tif reader, ok := body.(io.Reader); ok {\n\t\t\tio.Copy(buf, reader)\n\t\t} else {\n\t\t\terr = json.NewEncoder(buf).Encode(body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, url.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tauth.ApplyAuthentication(req)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "8648aee68cd1db03818378a15fc0df60", "score": "0.4147085", "text": "func urlcreation(b string) {\n\n\ta := \"http://10.138.32.76:9001/v1/alltrade/obtainDetail?filters=(\" + b + \")\"\n\turl := string(a)\n\thttpreq(url)\n\t//fmt.Print(url, \"\\n\")\n}", "title": "" }, { "docid": "35657d6295b9d7a09e82267414ea4176", "score": "0.4140264", "text": "func CreateRoute(w http.ResponseWriter, r *http.Request) {\n\turl := new(Url)\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"file\" : r.Body,\n\t\t\t\"error\": err,\n\t\t}).Warning(\"Read request error\")\n\t}\n\terr = json.Unmarshal(body, &url)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"file\" : body,\n\t\t\t\"error\": err,\n\t\t}).Warning(\"Unmarshal error\")\n\t}\n\turl.checkShortUrl()\n\turl.checkLongUrl()\n\turl.addData()\n\tsavedUrl , _ := json.Marshal(url)\n\tw.WriteHeader(200)\n\tw.Write(savedUrl)\n}", "title": "" }, { "docid": "0873c0d6c8c3ae57940269062575cd32", "score": "0.41397387", "text": "func NewWikilink(l *ast.Link) *Wikilink {\n\tc := &Wikilink{\n\t\tLink: *l,\n\t}\n\tc.Destination = l.Destination // AKA Target\n\tc.Title = l.Title\n\n\treturn c\n}", "title": "" }, { "docid": "58b5f21b2795e560003a1039e67d6580", "score": "0.4128796", "text": "func NewRichTextEmailAddress(text RichText, emailAddress string) *RichTextEmailAddress {\n\trichTextEmailAddressTemp := RichTextEmailAddress{\n\t\ttdCommon: tdCommon{Type: \"richTextEmailAddress\"},\n\t\tText: text,\n\t\tEmailAddress: emailAddress,\n\t}\n\n\treturn &richTextEmailAddressTemp\n}", "title": "" }, { "docid": "4f7fee5cb9fda70026e84add69dd09d0", "score": "0.41189602", "text": "func (tp *LTIToolProvider) CreateReturnURL() (*url.URL, error) {\n\tif tp.LTIHeaders == nil || tp.LTIHeaders.LaunchPresReturnURL == \"\" {\n\t\treturn nil, nil\n\t}\n\n\turlParams, err := tp.LTIResponse.Serialize()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturnUrl := tp.LTIHeaders.LaunchPresReturnURL + \"?\" + urlParams\n\treturn url.Parse(returnUrl)\n}", "title": "" }, { "docid": "466555e3a4d163a648b19b8efadae59e", "score": "0.411767", "text": "func NewError(text string) error {\n\treturn &errorString{text}\n}", "title": "" }, { "docid": "aa047669eda81621cb5be16e4dbae2e8", "score": "0.41173318", "text": "func (g *Gatherer) AddURL(name, url string) {\n\tg.addOperation(&URL{\n\t\tName: name,\n\t\tURL: url,\n\t\tOutputHandler: outputWriter(name, g.targetDir),\n\t})\n}", "title": "" }, { "docid": "4217e6010a982401b20ce7136eb61ffc", "score": "0.41085735", "text": "func (url *UrlInfra) CreateURLDocument (ctx context.Context, request *models.UrlRequest) (*models.UrlResponse, error){\n \t\n\t // Create a random string that will serve as the short form of the url.\n\t shortUrl := createShortUrl(3)\n\n\t // Check if randomly generated string already exists in the db. Unlikely, but best to safeguard against this.\n\n\t query := url.MongoCollection.Find(shortUrl).Iter()\n\t var results []bson.M\n\t if err := query.All(&results); err != nil{\n\t \treturn nil, err\n\t }\n\t for _, result := range results{\n\t \tfor _, resultVal := range result{\n\t \t\tif shortUrl == resultVal{\n\t \t\t\t// Create new short url if it already exists in the db\n\t \t\t\tshortUrl = createShortUrl(3)\n\t\t\t}\n\t\t}\n\t }\n\n\t // Create new uuid for the URL ID.\n\t urlID := uuid.NewV4()\n\t newUrl := &models.UrlResponse{\n\t\t ShortUrl: shortUrl,\n\t\t LongUrl: request.UrlToBeShortened,\n\t\t Clicks: 0,\n\t\t CreatedAt: time.Now(),\n\t\t URLId: urlID.String(),\n\t }\n\n\t err := url.MongoCollection.Insert(newUrl)\n \tif err != nil {\n \t\treturn nil, errors.New(\"error while trying to insert url into mongo\")\n\t}\n\n \treturn newUrl, nil\n }", "title": "" }, { "docid": "aed33716fe199d08d02060572c8e4ca6", "score": "0.41075015", "text": "func (url URLTemplate) RenderWithRelease(release Release) (URL, error) {\n\tsemver, err := release.SemVer()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tparam := struct {\n\t\tTag string\n\t\tSemVer string\n\t}{\n\t\tTag: release.Tag,\n\t\tSemVer: semver,\n\t}\n\n\ttmpl, err := template.New(\"\").Parse(url.String())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbuf := new(bytes.Buffer)\n\terr = tmpl.Execute(buf, param)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn NewURL(buf.String()), nil\n}", "title": "" }, { "docid": "1f75f817a3c9a2d3df2a348de0969046", "score": "0.4100275", "text": "func NewRel(rel, val string) *Rel {\n\treturn &Rel{\n\t\tRel: rel,\n\t\tVal: val,\n\t}\n}", "title": "" }, { "docid": "4403e3558ca847d67ad2cacb1240738c", "score": "0.4099291", "text": "func (b *StoriesGetVideoUploadServerBuilder) LinkText(v string) *StoriesGetVideoUploadServerBuilder {\n\tb.Params[\"link_text\"] = v\n\treturn b\n}", "title": "" }, { "docid": "4fbb90c17df997d2e8d33d0121058a0e", "score": "0.409897", "text": "func (p *Params) ReplaceTextsToImagesByURL(from, to string) *Params {\r\n\tp.Works.DoReplaceTextsToImagesByURL = true\r\n\tp.ReplaceTextsToImagesP.ReplaceFromText = from\r\n\tp.ReplaceTextsToImagesP.ReplaceToImage = to\r\n\treturn p\r\n}", "title": "" }, { "docid": "381665e57da0041cbfcb83f2158c4505", "score": "0.40830782", "text": "func newStyle(fg, bg lib.ColorPair, bold bool) func(string) string {\n\ts := te.Style{}.Foreground(fg.Color()).Background(bg.Color())\n\tif bold {\n\t\ts = s.Bold()\n\t}\n\treturn s.Styled\n}", "title": "" }, { "docid": "0871129ba56d8a1916831fdfa6b264a0", "score": "0.40787768", "text": "func NewLearningContent()(*LearningContent) {\n m := &LearningContent{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "b8c9ca5de9dc9899fb5e53f27008e868", "score": "0.40639317", "text": "func NewRichTextStrikethrough(text RichText) *RichTextStrikethrough {\n\trichTextStrikethroughTemp := RichTextStrikethrough{\n\t\ttdCommon: tdCommon{Type: \"richTextStrikethrough\"},\n\t\tText: text,\n\t}\n\n\treturn &richTextStrikethroughTemp\n}", "title": "" }, { "docid": "6ee7728f3dcc74d48a87372a37023673", "score": "0.4059909", "text": "func NewLinkSubmission(sr, title, link string, replies bool, c *Captcha) *NewSubmission {\n\treturn &NewSubmission{sr, title, link, false, replies, true, true, c}\n}", "title": "" }, { "docid": "a4303e4cfd4a4835d0e65c1f9b57e0e5", "score": "0.40538198", "text": "func (r *Registry) url(pathTemplate string, args ...interface{}) string {\n\tpathSuffix := fmt.Sprintf(pathTemplate, args...)\n\turl := fmt.Sprintf(\"%s%s\", r.URL, pathSuffix)\n\treturn url\n}", "title": "" }, { "docid": "3295a7c574e3bda6f70b808db42d3a1a", "score": "0.4051484", "text": "func WebViewNewWithRelatedView(webView *WebView) *WebView {\n\tc_web_view := (*C.WebKitWebView)(C.NULL)\n\tif webView != nil {\n\t\tc_web_view = (*C.WebKitWebView)(webView.ToC())\n\t}\n\n\tretC := C.webkit_web_view_new_with_related_view(c_web_view)\n\tretGo := WebViewNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "b942d90c520a047c82a45b7764dab4aa", "score": "0.40395126", "text": "func (w *WeVideo) AddText(clipName, expectedTrack, text string) action.Action {\n\tui := w.ui\n\ttextTab := nodewith.Name(\"Text\").Role(role.Tab).HasClass(editorTabClass)\n\t// It removes the text info, so it can only capture \"Basic text\" node by classname.\n\t// The first one is \"Basic text\".\n\tbasicText := nodewith.ClassName(\"ui-draggable-handle\").Role(role.GenericContainer).First()\n\tdragTextToTrack := func(ctx context.Context) error {\n\t\ttextLocation, err := ui.Location(ctx, basicText)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\texpectedTrack := nodewith.Name(expectedTrack).Role(role.StaticText)\n\t\ttrackLocation, err := ui.Location(ctx, expectedTrack)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdragUpStart := textLocation.CenterPoint()\n\t\tdragUpEnd := coords.NewPoint(w.clips[clipName].startPoint.X, trackLocation.CenterY())\n\t\tpc := pointer.NewMouse(w.tconn)\n\t\tdefer pc.Close()\n\t\ttesting.ContextLogf(ctx, \"Drag text to track from %v to %v\", dragUpStart, dragUpEnd)\n\t\treturn uiauto.Retry(retryTimes, uiauto.Combine(\"drag text to track\",\n\t\t\tpc.Drag(dragUpStart, pc.DragTo(dragUpEnd, dragTime)),\n\t\t\tui.WithTimeout(shortUITimeout).WaitUntilExists(beginningOfTheClip),\n\t\t))(ctx)\n\t}\n\tsampleText := nodewith.Name(\"Sample text\").Role(role.StaticText)\n\tsaveButtonRe := regexp.MustCompile(\"(?i)save changes\")\n\tsaveButton := nodewith.NameRegex(saveButtonRe).Role(role.StaticText).Ancestor(weVideoWebArea)\n\teditTextProperties := uiauto.NamedCombine(\"edit text\",\n\t\tw.closePromptWindow(),\n\t\tw.kb.TypeAction(\"e\"), // Type e to edit text.\n\t\tui.LeftClick(sampleText),\n\t\tw.kb.AccelAction(\"Ctrl+A\"),\n\t\tw.kb.TypeAction(text),\n\t\tui.DoDefaultUntil(saveButton, ui.WithTimeout(shortUITimeout).WaitUntilGone(saveButton)),\n\t)\n\treturn uiauto.NamedCombine(fmt.Sprintf(\"add text to clip \\\"%s\\\"\", clipName),\n\t\tw.closePromptWindow(),\n\t\tui.LeftClick(textTab),\n\t\tdragTextToTrack,\n\t\teditTextProperties,\n\t)\n}", "title": "" }, { "docid": "dab9510d1062f66a26c5d480e1510a76", "score": "0.40378207", "text": "func (r *Request) URL(url string) Interface {\n\tr.url.Reset()\n\tr.url.WriteString(url)\n\treturn r\n}", "title": "" }, { "docid": "aa7a74c550fd5752278ae8f33b9ddcda", "score": "0.40308252", "text": "func NewRichTextItalic(text RichText) *RichTextItalic {\n\trichTextItalicTemp := RichTextItalic{\n\t\ttdCommon: tdCommon{Type: \"richTextItalic\"},\n\t\tText: text,\n\t}\n\n\treturn &richTextItalicTemp\n}", "title": "" }, { "docid": "9f8bf503a058d412af9a1438154a00ea", "score": "0.402746", "text": "func UnmarshalTextEntityTypeTextURL(data json.RawMessage) (*TextEntityTypeTextURL, error) {\n\tvar response TextEntityTypeTextURL\n\n\terr := json.Unmarshal(data, &response)\n\n\treturn &response, err\n}", "title": "" }, { "docid": "f8f782c1852e458b470917bea184feb8", "score": "0.40239924", "text": "func newLink(d *LinkData, artifactsURL string) (*link, error) {\n\tswitch d.Type {\n\tcase TypeStatic:\n\t\tif d.StaticURL == \"\" {\n\t\t\treturn nil, errors.New(\"url field must not be empty for static external data file\")\n\t\t}\n\t\tif d.Name != \"\" {\n\t\t\treturn nil, errors.New(\"name field must be empty for static external data file\")\n\t\t}\n\t\tif d.SHA256Sum == \"\" {\n\t\t\treturn nil, errors.New(\"sha256sum field must not be empty for static external data file\")\n\t\t}\n\t\treturn &link{Data: *d, ComputedURL: d.StaticURL}, nil\n\tcase TypeArtifact:\n\t\tif d.StaticURL != \"\" {\n\t\t\treturn nil, errors.New(\"url field must be empty for artifact external data file\")\n\t\t}\n\t\tif d.Name == \"\" {\n\t\t\treturn nil, errors.New(\"name field must not be empty for artifact external data file\")\n\t\t}\n\t\tif d.SHA256Sum != \"\" {\n\t\t\treturn nil, errors.New(\"sha256sum field must be empty for artifact external data file\")\n\t\t}\n\t\tif d.Size != 0 {\n\t\t\treturn nil, errors.New(\"size field must be empty for artifact external data file\")\n\t\t}\n\t\tif artifactsURL == \"\" {\n\t\t\treturn nil, errors.New(\"build artifact URL is unknown (running a developer build?)\")\n\t\t}\n\t\treturn &link{Data: *d, ComputedURL: artifactsURL + d.Name}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown external data link type %q\", d.Type)\n\t}\n}", "title": "" }, { "docid": "7b8b28dac24f8ed87058231c98855687", "score": "0.40231517", "text": "func (m *Envelope) AddHTMLAlternativeToPlainText(content string) bool {\n\trootPart := C.g_mime_message_get_mime_part(m.gmimeMessage)\n\tctype := C.gmime_get_content_type_string(rootPart)\n\tdefer C.g_free(C.gpointer(unsafe.Pointer(ctype)))\n\n\t// if content type is not text/plain, we can't reliably add alternative html\n\tgoCType := C.GoString(ctype)\n\tif goCType != \"text/plain\" {\n\t\treturn false\n\t}\n\n\t// set new multipart as root and add the original text/plain to it\n\tmultipart := C.g_mime_multipart_new_with_subtype(cStringAlternative)\n\tC.g_mime_multipart_add(multipart, (*C.GMimeObject)(unsafe.Pointer(rootPart)))\n\tC.g_mime_message_set_mime_part(m.gmimeMessage, (*C.GMimeObject)(unsafe.Pointer(multipart)))\n\n\t// create a new html part and add it to the root level multipart\n\t// TODO: need to free newHTMLpart somewhere\n\tnewHTMLpart := C.g_mime_text_part_new_with_subtype(cStringHTML)\n\tcContent := C.CString(content)\n\tdefer C.g_free(C.gpointer(unsafe.Pointer(cContent)))\n\tC.g_mime_text_part_set_text(newHTMLpart, cContent)\n\tC.g_mime_multipart_add(multipart, (*C.GMimeObject)(unsafe.Pointer(newHTMLpart)))\n\treturn true\n}", "title": "" }, { "docid": "7240c0a55287b91bc3531f892aa063f1", "score": "0.4022082", "text": "func NewURL(path string) (*URL, error) {\n\tvar u = &URL{Path: path}\n\n\t// Check for an info request first since it's pretty trivial to do\n\tif strings.HasSuffix(path, \"info.json\") {\n\t\tu.Info = true\n\t\tu.ID = URLToID(strings.Replace(path, \"/info.json\", \"\", -1))\n\t\treturn u, nil\n\t}\n\n\t// Parse in reverse order to deal with the continuing problem of slashes not\n\t// being escaped properly in all situations\n\tvar parts = pathify(path)\n\tvar qualityFormat = parts.pop()\n\tvar qfParts = strings.SplitN(qualityFormat, \".\", 2)\n\tif len(qfParts) == 2 {\n\t\tu.Format = StringToFormat(qfParts[1])\n\t\tu.Quality = StringToQuality(qfParts[0])\n\t}\n\tu.Rotation = StringToRotation(parts.pop())\n\tu.Size = StringToSize(parts.pop())\n\tu.Region = StringToRegion(parts.pop())\n\n\t// The remainder of the path has to be the ID\n\tu.ID = URLToID(parts.rejoin())\n\n\t// Invalid may or may not actually mean invalid, but we just let the caller\n\t// try to figure it out....\n\tif !u.Valid() {\n\t\treturn u, u.Error()\n\t}\n\n\treturn u, nil\n}", "title": "" }, { "docid": "a44480cf4c07dbc454db05968f4c62ee", "score": "0.40213296", "text": "func TextViewNew() (*TextView, error) {\n\tc := C.gtk_text_view_new()\n\tif c == nil {\n\t\treturn nil, nilPtrErr\n\t}\n\tobj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}\n\tt := wrapTextView(obj)\n\tobj.RefSink()\n\truntime.SetFinalizer(obj, (*glib.Object).Unref)\n\treturn t, nil\n}", "title": "" }, { "docid": "6de42bd92aae93b3ae4d0021f345d949", "score": "0.40173253", "text": "func init() {\n\tgcfg.SetContent(urlConfig, \"url.toml\")\n\tg.Config(\"url\").SetFileName(\"url.toml\")\n}", "title": "" }, { "docid": "aa8ec6f9c38304094d3e3bc41360a61f", "score": "0.40166053", "text": "func (p *PdfiumImplementation) FPDFPageObj_NewTextObj(request *requests.FPDFPageObj_NewTextObj) (*responses.FPDFPageObj_NewTextObj, error) {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\tdocumentHandle, err := p.getDocumentHandle(request.Document)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfont := C.CString(request.Font)\n\tdefer C.free(unsafe.Pointer(font))\n\n\ttextObject := C.FPDFPageObj_NewTextObj(documentHandle.handle, font, C.float(request.FontSize))\n\ttextObjectHandle := p.registerPageObject(textObject)\n\n\treturn &responses.FPDFPageObj_NewTextObj{\n\t\tPageObject: textObjectHandle.nativeRef,\n\t}, nil\n}", "title": "" }, { "docid": "46306ef73efe3f4cd81b3f274d14bc46", "score": "0.401237", "text": "func (r *Document) URL() scalars.URL {\n\treturn scalars.NewURL(r.document.URL)\n}", "title": "" }, { "docid": "9d78435c7343a998a19dd6f3b78048c5", "score": "0.40110943", "text": "func createGitURL(moduleCall *tfconfig.ModuleCall) (string, error) {\n\tsplitString := strings.Split(moduleCall.Source, \"/\")\n\towner, repo := splitString[1], splitString[2]\n\n\tclient := github.NewClient(nil)\n\trelease, _, err := client.Repositories.GetLatestRelease(context.Background(), owner, repo)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn strings.Split(moduleCall.Source, tagPattern)[0] + tagPattern + *release.TagName, nil\n}", "title": "" }, { "docid": "89ea36694be9fa2cedca07ed326af53f", "score": "0.4010665", "text": "func AddNewText2D(sc *Scene, parent ki.Ki, name string, text string) *Text2D {\n\ttxt := parent.AddNewChild(TypeText2D, name).(*Text2D)\n\ttxt.Defaults(sc)\n\ttxt.Text = text\n\treturn txt\n}", "title": "" } ]
86884bdb668b5404329a4a8f003c944f
check runs all checks and userdefined validators on the builder.
[ { "docid": "ab90c9390bc47e5ee84f4401715e3f59", "score": "0.6176269", "text": "func (au *AccountUpdate) check() error {\n\tif v, ok := au.mutation.Provider(); ok {\n\t\tif err := account.ProviderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"provider\", err: fmt.Errorf(\"models: validator failed for field \\\"provider\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.Email(); ok {\n\t\tif err := account.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(\"models: validator failed for field \\\"email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.Password(); ok {\n\t\tif err := account.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"models: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.ConfirmationToken(); ok {\n\t\tif err := account.ConfirmationTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"confirmation_token\", err: fmt.Errorf(\"models: validator failed for field \\\"confirmation_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.RecoveryToken(); ok {\n\t\tif err := account.RecoveryTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"recovery_token\", err: fmt.Errorf(\"models: validator failed for field \\\"recovery_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.Otp(); ok {\n\t\tif err := account.OtpValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"otp\", err: fmt.Errorf(\"models: validator failed for field \\\"otp\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.EmailChange(); ok {\n\t\tif err := account.EmailChangeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.EmailChangeToken(); ok {\n\t\tif err := account.EmailChangeTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change_token\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change_token\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "f143e8331ee497e8d61f1fd234446204", "score": "0.71832687", "text": "func (bc *BuilderCreate) check() error {\n\treturn nil\n}", "title": "" }, { "docid": "c2194a3c39d260ec9170f59c9702f1e7", "score": "0.6471791", "text": "func (buo *BadgeUpdateOne) check() error {\n\tif v, ok := buo.mutation.Color(); ok {\n\t\tif err := badge.ColorValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"color\", err: fmt.Errorf(\"ent: validator failed for field \\\"color\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := buo.mutation.Material(); ok {\n\t\tif err := badge.MaterialValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"material\", err: fmt.Errorf(\"ent: validator failed for field \\\"material\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c09c49f32ff65e642306cd655869c462", "score": "0.6461162", "text": "func (suo *SurgeryappointmentUpdateOne) check() error {\n\tif v, ok := suo.mutation.Phone(); ok {\n\t\tif err := surgeryappointment.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suo.mutation.Note(); ok {\n\t\tif err := surgeryappointment.NoteValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"note\", err: fmt.Errorf(\"ent: validator failed for field \\\"note\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suo.mutation.Cost(); ok {\n\t\tif err := surgeryappointment.CostValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"cost\", err: fmt.Errorf(\"ent: validator failed for field \\\"cost\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0e65a56b2f2a9f814a85386ee8e88287", "score": "0.64498776", "text": "func (su *SurgeryappointmentUpdate) check() error {\n\tif v, ok := su.mutation.Phone(); ok {\n\t\tif err := surgeryappointment.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := su.mutation.Note(); ok {\n\t\tif err := surgeryappointment.NoteValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"note\", err: fmt.Errorf(\"ent: validator failed for field \\\"note\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := su.mutation.Cost(); ok {\n\t\tif err := surgeryappointment.CostValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"cost\", err: fmt.Errorf(\"ent: validator failed for field \\\"cost\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2dd7e2308117ccda2ca2700503eaccb8", "score": "0.6419694", "text": "func (bc *BankdetailCreate) check() error {\n\tif v, ok := bc.mutation.BankAccountNo(); ok {\n\t\tif err := bankdetail.BankAccountNoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Bank_AccountNo\", err: fmt.Errorf(\"ent: validator failed for field \\\"Bank_AccountNo\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := bc.mutation.BankName(); ok {\n\t\tif err := bankdetail.BankNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Bank_Name\", err: fmt.Errorf(\"ent: validator failed for field \\\"Bank_Name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := bc.mutation.BankAccountName(); ok {\n\t\tif err := bankdetail.BankAccountNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Bank_AccountName\", err: fmt.Errorf(\"ent: validator failed for field \\\"Bank_AccountName\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "548c1c9692c2d11bd4cb41c9b5b5cdac", "score": "0.6364352", "text": "func (uuo *UserUpdateOne) check() error {\n\tif v, ok := uuo.mutation.BillingID(); ok {\n\t\tif err := user.BillingIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"billing_id\", err: fmt.Errorf(\"models: validator failed for field \\\"billing_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Provider(); ok {\n\t\tif err := user.ProviderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"provider\", err: fmt.Errorf(\"models: validator failed for field \\\"provider\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Email(); ok {\n\t\tif err := user.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(\"models: validator failed for field \\\"email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Password(); ok {\n\t\tif err := user.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"models: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.APIKey(); ok {\n\t\tif err := user.APIKeyValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"api_key\", err: fmt.Errorf(\"models: validator failed for field \\\"api_key\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.ConfirmationToken(); ok {\n\t\tif err := user.ConfirmationTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"confirmation_token\", err: fmt.Errorf(\"models: validator failed for field \\\"confirmation_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.RecoveryToken(); ok {\n\t\tif err := user.RecoveryTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"recovery_token\", err: fmt.Errorf(\"models: validator failed for field \\\"recovery_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Otp(); ok {\n\t\tif err := user.OtpValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"otp\", err: fmt.Errorf(\"models: validator failed for field \\\"otp\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.EmailChange(); ok {\n\t\tif err := user.EmailChangeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.EmailChangeToken(); ok {\n\t\tif err := user.EmailChangeTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change_token\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change_token\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "473718b4ae4892faeb26b8ca205ec644", "score": "0.63612586", "text": "func (mc *MachineCreate) check() error {\n\tif _, ok := mc.mutation.Hwid(); !ok {\n\t\treturn &ValidationError{Name: \"hwid\", err: errors.New(\"ent: missing required field \\\"hwid\\\"\")}\n\t}\n\tif v, ok := mc.mutation.Hwid(); ok {\n\t\tif err := machine.HwidValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"hwid\", err: fmt.Errorf(\"ent: validator failed for field \\\"hwid\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := mc.mutation.Hostname(); !ok {\n\t\treturn &ValidationError{Name: \"hostname\", err: errors.New(\"ent: missing required field \\\"hostname\\\"\")}\n\t}\n\tif v, ok := mc.mutation.Hostname(); ok {\n\t\tif err := machine.HostnameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"hostname\", err: fmt.Errorf(\"ent: validator failed for field \\\"hostname\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := mc.mutation.Fingerprint(); !ok {\n\t\treturn &ValidationError{Name: \"fingerprint\", err: errors.New(\"ent: missing required field \\\"fingerprint\\\"\")}\n\t}\n\tif v, ok := mc.mutation.Fingerprint(); ok {\n\t\tif err := machine.FingerprintValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"fingerprint\", err: fmt.Errorf(\"ent: validator failed for field \\\"fingerprint\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dca83afcb50783c7d0fcfbe5c031cb07", "score": "0.6351587", "text": "func (wu *WalletUpdate) check() error {\n\tif v, ok := wu.mutation.Seed(); ok {\n\t\tif err := wallet.SeedValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"seed\", err: fmt.Errorf(`ent: validator failed for field \"Wallet.seed\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := wu.mutation.Representative(); ok {\n\t\tif err := wallet.RepresentativeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"representative\", err: fmt.Errorf(`ent: validator failed for field \"Wallet.representative\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d68beebab4f1ed0abfb79c42d2567891", "score": "0.63493603", "text": "func (wuo *WalletUpdateOne) check() error {\n\tif v, ok := wuo.mutation.Seed(); ok {\n\t\tif err := wallet.SeedValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"seed\", err: fmt.Errorf(`ent: validator failed for field \"Wallet.seed\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := wuo.mutation.Representative(); ok {\n\t\tif err := wallet.RepresentativeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"representative\", err: fmt.Errorf(`ent: validator failed for field \"Wallet.representative\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "afaf714fa735f61d3b200554a16366e2", "score": "0.6339941", "text": "func (uu *UserUpdate) check() error {\n\tif v, ok := uu.mutation.BillingID(); ok {\n\t\tif err := user.BillingIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"billing_id\", err: fmt.Errorf(\"models: validator failed for field \\\"billing_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Provider(); ok {\n\t\tif err := user.ProviderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"provider\", err: fmt.Errorf(\"models: validator failed for field \\\"provider\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Email(); ok {\n\t\tif err := user.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(\"models: validator failed for field \\\"email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Password(); ok {\n\t\tif err := user.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"models: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.APIKey(); ok {\n\t\tif err := user.APIKeyValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"api_key\", err: fmt.Errorf(\"models: validator failed for field \\\"api_key\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.ConfirmationToken(); ok {\n\t\tif err := user.ConfirmationTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"confirmation_token\", err: fmt.Errorf(\"models: validator failed for field \\\"confirmation_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.RecoveryToken(); ok {\n\t\tif err := user.RecoveryTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"recovery_token\", err: fmt.Errorf(\"models: validator failed for field \\\"recovery_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Otp(); ok {\n\t\tif err := user.OtpValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"otp\", err: fmt.Errorf(\"models: validator failed for field \\\"otp\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.EmailChange(); ok {\n\t\tif err := user.EmailChangeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.EmailChangeToken(); ok {\n\t\tif err := user.EmailChangeTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change_token\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change_token\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59c3a5519d8215c5a8ac6f6ae85c7dcf", "score": "0.6328843", "text": "func (bu *BadgeUpdate) check() error {\n\tif v, ok := bu.mutation.Color(); ok {\n\t\tif err := badge.ColorValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"color\", err: fmt.Errorf(\"ent: validator failed for field \\\"color\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := bu.mutation.Material(); ok {\n\t\tif err := badge.MaterialValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"material\", err: fmt.Errorf(\"ent: validator failed for field \\\"material\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f51a284f9578f97aa05133915a694eae", "score": "0.63136643", "text": "func (rdc *ResultsDefinitionCreate) check() error {\n\treturn nil\n}", "title": "" }, { "docid": "3005349b035081ad8cb7bc82f3a6419d", "score": "0.63097954", "text": "func (cc *ConsumerCreate) check() error {\n\tif v, ok := cc.mutation.TransactionID(); ok {\n\t\tif err := consumer.TransactionIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"transaction_id\", err: fmt.Errorf(\"ent: validator failed for field \\\"transaction_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.TransactionStatus(); ok {\n\t\tif err := consumer.TransactionStatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"TransactionStatus\", err: fmt.Errorf(\"ent: validator failed for field \\\"TransactionStatus\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.TransactionType(); ok {\n\t\tif err := consumer.TransactionTypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"TransactionType\", err: fmt.Errorf(\"ent: validator failed for field \\\"TransactionType\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.PaymentChannel(); ok {\n\t\tif err := consumer.PaymentChannelValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"PaymentChannel\", err: fmt.Errorf(\"ent: validator failed for field \\\"PaymentChannel\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.PaymentType(); ok {\n\t\tif err := consumer.PaymentTypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"PaymentType\", err: fmt.Errorf(\"ent: validator failed for field \\\"PaymentType\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.TypeCode(); ok {\n\t\tif err := consumer.TypeCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"TypeCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"TypeCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ApprovalCode(); ok {\n\t\tif err := consumer.ApprovalCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ApprovalCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"ApprovalCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.BillerID(); ok {\n\t\tif err := consumer.BillerIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"BillerID\", err: fmt.Errorf(\"ent: validator failed for field \\\"BillerID\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.Ref1(); ok {\n\t\tif err := consumer.Ref1Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ref1\", err: fmt.Errorf(\"ent: validator failed for field \\\"ref1\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.Ref2(); ok {\n\t\tif err := consumer.Ref2Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ref2\", err: fmt.Errorf(\"ent: validator failed for field \\\"ref2\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.Ref3(); ok {\n\t\tif err := consumer.Ref3Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ref3\", err: fmt.Errorf(\"ent: validator failed for field \\\"ref3\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.FromReference(); ok {\n\t\tif err := consumer.FromReferenceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"FromReference\", err: fmt.Errorf(\"ent: validator failed for field \\\"FromReference\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.FromPhoneNo(); ok {\n\t\tif err := consumer.FromPhoneNoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"FromPhoneNo\", err: fmt.Errorf(\"ent: validator failed for field \\\"FromPhoneNo\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.FromName(); ok {\n\t\tif err := consumer.FromNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"FromName\", err: fmt.Errorf(\"ent: validator failed for field \\\"FromName\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ToAccount(); ok {\n\t\tif err := consumer.ToAccountValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ToAccount\", err: fmt.Errorf(\"ent: validator failed for field \\\"ToAccount\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ToAccountPhoneNo(); ok {\n\t\tif err := consumer.ToAccountPhoneNoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ToAccountPhoneNo\", err: fmt.Errorf(\"ent: validator failed for field \\\"ToAccountPhoneNo\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ToAccountName(); ok {\n\t\tif err := consumer.ToAccountNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ToAccountName\", err: fmt.Errorf(\"ent: validator failed for field \\\"ToAccountName\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.BankCode(); ok {\n\t\tif err := consumer.BankCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"BankCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"BankCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.TerminalId(); ok {\n\t\tif err := consumer.TerminalIdValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"TerminalId\", err: fmt.Errorf(\"ent: validator failed for field \\\"TerminalId\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.TerminalType(); ok {\n\t\tif err := consumer.TerminalTypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"TerminalType\", err: fmt.Errorf(\"ent: validator failed for field \\\"TerminalType\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ToAccount105(); ok {\n\t\tif err := consumer.ToAccount105Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ToAccount105\", err: fmt.Errorf(\"ent: validator failed for field \\\"ToAccount105\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.FromReference105(); ok {\n\t\tif err := consumer.FromReference105Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"FromReference105\", err: fmt.Errorf(\"ent: validator failed for field \\\"FromReference105\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.PartnerRef(); ok {\n\t\tif err := consumer.PartnerRefValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"PartnerRef\", err: fmt.Errorf(\"ent: validator failed for field \\\"PartnerRef\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ResponseCode(); ok {\n\t\tif err := consumer.ResponseCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ResponseCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"ResponseCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ResponseDescription(); ok {\n\t\tif err := consumer.ResponseDescriptionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ResponseDescription\", err: fmt.Errorf(\"ent: validator failed for field \\\"ResponseDescription\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8d27ffd89ac9eb617c0aad9d2531d53c", "score": "0.62834436", "text": "func (lbc *LoadBalanceCreate) check() error {\n\tif _, ok := lbc.mutation.ServiceID(); !ok {\n\t\treturn &ValidationError{Name: \"service_id\", err: errors.New(\"ent: missing required field \\\"service_id\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.CheckMethod(); !ok {\n\t\treturn &ValidationError{Name: \"check_method\", err: errors.New(\"ent: missing required field \\\"check_method\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.CheckTimeout(); !ok {\n\t\treturn &ValidationError{Name: \"check_timeout\", err: errors.New(\"ent: missing required field \\\"check_timeout\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.CheckInterval(); !ok {\n\t\treturn &ValidationError{Name: \"check_interval\", err: errors.New(\"ent: missing required field \\\"check_interval\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.RoundType(); !ok {\n\t\treturn &ValidationError{Name: \"round_type\", err: errors.New(\"ent: missing required field \\\"round_type\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.IPList(); !ok {\n\t\treturn &ValidationError{Name: \"ip_list\", err: errors.New(\"ent: missing required field \\\"ip_list\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.WeightList(); !ok {\n\t\treturn &ValidationError{Name: \"weight_list\", err: errors.New(\"ent: missing required field \\\"weight_list\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.ForbidList(); !ok {\n\t\treturn &ValidationError{Name: \"forbid_list\", err: errors.New(\"ent: missing required field \\\"forbid_list\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.UpstreamConnectTimeout(); !ok {\n\t\treturn &ValidationError{Name: \"upstream_connect_timeout\", err: errors.New(\"ent: missing required field \\\"upstream_connect_timeout\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.UpstreamHeaderTimeout(); !ok {\n\t\treturn &ValidationError{Name: \"upstream_header_timeout\", err: errors.New(\"ent: missing required field \\\"upstream_header_timeout\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.UpstreamIdleTimeout(); !ok {\n\t\treturn &ValidationError{Name: \"upstream_idle_timeout\", err: errors.New(\"ent: missing required field \\\"upstream_idle_timeout\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.UpstreamMaxIdle(); !ok {\n\t\treturn &ValidationError{Name: \"upstream_max_idle\", err: errors.New(\"ent: missing required field \\\"upstream_max_idle\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c403b2d0e69ea50df75140faf9aa5203", "score": "0.6280753", "text": "func (auo *AccountUpdateOne) check() error {\n\tif v, ok := auo.mutation.Provider(); ok {\n\t\tif err := account.ProviderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"provider\", err: fmt.Errorf(\"models: validator failed for field \\\"provider\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.Email(); ok {\n\t\tif err := account.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(\"models: validator failed for field \\\"email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.Password(); ok {\n\t\tif err := account.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"models: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.ConfirmationToken(); ok {\n\t\tif err := account.ConfirmationTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"confirmation_token\", err: fmt.Errorf(\"models: validator failed for field \\\"confirmation_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.RecoveryToken(); ok {\n\t\tif err := account.RecoveryTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"recovery_token\", err: fmt.Errorf(\"models: validator failed for field \\\"recovery_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.Otp(); ok {\n\t\tif err := account.OtpValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"otp\", err: fmt.Errorf(\"models: validator failed for field \\\"otp\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.EmailChange(); ok {\n\t\tif err := account.EmailChangeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.EmailChangeToken(); ok {\n\t\tif err := account.EmailChangeTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change_token\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change_token\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08c083ab4ce9c8f3b014634f044b3090", "score": "0.62754875", "text": "func (mruo *MedicalRecordUpdateOne) check() error {\n\tif v, ok := mruo.mutation.Email(); ok {\n\t\tif err := medicalrecord.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(\"ent: validator failed for field \\\"email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mruo.mutation.Password(); ok {\n\t\tif err := medicalrecord.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"ent: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mruo.mutation.Name(); ok {\n\t\tif err := medicalrecord.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ae4254751a29e15b4c8fb7cc507be1f", "score": "0.6254685", "text": "func (wc *WidgetCreate) check() error {\n\tif _, ok := wc.mutation.Note(); !ok {\n\t\treturn &ValidationError{Name: \"note\", err: errors.New(`ent: missing required field \"note\"`)}\n\t}\n\tif v, ok := wc.mutation.Note(); ok {\n\t\tif err := widget.NoteValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"note\", err: fmt.Errorf(`ent: validator failed for field \"note\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := wc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(`ent: missing required field \"created_at\"`)}\n\t}\n\tif _, ok := wc.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(`ent: missing required field \"status\"`)}\n\t}\n\tif v, ok := wc.mutation.Status(); ok {\n\t\tif err := widget.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"status\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := wc.mutation.Priority(); !ok {\n\t\treturn &ValidationError{Name: \"priority\", err: errors.New(`ent: missing required field \"priority\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a63be3a2971a22ec56fd2ee96bd5341", "score": "0.62467855", "text": "func (mru *MedicalRecordUpdate) check() error {\n\tif v, ok := mru.mutation.Email(); ok {\n\t\tif err := medicalrecord.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(\"ent: validator failed for field \\\"email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mru.mutation.Password(); ok {\n\t\tif err := medicalrecord.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"ent: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mru.mutation.Name(); ok {\n\t\tif err := medicalrecord.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ce3ddf249a04b5314b6d2872b91d2eca", "score": "0.6207184", "text": "func (ksc *KeyStoreCreate) check() error {\n\tif _, ok := ksc.mutation.Address(); !ok {\n\t\treturn &ValidationError{Name: \"address\", err: errors.New(`ent: missing required field \"address\"`)}\n\t}\n\tif v, ok := ksc.mutation.Address(); ok {\n\t\tif err := keystore.AddressValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"address\", err: fmt.Errorf(`ent: validator failed for field \"address\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := ksc.mutation.PrivateKey(); !ok {\n\t\treturn &ValidationError{Name: \"private_key\", err: errors.New(`ent: missing required field \"private_key\"`)}\n\t}\n\tif v, ok := ksc.mutation.PrivateKey(); ok {\n\t\tif err := keystore.PrivateKeyValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"private_key\", err: fmt.Errorf(`ent: validator failed for field \"private_key\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := ksc.mutation.CoinID(); !ok {\n\t\treturn &ValidationError{Name: \"coin\", err: errors.New(\"ent: missing required edge \\\"coin\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4111d7cbdf0a11bb5485110fe813b708", "score": "0.6196409", "text": "func (osu *OutboundShippingUpdate) check() error {\n\tif v, ok := osu.mutation.Courier(); ok {\n\t\tif err := outboundshipping.CourierValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"courier\", err: fmt.Errorf(\"ent: validator failed for field \\\"courier\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := osu.mutation.GetType(); ok {\n\t\tif err := outboundshipping.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := osu.mutation.State(); ok {\n\t\tif err := outboundshipping.StateValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"state\", err: fmt.Errorf(\"ent: validator failed for field \\\"state\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e38ef9e0064111cf38f5f647e56ef2e4", "score": "0.61909574", "text": "func (ugu *UsersGroupUpdate) check() error {\n\tif v, ok := ugu.mutation.Name(); ok {\n\t\tif err := usersgroup.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ugu.mutation.Status(); ok {\n\t\tif err := usersgroup.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a5db892567d08866be7601bffb36be4c", "score": "0.617893", "text": "func (cuo *ConnectorUpdateOne) check() error {\n\tif v, ok := cuo.mutation.GetType(); ok {\n\t\tif err := connector.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(`db: validator failed for field \"Connector.type\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := cuo.mutation.Name(); ok {\n\t\tif err := connector.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`db: validator failed for field \"Connector.name\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9c2bf5b27fee427e32cfe6cd05231d0e", "score": "0.6177764", "text": "func (osuo *OutboundShippingUpdateOne) check() error {\n\tif v, ok := osuo.mutation.Courier(); ok {\n\t\tif err := outboundshipping.CourierValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"courier\", err: fmt.Errorf(\"ent: validator failed for field \\\"courier\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := osuo.mutation.GetType(); ok {\n\t\tif err := outboundshipping.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := osuo.mutation.State(); ok {\n\t\tif err := outboundshipping.StateValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"state\", err: fmt.Errorf(\"ent: validator failed for field \\\"state\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b8325909fc5a6487cc06324c502e5f2", "score": "0.6176408", "text": "func (ddu *DatabaseDetectorUpdate) check() error {\n\tif v, ok := ddu.mutation.Status(); ok {\n\t\tif err := databasedetector.StatusValidator(int8(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"DatabaseDetector.status\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ddu.mutation.Name(); ok {\n\t\tif err := databasedetector.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`ent: validator failed for field \"DatabaseDetector.name\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ddu.mutation.Timeout(); ok {\n\t\tif err := databasedetector.TimeoutValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"timeout\", err: fmt.Errorf(`ent: validator failed for field \"DatabaseDetector.timeout\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "578579b7115bdf7b1cdb19e6be1a568f", "score": "0.61717594", "text": "func (cuo *CompanyUpdateOne) check() error {\n\tif v, ok := cuo.mutation.Name(); ok {\n\t\tif err := company.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuo.mutation.Location(); ok {\n\t\tif err := company.LocationValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"location\", err: fmt.Errorf(\"ent: validator failed for field \\\"location\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuo.mutation.PostalCode(); ok {\n\t\tif err := company.PostalCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"postal_code\", err: fmt.Errorf(\"ent: validator failed for field \\\"postal_code\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuo.mutation.PhoneNumber(); ok {\n\t\tif err := company.PhoneNumberValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone_number\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone_number\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuo.mutation.CompanyID(); ok {\n\t\tif err := company.CompanyIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"company_id\", err: fmt.Errorf(\"ent: validator failed for field \\\"company_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuo.mutation.Introduction(); ok {\n\t\tif err := company.IntroductionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"introduction\", err: fmt.Errorf(\"ent: validator failed for field \\\"introduction\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9993f90e40a75f40c8828294a0fda4d0", "score": "0.6165172", "text": "func (ftu *FieldTypeUpdate) check() error {\n\tif v, ok := ftu.mutation.ValidateOptionalInt32(); ok {\n\t\tif err := fieldtype.ValidateOptionalInt32Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"validate_optional_int32\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.validate_optional_int32\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.State(); ok {\n\t\tif err := fieldtype.StateValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"state\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.state\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.MAC(); ok {\n\t\tif err := fieldtype.MACValidator(v.String()); err != nil {\n\t\t\treturn &ValidationError{Name: \"mac\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.mac\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.Ndir(); ok {\n\t\tif err := fieldtype.NdirValidator(string(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"ndir\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.ndir\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.Link(); ok {\n\t\tif err := fieldtype.LinkValidator(v.String()); err != nil {\n\t\t\treturn &ValidationError{Name: \"link\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.link\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.RawData(); ok {\n\t\tif err := fieldtype.RawDataValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"raw_data\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.raw_data\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.IP(); ok {\n\t\tif err := fieldtype.IPValidator([]byte(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"ip\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.ip\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.Role(); ok {\n\t\tif err := fieldtype.RoleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"role\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.role\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.Priority(); ok {\n\t\tif err := fieldtype.PriorityValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"priority\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.priority\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "62400b9f384f1cce59d0de6195fe4c55", "score": "0.6164163", "text": "func (tc *ToyCreate) check() error {\n\tif _, ok := tc.mutation.Color(); !ok {\n\t\treturn &ValidationError{Name: \"color\", err: errors.New(`ent: missing required field \"color\"`)}\n\t}\n\tif v, ok := tc.mutation.Color(); ok {\n\t\tif err := toy.ColorValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"color\", err: fmt.Errorf(`ent: validator failed for field \"color\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := tc.mutation.Material(); !ok {\n\t\treturn &ValidationError{Name: \"material\", err: errors.New(`ent: missing required field \"material\"`)}\n\t}\n\tif v, ok := tc.mutation.Material(); ok {\n\t\tif err := toy.MaterialValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"material\", err: fmt.Errorf(`ent: validator failed for field \"material\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := tc.mutation.Title(); !ok {\n\t\treturn &ValidationError{Name: \"title\", err: errors.New(`ent: missing required field \"title\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "19795b1cb08b64df617caccfc8d6fc27", "score": "0.61612254", "text": "func (b *Builder) validate() error {\n\tif len(b.errors) != 0 {\n\t\treturn errors.Errorf(\"failed to validate: build errors were found: %v\", b.errors)\n\t}\n\tvalidationErrs := []error{}\n\tif b.meta.object.Name == \"\" && b.meta.object.GenerateName == \"\" {\n\t\tvalidationErrs = append(validationErrs, errors.New(\"missing name\"))\n\t}\n\tif len(validationErrs) != 0 {\n\t\tb.errors = append(b.errors, validationErrs...)\n\t\treturn errors.Errorf(\"validation error(s) found: %v\", validationErrs)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "629cea7828656e3bfd0ef2486536a823", "score": "0.61520374", "text": "func (vuo *VehicleUpdateOne) check() error {\n\tif v, ok := vuo.mutation.Hours(); ok {\n\t\tif err := vehicle.HoursValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"hours\", err: fmt.Errorf(\"ent: validator failed for field \\\"hours\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := vuo.mutation.Year(); ok {\n\t\tif err := vehicle.YearValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"year\", err: fmt.Errorf(\"ent: validator failed for field \\\"year\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := vuo.mutation.Power(); ok {\n\t\tif err := vehicle.PowerValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"power\", err: fmt.Errorf(\"ent: validator failed for field \\\"power\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := vuo.mutation.LocationID(); vuo.mutation.LocationCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"location\\\"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c0a46f05d84b70f698d2f8902f5d51f", "score": "0.61516756", "text": "func (v *Validation) Check(obj interface{}, checks ...Validator) *Result {\n\tvldts := make([]validation.Validator, 0, len(checks))\n\tfor _, v := range checks {\n\t\tvldts = append(vldts, validation.Validator(v))\n\t}\n\treturn (*Result)((*validation.Validation)(v).Check(obj, vldts...))\n}", "title": "" }, { "docid": "493510861124c41aff0a4817b946622a", "score": "0.6151201", "text": "func (rwc *ReportWalletCreate) check() error {\n\tif _, ok := rwc.mutation.Walletid(); !ok {\n\t\treturn &ValidationError{Name: \"walletid\", err: errors.New(\"ent: missing required field \\\"walletid\\\"\")}\n\t}\n\tif v, ok := rwc.mutation.Walletid(); ok {\n\t\tif err := reportwallet.WalletidValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"walletid\", err: fmt.Errorf(\"ent: validator failed for field \\\"walletid\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.WalletTypeName(); ok {\n\t\tif err := reportwallet.WalletTypeNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"WalletTypeName\", err: fmt.Errorf(\"ent: validator failed for field \\\"WalletTypeName\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.WalletPhoneno(); ok {\n\t\tif err := reportwallet.WalletPhonenoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"WalletPhoneno\", err: fmt.Errorf(\"ent: validator failed for field \\\"WalletPhoneno\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.WalletName(); ok {\n\t\tif err := reportwallet.WalletNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"WalletName\", err: fmt.Errorf(\"ent: validator failed for field \\\"WalletName\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.CitizenId(); ok {\n\t\tif err := reportwallet.CitizenIdValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"CitizenId\", err: fmt.Errorf(\"ent: validator failed for field \\\"CitizenId\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.Status(); ok {\n\t\tif err := reportwallet.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Status\", err: fmt.Errorf(\"ent: validator failed for field \\\"Status\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.Email(); ok {\n\t\tif err := reportwallet.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Email\", err: fmt.Errorf(\"ent: validator failed for field \\\"Email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.IsForgetPin(); ok {\n\t\tif err := reportwallet.IsForgetPinValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"IsForgetPin\", err: fmt.Errorf(\"ent: validator failed for field \\\"IsForgetPin\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.ATMCard(); ok {\n\t\tif err := reportwallet.ATMCardValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ATMCard\", err: fmt.Errorf(\"ent: validator failed for field \\\"ATMCard\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.AccountNo(); ok {\n\t\tif err := reportwallet.AccountNoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"AccountNo\", err: fmt.Errorf(\"ent: validator failed for field \\\"AccountNo\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.Street(); ok {\n\t\tif err := reportwallet.StreetValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Street\", err: fmt.Errorf(\"ent: validator failed for field \\\"Street\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.District(); ok {\n\t\tif err := reportwallet.DistrictValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"District\", err: fmt.Errorf(\"ent: validator failed for field \\\"District\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.SubDistrict(); ok {\n\t\tif err := reportwallet.SubDistrictValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SubDistrict\", err: fmt.Errorf(\"ent: validator failed for field \\\"SubDistrict\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.Province(); ok {\n\t\tif err := reportwallet.ProvinceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Province\", err: fmt.Errorf(\"ent: validator failed for field \\\"Province\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.PostalCode(); ok {\n\t\tif err := reportwallet.PostalCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"PostalCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"PostalCode\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ae860301658deb84b160d86b6978989", "score": "0.61456573", "text": "func (uc *UserCreate) check() error {\n\tif _, ok := uc.mutation.Created(); !ok {\n\t\treturn &ValidationError{Name: \"created\", err: errors.New(`ent: missing required field \"User.created\"`)}\n\t}\n\tif _, ok := uc.mutation.Updated(); !ok {\n\t\treturn &ValidationError{Name: \"updated\", err: errors.New(`ent: missing required field \"User.updated\"`)}\n\t}\n\tif _, ok := uc.mutation.NickName(); !ok {\n\t\treturn &ValidationError{Name: \"nick_name\", err: errors.New(`ent: missing required field \"User.nick_name\"`)}\n\t}\n\tif v, ok := uc.mutation.NickName(); ok {\n\t\tif err := user.NickNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"nick_name\", err: fmt.Errorf(`ent: validator failed for field \"User.nick_name\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := uc.mutation.Sex(); !ok {\n\t\treturn &ValidationError{Name: \"sex\", err: errors.New(`ent: missing required field \"User.sex\"`)}\n\t}\n\tif v, ok := uc.mutation.Phone(); ok {\n\t\tif err := user.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone\", err: fmt.Errorf(`ent: validator failed for field \"User.phone\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := uc.mutation.Email(); ok {\n\t\tif err := user.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(`ent: validator failed for field \"User.email\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "186e2733af68da41cc081097ef35926e", "score": "0.6143533", "text": "func (uguo *UsersGroupUpdateOne) check() error {\n\tif v, ok := uguo.mutation.Name(); ok {\n\t\tif err := usersgroup.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uguo.mutation.Status(); ok {\n\t\tif err := usersgroup.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9784b4b8f7c98e327c1af6ffb63ee164", "score": "0.61358523", "text": "func (vcc *VehicleClassCreate) check() error {\n\tif _, ok := vcc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(`ent: missing required field \"created_at\"`)}\n\t}\n\tif _, ok := vcc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(`ent: missing required field \"updated_at\"`)}\n\t}\n\tif _, ok := vcc.mutation.Short(); !ok {\n\t\treturn &ValidationError{Name: \"short\", err: errors.New(`ent: missing required field \"short\"`)}\n\t}\n\tif v, ok := vcc.mutation.Short(); ok {\n\t\tif err := vehicleclass.ShortValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"short\", err: fmt.Errorf(`ent: validator failed for field \"short\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := vcc.mutation.Title(); !ok {\n\t\treturn &ValidationError{Name: \"title\", err: errors.New(`ent: missing required field \"title\"`)}\n\t}\n\tif v, ok := vcc.mutation.Title(); ok {\n\t\tif err := vehicleclass.TitleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"title\", err: fmt.Errorf(`ent: validator failed for field \"title\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := vcc.mutation.Description(); ok {\n\t\tif err := vehicleclass.DescriptionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"description\", err: fmt.Errorf(`ent: validator failed for field \"description\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "222986cfe4216c6adb599e9156ad1a21", "score": "0.61240935", "text": "func (vu *VehicleUpdate) check() error {\n\tif v, ok := vu.mutation.Hours(); ok {\n\t\tif err := vehicle.HoursValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"hours\", err: fmt.Errorf(\"ent: validator failed for field \\\"hours\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := vu.mutation.Year(); ok {\n\t\tif err := vehicle.YearValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"year\", err: fmt.Errorf(\"ent: validator failed for field \\\"year\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := vu.mutation.Power(); ok {\n\t\tif err := vehicle.PowerValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"power\", err: fmt.Errorf(\"ent: validator failed for field \\\"power\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := vu.mutation.LocationID(); vu.mutation.LocationCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"location\\\"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1a1b781c1c49544d078e2700e522d1d5", "score": "0.61147255", "text": "func (bc *BankCreate) check() error {\n\tif _, ok := bc.mutation.BankCode(); !ok {\n\t\treturn &ValidationError{Name: \"bankCode\", err: errors.New(\"ent: missing required field \\\"bankCode\\\"\")}\n\t}\n\tif _, ok := bc.mutation.BankName(); !ok {\n\t\treturn &ValidationError{Name: \"bankName\", err: errors.New(\"ent: missing required field \\\"bankName\\\"\")}\n\t}\n\tif _, ok := bc.mutation.URL(); !ok {\n\t\treturn &ValidationError{Name: \"url\", err: errors.New(\"ent: missing required field \\\"url\\\"\")}\n\t}\n\tif _, ok := bc.mutation.Swift(); !ok {\n\t\treturn &ValidationError{Name: \"swift\", err: errors.New(\"ent: missing required field \\\"swift\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4026194c6e564497d2ec0c27f20e9fc", "score": "0.61073214", "text": "func (muo *MetricsUpdateOne) check() error {\n\tif v, ok := muo.mutation.Namespace(); ok {\n\t\tif err := metrics.NamespaceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"namespace\", err: fmt.Errorf(\"ent: validator failed for field \\\"namespace\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := muo.mutation.Workflow(); ok {\n\t\tif err := metrics.WorkflowValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"workflow\", err: fmt.Errorf(\"ent: validator failed for field \\\"workflow\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := muo.mutation.Instance(); ok {\n\t\tif err := metrics.InstanceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"instance\", err: fmt.Errorf(\"ent: validator failed for field \\\"instance\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := muo.mutation.State(); ok {\n\t\tif err := metrics.StateValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"state\", err: fmt.Errorf(\"ent: validator failed for field \\\"state\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := muo.mutation.WorkflowMs(); ok {\n\t\tif err := metrics.WorkflowMsValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"workflow_ms\", err: fmt.Errorf(\"ent: validator failed for field \\\"workflow_ms\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := muo.mutation.IsolateMs(); ok {\n\t\tif err := metrics.IsolateMsValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"isolate_ms\", err: fmt.Errorf(\"ent: validator failed for field \\\"isolate_ms\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := muo.mutation.Next(); ok {\n\t\tif err := metrics.NextValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"next\", err: fmt.Errorf(\"ent: validator failed for field \\\"next\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2198919160cc219954e8b6d02d366c23", "score": "0.61037946", "text": "func (cu *ConnectorUpdate) check() error {\n\tif v, ok := cu.mutation.GetType(); ok {\n\t\tif err := connector.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(`db: validator failed for field \"Connector.type\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := cu.mutation.Name(); ok {\n\t\tif err := connector.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`db: validator failed for field \"Connector.name\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "14780b8e54b029345699428ab07cf358", "score": "0.6095553", "text": "func (ftuo *FieldTypeUpdateOne) check() error {\n\tif v, ok := ftuo.mutation.ValidateOptionalInt32(); ok {\n\t\tif err := fieldtype.ValidateOptionalInt32Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"validate_optional_int32\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.validate_optional_int32\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftuo.mutation.State(); ok {\n\t\tif err := fieldtype.StateValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"state\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.state\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftuo.mutation.MAC(); ok {\n\t\tif err := fieldtype.MACValidator(v.String()); err != nil {\n\t\t\treturn &ValidationError{Name: \"mac\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.mac\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftuo.mutation.Ndir(); ok {\n\t\tif err := fieldtype.NdirValidator(string(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"ndir\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.ndir\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftuo.mutation.Link(); ok {\n\t\tif err := fieldtype.LinkValidator(v.String()); err != nil {\n\t\t\treturn &ValidationError{Name: \"link\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.link\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftuo.mutation.RawData(); ok {\n\t\tif err := fieldtype.RawDataValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"raw_data\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.raw_data\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftuo.mutation.IP(); ok {\n\t\tif err := fieldtype.IPValidator([]byte(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"ip\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.ip\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftuo.mutation.Role(); ok {\n\t\tif err := fieldtype.RoleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"role\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.role\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftuo.mutation.Priority(); ok {\n\t\tif err := fieldtype.PriorityValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"priority\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.priority\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2f1bab6ecb35f43d2a8f4bcc050b1a8a", "score": "0.609401", "text": "func (ouo *OperationUpdateOne) check() error {\n\tif v, ok := ouo.mutation.GetType(); ok {\n\t\tif err := operation.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ouo.mutation.Status(); ok {\n\t\tif err := operation.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a14f835f797d9a32c3e4df12d8b60f1e", "score": "0.6093068", "text": "func (dduo *DatabaseDetectorUpdateOne) check() error {\n\tif v, ok := dduo.mutation.Status(); ok {\n\t\tif err := databasedetector.StatusValidator(int8(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"DatabaseDetector.status\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := dduo.mutation.Name(); ok {\n\t\tif err := databasedetector.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`ent: validator failed for field \"DatabaseDetector.name\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := dduo.mutation.Timeout(); ok {\n\t\tif err := databasedetector.TimeoutValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"timeout\", err: fmt.Errorf(`ent: validator failed for field \"DatabaseDetector.timeout\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9ef625d72e4d174bc30bcab788279b79", "score": "0.6091825", "text": "func (rc *RunCreate) check() error {\n\tif _, ok := rc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(\"ent: missing required field \\\"created_at\\\"\")}\n\t}\n\tif _, ok := rc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(\"ent: missing required field \\\"updated_at\\\"\")}\n\t}\n\tif _, ok := rc.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(\"ent: missing required field \\\"status\\\"\")}\n\t}\n\tif v, ok := rc.mutation.Status(); ok {\n\t\tif err := run.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := rc.mutation.Name(); !ok {\n\t\treturn &ValidationError{Name: \"name\", err: errors.New(\"ent: missing required field \\\"name\\\"\")}\n\t}\n\tif v, ok := rc.mutation.ID(); ok {\n\t\tif err := run.IDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"id\", err: fmt.Errorf(\"ent: validator failed for field \\\"id\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := rc.mutation.TemplateID(); !ok {\n\t\treturn &ValidationError{Name: \"template\", err: errors.New(\"ent: missing required edge \\\"template\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3a6cb045698ca6182bda705185d5f52", "score": "0.60842955", "text": "func (usc *UserSettingsCreate) check() error {\n\tif _, ok := usc.mutation.CreateTime(); !ok {\n\t\treturn &ValidationError{Name: \"create_time\", err: errors.New(\"ent: missing required field \\\"create_time\\\"\")}\n\t}\n\tif _, ok := usc.mutation.UpdateTime(); !ok {\n\t\treturn &ValidationError{Name: \"update_time\", err: errors.New(\"ent: missing required field \\\"update_time\\\"\")}\n\t}\n\tif _, ok := usc.mutation.NewCardsPerDay(); !ok {\n\t\treturn &ValidationError{Name: \"newCardsPerDay\", err: errors.New(\"ent: missing required field \\\"newCardsPerDay\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "382fb583256671006ba8de66fdc47e44", "score": "0.6082484", "text": "func (cu *CompanyUpdate) check() error {\n\tif v, ok := cu.mutation.Name(); ok {\n\t\tif err := company.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cu.mutation.Location(); ok {\n\t\tif err := company.LocationValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"location\", err: fmt.Errorf(\"ent: validator failed for field \\\"location\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cu.mutation.PostalCode(); ok {\n\t\tif err := company.PostalCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"postal_code\", err: fmt.Errorf(\"ent: validator failed for field \\\"postal_code\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cu.mutation.PhoneNumber(); ok {\n\t\tif err := company.PhoneNumberValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone_number\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone_number\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cu.mutation.CompanyID(); ok {\n\t\tif err := company.CompanyIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"company_id\", err: fmt.Errorf(\"ent: validator failed for field \\\"company_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cu.mutation.Introduction(); ok {\n\t\tif err := company.IntroductionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"introduction\", err: fmt.Errorf(\"ent: validator failed for field \\\"introduction\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "413e2c53a10c1e6561182f6896e33439", "score": "0.6078144", "text": "func (tuo *TankUpdateOne) check() error {\n\tif v, ok := tuo.mutation.Name(); ok {\n\t\tif err := tank.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tuo.mutation.TankClass(); ok {\n\t\tif err := tank.TankClassValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"tankClass\", err: fmt.Errorf(\"ent: validator failed for field \\\"tankClass\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tuo.mutation.Country(); ok {\n\t\tif err := tank.CountryValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"country\", err: fmt.Errorf(\"ent: validator failed for field \\\"country\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2110e856848d0f7d12d7ebb637d0108e", "score": "0.6074681", "text": "func (cc *CustomerCreate) check() error {\n\tif _, ok := cc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(\"ent: missing required field \\\"created_at\\\"\")}\n\t}\n\tif _, ok := cc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(\"ent: missing required field \\\"updated_at\\\"\")}\n\t}\n\tif _, ok := cc.mutation.Address(); !ok {\n\t\treturn &ValidationError{Name: \"address\", err: errors.New(\"ent: missing required field \\\"address\\\"\")}\n\t}\n\tif v, ok := cc.mutation.Address(); ok {\n\t\tif err := customer.AddressValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"address\", err: fmt.Errorf(\"ent: validator failed for field \\\"address\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := cc.mutation.Phone(); !ok {\n\t\treturn &ValidationError{Name: \"phone\", err: errors.New(\"ent: missing required field \\\"phone\\\"\")}\n\t}\n\tif v, ok := cc.mutation.Phone(); ok {\n\t\tif err := customer.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := cc.mutation.UserID(); !ok {\n\t\treturn &ValidationError{Name: \"user\", err: errors.New(\"ent: missing required edge \\\"user\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f60e9d4ee4fd86181fb41a2e6b92f37b", "score": "0.60725904", "text": "func (djuo *DetectionJobUpdateOne) check() error {\n\tif v, ok := djuo.mutation.Method(); ok {\n\t\tif err := detectionjob.MethodValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"method\", err: fmt.Errorf(\"ent: validator failed for field \\\"method\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := djuo.mutation.SiteID(); ok {\n\t\tif err := detectionjob.SiteIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"site_id\", err: fmt.Errorf(\"ent: validator failed for field \\\"site_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := djuo.mutation.Metric(); ok {\n\t\tif err := detectionjob.MetricValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"metric\", err: fmt.Errorf(\"ent: validator failed for field \\\"metric\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := djuo.mutation.Attribute(); ok {\n\t\tif err := detectionjob.AttributeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"attribute\", err: fmt.Errorf(\"ent: validator failed for field \\\"attribute\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := djuo.mutation.TimeAgo(); ok {\n\t\tif err := detectionjob.TimeAgoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"time_ago\", err: fmt.Errorf(\"ent: validator failed for field \\\"time_ago\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := djuo.mutation.TimeStep(); ok {\n\t\tif err := detectionjob.TimeStepValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"time_step\", err: fmt.Errorf(\"ent: validator failed for field \\\"time_step\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2bfa0e0a02339ba714a301175a0a7fb4", "score": "0.60723937", "text": "func (ac *AgentCreate) check() error {\n\tif _, ok := ac.mutation.UUID(); !ok {\n\t\treturn &ValidationError{Name: \"uuid\", err: errors.New(\"ent: missing required field \\\"uuid\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Hostname(); !ok {\n\t\treturn &ValidationError{Name: \"hostname\", err: errors.New(\"ent: missing required field \\\"hostname\\\"\")}\n\t}\n\tif _, ok := ac.mutation.IP(); !ok {\n\t\treturn &ValidationError{Name: \"ip\", err: errors.New(\"ent: missing required field \\\"ip\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Port(); !ok {\n\t\treturn &ValidationError{Name: \"port\", err: errors.New(\"ent: missing required field \\\"port\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Pid(); !ok {\n\t\treturn &ValidationError{Name: \"pid\", err: errors.New(\"ent: missing required field \\\"pid\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ae2b6d80681e1db38cfbc78d9693b84", "score": "0.60673094", "text": "func (rsc *RequestStatusCreate) check() error {\n\tif _, ok := rsc.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(`ent: missing required field \"RequestStatus.status\"`)}\n\t}\n\tif v, ok := rsc.mutation.Status(); ok {\n\t\tif err := requeststatus.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"RequestStatus.status\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := rsc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(`ent: missing required field \"RequestStatus.created_at\"`)}\n\t}\n\tif _, ok := rsc.mutation.RequestID(); !ok {\n\t\treturn &ValidationError{Name: \"request\", err: errors.New(`ent: missing required edge \"RequestStatus.request\"`)}\n\t}\n\tif _, ok := rsc.mutation.UserID(); !ok {\n\t\treturn &ValidationError{Name: \"user\", err: errors.New(`ent: missing required edge \"RequestStatus.user\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cb50a612be091c5af0647d36a54c1331", "score": "0.60667473", "text": "func (uuo *UserUpdateOne) check() error {\n\tif v, ok := uuo.mutation.Name(); ok {\n\t\tif err := user.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Username(); ok {\n\t\tif err := user.UsernameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"username\", err: fmt.Errorf(\"ent: validator failed for field \\\"username\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Password(); ok {\n\t\tif err := user.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"ent: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Bio(); ok {\n\t\tif err := user.BioValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"bio\", err: fmt.Errorf(\"ent: validator failed for field \\\"bio\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Gender(); ok {\n\t\tif err := user.GenderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"gender\", err: fmt.Errorf(\"ent: validator failed for field \\\"gender\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Role(); ok {\n\t\tif err := user.RoleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"role\", err: fmt.Errorf(\"ent: validator failed for field \\\"role\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7f06a19d4bbdcaf03740f1ead4123b66", "score": "0.6055084", "text": "func (vu *VeterinarianUpdate) check() error {\n\tif v, ok := vu.mutation.Phone(); ok {\n\t\tif err := veterinarian.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := vu.mutation.UserID(); vu.mutation.UserCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"user\\\"\")\n\t}\n\tif _, ok := vu.mutation.ClinicID(); vu.mutation.ClinicCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"clinic\\\"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fab19cfca255d8e65913363a04ce0235", "score": "0.6046256", "text": "func (mpu *MedicalProcedureUpdate) check() error {\n\tif v, ok := mpu.mutation.ProcedureOrder(); ok {\n\t\tif err := medicalprocedure.ProcedureOrderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"procedureOrder\", err: fmt.Errorf(\"ent: validator failed for field \\\"procedureOrder\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mpu.mutation.ProcedureRoom(); ok {\n\t\tif err := medicalprocedure.ProcedureRoomValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"procedureRoom\", err: fmt.Errorf(\"ent: validator failed for field \\\"procedureRoom\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mpu.mutation.ProcedureDescripe(); ok {\n\t\tif err := medicalprocedure.ProcedureDescripeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"procedureDescripe\", err: fmt.Errorf(\"ent: validator failed for field \\\"procedureDescripe\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6dc7147dbbf21954edea86225104454c", "score": "0.6044589", "text": "func (tu *TankUpdate) check() error {\n\tif v, ok := tu.mutation.Name(); ok {\n\t\tif err := tank.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tu.mutation.TankClass(); ok {\n\t\tif err := tank.TankClassValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"tankClass\", err: fmt.Errorf(\"ent: validator failed for field \\\"tankClass\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tu.mutation.Country(); ok {\n\t\tif err := tank.CountryValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"country\", err: fmt.Errorf(\"ent: validator failed for field \\\"country\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9ea28e7216c756fc65bce4cce10a7d0", "score": "0.6036148", "text": "func Check() {\n\tmg.Deps(CheckGoImports, CheckGoLint, CheckGoVet, CheckCopyright)\n}", "title": "" }, { "docid": "8714b6142bf9609f4021ba3bb50186da", "score": "0.60355514", "text": "func (pc *PatientCreate) check() error {\n\tif _, ok := pc.mutation.PersonalID(); !ok {\n\t\treturn &ValidationError{Name: \"personalID\", err: errors.New(\"ent: missing required field \\\"personalID\\\"\")}\n\t}\n\tif v, ok := pc.mutation.PersonalID(); ok {\n\t\tif err := patient.PersonalIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"personalID\", err: fmt.Errorf(\"ent: validator failed for field \\\"personalID\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := pc.mutation.HospitalNumber(); !ok {\n\t\treturn &ValidationError{Name: \"hospitalNumber\", err: errors.New(\"ent: missing required field \\\"hospitalNumber\\\"\")}\n\t}\n\tif v, ok := pc.mutation.HospitalNumber(); ok {\n\t\tif err := patient.HospitalNumberValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"hospitalNumber\", err: fmt.Errorf(\"ent: validator failed for field \\\"hospitalNumber\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := pc.mutation.PatientName(); !ok {\n\t\treturn &ValidationError{Name: \"patientName\", err: errors.New(\"ent: missing required field \\\"patientName\\\"\")}\n\t}\n\tif v, ok := pc.mutation.PatientName(); ok {\n\t\tif err := patient.PatientNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"patientName\", err: fmt.Errorf(\"ent: validator failed for field \\\"patientName\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := pc.mutation.DrugAllergy(); !ok {\n\t\treturn &ValidationError{Name: \"drugAllergy\", err: errors.New(\"ent: missing required field \\\"drugAllergy\\\"\")}\n\t}\n\tif v, ok := pc.mutation.DrugAllergy(); ok {\n\t\tif err := patient.DrugAllergyValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"drugAllergy\", err: fmt.Errorf(\"ent: validator failed for field \\\"drugAllergy\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := pc.mutation.MobileNumber(); !ok {\n\t\treturn &ValidationError{Name: \"mobileNumber\", err: errors.New(\"ent: missing required field \\\"mobileNumber\\\"\")}\n\t}\n\tif v, ok := pc.mutation.MobileNumber(); ok {\n\t\tif err := patient.MobileNumberValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"mobileNumber\", err: fmt.Errorf(\"ent: validator failed for field \\\"mobileNumber\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := pc.mutation.Added(); !ok {\n\t\treturn &ValidationError{Name: \"added\", err: errors.New(\"ent: missing required field \\\"added\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "16b52f866e84103a326b025df09105aa", "score": "0.60346377", "text": "func (ou *OperationUpdate) check() error {\n\tif v, ok := ou.mutation.GetType(); ok {\n\t\tif err := operation.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ou.mutation.Status(); ok {\n\t\tif err := operation.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d644611295caf0223dc8b1ce7167ba0a", "score": "0.6033926", "text": "func (mu *MetricsUpdate) check() error {\n\tif v, ok := mu.mutation.Namespace(); ok {\n\t\tif err := metrics.NamespaceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"namespace\", err: fmt.Errorf(\"ent: validator failed for field \\\"namespace\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mu.mutation.Workflow(); ok {\n\t\tif err := metrics.WorkflowValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"workflow\", err: fmt.Errorf(\"ent: validator failed for field \\\"workflow\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mu.mutation.Instance(); ok {\n\t\tif err := metrics.InstanceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"instance\", err: fmt.Errorf(\"ent: validator failed for field \\\"instance\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mu.mutation.State(); ok {\n\t\tif err := metrics.StateValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"state\", err: fmt.Errorf(\"ent: validator failed for field \\\"state\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mu.mutation.WorkflowMs(); ok {\n\t\tif err := metrics.WorkflowMsValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"workflow_ms\", err: fmt.Errorf(\"ent: validator failed for field \\\"workflow_ms\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mu.mutation.IsolateMs(); ok {\n\t\tif err := metrics.IsolateMsValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"isolate_ms\", err: fmt.Errorf(\"ent: validator failed for field \\\"isolate_ms\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mu.mutation.Next(); ok {\n\t\tif err := metrics.NextValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"next\", err: fmt.Errorf(\"ent: validator failed for field \\\"next\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e33eec3a7309fce3003abe1f7cf8b9d4", "score": "0.60322404", "text": "func (gcc *GoodsClassifyCreate) check() error {\n\tif _, ok := gcc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(\"ent: missing required field \\\"created_at\\\"\")}\n\t}\n\tif _, ok := gcc.mutation.Level(); !ok {\n\t\treturn &ValidationError{Name: \"level\", err: errors.New(\"ent: missing required field \\\"level\\\"\")}\n\t}\n\tif v, ok := gcc.mutation.Sort(); ok {\n\t\tif err := goodsclassify.SortValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"sort\", err: fmt.Errorf(\"ent: validator failed for field \\\"sort\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b14d508a7ee8ba3dcb05c6ee6640205e", "score": "0.6026875", "text": "func (status *Status) check() (string, error) {\n\tstatus.Version = newVersionStatus(status.cli)\n\tstatus.System = newSystemStatus()\n\tstatus.Configuration = newConfigurationStatus(status)\n\tstatus.APIReachability = newAPIReachabilityStatus(status.cfg)\n\n\treturn status.compile()\n}", "title": "" }, { "docid": "09f0e5ad76ff0257fc8d17e49a6590fa", "score": "0.6021171", "text": "func (smc *StockManagerCreate) check() error {\n\tif _, ok := smc.mutation.Activite(); !ok {\n\t\treturn &ValidationError{Name: \"Activite\", err: errors.New(\"ent: missing required field \\\"Activite\\\"\")}\n\t}\n\tif _, ok := smc.mutation.SemaineA(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineA\", err: errors.New(\"ent: missing required field \\\"SemaineA\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineA(); ok {\n\t\tif err := stockmanager.SemaineAValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineA\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineA\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineB(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineB\", err: errors.New(\"ent: missing required field \\\"SemaineB\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineB(); ok {\n\t\tif err := stockmanager.SemaineBValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineB\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineB\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineC(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineC\", err: errors.New(\"ent: missing required field \\\"SemaineC\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineC(); ok {\n\t\tif err := stockmanager.SemaineCValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineC\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineC\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineD(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineD\", err: errors.New(\"ent: missing required field \\\"SemaineD\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineD(); ok {\n\t\tif err := stockmanager.SemaineDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineD\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineD\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineE(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineE\", err: errors.New(\"ent: missing required field \\\"SemaineE\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineE(); ok {\n\t\tif err := stockmanager.SemaineEValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineE\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineE\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineF(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineF\", err: errors.New(\"ent: missing required field \\\"SemaineF\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineF(); ok {\n\t\tif err := stockmanager.SemaineFValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineF\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineF\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineG(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineG\", err: errors.New(\"ent: missing required field \\\"SemaineG\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineG(); ok {\n\t\tif err := stockmanager.SemaineGValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineG\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineG\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineH(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineH\", err: errors.New(\"ent: missing required field \\\"SemaineH\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineH(); ok {\n\t\tif err := stockmanager.SemaineHValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineH\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineH\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := smc.mutation.ID(); ok {\n\t\tif err := stockmanager.IDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"id\", err: fmt.Errorf(\"ent: validator failed for field \\\"id\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59028a2a53bf1edd36ca930b331d0d77", "score": "0.6019738", "text": "func (u *user) check(ca checkArg) {\n\tvar err error\n\n\tdefer func() {\n\t\tu.ca.log.Debug(\"Check %s, err: %v\", ca, err)\n\t\tca.retCh <- err\n\t}()\n\n\tif err = u.repopulate(); err != nil {\n\t\treturn\n\t}\n\n\tu.lock.RLock()\n\tdefer u.lock.RUnlock()\n\n\terr = u.checkAfterPopulatedRLocked(ca)\n}", "title": "" }, { "docid": "f34ddb4c5dcab1c3365dba856079ee00", "score": "0.60120845", "text": "func (ru *RouteUpdate) check() error {\n\tif v, ok := ru.mutation.Tenant(); ok {\n\t\tif err := route.TenantValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"tenant\", err: fmt.Errorf(\"ent: validator failed for field \\\"tenant\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ru.mutation.Name(); ok {\n\t\tif err := route.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ru.mutation.URI(); ok {\n\t\tif err := route.URIValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"uri\", err: fmt.Errorf(\"ent: validator failed for field \\\"uri\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ru.mutation.Method(); ok {\n\t\tif err := route.MethodValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"method\", err: fmt.Errorf(\"ent: validator failed for field \\\"method\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6433d2da8c2634eff1dfb8389cfbf713", "score": "0.6007227", "text": "func (dju *DetectionJobUpdate) check() error {\n\tif v, ok := dju.mutation.Method(); ok {\n\t\tif err := detectionjob.MethodValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"method\", err: fmt.Errorf(\"ent: validator failed for field \\\"method\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := dju.mutation.SiteID(); ok {\n\t\tif err := detectionjob.SiteIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"site_id\", err: fmt.Errorf(\"ent: validator failed for field \\\"site_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := dju.mutation.Metric(); ok {\n\t\tif err := detectionjob.MetricValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"metric\", err: fmt.Errorf(\"ent: validator failed for field \\\"metric\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := dju.mutation.Attribute(); ok {\n\t\tif err := detectionjob.AttributeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"attribute\", err: fmt.Errorf(\"ent: validator failed for field \\\"attribute\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := dju.mutation.TimeAgo(); ok {\n\t\tif err := detectionjob.TimeAgoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"time_ago\", err: fmt.Errorf(\"ent: validator failed for field \\\"time_ago\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := dju.mutation.TimeStep(); ok {\n\t\tif err := detectionjob.TimeStepValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"time_step\", err: fmt.Errorf(\"ent: validator failed for field \\\"time_step\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9dcde44108b14285fc2eaeefbfe79bdb", "score": "0.60065496", "text": "func (vuo *VeterinarianUpdateOne) check() error {\n\tif v, ok := vuo.mutation.Phone(); ok {\n\t\tif err := veterinarian.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := vuo.mutation.UserID(); vuo.mutation.UserCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"user\\\"\")\n\t}\n\tif _, ok := vuo.mutation.ClinicID(); vuo.mutation.ClinicCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"clinic\\\"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c205b5d636f9c84383f878b1de8aa66", "score": "0.6003657", "text": "func (puo *PetUpdateOne) check() error {\n\tif v, ok := puo.mutation.Height(); ok {\n\t\tif err := pet.HeightValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"height\", err: fmt.Errorf(\"ent: validator failed for field \\\"height\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := puo.mutation.Weight(); ok {\n\t\tif err := pet.WeightValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"weight\", err: fmt.Errorf(\"ent: validator failed for field \\\"weight\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := puo.mutation.Sex(); ok {\n\t\tif err := pet.SexValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"sex\", err: fmt.Errorf(\"ent: validator failed for field \\\"sex\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := puo.mutation.BadgeID(); puo.mutation.BadgeCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"badge\\\"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cc0d6b3ae4c99534a434dcb8b6c1de01", "score": "0.6001012", "text": "func (ugc *UserGroupCreate) check() error {\n\tif _, ok := ugc.mutation.JoinedAt(); !ok {\n\t\treturn &ValidationError{Name: \"joined_at\", err: errors.New(`ent: missing required field \"UserGroup.joined_at\"`)}\n\t}\n\tif _, ok := ugc.mutation.UserID(); !ok {\n\t\treturn &ValidationError{Name: \"user_id\", err: errors.New(`ent: missing required field \"UserGroup.user_id\"`)}\n\t}\n\tif _, ok := ugc.mutation.GroupID(); !ok {\n\t\treturn &ValidationError{Name: \"group_id\", err: errors.New(`ent: missing required field \"UserGroup.group_id\"`)}\n\t}\n\tif _, ok := ugc.mutation.UserID(); !ok {\n\t\treturn &ValidationError{Name: \"user\", err: errors.New(`ent: missing required edge \"UserGroup.user\"`)}\n\t}\n\tif _, ok := ugc.mutation.GroupID(); !ok {\n\t\treturn &ValidationError{Name: \"group\", err: errors.New(`ent: missing required edge \"UserGroup.group\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cdf975b831e4c8fa849a7eb2d23b417f", "score": "0.60008425", "text": "func (uu *UserUpdate) check() error {\n\tif v, ok := uu.mutation.Name(); ok {\n\t\tif err := user.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Username(); ok {\n\t\tif err := user.UsernameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"username\", err: fmt.Errorf(\"ent: validator failed for field \\\"username\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Password(); ok {\n\t\tif err := user.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"ent: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Bio(); ok {\n\t\tif err := user.BioValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"bio\", err: fmt.Errorf(\"ent: validator failed for field \\\"bio\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Gender(); ok {\n\t\tif err := user.GenderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"gender\", err: fmt.Errorf(\"ent: validator failed for field \\\"gender\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Role(); ok {\n\t\tif err := user.RoleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"role\", err: fmt.Errorf(\"ent: validator failed for field \\\"role\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cfd7c9ed5cbe4c93c9b6051401b70c19", "score": "0.59834296", "text": "func (sc *SensorCreate) check() error {\n\tif _, ok := sc.mutation.GetType(); !ok {\n\t\treturn &ValidationError{Name: \"type\", err: errors.New(`ent: missing required field \"type\"`)}\n\t}\n\tif v, ok := sc.mutation.GetType(); ok {\n\t\tif err := sensor.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(`ent: validator failed for field \"type\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := sc.mutation.Location(); !ok {\n\t\treturn &ValidationError{Name: \"location\", err: errors.New(`ent: missing required field \"location\"`)}\n\t}\n\tif v, ok := sc.mutation.Location(); ok {\n\t\tif err := sensor.LocationValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"location\", err: fmt.Errorf(`ent: validator failed for field \"location\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "68c4108deec4d04e53af4467fd2a128c", "score": "0.5977349", "text": "func (mpuo *MedicalProcedureUpdateOne) check() error {\n\tif v, ok := mpuo.mutation.ProcedureOrder(); ok {\n\t\tif err := medicalprocedure.ProcedureOrderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"procedureOrder\", err: fmt.Errorf(\"ent: validator failed for field \\\"procedureOrder\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mpuo.mutation.ProcedureRoom(); ok {\n\t\tif err := medicalprocedure.ProcedureRoomValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"procedureRoom\", err: fmt.Errorf(\"ent: validator failed for field \\\"procedureRoom\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mpuo.mutation.ProcedureDescripe(); ok {\n\t\tif err := medicalprocedure.ProcedureDescripeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"procedureDescripe\", err: fmt.Errorf(\"ent: validator failed for field \\\"procedureDescripe\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "44da8050d760a3cfdf50eb46ffef11f8", "score": "0.5977213", "text": "func (ruo *RouteUpdateOne) check() error {\n\tif v, ok := ruo.mutation.Tenant(); ok {\n\t\tif err := route.TenantValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"tenant\", err: fmt.Errorf(\"ent: validator failed for field \\\"tenant\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ruo.mutation.Name(); ok {\n\t\tif err := route.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ruo.mutation.URI(); ok {\n\t\tif err := route.URIValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"uri\", err: fmt.Errorf(\"ent: validator failed for field \\\"uri\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ruo.mutation.Method(); ok {\n\t\tif err := route.MethodValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"method\", err: fmt.Errorf(\"ent: validator failed for field \\\"method\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "57dbadada2c1dad05414d25b04b8c6b1", "score": "0.59744465", "text": "func (hdu *HTTPDetectorUpdate) check() error {\n\tif v, ok := hdu.mutation.Status(); ok {\n\t\tif err := httpdetector.StatusValidator(int8(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.status\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := hdu.mutation.Name(); ok {\n\t\tif err := httpdetector.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.name\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := hdu.mutation.Timeout(); ok {\n\t\tif err := httpdetector.TimeoutValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"timeout\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.timeout\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := hdu.mutation.URL(); ok {\n\t\tif err := httpdetector.URLValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"url\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.url\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d23ebc4b8d3fbea970f6db8f45c99e7f", "score": "0.59694374", "text": "func (cc *CardCreate) check() error {\n\tif _, ok := cc.mutation.GetType(); !ok {\n\t\treturn &ValidationError{Name: \"type\", err: errors.New(\"ent: missing required field \\\"type\\\"\")}\n\t}\n\tif v, ok := cc.mutation.GetType(); ok {\n\t\tif err := card.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := cc.mutation.Number(); !ok {\n\t\treturn &ValidationError{Name: \"number\", err: errors.New(\"ent: missing required field \\\"number\\\"\")}\n\t}\n\tif _, ok := cc.mutation.StartDate(); !ok {\n\t\treturn &ValidationError{Name: \"startDate\", err: errors.New(\"ent: missing required field \\\"startDate\\\"\")}\n\t}\n\tif _, ok := cc.mutation.ExpiryDate(); !ok {\n\t\treturn &ValidationError{Name: \"expiryDate\", err: errors.New(\"ent: missing required field \\\"expiryDate\\\"\")}\n\t}\n\tif _, ok := cc.mutation.HolderName(); !ok {\n\t\treturn &ValidationError{Name: \"holderName\", err: errors.New(\"ent: missing required field \\\"holderName\\\"\")}\n\t}\n\tif _, ok := cc.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(\"ent: missing required field \\\"status\\\"\")}\n\t}\n\tif v, ok := cc.mutation.Status(); ok {\n\t\tif err := card.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := cc.mutation.URL(); !ok {\n\t\treturn &ValidationError{Name: \"url\", err: errors.New(\"ent: missing required field \\\"url\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef68686fc47cc039877ddad79d9faca9", "score": "0.5961397", "text": "func (tuo *TransactionUpdateOne) check() error {\n\tif v, ok := tuo.mutation.Status(); ok {\n\t\tif err := transaction.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tuo.mutation.ExecutedCurrencyCode(); ok {\n\t\tif err := transaction.ExecutedCurrencyCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"executedCurrencyCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"executedCurrencyCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tuo.mutation.OriginatingCurrencyCode(); ok {\n\t\tif err := transaction.OriginatingCurrencyCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"originatingCurrencyCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"originatingCurrencyCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tuo.mutation.Direction(); ok {\n\t\tif err := transaction.DirectionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"direction\", err: fmt.Errorf(\"ent: validator failed for field \\\"direction\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0327d700b145d9074310b60323b0b2e5", "score": "0.5943172", "text": "func (suu *SysUserUpdate) check() error {\n\tif v, ok := suu.mutation.RealName(); ok {\n\t\tif err := sysuser.RealNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"real_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"real_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suu.mutation.FirstName(); ok {\n\t\tif err := sysuser.FirstNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"first_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"first_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suu.mutation.LastName(); ok {\n\t\tif err := sysuser.LastNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"last_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"last_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suu.mutation.Password(); ok {\n\t\tif err := sysuser.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Password\", err: fmt.Errorf(\"ent: validator failed for field \\\"Password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suu.mutation.Email(); ok {\n\t\tif err := sysuser.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Email\", err: fmt.Errorf(\"ent: validator failed for field \\\"Email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suu.mutation.Phone(); ok {\n\t\tif err := sysuser.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"Phone\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95c81e9ac94e78efb86059a8fc8167f5", "score": "0.5937973", "text": "func (wc *WorkspaceCreate) check() error {\n\tif _, ok := wc.mutation.Name(); !ok {\n\t\treturn &ValidationError{Name: \"name\", err: errors.New(\"models: missing required field \\\"name\\\"\")}\n\t}\n\tif v, ok := wc.mutation.Name(); ok {\n\t\tif err := workspace.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"models: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := wc.mutation.Plan(); !ok {\n\t\treturn &ValidationError{Name: \"plan\", err: errors.New(\"models: missing required field \\\"plan\\\"\")}\n\t}\n\tif v, ok := wc.mutation.Plan(); ok {\n\t\tif err := workspace.PlanValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"plan\", err: fmt.Errorf(\"models: validator failed for field \\\"plan\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := wc.mutation.Description(); ok {\n\t\tif err := workspace.DescriptionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"description\", err: fmt.Errorf(\"models: validator failed for field \\\"description\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := wc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(\"models: missing required field \\\"created_at\\\"\")}\n\t}\n\tif _, ok := wc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(\"models: missing required field \\\"updated_at\\\"\")}\n\t}\n\tif _, ok := wc.mutation.OwnerID(); !ok {\n\t\treturn &ValidationError{Name: \"owner\", err: errors.New(\"models: missing required edge \\\"owner\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "52cda27cb4dfb992121a4b36ae00e1f8", "score": "0.59356195", "text": "func (suuo *SysUserUpdateOne) check() error {\n\tif v, ok := suuo.mutation.RealName(); ok {\n\t\tif err := sysuser.RealNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"real_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"real_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suuo.mutation.FirstName(); ok {\n\t\tif err := sysuser.FirstNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"first_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"first_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suuo.mutation.LastName(); ok {\n\t\tif err := sysuser.LastNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"last_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"last_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suuo.mutation.Password(); ok {\n\t\tif err := sysuser.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Password\", err: fmt.Errorf(\"ent: validator failed for field \\\"Password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suuo.mutation.Email(); ok {\n\t\tif err := sysuser.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Email\", err: fmt.Errorf(\"ent: validator failed for field \\\"Email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suuo.mutation.Phone(); ok {\n\t\tif err := sysuser.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"Phone\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6a7a3530f694de111f08c2633c427b70", "score": "0.59225136", "text": "func (ac *AccountCreate) check() error {\n\tif _, ok := ac.mutation.GetType(); !ok {\n\t\treturn &ValidationError{Name: \"type\", err: errors.New(\"ent: missing required field \\\"type\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Number(); !ok {\n\t\treturn &ValidationError{Name: \"number\", err: errors.New(\"ent: missing required field \\\"number\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Name(); !ok {\n\t\treturn &ValidationError{Name: \"name\", err: errors.New(\"ent: missing required field \\\"name\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Title(); !ok {\n\t\treturn &ValidationError{Name: \"title\", err: errors.New(\"ent: missing required field \\\"title\\\"\")}\n\t}\n\tif _, ok := ac.mutation.DateCreated(); !ok {\n\t\treturn &ValidationError{Name: \"dateCreated\", err: errors.New(\"ent: missing required field \\\"dateCreated\\\"\")}\n\t}\n\tif _, ok := ac.mutation.DateOpened(); !ok {\n\t\treturn &ValidationError{Name: \"dateOpened\", err: errors.New(\"ent: missing required field \\\"dateOpened\\\"\")}\n\t}\n\tif _, ok := ac.mutation.DateLastUpdated(); !ok {\n\t\treturn &ValidationError{Name: \"dateLastUpdated\", err: errors.New(\"ent: missing required field \\\"dateLastUpdated\\\"\")}\n\t}\n\tif _, ok := ac.mutation.CurrencyCode(); !ok {\n\t\treturn &ValidationError{Name: \"currencyCode\", err: errors.New(\"ent: missing required field \\\"currencyCode\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(\"ent: missing required field \\\"status\\\"\")}\n\t}\n\tif v, ok := ac.mutation.Status(); ok {\n\t\tif err := account.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := ac.mutation.Source(); !ok {\n\t\treturn &ValidationError{Name: \"source\", err: errors.New(\"ent: missing required field \\\"source\\\"\")}\n\t}\n\tif _, ok := ac.mutation.InterestReporting(); !ok {\n\t\treturn &ValidationError{Name: \"interestReporting\", err: errors.New(\"ent: missing required field \\\"interestReporting\\\"\")}\n\t}\n\tif _, ok := ac.mutation.CurrentBalance(); !ok {\n\t\treturn &ValidationError{Name: \"currentBalance\", err: errors.New(\"ent: missing required field \\\"currentBalance\\\"\")}\n\t}\n\tif _, ok := ac.mutation.AvailableBalance(); !ok {\n\t\treturn &ValidationError{Name: \"availableBalance\", err: errors.New(\"ent: missing required field \\\"availableBalance\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4234c900fdd0aff346e31270fd292bfc", "score": "0.59150726", "text": "func (arc *APIResponseCreate) check() error {\n\tif _, ok := arc.mutation.Code(); !ok {\n\t\treturn &ValidationError{Name: \"code\", err: errors.New(\"ent: missing required field \\\"code\\\"\")}\n\t}\n\tif v, ok := arc.mutation.Code(); ok {\n\t\tif err := apiresponse.CodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"code\", err: fmt.Errorf(\"ent: validator failed for field \\\"code\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := arc.mutation.GetType(); !ok {\n\t\treturn &ValidationError{Name: \"type\", err: errors.New(\"ent: missing required field \\\"type\\\"\")}\n\t}\n\tif _, ok := arc.mutation.Message(); !ok {\n\t\treturn &ValidationError{Name: \"message\", err: errors.New(\"ent: missing required field \\\"message\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6df8b3c0294890f8b0a527c0e1f15f3e", "score": "0.5899255", "text": "func (ucc *UserCardCreate) check() error {\n\tif _, ok := ucc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(`ent: missing required field \"created_at\"`)}\n\t}\n\tif _, ok := ucc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(`ent: missing required field \"updated_at\"`)}\n\t}\n\tif _, ok := ucc.mutation.LimitDaily(); !ok {\n\t\treturn &ValidationError{Name: \"limit_daily\", err: errors.New(`ent: missing required field \"limit_daily\"`)}\n\t}\n\tif _, ok := ucc.mutation.LimitMonthly(); !ok {\n\t\treturn &ValidationError{Name: \"limit_monthly\", err: errors.New(`ent: missing required field \"limit_monthly\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d9ca0102fee50af7de871fad1606065d", "score": "0.58957773", "text": "func (pu *PetUpdate) check() error {\n\tif v, ok := pu.mutation.Height(); ok {\n\t\tif err := pet.HeightValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"height\", err: fmt.Errorf(\"ent: validator failed for field \\\"height\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := pu.mutation.Weight(); ok {\n\t\tif err := pet.WeightValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"weight\", err: fmt.Errorf(\"ent: validator failed for field \\\"weight\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := pu.mutation.Sex(); ok {\n\t\tif err := pet.SexValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"sex\", err: fmt.Errorf(\"ent: validator failed for field \\\"sex\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := pu.mutation.BadgeID(); pu.mutation.BadgeCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"badge\\\"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "924c0514c07cc6b91801f5a8161c6193", "score": "0.58936733", "text": "func (tu *TransactionUpdate) check() error {\n\tif v, ok := tu.mutation.Status(); ok {\n\t\tif err := transaction.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tu.mutation.ExecutedCurrencyCode(); ok {\n\t\tif err := transaction.ExecutedCurrencyCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"executedCurrencyCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"executedCurrencyCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tu.mutation.OriginatingCurrencyCode(); ok {\n\t\tif err := transaction.OriginatingCurrencyCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"originatingCurrencyCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"originatingCurrencyCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tu.mutation.Direction(); ok {\n\t\tif err := transaction.DirectionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"direction\", err: fmt.Errorf(\"ent: validator failed for field \\\"direction\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "16acea9e55b4e37da52de2ce6916bcb8", "score": "0.58879125", "text": "func (m *MainCfg) check() error {\n\tif len(m.AutoscalerFiles) == 0 {\n\t\treturn fmt.Errorf(\"Autoscaler files can't be empty\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4e8424217c4f2c1a021dbf9a97eeb073", "score": "0.5884609", "text": "func (uuo *UserUpdateOne) check() error {\n\tif v, ok := uuo.mutation.Username(); ok {\n\t\tif err := user.UsernameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"username\", err: fmt.Errorf(\"ent: validator failed for field \\\"username\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Password(); ok {\n\t\tif err := user.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"ent: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cac18a107cc69358cfc2d3b8babfceb1", "score": "0.58790475", "text": "func (uu *UserUpdate) check() error {\n\tif v, ok := uu.mutation.Username(); ok {\n\t\tif err := user.UsernameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"username\", err: fmt.Errorf(\"ent: validator failed for field \\\"username\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Password(); ok {\n\t\tif err := user.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"ent: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9a8ea7636f4a97fea849a7fd231c2eb", "score": "0.58718693", "text": "func (bmc *BookingMetadatumCreate) check() error {\n\tif _, ok := bmc.mutation.Key(); !ok {\n\t\treturn &ValidationError{Name: \"key\", err: errors.New(`ent: missing required field \"key\"`)}\n\t}\n\tif _, ok := bmc.mutation.Value(); !ok {\n\t\treturn &ValidationError{Name: \"value\", err: errors.New(`ent: missing required field \"value\"`)}\n\t}\n\tif _, ok := bmc.mutation.BookingId(); !ok {\n\t\treturn &ValidationError{Name: \"bookingId\", err: errors.New(`ent: missing required field \"bookingId\"`)}\n\t}\n\tif _, ok := bmc.mutation.BookingID(); !ok {\n\t\treturn &ValidationError{Name: \"booking\", err: errors.New(\"ent: missing required edge \\\"booking\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0b67a898785e966aef265c3e9f441c6c", "score": "0.58584183", "text": "func (cuuo *CompanyUserUpdateOne) check() error {\n\tif v, ok := cuuo.mutation.LastName(); ok {\n\t\tif err := companyuser.LastNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"last_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"last_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuuo.mutation.FirstName(); ok {\n\t\tif err := companyuser.FirstNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"first_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"first_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuuo.mutation.LastNameFurigana(); ok {\n\t\tif err := companyuser.LastNameFuriganaValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"last_name_furigana\", err: fmt.Errorf(\"ent: validator failed for field \\\"last_name_furigana\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuuo.mutation.FirstNameFurigana(); ok {\n\t\tif err := companyuser.FirstNameFuriganaValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"first_name_furigana\", err: fmt.Errorf(\"ent: validator failed for field \\\"first_name_furigana\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuuo.mutation.ProfileName(); ok {\n\t\tif err := companyuser.ProfileNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"profile_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"profile_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuuo.mutation.IconURL(); ok {\n\t\tif err := companyuser.IconURLValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"icon_url\", err: fmt.Errorf(\"ent: validator failed for field \\\"icon_url\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuuo.mutation.Gender(); ok {\n\t\tif err := companyuser.GenderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"gender\", err: fmt.Errorf(\"ent: validator failed for field \\\"gender\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1427b6e5c0e6f0bdadbc6a64910b5467", "score": "0.5852337", "text": "func (sec *StudyEligibilityCreate) check() error {\n\tif _, ok := sec.mutation.EligibilityCriteria(); !ok {\n\t\treturn &ValidationError{Name: \"EligibilityCriteria\", err: errors.New(`models: missing required field \"StudyEligibility.EligibilityCriteria\"`)}\n\t}\n\tif _, ok := sec.mutation.HealthyVolunteers(); !ok {\n\t\treturn &ValidationError{Name: \"HealthyVolunteers\", err: errors.New(`models: missing required field \"StudyEligibility.HealthyVolunteers\"`)}\n\t}\n\tif _, ok := sec.mutation.Gender(); !ok {\n\t\treturn &ValidationError{Name: \"Gender\", err: errors.New(`models: missing required field \"StudyEligibility.Gender\"`)}\n\t}\n\tif _, ok := sec.mutation.MinimumAge(); !ok {\n\t\treturn &ValidationError{Name: \"MinimumAge\", err: errors.New(`models: missing required field \"StudyEligibility.MinimumAge\"`)}\n\t}\n\tif _, ok := sec.mutation.MaximumAge(); !ok {\n\t\treturn &ValidationError{Name: \"MaximumAge\", err: errors.New(`models: missing required field \"StudyEligibility.MaximumAge\"`)}\n\t}\n\tif _, ok := sec.mutation.StdAgeList(); !ok {\n\t\treturn &ValidationError{Name: \"StdAgeList\", err: errors.New(`models: missing required field \"StudyEligibility.StdAgeList\"`)}\n\t}\n\tif _, ok := sec.mutation.Ethnicity(); !ok {\n\t\treturn &ValidationError{Name: \"Ethnicity\", err: errors.New(`models: missing required field \"StudyEligibility.Ethnicity\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "80b1c4e0991fbbae6ace56b96eb183bc", "score": "0.5851615", "text": "func (rc *RestaurantCreate) check() error {\n\tif _, ok := rc.mutation.Name(); !ok {\n\t\treturn &ValidationError{Name: \"name\", err: errors.New(\"ent: missing required field \\\"name\\\"\")}\n\t}\n\tif v, ok := rc.mutation.Name(); ok {\n\t\tif err := restaurant.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "34a548465e15ee912a541180a5be6092", "score": "0.5850838", "text": "func (rc *ReportwallettbCreate) check() error {\n\tif _, ok := rc.mutation.Walletid(); !ok {\n\t\treturn &ValidationError{Name: \"walletid\", err: errors.New(\"ent: missing required field \\\"walletid\\\"\")}\n\t}\n\tif v, ok := rc.mutation.Walletid(); ok {\n\t\tif err := reportwallettb.WalletidValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"walletid\", err: fmt.Errorf(\"ent: validator failed for field \\\"walletid\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.WalletTypeName(); ok {\n\t\tif err := reportwallettb.WalletTypeNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"WalletTypeName\", err: fmt.Errorf(\"ent: validator failed for field \\\"WalletTypeName\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.WalletPhoneno(); ok {\n\t\tif err := reportwallettb.WalletPhonenoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"WalletPhoneno\", err: fmt.Errorf(\"ent: validator failed for field \\\"WalletPhoneno\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.WalletName(); ok {\n\t\tif err := reportwallettb.WalletNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"WalletName\", err: fmt.Errorf(\"ent: validator failed for field \\\"WalletName\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.CitizenId(); ok {\n\t\tif err := reportwallettb.CitizenIdValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"CitizenId\", err: fmt.Errorf(\"ent: validator failed for field \\\"CitizenId\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.Status(); ok {\n\t\tif err := reportwallettb.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Status\", err: fmt.Errorf(\"ent: validator failed for field \\\"Status\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.UserAgent(); ok {\n\t\tif err := reportwallettb.UserAgentValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"UserAgent\", err: fmt.Errorf(\"ent: validator failed for field \\\"UserAgent\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.ATMCard(); ok {\n\t\tif err := reportwallettb.ATMCardValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ATMCard\", err: fmt.Errorf(\"ent: validator failed for field \\\"ATMCard\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.AccountNo(); ok {\n\t\tif err := reportwallettb.AccountNoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"AccountNo\", err: fmt.Errorf(\"ent: validator failed for field \\\"AccountNo\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.Province(); ok {\n\t\tif err := reportwallettb.ProvinceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Province\", err: fmt.Errorf(\"ent: validator failed for field \\\"Province\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.PostalCode(); ok {\n\t\tif err := reportwallettb.PostalCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"PostalCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"PostalCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.IsKYC(); ok {\n\t\tif err := reportwallettb.IsKYCValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"isKYC\", err: fmt.Errorf(\"ent: validator failed for field \\\"isKYC\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "db95d39bdefc8f28e2e16127eda70541", "score": "0.5847702", "text": "func (ac *AlertCreate) check() error {\n\tif _, ok := ac.mutation.Scenario(); !ok {\n\t\treturn &ValidationError{Name: \"scenario\", err: errors.New(`ent: missing required field \"Alert.scenario\"`)}\n\t}\n\tif _, ok := ac.mutation.Simulated(); !ok {\n\t\treturn &ValidationError{Name: \"simulated\", err: errors.New(`ent: missing required field \"Alert.simulated\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b2518bc3f0989288a73b8cc0bc341374", "score": "0.5847472", "text": "func (mc *MetadataCreate) check() error {\n\tif _, ok := mc.mutation.Age(); !ok {\n\t\treturn &ValidationError{Name: \"age\", err: errors.New(`ent: missing required field \"Metadata.age\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8654cc96b0f43f70e07d08ef7da9cfec", "score": "0.5844917", "text": "func (nc *NodeCreate) check() error {\n\tif _, ok := nc.mutation.Tenant(); !ok {\n\t\treturn &ValidationError{Name: \"tenant\", err: errors.New(\"ent: missing required field \\\"tenant\\\"\")}\n\t}\n\tif v, ok := nc.mutation.Tenant(); ok {\n\t\tif err := node.TenantValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"tenant\", err: fmt.Errorf(\"ent: validator failed for field \\\"tenant\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := nc.mutation.Name(); !ok {\n\t\treturn &ValidationError{Name: \"name\", err: errors.New(\"ent: missing required field \\\"name\\\"\")}\n\t}\n\tif v, ok := nc.mutation.Name(); ok {\n\t\tif err := node.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := nc.mutation.GetType(); !ok {\n\t\treturn &ValidationError{Name: \"type\", err: errors.New(\"ent: missing required field \\\"type\\\"\")}\n\t}\n\tif v, ok := nc.mutation.GetType(); ok {\n\t\tif err := node.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := nc.mutation.Data(); !ok {\n\t\treturn &ValidationError{Name: \"data\", err: errors.New(\"ent: missing required field \\\"data\\\"\")}\n\t}\n\tif _, ok := nc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(\"ent: missing required field \\\"created_at\\\"\")}\n\t}\n\tif _, ok := nc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(\"ent: missing required field \\\"updated_at\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bcd381b65e361376e8e58a45de8ab006", "score": "0.5843089", "text": "func (sc *StateCreate) check() error {\n\tif _, ok := sc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(`ent: missing required field \"created_at\"`)}\n\t}\n\tif _, ok := sc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(`ent: missing required field \"updated_at\"`)}\n\t}\n\tif _, ok := sc.mutation.Short(); !ok {\n\t\treturn &ValidationError{Name: \"short\", err: errors.New(`ent: missing required field \"short\"`)}\n\t}\n\tif v, ok := sc.mutation.Short(); ok {\n\t\tif err := state.ShortValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"short\", err: fmt.Errorf(`ent: validator failed for field \"short\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := sc.mutation.Title(); !ok {\n\t\treturn &ValidationError{Name: \"title\", err: errors.New(`ent: missing required field \"title\"`)}\n\t}\n\tif v, ok := sc.mutation.Title(); ok {\n\t\tif err := state.TitleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"title\", err: fmt.Errorf(`ent: validator failed for field \"title\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := sc.mutation.Description(); ok {\n\t\tif err := state.DescriptionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"description\", err: fmt.Errorf(`ent: validator failed for field \"description\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9ee2e2fabbbfafe0e65203fd14b67d4", "score": "0.5838741", "text": "func (qc *QuestionCreate) check() error {\n\tif _, ok := qc.mutation.Body(); !ok {\n\t\treturn &ValidationError{Name: \"body\", err: errors.New(`ent: missing required field \"body\"`)}\n\t}\n\tif _, ok := qc.mutation.UserID(); !ok {\n\t\treturn &ValidationError{Name: \"user_id\", err: errors.New(`ent: missing required field \"user_id\"`)}\n\t}\n\tif _, ok := qc.mutation.PollExpiry(); !ok {\n\t\treturn &ValidationError{Name: \"pollExpiry\", err: errors.New(`ent: missing required field \"pollExpiry\"`)}\n\t}\n\tif _, ok := qc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(`ent: missing required field \"created_at\"`)}\n\t}\n\tif _, ok := qc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(`ent: missing required field \"updated_at\"`)}\n\t}\n\tif _, ok := qc.mutation.UserID(); !ok {\n\t\treturn &ValidationError{Name: \"user\", err: errors.New(\"ent: missing required edge \\\"user\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c2670fb492cd80d930d837dcbc9942c5", "score": "0.5838459", "text": "func (in WasmPluginChecker) Check() models.IstioValidations {\n\tvalidations := models.IstioValidations{}\n\n\treturn validations\n}", "title": "" }, { "docid": "78547698aaf0cfa5ee8fe9a65e5ac6f5", "score": "0.5834576", "text": "func (hduo *HTTPDetectorUpdateOne) check() error {\n\tif v, ok := hduo.mutation.Status(); ok {\n\t\tif err := httpdetector.StatusValidator(int8(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.status\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := hduo.mutation.Name(); ok {\n\t\tif err := httpdetector.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.name\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := hduo.mutation.Timeout(); ok {\n\t\tif err := httpdetector.TimeoutValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"timeout\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.timeout\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := hduo.mutation.URL(); ok {\n\t\tif err := httpdetector.URLValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"url\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.url\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e8b08ae4985e05ab222df5d81eb62e28", "score": "0.58327216", "text": "func (auo *AvatarUpdateOne) check() error {\n\tif v, ok := auo.mutation.URL(); ok {\n\t\tif err := avatar.URLValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"url\", err: fmt.Errorf(\"ent: validator failed for field \\\"url\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.Status(); ok {\n\t\tif err := avatar.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ad0a33f518b427efb9d6ee5bd9e2c233", "score": "0.58284783", "text": "func (gic *GroupInfoCreate) check() error {\n\tif _, ok := gic.mutation.Desc(); !ok {\n\t\treturn &ValidationError{Name: \"desc\", err: errors.New(`ent: missing required field \"GroupInfo.desc\"`)}\n\t}\n\tif _, ok := gic.mutation.MaxUsers(); !ok {\n\t\treturn &ValidationError{Name: \"max_users\", err: errors.New(`ent: missing required field \"GroupInfo.max_users\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "20777b674308527dffb5c312902ee993", "score": "0.5827193", "text": "func (sdc *SysDictCreate) check() error {\n\tif _, ok := sdc.mutation.IsDel(); !ok {\n\t\treturn &ValidationError{Name: \"is_del\", err: errors.New(\"ent: missing required field \\\"is_del\\\"\")}\n\t}\n\tif _, ok := sdc.mutation.Memo(); !ok {\n\t\treturn &ValidationError{Name: \"memo\", err: errors.New(\"ent: missing required field \\\"memo\\\"\")}\n\t}\n\tif v, ok := sdc.mutation.Memo(); ok {\n\t\tif err := sysdict.MemoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"memo\", err: fmt.Errorf(\"ent: validator failed for field \\\"memo\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := sdc.mutation.Sort(); !ok {\n\t\treturn &ValidationError{Name: \"sort\", err: errors.New(\"ent: missing required field \\\"sort\\\"\")}\n\t}\n\tif _, ok := sdc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(\"ent: missing required field \\\"created_at\\\"\")}\n\t}\n\tif _, ok := sdc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(\"ent: missing required field \\\"updated_at\\\"\")}\n\t}\n\tif _, ok := sdc.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(\"ent: missing required field \\\"status\\\"\")}\n\t}\n\tif _, ok := sdc.mutation.NameCn(); !ok {\n\t\treturn &ValidationError{Name: \"name_cn\", err: errors.New(\"ent: missing required field \\\"name_cn\\\"\")}\n\t}\n\tif v, ok := sdc.mutation.NameCn(); ok {\n\t\tif err := sysdict.NameCnValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name_cn\", err: fmt.Errorf(\"ent: validator failed for field \\\"name_cn\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := sdc.mutation.NameEn(); !ok {\n\t\treturn &ValidationError{Name: \"name_en\", err: errors.New(\"ent: missing required field \\\"name_en\\\"\")}\n\t}\n\tif v, ok := sdc.mutation.NameEn(); ok {\n\t\tif err := sysdict.NameEnValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name_en\", err: fmt.Errorf(\"ent: validator failed for field \\\"name_en\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := sdc.mutation.ID(); ok {\n\t\tif err := sysdict.IDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"id\", err: fmt.Errorf(\"ent: validator failed for field \\\"id\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c101e380a8203b7c9f0c7fce74336fa", "score": "0.5822253", "text": "func (muo *MenuUpdateOne) check() error {\n\tif v, ok := muo.mutation.Name(); ok {\n\t\tif err := menu.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := muo.mutation.Path(); ok {\n\t\tif err := menu.PathValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"path\", err: fmt.Errorf(\"ent: validator failed for field \\\"path\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
536725971e7b1bce844317c2526a5a52
Check if an prescription is connected to any blocks
[ { "docid": "570e18fe4a747ab6d3da0930a258489f", "score": "0.745921", "text": "func PrescriptionConnectedToBlocks(ctx context.Context, conn pgxload.PgxLoader, id uuid.UUID) (bool, error) {\n\n\tquery := pgxload.RebindPositional(\"SELECT COUNT(1) FROM \" + database.TableName(workout.BlockExercise{}) + \" WHERE prescription_id = ?\")\n\n\tvar count int\n\n\trows, err := conn.Query(ctx, query, id)\n\tif err != nil {\n\n\t\treturn false, err\n\t}\n\n\terr = conn.Scanner(rows).Scan(&count)\n\tif err != nil {\n\n\t\treturn false, err\n\t}\n\n\treturn count > 0, nil\n\n}", "title": "" } ]
[ { "docid": "9a3e0c32d827f0d52317f45614929820", "score": "0.59816563", "text": "func ExerciseConnectedToBlocks(ctx context.Context, conn pgxload.PgxLoader, id uuid.UUID) (bool, error) {\n\n\tquery := pgxload.RebindPositional(\"SELECT COUNT(1) FROM \" + database.TableName(workout.BlockExercise{}) + \" WHERE exercise_id = ?\")\n\n\tvar count int\n\n\trows, err := conn.Query(ctx, query, id)\n\tif err != nil {\n\n\t\treturn false, err\n\t}\n\n\terr = conn.Scanner(rows).Scan(&count)\n\tif err != nil {\n\n\t\treturn false, err\n\t}\n\n\treturn count > 0, nil\n\n}", "title": "" }, { "docid": "4db31632bfbec7d8446020a7b5010f68", "score": "0.59426075", "text": "func (n *nurikabe) hasBlock() bool {\n\tfor i := 0; i < n.l; i++ {\n\t\tif i/n.d.Columns() == n.d.Rows()-1 || // bottom of grid\n\t\t\ti%n.d.Columns() == n.d.Columns()-1 || // right side of grid\n\t\t\tn.d.Open(i) ||\n\t\t\tn.d.Open(i+1) ||\n\t\t\tn.d.Open(i+n.d.Columns()) ||\n\t\t\tn.d.Open(i+n.d.Columns()+1) {\n\t\t\tcontinue\n\t\t}\n\t\tif Verbose {\n\t\t\tfmt.Println(\"Block err\")\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c788ecc6be626655bf25f2b78617d91a", "score": "0.56130147", "text": "func (pool *Producer) IsConnected() bool {\n\tpool.mu.RLock()\n\tdefer pool.mu.RUnlock()\n\n\tfor _, producer := range pool.producers {\n\t\tif producer.isConnected() {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e71c0c809d1d58abb3d57ee9fbc907ef", "score": "0.5563513", "text": "func (surfClient *RPCClient) HasBlocks(blockHashesIn []string, blockHashesOut *[]string) error {\n\t// connect to the server\n\tconn, e := rpc.DialHTTP(\"tcp\", surfClient.ServerAddr)\n\tif e != nil {\n\t\treturn e\n\t}\n\n\t// perform the call\n\te = conn.Call(\"Server.HasBlocks\", blockHashesIn, blockHashesOut)\n\tif e != nil {\n\t\tconn.Close()\n\t\treturn e\n\t}\n\n\t// close the connection\n\treturn conn.Close()\n}", "title": "" }, { "docid": "d48658224141b77f90282da064a8a0ac", "score": "0.55473214", "text": "func (producer *producer) isConnected() bool {\n\tproducer.mu.RLock()\n\tdefer producer.mu.RUnlock()\n\n\treturn (producer.conn != nil)\n}", "title": "" }, { "docid": "afdb151c012d96bad62b63115b96951f", "score": "0.5510373", "text": "func (sw *Writer) InBlock() bool {\n\treturn sw.q || sw.c\n}", "title": "" }, { "docid": "4b4c1572c26dff224cfbbb75811a7732", "score": "0.54865813", "text": "func (lp *LoadPoint) connected() bool {\n\treturn lp.status == api.StatusB || lp.status == api.StatusC\n}", "title": "" }, { "docid": "4b4c1572c26dff224cfbbb75811a7732", "score": "0.54865813", "text": "func (lp *LoadPoint) connected() bool {\n\treturn lp.status == api.StatusB || lp.status == api.StatusC\n}", "title": "" }, { "docid": "813794f886983bae2d832ee1da3c16a3", "score": "0.54535073", "text": "func (p *Peer) onBlock(block *Block, ibd bool, outChan chan<- Message) (bool, error) {\n\t// the message has the ID in it but we can't trust that.\n\t// it's provided as convenience for trusted peering relationships only\n\tid, err := block.ID()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tlog.Printf(\"Received block: %s, from: %s\\n\", id, p.conn.RemoteAddr())\n\n\tblockInFlight, ok := p.localInflightQueue.Peek()\n\tif !ok || blockInFlight != id {\n\t\t// disconnect misbehaving peer\n\t\tp.conn.Close()\n\t\treturn false, fmt.Errorf(\"Received unrequested block\")\n\t}\n\n\t// don't process low difficulty blocks\n\tif ibd == false && CheckpointsEnabled && block.Header.Height < LatestCheckpointHeight {\n\t\t// don't disconnect them. they may need us to find out about the real chain\n\t\tp.localInflightQueue.Remove(id, \"\")\n\t\tp.globalInflightQueue.Remove(id, p.conn.RemoteAddr().String())\n\t\t// ignore future inv_blocks for this block\n\t\tp.ignoreBlocks[id] = true\n\t\tif len(p.ignoreBlocks) > maxBlocksPerInv {\n\t\t\t// they're intentionally sending us bad blocks\n\t\t\tlog.Printf(\"Disconnecting %s, max ignore list size exceeded\\n\", p.conn.RemoteAddr().String())\n\t\t\tp.conn.Close()\n\t\t}\n\t\treturn false, fmt.Errorf(\"Block %s height %d less than latest checkpoint height %d\",\n\t\t\tid, block.Header.Height, LatestCheckpointHeight)\n\t}\n\n\tvar accepted bool\n\n\t// is it an orphan?\n\theader, _, err := p.blockStore.GetBlockHeader(block.Header.Previous)\n\tif err != nil || header == nil {\n\t\tp.localInflightQueue.Remove(id, \"\")\n\t\tp.globalInflightQueue.Remove(id, p.conn.RemoteAddr().String())\n\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tlog.Printf(\"Block %s is an orphan, sending find_common_ancestor to: %s\\n\",\n\t\t\tid, p.conn.RemoteAddr())\n\n\t\t// send a find common ancestor request\n\t\tif err := p.sendFindCommonAncestor(nil, false, outChan); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t} else {\n\t\t// process the block\n\t\tif err := p.processor.ProcessBlock(id, block, p.conn.RemoteAddr().String()); err != nil {\n\t\t\t// disconnect a peer that sends us a bad block\n\t\t\tp.conn.Close()\n\t\t\treturn false, err\n\t\t}\n\t\t// newly accepted block\n\t\taccepted = true\n\n\t\t// remove it from the inflight queues only after we process it\n\t\tp.localInflightQueue.Remove(id, \"\")\n\t\tp.globalInflightQueue.Remove(id, p.conn.RemoteAddr().String())\n\t}\n\n\t// see if there are any more blocks to download right now\n\tif err := p.processDownloadQueue(outChan); err != nil {\n\t\treturn false, err\n\t}\n\n\treturn accepted, nil\n}", "title": "" }, { "docid": "25871725c587fd419da9c588adbe6a73", "score": "0.5399927", "text": "func (o *FcpoolReservation) HasBlock() bool {\n\tif o != nil && o.Block != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a8f2bc93f7b665d1dd0829391c5c6df4", "score": "0.5394093", "text": "func (lp *LoadPoint) connected() bool {\n\tstatus := lp.GetStatus()\n\treturn status == api.StatusB || status == api.StatusC\n}", "title": "" }, { "docid": "c7002c15485f20b5dcba646764b2d90c", "score": "0.5384144", "text": "func (me TxsdPresentationAttributesGraphicsDisplay) IsBlock() bool { return me == \"block\" }", "title": "" }, { "docid": "9c67443f5de25b64b559e331781bb53a", "score": "0.5366007", "text": "func (u *UF) Connected(p, q int) bool { return u.Find(p) == u.Find(q) }", "title": "" }, { "docid": "766abdaa3eec22fb8f08c07275482aec", "score": "0.53388643", "text": "func (n *nodeImpl) isSink() bool {\n\treturn len(n.out) == 0\n}", "title": "" }, { "docid": "ece8396ea241b257536e3fcb5ffe77af", "score": "0.5327652", "text": "func (u uf) Connected(p, q int) bool {\n\treturn u.id[p] == u.id[q]\n}", "title": "" }, { "docid": "dd767dc596333fd1058489af0e3a21cb", "score": "0.529853", "text": "func (c *CC) Connected(v, w int) bool {\n\treturn c.ids[v] == c.ids[w]\n}", "title": "" }, { "docid": "f5aaa62535273fe3447ead0e14206fef", "score": "0.52079", "text": "func (obj *block) HasNot() bool {\n\treturn obj.not != nil\n}", "title": "" }, { "docid": "32c109a1486e1b13d090e762bff890b6", "score": "0.51723355", "text": "func (me TactionType) IsBlockNetwork() bool { return me.String() == \"block-network\" }", "title": "" }, { "docid": "ff56b994e2f4e3d2e3dd0fb98c40a9be", "score": "0.5170166", "text": "func VerifyBlock(block *Block) bool {\n\tBlockpuzzle := block.puzzle()\n\tBlocksolution := block.Solution\n\tfmt.Fprintf(introserver, \"VERIFY\"+\" \"+Blockpuzzle+\" \"+Blocksolution+\"\\n\")\n\tchannel := make(chan bool)\n\tVerifyMap[Blockpuzzle] = channel\n\tverified := <-channel\n\tif verified {\n\t\tif !verifiedblockmap[Blockpuzzle] {\n\t\t\tverified = false\n\t\t}\n\t}\n\treturn verified\n}", "title": "" }, { "docid": "5da24a013912553014e6f80a98c3ffc8", "score": "0.51546246", "text": "func isSuccessDataBlocks(enBlocks [][]byte, dataBlocks int) bool {\n\t// Count number of data blocks that were read.\n\tvar successDataBlocksCount = 0\n\tfor index := range enBlocks[:dataBlocks] {\n\t\tif enBlocks[index] == nil {\n\t\t\tcontinue\n\t\t}\n\t\t// block index lesser than data blocks, update data block count.\n\t\tif index < dataBlocks {\n\t\t\tsuccessDataBlocksCount++\n\t\t}\n\t}\n\t// Returns true if we have atleast the dataBlocks.\n\treturn successDataBlocksCount >= dataBlocks\n}", "title": "" }, { "docid": "293cf0385b1e3cc9101c6b21f6187370", "score": "0.5148728", "text": "func (stb *SetTopBox) IsConnected() (bool, error) {\n\tlocations, err := stb.GetLocations()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif len(locations) > 0 {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "061855bf06fca1e51e2dccef771dc399", "score": "0.5124272", "text": "func (e *Gibberish) Connected() bool {\n\treturn true // We're always connected\n}", "title": "" }, { "docid": "86837afed4d4c4950ffeb8407e498783", "score": "0.5124228", "text": "func (cp *ConnProvider) isConnected(pid string) bool {\n\tcp.mu.Lock()\n\tdefer cp.mu.Unlock()\n\t_, ok := cp.connected[pid]\n\treturn ok\n}", "title": "" }, { "docid": "d39c989d819817abcca089e46b897027", "score": "0.50965834", "text": "func (this *DynamicBucket) isConnected() bool {\n\tif (this.GetLastChecked() == -1) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4bb0bc78b4cbec9bbe893e7692a644b6", "score": "0.5079454", "text": "func listenForBlocks() error {\n\tconn, err := ethclient.Dial(\"wss://\" + os.Getenv(\"ENVIRONMENT\") + \".infura.io/ws\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Cannot dial websocket connection %v\", err)\n\t}\n\n\tch := make(chan *types.Header)\n\tsub, err := conn.SubscribeNewHead(context.Background(), ch)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Cannot subscribe to head %v\", err)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase msg := <-ch:\n\t\t\tlog.Println(\"New Block:\", msg.Number.String())\n\t\t\tgetBlock(msg.Number)\n\t\tcase err := <-sub.Err():\n\t\t\tlog.Println(\"Connection error:\", err)\n\t\tcase <-time.After(15 * time.Second):\n\t\t\tfmt.Println(\"Waiting for blocks...\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "af9ff8b7b4db5f7b1cafd936bb7a028a", "score": "0.507845", "text": "func (p *plexConnector) isConnected() bool {\n\tp.runningMu.Lock()\n\tdefer p.runningMu.Unlock()\n\treturn p.running\n}", "title": "" }, { "docid": "76157ad4115aa412e42d1ec3bdfac18c", "score": "0.5055983", "text": "func (b *Buf) IsPooled() bool { return b.segment != nil }", "title": "" }, { "docid": "80426743bbca5c1c0527cfb084ca51ee", "score": "0.5050626", "text": "func check() bool {\n\tif len(Data.RC) == 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "338ebb714bf25a44fff1e365b938e03d", "score": "0.50400794", "text": "func (circ *Circuit) validCircuit() bool {\n // Make sure there are a correct number of gates in the circuit\n if len(circ.Gates) < (circ.NumInputWires + circ.NumOutputWires) {\n return false\n }\n \n // Go through each gate and make sure it is properly connected\n for i := 0; i < len(circ.Gates); i++ {\n if len(circ.Gates[i].InFrom) < min_input_wires[circ.Gates[i].GateType] ||\n len(circ.Gates[i].InFrom) > max_input_wires[circ.Gates[i].GateType] {\n // This gate doesn't have the right number of connected input wires\n return false\n }\n }\n \n return true\n}", "title": "" }, { "docid": "64117d2678a9850788f1394190d5351b", "score": "0.50295556", "text": "func (t *tidy) inPreBlock() bool {\n\treturn t.preBlock != -1\n}", "title": "" }, { "docid": "e889ad250ef63e4f41ceca5f1caea81d", "score": "0.50233525", "text": "func allNeighboursReceived() bool {\n\tallReceived := true\n\tfor _, node := range neighbors {\n\t\tif parent.port != node.port {\n\t\t\tif !node.receive {\n\t\t\t\tallReceived = false\n\t\t\t}\n\t\t}\n\t}\n\treturn allReceived\n}", "title": "" }, { "docid": "4ae08a4a047ceeca1890cbe2b93f9130", "score": "0.5019143", "text": "func (mset *stream) checkForOrphanMsgs() {\n\tmset.mu.RLock()\n\tconsumers := make([]*consumer, 0, len(mset.consumers))\n\tfor _, o := range mset.consumers {\n\t\tconsumers = append(consumers, o)\n\t}\n\tmset.mu.RUnlock()\n\tfor _, o := range consumers {\n\t\to.checkStateForInterestStream()\n\t}\n}", "title": "" }, { "docid": "22f88db2375d2fba312d510be9032baf", "score": "0.50071335", "text": "func (b *Bridge) isAvailable(channel string, list []string) bool {\n\tfor _, item := range list {\n\t\tif channel == item {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "eb31baea91a492e1fcc0fd22de18b339", "score": "0.5003341", "text": "func (c *WebSocketManager) HasClients() bool {\n\treturn c.Connections.Len() != 0\n}", "title": "" }, { "docid": "d4c9dd0dff5845405abb0c78590f2182", "score": "0.4997595", "text": "func (s Speeds) Connected() bool {\n\treturn s.state >= 5 // IF_OPER_DORMANT\n}", "title": "" }, { "docid": "72475ef3b1a29a7a1c27b8a45e10fb07", "score": "0.49939469", "text": "func (w *xcWallet) connected() bool {\n\tw.mtx.RLock()\n\tdefer w.mtx.RUnlock()\n\treturn w.hookedUp\n}", "title": "" }, { "docid": "0d79d8db8c4744aa442a7bc4a8c0aacf", "score": "0.49823424", "text": "func (qu *QuickUnion) Connected(p uint64, q uint64) bool {\n\treturn qu.getRoot(p) == qu.getRoot(q)\n}", "title": "" }, { "docid": "cc0ac7209944a85653d46116ebbcbc40", "score": "0.49821088", "text": "func (b *Block) IsAccepted() bool {\n\tb.RLock()\n\tdefer b.RUnlock()\n\n\treturn b.accepted || b.weaklyAccepted\n}", "title": "" }, { "docid": "e0f4ce8b79bdfd5342a64d3fae6b5c74", "score": "0.49635607", "text": "func isSuccessDecodeBlocks(enBlocks [][]byte, dataBlocks int) bool {\n\t// Count number of data and parity blocks that were read.\n\tvar successDataBlocksCount = 0\n\tvar successParityBlocksCount = 0\n\tfor index := range enBlocks {\n\t\tif enBlocks[index] == nil {\n\t\t\tcontinue\n\t\t}\n\t\t// block index lesser than data blocks, update data block count.\n\t\tif index < dataBlocks {\n\t\t\tsuccessDataBlocksCount++\n\t\t\tcontinue\n\t\t} // else { // update parity block count.\n\t\tsuccessParityBlocksCount++\n\t}\n\t// Returns true if we have atleast dataBlocks parity.\n\treturn successDataBlocksCount == dataBlocks || successDataBlocksCount+successParityBlocksCount >= dataBlocks\n}", "title": "" }, { "docid": "922253de3a330baaf9b69683def31af9", "score": "0.49627465", "text": "func (wqu Wqu) Connected(p int, q int) bool {\n\t// connected only if both p and q are in the same component\n\treturn wqu.Find(p) == wqu.Find(q)\n}", "title": "" }, { "docid": "423512bffbaa23001f64945e21a811f0", "score": "0.49596167", "text": "func (c *chainView) contains(node *blockNode) bool {\n\treturn c.nodeByHeight(node.height) == node\n}", "title": "" }, { "docid": "1c368a5190150a7611d586274ed345f3", "score": "0.49567443", "text": "func (cs *connectorState) isConnected() bool {\n\treturn cs.connectorConn != nil\n}", "title": "" }, { "docid": "c791105bdd28c344b3666724c0b233f1", "score": "0.49525192", "text": "func (obj *grammar) HasChannels() bool {\n\treturn obj.channels != nil\n}", "title": "" }, { "docid": "3a93861d54919c82413b44dab2499403", "score": "0.49518773", "text": "func (o *IpBlockProperties) HasIpConsumers() bool {\n\tif o != nil && o.IpConsumers != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cde6a9e96673ee9e76d451bdf2385d43", "score": "0.49494198", "text": "func hasConn(s *scheduler, peerID core.PeerID, infoHash core.InfoHash) bool {\n\tresult := make(chan bool)\n\ts.eventLoop.send(hasConnEvent{peerID, infoHash, result})\n\treturn <-result\n}", "title": "" }, { "docid": "9e5f72ac37e4698a7a3fce01d6c48068", "score": "0.49420875", "text": "func (g *Graph) isConnected() bool {\n\tlvisited := map[string]struct{}{}\n\tfvisited := map[string]struct{}{}\n\t// Check forwards connectivity and backwards connectivity\n\treturn g.connectedToLastNode(g.Source, lvisited) && g.connectedToFirstNode(g.Sink, fvisited)\n}", "title": "" }, { "docid": "50d13f8210a8c971f9687e62a782cfa1", "score": "0.49322164", "text": "func (df DiffNode) IsBlocking() bool {\n\treturn len(df.Blocking) > 0\n}", "title": "" }, { "docid": "0bf6938d692b7dd76f55506e5766d0db", "score": "0.49236935", "text": "func (bp *BitswapPeer) HasBlock(c cid.Cid) (bool, error) {\n\treturn bp.BlockStore().Has(c)\n}", "title": "" }, { "docid": "51d4da7e0408a8f9cb4f74611bbbaeb4", "score": "0.49210796", "text": "func (sr *serializerState) unblockOne() (empty bool) {\n\twinner := sr.pop()\n\tif winner == nil {\n\t\treturn true\n\t}\n\tsr.wg.Add(1)\n\tclose(winner.ch)\n\tsr.wg.Wait()\n\treturn false\n}", "title": "" }, { "docid": "06f2b748fb72f4dc25fff9f3aea6e4bd", "score": "0.49206308", "text": "func (b *Block) HasWire() bool {\n\treturn b.hasWire\n}", "title": "" }, { "docid": "dc9a1c9cf482abbed88ecd0475759b25", "score": "0.4916909", "text": "func (h *Hand) IsInitialHand() bool {\n\treturn h.Count() == 2\n}", "title": "" }, { "docid": "275fe384fb4bf4104617aef239372c84", "score": "0.49166834", "text": "func containsChunk(addr swarm.Address, chs ...swarm.Chunk) bool {\n\tfor _, c := range chs {\n\t\tif addr.Equal(c.Address()) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2df7f224e5b20a1b91f495d4ae108555", "score": "0.49160436", "text": "func (o *IppoolShadowPool) HasIpBlockHeads() bool {\n\tif o != nil && o.IpBlockHeads != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "adea23c999b537fcc04c90922238a0ff", "score": "0.49151236", "text": "func (c *Carton) Available() bool {\n\tfor _, box := range *c.Boxes {\n\t\tif box.Available() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "78048ff6f4fdb6d2d4606269c30f0882", "score": "0.49149203", "text": "func (state *pcState) synced() bool {\n\treturn len(state.queue) <= 1\n}", "title": "" }, { "docid": "d947fba4f51c4bdfd8ef81be071ec9c5", "score": "0.49124345", "text": "func IsConfigBlock(block *cb.Block) bool {\n\tenvelope, err := ExtractEnvelope(block, 0)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tpayload, err := UnmarshalPayload(envelope.Payload)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tif payload.Header == nil {\n\t\treturn false\n\t}\n\n\thdr, err := UnmarshalChannelHeader(payload.Header.ChannelHeader)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn cb.HeaderType(hdr.Type) == cb.HeaderType_CONFIG || cb.HeaderType(hdr.Type) == cb.HeaderType_ORDERER_TRANSACTION\n}", "title": "" }, { "docid": "f48e37f8e4e737eee95ae75d6e039bb8", "score": "0.49084193", "text": "func (mset *stream) hasPreAck(o *consumer, seq uint64) bool {\n\tif o == nil || len(mset.preAcks) == 0 {\n\t\treturn false\n\t}\n\tconsumers := mset.preAcks[seq]\n\tif len(consumers) == 0 {\n\t\treturn false\n\t}\n\t_, found := consumers[o]\n\treturn found\n}", "title": "" }, { "docid": "33f596c90a9e0e2c024082e65d15a714", "score": "0.4904748", "text": "func (c *Client) IsSubscribed(ch string) bool {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\t_, ok := c.channels[ch]\n\treturn ok\n}", "title": "" }, { "docid": "85b06ccf5441d2f1637a1be8517bd82b", "score": "0.4895034", "text": "func (ftm *FtmBridge) observeBlocks() {\n\tvar sub ethereum.Subscription\n\tdefer func() {\n\t\tif sub != nil {\n\t\t\tsub.Unsubscribe()\n\t\t}\n\t\tftm.log.Noticef(\"block observer done\")\n\t\tftm.wg.Done()\n\t}()\n\n\tsub = ftm.blockSubscription()\n\tfor {\n\t\t// re-subscribe if the subscription ref is not valid\n\t\tif sub == nil {\n\t\t\ttm := time.NewTimer(ftmHeadsObserverSubscribeTick)\n\t\t\tselect {\n\t\t\tcase <-ftm.sigClose:\n\t\t\t\treturn\n\t\t\tcase <-tm.C:\n\t\t\t\tsub = ftm.blockSubscription()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// use the subscriptions\n\t\tselect {\n\t\tcase <-ftm.sigClose:\n\t\t\treturn\n\t\tcase err := <-sub.Err():\n\t\t\tftm.log.Errorf(\"block subscription failed; %s\", err.Error())\n\t\t\tsub = nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b8caf9eca37a48b88794436fb40345c5", "score": "0.4882912", "text": "func (cond *alleleFixedLost) Check(sim Epidemic) bool {\n\tc := make(chan bool)\n\tvar wg sync.WaitGroup\n\tfor _, host := range sim.HostMap() {\n\t\twg.Add(1)\n\t\tgo func(host Host, c chan<- bool, wg *sync.WaitGroup) {\n\t\t\tdefer wg.Done()\n\t\t\tresultMap := make(map[ksuid.KSUID]bool)\n\t\t\tfor _, node := range host.Pathogens() {\n\t\t\t\tgenotypeUID := node.GenotypeUID()\n\t\t\t\tif _, exists := resultMap[genotypeUID]; !exists {\n\t\t\t\t\tif node.CurrentGenotype().Sequence()[cond.site] == cond.char {\n\t\t\t\t\t\tresultMap[genotypeUID] = true\n\t\t\t\t\t\tc <- true\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresultMap[genotypeUID] = false\n\t\t\t\t\t\tc <- false\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tc <- resultMap[genotypeUID]\n\t\t\t\t}\n\t\t\t}\n\t\t}(host, c, &wg)\n\t}\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(c)\n\t}()\n\tfixed := true\n\tlost := true\n\tfor e := range c {\n\t\tif e {\n\t\t\t// One true output means it is not yet lost\n\t\t\tlost = false\n\t\t} else {\n\t\t\t// One false output means that it is not yet fixed\n\t\t\tfixed = false\n\t\t}\n\t}\n\t// Return true if not fixed, or not lost\n\t// fixed lost continue\n\t// true false false\n\t// false true false\n\t// false false true\n\t// true true false* (cannot happen)\n\tif fixed {\n\t\tcond.reason = \"allele fixed\"\n\t} else if lost {\n\t\tcond.reason = \"allele lost\"\n\t}\n\treturn !fixed && !lost\n}", "title": "" }, { "docid": "c542816bfb020ea0e0f15fcdd765082a", "score": "0.488125", "text": "func (o *HostResponse) HasFirstSeenBlock() bool {\n\tif o != nil && o.FirstSeenBlock != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b4233d07fad692d12d5321b7ac5f3b78", "score": "0.4873267", "text": "func (t *Telegram) IsConnected() bool { return t.Connected }", "title": "" }, { "docid": "887aa868dd5496eee65aaf98a4b4d25b", "score": "0.48731938", "text": "func (p *Peer) KnownBlock(hash common.Hash) bool {\n\treturn p.knownBlocks.Contains(hash)\n}", "title": "" }, { "docid": "1ce5b0895a98fac14a4ddacce61ddc17", "score": "0.48700577", "text": "func (s *sendOnlyNode) verifyLoop() {\n\tdefer s.wg.Done()\n\n\tbackoff := utils.NewRedialBackoff()\n\tfor {\n\t\tselect {\n\t\tcase <-time.After(backoff.Duration()):\n\t\t\tchainID, err := s.sender.ChainID(context.Background())\n\t\t\tif err != nil {\n\t\t\t\tok := s.IfStarted(func() {\n\t\t\t\t\tif changed := s.setState(NodeStateUnreachable); changed {\n\t\t\t\t\t\tpromEVMPoolRPCNodeTransitionsToUnreachable.WithLabelValues(s.chainID.String(), s.name).Inc()\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\ts.log.Errorw(fmt.Sprintf(\"Verify failed: %v\", err), \"err\", err)\n\t\t\t\tcontinue\n\t\t\t} else if chainID.Cmp(s.chainID) != 0 {\n\t\t\t\tok := s.IfStarted(func() {\n\t\t\t\t\tif changed := s.setState(NodeStateInvalidChainID); changed {\n\t\t\t\t\t\tpromEVMPoolRPCNodeTransitionsToInvalidChainID.WithLabelValues(s.chainID.String(), s.name).Inc()\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\ts.log.Errorf(\n\t\t\t\t\t\"sendonly rpc ChainID doesn't match local chain ID: RPC ID=%s, local ID=%s, node name=%s\",\n\t\t\t\t\tchainID.String(),\n\t\t\t\t\ts.chainID.String(),\n\t\t\t\t\ts.name,\n\t\t\t\t)\n\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tok := s.IfStarted(func() {\n\t\t\t\t\tif changed := s.setState(NodeStateAlive); changed {\n\t\t\t\t\t\tpromEVMPoolRPCNodeTransitionsToAlive.WithLabelValues(s.chainID.String(), s.name).Inc()\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\ts.log.Infow(\"Sendonly RPC Node is online\", \"nodeState\", s.state)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-s.chStop:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "685d6531065eac324f5d12ea57b7fe23", "score": "0.486329", "text": "func (Begin) IsMessage() {}", "title": "" }, { "docid": "90d875fe75ebf9bd904116fcd9330e0d", "score": "0.48613742", "text": "func IsAccepted(prefix string) bool {\n\tmutex.RLock()\n\tdefer mutex.RUnlock()\n\tfor n := range sockets {\n\t\tif strings.HasPrefix(n, prefix) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "31c52fbafa6f332e936673f357331b01", "score": "0.48553348", "text": "func (b *BlockChain) checkConnectBlock(node *blockNode, block *asiutil.Block, view *txo.UtxoViewpoint,\n\tstxos *[]txo.SpentTxOut, msgvblock *protos.MsgVBlock) (\n\ttypes.Receipts, []*types.Log, error) {\n\n\t// Check Sig & Weight\n\terr := b.checkSignaturesWeight(node, block, view)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t//contract related statedb info.\n\tstatedb, err := state.New(node.parent.stateRoot, b.stateCache)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tfeepool, err := b.GetAcceptFees(block,\n\t\tstatedb, chaincfg.ActiveNetParams.FvmParam, block.Height())\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\t// If the side chain blocks end up in the database, a call to\n\t// CheckBlockSanity should be done here in case a previous version\n\t// allowed a block that is no longer valid. However, since the\n\t// implementation only currently uses memory for the side chain blocks,\n\t// it isn't currently necessary.\n\n\t// The coinbase for the Genesis block is not spendable, so just return\n\t// an error now.\n\tif node.hash.IsEqual(b.chainParams.GenesisHash) {\n\t\tstr := \"invalid hash when checking block connection: the block to be checked can not be genesis block\"\n\t\treturn nil, nil, ruleError(ErrInvalidBlockHash, str)\n\t}\n\n\t// Ensure the view is for the node being checked.\n\tparentHash := &block.MsgBlock().Header.PrevBlock\n\tif !view.BestHash().IsEqual(parentHash) {\n\t\terrStr := fmt.Sprintf(\"inconsistent view when \"+\n\t\t\t\"checking block connection: best hash is %v instead \"+\n\t\t\t\"of expected %v\", view.BestHash(), parentHash)\n\t\treturn nil, nil, ruleError(ErrHashMismatch, errStr)\n\t}\n\n\t// Load all of the utxos referenced by the inputs for all transactions\n\t// in the block don't already exist in the utxo view from the database.\n\t//\n\t// These utxo entries are needed for verification of things such as\n\t// transaction inputs, counting pay-to-script-hashes, and scripts.\n\terr = fetchInputUtxos(view, b.db, block)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// The number of signature operations must be less than the maximum\n\t// allowed per block. Note that the preliminary sanity checks on a\n\t// block also include a check similar to this one, but this check\n\t// expands the count to include a precise count of pay-to-script-hash\n\t// signature operations in each of the input transaction public key\n\t// scripts.\n\ttransactions := block.Transactions()\n\tcoinbaseIdx := len(transactions) - 1\n\ttotalSigOpCost := 0\n\tfor i, tx := range transactions {\n\t\t// Since the first (and only the first) transaction has\n\t\t// already been verified to be a coinbase transaction,\n\t\t// use i == 0 as an optimization for the flag to\n\t\t// countP2SHSigOps for whether or not the transaction is\n\t\t// a coinbase transaction rather than having to do a\n\t\t// full coinbase check again.\n\t\tsigOpCost, err := GetSigOpCost(tx, i == coinbaseIdx, view)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\t// Check for overflow or going over the limits. We have to do\n\t\t// this on every loop iteration to avoid overflow.\n\t\tlastSigOpCost := totalSigOpCost\n\t\ttotalSigOpCost += sigOpCost\n\t\tif totalSigOpCost < lastSigOpCost || totalSigOpCost > MaxBlockSigOpsCost {\n\t\t\tstr := fmt.Sprintf(\"block contains too many \"+\n\t\t\t\t\"signature operations - got %v, max %v\",\n\t\t\t\ttotalSigOpCost, MaxBlockSigOpsCost)\n\t\t\treturn nil, nil, ruleError(ErrTooManySigOps, str)\n\t\t}\n\t}\n\n\t// Perform several checks on the inputs for each transaction. Also\n\t// accumulate the total fees. This could technically be combined with\n\t// the loop above instead of running another loop over the transactions,\n\t// but by separating it we can avoid running the more expensive (though\n\t// still relatively cheap as compared to running the scripts) checks\n\t// against all the inputs when the signature operations are out of\n\t// bounds.\n\tvar totalGasUsed uint64\n\tallFees := make(map[protos.Asset]int64)\n\tvar (\n\t\treceipts types.Receipts\n\t\tallLogs []*types.Log\n\t\ttotalFeeLockItems map[protos.Asset]*txo.LockItem\n\t)\n\tfor i, tx := range transactions {\n\t\tfee, feeList, err := CheckTransactionInputs(tx, node.height, view, b)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\t// Sum the total fees and ensure we don't overflow the\n\t\t// accumulator.\n\t\tif feeList != nil {\n\t\t\tfor asset, _ := range *feeList {\n\t\t\t\tif _, ok := feepool[asset]; !ok {\n\t\t\t\t\terrstr := fmt.Sprintf(\"Skipping tx %s because its \"+\n\t\t\t\t\t\t\"fee %v is unsupported\", tx.Hash(), asset)\n\t\t\t\t\treturn nil, nil, ruleError(ErrForbiddenAsset, errstr)\n\t\t\t\t}\n\t\t\t}\n\t\t\terr = MergeFees(&allFees, feeList)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t}\n\n\t\t// Add all of the outputs for this transaction which are not\n\t\t// provably unspendable as available utxos. Also, the passed\n\t\t// spent txos slice is updated to contain an entry for each\n\t\t// spent txout in the order each transaction spends them.\n\t\tstatedb.Prepare(*tx.Hash(), *block.Hash(), i)\n\t\treceipt, err, gasUsed, vtx, feeLockItems := b.ConnectTransaction(block, i, view, tx, stxos, statedb, fee)\n\t\tif receipt != nil {\n\t\t\treceipts = append(receipts, receipt)\n\t\t\tallLogs = append(allLogs, receipt.Logs...)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\ttotalGasUsed += gasUsed\n\t\tif vtx != nil && msgvblock != nil {\n\t\t\tmsgvblock.AddTransaction(vtx)\n\t\t}\n\t\tif totalFeeLockItems == nil {\n\t\t\ttotalFeeLockItems = feeLockItems\n\t\t} else if feeLockItems != nil {\n\t\t\tfor k, item := range feeLockItems {\n\t\t\t\tif titem, ok := totalFeeLockItems[k]; ok {\n\t\t\t\t\ttitem.Merge(item)\n\t\t\t\t} else {\n\t\t\t\t\ttotalFeeLockItems[k] = item\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif block.MsgBlock().Header.GasUsed != totalGasUsed {\n\t\terrStr := fmt.Sprintf(\"total gas used mismatch, header %d vs calc %d.\",\n\t\t\tblock.MsgBlock().Header.GasUsed, totalGasUsed)\n\t\treturn nil, nil, ruleError(ErrGasMismatch, errStr)\n\t}\n\n\tif err := b.checkCoinbaseTx(node.parent, block, allFees); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Don't run scripts if this node is before the latest known good\n\t// checkpoint since the validity is verified via the checkpoints (all\n\t// transactions are included in the merkle root hash and any changes\n\t// will therefore be detected by the next checkpoint). This is a huge\n\t// optimization because running the scripts is the most time consuming\n\t// portion of block handling.\n\tcheckpoint := b.LatestCheckpoint()\n\trunScripts := true\n\tif checkpoint != nil && node.height <= checkpoint.Height {\n\t\trunScripts = false\n\t}\n\n\t// Blocks created after the BIP0016 activation time need to have the\n\t// pay-to-script-hash checks enabled.\n\tvar scriptFlags txscript.ScriptFlags\n\tscriptFlags |= txscript.ScriptBip16\n\n\t// Enforce CHECKLOCKTIMEVERIFY for block versions 4+ once the historical\n\t// activation threshold has been reached. This is part of BIP0065.\n\tscriptFlags |= txscript.ScriptVerifyCheckLockTimeVerify\n\n\t// If the CSV soft-fork is now active, then modify the\n\t// scriptFlags to ensure that the CSV op code is properly\n\t// validated during the script checks bleow.\n\tscriptFlags |= txscript.ScriptVerifyCheckSequenceVerify\n\n\t// We obtain the MTP of the *previous* block in order to\n\t// determine if transactions in the current block are final.\n\tmedianTime := node.parent.GetTime()\n\n\t// Additionally, if the CSV soft-fork package is now active,\n\t// then we also enforce the relative sequence number based\n\t// lock-times within the inputs of all transactions in this\n\t// candidate block.\n\tfor _, tx := range block.Transactions() {\n\t\t// A transaction can only be included within a block\n\t\t// once the sequence locks of *all* its inputs are\n\t\t// active.\n\t\tsequenceLock, err := b.calcSequenceLock(node, tx, view,\n\t\t\tfalse)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tif !SequenceLockActive(sequenceLock, node.height,\n\t\t\tmedianTime) {\n\t\t\tstr := fmt.Sprintf(\"block contains \" +\n\t\t\t\t\"transaction whose input sequence \" +\n\t\t\t\t\"locks are not met\")\n\t\t\treturn nil, nil, ruleError(ErrUnfinalizedTx, str)\n\t\t}\n\t}\n\n\t// Now that the inexpensive checks are done and have passed, verify the\n\t// transactions are actually allowed to spend the coins by running the\n\t// expensive ECDSA signature check scripts. Doing this last helps\n\t// prevent CPU exhaustion attacks.\n\tif runScripts {\n\t\terr := checkBlockScripts(block, view, scriptFlags)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t}\n\n\t// Update the best hash for view to include this block since all of its\n\t// transactions have been connected.\n\tview.SetBestHash(&node.hash)\n\n\t//save dbstate.\n\tstateRoot, err := statedb.Commit(true)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif err := statedb.Database().TrieDB().Commit(stateRoot, false); err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif !bytes.Equal(node.stateRoot[:], stateRoot[:]) {\n\t\treturn nil, nil, ruleError(ErrStateRootNotMatch, \"state root of the block is not matched.\")\n\t}\n\n\tupdateFeeLockItems(block, view, totalFeeLockItems)\n\n\treturn receipts, allLogs, nil\n}", "title": "" }, { "docid": "0356c1a46a91075f92ebc0a47da89c2d", "score": "0.48514605", "text": "func (me TactionType) IsBlockPort() bool { return me.String() == \"block-port\" }", "title": "" }, { "docid": "412ea26d698d637bf5e0a170ea82aafc", "score": "0.4850475", "text": "func (b *blockManager) isSyncCandidate(sp *ServerPeer) bool {\n\t// The peer is not a candidate for sync if it's not a full node.\n\treturn sp.Services()&wire.SFNodeNetwork == wire.SFNodeNetwork\n}", "title": "" }, { "docid": "0d69ed52c75f4b469a50af7243df55b8", "score": "0.484896", "text": "func (c *jsiiProxy_CfnVPCCidrBlock) ShouldSynthesize() *bool {\n\tvar returns *bool\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"shouldSynthesize\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "efa85146951a424fe1d27d0d1e8d26c2", "score": "0.48466426", "text": "func checkBlocks(blocks []Block) {\n\tfor _, block := range blocks {\n\t\tsendMessage(block)\n\t\tif block.Created > config.LastTimestamp {\n\t\t\tconfig.LastTimestamp = block.Created + 1 // + 1 or we would get the last one all the time\n\t\t}\n\t}\n}", "title": "" }, { "docid": "afcdd00366a0ba755cd6d8cbbd28fd7d", "score": "0.48459908", "text": "func (c *Sender) IsConnected() bool {\n\terr := c.cerenceClient.CheckConnection()\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "9d4e4b31b35ca743058de1b54b44233a", "score": "0.48411825", "text": "func (cache *rpcCache) isConnected() bool {\n\tif cache.Connected {\n\t\treturn true\n\t} else if !cache.Connecting {\n\t\treturn false\n\t}\n\tticker := time.NewTicker(10 * time.Millisecond)\n\tfor i := 0; i < 5 && cache.Connecting; i++ {\n\t\t<-ticker.C\n\t}\n\tticker.Stop()\n\treturn cache.Connected\n}", "title": "" }, { "docid": "a5d1e9be89dbcb1bc6f030767977a10e", "score": "0.48381647", "text": "func (b Block) IsEmpty() bool {\n\treturn b.Id == 0\n}", "title": "" }, { "docid": "2559607b1cffbf9a48df83c0b20416bf", "score": "0.48379013", "text": "func (blockSub *BlockSubscription2) Blocks() <-chan *tee.Block { return blockSub.blocks }", "title": "" }, { "docid": "a88c34d2dd30851e624fec5aad9e86aa", "score": "0.4835571", "text": "func (b *BlockChain) checkConnectBlock(ib blockdag.IBlock, block *types.SerializedBlock, utxoView *UtxoViewpoint, stxos *[]SpentTxOut) error {\n\t// If the side chain blocks end up in the database, a call to\n\t// CheckBlockSanity should be done here in case a previous version\n\t// allowed a block that is no longer valid. However, since the\n\t// implementation only currently uses memory for the side chain blocks,\n\t// it isn't currently necessary.\n\n\t// The coinbase for the Genesis block is not spendable, so just return\n\t// an error now.\n\tif ib.GetHash().IsEqual(b.params.GenesisHash) {\n\t\tstr := \"the coinbase for the genesis block is not spendable\"\n\t\treturn ruleError(ErrMissingTxOut, str)\n\t}\n\t// Don't run scripts if this node is before the latest known good\n\t// checkpoint since the validity is verified via the checkpoints (all\n\t// transactions are included in the merkle root hash and any changes\n\t// will therefore be detected by the next checkpoint). This is a huge\n\t// optimization because running the scripts is the most time consuming\n\t// portion of block handling.\n\tcheckpoint := b.LatestCheckpoint()\n\trunScripts := !b.noVerify\n\tif checkpoint != nil && uint64(ib.GetLayer()) <= checkpoint.Layer {\n\t\trunScripts = false\n\t}\n\tvar scriptFlags txscript.ScriptFlags\n\tvar err error\n\tif runScripts {\n\t\tscriptFlags, err = b.consensusScriptVerifyFlags()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// At first, we must calculate the dag duplicate tx for block.\n\tb.CalculateDAGDuplicateTxs(block)\n\n\t// The number of signature operations must be less than the maximum\n\t// allowed per block. Note that the preliminary sanity checks on a\n\t// block also include a check similar to this one, but this check\n\t// expands the count to include a precise count of pay-to-script-hash\n\t// signature operations in each of the input transaction public key\n\t// scripts.\n\t// Do this for all TxTrees.\n\n\terr = utxoView.fetchInputUtxos(b.db, block, b)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnode := b.GetBlockNode(ib)\n\tif node == nil {\n\t\treturn fmt.Errorf(\"Block Node error:%s\\n\", ib.GetHash().String())\n\t}\n\terr = b.checkTransactionsAndConnect(node, block, b.subsidyCache, utxoView, stxos)\n\tif err != nil {\n\t\tlog.Trace(\"checkTransactionsAndConnect failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\t// Enforce all relative lock times via sequence numbers for the regular\n\t// transaction tree once the stake vote for the agenda is active.\n\n\t// Use the past median time of the *previous* block in order\n\t// to determine if the transactions in the current block are\n\t// final.\n\tmainParent := b.bd.GetBlockById(ib.GetMainParent())\n\tif mainParent == nil {\n\t\treturn fmt.Errorf(\"Block Main Parent error:%s\\n\", ib.GetHash().String())\n\t}\n\tprevMedianTime := b.CalcPastMedianTime(mainParent)\n\n\t// Skip the coinbase since it does not have any inputs and thus\n\t// lock times do not apply.\n\tfor _, tx := range block.Transactions() {\n\t\tsequenceLock, err := b.calcSequenceLock(tx,\n\t\t\tutxoView, false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !SequenceLockActive(sequenceLock, int64(ib.GetHeight()), //TODO, remove type conversion\n\t\t\tprevMedianTime) {\n\n\t\t\tstr := fmt.Sprintf(\"block contains \" +\n\t\t\t\t\"transaction whose input sequence \" +\n\t\t\t\t\"locks are not met\")\n\t\t\treturn ruleError(ErrUnfinalizedTx, str)\n\t\t}\n\t}\n\n\tif runScripts {\n\t\terr = b.checkBlockScripts(block, utxoView,\n\t\t\tscriptFlags, b.sigCache)\n\t\tif err != nil {\n\t\t\tlog.Trace(\"checkBlockScripts failed; error returned \"+\n\t\t\t\t\"on txtreeregular of cur block: %v\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn b.CheckTokenState(block)\n}", "title": "" }, { "docid": "9590db6e310b648092186b6dcbcf32ba", "score": "0.48231518", "text": "func (me TactionType) IsBlockHost() bool { return me.String() == \"block-host\" }", "title": "" }, { "docid": "d8842762b2d60d2a7ff7b90e1554afef", "score": "0.4820781", "text": "func allNeighboursReplied() bool {\n\tallReplied := true\n\tfor _, addr := range neighbours {\n\t\tif self.ParentMessage.Port != addr.Port && !addr.HasReplied {\n\t\t\tallReplied = false\n\t\t}\n\t}\n\n\treturn allReplied\n}", "title": "" }, { "docid": "f40762096e2be5cc25c662c797e9f801", "score": "0.48161525", "text": "func (pc *ProxySocks5Conf) IsContry() bool {\n\treturn pc.CountryIsoCode != \"\"\n}", "title": "" }, { "docid": "3389b249cc6e0736379248d4517f2dad", "score": "0.48160523", "text": "func (o *NetworkElement) HasPsus() bool {\n\tif o != nil && o.Psus != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "45ffb377ab65e8f98ab6c0b55001e8bf", "score": "0.48151943", "text": "func (t *Torrent) peerInActiveConns(peer Peer) bool {\n\tfor _, ci := range t.conns {\n\t\tif ci.peer.P.IP.Equal(peer.P.IP) && ci.peer.P.Port == peer.P.Port {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "69172b103785c9b8c52abb829d5b0862", "score": "0.48055047", "text": "func (c *Chain) HasProposedOrCommittedBlock(block *Block) bool {\n\tif c.Proposed != nil && c.Proposed.IsSameAsBlock(block) {\n\t\treturn true\n\t}\n\n\t// check if the block being checked is the next to be committed\n\tlast := c.LastBlock()\n\tif last != nil {\n\t\thash, err := last.Hash()\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\n\t\tlastHashString := acrypto.Base64URLEncode(hash)\n\t\tif lastHashString == block.ID {\n\t\t\treturn true\n\t\t}\n\t}\n\n\t// if that fails, work backwards in the chain to see if any of them match\n\tfor i := len(c.Blocks) - 1; i > 0; i-- {\n\t\tif c.Blocks[i].IsSameAsBlock(block) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c36c02ab2f75cffd41cb2a2ff5e00d60", "score": "0.48046276", "text": "func (pool *BlockPool) IsCaughtUp() bool {\n\tpool.mtx.Lock()\n\tdefer pool.mtx.Unlock()\n\n\t// Need at least 1 peer to be considered caught up.\n\tif len(pool.peers) == 0 {\n\t\tpool.Logger.Debug(\"BlockPool has no peers\")\n\t\treturn false\n\t}\n\n\t// some conditions to determine if we're caught up\n\treceivedBlockOrTimedOut := (pool.height > 0 || time.Since(pool.startTime) > 5*time.Second)\n\tourChainIsLongestAmongPeers := pool.maxPeerHeight == 0 || pool.height >= pool.maxPeerHeight\n\tisCaughtUp := receivedBlockOrTimedOut && ourChainIsLongestAmongPeers\n\treturn isCaughtUp\n}", "title": "" }, { "docid": "999f60e05e62d208794fbc57a5d83998", "score": "0.47963238", "text": "func (o *NetworkElementAllOf) HasPsus() bool {\n\tif o != nil && o.Psus != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "97bcc868689f1b98a35c9b3504d7b92b", "score": "0.479607", "text": "func (c WebSession_WebSocketStream) IsValid() bool {\n\treturn capnp.Client(c).IsValid()\n}", "title": "" }, { "docid": "07104053ae045e1539a9e2d8773296cb", "score": "0.47916663", "text": "func (cons *LogConsumer) IsBlocked() bool {\n\treturn false\n}", "title": "" }, { "docid": "6cbe6da6f3c1b4309d946bbaf48b7b3f", "score": "0.47894925", "text": "func (self *Server) isProposer(blockNum uint32, peerIdx uint32) bool {\n\tself.metaLock.RLock()\n\tdefer self.metaLock.RUnlock()\n\n\t{\n\t\tif peerIdx == self.Index && !isActive(self.getState()) {\n\t\t\treturn false\n\t\t}\n\t\t// the first active proposer\n\t\tfor _, id := range self.currentParticipantConfig.Proposers {\n\t\t\tif self.isPeerAlive(id, blockNum) {\n\t\t\t\treturn peerIdx == id\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO: proposer check for non-current block\n\treturn false\n}", "title": "" }, { "docid": "b962d3f005109d8e651c69df601676be", "score": "0.47889334", "text": "func (cond *alleleExists) Check(sim Epidemic) bool {\n\tc := make(chan bool)\n\tvar wg sync.WaitGroup\n\tfor _, host := range sim.HostMap() {\n\t\twg.Add(1)\n\t\tgo func(host Host, c chan<- bool, wg *sync.WaitGroup) {\n\t\t\tdefer wg.Done()\n\t\t\tresultMap := make(map[ksuid.KSUID]bool)\n\t\t\tfor _, node := range host.Pathogens() {\n\t\t\t\tgenotypeUID := node.GenotypeUID()\n\t\t\t\tif _, exists := resultMap[genotypeUID]; !exists {\n\t\t\t\t\tif node.CurrentGenotype().Sequence()[cond.site] == cond.char {\n\t\t\t\t\t\tresultMap[genotypeUID] = true\n\t\t\t\t\t\tc <- true\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresultMap[genotypeUID] = false\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif resultMap[genotypeUID] {\n\t\t\t\t\t\tc <- true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}(host, c, &wg)\n\t}\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(c)\n\t}()\n\texists := false\n\tfor range c {\n\t\texists = true\n\t}\n\treturn exists\n}", "title": "" }, { "docid": "a9f961eba88b2db4e56d5238736c77cc", "score": "0.4787955", "text": "func IsValidBlock(block Block) bool {\n\t// fmt.Println(\"Started hashing\")\n\thash := block.Hash()\n\t// fmt.Println(\"stopped hashing\")\n\tif hash[0] == byte(0) && hash[1] == byte(0) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "cc79cb090892a0862be418f3618d0e76", "score": "0.47843927", "text": "func isBlockElement(node *styledNode) bool {\n\tv, ok := node.specifiedValues[\"display\"]\n\tif ok {\n\t\treturn v.keyword == \"block\"\n\t}\n\n\tfor _, v := range blockTags {\n\t\tif v == node.node.TagName() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0fa9bf841dcce28c4be1a4857898f740", "score": "0.47812146", "text": "func (ncp *NebulaCAPool) isBlocklistedWithCache(c *NebulaCertificate, useCache bool) bool {\n\th, err := c.sha256SumWithCache(useCache)\n\tif err != nil {\n\t\treturn true\n\t}\n\n\tif _, ok := ncp.certBlocklist[h]; ok {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a3992589ed5c82a1223a437bf55f377a", "score": "0.4781213", "text": "func (rb *Rekordbox) IsLinked() bool {\n\treturn rb.conn != nil\n}", "title": "" }, { "docid": "836fbd026006d5c5600254c9d3e6d8a4", "score": "0.47801775", "text": "func (q *Reader) IsStarved() bool {\n\tq.RLock()\n\tdefer q.RUnlock()\n\n\tfor _, conn := range q.nsqConnections {\n\t\tthreshold := int64(float64(atomic.LoadInt64(&conn.rdyCount)) * 0.85)\n\t\tif atomic.LoadInt64(&conn.messagesInFlight) >= threshold &&\n\t\t\tatomic.LoadInt32(&conn.stopFlag) != 1 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d781daac120407fc4002272f2712d20c", "score": "0.47799355", "text": "func (this *Server) checkBlock(domain string) bool {\n\tval, ok := lookupBoolInMap(this.config.Blocks, domain)\n\treturn ok && val != nil && *val\n}", "title": "" }, { "docid": "b488f53404d2fa43bf801f75e013d2fb", "score": "0.4779735", "text": "func (t *tidy) inTextBlock() bool {\n\treturn t.textBlock != -1\n}", "title": "" }, { "docid": "4da63f7688bb50f6bbf62ad7f1761d2a", "score": "0.47757113", "text": "func (b BlackLister) containsMixers(project, stage string) (bool, error) {\n\n\thandler := configutils.NewResourceHandler(os.Getenv(envConfigSvcURL))\n\tresources, err := handler.GetAllStageResources(project, stage)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\trequiredTemplates := map[string]string{\n\t\tipHandler: \"\",\n\t\tipRule: \"\",\n\t\tipInstance: \"\",\n\t}\n\tfor _, resource := range resources {\n\t\tif _, ok := requiredTemplates[*resource.ResourceURI]; ok {\n\t\t\tdelete(requiredTemplates, *resource.ResourceURI)\n\t\t}\n\t}\n\treturn len(requiredTemplates) == 0, nil\n}", "title": "" }, { "docid": "f25084cbffe4caff5bc12d917a16c967", "score": "0.47733256", "text": "func (mset *stream) hasAllPreAcks(seq uint64, subj string) bool {\n\tif len(mset.preAcks) == 0 || len(mset.preAcks[seq]) == 0 {\n\t\treturn false\n\t}\n\t// Since these can be filtered and mutually exclusive,\n\t// if we have some preAcks we need to check all interest here.\n\treturn mset.noInterestWithSubject(seq, subj, nil)\n}", "title": "" }, { "docid": "b374a26b4d5233d422c4a347aa318525", "score": "0.47715506", "text": "func (sub *BlockSubscription) Blocks() <-chan *tee.Block { return sub.blocks }", "title": "" }, { "docid": "573d94b937e42accb0842818d5721fbc", "score": "0.47667995", "text": "func (qf Qf) Connected(p int, q int) bool {\n\t// connected only if both p and q are in the same component\n\treturn qf.Find(p) == qf.Find(q)\n}", "title": "" }, { "docid": "650b16923cc5bf9ce6c4c33b06fec31a", "score": "0.47651094", "text": "func (i *IE) IsRANProceduresReady() bool {\r\n\treturn ((i.CommonFlags() >> 2) & 0x01) != 0\r\n}", "title": "" } ]
1de455a1bf98f6ef939285cffafb09af
SetContext adds the context to the state params
[ { "docid": "4d086b7088a38963147ec7421d99805e", "score": "0.7605691", "text": "func (o *StateParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" } ]
[ { "docid": "9dab68a13808717e6cfdad50ff952ef4", "score": "0.7469984", "text": "func (_m *Conn) SetContext(v interface{}) {\n\t_m.Called(v)\n}", "title": "" }, { "docid": "425ea716e5aad2e66a6400917335a88f", "score": "0.7269603", "text": "func (o *CreateSnapshotRepstateParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "2df6a684d498bb0ec2ded7aa1792e32a", "score": "0.7255349", "text": "func (ls *LState) SetContext(ctx context.Context) {\n\tls.mainLoop = mainLoopWithContext\n\tls.ctx = ctx\n}", "title": "" }, { "docid": "5f7d0923b0fcbb0dee6851a5a1ef99ff", "score": "0.718647", "text": "func (o *GetLatestParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "bbe82a5b65b7c5037cd2e06100028b70", "score": "0.71332973", "text": "func (s *Spectator) SetContext(context *Context) {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\ts.context = context\n}", "title": "" }, { "docid": "c2a081613226a2f37f0542c66147705e", "score": "0.71021146", "text": "func (o *SensorParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "f67fc4079257e8623f7f35180e4752a4", "score": "0.70978385", "text": "func (c *ContextManager) SetContext(state octant.State, payload action.Payload) error {\n\trequestedContext, err := payload.String(\"requestedContext\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"extract requested context from payload\")\n\t}\n\tstate.SetContext(requestedContext)\n\treturn nil\n}", "title": "" }, { "docid": "dddd584a37458a0cbe7ff2faecdba301", "score": "0.7089074", "text": "func SetContext(p unsafe.Pointer, ctx unsafe.Pointer) {\n\tstate := (*C.state)(p)\n\n\tif state.goMem != nil {\n\t\tperistentPtrs.Delete(state.goMem)\n\t}\n\n\t// implicitly destroy batchCtx when a context is set\n\tif state.batchCtx != nil {\n\t\tperistentPtrs.Delete(state.batchCtx)\n\t}\n\n\tstate.goMem = ctx\n\n\tif ctx != nil {\n\t\tperistentPtrs.Store(ctx, ctx)\n\t\t// implicitly create a new batchCtx when a non-empty context is set\n\t\tstate.batchCtx = unsafe.Pointer(&batchContext{})\n\t\tperistentPtrs.Store(state.batchCtx, state.batchCtx)\n\t}\n}", "title": "" }, { "docid": "b27a4dac4c2a0da87164ce66419e9fa2", "score": "0.7083431", "text": "func (h *HTTPProvider) SetContext(context *motan.Context) {\n\th.gctx = context\n}", "title": "" }, { "docid": "b27a4dac4c2a0da87164ce66419e9fa2", "score": "0.7083431", "text": "func (h *HTTPProvider) SetContext(context *motan.Context) {\n\th.gctx = context\n}", "title": "" }, { "docid": "a2c9a181ff28c5d5ac440bb4a54e0200", "score": "0.7075414", "text": "func (o *TimeseriesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "c0d880c95fb8ff0717c93eaa25eac3ca", "score": "0.707175", "text": "func (o *AddParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "0fd1e00ef0493d8d683711b1c907fb1a", "score": "0.7066494", "text": "func (o *GetRestapiV10DictionaryStateParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "85bb50a6cfc2c88980438361673aee62", "score": "0.7065571", "text": "func (o *GetTransactionFromBlockLatestParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "b62e16be0a0903cee430c1794e426426", "score": "0.7057544", "text": "func (o *ProviderParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "eb329ed8c9a5876430404e275bb9cad5", "score": "0.70526725", "text": "func (o *AddNodeUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "a03f150fded8fd1ef7e3056d4d2bed7b", "score": "0.70508903", "text": "func (o *GetChamberStateParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "6f8267811773fae0badd56d1942e1303", "score": "0.70361704", "text": "func (o *UpdateSmbLogLevelParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "bb4cd5c4e2dcc050c2ed1f9f68e92a51", "score": "0.7033724", "text": "func (o *UpdateFnParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "b66a4c1bfc832c81484d3dd1ce2f6f0c", "score": "0.7033167", "text": "func (o *CrossProductConfigurevROPSAsWLPEndpointUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "fee65e375b931d5e31bf02810a8eac91", "score": "0.7024175", "text": "func (o *PutLolChatV1SettingsByKeyParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "b3af7a4f8f0c82e25dcf0581dbb0d506", "score": "0.70173043", "text": "func (c *Conn) SetContext(data interface{}) {\n\tc.ctx = data\n}", "title": "" }, { "docid": "218b5887c759b8ae20d74f9355ca85f3", "score": "0.7006623", "text": "func (o *StreamPricingParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "6666c1f3684dcc2850363094e7251769", "score": "0.7001412", "text": "func (o *GetApexLeagueParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "4e6a080aea82e74a481f00477758d711", "score": "0.70007044", "text": "func (o *AnalyseParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "f0ee85103ba21f5a11597a5159995c62", "score": "0.69970196", "text": "func (o *CreateProductSnapshotRequestUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "0138ef2d0cc3ffbf5226126d2b596eba", "score": "0.6993884", "text": "func (o *GetPrinterStateParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "0887b043d23f7287f94cb64af65d1df6", "score": "0.6987053", "text": "func (a *PdfAction) SetContext(ctx PdfModel) {\n\ta.context = ctx\n}", "title": "" }, { "docid": "83b29ce00d185ee47d8957d2e89d5164", "score": "0.69862306", "text": "func (o *PostInternalSyncregistryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "595057cc4fba00a8224b17528469f2a7", "score": "0.6984473", "text": "func (o *Object) SetContext(ctx iface.IContext) {\n o.context = ctx\n}", "title": "" }, { "docid": "406d43230f20aa86ad1d6ec12a37185e", "score": "0.6975468", "text": "func (o *PostWasmCodesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "68fa4852467344432f3d3c92ff1dc616", "score": "0.69678116", "text": "func (o *SamlInitParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "31f8f44e7729465c504bcdce0f8a5d93", "score": "0.69652426", "text": "func (o *CreateMatchPoolParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "4eefb91c02560cfc5b094e07e2ecb09e", "score": "0.6961471", "text": "func (o *GetMarketdataHistoryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "4d89469d6949dacf5fd9fbf3ebbc6427", "score": "0.6953105", "text": "func (o *UploadSvtImageParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "6c8a6933565d2614fc6840fe0b21898d", "score": "0.6944657", "text": "func (o *UpdateRepository4Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "c6dc30fdf73c27399648707a8555edbb", "score": "0.6942612", "text": "func (o *EchoParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "435e9aa413bdaf9d7cd111ecb4abba66", "score": "0.69372517", "text": "func (o *UnignoreParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "211598986b904bb3fa60ec7319be7bc0", "score": "0.69366974", "text": "func (o *GetServiceAndDependenciesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "cc88c5e5b16f48a1d765a934817a887a", "score": "0.6919255", "text": "func (o *InvokeActionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "6cf14c71e1557c8400ae7726a08205e0", "score": "0.69093406", "text": "func (o *LogParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "dfa53088f5e47f80cfeeee5e37669c1b", "score": "0.6908478", "text": "func (o *CreateLoadBalancerVirtualServerParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "1122a69cb90937eea2e21d5abacb7ae5", "score": "0.6905149", "text": "func (o *GetComputeBladesMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "707db881df8e6b317136ea1028d77f7e", "score": "0.689818", "text": "func (o *VariantsStackParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "82bf232c3ac9e82406a363600d39c9c8", "score": "0.68976307", "text": "func (o *ModifyNodePoolParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "29f27d503b7678a03d6e926465b53863", "score": "0.68973994", "text": "func (o *ModifyInternalSdxProxyConfigParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "a4adee5731ce9df1fec2c65194845f08", "score": "0.68971795", "text": "func (o *UploadChunkParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "54637788dfd5e8712f067f8bddaaae63", "score": "0.68971324", "text": "func (cmd *Command) SetContext(context interface{}) {\n\tcmd.Context = context\n}", "title": "" }, { "docid": "19883e1ec00963cadda38aa5e76d6a90", "score": "0.68965673", "text": "func (o *SetContainerStateParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "0fc0767c6b8361fcb97cd4f5229708d1", "score": "0.68958056", "text": "func (o *AddKeyPairParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "605b6bbc04b4135b434656958c32e86c", "score": "0.6893356", "text": "func (o *GetEurekaInfoParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "daf4a3e0eefcc82cd7fdf590d90eab94", "score": "0.6892337", "text": "func (o *QueryEventStreamHandlerParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "8160342e8f9e38c3bd901369786fcdd0", "score": "0.6885978", "text": "func (o *GetFnsFnIDCallsCallIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "a974222ca0da4f6012d442eaa1388b34", "score": "0.6880696", "text": "func (o *CreateRegionUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "3efebb91b97afa998a2285c4952ee394", "score": "0.6880456", "text": "func (o *GetVSphereNetworksParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "5bc31d38585a651b66c503712a2e099e", "score": "0.687902", "text": "func (o *StreamEventsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "7d72cd272c95eebf6fcd5726d045abe0", "score": "0.68720835", "text": "func (o *GetSpeedtestsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "c6ee0b504acf103796a44b1e7810506a", "score": "0.6870211", "text": "func (o *GetSupportedFeaturesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "3d0a7803a19436637debbae2e57c4b9a", "score": "0.68696064", "text": "func (o *StorageServiceBulkLoadByPathPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "a9ef34099cb6a4026fa803c3fe7ac468", "score": "0.68693876", "text": "func (o *ParseParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "eb61d09758e85a7a9163399916481a75", "score": "0.6866249", "text": "func (o *PostWalletSiafundsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "4678e53b2291f9ba05d98c3dee4133bf", "score": "0.6865684", "text": "func (o *GetMarketSwapParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "8ef6c0a6061d46b97714692743086787", "score": "0.6865241", "text": "func (o *SetFieldParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "ceb7e24e1164a6b20f5dd170e3163094", "score": "0.686263", "text": "func (o *GetBaseStoreUsingGETParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "84629f9bd8537fd026583ddb4db97a4b", "score": "0.6855496", "text": "func (o *AdminChatHistoryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "f521f2d12430d1619104329d589b0504", "score": "0.6850755", "text": "func (o *GetIcecreamParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "c33c4aa8847795d11411ab7a30670cef", "score": "0.6844361", "text": "func (o *GetItinerariesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "00799250bc728194c3acc9a6f39b299b", "score": "0.683851", "text": "func (o *GetTransactionFromBlockHashParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "7fec537a378891e4b39b39b5165e122f", "score": "0.68372345", "text": "func (o *GetDeltaParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "b6cff4bef42fba9b45eab18b4848d8b4", "score": "0.68327487", "text": "func (o *QueryUnbondingParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "82915adc88a714c21f049188eff6632a", "score": "0.683231", "text": "func (o *StartBlockGeneratorParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "ad4883649f4b3610f0726e69dfd10655", "score": "0.68314856", "text": "func (o *AddOpsNoteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "943705eb04c98bc8e87a42f7f98746f6", "score": "0.68306035", "text": "func SetContext(p unsafe.Pointer, ctx unsafe.Pointer) {\n\tstate := (*C.state)(p)\n\n\tif state.goMem != nil {\n\t\tperistentPtrs.Delete(state.goMem)\n\t}\n\n\tstate.goMem = ctx\n\n\tif ctx != nil {\n\t\tperistentPtrs.Store(ctx, ctx)\n\t}\n}", "title": "" }, { "docid": "2fb1a326a50bff6843d117d986229d1a", "score": "0.68282354", "text": "func (o *ValidateProductScaleoutOvaMappedRequestUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "d94c465018043de21e01f237c2d04382", "score": "0.6826347", "text": "func (o *InspectParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "993a216cb5d28cfc03edb572b0a90a3a", "score": "0.68258303", "text": "func (o *UpdateACartParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "3852512cdf8ac4c3a8b79ab294c71c08", "score": "0.682315", "text": "func (o *GetAllParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "10f88e4e24b340ef8b79945ff25a89dd", "score": "0.68228835", "text": "func (o *GetContractCallFromTxParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "ddb10881d5c0dcba3d097a3c6e3c7f17", "score": "0.68214697", "text": "func (o *PostVoiceChatV2SessionsByIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "eb656aa73b5e5533b89e212fc3e2c707", "score": "0.6819268", "text": "func (o *PerformPoolMemberActionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "9d7012831a98fcf1f31083c06883775f", "score": "0.68189955", "text": "func (o *AddSocks5ServerParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "6bd8f264b2bfe90b9a1f668fb1b4442a", "score": "0.6811496", "text": "func (o *PostGcloudVoiceChatV2SessionsByIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "57fdce4972692827166cd720e8e1b909", "score": "0.68105984", "text": "func (o *SaveOrUpdateIcecreamParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "e80873718d3c8f4175430aadfbeef394", "score": "0.68082005", "text": "func SetContext(input IContextInput, da IContextDataAccess) {\n\tda.AddContext(input.GetName(), input.GetUser(), input.GetJiraURLName())\n}", "title": "" }, { "docid": "5130e474bdb527166c32be5ad397f863", "score": "0.68066055", "text": "func (o *GetPublicTestParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "a59a6b015972afe4283398347945c3db", "score": "0.68049973", "text": "func (o *UpdateRegistryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "b918ae3e7a423c9dac4ded551000f87a", "score": "0.680413", "text": "func (o *SetCommandParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "b4bfaaa150083a3be9dfc2b4dd1c2ddf", "score": "0.6796997", "text": "func (o *UpdateGatewayUsingPUTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "1cd13d102350db45e9a23051dfeab5e5", "score": "0.6795584", "text": "func (o *ParseOvfParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "a03ca1e5ca4199b05a4180e11c7e0c14", "score": "0.6795007", "text": "func (o *SearchFlowParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "419e64edae38057d041b40c122ed12ba", "score": "0.67944545", "text": "func (o *BackupDatalakeParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "b97d7cfbea8c9a0081081c66a4a75e7e", "score": "0.67942804", "text": "func (o *PostComputeRackUnitsMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "2ac6782b527c8ed14e63502487d76f2c", "score": "0.6793673", "text": "func (o *RunSQLQueryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "b7dcb3b455a692829598447165a6572a", "score": "0.67919475", "text": "func (o *GetSepainstantParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "9fd906545c9da1d58ff921ec1e420c73", "score": "0.6786604", "text": "func (o *UpdateWhitelabelConfigurationParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "6c65eaa9244b6236aae13c893b78241b", "score": "0.6784197", "text": "func (o *AddCustomMaterialParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "6b441292901c11179be49444d4cf9570", "score": "0.6782623", "text": "func (o *ChangeTaglineParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "4c2fdee2a13d3105ecf7afd60acbad79", "score": "0.67819375", "text": "func (o *GetTanzuEditionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "ec73f50b616e5c7c41234c8dd4746c42", "score": "0.6779247", "text": "func (o *PostPublicLdapParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "8cb094bec9d54568ef40a5dcc3190827", "score": "0.6779109", "text": "func (o *GetSMSEventsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" } ]
22df9aefb121d2381b77a338eecc8c63
LoadMulti loads multiple values with given ids into results, which should be a map from string (id) to pointer to struct
[ { "docid": "783fc39edd819f50ed1ae05df33c6227", "score": "0.6502165", "text": "func (s *DocumentSession) LoadMulti(results interface{}, ids []string) error {\n\tif len(ids) == 0 {\n\t\treturn newIllegalArgumentError(\"ids cannot be empty array\")\n\t}\n\tif err := checkValidLoadMultiArg(results, \"results\"); err != nil {\n\t\treturn err\n\t}\n\tloadOperation := NewLoadOperation(s.InMemoryDocumentSessionOperations)\n\terr := s.loadInternalWithOperation(ids, loadOperation, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn loadOperation.getDocuments(results)\n}", "title": "" } ]
[ { "docid": "797b1edc5239459e4ab54530949d43ad", "score": "0.6820898", "text": "func (m *IdMap) load(ids map[uint]string) {\n\tmax := uint(0)\n\tfor id, s := range ids {\n\t\tif id > max {\n\t\t\tmax = id\n\t\t}\n\t\tm.getBucket(s).lookup[s] = key.Type(id)\n\t}\n\tm.counter = uint64(max)\n}", "title": "" }, { "docid": "ee573744ebea4b845f9c782df09dbe00", "score": "0.6680218", "text": "func (s *DocumentSession) loadInternalMulti(results interface{}, ids []string, includes []string) error {\n\tif len(ids) == 0 {\n\t\treturn newIllegalArgumentError(\"ids cannot be empty array\")\n\t}\n\n\tloadOperation := NewLoadOperation(s.InMemoryDocumentSessionOperations)\n\tloadOperation.byIds(ids)\n\tloadOperation.withIncludes(includes)\n\n\tcommand, err := loadOperation.createRequest()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif command != nil {\n\t\terr := s.requestExecutor.ExecuteCommand(command, s.sessionInfo)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tloadOperation.setResult(command.Result)\n\t}\n\n\treturn loadOperation.getDocuments(results)\n}", "title": "" }, { "docid": "7d4b365a31a8be4886c0c5976fff4273", "score": "0.6535468", "text": "func (dl *DataLoader) LoadMany(keys []interface{}) []Value {\n\tvalues := make([]Value, len(keys))\n\tvar keysToFetch []interface{}\n\tvar keysToFetchIndex []int\n\n\tfunc() {\n\t\tdl.mu.RLock()\n\t\tdefer dl.mu.RUnlock()\n\t\tfor i, key := range keys {\n\t\t\tv, ok := dl.cache[key]\n\t\t\tif ok {\n\t\t\t\tvalues[i] = v\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tkeysToFetch = append(keysToFetch, key)\n\t\t\tkeysToFetchIndex = append(keysToFetchIndex, i)\n\t\t}\n\t}()\n\n\tif len(keysToFetch) > 0 {\n\t\tn := func() *Notification {\n\t\t\tdl.mu.Lock()\n\t\t\tdefer dl.mu.Unlock()\n\t\t\tfor i := 0; i < len(keysToFetch); i++ {\n\t\t\t\tkey := keysToFetch[i]\n\t\t\t\tv, ok := dl.cache[key]\n\t\t\t\tif ok {\n\t\t\t\t\tvalues[keysToFetchIndex[i]] = v\n\t\t\t\t\tkeysToFetch[i] = keysToFetch[len(keysToFetch)-1]\n\t\t\t\t\tkeysToFetch = keysToFetch[:len(keysToFetch)-1]\n\t\t\t\t\tkeysToFetchIndex[i] = keysToFetchIndex[len(keysToFetchIndex)-1]\n\t\t\t\t\tkeysToFetchIndex = keysToFetchIndex[:len(keysToFetchIndex)-1]\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tdl.pending[key] = struct{}{}\n\t\t\t}\n\t\t\treturn dl.scheduleFetch()\n\t\t}()\n\t\tif len(keysToFetch) > 0 {\n\t\t\tn.Wait()\n\t\t\tfor vsi, vi := range keysToFetchIndex {\n\t\t\t\tvalues[vi] = dl.cache[keysToFetch[vsi]]\n\t\t\t}\n\t\t}\n\t}\n\treturn values\n}", "title": "" }, { "docid": "24c3d4f024f5013c7a6fc44f1c9abcc1", "score": "0.62285304", "text": "func (l *Loader[K, V]) load(entries []*entry[K, V]) []*entry[K, V] {\n\t// If we need to load more than the max, call load with the max, and return the rest.\n\tif len(entries) > l.cfg.Max {\n\t\tl.load(entries[:l.cfg.Max])\n\t\treturn entries[l.cfg.Max:]\n\t}\n\n\t// We need to copy the list so we don't get overwritten if other\n\t// batch updates are done in the background while this call is processing.\n\tcpy := make([]*entry[K, V], len(entries))\n\tcopy(cpy, entries)\n\n\tgo func() {\n\t\tctx := l.ctx\n\n\t\t// Map the entries out by ID, and collect the list of IDs\n\t\t// for the DB call.\n\t\tm := make(map[K]*entry[K, V], len(entries))\n\t\tids := make([]K, len(entries))\n\t\tfor i, e := range cpy {\n\t\t\tids[i] = e.id\n\t\t\tm[e.id] = e\n\t\t}\n\n\t\t// Call fetch for everything we're loading\n\t\tres, err := l.cfg.FetchFunc(ctx, ids)\n\t\tif err != nil {\n\t\t\t// If the fetch failed, set all the pending entries err property to\n\t\t\t// reflect the failure, and close the done channel to indicate the load/fetch\n\t\t\t// completed.\n\t\t\tfor _, e := range cpy {\n\t\t\t\te.err = err\n\t\t\t\tclose(e.done)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tfor i := range res {\n\t\t\t// Go through each received response and update the data value based on the ID.\n\t\t\t// We're processing against a map so we can ignore order within fetch methods.\n\t\t\tid := l.cfg.IDFunc(res[i])\n\t\t\te := m[id]\n\t\t\tif e == nil {\n\t\t\t\t// Ignore any unknown/unexpected results\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\te.data = &res[i]\n\t\t}\n\n\t\t// nil or not, all entries are now done loading, if the .data prop was not set\n\t\t// then the entry does not exist.\n\t\tfor _, e := range cpy {\n\t\t\tclose(e.done)\n\t\t}\n\t}()\n\n\treturn entries[:0]\n}", "title": "" }, { "docid": "634b213a1f968571b6c89d021e2aed86", "score": "0.6034117", "text": "func (sm *syncMap) FetchMulti(keys []string) map[string]string {\n result := make(map[string]string)\n\n for _, key := range keys {\n if value, err := sm.Fetch(key); err == nil {\n result[key] = value\n }\n }\n\n return result\n}", "title": "" }, { "docid": "32120cbcd22354179f391c90c3c245b1", "score": "0.5870571", "text": "func (s *LocalSegment) LoadMultiFieldData(rowCount int64, fields []*datapb.FieldBinlog) error {\n\ts.ptrLock.RLock()\n\tdefer s.ptrLock.RUnlock()\n\n\tif s.ptr == nil {\n\t\treturn merr.WrapErrSegmentNotLoaded(s.segmentID, \"segment released\")\n\t}\n\n\tlog := log.With(\n\t\tzap.Int64(\"collectionID\", s.Collection()),\n\t\tzap.Int64(\"partitionID\", s.Partition()),\n\t\tzap.Int64(\"segmentID\", s.ID()),\n\t)\n\n\tloadFieldDataInfo, err := newLoadFieldDataInfo()\n\tdefer deleteFieldDataInfo(loadFieldDataInfo)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, field := range fields {\n\t\tfieldID := field.FieldID\n\t\terr = loadFieldDataInfo.appendLoadFieldInfo(fieldID, rowCount)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, binlog := range field.Binlogs {\n\t\t\terr = loadFieldDataInfo.appendLoadFieldDataPath(fieldID, binlog.GetLogPath())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tloadFieldDataInfo.appendMMapDirPath(paramtable.Get().QueryNodeCfg.MmapDirPath.GetValue())\n\t}\n\n\tvar status C.CStatus\n\tGetDynamicPool().Submit(func() (any, error) {\n\t\tstatus = C.LoadFieldData(s.ptr, loadFieldDataInfo.cLoadFieldDataInfo)\n\t\treturn nil, nil\n\t}).Await()\n\tif err := HandleCStatus(&status, \"LoadMultiFieldData failed\"); err != nil {\n\t\treturn err\n\t}\n\n\tlog.Info(\"load mutil field done\",\n\t\tzap.Int64(\"row count\", rowCount),\n\t\tzap.Int64(\"segmentID\", s.ID()))\n\n\treturn nil\n}", "title": "" }, { "docid": "61caf9eb30770a728f23570a67c3d634", "score": "0.580385", "text": "func (c Conn) FetchMany(model interface{}, ids []string) error {\n\tslice := reflect.ValueOf(model).Elem()\n\telementType := slice.Type().Elem()\n\tvalues := make([]reflect.Value, len(ids))\n\n\tfor i, id := range ids {\n\t\tpointer := reflect.New(elementType).Interface()\n\n\t\terr := c.Fetch(pointer, id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvalues[i] = reflect.Indirect(reflect.ValueOf(pointer))\n\t}\n\n\tslice.Set(reflect.Append(slice, values...))\n\n\treturn nil\n}", "title": "" }, { "docid": "ccc0366d4ed950f80512c91ba0b8e779", "score": "0.57294244", "text": "func (s *MovingFunctionStorage) fetchByIDs(\n\tctx context.Context,\n\tids []string,\n\topts storage.FetchOptions,\n) (*storage.FetchResult, error) {\n\tif s.Bootstrap == nil && s.Values == nil && s.OriginalValues == nil && len(s.ExplicitBootstraps) == 0 {\n\t\treturn storage.NewFetchResult(ctx, nil, block.NewResultMetadata()), nil\n\t}\n\n\tvar (\n\t\tseriesList = make([]*ts.Series, 0, len(ids))\n\t\tvalues = make([]float64, 0, len(s.Bootstrap)+len(s.Values))\n\t\tstep = s.StepMillis\n\t)\n\tfor _, bootstrap := range s.ExplicitBootstraps {\n\t\tif !opts.StartTime.Equal(bootstrap.Start) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif v := bootstrap.StepMillis; v > 0 {\n\t\t\tstep = v\n\t\t}\n\t\tfor _, elem := range bootstrap.Values {\n\t\t\tseries := ts.NewSeries(ctx, elem.Name, opts.StartTime,\n\t\t\t\tNewTestSeriesValues(ctx, step, elem.Values))\n\t\t\tseriesList = append(seriesList, series)\n\t\t}\n\t\treturn storage.NewFetchResult(ctx, seriesList, block.NewResultMetadata()), nil\n\t}\n\n\tif opts.StartTime.Equal(s.BootstrapStart) {\n\t\tvalues = append(values, s.Bootstrap...)\n\t\tvalues = append(values, s.Values...)\n\t} else {\n\t\tif s.OriginalValues != nil {\n\t\t\tfor _, elem := range s.OriginalValues {\n\t\t\t\tseries := ts.NewSeries(ctx, elem.Name, opts.StartTime,\n\t\t\t\t\tNewTestSeriesValues(ctx, step, elem.Values))\n\t\t\t\tseriesList = append(seriesList, series)\n\t\t\t}\n\t\t\treturn storage.NewFetchResult(ctx, seriesList, block.NewResultMetadata()), nil\n\t\t}\n\n\t\tvalues = append(values, s.Values...)\n\t}\n\n\tfor _, id := range ids {\n\t\tseries := ts.NewSeries(ctx, id, opts.StartTime,\n\t\t\tNewTestSeriesValues(ctx, step, values))\n\t\tseriesList = append(seriesList, series)\n\t}\n\n\treturn storage.NewFetchResult(ctx, seriesList, block.NewResultMetadata()), nil\n}", "title": "" }, { "docid": "e8502c4e9cd8d19a2dca80429ff65970", "score": "0.5621819", "text": "func (wk *Worker) read_mult_inputs(ids []Split) ([]interface{}, bool, []string) {\n everything := make([]interface{}, 0)\n missing := make([]string, 0)\n success := true\n // try reading all the splits\n for _, id := range ids {\n arr, exist := wk.read_split(id.Hostname, id.SplitID)\n if !exist {\n success = false\n missing = append(missing, id.SplitID)\n }\n if !success {\n continue\n }\n for _, line := range arr {\n everything = append(everything, line)\n }\n }\n if !success { // some splits missing, return their ids\n return nil, false, missing\n } else { // all splits exist, return merged contents\n return everything, true, nil\n }\n}", "title": "" }, { "docid": "44ce1423b4675844c6dd167717b173e0", "score": "0.56105936", "text": "func (c *redisCache) MultiGet(ctx context.Context, keys []string, value interface{}) error {\n\tif len(keys) == 0 {\n\t\treturn nil\n\t}\n\tcacheKeys := make([]string, len(keys))\n\tfor index, key := range keys {\n\t\tcacheKey, err := BuildCacheKey(c.KeyPrefix, key)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"BuildCacheKey error: %v, key=%s\", err, key)\n\t\t}\n\t\tcacheKeys[index] = cacheKey\n\t}\n\tvalues, err := c.client.MGet(ctx, cacheKeys...).Result()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"c.client.MGet error: %v, keys=%+v\", err, cacheKeys)\n\t}\n\n\t// 通过反射注入到map\n\tvalueMap := reflect.ValueOf(value)\n\tfor i, v := range values {\n\t\tif v == nil {\n\t\t\tcontinue\n\t\t}\n\t\tobject := c.newObject()\n\t\terr = encoding.Unmarshal(c.encoding, []byte(v.(string)), object)\n\t\tif err != nil {\n\t\t\t//logger.Warnf(\"unmarshal data error: %+v, key=%s, cacheKey=%s type=%v\", err, keys[i], cacheKeys[i], reflect.TypeOf(value))\n\t\t\tcontinue\n\t\t}\n\t\tvalueMap.SetMapIndex(reflect.ValueOf(cacheKeys[i]), reflect.ValueOf(object))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a9b820cfb0cfbf972b34bfd337bb74dd", "score": "0.55983204", "text": "func (bc *MemoryCache) GetMulti( keys []string,values []interface{}) (err error) {\n\tif(values==nil){\n return errors.New(\"val is unkown interface!!!\")\n }\n\tkeysErr := make([]string, 0)\n\tvar value interface{}\n\tfor _, ki := range keys {\n\t\terr = bc.Get( ki,value)\n\t\tif err != nil {\n\t\t\tkeysErr = append(keysErr, fmt.Sprintf(\"key [%s] error: %s\", ki, err.Error()))\n\t\t\tcontinue\n\t\t}\n\t\tvalues = append(values, value)\n\t}\n\n\tif len(keysErr) == 0 {\n\t\treturn nil\n\t}\n\treturn errors.New(strings.Join(keysErr, \"; \"))\n}", "title": "" }, { "docid": "a8fefe7099768eb1d63473d99fcea45c", "score": "0.55505705", "text": "func (g *God) Loads(pkvs ...interface{}) ([]Model, error) {\n\tif len(g.Model.PK) != 1 {\n\t\treturn nil, Err_invalid_pk_for_load\n\t}\n\n\tif len(pkvs) < 1 {\n\t\treturn []Model{}, nil\n\t}\n\n\treturn g.NewStatement().On(E_in(g.Model.PK[0].Column, pkvs)).Multi()\n}", "title": "" }, { "docid": "14658929170d452946ba2d6a3b474dbd", "score": "0.5488853", "text": "func (c *BoltDB) GetMulti(keys []string) map[string]interface{} {\n\tpanic(\"implement me\")\n}", "title": "" }, { "docid": "200208300239ee9135c4dc15d52fa967", "score": "0.541942", "text": "func (c *Client) GetMulti(ctx context.Context, keys []*datastore.Key, dst interface{}) error {\n\t// Get runtime value of dst.\n\tdVal := reflect.ValueOf(dst)\n\n\t// Get type of dst.\n\tdstType := reflect.TypeOf(dst)\n\n\t// Get string of dst type.\n\tdstName := dstType.String()\n\n\t// Make sure dst is of the coorect type and length.\n\tif dVal.Kind() != reflect.Slice {\n\t\treturn errors.New(\"godscache.Client.GetMulti: dst must be a slice of structs or struct pointers\")\n\t}\n\n\tif dstName == \"datastore.PropertyList\" {\n\t\treturn errors.New(\"godscache.Client.GetMulti: dst must not be a datastore.PropertyList\")\n\t}\n\n\tif len(keys) != dVal.Len() {\n\t\treturn errors.New(\"godscache.Client.GetMulti: keys and dst must be the same length\")\n\t}\n\n\t// Make some new data structures to hold keys and results.\n\tuncachedKeys := make([]*datastore.Key, 0)\n\tresultsMap := make(map[string]interface{}, len(keys))\n\n\t// Batch get items from cache.\n\terr := c.getMultiFromCache(keys, dst)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"godscache.Client.GetMulti: failed getting multiple items from cache: %v\", err)\n\t}\n\n\t// log.Printf(\"godscache.Client.GetMulti: got multiple results from cache: %+v\", dst)\n\n\t// For each key.\n\tfor idx, key := range keys {\n\t\t// Check if we're missing the value because it wasn't in the cache.\n\t\tdVal2 := dVal.Index(idx)\n\t\tif (dVal2.Kind() == reflect.Ptr && dVal2.IsNil()) || dVal2.Kind() == reflect.Struct {\n\t\t\t// Add the key to the list of uncached keys, so we can use it below to request the Datastore.\n\t\t\tuncachedKeys = append(uncachedKeys, key)\n\t\t} else {\n\t\t\t// If the value was in the cache, add it to the results map.\n\t\t\tresultsMap[key.String()] = dVal2.Interface()\n\t\t}\n\t}\n\n\t// If there are any uncached keys, use them for a batch datastore lookup.\n\tif len(uncachedKeys) > 0 {\n\t\t// log.Printf(\"godscache.Client.GetMulti: number of cache misses: %v\", len(uncachedKeys))\n\n\t\t// Make a new dynamic slice to hold the uncached results, that's the same length as the\n\t\t// uncached keys slice.\n\t\tdsResultsSlice := reflect.MakeSlice(dstType, len(uncachedKeys), len(uncachedKeys))\n\n\t\t// Make the slice addressable.\n\t\tdsResults := reflect.New(dstType).Elem()\n\t\tdsResults.Set(dsResultsSlice)\n\n\t\t// log.Printf(\"godscache.Client.GetMulti: dsResults type: %v\", dsResults.Type().String())\n\n\t\t// Get the uncached data from the datastore.\n\t\terr := c.Parent.GetMulti(ctx, uncachedKeys, dsResults.Interface())\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"godscache.Client.GetMulti: failed getting multiple values from datastore: %v\", err)\n\t\t}\n\n\t\t// log.Printf(\"godscache.Client.GetMulti: dsResults: %+v\", dsResults.Interface())\n\n\t\t// Add the data to the results map, and to the cache.\n\t\tfor idx, key := range uncachedKeys {\n\t\t\tkeyStr := key.String()\n\n\t\t\tres := dsResults.Index(idx).Interface()\n\t\t\tresultsMap[keyStr] = res\n\n\t\t\terr = c.addToCache(key, res)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"godscache.Client.GetMulti: failed adding item to cache: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Copy the results to dst in the correct order.\n\tfor idx, key := range keys {\n\t\tkeyStr := key.String()\n\t\tval, ok := resultsMap[keyStr]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"godscache.Client.GetMulti: expected item not found in results map\")\n\t\t}\n\t\tdVal.Index(idx).Set(reflect.ValueOf(val))\n\t}\n\n\t// log.Printf(\"godscache.Client.GetMulti: results: %+v\", dst)\n\n\treturn nil\n}", "title": "" }, { "docid": "fec1aa4274ee928c0376779ab316f69c", "score": "0.5409808", "text": "func EvalAllIDs(src *Col, result *map[uint64]struct{}) (err error) {\n\tresultMutex := &sync.Mutex{}\n\tcollectIDs := func(id uint64, _ map[string]interface{}) bool {\n\t\tresultMutex.Lock()\n\t\t(*result)[id] = struct{}{}\n\t\tresultMutex.Unlock()\n\t\treturn true\n\t}\n\tsrc.ForAll(collectIDs)\n\treturn\n}", "title": "" }, { "docid": "42def747c48ba0247df4cb286cfbce94", "score": "0.5395214", "text": "func (this DmnElements) load(t interface{}, cval int) (error) {\n\n\tvar tag, id string\n\n\tswitch obj := t.(type) {\n\n\tcase *Dmn:\n\n\t\tif em, err := toMap(t); err != nil {\n\t\t\treturn err\n\t\t} else {\n\t\t\treturn this.load(em, cval)\n\t\t}\n\n\tcase map[string]interface{}:\n\n\t\ttm := make(map[string]interface{})\n\n\t\tfor name, value := range obj {\n\n\t\t\tswitch obj := value.(type) {\n\n\t\t\tcase string:\n\n\t\t\t\tif name == `id` {\n\t\t\t\t\tid = obj\n\t\t\t\t} else {\n\t\t\t\t\ttm[name] = value\n\t\t\t\t}\n\n\t\t\tcase map[string]interface{}:\n\n\t\t\t\tif name == `xmlName` {\n\t\t\t\t\ttag = obj[`Local`].(string)\n\t\t\t\t} else if err := this.load(obj, cval); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\tdefault:\n\n\t\t\t\tif err := this.load(obj, cval); 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 tag == `` || id == `` {\n\t\t\treturn fmt.Errorf(`missing Tag and Id`)\n\t\t}\n\n\t\tfor name, value := range tm {\n\t\t\tel := DmnElement{tag, id, name, value.(string)}\n\t\t\tthis[el] += cval\n\t\t}\n\n\tcase []interface{}:\n\n\t\tfor _, value := range obj {\n\t\t\tif err := this.load(value, cval); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\tdefault:\n\t\treturn fmt.Errorf(`unsupported type %T`, t)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c5315bbc6faac861ce38cbdf82503325", "score": "0.53745544", "text": "func EvalAllIDs(src *Col, result *map[int]struct{}) (err error) {\n\tsrc.forEachDoc(func(id int, _ []byte) bool {\n\t\t(*result)[id] = struct{}{}\n\t\treturn true\n\t}, false)\n\treturn\n}", "title": "" }, { "docid": "b3e6646268c035c95143ca35728c6cd3", "score": "0.5369622", "text": "func (m *MMSplitStorage) FetchMany(splitNames []string) map[string]*dtos.SplitDTO {\n\tm.mutex.RLock()\n\tdefer m.mutex.RUnlock()\n\tsplits := make(map[string]*dtos.SplitDTO)\n\tfor _, splitName := range splitNames {\n\t\tsplits[splitName] = m._get(splitName)\n\t}\n\treturn splits\n}", "title": "" }, { "docid": "587733c8480dbf8e91e7eb292bd10b38", "score": "0.5349864", "text": "func (o *LoadOperation) getDocuments(results interface{}) error {\n\t// results must be map[string]*struct\n\tm := reflect.ValueOf(results)\n\tif m.Type().Kind() != reflect.Map {\n\t\treturn fmt.Errorf(\"results should be a map[string]*struct, is %s. tp: %s\", m.Type().String(), m.Type().String())\n\t}\n\tmapKeyType := m.Type().Key()\n\tif mapKeyType != stringType {\n\t\treturn fmt.Errorf(\"results should be a map[string]*struct, is %s. tp: %s\", m.Type().String(), m.Type().String())\n\t}\n\tmapElemPtrType := m.Type().Elem()\n\tif mapElemPtrType.Kind() != reflect.Ptr {\n\t\treturn fmt.Errorf(\"results should be a map[string]*struct, is %s. tp: %s\", m.Type().String(), m.Type().String())\n\t}\n\tmapElemType := mapElemPtrType.Elem()\n\tif mapElemType.Kind() != reflect.Struct {\n\t\treturn fmt.Errorf(\"results should be a map[string]*struct, is %s. tp: %s\", m.Type().String(), m.Type().String())\n\t}\n\n\tuniqueIds := StringArrayCopy(o._ids)\n\tStringArrayRemove(&uniqueIds, \"\")\n\tuniqueIds = StringArrayRemoveDuplicatesNoCase(uniqueIds)\n\tfor _, id := range uniqueIds {\n\t\tv, err := o.getDocumentWithIDOld(mapElemPtrType, id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tkey := reflect.ValueOf(id)\n\t\tv2 := reflect.ValueOf(v)\n\t\tm.SetMapIndex(key, v2)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9d5cfff7f53fab63a4ea521e4f25b018", "score": "0.53497195", "text": "func (r *RedisDriver) GetMulti(cveIDs []string) (cveDetails map[string]*models.CveDetail) {\n\tvar err error\n\tcveDetails = map[string]*models.CveDetail{}\n\tpipe := r.conn.Pipeline()\n\trs := map[string]*redis.StringStringMapCmd{}\n\tfor _, cveID := range cveIDs {\n\t\trs[cveID] = pipe.HGetAll(hashKeyPrefix + cveID)\n\t}\n\tif _, err = pipe.Exec(); err != nil {\n\t\tif err != redis.Nil {\n\t\t\tlog.Errorf(\"Failed to get multi cve json. err : %s\", err)\n\t\t\treturn cveDetails\n\t\t}\n\t}\n\n\tfor cveID, result := range rs {\n\t\tjvn := models.Jvn{\n\t\t\tReferences: []models.Reference{},\n\t\t\tCpes: []models.Cpe{},\n\t\t}\n\t\tif j, ok := result.Val()[\"Jvn\"]; ok {\n\t\t\tif err = json.Unmarshal([]byte(j), &jvn); err != nil {\n\t\t\t\tlog.Errorf(\"Failed to Unmarshal json. err : %s\", err)\n\t\t\t}\n\t\t}\n\n\t\tnvd := models.Nvd{\n\t\t\tReferences: []models.Reference{},\n\t\t\tCpes: []models.Cpe{},\n\t\t}\n\t\tif j, ok := result.Val()[\"Nvd\"]; ok {\n\t\t\tif err = json.Unmarshal([]byte(j), &nvd); err != nil {\n\t\t\t\tlog.Errorf(\"Failed to Unmarshal json. err : %s\", err)\n\t\t\t}\n\t\t}\n\n\t\tcveDetail := &models.CveDetail{\n\t\t\tCveID: cveID,\n\t\t\tNvd: nvd,\n\t\t\tJvn: jvn,\n\t\t}\n\t\tcveDetails[cveID] = cveDetail\n\t}\n\treturn cveDetails\n}", "title": "" }, { "docid": "c760410ca872dfae5cc44eb6876a9c98", "score": "0.5296866", "text": "func (dao *ContentDao) GetByIds(c context.Context, oid int64, rpIds []int64) (rcMap map[int64]*reply.Content, err error) {\n\tif len(rpIds) == 0 {\n\t\treturn\n\t}\n\trows, err := dao.dbSlave.Query(c, fmt.Sprintf(_selContsSQL, dao.hit(oid), xstr.JoinInts(rpIds)))\n\tif err != nil {\n\t\tlog.Error(\"contentDao.Query error(%v)\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\trcMap = make(map[int64]*reply.Content, len(rpIds))\n\tfor rows.Next() {\n\t\trc := &reply.Content{}\n\t\tif err = rows.Scan(&rc.RpID, &rc.Message, &rc.Ats, &rc.IP, &rc.Plat, &rc.Device, &rc.Topics); err != nil {\n\t\t\tlog.Error(\"row.Scan error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\trcMap[rc.RpID] = rc\n\t}\n\tif err = rows.Err(); err != nil {\n\t\tlog.Error(\"rows.err error(%v)\", err)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "4c58c5f602a054085642bfdaa94e9702", "score": "0.52695674", "text": "func (r *Repo) LoadIDs() {\n\tlog.Println(\"Loading IDs\")\n\tr.bindings = readSlabsFromDB(r.db)\n}", "title": "" }, { "docid": "012aa6a1192307608a28fc4dd9f0e643", "score": "0.5255392", "text": "func (d *Data) loadProtoIds() error {\n\tcount := d.headerItem.protoIdsSize\n\td.protoIds = make([]protoIdItem, count)\n\n\tif _, err := d.dexFile.Seek(int64(d.headerItem.protoIdsOff), os.SEEK_SET); err != nil {\n\t\treturn err\n\t}\n\n\t// Read the proto ID items.\n\tfor i := 0; i < count; i++ {\n\t\td.protoIds[i] = protoIdItem{}\n\n\t\tshortyIdx, err := d.readInt()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\td.protoIds[i].shortyIdx = shortyIdx\n\n\t\treturnTypeIdx, err := d.readInt()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\td.protoIds[i].returnTypeIdx = returnTypeIdx\n\n\t\tparametersOff, err := d.readInt()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\td.protoIds[i].parametersOff = parametersOff\n\t}\n\n\t// Go back through and read the type lists.\n\tfor _, protoId := range d.protoIds {\n\t\toffset := protoId.parametersOff\n\n\t\tif offset == 0 {\n\t\t\tprotoId.types = make([]int16, 0)\n\t\t\tcontinue\n\t\t}\n\n\t\tif _, err := d.dexFile.Seek(int64(offset), os.SEEK_SET); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tsize, err := d.readInt() // #of entries in list\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tprotoId.types = make([]int16, size)\n\n\t\tfor j := 0; j < size; j++ {\n\t\t\tt, err := d.readShort()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tprotoId.types[j] = t\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c7b616e679e7861c4d7c9afd01cac6ff", "score": "0.5253391", "text": "func (m *Manager) GetMulti(keys []string) map[string]interface{} {\n\treturn m.Default().GetMulti(keys)\n}", "title": "" }, { "docid": "4414b46da9c8e836a033c33165f01d7c", "score": "0.52237827", "text": "func (c *CoinloreAPI) FetchAll(ids []string) ([]types.LoreData, error) {\n\ttype CryptoJSON struct {\n\t\tID string `json:\"id\"`\n\t\tName string `json:\"name\"`\n\t\tPrice string `json:\"price_usd\"`\n\t}\n\n\tvar (\n\t\terr error\n\t\treq *http.Request\n\t\tres *http.Response\n\t\tbody []byte\n\t\tCrypJSON []CryptoJSON\n\t\tDataFromURL []types.LoreData\n\t)\n\n\tfor _, u := range ids {\n\n\t\turl := c.prepareURL(u)\n\n\t\tspaceClient := http.Client{\n\t\t\tTimeout: time.Second * 10,\n\t\t}\n\n\t\tif req, err = http.NewRequest(http.MethodGet, url, nil); err != nil {\n\n\t\t\treturn nil, err\n\t\t}\n\t\tif res, err = spaceClient.Do(req); err != nil {\n\n\t\t\treturn nil, err\n\t\t}\n\t\tif body, err = ioutil.ReadAll(res.Body); err != nil {\n\n\t\t\treturn nil, err\n\t\t}\n\t\tif err = json.Unmarshal(body, &CrypJSON); err != nil {\n\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(CrypJSON) < 1 {\n\n\t\t\treturn DataFromURL, err\n\t\t}\n\t\tp, _ := strconv.ParseFloat(CrypJSON[0].Price, 64)\n\n\t\tDataFromURL = append(DataFromURL, types.LoreData{\n\t\t\tID: CrypJSON[0].ID,\n\t\t\tName: CrypJSON[0].Name,\n\t\t\tPrice: p,\n\t\t})\n\t}\n\n\treturn DataFromURL, err\n}", "title": "" }, { "docid": "de6fd83aef88a7fd97d3edb809d073be", "score": "0.52143866", "text": "func (l *register) resolve(ids interface{}, typ reflect.Type) (reflect.Value, error) {\n\tif reflect.TypeOf(ids).Kind() != reflect.Slice {\n\t\treturn reflect.Value{}, errors.New(\"ids must be a slice\")\n\t}\n\n\n\tresolvers, ok := l.resolvers[typ]\n\tif !ok {\n\t\tif resolvers, ok = l.resolvers[reflect.PtrTo(typ)]; !ok {\n\t\t\treturn reflect.Value{}, fmt.Errorf(\"no resolvers found for %v\", typ.String())\n\t\t}\n\t}\n\n\tfn, ok := resolvers[reflect.TypeOf(ids).Elem()]\n\tif !ok {\n\t\treturn reflect.Value{}, fmt.Errorf(\"no resolvers found for %v with key type %v\", typ.String(), reflect.TypeOf(ids).Elem().String())\n\t}\n\n\tldr := &loader{*l, nil}\n\tvals, err := fn(context.TODO(), ldr, ids)\n\tif err != nil {\n\t\treturn reflect.Value{}, err\n\t}\n\tif err := ldr.execute(); err != nil {\n\t\treturn reflect.Value{}, err\n\t}\n\n\trefVals := reflect.ValueOf(vals)\n\tif refVals.Len() != reflect.ValueOf(ids).Len() {\n\t\treturn reflect.Value{}, errors.New(\"not all items found\")\n\t}\n\n\treturn refVals, nil\n}", "title": "" }, { "docid": "51d39497079dd42b350c9a66827c1a61", "score": "0.5212066", "text": "func LoadDataflowValues(uuid string)(data map[string]map[string]string, err error){\n data, err = node.LoadDataflowValues(uuid)\n changecontrol.ChangeControlInsertData(err, \"LoadDataflowValues\")\n return data, err\n}", "title": "" }, { "docid": "ff6ecbeae92352462e9ef7bb313b308b", "score": "0.52088183", "text": "func (d *Data) loadFieldIds() error {\n\tcount := d.headerItem.fieldIdsSize\n\td.fieldIds = make([]fieldIdItem, count)\n\n\tif _, err := d.dexFile.Seek(int64(d.headerItem.fieldIdsOff), os.SEEK_SET); err != nil {\n\t\treturn err\n\t}\n\n\tfor i := 0; i < count; i++ {\n\t\td.fieldIds[i] = fieldIdItem{}\n\n\t\tclassIdx, err := d.readShort()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\td.fieldIds[i].classIdx = classIdx\n\n\t\ttypeIdx, err := d.readShort()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\td.fieldIds[i].typeIdx = typeIdx\n\n\t\tnameIdx, err := d.readInt()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\td.fieldIds[i].nameIdx = nameIdx\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0242866e77a9c05d69298fab743aa755", "score": "0.5194295", "text": "func (volumeL) LoadRecords(e boil.Executor, singular bool, maybeVolume interface{}) error {\n\tvar slice []*Volume\n\tvar object *Volume\n\n\tcount := 1\n\tif singular {\n\t\tobject = maybeVolume.(*Volume)\n\t} else {\n\t\tslice = *maybeVolume.(*VolumeSlice)\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 = &volumeR{}\n\t\t}\n\t\targs[0] = object.ID\n\t} else {\n\t\tfor i, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &volumeR{}\n\t\t\t}\n\t\t\targs[i] = obj.ID\n\t\t}\n\t}\n\n\tquery := fmt.Sprintf(\n\t\t\"select * from \\\"record\\\" where \\\"volume\\\" in (%s)\",\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),\n\t)\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 record\")\n\t}\n\tdefer results.Close()\n\n\tvar resultSlice []*Record\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice record\")\n\t}\n\n\tif len(recordAfterSelectHooks) != 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\tif singular {\n\t\tobject.R.Records = resultSlice\n\t\treturn nil\n\t}\n\n\tfor _, foreign := range resultSlice {\n\t\tfor _, local := range slice {\n\t\t\tif local.ID == foreign.Volume {\n\t\t\t\tlocal.R.Records = append(local.R.Records, foreign)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a836999db40782178da9a67755311398", "score": "0.5185893", "text": "func Load(uri ...string) ([]*Tileset, error) {\n\tres := make([]*Tileset, len(uri))\n\tfor i, u := range uri {\n\t\tel, err := loadOne(u)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres[i] = el\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "7d1cb5b7f30d3cf6626a72bad8e11091", "score": "0.5179954", "text": "func LoadAllByIDs(ctx context.Context, db gorp.SqlExecutor, ids []int64) (sdk.Workflows, error) {\n\tif len(ids) == 0 {\n\t\treturn []sdk.Workflow{}, nil\n\t}\n\tvar dao WorkflowDAO\n\tdao.Filters.WorkflowIDs = ids\n\treturn dao.LoadAll(ctx, db)\n}", "title": "" }, { "docid": "cd25559ec3195d34ca67d6915faae70f", "score": "0.51624817", "text": "func ModelLoadMap(model Model, data map[string]interface{}) error {\n\tfor k, v := range data {\n\t\tmodelField, err := ModelGetField(model, field.NewNameFromSnakeCase(k))\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\terr = modelField.Scan(v)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "76a34b37a67d76e3953ad2c1ffcb784a", "score": "0.51523596", "text": "func (vInfo *ListValues) loadValues() error {\n\tvar err error\n\tif vInfo.query.Mask == \"*\" {\n\t\terr = vInfo.loadUnmaskedValues()\n\t} else {\n\t\terr = vInfo.loadMaskedValues()\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "073d1a1174146de8a32e64e9f757d13d", "score": "0.5123034", "text": "func (c *Client) getMultiFromCache(keys []*datastore.Key, dst interface{}) error {\n\tif c.MemcacheClient == nil {\n\t\treturn nil\n\t}\n\n\t// Make the key strings slice, for use with memcache's get multi function.\n\tkeyStrs := make([]string, 0, len(keys))\n\tfor _, key := range keys {\n\t\tkeyStrs = append(keyStrs, key.String())\n\t}\n\n\t// Batch get the data from memcached.\n\titems, err := c.MemcacheClient.GetMulti(keyStrs)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"godscache.Client.getMultiFromCache: failed getting multiple items from memcached: %v\", err)\n\t}\n\n\t// Get the runtime value of dst.\n\tdVal := reflect.ValueOf(dst)\n\n\t// Insert the data into dst. It will skip inserting in positions where data wasn't found\n\t// in the cache, leaving those spots nil.\n\tfor idx, key := range keys {\n\t\t// Check if data is cached, and if so, get it out of the cache.\n\t\tkeyStr := key.String()\n\t\titem, cached := items[keyStr]\n\t\tif cached {\n\t\t\t// Create a new runtime value which can be unmarshalled into.\n\t\t\tdVal2 := reflect.New(reflect.TypeOf(dst).Elem())\n\t\t\terr = json.Unmarshal(item.Value, dVal2.Interface())\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"godscache.Client.getMultiFromCache: failed unmarshaling cached data from JSON: %v\", err)\n\t\t\t}\n\n\t\t\t// Copy the data into dst.\n\t\t\tdVal.Index(idx).Set(dVal2.Elem())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "459ba14e5ebaab926002bac248178bee", "score": "0.51224124", "text": "func LoadAllByProjectIDs(ctx context.Context, db gorp.SqlExecutor, projectIDs []int64) (sdk.Workflows, error) {\n\tquery := gorpmapping.NewQuery(`\n SELECT *\n FROM workflow\n WHERE project_id = ANY(string_to_array($1, ',')::int[])\n `).Args(gorpmapping.IDsToQueryString(projectIDs))\n\treturn getAll(ctx, db, query)\n}", "title": "" }, { "docid": "1647c82080186dcfa1b867802b543a80", "score": "0.5121694", "text": "func getLocations(ids []int64) (map[int64]*pb.Location, error) {\n\t// Deduplicate IDs\n\tids = deduplicateIDs(ids)\n\n\tresponse := make(map[int64]*pb.Location)\n\tsuccess := make(chan CachedLocation)\n\tfailure := make(chan error)\n\toutstandingRequests := len(ids)\n\tfailed := false\n\n\tfor _, id := range ids {\n\t\tgo getLocationAsync(id, success, failure)\n\t}\n\n\tfor outstandingRequests > 0 {\n\t\tselect {\n\t\tcase location := <-success:\n\t\t\tresponse[location.ID] = &location.Location\n\t\tcase err := <-failure:\n\t\t\tlogrus.Warn(err.Error())\n\t\t\tfailed = true\n\t\t}\n\n\t\toutstandingRequests--\n\t}\n\n\tif failed {\n\t\treturn response, errors.New(\"could not fetch all locations\")\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "122410cf1b55184bf6612aa7fa6c418c", "score": "0.51123965", "text": "func (groupLogL) LoadGroupLogItems(ctx context.Context, e boil.ContextExecutor, singular bool, maybeGroupLog interface{}, mods queries.Applicator) error {\n\tvar slice []*GroupLog\n\tvar object *GroupLog\n\n\tif singular {\n\t\tobject = maybeGroupLog.(*GroupLog)\n\t} else {\n\t\tslice = *maybeGroupLog.(*[]*GroupLog)\n\t}\n\n\targs := make([]interface{}, 0, 1)\n\tif singular {\n\t\tif object.R == nil {\n\t\t\tobject.R = &groupLogR{}\n\t\t}\n\t\targs = append(args, object.ID)\n\t} else {\n\tOuter:\n\t\tfor _, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &groupLogR{}\n\t\t\t}\n\n\t\t\tfor _, a := range args {\n\t\t\t\tif a == obj.ID {\n\t\t\t\t\tcontinue Outer\n\t\t\t\t}\n\t\t\t}\n\n\t\t\targs = append(args, obj.ID)\n\t\t}\n\t}\n\n\tif len(args) == 0 {\n\t\treturn nil\n\t}\n\n\tquery := NewQuery(qm.From(`group_log_items`), qm.WhereIn(`group_log_items.group_log_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 group_log_items\")\n\t}\n\n\tvar resultSlice []*GroupLogItem\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice group_log_items\")\n\t}\n\n\tif err = results.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to close results in eager load on group_log_items\")\n\t}\n\tif err = results.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"error occurred during iteration of eager loaded relations for group_log_items\")\n\t}\n\n\tif len(groupLogItemAfterSelectHooks) != 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\tif singular {\n\t\tobject.R.GroupLogItems = resultSlice\n\t\tfor _, foreign := range resultSlice {\n\t\t\tif foreign.R == nil {\n\t\t\t\tforeign.R = &groupLogItemR{}\n\t\t\t}\n\t\t\tforeign.R.GroupLog = object\n\t\t}\n\t\treturn nil\n\t}\n\n\tfor _, foreign := range resultSlice {\n\t\tfor _, local := range slice {\n\t\t\tif local.ID == foreign.GroupLogID {\n\t\t\t\tlocal.R.GroupLogItems = append(local.R.GroupLogItems, foreign)\n\t\t\t\tif foreign.R == nil {\n\t\t\t\t\tforeign.R = &groupLogItemR{}\n\t\t\t\t}\n\t\t\t\tforeign.R.GroupLog = local\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "815c78c2fb6c655af4f7138e2c9769f0", "score": "0.5109065", "text": "func load(c ssmiface.SSMAPI, f []*field) error {\n\tplain, decrypt := partitionFields(f, func(x *field) bool {\n\t\treturn x.decrypt\n\t})\n\terr := batchIterateFields(plain, maxParameters, func(f []*field) error {\n\t\treturn loadParameters(c, f, false)\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn batchIterateFields(decrypt, maxParameters, func(f []*field) error {\n\t\treturn loadParameters(c, f, true)\n\t})\n}", "title": "" }, { "docid": "56280d92578f7f6299165fab8e8ffcb0", "score": "0.5105159", "text": "func (s *GaeSetting) load() map[string]map[string]string {\n\tall := make(map[string]map[string]string)\n\n\ttype SI struct {\n\t\tSite string\n\t\tName string\n\t\tValue string\n\t}\n\tvar entities []SI\n\n\tq := datastore.NewQuery(\"Setting\").Limit(1000)\n\t_, err := s.client.GetAll(s.ctx, q, &entities)\n\tif err != nil {\n\t\t// Handle error\n\t\tfmt.Println(err)\n\t\treturn nil\n\t}\n\tif len(entities) == 1000 {\n\t\tfmt.Println(\"Too many entities in settings table. Settings will not operate reliably.\")\n\t}\n\n\tfor _, e := range entities {\n\t\t_, exists := all[e.Site]\n\t\tif !exists {\n\t\t\tall[e.Site] = make(map[string]string)\n\t\t}\n\t\tall[e.Site][e.Name] = e.Value\n\t}\n\n\treturn all\n}", "title": "" }, { "docid": "aea30634d0fe01dfff6017199271cf41", "score": "0.5093874", "text": "func LoadSummaries(db *database.DB, pageMap map[string]*Page) error {\n\tif len(pageMap) <= 0 {\n\t\treturn nil\n\t}\n\tpageIDs := PageIDsListFromMap(pageMap)\n\n\trows := database.NewQuery(`\n\t\tSELECT pageId,name,text\n\t\tFROM pageSummaries\n\t\tWHERE pageId IN`).AddArgsGroup(pageIDs).ToStatement(db).Query()\n\terr := rows.Process(func(db *database.DB, rows *database.Rows) error {\n\t\tvar pageID string\n\t\tvar name, text string\n\t\terr := rows.Scan(&pageID, &name, &text)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to scan: %v\", err)\n\t\t}\n\t\tpageMap[pageID].Summaries[name] = text\n\t\treturn nil\n\t})\n\treturn err\n}", "title": "" }, { "docid": "b09c0fe515b4ae62bb1ad80a1461cd3a", "score": "0.50862175", "text": "func (c *client) MultiRead(ctx context.Context, fieldsToRead []string, entities ...DomainObject) (MultiResult, error) {\n\tif !c.initialized {\n\t\treturn nil, &ErrNotInitialized{}\n\t}\n\n\tif len(entities) == 0 {\n\t\treturn nil, fmt.Errorf(\"the number of entities to read is zero\")\n\t}\n\n\t// lookup registered entity, the registrar will return error if it is not found\n\tvar re *RegisteredEntity\n\tvar listFieldValues []map[string]FieldValue\n\tfor _, entity := range entities {\n\t\tere, err := c.registrar.Find(entity)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif re == nil {\n\t\t\tre = ere\n\t\t} else if re != ere {\n\t\t\treturn nil, fmt.Errorf(\"inconsistent entity type for multi read: %v vs %v\", re, ere)\n\t\t}\n\n\t\t// translate entity field values to a map of primary key name/values pairs\n\t\t// required to perform a read\n\t\tlistFieldValues = append(listFieldValues, re.KeyFieldValues(entity))\n\t}\n\n\t// build a list of column names from a list of entities field names\n\tcolumnsToRead, err := re.ColumnNames(fieldsToRead)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresults, err := c.connector.MultiRead(ctx, re.EntityInfo(), listFieldValues, columnsToRead)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmultiResult := MultiResult{}\n\t// map results to entity fields\n\tfor i, entity := range entities {\n\t\tif results[i].Error != nil {\n\t\t\tmultiResult[entity] = results[i].Error\n\t\t\tcontinue\n\t\t}\n\t\tre.SetFieldValues(entity, results[i].Values, columnsToRead)\n\t}\n\n\treturn multiResult, nil\n}", "title": "" }, { "docid": "8dd284ae31e2e7a552fbec1f5ec0e0af", "score": "0.5085034", "text": "func (r *RedisSplitStorage) FetchMany(features []string) map[string]*dtos.SplitDTO {\n\tkeysToFetch := make([]string, 0)\n\tfor _, feature := range features {\n\t\tkeysToFetch = append(keysToFetch, strings.Replace(redisSplit, \"{split}\", feature, 1))\n\t}\n\trawSplits, err := r.client.Mget(keysToFetch)\n\n\tif err != nil {\n\t\tr.logger.Error(fmt.Sprintf(\"Could not fetch features from redis: %s\", err.Error()))\n\t\treturn nil\n\t}\n\n\tsplits := make(map[string]*dtos.SplitDTO)\n\tfor idx, feature := range features {\n\t\tvar split *dtos.SplitDTO\n\t\trawSplit, ok := rawSplits[idx].(string)\n\t\tif ok {\n\t\t\terr = json.Unmarshal([]byte(rawSplit), &split)\n\t\t\tif err != nil {\n\t\t\t\tr.logger.Error(\"Could not parse feature \\\"%s\\\" fetched from redis\", feature)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tsplits[feature] = split\n\t}\n\n\treturn splits\n}", "title": "" }, { "docid": "d5112278af2a3fd5f4d728dbf8a47af7", "score": "0.50826955", "text": "func (categoryL) LoadRecords(e boil.Executor, singular bool, maybeCategory interface{}) error {\n\tvar slice []*Category\n\tvar object *Category\n\n\tcount := 1\n\tif singular {\n\t\tobject = maybeCategory.(*Category)\n\t} else {\n\t\tslice = *maybeCategory.(*CategorySlice)\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 = &categoryR{}\n\t\t}\n\t\targs[0] = object.ID\n\t} else {\n\t\tfor i, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &categoryR{}\n\t\t\t}\n\t\t\targs[i] = obj.ID\n\t\t}\n\t}\n\n\tquery := fmt.Sprintf(\n\t\t\"select * from \\\"record\\\" where \\\"category\\\" in (%s)\",\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),\n\t)\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 record\")\n\t}\n\tdefer results.Close()\n\n\tvar resultSlice []*Record\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice record\")\n\t}\n\n\tif len(recordAfterSelectHooks) != 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\tif singular {\n\t\tobject.R.Records = resultSlice\n\t\treturn nil\n\t}\n\n\tfor _, foreign := range resultSlice {\n\t\tfor _, local := range slice {\n\t\t\tif local.ID == foreign.Category {\n\t\t\t\tlocal.R.Records = append(local.R.Records, foreign)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "413c38da25baa865522edde07b41fc67", "score": "0.5082201", "text": "func (db *DB) SelectMulti(s string, args ...interface{}) ([]map[string]string, error) {\n\trows, err := db.Query(s, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tm, err := readRows(rows)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "f2f83f2f555d975453de9a37d3de234a", "score": "0.5078332", "text": "func GetValues(\n\tp singleValueProvider,\n\tids ...string,\n) (map[string]ProviderResponse, error) {\n\tresponses := map[string]ProviderResponse{}\n\n\tfor _, id := range ids {\n\t\tif _, ok := responses[id]; ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tpr := ProviderResponse{}\n\t\tpr.Value, pr.Error = p.GetValue(id)\n\n\t\tresponses[id] = pr\n\t}\n\n\treturn responses, nil\n}", "title": "" }, { "docid": "49e50dc6ada0f0e9936b400c915d4d90", "score": "0.507717", "text": "func LoadDivisions(db *gorm.DB) *sync.Map {\n\tvar r []Divisions\n\n\t// Get all records and check error.\n\tcheckErr(db.Find(&r).Error)\n\n\t// Store records in sync.Map.\n\tm := &sync.Map{}\n\tfor _, v := range r {\n\t\tm.Store(v.DivisionCode, v)\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "69e6d37945d6c416a7a203eb13196bff", "score": "0.5057569", "text": "func (d *Data) loadTypeIds() error {\n\tcount := d.headerItem.typeIdsSize\n\td.typeIds = make([]typeIdItem, count)\n\n\tif _, err := d.dexFile.Seek(int64(d.headerItem.typeIdsOff), os.SEEK_SET); err != nil {\n\t\treturn err\n\t}\n\n\tfor i := 0; i < count; i++ {\n\t\td.typeIds[i] = typeIdItem{}\n\n\t\tdescriptorIdx, err := d.readInt()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\td.typeIds[i].descriptorIdx = descriptorIdx\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "db722d997ed0f7ca7e8fb0ab17c855ba", "score": "0.5055304", "text": "func ExecuteLoadPipeline(db *database.DB, data *CommonHandlerData) error {\n\tu := data.User\n\tpageMap := data.PageMap\n\tuserMap := data.UserMap\n\tmasteryMap := data.MasteryMap\n\tpageObjectMap := data.PageObjectMap\n\tmarkMap := data.MarkMap\n\n\t// Load comments\n\tfilteredPageMap := filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Comments })\n\terr := LoadCommentIDs(db, u, pageMap, &LoadDataOptions{ForPages: filteredPageMap})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadCommentIds for failed: %v\", err)\n\t}\n\n\t// Load questions\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Questions })\n\terr = LoadChildIDs(db, pageMap, u, &LoadChildIdsOptions{\n\t\tForPages: filteredPageMap,\n\t\tType: QuestionPageType,\n\t\tPagePairType: ParentPagePairType,\n\t\tLoadOptions: IntrasitePopoverLoadOptions,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadChildIds for questions failed: %v\", err)\n\t}\n\n\t// Load explanations\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Explanations })\n\terr = LoadExplanations(db, data, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadExplanationIds failed: %v\", err)\n\t}\n\n\t// Load children\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Children })\n\terr = LoadChildIDs(db, pageMap, u, &LoadChildIdsOptions{\n\t\tForPages: filteredPageMap,\n\t\tType: WikiPageType,\n\t\tPagePairType: ParentPagePairType,\n\t\tLoadOptions: TitlePlusLoadOptions,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadChildIds for children failed: %v\", err)\n\t}\n\n\t// Load parents\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Parents })\n\terr = LoadParentIDs(db, pageMap, u, &LoadParentIdsOptions{\n\t\tForPages: filteredPageMap,\n\t\tPagePairType: ParentPagePairType,\n\t\tLoadOptions: TitlePlusLoadOptions,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadParentIds for parents failed: %v\", err)\n\t}\n\n\t// Load tags\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Tags })\n\terr = LoadParentIDs(db, pageMap, u, &LoadParentIdsOptions{\n\t\tForPages: filteredPageMap,\n\t\tPagePairType: TagPagePairType,\n\t\tLoadOptions: TitlePlusLoadOptions,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadParentIds for tags failed: %v\", err)\n\t}\n\n\t// Load related\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Related })\n\terr = LoadChildIDs(db, pageMap, u, &LoadChildIdsOptions{\n\t\tForPages: filteredPageMap,\n\t\tType: WikiPageType,\n\t\tPagePairType: TagPagePairType,\n\t\tLoadOptions: TitlePlusLoadOptions,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadChildIds for related failed: %v\", err)\n\t}\n\n\t// Load available lenses\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Lenses })\n\terr = LoadLensesForPages(db, data, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadLensesForPages failed: %v\", err)\n\t}\n\n\t// Load path pages\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Path })\n\terr = LoadPathForPages(db, data, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadPathForPages failed: %v\", err)\n\t}\n\n\t// Load requisites\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Requisites })\n\terr = LoadRequisites(db, pageMap, u, &LoadReqsOptions{\n\t\tForPages: filteredPageMap,\n\t\tMasteryMap: masteryMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadRequisites failed: %v\", err)\n\t}\n\n\t// Load domains the pages have been submitted to\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.SubmittedTo })\n\terr = LoadPageToDomainSubmissionsForPages(db, pageMap, userMap, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadPageToDomainSubmissionsForPages failed: %v\", err)\n\t}\n\n\t// Load answers\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Answers })\n\terr = LoadAnswers(db, pageMap, userMap, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadAnswers failed: %v\", err)\n\t}\n\n\tif u.ID != \"\" {\n\t\t// Load user's marks\n\t\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.UserMarks })\n\t\terr = LoadMarkIDs(db, u, pageMap, markMap, &LoadMarkIDsOptions{\n\t\t\tForPages: filteredPageMap,\n\t\t\tCurrentUserConstraint: true,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"LoadMarkIds for user's marks failed: %v\", err)\n\t\t}\n\n\t\t// Load unresolved marks\n\t\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.UnresolvedMarks })\n\t\terr = LoadMarkIDs(db, u, pageMap, markMap, &LoadMarkIDsOptions{\n\t\t\tForPages: filteredPageMap,\n\t\t\tEditorConstraint: true,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"LoadMarkIds for unresolved marks failed: %v\", err)\n\t\t}\n\n\t\t// Load all marks if forced to\n\t\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.AllMarks })\n\t\terr = LoadMarkIDs(db, u, pageMap, markMap, &LoadMarkIDsOptions{\n\t\t\tForPages: filteredPageMap,\n\t\t\tLoadResolvedToo: true,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"LoadMarkIds for all marks failed: %v\", err)\n\t\t}\n\t}\n\n\t// Load data for all marks in the map\n\terr = LoadMarkData(db, pageMap, userMap, markMap, u)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadMarkData failed: %v\", err)\n\t}\n\n\t// Load links\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Links })\n\terr = LoadLinks(db, u, pageMap, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadLinks failed: %v\", err)\n\t}\n\n\t// Load learn more pages\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.LearnMore })\n\terr = LoadLearnMore(db, u, pageMap, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadLearnMore failed: %v\", err)\n\t}\n\n\t// Load change logs\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.ChangeLogs })\n\terr = LoadChangeLogsForPages(db, u, data, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadChangeLogsForPages failed: %v\", err)\n\t}\n\n\t// Load content requests\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.ContentRequests })\n\terr = LoadContentRequestsForPages(db, u, data, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadContentRequestsForPages failed: %v\", err)\n\t}\n\n\t// Load feed submissions\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.FeedSubmissions })\n\terr = LoadFeedSubmissionsForPages(db, u, data, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadFeedSubmissionsForPages failed: %v\", err)\n\t}\n\n\t// Load search strings\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.SearchStrings })\n\terr = LoadSearchStrings(db, filteredPageMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadSearchStrings failed: %v\", err)\n\t}\n\n\t// Load whether the pages are lenses for other pages\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.LensParentID })\n\terr = LoadLensParentIDs(db, pageMap, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadLensParentIds failed: %v\", err)\n\t}\n\n\t// Load whether or not the pages have an unpublished draft\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.HasDraft })\n\terr = LoadDraftExistence(db, u.ID, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadDraftExistence failed: %v\", err)\n\t}\n\n\t// Load last visit dates\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.LastVisit || p.LoadOptions.SubpageCounts })\n\terr = LoadLastVisits(db, u, filteredPageMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadLastVisits failed: %v\", err)\n\t}\n\n\t// Load subscriptions\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Subscriptions })\n\terr = LoadSubscriptions(db, u.ID, filteredPageMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadSubscriptions failed: %v\", err)\n\t}\n\n\t// Load subpage counts\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.SubpageCounts })\n\terr = LoadSubpageCounts(db, u, filteredPageMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadSubpageCounts failed: %v\", err)\n\t}\n\n\t// Load answer counts\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.AnswerCounts })\n\terr = LoadAnswerCounts(db, filteredPageMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadAnswerCounts failed: %v\", err)\n\t}\n\n\t// Load number of red links.\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.RedLinkCount })\n\terr = LoadRedLinkCount(db, u, filteredPageMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadRedLinkCount failed: %v\", err)\n\t}\n\n\t// Load whether the page is used as a requirement\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.UsedAsMastery })\n\terr = LoadUsedAsMastery(db, filteredPageMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadUsedAsMastery failed: %v\", err)\n\t}\n\n\t// Load pages' creator's ids\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Creators })\n\terr = LoadCreatorIDs(db, u, pageMap, userMap, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadCreatorIds failed: %v\", err)\n\t}\n\n\t// Load pages' edit history\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.EditHistory })\n\terr = LoadEditHistory(db, filteredPageMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadEditHistory failed: %v\", err)\n\t}\n\n\t// Load domain roles for user pages that need it\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.DomainRoles })\n\tfor pageID := range filteredPageMap {\n\t\tif userPage, ok := userMap[pageID]; ok {\n\t\t\terr = LoadUserDomainMembership(db, userPage, data.DomainMap)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"LoadUserDomainMembership failed: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Load all relevant domains\n\terr = LoadRelevantDomains(db, u, pageMap, userMap, data.DomainMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadRelevantDomains failed: %v\", err)\n\t}\n\n\t// Load page data\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return !p.LoadOptions.Edit && !p.LoadOptions.IncludeDeleted })\n\terr = LoadPages(db, u, filteredPageMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadPages failed: %v\", err)\n\t}\n\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return !p.LoadOptions.Edit && p.LoadOptions.IncludeDeleted })\n\terr = LoadPagesWithOptions(db, u, filteredPageMap, PageInfosFilterWithOptions(u, &PageInfosOptions{Deleted: true}))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadPages (deleted) failed: %v\", err)\n\t}\n\n\t// Load votes\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Votes || p.LoadOptions.VoteSummary })\n\terr = LoadVotes(db, u, filteredPageMap, userMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadVotes failed: %v\", err)\n\t}\n\n\t// Load proposal edit number (if any)\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.ProposalEditNum })\n\terr = LoadProposalEditNum(db, filteredPageMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadProposalEditNum failed: %v\", err)\n\t}\n\n\t// Load (dis)likes\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Likes })\n\tindividualLikesPageMap := filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.IndividualLikes })\n\terr = LoadLikesForPages(db, u, filteredPageMap, individualLikesPageMap, userMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadLikesForPages failed: %v\", err)\n\t}\n\n\t// Compute edit permissions\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.DomainsAndPermissions })\n\tComputePermissionsForMap(db.C, u, filteredPageMap, data.DomainMap)\n\n\t// Load summaries\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.Summaries })\n\terr = LoadSummaries(db, filteredPageMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadSummaries failed: %v\", err)\n\t}\n\n\t// Load incoming mark count\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.LinkedMarkCount && p.Type == QuestionPageType })\n\terr = LoadLinkedMarkCounts(db, filteredPageMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadLinkedMarkCounts failed: %v\", err)\n\t}\n\n\t// Load prev/next ids\n\t/*filteredPageMap = filterPageMap(pageMap, func(p *Page) bool {\n\t\treturn p.Type == WikiPageType && p.LoadOptions.NextPrevIds\n\t})\n\terr = LoadNextPrevPageIds(db, u.Id, &LoadDataOptions{\n\t\tForPages: filteredPageMap,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadNextPrevPageIds failed: %v\", err)\n\t}*/\n\n\t// Load page objects\n\tfilteredPageMap = filterPageMap(pageMap, func(p *Page) bool { return p.LoadOptions.PageObjects })\n\terr = LoadPageObjects(db, u, filteredPageMap, pageObjectMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadPageObject failed: %v\", err)\n\t}\n\n\t// Add pages that need a corresponding mastery to the masteryMap\n\tfor _, p := range pageMap {\n\t\tif p.LoadOptions.Mastery {\n\t\t\tmasteryMap[p.PageID] = &Mastery{PageID: p.PageID}\n\t\t}\n\t}\n\n\t// Load what requirements the user has met\n\terr = LoadMasteries(db, u, masteryMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadMasteries failed: %v\", err)\n\t}\n\n\t// Load all the users\n\tAddUserIDToMap(u.ID, userMap)\n\tfor _, p := range pageMap {\n\t\tAddUserIDToMap(p.PageCreatorID, userMap)\n\t\tAddUserIDToMap(p.EditCreatorID, userMap)\n\t\tif IsIDValid(p.LockedBy) {\n\t\t\tAddUserIDToMap(p.LockedBy, userMap)\n\t\t}\n\t}\n\terr = LoadUsers(db, userMap, u.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"LoadUsers failed: %v\", err)\n\t}\n\n\t// Computed which pages count as visited.\n\t// TODO: refactor this code to use multiple-maps insert wrapper\n\tvisitedValues := make([]interface{}, 0)\n\tvisitorID := u.GetSomeID()\n\tif visitorID != \"\" {\n\t\tfor pageID, p := range pageMap {\n\t\t\tif p.LoadOptions.Text {\n\t\t\t\tvisitedValues = append(visitedValues, visitorID, u.SessionID, u.AnalyticsID, db.C.R.RemoteAddr, pageID, database.Now())\n\t\t\t}\n\t\t}\n\t}\n\n\t// Add a visit to pages for which we loaded text.\n\tif len(visitedValues) > 0 {\n\t\tstatement := db.NewStatement(`\n\t\t\tINSERT INTO visits (userId, sessionId, analyticsId, ipAddress, pageId, createdAt)\n\t\t\tVALUES ` + database.ArgsPlaceholder(len(visitedValues), 6))\n\t\tif _, err = statement.Exec(visitedValues...); err != nil {\n\t\t\treturn fmt.Errorf(\"Couldn't update visits: %v\", err)\n\t\t}\n\t}\n\n\t// Update lastVisits table\n\tif IsIDValid(u.ID) {\n\t\thashmaps := make(database.InsertMaps, 0)\n\t\tfor pageID, p := range pageMap {\n\t\t\tif p.LoadOptions.Text {\n\t\t\t\thashmap := make(database.InsertMap)\n\t\t\t\thashmap[\"userId\"] = u.ID\n\t\t\t\thashmap[\"pageId\"] = pageID\n\t\t\t\thashmap[\"createdAt\"] = database.Now()\n\t\t\t\thashmap[\"updatedAt\"] = database.Now()\n\t\t\t\thashmaps = append(hashmaps, hashmap)\n\t\t\t}\n\t\t}\n\t\tif len(hashmaps) > 0 {\n\t\t\tstatement := db.NewMultipleInsertStatement(\"lastVisits\", hashmaps, \"updatedAt\")\n\t\t\tif _, err := statement.Exec(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"Couldn't insert into lastVisits: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "211d9e4f995a589fdb981237fb71d5b4", "score": "0.50347704", "text": "func (rc *Cache) GetMulti(keys []string) []interface{} {\n\tr := rc.c.Get()\n\tdefer r.Close()\n\tvar args []interface{}\n\tfor _, key := range keys {\n\t\targs = append(args, rc.associate(key))\n\t}\n\tvalues, err := redis.Values(r.Do(\"MGET\", args...))\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn values\n}", "title": "" }, { "docid": "ec2b70cf4ad1cec3c3c3013ce659c932", "score": "0.5033403", "text": "func (s *System) Load(ctx context.Context) error {\n\tfor _, resourceIdentifier := range s.resourceIdentifiers {\n\t\tif resourceIdentifier.Name != \"\" {\n\t\t\tobject := &unstructured.Unstructured{}\n\t\t\tobject.SetGroupVersionKind(resourceIdentifier.GroupVersionKind)\n\n\t\t\tif err := s.k8sClient.Get(\n\t\t\t\tctx,\n\t\t\t\ttypes.NamespacedName{Namespace: resourceIdentifier.Namespace, Name: resourceIdentifier.Name},\n\t\t\t\tobject,\n\t\t\t); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"failed to get kubernetes resource\")\n\t\t\t}\n\n\t\t\ts.state[*resourceIdentifier] = object\n\t\t\tcontinue\n\t\t}\n\n\t\tobjects := &unstructured.UnstructuredList{}\n\t\tobjects.SetGroupVersionKind(resourceIdentifier.GroupVersionKind)\n\n\t\tif err := s.k8sClient.List(\n\t\t\tctx,\n\t\t\tobjects,\n\t\t\t&client.ListOptions{Namespace: resourceIdentifier.Namespace},\n\t\t); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to list kubernetes resource\")\n\t\t}\n\n\t\tfor _, object := range objects.Items {\n\t\t\tobject := object\n\t\t\tgv, err := schema.ParseGroupVersion(object.GetAPIVersion())\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"failed to parse group version\")\n\t\t\t}\n\n\t\t\tresIdent := ResourceIdentifier{\n\t\t\t\tGroupVersionKind: schema.GroupVersionKind{\n\t\t\t\t\tGroup: gv.Group,\n\t\t\t\t\tVersion: gv.Version,\n\t\t\t\t\tKind: object.GetKind(),\n\t\t\t\t},\n\t\t\t\tNamespace: object.GetNamespace(),\n\t\t\t\tName: object.GetName(),\n\t\t\t}\n\n\t\t\ts.state[resIdent] = &object\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "387d493a3e6fc01e0fda8366861e811a", "score": "0.50312275", "text": "func (c *RemoteIndexCache) FetchMultiSeries(ctx context.Context, blockID ulid.ULID, ids []storage.SeriesRef) (hits map[storage.SeriesRef][]byte, misses []storage.SeriesRef) {\n\tkeys := make([]string, 0, len(ids))\n\n\tblockIDKey := blockID.String()\n\tfor _, id := range ids {\n\t\tkey := cacheKey{blockIDKey, cacheKeySeries(id), \"\"}.string()\n\t\tkeys = append(keys, key)\n\t}\n\n\t// Fetch the keys from memcached in a single request.\n\tc.seriesRequests.Add(float64(len(ids)))\n\tresults := c.memcached.GetMulti(ctx, keys)\n\tif len(results) == 0 {\n\t\treturn nil, ids\n\t}\n\n\t// Construct the resulting hits map and list of missing keys. We iterate on the input\n\t// list of ids to be able to easily create the list of ones in a single iteration.\n\thits = make(map[storage.SeriesRef][]byte, len(results))\n\tfor i, id := range ids {\n\t\t// Check if the key has been found in memcached. If not, we add it to the list\n\t\t// of missing keys.\n\t\tvalue, ok := results[keys[i]]\n\t\tif !ok {\n\t\t\tmisses = append(misses, id)\n\t\t\tcontinue\n\t\t}\n\n\t\thits[id] = value\n\t}\n\n\tc.seriesHits.Add(float64(len(hits)))\n\treturn hits, misses\n}", "title": "" }, { "docid": "5eed36e95a95d51f040956fe1c84a9dd", "score": "0.50269777", "text": "func LoadAllMapRes() {\n\tostype := runtime.GOOS // 获取系统类型\n\n\tvar splicing = \"\"\n\tif ostype == \"windows\" {\n\t\tsplicing = \"\\\\examples\\\\unity_demo\\\\map_file\\\\\"\n\t} else if ostype == \"linux\" {\n\t\tsplicing = \"/examples/unity_demo/map_file/\"\n\t}\n\n\tvar listpath = \".\" + splicing\n\n\tvar filter gwioutil.FileFilter\n\t_ = filter.GetFileList(listpath, common.Json)\n\n\tgwlog.DebugfE(\"map file load cout[%d]\", len(filter.ListFile))\n\n\tvar m MapInfo\n\tfor _, path := range filter.ListFile {\n\t\terr := m.Init(path)\n\t\tif err != nil {\n\t\t\tgwlog.PanicfE(\"load file err file[%s] [%s]\", path, err.Error())\n\t\t}\n\n\t\tMapBaseInfo[m.Name] = m\n\t\tMapBaseInfoID[m.ID] = m\n\t}\n}", "title": "" }, { "docid": "9ef3fa07b65e3b71425c2cf8a3497c9e", "score": "0.5018517", "text": "func (rc *RecordCollection) ForceLoad(fieldNames ...FieldName) *RecordCollection {\n\trc.CheckExecutionPermission(rc.model.methods.MustGet(\"Load\"))\n\tif rc.query.isEmpty() {\n\t\t// Never load RecordSets without query.\n\t\treturn rc\n\t}\n\tif rc.hasNegIds {\n\t\tlog.Panic(\"Trying to load a memory RecordSet created by New\", \"model\", rc.model, \"ids\", rc.ids)\n\t}\n\tif len(rc.query.groups) > 0 {\n\t\tlog.Panic(\"Trying to load a grouped query\", \"model\", rc.model, \"groups\", rc.query.groups)\n\t}\n\trSet := rc\n\tvar prefetch bool\n\tif !rc.prefetchRC.IsEmpty() && len(rc.ids) > 0 {\n\t\t// We have a prefetch recordSet and our ids are already fetched\n\t\tprefetch = true\n\t\trSet = rc.Union(rc.prefetchRC).WithEnv(rc.Env())\n\t}\n\trSet = rSet.addRecordRuleConditions(rc.env.uid, security.Read)\n\trSet.applyDefaultOrder()\n\n\tfields := make([]FieldName, len(fieldNames))\n\tcopy(fields, fieldNames)\n\tif len(fields) == 0 {\n\t\tfields = rSet.model.fields.storedFieldNames()\n\t}\n\taddNameSearchesToCondition(rSet.model, rSet.query.cond)\n\trSet.applyContexts()\n\tsubFields, _ := rSet.substituteRelatedFields(fields)\n\trSet = rSet.substituteRelatedInQuery()\n\tdbFields := filterOnDBFields(rSet.model, subFields)\n\tquery, args, substs := rSet.query.selectQuery(dbFields)\n\trows := dbQuery(rSet.env.cr.tx, query, args...)\n\tdefer rows.Close()\n\tvar ids []int64\n\tfor rows.Next() {\n\t\tline := make(FieldMap)\n\t\terr := rSet.model.scanToFieldMap(rows, &line, substs)\n\t\tif err != nil {\n\t\t\tlog.Panic(err.Error(), \"model\", rSet.ModelName(), \"fields\", fields)\n\t\t}\n\t\trSet.env.cache.addRecord(rSet.model, line[\"id\"].(int64), line, rc.query.ctxArgsSlug())\n\t\tids = append(ids, line[\"id\"].(int64))\n\t}\n\n\trSet = rSet.withIds(ids)\n\trSet.loadRelationFields(subFields)\n\tif prefetch {\n\t\t*rc = *rSet.Intersect(rc).WithEnv(rc.Env())\n\t\treturn rc\n\t}\n\treturn rSet\n}", "title": "" }, { "docid": "74647d09b50bb3addfb07ba806c9e66c", "score": "0.4993096", "text": "func (ser *MediaService) GetMultiple(\n\tids []int, tx db.Tx, keep func(md *models.Media) bool,\n) ([]*models.Media, error) {\n\tvlist, err := tx.Database().GetMultiple(ids, ser, tx,\n\t\tfunc(m db.Model) bool {\n\t\t\tmd, err := ser.AssertType(m)\n\t\t\tif err != nil {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn keep(md)\n\t\t})\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": "69950c7bc4bb2e5e06a0b96fc5cf6c1e", "score": "0.49894398", "text": "func (c *Collection) getStoredIDsAndValues(starter string, limit int, IDsOnly bool) ([]*ResponseElem, error) {\n\tresponse := make([]*ResponseElem, limit)\n\n\terr := c.store.View(func(txn *badger.Txn) error {\n\t\titer := txn.NewIterator(badger.DefaultIteratorOptions)\n\t\tdefer iter.Close()\n\n\t\tprefix := []byte(c.id[:4] + \"_\")\n\t\tif starter == \"\" {\n\t\t\titer.Seek(prefix)\n\t\t} else {\n\t\t\titer.Seek(append(prefix, []byte(starter)...))\n\t\t}\n\n\t\tcount := 0\n\t\tfor ; iter.Valid(); iter.Next() {\n\t\t\tif !iter.ValidForPrefix(prefix) || count > limit-1 {\n\t\t\t\tresponse = response[:count]\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tresponseItem := new(ResponseElem)\n\n\t\t\titem := iter.Item()\n\n\t\t\tif item.IsDeletedOrExpired() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tresponseItem.ID = new(idType)\n\t\t\tresponseItem.ID.ID = string(item.Key()[5:])\n\n\t\t\tif !IDsOnly {\n\t\t\t\tvar err error\n\t\t\t\tresponseItem.ContentAsBytes, err = item.ValueCopy(responseItem.ContentAsBytes)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tvar corrupted error\n\t\t\t\tresponseItem.ContentAsBytes, corrupted = c.getAndCheckContent(responseItem.ContentAsBytes)\n\t\t\t\tif corrupted != nil {\n\t\t\t\t\treturn corrupted\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tresponse[count] = responseItem\n\n\t\t\tcount++\n\t\t}\n\n\t\t// Clean the end of the slice if not full\n\t\tresponse = response[:count]\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "f5322508c27dba981c323149422b59c4", "score": "0.49841115", "text": "func (d *Dao) Uids(c context.Context, names []string) (res map[string]int64, err error) {\n\tvar (\n\t\tparam = url.Values{}\n\t\tnamesStr = strings.Join(names, \",\")\n\t\tuidURI = d.c.Host.Manager + _uidsURL\n\t)\n\tparam.Set(\"unames\", namesStr)\n\n\tvar httpRes struct {\n\t\tCode int `json:\"code\"`\n\t\tData map[string]int64 `json:\"data\"`\n\t\tMessage string `json:\"message\"`\n\t}\n\n\terr = d.httpClient.Get(c, uidURI, \"\", param, &httpRes)\n\tif err != nil {\n\t\tlog.Error(\"d.client.Get(%s) error(%v)\", uidURI+\"?\"+param.Encode(), err)\n\t\treturn\n\t}\n\tif httpRes.Code != 0 {\n\t\tlog.Error(\"url(%s) error(%v), code(%d), message(%s)\", uidURI+\"?\"+param.Encode(), err, httpRes.Code, httpRes.Message)\n\t}\n\tres = httpRes.Data\n\treturn\n}", "title": "" }, { "docid": "1ee37bc01319eb90cac6adf8d94924be", "score": "0.4978653", "text": "func (c *Cache) GetMultiple(ns, coll string, keys ...string) ([]*api.Value, error) {\n\tvalues := make([]*api.Value, len(keys))\n\tfor i, key := range keys {\n\t\tvalue, err := c.Get(ns, coll, key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvalues[i] = value\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "d6a02283a2a5afc6fa990b1c86b19200", "score": "0.49724928", "text": "func (m *MemHashStore) Load(id *UUID) ([]byte, error) {\n\tif id == nil {\n\t\treturn nil, ErrNilJobID\n\t}\n\n\t//calculate bucket\n\thead := binary.LittleEndian.Uint32(id[0:4])\n\tslot := int(head) % len(m.buckets)\n\n\t//lock the corresponding bucket\n\tm.locks[slot].Lock()\n\t//load the item\n\th, exists := m.buckets[slot][*id]\n\t//unlock the corresponding bucket\n\tm.locks[slot].Unlock()\n\n\tif !exists {\n\t\treturn nil, nil\n\t}\n\treturn h, nil\n}", "title": "" }, { "docid": "34559d6dd4cdc2718f702c89f0edcdb3", "score": "0.4968992", "text": "func LoadAllNamesByProjectIDs(_ context.Context, db gorp.SqlExecutor, projectIDs []int64) ([]sdk.WorkflowName, error) {\n\tquery := `\n SELECT workflow.*, project.projectkey\n\tFROM workflow\n\tJOIN project ON project.id = workflow.project_id\n WHERE project_id = ANY($1)`\n\n\tvar result []sdk.WorkflowName // This struct is not registered as a gorpmapping entity so we can't use gorpmapping.Query\n\t_, err := db.Select(&result, query, pq.Int64Array(projectIDs))\n\tif err == sql.ErrNoRows {\n\t\treturn result, nil\n\t}\n\treturn result, sdk.WithStack(err)\n}", "title": "" }, { "docid": "46f3bac9f32373f00a58a732045303fd", "score": "0.49605572", "text": "func loadIds(root string) ([]string, error) {\n\tdirs, err := ioutil.ReadDir(root)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout := []string{}\n\tfor _, d := range dirs {\n\t\tif !d.IsDir() {\n\t\t\tout = append(out, d.Name())\n\t\t}\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "220dfd7a0c703fcce79729fd0c2a31e7", "score": "0.49424592", "text": "func LookupVolumeIds(masterFn GetMasterFn, grpcDialOption grpc.DialOption, vids []string) (map[string]*LookupResult, error) {\n\tret := make(map[string]*LookupResult)\n\tvar unknown_vids []string\n\n\t//check vid cache first\n\tfor _, vid := range vids {\n\t\tlocations, cacheErr := vc.Get(vid)\n\t\tif cacheErr == nil {\n\t\t\tret[vid] = &LookupResult{VolumeOrFileId: vid, Locations: locations}\n\t\t} else {\n\t\t\tunknown_vids = append(unknown_vids, vid)\n\t\t}\n\t}\n\t//return success if all volume ids are known\n\tif len(unknown_vids) == 0 {\n\t\treturn ret, nil\n\t}\n\n\t//only query unknown_vids\n\n\terr := WithMasterServerClient(false, masterFn(), grpcDialOption, func(masterClient master_pb.SeaweedClient) error {\n\n\t\treq := &master_pb.LookupVolumeRequest{\n\t\t\tVolumeOrFileIds: unknown_vids,\n\t\t}\n\t\tresp, grpcErr := masterClient.LookupVolume(context.Background(), req)\n\t\tif grpcErr != nil {\n\t\t\treturn grpcErr\n\t\t}\n\n\t\t//set newly checked vids to cache\n\t\tfor _, vidLocations := range resp.VolumeIdLocations {\n\t\t\tvar locations []Location\n\t\t\tfor _, loc := range vidLocations.Locations {\n\t\t\t\tlocations = append(locations, Location{\n\t\t\t\t\tUrl: loc.Url,\n\t\t\t\t\tPublicUrl: loc.PublicUrl,\n\t\t\t\t\tDataCenter: loc.DataCenter,\n\t\t\t\t\tGrpcPort: int(loc.GrpcPort),\n\t\t\t\t})\n\t\t\t}\n\t\t\tif vidLocations.Error != \"\" {\n\t\t\t\tvc.Set(vidLocations.VolumeOrFileId, locations, 10*time.Minute)\n\t\t\t}\n\t\t\tret[vidLocations.VolumeOrFileId] = &LookupResult{\n\t\t\t\tVolumeOrFileId: vidLocations.VolumeOrFileId,\n\t\t\t\tLocations: locations,\n\t\t\t\tJwt: vidLocations.Auth,\n\t\t\t\tError: vidLocations.Error,\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "4ed57a2388e894348aa06a382b420947", "score": "0.49367368", "text": "func (b *Batch) importValueData() error {\n\tctx := context.Background()\n\n\tshardWidth := uint64(featurebase.ShardWidth)\n\teg := egpool.Group{PoolSize: 20}\n\n\tids := make([]uint64, len(b.ids))\n\tfor fieldName, bvalues := range b.values {\n\t\tids = ids[:len(b.ids)]\n\n\t\t// trim out null values from ids and values.\n\t\tnullIndices := b.nullIndices[fieldName]\n\n\t\ti, n := uint64(0), 0\n\t\tfor _, nullIndex := range nullIndices {\n\t\t\tcopy(ids[n:], b.ids[i:nullIndex])\n\t\t\tn += copy(bvalues[n:], bvalues[i:nullIndex])\n\t\t\ti = nullIndex + 1\n\t\t}\n\n\t\tcopy(ids[n:], b.ids[i:])\n\t\tn += copy(bvalues[n:], bvalues[i:])\n\t\tids, bvalues = ids[:n], bvalues[:n]\n\n\t\t// now do imports by shard\n\t\tif len(ids) == 0 {\n\t\t\tcontinue // TODO test this \"all nil\" case\n\t\t}\n\n\t\tsc := &valsByIDsSortable{ids: ids, vals: bvalues, width: shardWidth}\n\t\tif !sort.IsSorted(sc) {\n\t\t\tsort.Stable(sc) // TODO(jaffee) this was sort.Sort which I think is a bug. If we get multiple of the same record w/in a batch with different int values, the last one needs to win. We need a test for this.\n\t\t}\n\n\t\tcurShard := ids[0] / shardWidth\n\t\tstartIdx := 0\n\t\tfor i := 1; i <= len(ids); i++ {\n\t\t\tvar recordID uint64\n\t\t\tif i < len(ids) {\n\t\t\t\trecordID = ids[i]\n\t\t\t} else {\n\t\t\t\trecordID = (curShard + 2) * shardWidth\n\t\t\t}\n\n\t\t\tif recordID/shardWidth != curShard {\n\t\t\t\tendIdx := i\n\t\t\t\tshard := curShard\n\t\t\t\tfield := b.headerMap[fieldName]\n\t\t\t\tfld := featurebase.FieldInfoToField(field)\n\t\t\t\tpath, data, err := b.importer.EncodeImportValues(ctx, b.tbl.ID, fld, shard, bvalues[startIdx:endIdx], ids[startIdx:endIdx], false)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.Wrap(err, \"encoding import values\")\n\t\t\t\t}\n\t\t\t\teg.Go(func() error {\n\t\t\t\t\tstart := time.Now()\n\t\t\t\t\tfld := featurebase.FieldInfoToField(field)\n\t\t\t\t\terr := b.importer.DoImport(ctx, b.tbl.ID, fld, shard, path, data)\n\t\t\t\t\tb.log.Debugf(\"imp-vals field: %s, shard: %d, data: %d %v\", field.Name, shard, len(data), time.Since(start))\n\t\t\t\t\treturn errors.Wrapf(err, \"importing values for field = %s\", field.Name)\n\t\t\t\t})\n\t\t\t\tstartIdx = i\n\t\t\t\tcurShard = recordID / shardWidth\n\t\t\t}\n\t\t}\n\t}\n\terr := eg.Wait()\n\tif err != nil {\n\t\tif pferr := anyCause(ErrPreconditionFailed, eg.Errors()...); pferr != nil {\n\t\t\treturn pferr\n\t\t}\n\t\treturn err\n\t}\n\treturn errors.Wrap(err, \"importing value data\")\n}", "title": "" }, { "docid": "d26baaadce4d60639d260d046daf9b5a", "score": "0.4931535", "text": "func getManyResponceToKeyValue(r io.Reader) (map[string]json.RawMessage, error) {\n\tvar data map[string]map[string]map[string]json.RawMessage\n\tif err := json.NewDecoder(r).Decode(&data); err != nil {\n\t\treturn nil, fmt.Errorf(\"decoding response: %w\", err)\n\t}\n\n\tkeyValue := make(map[string]json.RawMessage)\n\tfor collection, idField := range data {\n\t\tfor id, fieldValue := range idField {\n\t\t\tfor field, value := range fieldValue {\n\t\t\t\tkeyValue[collection+\"/\"+id+\"/\"+field] = value\n\t\t\t}\n\t\t}\n\t}\n\treturn keyValue, nil\n}", "title": "" }, { "docid": "770fd9ecd53a8911a1f9526f9b615476", "score": "0.4929641", "text": "func (vcdClient *VCDClient) ResourcePoolsFromIds(resourcePoolIds []string) ([]*ResourcePool, error) {\n\tif len(resourcePoolIds) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tvar result []*ResourcePool\n\n\t// 1. make sure there are no duplicates in the input IDs\n\tuniqueIds := make(map[string]bool)\n\tvar duplicates []string\n\tfor _, id := range resourcePoolIds {\n\t\t_, seen := uniqueIds[id]\n\t\tif seen {\n\t\t\tduplicates = append(duplicates, id)\n\t\t}\n\t\tuniqueIds[id] = true\n\t}\n\n\tif len(duplicates) > 0 {\n\t\treturn nil, fmt.Errorf(\"duplicate IDs found in input: %v\", duplicates)\n\t}\n\n\t// 2. get all resource pools\n\tresourcePools, err := vcdClient.GetAllResourcePools(nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tutil.Logger.Printf(\"wantedRecords: %v\\n\", resourcePoolIds)\n\t// 3. build a map of resource pools, indexed by ID, for easy search\n\tvar foundRecords = make(map[string]*ResourcePool)\n\n\tfor _, rpr := range resourcePools {\n\t\tfoundRecords[rpr.ResourcePool.Moref] = rpr\n\t}\n\n\t// 4. loop through the requested IDs\n\tfor wanted := range uniqueIds {\n\t\t// 4.1 if the wanted ID is not found, exit with an error\n\t\tfoundResourcePool, ok := foundRecords[wanted]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"resource pool ID '%s' not found in VCD\", wanted)\n\t\t}\n\t\tresult = append(result, foundResourcePool)\n\t}\n\n\t// 5. Check that we got as many resource pools as the requested IDs\n\tif len(result) != len(uniqueIds) {\n\t\treturn result, fmt.Errorf(\"%d IDs were requested, but only %d found\", len(uniqueIds), len(result))\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "db45e706acd8ecc78a04fb00fa8738da", "score": "0.49196494", "text": "func (c *Cache) BulkGetProfileId(names []string) ([]*entity.ProfileId, error) {\n c.logger.Debugf(\"processing query for profile Ids associated with names %s\", strings.Join(names, \", \"))\n\n ids := make([]*entity.ProfileId, 0)\n at := time.Now()\n\n for i := 0; i < len(names); {\n name := names[i]\n id, err := c.storage.GetProfileId(name, at) // TODO: bulk lookup support in storage backend?\n if err != nil {\n c.logger.Errorf(\"storage backend responded with error: %s\", err)\n continue\n }\n\n if id != nil {\n ids = append(ids, id)\n names = append(names[:i], names[i+1:]...)\n continue\n }\n\n i++\n }\n c.logger.Debugf(\"resolved %d profile Ids from cache, %d will be resolved from upstream\", len(ids), len(names))\n\n if len(names) == 0 {\n c.logger.Debugf(\"query fulfilled using cached data\")\n return ids, nil\n }\n\n c.incrementRequestCounter()\n newIds, err := c.upstream.BulkGetId(names)\n if err != nil {\n return nil, fmt.Errorf(\"upstream responded with error: %s\", err)\n }\n\n for _, id := range newIds {\n err := c.storage.PutProfileId(id) // TODO: bulk upload support in storage backend?\n if err != nil {\n return nil, fmt.Errorf(\"storage backend responded with error: %s\", err)\n }\n\n c.events <- &entity.Event{\n Type: entity.ProfileIdEvent,\n Key: &entity.ProfileIdKey{\n Name: id.Name,\n At: at,\n },\n Object: id,\n }\n }\n\n c.logger.Debugf(\"wrote new data to storage backend\")\n c.logger.Debugf(\"notified event channel\")\n return append(ids, newIds...), nil\n}", "title": "" }, { "docid": "36f16739d8966c8543e32b878f8b7a4a", "score": "0.49187595", "text": "func LoadNetworkValuesSelected(uuid string)(data map[string]map[string]string, err error){\n data, err = node.LoadNetworkValuesSelected(uuid)\n changecontrol.ChangeControlInsertData(err, \"LoadNetworkValuesSelected\")\n return data, err\n}", "title": "" }, { "docid": "6da933378b4aeb791b2d8c62e3cea13d", "score": "0.49122867", "text": "func (db *MongoController) extractManyByIDFromDB(dbName string, collectionName string, pResults interface{}, key string, value interface{}, limit int64) error {\n\tcollection := db.client.Database(dbName).Collection(collectionName)\n\t\n\tfindOptions := options.Find()\n\tfindOptions.SetLimit(limit)\n\n\tfilter := bson.D{{Key: key, Value: value}}\n\n\t// Passing bson.D{{}} as the filter matches all documents in the collection\n\tcur, err := collection.Find(context.Background(), filter, findOptions)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\t// All extract all (subject to limit) from requested query \n\terr = cur.All(context.TODO(), pResults)\n\tif err != nil {\n\t\t// handle error\n\t}\n\t\n\treturn err\n}", "title": "" }, { "docid": "3b4d5aa1bfc6e9d134c47440e33f3d7d", "score": "0.49109328", "text": "func LoadMasteries(db *database.DB, u *CurrentUser, masteryMap map[string]*Mastery) error {\n\tuserID := u.GetSomeID()\n\tif userID == \"\" {\n\t\treturn nil\n\t}\n\n\trows := database.NewQuery(`\n\t\tSELECT masteryId,updatedAt,has,wants,level\n\t\tFROM userMasteryPairs\n\t\tWHERE userId=?`, userID).ToStatement(db).Query()\n\terr := rows.Process(func(db *database.DB, rows *database.Rows) error {\n\t\tvar mastery Mastery\n\t\terr := rows.Scan(&mastery.PageID, &mastery.UpdatedAt, &mastery.Has, &mastery.Wants, &mastery.Level)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to scan for mastery: %v\", err)\n\t\t}\n\t\tmasteryMap[mastery.PageID] = &mastery\n\t\treturn nil\n\t})\n\treturn err\n}", "title": "" }, { "docid": "d5ce5f5bdd1a12262cebfb653c533e09", "score": "0.49047917", "text": "func TOIDReadByLIds(lids []uint32) ([]record.TOIDRecord, error) {\n\tresult := []record.TOIDRecord{}\n\tfor _, lid := range lids {\n\t\tr, err := TOIDReadByLId(lid)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult = append(result, r)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "4bfcedff05908b0909f556ca7b37d37b", "score": "0.49007186", "text": "func getFieldsFromMap(d interface{}) (*models.Data, error) {\n\ts := reflect.ValueOf(d)\n\tif s.Kind() == reflect.Ptr {\n\t\td = s.Elem().Interface()\n\t}\n\trawData := d.(map[string]interface{})\n\tresp := models.NewData()\n\tid, ok := rawData[\"id\"]\n\tif !ok {\n\t\treturn nil, &noIDError{err: \"id is not defined\"}\n\t}\n\tresp.PrimaryKey = id\n\tfor key, value := range rawData {\n\t\tresp.AddValue(key, value)\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "bc500043238ba985e88d1ae838f6d23b", "score": "0.48989752", "text": "func (recordL) LoadMetrics(e boil.Executor, singular bool, maybeRecord interface{}) error {\n\tvar slice []*Record\n\tvar object *Record\n\n\tcount := 1\n\tif singular {\n\t\tobject = maybeRecord.(*Record)\n\t} else {\n\t\tslice = *maybeRecord.(*RecordSlice)\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 = &recordR{}\n\t\t}\n\t\targs[0] = object.ID\n\t} else {\n\t\tfor i, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &recordR{}\n\t\t\t}\n\t\t\targs[i] = obj.ID\n\t\t}\n\t}\n\n\tquery := fmt.Sprintf(\n\t\t\"select \\\"a\\\".*, \\\"b\\\".\\\"record\\\" from \\\"metric\\\" as \\\"a\\\" inner join \\\"measure_abstract\\\" as \\\"b\\\" on \\\"a\\\".\\\"id\\\" = \\\"b\\\".\\\"metric\\\" where \\\"b\\\".\\\"record\\\" in (%s)\",\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),\n\t)\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 metric\")\n\t}\n\tdefer results.Close()\n\n\tvar resultSlice []*Metric\n\n\tvar localJoinCols []int\n\tfor results.Next() {\n\t\tone := new(Metric)\n\t\tvar localJoinCol int\n\n\t\terr = results.Scan(&one.ID, &one.Category, &one.Name, &one.Release, &one.Type, &one.Options, &one.Assumed, &one.Description, &one.Required, &localJoinCol)\n\t\tif err = results.Err(); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to plebian-bind eager loaded slice metric\")\n\t\t}\n\n\t\tresultSlice = append(resultSlice, one)\n\t\tlocalJoinCols = append(localJoinCols, localJoinCol)\n\t}\n\n\tif err = results.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to plebian-bind eager loaded slice metric\")\n\t}\n\n\tif len(metricAfterSelectHooks) != 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\tif singular {\n\t\tobject.R.Metrics = resultSlice\n\t\treturn nil\n\t}\n\n\tfor i, foreign := range resultSlice {\n\t\tlocalJoinCol := localJoinCols[i]\n\t\tfor _, local := range slice {\n\t\t\tif local.ID == localJoinCol {\n\t\t\t\tlocal.R.Metrics = append(local.R.Metrics, foreign)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f7ada3559cd22f36dad4bd4a765375c8", "score": "0.4895492", "text": "func (r *recipeUsecase) fetchByIdsHelper(ids []string) ([]*models.Recipe, error) {\n\t//Make separate channels to receive responses and errors\n\trespc, errc := make(chan *models.Recipe), make(chan error)\n\t//For all ids passed, start a goroutine which contacts the repository layer and fetches the recipe\n\tfor _, id := range ids {\n\t\tgo func(idToFetch string) {\n\t\t\tbody, err := r.recipeRepo.FetchByID(idToFetch)\n\t\t\tif err != nil {\n\t\t\t\terrc <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\trespc <- body\n\t\t}(id)\n\t}\n\n\trecipes := []*models.Recipe{}\n\n\t//Receive the response/error in the channels\n\tfor range ids {\n\t\tselect {\n\t\tcase resp := <-respc:\n\t\t\trecipes = append(recipes, resp)\n\t\tcase err := <-errc:\n\t\t\tfmt.Println(\"Response Error : \", err)\n\t\t\t//If response is 404, ignore. Else, return error to delivery layer.\n\t\t\tif err.Error() != \"Not found\" {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn recipes, nil\n}", "title": "" }, { "docid": "9452d890dc60b4178d73ee77b2567b11", "score": "0.48898724", "text": "func HGetMultipleFields(conn int, cKeys, cFields []string) *map[string](map[string]([]byte)) {\n\tpipe := redisClient.Pipeline()\n\tlengthKeys := len(cKeys)\n\tcmds := make([](*redis.SliceCmd), lengthKeys)\n\tfor i := 0; i < lengthKeys; i++ {\n\t\tcKey := cKeys[i]\n\t\tcmds[i] = pipe.HMGet(cKey, cFields...)\n\t}\n\n\tpipe.Exec()\n\n\tresults := make(map[string](map[string]([]byte)))\n\ttotalFields := len(cFields)\n\tfor i := 0; i < lengthKeys; i++ {\n\t\titem := make(map[string]([]byte))\n\t\tvalues := cmds[i].Val()\n\t\tfor j := 0; j < totalFields; j++ {\n\t\t\tfield := cFields[j]\n\t\t\tswitch v := values[j].(type) {\n\t\t\tcase int:\n\t\t\t\titem[field] = values[j].([]byte)\n\t\t\tcase string:\n\t\t\t\titem[field] = []byte(values[j].(string))\n\t\t\tcase nil:\n\t\t\t\titem[field] = nil\n\t\t\tdefault:\n\t\t\t\tfmt.Printf(\"I don't know about type %T!\\n\", v)\n\t\t\t}\n\t\t}\n\t\tresults[cKeys[i]] = item\n\t}\n\treturn &results\n}", "title": "" }, { "docid": "bb87531166d6f485f030f2697896aacc", "score": "0.4887954", "text": "func (udc *Fuego) LoadFieldIds(kvreader store.KVReader) (fieldIds uint16s, err error) {\n\t// TODO: Replace the FieldRow iterator by instead accessing the\n\t// index.FieldCache, which doesn't currently have a public API to\n\t// grab all the fieldId's.\n\tif kvreader == nil {\n\t\tkvreader, err = udc.store.Reader()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer kvreader.Close()\n\t}\n\n\tfieldRow := FieldRow{}\n\n\tit := kvreader.PrefixIterator(FieldRowPrefix)\n\n\tk, v, valid := it.Current()\n\tfor valid {\n\t\terr := fieldRow.ParseKV(k, v)\n\t\tif err != nil {\n\t\t\tit.Close()\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfieldIds = append(fieldIds, fieldRow.index)\n\n\t\tit.Next()\n\t\tk, v, valid = it.Current()\n\t}\n\n\tit.Close()\n\n\tsort.Sort(fieldIds)\n\n\treturn fieldIds, nil\n}", "title": "" }, { "docid": "f0cf91f9bdce766d77648d8f506a7cda", "score": "0.48861063", "text": "func (recordL) LoadSlotRecords(e boil.Executor, singular bool, maybeRecord interface{}) error {\n\tvar slice []*Record\n\tvar object *Record\n\n\tcount := 1\n\tif singular {\n\t\tobject = maybeRecord.(*Record)\n\t} else {\n\t\tslice = *maybeRecord.(*RecordSlice)\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 = &recordR{}\n\t\t}\n\t\targs[0] = object.ID\n\t} else {\n\t\tfor i, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &recordR{}\n\t\t\t}\n\t\t\targs[i] = obj.ID\n\t\t}\n\t}\n\n\tquery := fmt.Sprintf(\n\t\t\"select * from \\\"slot_record\\\" where \\\"record\\\" in (%s)\",\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),\n\t)\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 slot_record\")\n\t}\n\tdefer results.Close()\n\n\tvar resultSlice []*SlotRecord\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice slot_record\")\n\t}\n\n\tif len(slotRecordAfterSelectHooks) != 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\tif singular {\n\t\tobject.R.SlotRecords = resultSlice\n\t\treturn nil\n\t}\n\n\tfor _, foreign := range resultSlice {\n\t\tfor _, local := range slice {\n\t\t\tif local.ID == foreign.Record {\n\t\t\t\tlocal.R.SlotRecords = append(local.R.SlotRecords, foreign)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7042f8e61e3bc6bb148696228bab6b4e", "score": "0.4875651", "text": "func LoadPageIDs(rows *database.Rows, pageMap map[string]*Page, loadOptions *PageLoadOptions) ([]string, error) {\n\tids := []string{}\n\terr := rows.Process(func(db *database.DB, rows *database.Rows) error {\n\t\tvar pageID string\n\t\terr := rows.Scan(&pageID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to scan a pageId: %v\", err)\n\t\t}\n\n\t\tAddPageToMap(pageID, pageMap, loadOptions)\n\t\tids = append(ids, pageID)\n\t\treturn nil\n\t})\n\treturn ids, err\n}", "title": "" }, { "docid": "50e4c7a4b47e205e1e76f0b6a7b28890", "score": "0.48738432", "text": "func LoadChangeLogsByIDs(db *database.DB, ids []string, typeConstraint string) (map[string]*ChangeLog, error) {\n\tchangeLogs := make(map[string]*ChangeLog)\n\tqueryPart := database.NewQuery(`\n\t\t\tWHERE id IN`).AddArgsGroupStr(ids).Add(`\n\t\t\t\tAND type=?`, typeConstraint)\n\terr := LoadChangeLogs(db, queryPart, nil, func(db *database.DB, changeLog *ChangeLog) error {\n\t\tchangeLogs[changeLog.ID] = changeLog\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Couldn't load changeLogs: %v\", err)\n\t}\n\treturn changeLogs, nil\n}", "title": "" }, { "docid": "9ec55d06b583616379bd0c0b2b66d1a8", "score": "0.48651248", "text": "func (c *redisCache) MultiGet(ctx context.Context, keys []string) ([]*cache.Item, error) {\n\tconn := c.farm.AllConn()\n\n\tif len(keys) > cacheMaxListSize {\n\t\tkeys = keys[:cacheMaxListSize]\n\t}\n\n\tarr := []interface{}{}\n\tfor _, v := range keys {\n\t\tarr = append(arr, c.formatKey(v))\n\t}\n\n\t// splat the args..\n\treply, err := cacheMultiGetScript.Do(conn, arr...)\n\n\t// since its of type redis.Error, nil check fails. So always need to check for blank string\n\tif err.Error() != \"\" {\n\t\treturn nil, errors.New(err.Error())\n\t}\n\n\tvar items []*cache.Item\n\tfor _, elements := range reply.([]interface{}) {\n\t\tfor _, e := range elements.([]interface{}) {\n\t\t\tif len(e.([]interface{})) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\titems = append(items, c.unmarshallItem(e.([]interface{})))\n\t\t}\n\t}\n\n\treturn items, nil\n}", "title": "" }, { "docid": "329c6487889ca3bf0821bc007854657a", "score": "0.48638007", "text": "func (r *Record) Load(c <-chan datastore.Property) os.Error {\n\n\t// load the fields\n\tfor f := range c {\n\n\t\tif f.Multiple {\n\n\t\t\t// do we already have this value?\n\t\t\tif r.Fields()[f.Name] == nil {\n\n\t\t\t\t// create a slice to hold these objects\n\t\t\t\tr.Fields()[f.Name] = make([]interface{}, 0, 0)\n\n\t\t\t}\n\n\t\t\t// add this object to the slice\n\t\t\tr.Fields()[f.Name] = reflect.Append(reflect.ValueOf(r.Fields()[f.Name]), reflect.ValueOf(f.Value)).Interface()\n\n\t\t} else {\n\n\t\t\t// load single value\n\t\t\tr.Fields()[f.Name] = f.Value\n\n\t\t}\n\n\t}\n\n\t// no errors\n\treturn nil\n}", "title": "" }, { "docid": "37a6ba54a1b934d1b3e614c7f8afc957", "score": "0.48561686", "text": "func (t *Typed[V]) readAllItems(ctx jsutil.AsyncContext) (map[string]*V, error) {\n\tdata, err := t.store.Get(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvalues := map[string]*V{}\n\tfor k, v := range data {\n\t\tvar tv V\n\t\tif err := vert.ValueOf(v).AssignTo(&tv); err != nil {\n\t\t\tjsutil.LogError(\"failed to parse value %s; dropping\", k)\n\t\t\tcontinue\n\t\t}\n\n\t\tvalues[k] = &tv\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "435e907762b9e7884227af8829a98ffa", "score": "0.4851791", "text": "func (r *recipeUsecase) FetchByIds(ids []string) ([]*models.Recipe, error) {\n\treturn r.fetchByIdsHelper(ids)\n}", "title": "" }, { "docid": "ff451cc9e3172134b5c7be8816f53cbe", "score": "0.48493263", "text": "func (d *Dao) ExtraByIds(c context.Context, ids []int64) (res map[int64]*model.ExtraQst, err error) {\n\tvar rows *sql.Rows\n\tres = make(map[int64]*model.ExtraQst, len(ids))\n\tidStr := xstr.JoinInts(ids)\n\tif rows, err = d.db.Query(c, fmt.Sprintf(_questionExtraByIdsSQL, idStr)); err != nil {\n\t\tlog.Error(\"d.questionExtraByIds.Query error(%v)\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tr := new(model.ExtraQst)\n\t\tif err = rows.Scan(&r.ID, &r.Question, &r.Ans, &r.Status, &r.OriginID, &r.AvID, &r.Source, &r.Ctime, &r.Mtime); err != nil {\n\t\t\tlog.Error(\"row.Scan() error(%v)\", err)\n\t\t\tres = nil\n\t\t\treturn\n\t\t}\n\t\tres[r.ID] = r\n\t}\n\terr = rows.Err()\n\treturn\n}", "title": "" }, { "docid": "e288cd26425fb2bddf63129d4422fb0e", "score": "0.48485", "text": "func LoadByID(ctx context.Context, id string, m Datastorer) error {\n\tkey, err := datastore.DecodeKey(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn LoadByKey(ctx, key, m)\n}", "title": "" }, { "docid": "2a4d02ebc201b524fcc8169711e60d41", "score": "0.48423547", "text": "func (cache *AINN) Loads(inputString [][]byte, _ ...interface{}) {\n\tvar curRecord DumpRecord\n\tvar curRecordInfo DumpInfo\n\n\tfor _, record := range inputString {\n\t\tbuffer := record[:len(record)-1]\n\t\tjson.Unmarshal(buffer, &curRecord)\n\t\tjson.Unmarshal([]byte(curRecord.Info), &curRecordInfo)\n\t\tswitch curRecordInfo.Type {\n\t\tcase \"FILES\":\n\t\t\tvar curFile files.Stats\n\t\t\tjson.Unmarshal([]byte(curRecord.Data), &curFile)\n\t\t\tqueue.Insert(cache.files, &curFile)\n\t\t\tcache.size += curFile.Size\n\t\tcase \"STATS\":\n\t\t\tjson.Unmarshal([]byte(curRecord.Data), &cache.stats.Data)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6b4e1d702b6fe55d4d307761e39f960b", "score": "0.48367643", "text": "func (e *Client) MultiGet(ctx context.Context, keys ...string) (map[string][]byte, error) {\n\n\ttxn := e.client.Txn(ctx)\n\tops := make([]clientv3.Op, len(keys))\n\tfor i, k := range keys {\n\t\tops[i] = clientv3.OpGet(e.KeyWithRootPath(k))\n\t}\n\ttxn.Then(ops...)\n\tresp, err := txn.Commit()\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tvalues := make(map[string][]byte, len(resp.Responses))\n\tfor _, r := range resp.Responses {\n\t\tif len(r.GetResponseRange().Kvs) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tk := string(r.GetResponseRange().Kvs[0].Key)\n\t\tprefix := e.rootPath\n\t\tif !strings.HasSuffix(prefix, \"/\") {\n\t\t\tprefix = prefix + \"/\"\n\t\t}\n\t\tk = strings.TrimPrefix(k, prefix)\n\t\tvalues[k] = r.GetResponseRange().Kvs[0].Value\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "5bb133e32f3bab06c50085e9b71e7954", "score": "0.48274183", "text": "func (a *ItemCat) LoadItems(idCat string) int {\n\tresp, err := http.Get(\"https://api.mercadolibre.com/sites/MLA/search?category=\" + idCat)\n\tif err != nil {\n\t\ta.data = \"\"\n\t\treturn 1\n\t}\n\tresp_body, err := ioutil.ReadAll(resp.Body)\n\tif err != nil || resp.StatusCode != 200 {\n\t\ta.data = \"\"\n\t\treturn 1\n\t}\n\ta.data = string(resp_body)\n\treturn 0\n}", "title": "" }, { "docid": "be1201e0021a9d83e1738da47b921d5f", "score": "0.48260415", "text": "func (dto *GetIPv4PoolCollectionResponse) Load(m *base.CollectionModel) error {\n\tdto.Start = m.Start\n\tdto.Count = m.Count\n\tdto.Total = m.Total\n\tdto.Members = make([]base.CollectionMemberResponseInterface, 0)\n\tfor _, v := range m.Members {\n\t\tmember := IPv4PoolCollectionMember{}\n\t\tif err := member.Load(v); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdto.Members = append(dto.Members, &member)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "187e95e16d665e82c05348c4a6db4f2e", "score": "0.4825708", "text": "func (rc *RecordCollection) loadRelatedRecords(fields []FieldName) {\n\tvar toLoad []FieldName\n\n\t// load contexted fields default value\n\tif rc.query.ctxArgsSlug() != \"\" {\n\t\tfor _, field := range fields {\n\t\t\texprs := splitFieldNames(field, ExprSep)\n\t\t\tif len(exprs) <= 1 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !rc.env.cache.checkIfInCache(rc.model, rc.ids, []string{field.JSON()}, \"\", true) {\n\t\t\t\ttoLoad = append(toLoad, field)\n\t\t\t}\n\t\t}\n\t\tif len(toLoad) > 0 {\n\t\t\trc.WithContext(\"hexya_default_contexts\", true).Load(toLoad...)\n\t\t}\n\t}\n\t// Load contexted fields with rc's context\n\ttoLoad = []FieldName{}\n\tfor _, field := range fields {\n\t\texprs := splitFieldNames(field, ExprSep)\n\t\tif len(exprs) <= 1 {\n\t\t\tcontinue\n\t\t}\n\t\tif !rc.env.cache.checkIfInCache(rc.model, rc.ids, []string{field.JSON()}, rc.query.ctxArgsSlug(), true) {\n\t\t\ttoLoad = append(toLoad, field)\n\t\t}\n\t}\n\t// Load related paths if not loaded already\n\tif len(toLoad) > 0 {\n\t\trc.Call(\"Load\", toLoad)\n\t}\n}", "title": "" }, { "docid": "02f0d425d9f665c48a4c10e60d85cc1e", "score": "0.4824227", "text": "func (dl *DataLoader) Load(key interface{}) Value {\n\treturn dl.LoadMany([]interface{}{\n\t\tkey,\n\t})[0]\n}", "title": "" }, { "docid": "90d2011295353240f9d69ad33c8880f6", "score": "0.48223066", "text": "func (vInfo *SetValues) loadSetValues() error {\n\tconn, err := connector.GetByName(vInfo.key.serverName, vInfo.key.dbNum)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn err\n\t}\n\n\tvar (\n\t\tvalues []string\n\t)\n\n\tr, err := conn.Do(\"SMEMBERS\", vInfo.key.key)\n\tvalues, err = redis.Strings(r, err)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn err\n\t}\n\toffsetStart, offsetEnd, err := rd.GetPageRangeForStrings(values, vInfo.query.PageSize, vInfo.query.PageNum)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tvaluesPageStrings := values[offsetStart:offsetEnd]\n\n\tvaluesPage := make([]RedisValue, len(valuesPageStrings))\n\tmaskedValuesCount := 0\n\tpageIndex := 0\n\tfor i, s := range values {\n\t\tmatchesMask := matchStringValueWithMask(s, vInfo.query.Mask)\n\t\tif matchesMask && i >= offsetStart && i <= offsetEnd {\n\t\t\tvaluesPage[pageIndex] = RedisValue{\n\t\t\t\tValue: s,\n\t\t\t\tIsBinary: isBinary(s),\n\t\t\t}\n\t\t\tpageIndex++\n\t\t}\n\n\t\tif matchesMask {\n\t\t\tmaskedValuesCount++\n\t\t}\n\n\t}\n\n\tvInfo.values = valuesPage\n\tvInfo.totalValuesCount = maskedValuesCount\n\treturn nil\n}", "title": "" }, { "docid": "f18fdce6075bec063e60514d0e98ddb6", "score": "0.482021", "text": "func (s *sqlDataStore) GIFsByID(ids []string, limit, offset int) ([]*shared.GIF, int, error) {\n\tdbgifs := []GIF{}\n\tdocumentCount := struct{ Count int }{0}\n\tif err := s.db.Table(\"gifs\").Select(\"COUNT(*) as count\").Where(\"api_id IN (?)\", ids).\n\t\tScan(&documentCount).Error; err != nil {\n\t\treturn nil, 0, fmt.Errorf(\"Error getting gif count by id: %w\", err)\n\t}\n\tif err := s.db.Table(\"gifs\").Where(\"api_id IN (?)\", ids).\n\t\tLimit(limit).Offset(offset).Scan(&dbgifs).Error; err != nil {\n\t\treturn nil, 0, fmt.Errorf(\"Error fetching gif: %w\", err)\n\t}\n\tgifs := []*shared.GIF{}\n\tfor _, gif := range dbgifs {\n\t\tgifs = append(gifs, s.gifToGIF(&gif))\n\t}\n\treturn gifs, documentCount.Count, nil\n}", "title": "" }, { "docid": "851732053461e18cbb8c33f98629fa19", "score": "0.4816593", "text": "func (c *Cache) GetMulti(ctx context.Context, keys []*datastorepb.Key) [][]byte {\n\t_, span := trace.StartSpan(ctx, \"github.com/DeNA/cloud-datastore-interceptor/cache/redis.GetMulti\")\n\tdefer func() { span.End() }()\n\n\tkey := make([]string, len(keys))\n\tfor i, k := range keys {\n\t\tkey[i] = keystr(k)\n\t}\n\n\tvalues, err := c.client.MGet(key...).Result()\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tret := make([][]byte, len(values))\n\tfor i, v := range values {\n\t\tif v != nil {\n\t\t\tret[i] = []byte(v.(string))\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "91bd304d4b5b57b4f22ca0ac79069f3a", "score": "0.48140985", "text": "func TestLoadOK(t *testing.T) {\n\titems := newLoadItems(makeIntItem(\"v\", 1), makeIntItem(\"v\", 2), makeIntItem(\"v\", 3))\n\tvar values stringVals\n\tdyn := &fakeDynPuter{\n\t\tput: func(input *dynamodb.PutItemInput) (*dynamodb.PutItemOutput, error) {\n\t\t\tvalues.Add(aws.StringValue(input.Item[\"v\"].N))\n\t\t\treturn &dynamodb.PutItemOutput{\n\t\t\t\tConsumedCapacity: &dynamodb.ConsumedCapacity{CapacityUnits: aws.Float64(1)},\n\t\t\t}, nil\n\t\t},\n\t}\n\tld := &Loader{\n\t\tDyn: dyn,\n\t\tTableName: \"test-table\",\n\t\tMaxParallel: 2,\n\t\tSource: items,\n\t}\n\n\tdone := make(chan error)\n\tgo func() { done <- ld.Run() }()\n\n\tselect {\n\tcase <-time.After(time.Second):\n\t\tt.Fatal(\"Timed out waiting for Run to complete\")\n\tcase err := <-done:\n\t\tif err != nil {\n\t\t\tt.Error(\"Unexpected error from Run\", err)\n\t\t}\n\t}\n\n\texpected := []string{\"1\", \"2\", \"3\"}\n\tif vals := values.Sorted(); !reflect.DeepEqual(vals, expected) {\n\t\tt.Error(\"Incorrect values sent to Dynamo\", vals)\n\t}\n}", "title": "" }, { "docid": "ae514e8e610b4c6de73c8149848f4061", "score": "0.4809253", "text": "func (p *Parser) readMultiMap(m *map[string][]string) {\n\tfor p.i < len(p.line)-1 {\n\t\tdone, _, key, _, val := p.nextStuff([]string{\":=\"})\n\t\tif done {\n\t\t\treturn\n\t\t}\n\t\tvar list []string\n\t\tif val == \"\" {\n\t\t\tlist = []string{}\n\t\t} else {\n\t\t\tvar err error\n\t\t\tlist, err = StringList(val)\n\t\t\tif err != nil {\n\t\t\t\tp.error(\"Cannot decode '%s': %s.\", val, err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\t(*m)[key] = list\n\t\ttracef(\"Added to mulit map (line %d): key: %v\", p.i, key, list)\n\t}\n}", "title": "" }, { "docid": "352d7c1ffa2da1c7afab3b0bcc335374", "score": "0.48021686", "text": "func (l LoaderFunc) Load(in map[string]interface{}) (out interface{}, errs map[string]error, err error) {\n\tout, errs, err = l(in)\n\treturn\n}", "title": "" }, { "docid": "97b7f4bf4eef0e81231e0dee740cff36", "score": "0.47969288", "text": "func loadFields(ctx context.Context, client *pilosa.InternalClient) (map[fieldKey]*fieldInfo, error) {\n\tindexes, err := client.Schema(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm := make(map[fieldKey]*fieldInfo)\n\tfor _, ii := range indexes {\n\t\tfor _, f := range ii.Fields {\n\t\t\tlog.Printf(\"field: index=%s name=%s type=%s\", ii.Name, f.Name, f.Options.Type)\n\n\t\t\tswitch f.Options.Type {\n\t\t\tcase \"set\", \"mutex\", \"time\":\n\t\t\t\tidentifiers, err := fetchFieldIDs(ctx, client, ii.Name, f.Name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"fetch fields: %w\", err)\n\t\t\t\t} else if len(identifiers.Rows) > 0 || len(identifiers.Keys) > 0 {\n\t\t\t\t\tm[fieldKey{ii.Name, f.Name}] = &fieldInfo{f, identifiers}\n\t\t\t\t}\n\n\t\t\tcase \"int\":\n\t\t\t\tm[fieldKey{ii.Name, f.Name}] = &fieldInfo{info: f}\n\t\t\t}\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "27396a90124db8c464da65e6da1dcb5a", "score": "0.4783941", "text": "func (Snapshot) BatchGet(keys []kv.Key) (map[string][]byte, error) {\n\tterror.Log(errors.New(\"No implemented\"))\n\treturn make(map[string][]byte, 0), nil\n}", "title": "" }, { "docid": "93a69dba20dab5cdb4796855e113b994", "score": "0.47824803", "text": "func TestLoadMultiPartitions(t *testing.T) {\n\tt.Skip(\"Issue: https://github.com/milvus-io/milvus-sdk-go/issues/375\")\n\tctx := createContext(t, time.Second*common.DefaultTimeout)\n\t// connect\n\tmc := createMilvusClient(ctx, t)\n\n\t// create collection and insert [0, nb) into default partition, [nb, nb*2) into new partition\n\tcollName := createDefaultCollection(ctx, t, mc, false, common.DefaultShards)\n\tpartitionName, _, _ := createInsertTwoPartitions(ctx, t, mc, collName, common.DefaultNb)\n\n\t// create index\n\tidx, _ := entity.NewIndexHNSW(entity.L2, 8, 96)\n\tmc.CreateIndex(ctx, collName, common.DefaultFloatVecFieldName, idx, false)\n\n\t// load partition\n\terrLoad := mc.LoadPartitions(ctx, collName, []string{partitionName, common.DefaultPartition}, false)\n\tcommon.CheckErr(t, errLoad, true)\n\n\t//query from nb from partition\n\tqueryIds := entity.NewColumnInt64(common.DefaultIntFieldName, []int64{0, common.DefaultNb})\n\tqueryResultPartition, _ := mc.QueryByPks(ctx, collName, []string{}, queryIds, []string{common.DefaultIntFieldName})\n\tcommon.CheckQueryResult(t, queryResultPartition, []entity.Column{\n\t\tentity.NewColumnInt64(common.DefaultIntFieldName, []int64{common.DefaultNb}),\n\t})\n}", "title": "" }, { "docid": "ed309c08313f45386ee1a041230cafbd", "score": "0.47793803", "text": "func (m *memStore) Batch(operations []spi.Operation) error {\n\tm.Lock()\n\tdefer m.Unlock()\n\n\tfor _, operation := range operations {\n\t\tif operation.Key == \"\" {\n\t\t\treturn errEmptyKey\n\t\t}\n\t}\n\n\tfor _, operation := range operations {\n\t\tif operation.Value == nil {\n\t\t\tdelete(m.db, operation.Key)\n\t\t\tcontinue\n\t\t}\n\n\t\tm.db[operation.Key] = dbEntry{\n\t\t\tvalue: operation.Value,\n\t\t\ttags: operation.Tags,\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7ae875bed4bcf60d3a39586af8e8ab75", "score": "0.47599244", "text": "func (m *Indexer) LookupOpIds(ctx context.Context, ids []uint64) ([]*model.Op, error) {\n\tif len(ids) == 0 {\n\t\treturn nil, nil\n\t}\n\ttable, err := m.Table(model.OpTableKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tops := make([]*model.Op, len(ids))\n\tvar count int\n\terr = table.StreamLookup(ctx, ids, func(r pack.Row) error {\n\t\tif count >= len(ops) {\n\t\t\treturn io.EOF\n\t\t}\n\t\top := &model.Op{}\n\t\tif err := r.Decode(op); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tops[count] = op\n\t\tcount++\n\t\treturn nil\n\t})\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\tif count == 0 {\n\t\treturn nil, model.ErrNoOp\n\t}\n\tops = ops[:count]\n\tm.joinStorage(ctx, ops)\n\treturn ops, nil\n}", "title": "" } ]
ddbacfad114366c50b85b4037e243f27
NewCpu() sets up a new CPU and loads the rom into memory.
[ { "docid": "a9114ad9c5885153b07991399cc4ff90", "score": "0.787314", "text": "func NewCpu(u ui.UI, r []byte, debug bool) *Cpu {\n\tcpu := &Cpu{}\n\tcpu.UI = u\n\tcpu.PC = 0x200\n\tcpu.ShouldDraw = false\n\tcpu.ShouldHalt = false\n\tcpu.Debug = debug\n\tcpu.ClockSpeed = 60\n\tcpu.IndexRegister = 0x0000\n\n\tcpu.LoadRom(r)\n\n\treturn cpu\n}", "title": "" } ]
[ { "docid": "b108fb048c0dad045b28ce07394531d4", "score": "0.7875887", "text": "func New() *Cpu {\n\tc := new(Cpu)\n\treturn c\n}", "title": "" }, { "docid": "16f5667932ffd83be91197db6ce5744b", "score": "0.7393337", "text": "func NewCPU(m *mem.RAM, v *vga.VGA) *CPU {\n\n\t// Create registers\n\tregs := make(map[uint16]uint16)\n\tfor _, n := range dat.RegNamesToNum {\n\t\tregs[n] = 0\n\t}\n\tregs[dat.RegNamesToNum[\"sp\"]] = m.StackMax\n\n\treturn &CPU{\n\t\tMem: m,\n\t\tVGA: v,\n\t\tRegs: regs,\n\t}\n}", "title": "" }, { "docid": "46fe40e9e0452da37bccefdf29ed32f8", "score": "0.73471344", "text": "func New() *CPU {\n\treturn &CPU{\n\t\tpath: \"/sys/devices/system/cpu\",\n\t}\n}", "title": "" }, { "docid": "a8ee79b1029ef3be2b0e9cba237c6e2d", "score": "0.72979546", "text": "func New(mmu mmu.MMU) *CPU {\n\tcpu := &CPU{\n\t\tmmu: mmu,\n\t\topCodeState: newState(),\n\t\trootOC: nextOpCode(),\n\t}\n\tif mmu.HardwareCompat() == consts.GBC {\n\t\tcpu.key1 = &key1Reg{\n\t\t\tmmu: mmu,\n\t\t}\n\t\tmmu.AddIODevice(cpu.key1, consts.AddrKEY1)\n\t}\n\treturn cpu\n}", "title": "" }, { "docid": "187a1824ca5e7cf3672edd3d75297ce9", "score": "0.7158805", "text": "func NewCPU(arch Architecture, m Memory) *CPU {\n\tcpu := &CPU{\n\t\tArch: arch,\n\t\tMem: m,\n\t\tinstSet: GetInstructionSet(arch),\n\t\tstoreByte: (*CPU).storeByteNormal,\n\t}\n\n\tcpu.Reg.Init()\n\treturn cpu\n}", "title": "" }, { "docid": "cedcb69170d13aeaf238ac53014a8615", "score": "0.70311475", "text": "func NewCPU(bus bus.Bus) *CPU {\n\t// TODO: Please check default value after power up.\n\tcpu := &CPU{\n\t\tgpr: reg.NewGPR(),\n\t\tfpr: reg.NewFGR(),\n\t\tpc: 0,\n\t\thi: 0,\n\t\tlo: 0,\n\t\tllBit: false,\n\t\tfcr0: 0,\n\t\tfcr31: 0,\n\t\tbus: bus,\n\t\tpipeline: NewPipeline(bus),\n\t}\n\treturn cpu\n}", "title": "" }, { "docid": "9eeadfebfc746ed6d6201f739448e1ab", "score": "0.7030567", "text": "func NewCPU() *pc.CPU {\n\tbrand := random.CPUBrand()\n\tcores := random.Integer(2, 8)\n\tminGhz := random.Float(2.0, 3.5)\n\n\treturn &pc.CPU{\n\t\tBrand: brand,\n\t\tName: random.CPUName(brand),\n\t\tCores: uint32(cores),\n\t\tThreads: uint32(random.Integer(cores, 12)),\n\t\tMinGhz: minGhz,\n\t\tMaxGhz: random.Float(minGhz, 5.0),\n\t}\n}", "title": "" }, { "docid": "431019c1538b1bf660efcf0a1b1060bb", "score": "0.69947743", "text": "func NewCPU() *CPU {\n\tcpu := CPU{}\n\n\treturn &cpu\n}", "title": "" }, { "docid": "5490b854e7b8ed4e8c0060d3d4ab0e77", "score": "0.69318897", "text": "func (t *System) NewCpu(Index System_Cpu_Index_Union) (*System_Cpu, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Cpu == nil {\n\t\tt.Cpu = make(map[System_Cpu_Index_Union]*System_Cpu)\n\t}\n\n\tkey := Index\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.Cpu[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Cpu\", key)\n\t}\n\n\tt.Cpu[key] = &System_Cpu{\n\t\tIndex: Index,\n\t}\n\n\treturn t.Cpu[key], nil\n}", "title": "" }, { "docid": "f0cee90f24ea8531a2859bd8937a946c", "score": "0.6754524", "text": "func (t *OpenconfigSystem_System_Cpus) NewCpu(Index OpenconfigSystem_System_Cpus_Cpu_State_Index_Union) (*OpenconfigSystem_System_Cpus_Cpu, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Cpu == nil {\n\t\tt.Cpu = make(map[OpenconfigSystem_System_Cpus_Cpu_State_Index_Union]*OpenconfigSystem_System_Cpus_Cpu)\n\t}\n\n\tkey := Index\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.Cpu[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Cpu\", key)\n\t}\n\n\tt.Cpu[key] = &OpenconfigSystem_System_Cpus_Cpu{\n\t\tIndex: Index,\n\t}\n\n\treturn t.Cpu[key], nil\n}", "title": "" }, { "docid": "f0cee90f24ea8531a2859bd8937a946c", "score": "0.67543125", "text": "func (t *OpenconfigSystem_System_Cpus) NewCpu(Index OpenconfigSystem_System_Cpus_Cpu_State_Index_Union) (*OpenconfigSystem_System_Cpus_Cpu, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Cpu == nil {\n\t\tt.Cpu = make(map[OpenconfigSystem_System_Cpus_Cpu_State_Index_Union]*OpenconfigSystem_System_Cpus_Cpu)\n\t}\n\n\tkey := Index\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.Cpu[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Cpu\", key)\n\t}\n\n\tt.Cpu[key] = &OpenconfigSystem_System_Cpus_Cpu{\n\t\tIndex: Index,\n\t}\n\n\treturn t.Cpu[key], nil\n}", "title": "" }, { "docid": "28502c77e759139b362179304f6909e6", "score": "0.66464406", "text": "func Load(filename string) (*CPU, error) {\n\t// read ROM file\n\tbytes, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to load Chip8 file %s: %v\", filename, err)\n\t}\n\n\t// copy ROM into memory at program address\n\tcpu := CPU{\n\t\tpc: programOffset,\n\t\tprogramSize: len(bytes),\n\t\ti: 0,\n\t\tv: [16]byte{},\n\t\tsp: 0,\n\t\tdt: 0,\n\t\tst: 0,\n\t}\n\t// copy digits for op: Fx29\n\tfor i, b := range digits {\n\t\tcpu.memory[i] = b\n\t}\n\t// copy program\n\tfor i, b := range bytes {\n\t\tcpu.memory[programOffset+i] = b\n\t}\n\treturn &cpu, nil\n}", "title": "" }, { "docid": "2cb8cc25e87c353aa067ef3fc1519dbf", "score": "0.65732116", "text": "func NewCPU() *CPU {\n\treturn &CPU{\n\t\tSum: 0,\n\t\tSamples: make([]float64, 0),\n\t\trwLock: &sync.RWMutex{},\n\t}\n}", "title": "" }, { "docid": "06ffb69a52654621de3d5652a876938b", "score": "0.65327644", "text": "func NewCPU() *CPU {\n\tdata, err := cpu.Times(true)\n\n\tif err != nil {\n\t\tpanic(\"[CPU] unable to initialize cpu plugin\")\n\t}\n\n\tc := &CPU{\n\t\tStrip: make([]colorful.Color, 26, 26),\n\t\tCPUColors: make([]colorful.Color, len(data), len(data)),\n\t\tFadeColor: colorful.LinearRgb(0, 0, 0),\n\t}\n\n\tfor index := range data {\n\n\t\trotation := (360 / len(data)) * index\n\t\tcolor := colorful.Hsv(float64(rotation), 1, 0.8)\n\t\tc.CPUColors[index] = color\n\t}\n\n\tgo c.Collect()\n\n\treturn c\n}", "title": "" }, { "docid": "440274255e22bc49ba4b86c3c375fedc", "score": "0.6409767", "text": "func New(logger log.Logger) *CPU {\n\treturn &CPU{\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "3822f3c84e38e80187f01ff264e0c01a", "score": "0.5927157", "text": "func NewMachine(cores int, memory uint64) Machine {\n\tvar machine Machine\n\tmachine.Cores = cores\n\tmachine.Memory = memory\n\tmachine.drives = make([]Drive, 0)\n\n\treturn machine\n}", "title": "" }, { "docid": "dd942036e3726b96179117bbc268f486", "score": "0.5902333", "text": "func (t *OpenconfigPlatform_Components_Component) GetOrCreateCpu() *OpenconfigPlatform_Components_Component_Cpu {\n\tif t.Cpu != nil {\n\t\treturn t.Cpu\n\t}\n\tt.Cpu = &OpenconfigPlatform_Components_Component_Cpu{}\n\treturn t.Cpu\n}", "title": "" }, { "docid": "8d25677defae67bdce985780403da347", "score": "0.5852227", "text": "func (o *EnvironmentDatabasesCurrentMetricResponse) SetCpu(v EnvironmentDatabasesCurrentMetricResponseCpu) {\n\to.Cpu = &v\n}", "title": "" }, { "docid": "4baa9468d4a40c9163c0fa04bc2aad65", "score": "0.56842107", "text": "func New(b *Binary, args []string, stdin io.Reader, stdout, stderr io.Writer, heapSize, stackSize int, tracePath string, opts ...Option) (m *Machine, exitStatus int, err error) {\n\tvar o options\n\tfor _, opt := range opts {\n\t\tif err := opt(&o); err != nil {\n\t\t\treturn nil, -1, err\n\t\t}\n\t}\n\n\tpc, ok := b.Sym[idStart]\n\tif !ok {\n\t\treturn nil, -1, fmt.Errorf(\"missing symbol: %s\", idStart)\n\t}\n\n\tif m, err = newMachine(b, heapSize, stdin, stdout, stderr, tracePath); err != nil {\n\t\treturn nil, -1, err\n\t}\n\n\tif o.profileFunctions {\n\t\tm.ProfileFunctions = map[PCInfo]int{}\n\t}\n\tif o.profileLines {\n\t\tm.ProfileLines = map[PCInfo]int{}\n\t}\n\tif o.profileInstructions {\n\t\tm.ProfileInstructions = map[Opcode]int{}\n\t}\n\tm.ProfileRate = o.profileRate\n\n\tt, err := m.NewThread(stackSize)\n\tif err != nil {\n\t\treturn nil, -1, err\n\t}\n\n\targv := make([]uintptr, len(args)+1)\n\tfor i, v := range args {\n\t\targv[i] = m.CString(v)\n\t}\n\tpargv := m.malloc(len(argv) * ptrSize)\n\tfor i, v := range argv {\n\t\twritePtr(pargv+uintptr(i*ptrSize), v)\n\t}\n\n\t// void _start(int args, char **argv);\n\tt.rp = t.sp\n\tt.sp -= i32StackSz\n\twriteI32(t.sp, int32(len(args))) // argc\n\tt.sp -= ptrStackSz\n\twritePtr(t.sp, pargv) // argv\n\tt.sp -= ptrStackSz\n\twritePtr(t.sp, 0xcafebabe) // return address, not used\n\tif exitStatus, err = t.run(uintptr(pc) + ffiProlog); err != nil {\n\t\treturn nil, exitStatus, err\n\t}\n\n\treturn m, exitStatus, nil\n}", "title": "" }, { "docid": "cc4c1b766dc5823e7bfb6a5d48839a1d", "score": "0.56006247", "text": "func (m *Machine) Create(driver string, cpuCount string, memSize string, diskSize string, isoURL string) error {\n\tm.out.Info(\"Creating a %s machine named '%s' with CPU(%s) MEM(%s) DISK(%s)...\", driver, m.Name, cpuCount, memSize, diskSize)\n\n\tboot2dockerURL := isoURL\n\tif boot2dockerURL == \"\" {\n\t\tboot2dockerURL = \"https://github.com/boot2docker/boot2docker/releases/download/v\" + util.GetRawCurrentDockerVersion() + \"/boot2docker.iso\"\n\t}\n\n\tvar create util.Executor\n\n\tswitch driver {\n\tcase util.VirtualBox:\n\t\tcreate = util.Command(\n\t\t\t\"docker-machine\",\n\t\t\t\"create\", m.Name,\n\t\t\t\"--driver=virtualbox\",\n\t\t\t\"--virtualbox-boot2docker-url=\"+boot2dockerURL,\n\t\t\t\"--virtualbox-memory=\"+memSize,\n\t\t\t\"--virtualbox-cpu-count=\"+cpuCount,\n\t\t\t\"--virtualbox-disk-size=\"+diskSize,\n\t\t\t\"--virtualbox-host-dns-resolver=true\",\n\t\t\t\"--engine-opt\", \"dns=172.17.0.1\",\n\t\t)\n\tcase util.VMWare:\n\t\tcreate = util.Command(\n\t\t\t\"docker-machine\",\n\t\t\t\"create\", m.Name,\n\t\t\t\"--driver=vmwarefusion\",\n\t\t\t\"--vmwarefusion-boot2docker-url=\"+boot2dockerURL,\n\t\t\t\"--vmwarefusion-memory-size=\"+memSize,\n\t\t\t\"--vmwarefusion-cpu-count=\"+cpuCount,\n\t\t\t\"--vmwarefusion-disk-size=\"+diskSize,\n\t\t\t\"--engine-opt\", \"dns=172.17.0.1\",\n\t\t)\n\tcase util.Xhyve:\n\t\tif err := m.CheckXhyveRequirements(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcreate = util.Command(\n\t\t\t\"docker-machine\",\n\t\t\t\"create\", m.Name,\n\t\t\t\"--driver=xhyve\",\n\t\t\t\"--xhyve-boot2docker-url=\"+boot2dockerURL,\n\t\t\t\"--xhyve-memory-size=\"+memSize,\n\t\t\t\"--xhyve-cpu-count=\"+cpuCount,\n\t\t\t\"--xhyve-disk-size=\"+diskSize,\n\t\t\t\"--engine-opt\", \"dns=172.17.0.1\",\n\t\t)\n\t}\n\n\tif err := create.Execute(false); err != nil {\n\t\treturn fmt.Errorf(\"error creating machine '%s': %s\", m.Name, err)\n\t}\n\n\tm.out.Info(\"Created docker-machine named '%s'...\", m.Name)\n\treturn nil\n}", "title": "" }, { "docid": "146b3bdd86adcfe119d88765cce1cf5b", "score": "0.5577049", "text": "func NewVM(pathToROM string, clockSpeed int) (*VM, error) {\n\twindow, err := pixel.NewWindow()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tvm := VM{\n\t\tmemory: [4096]byte{},\n\t\tv: [16]byte{},\n\t\tpc: 0x200,\n\t\tstack: [16]uint16{},\n\t\tgfx: [64 * 32]byte{},\n\t\tkeypad: [16]byte{},\n\t\twindow: window,\n\t\tClock: time.NewTicker(time.Second / time.Duration(clockSpeed)),\n\t\taudioC: make(chan struct{}),\n\t\tShutdownC: make(chan struct{}),\n\t}\n\n\tvm.loadFontSet()\n\n\tif err := vm.loadROM(pathToROM); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &vm, nil\n}", "title": "" }, { "docid": "4e523e3de425ee7dccbdd355c9f0d31f", "score": "0.5564645", "text": "func NewCPUProfile(data []byte) (*CPUProfile, error) {\n\tcp := &CPUProfile{data: data}\n\tprof, err := profile.ParseData(data)\n\tcp.prof = prof\n\treturn cp, err\n}", "title": "" }, { "docid": "075385e9bc551471633947306a3d12f4", "score": "0.54963064", "text": "func InitialCPU() CPU {\n\treturn CPU{0}\n}", "title": "" }, { "docid": "b383b9d443f4e176473cc638e8ac4f95", "score": "0.5489685", "text": "func NewCPUInfo() *CPUInfo {\n\tci := new(CPUInfo)\n\treturn ci\n}", "title": "" }, { "docid": "f89d9e83f4126638ed6521d6fba5403a", "score": "0.5448587", "text": "func New() *Machine {\n\treturn &Machine{\n\t\trand: newRandomizer(),\n\t}\n}", "title": "" }, { "docid": "4ae647b5e90d184db6cb81ca7ced0e3c", "score": "0.53892654", "text": "func NewHardware(webcam bool, eegModel string) (Hardware, error) {\n\n\t// TODO this is where we parse and organize logic about hardware specs\n\t// relevant to ml.\n\n\treturn Hardware{Webcam{}, EEGHeadset{eegModel}}, nil\n}", "title": "" }, { "docid": "f54b62ea137e05bda7c8edc100d4fa3d", "score": "0.53778327", "text": "func New() *Machine {\n\treturn &Machine{\n\t\tstack: stack.New(),\n\t\tinstructions: []ByteCode{\n\t\t\tICONST, 1,\n\t\t\tICONST, 2,\n\t\t\tICONST, 3,\n\t\t\tIADD,\n\t\t\tIADD,\n\t\t\tPRINT,\n\t\t\tHALT,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "4accf56b93e8c649fee78b437d7c44cb", "score": "0.53771156", "text": "func (t *OpenconfigSystem_System_Cpus) GetOrCreateCpu(Index OpenconfigSystem_System_Cpus_Cpu_State_Index_Union) *OpenconfigSystem_System_Cpus_Cpu {\n\n\tkey := Index\n\n\tif v, ok := t.Cpu[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.NewCpu(Index)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateCpu got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "1f6b6e6f10b5d02bb9ca74d6d7f919c0", "score": "0.5354903", "text": "func New(impl *Implementation) *Machine {\n\timpl.mergeStdlib()\n\ti := impl.dup()\n\n\tm := &Machine{\n\t\timpl: i,\n\t\texec: make(chan *mProcess),\n\t\tenv: make(map[string]string, 0),\n\t}\n\n\tgo m.run()\n\n\treturn m\n}", "title": "" }, { "docid": "a68f6e18ac89298fadaebba680b472b4", "score": "0.53145456", "text": "func NewCgroupCpu() (*CgroupCpu, error) {\n\n\tcores, err := pscpu.Counts(true)\n\tif err != nil || cores == 0 {\n\t\tperCpuUsage, err := PerCpuUsage()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"fail to PerCpuUsage(), e:%s\", err.Error())\n\t\t}\n\n\t\tcores = len(perCpuUsage)\n\t}\n\n\tcpus, err := Cpus()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"fail to Cpus(), e:%s\", err.Error())\n\t}\n\n\tquota := float64(len(cpus))\n\n\tcpuQuota, err := CpuQuota()\n\tif err == nil && cpuQuota != -1 {\n\t\tperiod, err := CpuPeriod()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"fail to CpuPeriod(), e:%s\", err.Error())\n\t\t}\n\n\t\t// logic cpus from time period\n\t\tlimit := float64(cpuQuota) / float64(period)\n\t\tif limit < quota {\n\t\t\tquota = limit\n\t\t}\n\n\t}\n\n\t// The maximum run frequency supported by CPU hardware\n\tmaxFreq := cpuMaxFreq()\n\n\tpreSystemUsage, err := systemCpuUsage()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"fail to systemCpuUsage(), e:%s\", err.Error())\n\t}\n\n\ttotalU, err := totalUsage()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"fail to totalUsage(), e:%s\", err.Error())\n\t}\n\n\tcpu := &CgroupCpu{\n\t\tfrequency: maxFreq,\n\t\tquota: quota,\n\t\tcores: uint64(cores),\n\t\tpreSystemUsage: preSystemUsage,\n\t\tpreTotalUsage: totalU,\n\t}\n\treturn cpu, nil\n}", "title": "" }, { "docid": "346c72c2e8634f8add74f138dc569c77", "score": "0.5313245", "text": "func (m *Module) NewVirtualMachine() *VirtualMachine {\n\tglobals := make([]int64, len(m.Globals))\n\tcopy(globals, m.Globals)\n\ttable := make([]uint32, len(m.Table))\n\tcopy(table, m.Table)\n\n\t// Load linear memory.\n\tmemory := emptyMemory\n\tif m.Module.Base.Memory != nil && len(m.Module.Base.Memory.Entries) > 0 {\n\t\tinitialLimit := int(m.Module.Base.Memory.Entries[0].Limits.Initial)\n\t\tif m.Config.MaxMemoryPages != 0 && initialLimit > m.Config.MaxMemoryPages {\n\t\t\tpanic(\"max memory exceeded\")\n\t\t}\n\n\t\tcapacity := initialLimit * DefaultPageSize\n\n\t\t// Initialize empty memory.\n\t\tmemory = make([]byte, capacity)\n\t\tfor i := 0; i < capacity; i++ {\n\t\t\tmemory[i] = 0\n\t\t}\n\n\t\tif m.Module.Base.Data != nil && len(m.Module.Base.Data.Entries) > 0 {\n\t\t\tfor _, e := range m.Module.Base.Data.Entries {\n\t\t\t\toffset := int(execInitExpr(e.Offset, globals))\n\t\t\t\tcopy(memory[offset:], e.Data)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &VirtualMachine{\n\t\tModule: m.Module,\n\t\tConfig: m.Config,\n\t\tFunctionCode: m.FunctionCode,\n\t\tFunctionImports: m.FunctionImports,\n\t\tCallStack: make([]Frame, DefaultCallStackSize),\n\t\tCurrentFrame: -1,\n\t\tTable: table,\n\t\tGlobals: globals,\n\t\tMemory: memory,\n\t\tExited: true,\n\t\tGasPolicy: m.GasPolicy,\n\t\tImportResolver: m.ImportResolver,\n\t}\n}", "title": "" }, { "docid": "28749767a94774c7f6b7648d7cfa3bdb", "score": "0.53046876", "text": "func (t *OpenconfigPlatform_Components_Component) GetCpu() *OpenconfigPlatform_Components_Component_Cpu {\n\tif t != nil && t.Cpu != nil {\n\t\treturn t.Cpu\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6795f5cd71948101947bcff62172b5d9", "score": "0.5304387", "text": "func (vm *Vm) AddCpu(totalCpu int) error {\n\treturn vm.SetCpus(totalCpu)\n}", "title": "" }, { "docid": "5917ba1565844dee6710ec4453df32dd", "score": "0.5267103", "text": "func New(bin ChasmBinary) (*ChaincodeVM, error) {\n\tvm := ChaincodeVM{}\n\tif err := vm.PreLoad(bin); err != nil {\n\t\treturn nil, err\n\t}\n\tvm.runstate = RsNotReady // not ready to run until we've called Init\n\tr, err := NewDefaultRand()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm.rand = r\n\tn, err := NewDefaultNow()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm.now = n\n\treturn &vm, nil\n}", "title": "" }, { "docid": "7d2f676369ccbb06d46486e5f128618d", "score": "0.52521783", "text": "func New(prog []byte) (*Mach, error) {\n\tp := prog\n\tif len(p) < 4 {\n\t\treturn nil, errors.New(\"program too short, need at least 4 bytes\")\n\t}\n\n\tif p[0] != _machVersionCode {\n\t\treturn nil, fmt.Errorf(\"unsupported stackvm program version %02x\", p[0])\n\t}\n\tp = p[1:]\n\n\tstackSize := binary.BigEndian.Uint16(p)\n\tif stackSize%_pageSize != 0 {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"invalid stacksize %#02x, not a %#02x-multiple\",\n\t\t\tstackSize, _pageSize)\n\t}\n\tp = p[2:]\n\n\tm := Mach{\n\t\tctx: defaultContext,\n\t\topc: makeOpCache(len(p)),\n\t\tpbp: 0,\n\t\tpsp: _pspInit,\n\t\tcbp: uint32(stackSize) - 4,\n\t\tcsp: uint32(stackSize) - 4,\n\t\tip: uint32(stackSize),\n\t}\n\n\tm.storeBytes(m.ip, p)\n\t// TODO mark code segment, update data\n\n\treturn &m, nil\n}", "title": "" }, { "docid": "91eedc737dfc0698552d50a3d4bfaa61", "score": "0.5238378", "text": "func CpuInfo() Resource {\n\tvar currentIdle, currnetTotal uint64\n\tcurrentIdle, currnetTotal, res := cpuSample(currentIdle, currnetTotal)\n\ttime.Sleep(time.Millisecond * time.Duration(GapMileSecond))\n\tcurrentIdle, currnetTotal, res = cpuSample(currentIdle, currnetTotal)\n\treturn Resource{\n\t\tName: \"CPU\",\n\t\tData: res,\n\t}\n}", "title": "" }, { "docid": "7e7bcd87194e0f563cbda4429f866ad7", "score": "0.5217817", "text": "func Load(shellcode []byte) {\n\tfmt.Println(\"Mess with the banana, die like the... banana?\") //I found it easier to breakpoint the consolewrite function to mess with the in-memory ntdll to verify the auto-switch to disk works sanely than to try and live-patch it programatically.\n\n\tbp, e := bananaphone.NewBananaPhone(bananaphone.DiskBananaPhoneMode)\n\tif e != nil {\n\t\tpanic(e)\n\t}\n\t//resolve the functions and extract the syscalls\n\t//resolve the functions and extract the syscalls\n\talloc, e := bp.GetSysID(\"NtAllocateVirtualMemory\")\n\tif e != nil {\n\t\tpanic(e)\n\t}\n\n\tcreateThread(shellcode,uintptr(0xffffffffffffffff),alloc)\n}", "title": "" }, { "docid": "da9dd01a4528ac8482329d4714d52dc5", "score": "0.52107394", "text": "func NewMachine(orm *ORM, cai *CAI) *Machine {\n\treturn &Machine{ORM: orm, CAI: cai}\n}", "title": "" }, { "docid": "b1c17c63290ced0736beeab285121c54", "score": "0.52087796", "text": "func NewCartridge(fileROM string, core *cpu.Core) (*Cartridge, error) {\r\n\r\n\t// load rom from file\r\n\tromData, err := ioutil.ReadFile(fileROM)\r\n\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\trom := memory.NewROM(romData, 0)\r\n\r\n\tvar ramData []byte\r\n\r\n\t// read ram type\r\n\tif ramType, err := rom.Read(0x0149); err == nil {\r\n\r\n\t\t// alocate ram\r\n\t\tswitch ramType {\r\n\r\n\t\tcase 0x00: // No RAM or MBC2\r\n\t\t\tbreak\r\n\t\tcase 0x01: // 2 KBytes\r\n\t\t\tramData = make([]byte, 2048)\r\n\t\tcase 0x02: // 8 Kbytes\r\n\t\t\tramData = make([]byte, 8192)\r\n\t\tcase 0x03: //32 KBytes\r\n\t\t\tramData = make([]byte, 32768)\r\n\t\tdefault:\r\n\t\t\treturn nil, ErrCorrupted\r\n\t\t}\r\n\r\n\t} else {\r\n\t\t// failed to read ram type\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// read MBC type\r\n\tmbcType, err := rom.Read(0x0147)\r\n\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tc := Cartridge{}\r\n\r\n\t// create MBC\r\n\tswitch mbcType {\r\n\r\n\tcase 0x00: // rom only\r\n\r\n\t\tc.mbc = NewNullMBC(romData)\r\n\r\n\tcase 0x01, 0x02, 0x03: // MBC1\r\n\r\n\t\tc.mbc = NewMBC1(romData, ramData)\r\n\r\n\tcase 0x05, 0x06: // MBC2\r\n\r\n\t\tc.mbc = NewMBC2(romData)\r\n\r\n\tcase 0x0F, 0x10, 0x11, 0x12, 0x13: // MBC3\r\n\r\n\t\tmbc3 := NewMBC3(romData, ramData)\r\n\t\tcore.RegisterToClockChanges(mbc3)\r\n\t\tc.mbc = mbc3\r\n\r\n\tdefault:\r\n\r\n\t\treturn nil, fmt.Errorf(\"cartridge type not supported (%x)\", mbcType)\r\n\t}\r\n\r\n\treturn &c, nil\r\n}", "title": "" }, { "docid": "6f97f76a8012ceb9dbab16a415e14b33", "score": "0.5198046", "text": "func NewCPUMemoryScaler(resourceName v1.ResourceName, config *ScalerConfig) (Scaler, error) {\n\tmeta, parseErr := parseResourceMetadata(config)\n\tif parseErr != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing %s metadata: %s\", resourceName, parseErr)\n\t}\n\n\treturn &cpuMemoryScaler{\n\t\tmetadata: meta,\n\t\tresourceName: resourceName,\n\t}, nil\n}", "title": "" }, { "docid": "1660640996ea709056f50da038705288", "score": "0.519011", "text": "func New(opt *option.Options) (Profile, error) {\n\tp := &profile{\n\t\topt: opt,\n\t}\n\n\terr := p.startCPUProfile()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "31620e85d17116a23b9d2fe5238442ce", "score": "0.51756763", "text": "func NewComputer(memSize uint32, logOut io.Writer) (c *Computer) {\n\tc = new(Computer)\n\n\t// Setup logging\n\tif logOut == nil {\n\t\tlogOut = os.Stderr\n\t}\n\tc.log = log.New(logOut, \"Computer: \", 0)\n\n\t// Initialize RAM of memSize\n\tc.memSize = memSize\n\tc.ram = NewMemory(memSize, logOut)\n\n\t// Initialize a register bank to contain all 16 registers + CPSR + Banked\n\t// registers\n\tc.registers = NewMemory(100, logOut)\n\n\t// Initialize buffers\n\tc.Keyboard = make(chan byte, 100)\n\tc.Console = make(chan byte, 100)\n\n\t// Initialize CPU with RAM and registers\n\tc.cpu = NewCPU(c.ram, c.registers, c.Keyboard, c.Console, logOut)\n\tc.Irq = c.cpu.irq\n\n\t// Trace Log File\n\tif err := c.EnableTracing(); err != nil {\n\t\tc.log.Println(\"Unable to open trace file -\", err)\n\t}\n\n\t// Step Counter\n\tc.step_counter = 1\n\n\treturn\n}", "title": "" }, { "docid": "7f8af0d857d9c767ecfb993f26108774", "score": "0.5159705", "text": "func (c *CPU) init(cpuID int) {\n\tc.kernelEntry = &c.kernel.cpuEntries[cpuID]\n\tc.cpuSelf = c\n\t// Null segment.\n\tc.gdt[0].setNull()\n\n\t// Kernel & user segments.\n\tc.gdt[segKcode] = KernelCodeSegment\n\tc.gdt[segKdata] = KernelDataSegment\n\tc.gdt[segUcode32] = UserCodeSegment32\n\tc.gdt[segUdata] = UserDataSegment\n\tc.gdt[segUcode64] = UserCodeSegment64\n\n\t// The task segment, this spans two entries.\n\ttssBase, tssLimit, _ := c.TSS()\n\tc.gdt[segTss].set(\n\t\tuint32(tssBase),\n\t\tuint32(tssLimit),\n\t\t0, // Privilege level zero.\n\t\tSegmentDescriptorPresent|\n\t\t\tSegmentDescriptorAccess|\n\t\t\tSegmentDescriptorWrite|\n\t\t\tSegmentDescriptorExecute)\n\tc.gdt[segTssHi].setHi(uint32((tssBase) >> 32))\n\n\t// Set the kernel stack pointer in the TSS (virtual address).\n\tstackAddr := c.StackTop()\n\tc.stackTop = stackAddr\n\tc.tss.rsp0Lo = uint32(stackAddr)\n\tc.tss.rsp0Hi = uint32(stackAddr >> 32)\n\tc.tss.ist1Lo = uint32(stackAddr)\n\tc.tss.ist1Hi = uint32(stackAddr >> 32)\n\n\t// Set the I/O bitmap base address beyond the last byte in the TSS\n\t// to block access to the entire I/O address range.\n\t//\n\t// From section 18.5.2 \"I/O Permission Bit Map\" from Intel SDM vol1:\n\t// I/O addresses not spanned by the map are treated as if they had set\n\t// bits in the map.\n\tc.tss.ioPerm = tssLimit + 1\n\n\t// Permanently set the kernel segments.\n\tc.registers.Cs = uint64(Kcode)\n\tc.registers.Ds = uint64(Kdata)\n\tc.registers.Es = uint64(Kdata)\n\tc.registers.Ss = uint64(Kdata)\n\tc.registers.Fs = uint64(Kdata)\n\tc.registers.Gs = uint64(Kdata)\n\n\t// Set mandatory flags.\n\tc.registers.Eflags = KernelFlagsSet\n\n\tc.hasXSAVE = hasXSAVE\n\tc.hasXSAVEOPT = hasXSAVEOPT\n}", "title": "" }, { "docid": "c04bae3544bb32263b95d3792eb68de7", "score": "0.51590705", "text": "func init() {\n\tcpu.Version = Version\n}", "title": "" }, { "docid": "ba60d452480607640a66dbea7b69183a", "score": "0.5154612", "text": "func (p *QEMUVirtualization) NewMachine(opts machine.InitOptions) (machine.VM, error) {\n\tvmConfigDir, err := machine.GetConfDir(vmtype)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm := new(MachineVM)\n\tif len(opts.Name) > 0 {\n\t\tvm.Name = opts.Name\n\t}\n\n\t// set VM ignition file\n\tignitionFile, err := machine.NewMachineFile(filepath.Join(vmConfigDir, vm.Name+\".ign\"), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm.IgnitionFile = *ignitionFile\n\n\t// set VM image file\n\timagePath, err := machine.NewMachineFile(opts.ImagePath, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm.ImagePath = *imagePath\n\n\tvm.RemoteUsername = opts.Username\n\n\t// Add a random port for ssh\n\tport, err := utils.GetRandomPort()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm.Port = port\n\n\tvm.CPUs = opts.CPUS\n\tvm.Memory = opts.Memory\n\tvm.DiskSize = opts.DiskSize\n\n\tvm.Created = time.Now()\n\n\t// find QEMU binary\n\texecPath, err := findQEMUBinary()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := vm.setPIDSocket(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Add qmp socket\n\tif err := vm.setQMPMonitorSocket(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := vm.setReadySocket(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// configure command to run\n\tvm.setNewMachineCMD(execPath)\n\treturn vm, nil\n}", "title": "" }, { "docid": "8e53ddbef9f6b9cf6a3cac3a1b5474c2", "score": "0.51453084", "text": "func NewGPU() *cpu.GPU {\n\tbrand := generator.RandomCPUBrand()\n\tname := generator.RandomCPUName(brand)\n\tminGHZ := generator.RandomFloat64(1.0, 1.5)\n\tmaxGHZ := generator.RandomFloat64(minGHZ, 2.0)\n\tmemory := &memory.Memory{\n\t\tValue: uint64(generator.RandomInt(2, 6)),\n\t\tUnit: memory.Memory_GIGABYTE,\n\t}\n\n\tgpu := &cpu.GPU{\n\t\tProcessUnitInfo: &cpu.ProcessUnitInfo{\n\t\t\tBrand: brand,\n\t\t\tName: name,\n\t\t\tMinGhz: minGHZ,\n\t\t\tMaxGhz: maxGHZ,\n\t\t},\n\t\tMemory: memory,\n\t}\n\n\treturn gpu\n}", "title": "" }, { "docid": "91db9c403c32fda10212a935cb91918d", "score": "0.51280445", "text": "func NewCPUFingerprint(logger *log.Logger) Fingerprint {\n\tf := &CPUFingerprint{logger: logger}\n\treturn f\n}", "title": "" }, { "docid": "e5098c40aa1dfac7566cc8364f2d09f8", "score": "0.5105606", "text": "func newCPURequest(container cache.Container) CPURequest {\n\tpod, _ := container.GetPod()\n\tfull, fraction, isolate, elevate := cpuAllocationPreferences(pod, container)\n\n\treturn &cpuRequest{\n\t\tcontainer: container,\n\t\tfull: full,\n\t\tfraction: fraction,\n\t\tisolate: isolate,\n\t\televate: elevate,\n\t}\n}", "title": "" }, { "docid": "dc0916de4316c70a2f32eff9fec58130", "score": "0.50844496", "text": "func (s *FifoCpuSharer) GrabCpu() {\n\ts.grabCpu()\n}", "title": "" }, { "docid": "fb6fe52efad14c53ad7e7c01862a2b29", "score": "0.5077097", "text": "func NewMachine(ctx *pulumi.Context,\n\tname string, args *MachineArgs, opts ...pulumi.ResourceOption) (*Machine, 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\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20190802preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20190318preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20190318preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20191212:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20191212:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20200730preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20200730preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20200802:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20200802:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20200815preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20200815preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210128preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210128preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210325preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210325preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210422preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210422preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210517preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210517preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210520:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210520:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210610preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210610preview:Machine\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource Machine\n\terr := ctx.RegisterResource(\"azure-native:hybridcompute/v20190802preview:Machine\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "c9352ca8b2dc5eebfe355eb7a14a1336", "score": "0.50722045", "text": "func NewMachine() *Machine {\n\treturn &Machine{}\n}", "title": "" }, { "docid": "c9352ca8b2dc5eebfe355eb7a14a1336", "score": "0.50722045", "text": "func NewMachine() *Machine {\n\treturn &Machine{}\n}", "title": "" }, { "docid": "74017f38f1a83ab31f21b2dc2427eabb", "score": "0.50601315", "text": "func NewVirtualMachine(\n\tcode []byte,\n\tconfig VMConfig,\n\timpResolver ImportResolver,\n\tgasPolicy compiler.GasPolicy,\n) (_retVM *VirtualMachine, retErr error) {\n\tif config.EnableJIT {\n\t\tfmt.Println(\"Warning: JIT support is removed.\")\n\t}\n\n\tm, err := compiler.LoadModule(code)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm.DisableFloatingPoint = config.DisableFloatingPoint\n\n\tfunctionCode, err := m.CompileForInterpreter(gasPolicy)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer utils.CatchPanic(&retErr)\n\n\ttable := emptyTable\n\tglobals := emptyGlobals\n\tfuncImports := emptyFuncImports\n\n\tif m.Base.Import != nil && impResolver != nil {\n\t\tfor _, imp := range m.Base.Import.Entries {\n\t\t\tswitch imp.Type.Kind() {\n\t\t\tcase wasm.ExternalFunction:\n\t\t\t\tfuncImports = append(funcImports, FunctionImportInfo{\n\t\t\t\t\tModuleName: imp.ModuleName,\n\t\t\t\t\tFieldName: imp.FieldName,\n\t\t\t\t\tF: nil, // deferred\n\t\t\t\t})\n\t\t\tcase wasm.ExternalGlobal:\n\t\t\t\tglobals = append(globals, impResolver.ResolveGlobal(imp.ModuleName, imp.FieldName))\n\t\t\tcase wasm.ExternalMemory:\n\t\t\t\t// TODO: Do we want a real import?\n\t\t\t\tif m.Base.Memory != nil && len(m.Base.Memory.Entries) > 0 {\n\t\t\t\t\tpanic(\"cannot import another memory while we already have one\")\n\t\t\t\t}\n\t\t\t\tm.Base.Memory = &wasm.SectionMemories{\n\t\t\t\t\tEntries: []wasm.Memory{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLimits: wasm.ResizableLimits{\n\t\t\t\t\t\t\t\tInitial: uint32(config.DefaultMemoryPages),\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\tcase wasm.ExternalTable:\n\t\t\t\t// TODO: Do we want a real import?\n\t\t\t\tif m.Base.Table != nil && len(m.Base.Table.Entries) > 0 {\n\t\t\t\t\tpanic(\"cannot import another table while we already have one\")\n\t\t\t\t}\n\t\t\t\tm.Base.Table = &wasm.SectionTables{\n\t\t\t\t\tEntries: []wasm.Table{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLimits: wasm.ResizableLimits{\n\t\t\t\t\t\t\t\tInitial: uint32(config.DefaultTableSize),\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\tdefault:\n\t\t\t\tpanic(fmt.Errorf(\"import kind not supported: %d\", imp.Type.Kind()))\n\t\t\t}\n\t\t}\n\t}\n\n\t// Load global entries.\n\tfor _, entry := range m.Base.GlobalIndexSpace {\n\t\tglobals = append(globals, execInitExpr(entry.Init, globals))\n\t}\n\n\t// Populate table elements.\n\tif m.Base.Table != nil && len(m.Base.Table.Entries) > 0 {\n\t\tt := &m.Base.Table.Entries[0]\n\n\t\tif config.MaxTableSize != 0 && int(t.Limits.Initial) > config.MaxTableSize {\n\t\t\tpanic(\"max table size exceeded\")\n\t\t}\n\n\t\ttable = make([]uint32, int(t.Limits.Initial))\n\t\tfor i := 0; i < int(t.Limits.Initial); i++ {\n\t\t\ttable[i] = 0xffffffff\n\t\t}\n\t\tif m.Base.Elements != nil && len(m.Base.Elements.Entries) > 0 {\n\t\t\tfor _, e := range m.Base.Elements.Entries {\n\t\t\t\toffset := int(execInitExpr(e.Offset, globals))\n\t\t\t\tcopy(table[offset:], e.Elems)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Load linear memory.\n\tmemory := emptyMemory\n\tif m.Base.Memory != nil && len(m.Base.Memory.Entries) > 0 {\n\t\tinitialLimit := int(m.Base.Memory.Entries[0].Limits.Initial)\n\t\tif config.MaxMemoryPages != 0 && initialLimit > config.MaxMemoryPages {\n\t\t\tpanic(\"max memory exceeded\")\n\t\t}\n\n\t\tcapacity := initialLimit * DefaultPageSize\n\n\t\t// Initialize empty memory.\n\t\tmemory = make([]byte, capacity)\n\t\tfor i := 0; i < capacity; i++ {\n\t\t\tmemory[i] = 0\n\t\t}\n\n\t\tif m.Base.Data != nil && len(m.Base.Data.Entries) > 0 {\n\t\t\tfor _, e := range m.Base.Data.Entries {\n\t\t\t\toffset := int(execInitExpr(e.Offset, globals))\n\t\t\t\tcopy(memory[offset:], e.Data)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &VirtualMachine{\n\t\tModule: m,\n\t\tConfig: config,\n\t\tFunctionCode: functionCode,\n\t\tFunctionImports: funcImports,\n\t\tCallStack: make([]Frame, DefaultCallStackSize),\n\t\tCurrentFrame: -1,\n\t\tTable: table,\n\t\tGlobals: globals,\n\t\tMemory: memory,\n\t\tExited: true,\n\t\tGasPolicy: gasPolicy,\n\t\tImportResolver: impResolver,\n\t}, nil\n}", "title": "" }, { "docid": "1a5d90523f2204b80b220d4635661d59", "score": "0.5057188", "text": "func (o *CreateVmTemplateRequest) SetCpuGeneration(v string) {\n\to.CpuGeneration = v\n}", "title": "" }, { "docid": "3cb1584c03e63bb553b9e4465d1cbff3", "score": "0.5042905", "text": "func NewVM() VM {\n return VM{\n Wren: C.createVM(),\n }\n}", "title": "" }, { "docid": "c5e9c74cfd7eaa4eac608e215f358040", "score": "0.50426203", "text": "func NewCPUCollector() (Collector, error) {\n\treturn &cpuCollector{}, nil\n}", "title": "" }, { "docid": "f80809c6a0b66af8f800be5a09b9dcc6", "score": "0.5031425", "text": "func CPU(now time.Time) (CPUInfo, error) {\n\tensureGlobalInfo()\n\treturn globalCurrentInfo.CPU(now)\n}", "title": "" }, { "docid": "04cec45b95137ac4a58a029348f5dbed", "score": "0.5030296", "text": "func (o *CreateVmTemplateRequest) SetCpuPerformance(v string) {\n\to.CpuPerformance = &v\n}", "title": "" }, { "docid": "b758515468307a5818d89817b1545d92", "score": "0.5010857", "text": "func (m *PilotConfig) GetCpu() *CPUTargetUtilizationConfig {\n\tif m != nil {\n\t\treturn m.Cpu\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b758515468307a5818d89817b1545d92", "score": "0.5010857", "text": "func (m *PilotConfig) GetCpu() *CPUTargetUtilizationConfig {\n\tif m != nil {\n\t\treturn m.Cpu\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b758515468307a5818d89817b1545d92", "score": "0.5010857", "text": "func (m *PilotConfig) GetCpu() *CPUTargetUtilizationConfig {\n\tif m != nil {\n\t\treturn m.Cpu\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b758515468307a5818d89817b1545d92", "score": "0.5010857", "text": "func (m *PilotConfig) GetCpu() *CPUTargetUtilizationConfig {\n\tif m != nil {\n\t\treturn m.Cpu\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b758515468307a5818d89817b1545d92", "score": "0.5010857", "text": "func (m *PilotConfig) GetCpu() *CPUTargetUtilizationConfig {\n\tif m != nil {\n\t\treturn m.Cpu\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b758515468307a5818d89817b1545d92", "score": "0.5010857", "text": "func (m *PilotConfig) GetCpu() *CPUTargetUtilizationConfig {\n\tif m != nil {\n\t\treturn m.Cpu\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d555c34dafe868f3af05b6917e2113ab", "score": "0.5010838", "text": "func New(base mb.BaseMetricSet) (mb.MetricSet, error) {\n\tcfgwarn.Experimental(\"The system load metricset is experimental.\")\n\n\tconfig := struct{}{}\n\tif err := base.Module().UnpackConfig(&config); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &MetricSet{\n\t\tBaseMetricSet: base,\n\t\tcpustat: new(C.perfstat_cpu_total_t),\n\t}, nil\n}", "title": "" }, { "docid": "ef8ac2d799169fe1317360c2fecc783b", "score": "0.50047123", "text": "func (x *PilotConfig) GetCpu() *CPUTargetUtilizationConfig {\n\tif x != nil {\n\t\treturn x.Cpu\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f3cff9da40e1976338744b40619e0d1d", "score": "0.5003633", "text": "func NewGPU(mmu *memory.MMU, monitor Monitor, core *cpu.Core, fps uint32) (*GPU, error) {\r\n\r\n\tif fps == 0 {\r\n\t\tfps = 1\r\n\t}\r\n\r\n\tg := GPU{mmu: mmu, monitor: monitor, core: core, fps: int64(fps)}\r\n\r\n\tg.lcdc = 0x91\r\n\r\n\t// lcdc\r\n\tif err := mmu.Map(&g.lcdc, AddrLCDC, AddrLCDC); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// stat\r\n\tif err := mmu.Map(&g.stat, AddrSTAT, AddrSTAT); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// scy\r\n\tif err := mmu.Map(&g.scy, AddrSCY, AddrSCY); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// scx\r\n\tif err := mmu.Map(&g.scx, AddrSCX, AddrSCX); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// wx\r\n\tif err := mmu.Map(&g.wx, AddrWinX, AddrWinX); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// wy\r\n\tif err := mmu.Map(&g.wy, AddrWinY, AddrWinY); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// ly\r\n\tif err := mmu.Map(&g, AddrLY, AddrLY); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// lyc\r\n\tif err := mmu.Map(&g.lyc, AddrLYC, AddrLYC); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// bgp\r\n\tif err := mmu.Map(&g.bgp, AddrBGP, AddrBGP); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// obp0\r\n\tif err := mmu.Map(&g.obp[0], AddrOBP0, AddrOBP0); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// obp1\r\n\tif err := mmu.Map(&g.obp[1], AddrOBP1, AddrOBP1); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// dma\r\n\tif err := mmu.Map(&g, AddrDMA, AddrDMA); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// vram\r\n\tg.vram = memory.NewRAM(make([]byte, 8192), 0x8000)\r\n\tif err := mmu.Map(&g, 0x8000, 0x9FFF); err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\t// oam\r\n\tg.oam = memory.NewRAM(make([]byte, 160), 0xFE00)\r\n\tif err := mmu.Map(&g, 0xFE00, 0xFE9F); err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\tg.displayEnabled = false\r\n\tg.initialize()\r\n\r\n\treturn &g, nil\r\n}", "title": "" }, { "docid": "b9640405db234cbc6b631b54ce90b3bb", "score": "0.49890587", "text": "func NewComputer(program []int, inputs []int) Computer {\n\tmemory := make([]int, len(program))\n\tcopy(memory, program)\n\n\tmyInputs := make([]int, len(inputs))\n\tcopy(myInputs, inputs)\n\n\tc := Computer{Memory: memory, Inputs: inputs, PC: 0}\n\treturn c\n}", "title": "" }, { "docid": "31ee7c837a9a21aaa5afb8e638fcd533", "score": "0.49850157", "text": "func (m *Machine) Start(arch string, kvm bool) (*os.Process, error) {\n\tqemu := fmt.Sprintf(\"qemu-system-%s\", arch)\n\targs := []string{\"-smp\", strconv.Itoa(m.Cores), \"-m\", strconv.FormatUint(m.Memory, 10)}\n\n\tif kvm {\n\t\targs = append(args, \"-enable-kvm\")\n\t}\n\n\tif len(m.cd) > 0 {\n\t\targs = append(args, \"-cdrom\")\n\t\targs = append(args, m.cd)\n\t}\n\n\tfor _, drive := range m.drives {\n\t\targs = append(args, \"-drive\")\n\t\targs = append(args, fmt.Sprintf(\"file=%s,format=%s\", drive.Path, drive.Format))\n\t}\n\n\tif len(m.ifaces) == 0 {\n\t\targs = append(args, \"-net\")\n\t\targs = append(args, \"none\")\n\t}\n\n\tfor _, iface := range m.ifaces {\n\t\ts := fmt.Sprintf(\"%s,id=%s\", iface.Type, iface.ID)\n\t\tif len(iface.IfName) > 0 {\n\t\t\ts = fmt.Sprintf(\"%s,ifname=%s\", s, iface.IfName)\n\t\t}\n\n\t\targs = append(args, \"-netdev\")\n\t\targs = append(args, s)\n\n\t\ts = fmt.Sprintf(\"virtio-net,netdev=%s\", iface.ID)\n\t\tif len(iface.MAC) > 0 {\n\t\t\ts = fmt.Sprintf(\"%s,mac=%s\", s, iface.MAC)\n\t\t}\n\n\t\targs = append(args, \"-device\")\n\t\targs = append(args, s)\n\t}\n\n\tif len(m.vnc) > 0 {\n\t\targs = append(args, \"-vnc\")\n\t\targs = append(args, m.vnc)\n\t} \n\t// else if len(m.display) == 0 {\n\t// \targs = append(args, \"-display\")\n\t// \targs = append(args, \"none\")\n\t// }\n\n\tif len(m.display) > 0 {\n\t\targs = append(args, \"-display\")\n\t\targs = append(args, m.display)\n\t\tfmt.Println(\"display\")\n\t}\n\n\tif len(m.monitor) > 0 {\n\t\targs = append(args, \"-qmp\")\n\t\targs = append(args, fmt.Sprintf(\"unix:%s,server,nowait\", m.monitor))\n\t fmt.Println(\"unix:%s,server,nowait\", m.monitor)\n\t}\n\n\tfor _, c := range m.custom {\n\t\targs = append(args, c[0])\n\t\targs = append(args, c[1])\n\t}\nfmt.Println(\"commadns\",args)\n\tcmd := exec.Command(qemu, args...)\n\tcmd.SysProcAttr = new(syscall.SysProcAttr)\n\tcmd.SysProcAttr.Setsid = true\n\n\t// stderr, err := cmd.StderrPipe()\n\t// if err == nil {\n\t// \tgo func() {\n\t// \t\ts, err := ioutil.ReadAll(stderr)\n\t// \t\tif err != nil {\n\t// \t\t\treturn\n\t// \t\t}\n\n\t// \t\tstderrCb(string(s))\n\t// \t}()\n\t// }\n\n\terr := cmd.Start()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tproc := cmd.Process\n\terrc := make(chan error)\n\n\tgo func() {\n\t\terr := cmd.Wait()\n\t\tif err != nil {\n\t\t\terrc <- fmt.Errorf(\"'qemu-system-%s': %s\", arch, err)\n\t\t\treturn\n\t\t}\n\t}()\n\n\ttime.Sleep(50 * time.Millisecond)\n\n\tvar vmerr error\n\tselect {\n\tcase vmerr = <-errc:\n\t\tif vmerr != nil {\n\t\t\treturn nil, vmerr\n\t\t}\n\tdefault:\n\t\tbreak\n\t}\n\n\treturn proc, nil\n}", "title": "" }, { "docid": "67a779a4370d55ee6a464f9da172ae95", "score": "0.4970159", "text": "func (m *Machine) GetCPU() int {\n\treturn m.GetData().Get(\"Driver\").Get(\"CPU\").MustInt()\n}", "title": "" }, { "docid": "4f0a0bf7005aac3572dc12b3c60138c7", "score": "0.49631396", "text": "func getCPU() (info *hostCPU, err error) {\n\tinfo = &hostCPU{}\n\n\t// get physical cpu stats\n\tvar cpus []cpu.InfoStat\n\n\t// On Windows this can sometimes take longer than the default timeout (10 seconds).\n\tctx, cancel := context.WithTimeout(context.Background(), cpuStatsTimeout)\n\tdefer cancel()\n\n\tcpus, err = cpuInfo(ctx)\n\tif err != nil {\n\t\treturn info, err\n\t}\n\n\tinfo.HostPhysicalCPUs = len(cpus)\n\n\t// get logical cpu stats\n\tinfo.HostLogicalCPUs, err = cpuCounts(ctx, true)\n\tif err != nil {\n\t\treturn info, err\n\t}\n\n\t// total number of cpu cores\n\tfor i := range cpus {\n\t\tinfo.HostCPUCores += int64(cpus[i].Cores)\n\t\t// TODO: This is not ideal... if there are different processors\n\t\t// we will only report one of the models... This is unlikely to happen,\n\t\t// but it could\n\t\tinfo.HostCPUModel = cpus[i].ModelName\n\t}\n\n\terr = fillPlatformSpecificCPUData(info)\n\treturn info, err\n}", "title": "" }, { "docid": "5e389073eebda68c26cc5259a7859474", "score": "0.49506348", "text": "func (d *DefaultResourceManager) allocateCpuResource(cpu float64, offer *MesosOfferResources) bool {\n\tif offer.Cpu-cpu >= 0 {\n\t\toffer.Cpu = offer.Cpu - cpu\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "47dbf29b8d314c607cbb87f3acc4f67e", "score": "0.49467924", "text": "func (t *OpenconfigSystem_System_Cpus) GetCpu(Index OpenconfigSystem_System_Cpus_Cpu_State_Index_Union) *OpenconfigSystem_System_Cpus_Cpu {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := Index\n\n\tif lm, ok := t.Cpu[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e6c9a120174bbcc55799e9334fbeb126", "score": "0.49407327", "text": "func NewMachine(name string, outlets int) *Machine {\n\tm := &Machine{\n\t\tName: name,\n\t\tOutlets: outlets,\n\t\tsem: make(chan string, outlets),\n\t\tstore: make(map[string]int),\n\t}\n\treturn m\n}", "title": "" }, { "docid": "cb8f5e7f601456a1a570b6e09039917d", "score": "0.4933748", "text": "func (o PlatformPropertiesOutput) Cpu() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v PlatformProperties) *int { return v.Cpu }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "789de745d6d6858b84fce30ca710d850", "score": "0.4897213", "text": "func New(source string, typ processor.CodeType, taskNum int, chunkSize int64) *scheduler {\n\tsFile, err := os.Open(source)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tsc := &scheduler{\n\t\tschedulerType: typ,\n\t\tchunkSize: chunkSize,\n\t\tchanTask: make(chan *processor.TaskProperty, taskNum),\n\t\twg: &sync.WaitGroup{},\n\t\tsFile: sFile,\n\t\tmutex: &sync.RWMutex{},\n\t\tcollectChan: make(chan *processor.DataChunk, taskNum),\n\t}\n\n\t// set basic info\n\tif typ == processor.EncodeType {\n\t\tsc.dispatch = sc.encodeDispatch\n\t\tsInfo, err := sc.sFile.Stat()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tsc.retainSize = sInfo.Size()\n\t\tsc.fileSize = sc.retainSize\n\t} else if typ == processor.DecodeType {\n\t\tsc.dispatch = sc.decodeDispatch\n\t} else {\n\t\tpanic(\"error typ\")\n\t}\n\n\t// init processor\n\tfor i := 0; i < taskNum; i++ {\n\t\tsc.pools = append(sc.pools, processor.New(sc.schedulerType, chunkSize, sc.chanTask, sc.sFile, sc.mutex))\n\t}\n\treturn sc\n}", "title": "" }, { "docid": "b11c31a15b4326f75a7ad6db4e3b9983", "score": "0.48969173", "text": "func (o PlatformPropertiesPtrOutput) Cpu() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *PlatformProperties) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Cpu\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "0a3cd3cfa4856cc5b277664ea7b70f86", "score": "0.48848903", "text": "func NewRAM() *pc.Memory {\n\treturn &pc.Memory{\n\t\tValue: uint64(random.Integer(4, 64)),\n\t\tUnit: pc.Memory_GIGABYTE,\n\t}\n}", "title": "" }, { "docid": "c348024ce4825431303eb6edc1d3424b", "score": "0.48826054", "text": "func New(w, h, c int) *Board {\n\tresult := &Board{}\n\tresult.Board = ttgboard.NewBoard(w, h, c)\n\n\timg, _, err := image.Decode(bytes.NewReader(tgassets.ImageX))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tresult.imgX = ebiten.NewImageFromImage(img)\n\n\timg, _, err = image.Decode(bytes.NewReader(tgassets.ImageO))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tresult.imgO = ebiten.NewImageFromImage(img)\n\n\treturn result\n}", "title": "" }, { "docid": "ee38b83778689d6b4d930906b8224789", "score": "0.4873866", "text": "func (m *MixerTelemetryConfig) GetCpu() *CPUTargetUtilizationConfig {\n\tif m != nil {\n\t\treturn m.Cpu\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ee38b83778689d6b4d930906b8224789", "score": "0.4873866", "text": "func (m *MixerTelemetryConfig) GetCpu() *CPUTargetUtilizationConfig {\n\tif m != nil {\n\t\treturn m.Cpu\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ee38b83778689d6b4d930906b8224789", "score": "0.4873866", "text": "func (m *MixerTelemetryConfig) GetCpu() *CPUTargetUtilizationConfig {\n\tif m != nil {\n\t\treturn m.Cpu\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "939a62e62b59110616d1fb4621196b6b", "score": "0.4867902", "text": "func newCPUSupply(n Node, isolated, sharable cpuset.CPUSet, granted int) CPUSupply {\n\treturn &cpuSupply{\n\t\tnode: n,\n\t\tisolated: isolated.Clone(),\n\t\tsharable: sharable.Clone(),\n\t\tgranted: granted,\n\t}\n}", "title": "" }, { "docid": "d2689741a91c1f45ebf8eb42b7127b6a", "score": "0.48481488", "text": "func (in *CPU) DeepCopy() *CPU {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CPU)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d2689741a91c1f45ebf8eb42b7127b6a", "score": "0.48481488", "text": "func (in *CPU) DeepCopy() *CPU {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CPU)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "73ab6f03ba238f6e955bdd137a46990e", "score": "0.48457548", "text": "func New(pin machine.Pin) Device {\n\treturn Device{\n\t\tpin: pin,\n\t\tHigh: false,\n\t\tBPM: 96.0,\n\t}\n}", "title": "" }, { "docid": "4ca3e16ae727690f750531ff87c34b97", "score": "0.4844682", "text": "func NewMemory(romData []uint8) *Memory {\n\tm := &Memory{}\n\n\tif len(romData) > len(m.ram)-ProgramStartAddress {\n\t\tpanic(\"Could not load ROM into emulator memory. Too big.\")\n\t}\n\n\tcopy(m.ram[HexSpriteAddress:], defaultCharacterSet())\n\tcopy(m.ram[ProgramStartAddress:], romData)\n\n\treturn m\n}", "title": "" }, { "docid": "58ac96202f69c850c8da7e1da0283f72", "score": "0.4844178", "text": "func (t *ThermosExecutor) cpu(cpu float64) {\n\tt.Task.Resources.CPU = &cpu\n}", "title": "" }, { "docid": "1b7eafa1d59b360b9ac6d342b62be06c", "score": "0.48231047", "text": "func (m *CoreDNSConfig) GetCpu() *CPUTargetUtilizationConfig {\n\tif m != nil {\n\t\treturn m.Cpu\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "894c9757a090a62d3478bd6180c97e15", "score": "0.48172054", "text": "func NewController(cpuLoad, memLoad resource.Load, cpuMonitor, memMonitor resource.Monitor) *Controller {\n\treturn &Controller{\n\t\tcpuLoad: cpuLoad,\n\t\tmemLoad: memLoad,\n\t\tcpuMonitor: cpuMonitor,\n\t\tmemMonitor: memMonitor,\n\t}\n}", "title": "" }, { "docid": "80969ae710dd877ddd820e2c7bca6f0f", "score": "0.48138192", "text": "func (o *ControllersUpdateResourceSettingsTemplateRequest) SetCpuRequest(v string) {\n\to.CpuRequest = &v\n}", "title": "" }, { "docid": "cc6cd20145fc78bcb283bd8b029f6f50", "score": "0.48111933", "text": "func New(pin machine.GPIO) Device {\n\treturn Device{pin}\n}", "title": "" }, { "docid": "e1c14b367073797e52615fd963521328", "score": "0.4795994", "text": "func NewVirtualMachine(config *VirtualMachineConfiguration) *VirtualMachine {\n\tid := xid.New().String()\n\tcs := charWithGoString(id)\n\tdefer cs.Free()\n\tstatuses[id] = &machineStatus{\n\t\tstate: VirtualMachineState(0),\n\t\tstateNotify: make(chan VirtualMachineState),\n\t}\n\thandlers[id] = &machineHandlers{\n\t\tstart: func(error) {},\n\t\tpause: func(error) {},\n\t\tresume: func(error) {},\n\t}\n\tdispatchQueue := C.makeDispatchQueue(cs.CString())\n\tv := &VirtualMachine{\n\t\tid: id,\n\t\tpointer: pointer{\n\t\t\tptr: C.newVZVirtualMachineWithDispatchQueue(\n\t\t\t\tconfig.Ptr(),\n\t\t\t\tdispatchQueue,\n\t\t\t\tcs.CString(),\n\t\t\t),\n\t\t},\n\t\tdispatchQueue: dispatchQueue,\n\t}\n\truntime.SetFinalizer(v, func(self *VirtualMachine) {\n\t\treleaseDispatch(self.dispatchQueue)\n\t\tself.Release()\n\t})\n\treturn v\n}", "title": "" }, { "docid": "32949835234de2ebc31118f126d33187", "score": "0.47954875", "text": "func (c *Cpu) LoadRom(r []byte) {\n\t// Clear memory.\n\tfor m := 0; m < 4096; m++ {\n\t\tc.Memory[m] = 0x00\n\t}\n\n\t// Copy program into memory starting at 0x200.\n\tfor index, b := range r {\n\t\tc.Memory[index+0x200] = b\n\t}\n}", "title": "" }, { "docid": "8be80c3b18bb65956c1aefe8a973eb56", "score": "0.4785087", "text": "func (e Emulator) GetCPU() *i6502.Cpu {\n\treturn e.CPU\n}", "title": "" }, { "docid": "ca0774a758e1ebf09a410a7986ac9fff", "score": "0.47828257", "text": "func (sys *system) CPU(id idset.ID) CPU {\n\treturn sys.cpus[id]\n}", "title": "" }, { "docid": "26ccb6387094855c3bcc4e5ef0ae60cc", "score": "0.4778104", "text": "func (o PlatformPropertiesResponseOutput) Cpu() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v PlatformPropertiesResponse) *int { return v.Cpu }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "b1148dcb3e41eacf211cf5e82a548708", "score": "0.4772774", "text": "func (cm *CPUManager) Start(ctx context.Context, req *v1.CPURequest) (*v1.StatusResponse, error) {\n\tctx, span := trace.StartSpan(ctx, \"v1.api.cpu.Start\")\n\tdefer span.End()\n\n\tresp := make(chan response, 1)\n\n\tgo func() {\n\t\tresp <- cm.startCPU(req)\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\t<-resp\n\t\t_ = level.Warn(cm.Logger).Log(\"msg\", \"Context error encountered\", \"err\", ctx.Err())\n\t\treturn prepareResponse(\"\", ctx.Err())\n\tcase r := <-resp:\n\t\treturn prepareResponse(r.message, r.err)\n\t}\n}", "title": "" }, { "docid": "9d3f4ecca896ef05e88e324b3a1d63b2", "score": "0.47727218", "text": "func NewGPU() *pc.GPU {\n\tbrand := random.GPUBrand()\n\tminGhz := random.Float(1.0, 1.5)\n\tgpu := &pc.GPU{\n\t\tBrand: brand,\n\t\tName: random.GPUName(brand),\n\t\tMinGhz: minGhz,\n\t\tMaxGhz: random.Float(minGhz, 2.0),\n\t\tMemory: &pc.Memory{\n\t\t\tValue: uint64(random.Integer(2, 6)),\n\t\t\tUnit: pc.Memory_GIGABYTE,\n\t\t},\n\t}\n\treturn gpu\n}", "title": "" }, { "docid": "32bb8805e62d6b37fe25b6d334a76356", "score": "0.477251", "text": "func cpu() {\n\ttype Message struct {\n\t\tTest string\n\t}\n\n\tlog.Print(\"Loading CPU 100%\")\n\tfor {\n\t\tconst testBytes = `{ \"Test\": \"value\" }`\n\t\titer := int64(8000000)\n\t\tstart := time.Now()\n\t\tp := &Message{}\n\t\tfor i := int64(1); i < iter; i++ {\n\t\t\tjson.NewDecoder(strings.NewReader(testBytes)).Decode(p)\n\t\t}\n\t\td := time.Since(start)\n\n\t\tlog.Printf(\"[Load cycle complete]. Took %.2f seconds\", d.Seconds())\n\t\ttime.Sleep(1 * time.Millisecond)\n\t}\n\n}", "title": "" } ]
00769f6f3bc3c515d14771837c245c09
Machine returns the machine with the given tag.
[ { "docid": "2291a1450bd611d8e1b7a7664f375aa1", "score": "0.7853031", "text": "func (st *State) Machine(machineTag string) (*Machine, error) {\n\ttag, err := names.ParseMachineTag(machineTag)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Machine{\n\t\ttag: tag,\n\t\tst: st,\n\t}, nil\n}", "title": "" } ]
[ { "docid": "331b68e0a7ea1371b8cea186f4a6a886", "score": "0.77869195", "text": "func (st *State) Machine(machineTag string) (*Machine, error) {\n\tlife, err := st.life(machineTag)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttag, err := names.ParseMachineTag(machineTag)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Machine{\n\t\ttag: tag,\n\t\tlife: life,\n\t\tst: st,\n\t}, nil\n}", "title": "" }, { "docid": "20063bf8b3a9a0f3d8349cc24e455592", "score": "0.6621291", "text": "func (h *Headscale) GetMachine(namespace string, name string) (*Machine, error) {\n\tmachines, err := h.ListMachinesInNamespace(namespace)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, m := range *machines {\n\t\tif m.Name == name {\n\t\t\treturn &m, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"not found\")\n}", "title": "" }, { "docid": "33a5623597729b6882b3eb8e95d4359a", "score": "0.6307434", "text": "func GetMachine(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *MachineState, opts ...pulumi.ResourceOption) (*Machine, error) {\n\tvar resource Machine\n\terr := ctx.ReadResource(\"azure-native:hybridcompute/v20190802preview:Machine\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "c7b2e37188bd8e93d6d9365d3abd6fd8", "score": "0.6295807", "text": "func GetMachine(c client.Client, name string) (*mapiv1beta1.Machine, error) {\n\tmachine := &mapiv1beta1.Machine{}\n\tkey := client.ObjectKey{Namespace: MachineAPINamespace, Name: name}\n\n\tif err := c.Get(context.Background(), key, machine); err != nil {\n\t\treturn nil, fmt.Errorf(\"error querying api for machine object: %v\", err)\n\t}\n\n\treturn machine, nil\n}", "title": "" }, { "docid": "d4182e1be3dc83ca31776075c1d43ff1", "score": "0.6292191", "text": "func MachineGet(r shared.RemoteDef, id string) (shared.MachineDef, error) {\n\tvar m shared.MachineDef\n\n\tresp, err := Get(r, fmt.Sprintf(\"/machines/%s\", id))\n\tif err != nil {\n\t\treturn m, err\n\t}\n\n\terr = DecodeJson(resp, &m)\n\tif err != nil {\n\t\treturn m, err\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "9b696cc9bbce2b4307a60cabc7c8c667", "score": "0.62899315", "text": "func (mp *StaticProvider) GetMachine(name string) (machine.Machine, error) {\n\tdbClient := mp.clientset.CoreV1().ConfigMaps(mp.dbNamespace)\n\n\tallocatedMachine, err := dbClient.List(metav1.ListOptions{LabelSelector: fmt.Sprintf(\"name=%s\", name)})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to fetch allocated machine config maps: %v\", err)\n\t}\n\tif len(allocatedMachine.Items) == 0 {\n\t\treturn nil, nil\n\t}\n\t// if len(allocatedMachine.Items) > 1 {\n\t// \treturn nil, fmt.Errorf(\"invalid number of machines returned for name %q: %d\", name, len(allocatedMachine.Items))\n\t// }\n\treturn &StaticProviderMachine{\n\t\tid: allocatedMachine.Items[0].Name,\n\t\tname: name,\n\t\thostname: allocatedMachine.Items[0].Data[\"hostname\"],\n\t\tipaddr: allocatedMachine.Items[0].Data[\"ipAddr\"],\n\t}, nil\n}", "title": "" }, { "docid": "99988a47f9b8ce1f43d2140283d0925c", "score": "0.6213507", "text": "func GetMachine(id string) (*Machine, error) {\n\tstdout, stderr, err := vbmOutErr(\"showvminfo\", id, \"--machinereadable\")\n\tif err != nil {\n\t\tif reMachineNotFound.FindString(stderr) != \"\" {\n\t\t\treturn nil, ErrMachineNotExist\n\t\t}\n\t\treturn nil, err\n\t}\n\ts := bufio.NewScanner(strings.NewReader(stdout))\n\tm := &Machine{}\n\tfor s.Scan() {\n\t\tres := reVMInfoLine.FindStringSubmatch(s.Text())\n\t\tif res == nil {\n\t\t\tcontinue\n\t\t}\n\t\tkey := res[1]\n\t\tif key == \"\" {\n\t\t\tkey = res[2]\n\t\t}\n\t\tval := res[3]\n\t\tif val == \"\" {\n\t\t\tval = res[4]\n\t\t}\n\n\t\tswitch key {\n\t\tcase \"name\":\n\t\t\tm.Name = val\n\t\tcase \"UUID\":\n\t\t\tm.UUID = val\n\t\tcase \"VMState\":\n\t\t\tm.State = MachineState(val)\n\t\tcase \"memory\":\n\t\t\tn, err := strconv.ParseUint(val, 10, 32)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tm.Memory = uint(n)\n\t\tcase \"cpus\":\n\t\t\tn, err := strconv.ParseUint(val, 10, 32)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tm.CPUs = uint(n)\n\t\tcase \"vram\":\n\t\t\tn, err := strconv.ParseUint(val, 10, 32)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tm.VRAM = uint(n)\n\t\tcase \"CfgFile\":\n\t\t\tm.CfgFile = val\n\t\t\tm.BaseFolder = filepath.Dir(val)\n\t\tcase \"description\":\n\t\t\tm.Description = val\n\t\t}\n\t}\n\tif err := s.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "c9352ca8b2dc5eebfe355eb7a14a1336", "score": "0.6144007", "text": "func NewMachine() *Machine {\n\treturn &Machine{}\n}", "title": "" }, { "docid": "c9352ca8b2dc5eebfe355eb7a14a1336", "score": "0.6144007", "text": "func NewMachine() *Machine {\n\treturn &Machine{}\n}", "title": "" }, { "docid": "e0a75524199055ba9a2584e88b876c66", "score": "0.61407393", "text": "func (tileImpl *TileImpl) Machine() newtonian.Machine {\n\treturn tileImpl.machineImpl\n}", "title": "" }, { "docid": "e88b848616e27922cbcb6c788037271b", "score": "0.60090655", "text": "func Machine() MachineBuilder {\n\treturn MachineBuilder{}\n}", "title": "" }, { "docid": "d51aeedd0e4695049afb5912e2d1a81c", "score": "0.59340537", "text": "func (b *Builder) FindMachine(assignedLabel string) *models.Machine {\n\tif assignedLabel == \"\" {\n\t\treturn nil\n\t}\n\n\tfor _, m := range b.Machines {\n\t\tif label, ok := m.Meta[\"assignedLabel\"].(string); ok && label == assignedLabel {\n\t\t\treturn m\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "92b51a0f29f0b527ee8765bc2a91234a", "score": "0.59208", "text": "func (svc *ResourceGroupsService) GetMachine(guid string) (\n\tresponse MachineResourceGroupResponse,\n\terr error,\n) {\n\tvar rawResponse resourceGroupWorkaroundResponse\n\terr = svc.get(guid, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn setMachineAccountResponse(rawResponse)\n}", "title": "" }, { "docid": "7c29a537808197678b8bc1047789cb0b", "score": "0.58959436", "text": "func (c *SwarmCluster) GetMachine(name string) (*dockermachine.Machine, error) {\n\tfor _, m := range c.Workers {\n\t\tif m.Host.Name == name {\n\t\t\treturn m, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"machine %s not found\", name)\n}", "title": "" }, { "docid": "da9dd01a4528ac8482329d4714d52dc5", "score": "0.58160275", "text": "func NewMachine(orm *ORM, cai *CAI) *Machine {\n\treturn &Machine{ORM: orm, CAI: cai}\n}", "title": "" }, { "docid": "a0ecac98932b6cd8cbc6ff06bbb104ac", "score": "0.57640964", "text": "func (s *Supervisor) Machine() Machine {\n\treturn s.machine\n}", "title": "" }, { "docid": "f8305a565da6ebc441a20e1ed9067803", "score": "0.57539475", "text": "func (a *Agent) Machine() *machine.Machine {\n\treturn a.machine\n}", "title": "" }, { "docid": "a2c172a42d0d630391128ddedeebf548", "score": "0.5687918", "text": "func (vb *VirtualBox) FindMachine(nameOrID string) (*Machine, error) {\n\tif err := vb.assertMobRef(); err != nil {\n\t\treturn nil, err\n\t}\n\n\trequest := findMachineRequest{VbID: vb.mobref, NameOrID: nameOrID}\n\tresponse := new(findMachineResponse)\n\terr := vb.send(request, response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm := &Machine{mobref: response.Returnval, vb: vb}\n\treturn m, nil\n}", "title": "" }, { "docid": "4ff428790417b5e7a2621febcf4246ff", "score": "0.55489844", "text": "func (u *Universe) VM(hostname string) *VM {\n\tu.mu.Lock()\n\tdefer u.mu.Unlock()\n\treturn u.vms[hostname]\n}", "title": "" }, { "docid": "e67ba5fe7cf0a473159f927ff8c6f689", "score": "0.55299693", "text": "func NewMachine(client *gomaasapi.MAASObject) *Machine {\n\treturn &Machine{client: client}\n}", "title": "" }, { "docid": "1ff7e5c18a8aa741df04d145df1aaaba", "score": "0.54444677", "text": "func NewMachine(address common.Address, backend bind.ContractBackend) (*Machine, error) {\n\tcontract, err := bindMachine(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Machine{MachineCaller: MachineCaller{contract: contract}, MachineTransactor: MachineTransactor{contract: contract}, MachineFilterer: MachineFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "f89d9e83f4126638ed6521d6fba5403a", "score": "0.5431862", "text": "func New() *Machine {\n\treturn &Machine{\n\t\trand: newRandomizer(),\n\t}\n}", "title": "" }, { "docid": "2337c880364fbe4b577442e529ed684b", "score": "0.54278183", "text": "func NewMachine() Machine {\n\tvar m Machine\n\tm.tape = make(tapeType)\n\tm.sm = make(statemachine)\n\treturn m\n}", "title": "" }, { "docid": "fb6fe52efad14c53ad7e7c01862a2b29", "score": "0.54071057", "text": "func NewMachine(ctx *pulumi.Context,\n\tname string, args *MachineArgs, opts ...pulumi.ResourceOption) (*Machine, 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\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20190802preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20190318preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20190318preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20191212:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20191212:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20200730preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20200730preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20200802:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20200802:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20200815preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20200815preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210128preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210128preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210325preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210325preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210422preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210422preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210517preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210517preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210520:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210520:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210610preview:Machine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210610preview:Machine\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource Machine\n\terr := ctx.RegisterResource(\"azure-native:hybridcompute/v20190802preview:Machine\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "96040c93c6d1aa66dc815fcc0e506168", "score": "0.5376662", "text": "func dockerMachineInspect(name string) (*machine, error) {\n\tvar (\n\t\tm = new(machine)\n\t\tb bytes.Buffer\n\t)\n\tcmd := exec.Command(\"docker-machine\", \"inspect\", name)\n\tcmd.Stdin = os.Stdin\n\tcmd.Stderr = os.Stderr\n\tcmd.Stdout = &b\n\n\tif err := cmd.Run(); err != nil {\n\t\treturn m, err\n\t}\n\tjson.Unmarshal(b.Bytes(), &m)\n\treturn m, nil\n}", "title": "" }, { "docid": "e6c9a120174bbcc55799e9334fbeb126", "score": "0.5368223", "text": "func NewMachine(name string, outlets int) *Machine {\n\tm := &Machine{\n\t\tName: name,\n\t\tOutlets: outlets,\n\t\tsem: make(chan string, outlets),\n\t\tstore: make(map[string]int),\n\t}\n\treturn m\n}", "title": "" }, { "docid": "2e0095cad2ec9132b2030850b9e2a0fc", "score": "0.5365455", "text": "func (h *Headscale) GetMachineByID(id uint64) (*Machine, error) {\n\tm := Machine{}\n\tif result := h.db.Find(&Machine{ID: id}).First(&m); result.Error != nil {\n\t\treturn nil, result.Error\n\t}\n\treturn &m, nil\n}", "title": "" }, { "docid": "e50b55fc6b8ccf204a416a306bc10e4f", "score": "0.53599924", "text": "func (s *Service) CreateOrGetMachine(machine *clusterv1.Machine, status *v1alpha1.AWSMachineProviderStatus, config *v1alpha1.AWSMachineProviderConfig, clusterStatus *v1alpha1.AWSClusterProviderStatus, clusterConfig *v1alpha1.AWSClusterProviderConfig, cluster *clusterv1.Cluster, bootstrapToken string) (*v1alpha1.Instance, error) {\n\tklog.V(2).Infof(\"Attempting to create or get machine %q\", machine.Name)\n\n\t// instance id exists, try to get it\n\tif status.InstanceID != nil {\n\t\tklog.V(2).Infof(\"Looking up machine %q by id %q\", machine.Name, *status.InstanceID)\n\n\t\tinstance, err := s.InstanceIfExists(status.InstanceID)\n\t\tif err != nil && !awserrors.IsNotFound(err) {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to look up machine %q by id %q\", machine.Name, *status.InstanceID)\n\t\t} else if err == nil && instance != nil {\n\t\t\treturn instance, nil\n\t\t}\n\t}\n\n\tklog.V(2).Infof(\"Looking up machine %q by tags\", machine.Name)\n\tinstance, err := s.InstanceByTags(machine, cluster)\n\tif err != nil && !awserrors.IsNotFound(err) {\n\t\treturn nil, errors.Wrapf(err, \"failed to query machine %q instance by tags\", machine.Name)\n\t} else if err == nil && instance != nil {\n\t\treturn instance, nil\n\t}\n\n\treturn s.CreateInstance(machine, config, clusterStatus, clusterConfig, cluster, bootstrapToken)\n}", "title": "" }, { "docid": "a577a3225b4c24dfe71b911d324ce783", "score": "0.52890974", "text": "func (m *Machine) Get(systemID string) ([]byte, error) {\n\tmc := m.client.GetSubObject(\"machines\").GetSubObject(systemID)\n\tres, err := mc.CallGet(\"\", url.Values{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res.GetBytes()\n}", "title": "" }, { "docid": "48b48feaa369ef959fab190ba9ddb630", "score": "0.52611524", "text": "func MachineCreate(r shared.RemoteDef, req shared.MachineDef) (shared.MachineDef, error) {\n\tvar m shared.MachineDef\n\n\tresp, err := PostJson(r, \"/machines\", req)\n\tif err != nil {\n\t\treturn m, err\n\t}\n\n\terr = DecodeJson(resp, &m)\n\tif err != nil {\n\t\treturn m, err\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "75e164f5c96348fc1fd7b582004d940c", "score": "0.52564514", "text": "func GetMachineGuest(ctx context.Context) *api.MachineGuest {\n\tvar guest api.MachineGuest\n\tguest.SetSize(api.DefaultVMSize)\n\n\tif IsSpecified(ctx, \"vm-size\") {\n\t\tguest.SetSize(GetString(ctx, \"vm-size\"))\n\t}\n\tif IsSpecified(ctx, \"vm-cpus\") {\n\t\tguest.CPUs = GetInt(ctx, \"vm-cpus\")\n\t}\n\tif IsSpecified(ctx, \"vm-memory\") {\n\t\tguest.MemoryMB = GetInt(ctx, \"vm-memory\")\n\t}\n\tif IsSpecified(ctx, \"vm-cpukind\") {\n\t\tguest.CPUKind = GetString(ctx, \"vm-cpukind\")\n\t}\n\treturn &guest\n}", "title": "" }, { "docid": "ae3c544478ca67bffd00b366f0c3b01e", "score": "0.525057", "text": "func (s *Service) CreateOrGetMachine(machine *actuators.MachineScope, bootstrapToken, kubeConfig string) (*v1alpha1.VM, error) {\n\tklog.V(2).Infof(\"Attempting to create or get machine %q\", machine.Name())\n\n\t// instance id exists, try to get it\n\tif machine.MachineStatus.VMID != nil {\n\t\tklog.V(2).Infof(\"Looking up machine %q (id: %q)\", machine.Name(), *machine.MachineStatus.VMID)\n\n\t\tinstance, err := s.VMIfExists(machine.Name())\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to look up machine %q (id: %q)\", machine.Name(), *machine.MachineStatus.VMID)\n\t\t} else if err == nil && instance != nil {\n\t\t\treturn instance, nil\n\t\t}\n\t}\n\n\tinstance, err := s.createVM(machine, bootstrapToken, kubeConfig)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Failed to create virtual machine %q\", machine.Name())\n\t}\n\n\treturn instance, nil\n}", "title": "" }, { "docid": "2adf4b566f945210fd613fc956d47ba2", "score": "0.5208331", "text": "func NewMachine(initial State, opts ...MachineOption) (*Machine, error) {\n\tmachine := &Machine{\n\t\tcurrent: initial,\n\t\tinitial: initial,\n\t\tallowable: map[State][]State{},\n\t}\n\tfor _, opt := range opts {\n\t\tif err := opt(machine); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn machine, nil\n}", "title": "" }, { "docid": "f54b62ea137e05bda7c8edc100d4fa3d", "score": "0.5203514", "text": "func New() *Machine {\n\treturn &Machine{\n\t\tstack: stack.New(),\n\t\tinstructions: []ByteCode{\n\t\t\tICONST, 1,\n\t\t\tICONST, 2,\n\t\t\tICONST, 3,\n\t\t\tIADD,\n\t\t\tIADD,\n\t\t\tPRINT,\n\t\t\tHALT,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "fcd80b39ee861e423e3242ae30c816c9", "score": "0.5157135", "text": "func (k *Key) QueryMachine() *MachineQuery {\n\treturn (&KeyClient{config: k.config}).QueryMachine(k)\n}", "title": "" }, { "docid": "692c0ca686f1ea46efc0524737858f88", "score": "0.5113641", "text": "func (c *Client) MachineInfo() (minfo *v1.MachineInfo, err error) {\n\tu := c.machineInfoURL()\n\tret := new(v1.MachineInfo)\n\tif err = c.httpGetJSONData(ret, nil, u, \"machine info\"); err != nil {\n\t\treturn\n\t}\n\tminfo = ret\n\treturn\n}", "title": "" }, { "docid": "74d804535ea5ec466104b1e166b16fd2", "score": "0.50617474", "text": "func NewMachineCommand() *Machine {\n\treturn &Machine{\n\t\tcommonFlags: &commonFlags{},\n\t}\n}", "title": "" }, { "docid": "0f874b9aa90b0ad554e8f022de748bd6", "score": "0.50408036", "text": "func (m *OnPremisesAgent) GetMachineName()(*string) {\n val, err := m.GetBackingStore().Get(\"machineName\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "262265a77439214182a89fad1ce581fa", "score": "0.5036267", "text": "func (m MachineBuilder) Build() *machinev1beta1.Machine {\n\tmachine := &machinev1beta1.Machine{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tGenerateName: m.generateName,\n\t\t\tCreationTimestamp: m.creationTimestamp,\n\t\t\tDeletionTimestamp: m.deletionTimestamp,\n\t\t\tName: m.name,\n\t\t\tNamespace: m.namespace,\n\t\t\tLabels: m.labels,\n\t\t},\n\t\tStatus: machinev1beta1.MachineStatus{\n\t\t\tErrorMessage: m.errorMessage,\n\t\t\tPhase: m.phase,\n\t\t\tNodeRef: m.nodeRef,\n\t\t},\n\t}\n\n\tif m.providerSpecBuilder != nil {\n\t\tmachine.Spec.ProviderSpec.Value = m.providerSpecBuilder.BuildRawExtension()\n\t}\n\n\tm.WithLabel(machinev1beta1.MachineClusterIDLabel, resourcebuilder.TestClusterIDValue)\n\n\treturn machine\n}", "title": "" }, { "docid": "3f835fa31f8964cc9cce2faa5fc03513", "score": "0.5031016", "text": "func GetMachineName() string {\n\t// REFACTOR NECESSARY: This function should not rely on globals.\n\tif viper.GetString(MachineProfile) == \"\" {\n\t\treturn \"minikube\"\n\t}\n\treturn viper.GetString(MachineProfile)\n}", "title": "" }, { "docid": "49a618ca7ba080e2320c8842aa416ca6", "score": "0.50038576", "text": "func New(ctx context.Context, options ...Opt) *Machine {\n\topts := &option{}\n\tfor _, o := range options {\n\t\to(opts)\n\t}\n\tif opts.maxRoutines <= 0 {\n\t\topts.maxRoutines = DefaultMaxRoutines\n\t}\n\tif opts.pubsub == nil {\n\t\topts.pubsub = &pubSub{\n\t\t\tsubscriptions: map[string]map[int]chan interface{}{},\n\t\t\tsubMu: sync.RWMutex{},\n\t\t}\n\t}\n\tctx, cancel := context.WithCancel(ctx)\n\tm := &Machine{\n\t\tparent: opts.parent,\n\t\tchildren: opts.children,\n\t\tdone: make(chan struct{}, 1),\n\t\tmiddlewares: opts.middlewares,\n\t\tcancel: cancel,\n\t\tctx: ctx,\n\t\tworkQueue: make(chan *work),\n\t\tmu: sync.RWMutex{},\n\t\troutines: map[int]Routine{},\n\t\ttags: opts.tags,\n\t\tmax: opts.maxRoutines,\n\t\tcloseOnce: sync.Once{},\n\t\tdoneOnce: sync.Once{},\n\t\tpubsub: opts.pubsub,\n\t\ttotal: 0,\n\t}\n\tgo m.serve()\n\treturn m\n}", "title": "" }, { "docid": "77054134d19b5bd95197259b38437414", "score": "0.49994317", "text": "func (is *ovirtClient) GetVMByMachine(machine machinev1.Machine) (instance *Instance, err error) {\n\tif machine.Spec.ProviderID != nil && *machine.Spec.ProviderID != \"\" {\n\t\tinstance, err = is.GetVMByID(*machine.Spec.ProviderID)\n\t\tif err == nil {\n\t\t\treturn instance, err\n\t\t}\n\t}\n\tinstance, err = is.GetVMByName(machine.Name)\n\treturn instance, err\n}", "title": "" }, { "docid": "f47729925336d05a5cf7c6c502a7458b", "score": "0.4996653", "text": "func (d *ExternalDriver) GetMachineClass(machineClassMeta *MachineClassMeta) (interface{}, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)\n\tdefer cancel()\n\n\tresp, err := d.client.GetMachineClass(ctx, &pb.MachineClassMeta{\n\t\tName: machineClassMeta.Name,\n\t\tRevision: machineClassMeta.Revision,\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsErr := resp.Error\n\tif sErr != \"\" {\n\t\treturn nil, errors.New(sErr)\n\t}\n\n\treturn resp.Data, nil\n}", "title": "" }, { "docid": "989a4a73ebca6bce471ee345e36f605a", "score": "0.49824086", "text": "func (dc *controller) getMachineDeploymentForMachine(ctx context.Context, machine *v1alpha1.Machine) *v1alpha1.MachineDeployment {\n\t// Find the owning machine set\n\tvar is *v1alpha1.MachineSet\n\tvar err error\n\tcontrollerRef := metav1.GetControllerOf(machine)\n\tif controllerRef == nil {\n\t\t// No controller owns this Machine.\n\t\treturn nil\n\t}\n\tif controllerRef.Kind != \"MachineSet\" { //TODO: Remove hardcoded string\n\t\t// Not a Machine owned by a machine set.\n\t\treturn nil\n\t}\n\tis, err = dc.controlMachineClient.MachineSets(machine.Namespace).Get(ctx, controllerRef.Name, metav1.GetOptions{})\n\tif err != nil || is.UID != controllerRef.UID {\n\t\tklog.V(4).Infof(\"Cannot get machineset %q for machine %q: %v\", controllerRef.Name, machine.Name, err)\n\t\treturn nil\n\t}\n\n\t// Now find the Deployment that owns that MachineSet.\n\tcontrollerRef = metav1.GetControllerOf(is)\n\tif controllerRef == nil {\n\t\treturn nil\n\t}\n\treturn dc.resolveDeploymentControllerRef(is.Namespace, controllerRef)\n}", "title": "" }, { "docid": "1256d6c79e5839c6ff8c9c0a8449b4c9", "score": "0.49611452", "text": "func (c *machineRemediationOperators) Get(name string, options v1.GetOptions) (result *v1alpha1.MachineRemediationOperator, err error) {\n\tresult = &v1alpha1.MachineRemediationOperator{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"machineremediationoperators\").\n\t\tName(name).\n\t\tVersionedParams(&options, scheme.ParameterCodec).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "d805edb77a5c8ca562fdeedd39342eb6", "score": "0.4937709", "text": "func GetMachineGroup(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *MachineGroupState, opts ...pulumi.ResourceOption) (*MachineGroup, error) {\n\tvar resource MachineGroup\n\terr := ctx.ReadResource(\"alicloud:log/machineGroup:MachineGroup\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "8fa1d2862ac18474eb3f2fcf35095f94", "score": "0.48901802", "text": "func DeployMachine(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Machine, error) {\n\tparsed, err := abi.JSON(strings.NewReader(MachineABI))\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\n\taddress, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(MachineBin), backend)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &Machine{MachineCaller: MachineCaller{contract: contract}, MachineTransactor: MachineTransactor{contract: contract}, MachineFilterer: MachineFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "9b5b297d899d4e21f7032810a8bfc7dd", "score": "0.4875987", "text": "func machineID() (string, error) {\n\tid, err := readHostid()\n\tif err != nil {\n\t\t// try fallback\n\t\tid, err = readKenv()\n\t}\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn id, nil\n}", "title": "" }, { "docid": "328ba153a425bf4e72bc9fd472535fd9", "score": "0.48752776", "text": "func (a *Actuator) CreateMachine(cluster *clusterv1.Cluster, machine *clusterv1.Machine) (*ec2.Reservation, error) {\n\t// Extract cluster operator cluster\n\tcoCluster, err := a.clusterOperatorCluster(cluster)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif coCluster.Spec.Hardware.AWS == nil {\n\t\treturn nil, fmt.Errorf(\"Cluster does not contain an AWS hardware spec\")\n\t}\n\n\tregion := coCluster.Spec.Hardware.AWS.Region\n\ta.logger.Debug(\"Obtaining EC2 client for region %q\", region)\n\tclient, err := a.ec2Client(region)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to obtain EC2 client: %v\", err)\n\t}\n\n\t// For now, we store the machineSet resource in the machine.\n\t// It really should be the machine resource, but it's not yet\n\t// fleshed out in the Cluster Operator API\n\tcoMachineSet, coClusterVersion, err := a.clusterOperatorMachineSet(machine)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ta.logger.Debug(\"Creating a machine for machineset %q and cluster version %q\", coMachineSet.Name, coClusterVersion.Name)\n\n\tif coClusterVersion.Spec.VMImages.AWSImages == nil {\n\t\treturn nil, fmt.Errorf(\"cluster version does not contain AWS images\")\n\t}\n\n\t// Get AMI to use\n\tamiName := amiForRegion(coClusterVersion.Spec.VMImages.AWSImages.RegionAMIs, region)\n\tif len(amiName) == 0 {\n\t\treturn nil, fmt.Errorf(\"cannot determine AMI name from cluster version %q and region %s\", coClusterVersion.Name, region)\n\t}\n\n\ta.logger.Debug(\"Describing AMI %q\", amiName)\n\timageIds := []*string{aws.String(amiName)}\n\tdescribeImagesRequest := ec2.DescribeImagesInput{\n\t\tImageIds: imageIds,\n\t}\n\tdescribeAMIResult, err := client.DescribeImages(&describeImagesRequest)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error describing AMI %s: %v\", amiName, err)\n\t}\n\ta.logger.Debug(\"Describe AMI result:\\n%s\", describeAMIResult)\n\tif len(describeAMIResult.Images) != 1 {\n\t\treturn nil, fmt.Errorf(\"Unexpected number of images returned: %d\", len(describeAMIResult.Images))\n\t}\n\n\t// Describe VPC\n\tvpcName := coCluster.Name\n\tvpcNameFilter := \"tag:Name\"\n\tdescribeVpcsRequest := ec2.DescribeVpcsInput{\n\t\tFilters: []*ec2.Filter{{Name: &vpcNameFilter, Values: []*string{&vpcName}}},\n\t}\n\tdescribeVpcsResult, err := client.DescribeVpcs(&describeVpcsRequest)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error describing VPC %s: %v\", vpcName, err)\n\t}\n\ta.logger.Debug(\"Describe VPC result:\\n%v\", describeVpcsResult)\n\tif len(describeVpcsResult.Vpcs) != 1 {\n\t\treturn nil, fmt.Errorf(\"Unexpected number of VPCs: %d\", len(describeVpcsResult.Vpcs))\n\t}\n\tvpcID := *(describeVpcsResult.Vpcs[0].VpcId)\n\n\t// Describe Subnet\n\tdescribeSubnetsRequest := ec2.DescribeSubnetsInput{\n\t\tFilters: []*ec2.Filter{\n\t\t\t{Name: aws.String(\"vpc-id\"), Values: []*string{aws.String(vpcID)}},\n\t\t},\n\t}\n\t// Filter by default availability zone if one was passed, otherwise, take the first subnet\n\t// that comes back.\n\tif len(a.defaultAvailabilityZone) > 0 {\n\t\tdescribeSubnetsRequest.Filters = append(describeSubnetsRequest.Filters, &ec2.Filter{Name: aws.String(\"availability-zone\"), Values: []*string{aws.String(a.defaultAvailabilityZone)}})\n\t}\n\tdescribeSubnetsResult, err := client.DescribeSubnets(&describeSubnetsRequest)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error describing Subnets for VPC %s: %v\", vpcName, err)\n\t}\n\ta.logger.Debug(\"Describe Subnets result:\\n%v\", describeSubnetsResult)\n\tif len(describeSubnetsResult.Subnets) == 0 {\n\t\treturn nil, fmt.Errorf(\"Did not find a subnet\")\n\t}\n\n\t// Determine security groups\n\tvar groupName, groupNameK8s string\n\tif coMachineSet.Spec.Infra {\n\t\tgroupName = vpcName + \"_infra\"\n\t\tgroupNameK8s = vpcName + \"_infra_k8s\"\n\t} else {\n\t\tgroupName = vpcName + \"_compute\"\n\t\tgroupNameK8s = vpcName + \"_compute_k8s\"\n\t}\n\tsecurityGroupNames := []*string{&vpcName, &groupName, &groupNameK8s}\n\tsgNameFilter := \"group-name\"\n\tdescribeSecurityGroupsRequest := ec2.DescribeSecurityGroupsInput{\n\t\tFilters: []*ec2.Filter{\n\t\t\t{Name: aws.String(\"vpc-id\"), Values: []*string{&vpcID}},\n\t\t\t{Name: &sgNameFilter, Values: securityGroupNames},\n\t\t},\n\t}\n\tdescribeSecurityGroupsResult, err := client.DescribeSecurityGroups(&describeSecurityGroupsRequest)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ta.logger.Debug(\"Describe Security Groups result:\\n%v\", describeSecurityGroupsResult)\n\n\tvar securityGroupIds []*string\n\tfor _, g := range describeSecurityGroupsResult.SecurityGroups {\n\t\tgroupID := *g.GroupId\n\t\tsecurityGroupIds = append(securityGroupIds, &groupID)\n\t}\n\n\t// build list of networkInterfaces (just 1 for now)\n\tvar networkInterfaces = []*ec2.InstanceNetworkInterfaceSpecification{\n\t\t{\n\t\t\tDeviceIndex: aws.Int64(0),\n\t\t\tAssociatePublicIpAddress: aws.Bool(true),\n\t\t\tSubnetId: describeSubnetsResult.Subnets[0].SubnetId,\n\t\t\tGroups: securityGroupIds,\n\t\t},\n\t}\n\n\t// Add tags to the created machine\n\ttagList := []*ec2.Tag{\n\t\t{Key: aws.String(\"clusterid\"), Value: aws.String(coCluster.Name)},\n\t\t{Key: aws.String(\"kubernetes.io/cluster/\" + coCluster.Name), Value: aws.String(coCluster.Name)},\n\t\t{Key: aws.String(\"Name\"), Value: aws.String(machine.Name)},\n\t}\n\ttagInstance := &ec2.TagSpecification{\n\t\tResourceType: aws.String(\"instance\"),\n\t\tTags: tagList,\n\t}\n\ttagVolume := &ec2.TagSpecification{\n\t\tResourceType: aws.String(\"volume\"),\n\t\tTags: tagList[0:1],\n\t}\n\n\t// For now, these are fixed\n\tblkDeviceMappings := []*ec2.BlockDeviceMapping{\n\t\t{\n\t\t\tDeviceName: aws.String(\"/dev/sda1\"),\n\t\t\tEbs: &ec2.EbsBlockDevice{\n\t\t\t\tDeleteOnTermination: aws.Bool(true),\n\t\t\t\tVolumeSize: aws.Int64(100),\n\t\t\t\tVolumeType: aws.String(\"gp2\"),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tDeviceName: aws.String(\"/dev/sdb\"),\n\t\t\tEbs: &ec2.EbsBlockDevice{\n\t\t\t\tDeleteOnTermination: aws.Bool(true),\n\t\t\t\tVolumeSize: aws.Int64(100),\n\t\t\t\tVolumeType: aws.String(\"gp2\"),\n\t\t\t},\n\t\t},\n\t}\n\n\tbootstrapKubeConfig, err := getBootstrapKubeconfig()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot get bootstrap kubeconfig: %v\", err)\n\t}\n\tuserData := getUserData(bootstrapKubeConfig, coMachineSet.Spec.Infra)\n\tuserDataEnc := base64.StdEncoding.EncodeToString([]byte(userData))\n\n\tinputConfig := ec2.RunInstancesInput{\n\t\tImageId: describeAMIResult.Images[0].ImageId,\n\t\tInstanceType: aws.String(coMachineSet.Spec.Hardware.AWS.InstanceType),\n\t\tMinCount: aws.Int64(1),\n\t\tMaxCount: aws.Int64(1),\n\t\tUserData: &userDataEnc,\n\t\tKeyName: aws.String(coCluster.Spec.Hardware.AWS.KeyPairName),\n\t\tIamInstanceProfile: &ec2.IamInstanceProfileSpecification{\n\t\t\tName: aws.String(iamRole(coCluster)),\n\t\t},\n\t\tBlockDeviceMappings: blkDeviceMappings,\n\t\tTagSpecifications: []*ec2.TagSpecification{tagInstance, tagVolume},\n\t\tNetworkInterfaces: networkInterfaces,\n\t}\n\n\trunResult, err := client.RunInstances(&inputConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create EC2 instance: %v\", err)\n\t}\n\ta.logger.Debug(\"Run Instances result:\\n%v\", runResult)\n\n\treturn runResult, nil\n}", "title": "" }, { "docid": "4c2f762dd0407ead80ad3ef1f4a0871e", "score": "0.4863173", "text": "func GetMachineID() (string, error) {\n\tout, err := exec.Command(\"ioreg\", \"-rd1\", \"-c\", \"IOPlatformExpertDevice\").Output()\n\tif err == nil {\n\t\tre := regexp.MustCompile(\"\\\"IOPlatformSerialNumber\\\" = \\\"(.*)\\\"\")\n\t\tret := re.FindStringSubmatch(string(out))\n\t\tif len(ret) == 2 {\n\t\t\treturn ret[1], nil\n\t\t}\n\t}\n\treturn \"\", errors.New(\"can't generate machine ID\")\n}", "title": "" }, { "docid": "7af76b1847ddec5f5ee6268ad72770ad", "score": "0.48458025", "text": "func (machineImpl *MachineImpl) Tile() newtonian.Tile {\n\treturn machineImpl.tileImpl\n}", "title": "" }, { "docid": "6430cb84702ddf95e73f4d3f96842a34", "score": "0.4830282", "text": "func (mCmd *Machine) Parse(args []string) error {\n\treturn nil\n}", "title": "" }, { "docid": "80992b1fd7b3c0904f7ec0bd34ceeef6", "score": "0.48268738", "text": "func MachineUpdate(r shared.RemoteDef, id string, req shared.MachineDef) (shared.MachineDef, error) {\n\tvar m shared.MachineDef\n\n\tresp, err := PostJson(r, fmt.Sprintf(\"/machines/%s\", id), req)\n\tif err != nil {\n\t\treturn m, err\n\t}\n\n\terr = DecodeJson(resp, &m)\n\tif err != nil {\n\t\treturn m, err\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "0816e70f62b1df22910b4ca98a7f9c7b", "score": "0.48232016", "text": "func getMachineDeployment(proxy cluster.Proxy, name, namespace string) (*clusterv1.MachineDeployment, error) {\n\tmdObj := &clusterv1.MachineDeployment{}\n\tc, err := proxy.NewClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmdObjKey := client.ObjectKey{\n\t\tNamespace: namespace,\n\t\tName: name,\n\t}\n\tif err := c.Get(context.TODO(), mdObjKey, mdObj); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error reading %q %s/%s\",\n\t\t\tmdObj.GroupVersionKind(), mdObjKey.Namespace, mdObjKey.Name)\n\t}\n\treturn mdObj, nil\n}", "title": "" }, { "docid": "7d2f676369ccbb06d46486e5f128618d", "score": "0.48199093", "text": "func New(prog []byte) (*Mach, error) {\n\tp := prog\n\tif len(p) < 4 {\n\t\treturn nil, errors.New(\"program too short, need at least 4 bytes\")\n\t}\n\n\tif p[0] != _machVersionCode {\n\t\treturn nil, fmt.Errorf(\"unsupported stackvm program version %02x\", p[0])\n\t}\n\tp = p[1:]\n\n\tstackSize := binary.BigEndian.Uint16(p)\n\tif stackSize%_pageSize != 0 {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"invalid stacksize %#02x, not a %#02x-multiple\",\n\t\t\tstackSize, _pageSize)\n\t}\n\tp = p[2:]\n\n\tm := Mach{\n\t\tctx: defaultContext,\n\t\topc: makeOpCache(len(p)),\n\t\tpbp: 0,\n\t\tpsp: _pspInit,\n\t\tcbp: uint32(stackSize) - 4,\n\t\tcsp: uint32(stackSize) - 4,\n\t\tip: uint32(stackSize),\n\t}\n\n\tm.storeBytes(m.ip, p)\n\t// TODO mark code segment, update data\n\n\treturn &m, nil\n}", "title": "" }, { "docid": "f1255a28c0436a4f9234cdc46d383e59", "score": "0.4803948", "text": "func GetMachineFromNode(c client.Client, node *corev1.Node) (*mapiv1beta1.Machine, error) {\n\tmachineNamespaceKey, ok := node.Annotations[MachineAnnotationKey]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"node %q does not have a MachineAnnotationKey %q\",\n\t\t\tnode.Name, MachineAnnotationKey)\n\t}\n\tnamespace, machineName, err := cache.SplitMetaNamespaceKey(machineNamespaceKey)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"machine annotation format is incorrect %v: %v\",\n\t\t\tmachineNamespaceKey, err)\n\t}\n\n\tif namespace != MachineAPINamespace {\n\t\treturn nil, fmt.Errorf(\"Machine %q is forbidden to live outside of default %v namespace\",\n\t\t\tmachineNamespaceKey, MachineAPINamespace)\n\t}\n\n\tmachine, err := GetMachine(c, machineName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error querying api for machine object: %v\", err)\n\t}\n\n\treturn machine, nil\n}", "title": "" }, { "docid": "9e265a8dab139e5e677a69d47d1891f6", "score": "0.4797284", "text": "func GetOwnerCAPIMachine(obj runtime.Object, cache capicontrollers.MachineCache) (*capi.Machine, error) {\n\tref, namespace, err := GetOwnerFromGVK(capi.GroupVersion.String(), \"Machine\", obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cache.Get(namespace, ref.Name)\n}", "title": "" }, { "docid": "dbd42e815ae381685f292fd3e1e3757f", "score": "0.47889808", "text": "func (m *ManagedAppRegistration) GetDeviceTag()(*string) {\n return m.deviceTag\n}", "title": "" }, { "docid": "3822f3c84e38e80187f01ff264e0c01a", "score": "0.47038558", "text": "func NewMachine(cores int, memory uint64) Machine {\n\tvar machine Machine\n\tmachine.Cores = cores\n\tmachine.Memory = memory\n\tmachine.drives = make([]Drive, 0)\n\n\treturn machine\n}", "title": "" }, { "docid": "b5df062604d3d496c539284b3d592b41", "score": "0.4693951", "text": "func (s *MachinePolicyService) Get(machinePoliciesQuery MachinePoliciesQuery) (*resources.Resources[*MachinePolicy], error) {\n\tpath, err := s.GetURITemplate().Expand(machinePoliciesQuery)\n\tif err != nil {\n\t\treturn &resources.Resources[*MachinePolicy]{}, err\n\t}\n\n\tresponse, err := api.ApiGet(s.GetClient(), new(resources.Resources[*MachinePolicy]), path)\n\tif err != nil {\n\t\treturn &resources.Resources[*MachinePolicy]{}, err\n\t}\n\n\treturn response.(*resources.Resources[*MachinePolicy]), nil\n}", "title": "" }, { "docid": "a0dd5782f03427d55ceb9221e305b455", "score": "0.46859562", "text": "func (s *Service) GetVirtualMachineTag(vmID int, tagKey string) (Tag, error) {\n\tbody, err := s.getVirtualMachineTagResponseBody(vmID, tagKey)\n\n\treturn body.Data, err\n}", "title": "" }, { "docid": "506756b647444ef2a4ab7e3adbf8a7ed", "score": "0.4672479", "text": "func (h *RestoreHandler) getVM(vmRestore *harvesterv1.VirtualMachineRestore) (*kv1.VirtualMachine, error) {\n\tswitch vmRestore.Spec.Target.Kind {\n\tcase kv1.VirtualMachineGroupVersionKind.Kind:\n\t\tvm, err := h.vmCache.Get(vmRestore.Namespace, vmRestore.Spec.Target.Name)\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn vm, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"unknown target %+v\", vmRestore.Spec.Target)\n}", "title": "" }, { "docid": "d1f2fd79182506a1d25aee08d0af98d7", "score": "0.46572226", "text": "func (o *PostMachineParams) SetMachine(machine *models.Machine) {\n\to.Machine = machine\n}", "title": "" }, { "docid": "ac9cfa20a7da1825e18e4646400e9089", "score": "0.46516627", "text": "func (e KeyEdges) MachineOrErr() (*Machine, error) {\n\tif e.loadedTypes[0] {\n\t\tif e.Machine == nil {\n\t\t\t// The edge machine was loaded in eager-loading,\n\t\t\t// but was not found.\n\t\t\treturn nil, &NotFoundError{label: machine.Label}\n\t\t}\n\t\treturn e.Machine, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"machine\"}\n}", "title": "" }, { "docid": "d9ec1c9ed79b1c34ac4e6c0f50338878", "score": "0.4649015", "text": "func NewMachineGroup(ctx *pulumi.Context,\n\tname string, args *MachineGroupArgs, opts ...pulumi.ResourceOption) (*MachineGroup, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.IdentifyLists == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'IdentifyLists'\")\n\t}\n\tif args.Project == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Project'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource MachineGroup\n\terr := ctx.RegisterResource(\"alicloud:log/machineGroup:MachineGroup\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "c5d25ff8fdae57433d26356dd767bea5", "score": "0.4634818", "text": "func (m *MicrosoftAuthenticatorAuthenticationMethod) GetDeviceTag()(*string) {\n val, err := m.GetBackingStore().Get(\"deviceTag\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "a5da38a68ef77bd9640832113bf0a354", "score": "0.4614333", "text": "func NewMachineFilterer(address common.Address, filterer bind.ContractFilterer) (*MachineFilterer, error) {\n\tcontract, err := bindMachine(address, nil, nil, filterer)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &MachineFilterer{contract: contract}, nil\n}", "title": "" }, { "docid": "0807af034affcf3312533aeabc736ef7", "score": "0.46036676", "text": "func NewOpbeatMachine() OpbeatMachine {\n\tvar machine = OpbeatMachine{}\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\treturn machine\n\t}\n\tmachine.Hostname = hostname\n\treturn machine\n}", "title": "" }, { "docid": "1662f7395072a76264a53071da54bd1e", "score": "0.45868555", "text": "func (p *Machine) Tags() []string {\n\treturn p.tags\n}", "title": "" }, { "docid": "37fa2c78479971ac4ac042b29b09b5c9", "score": "0.45818844", "text": "func MachineStop(r shared.RemoteDef, id string) error {\n\tresp, err := Get(r, fmt.Sprintf(\"/machines/%s/stop\", id))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = CheckResponse(resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "31947659a13fd3338bc48a6a02f76c69", "score": "0.45753318", "text": "func (r *AzureStackHCIMachineReconciler) getVMImage(scope *scope.MachineScope) (*infrav1.Image, error) {\n\t// Use custom image if provided\n\tif scope.AzureStackHCIMachine.Spec.Image.Name != nil && *scope.AzureStackHCIMachine.Spec.Image.Name != \"\" {\n\t\tscope.Info(\"Using custom image name for machine\", \"machine\", scope.AzureStackHCIMachine.GetName(), \"imageName\", scope.AzureStackHCIMachine.Spec.Image.Name)\n\t\treturn &scope.AzureStackHCIMachine.Spec.Image, nil\n\t}\n\n\treturn azurestackhci.GetDefaultImage(scope.AzureStackHCIMachine.Spec.Image.OSType, to.String(scope.Machine.Spec.Version))\n}", "title": "" }, { "docid": "6b08c8f674bb49b6e7ce628c2d480f75", "score": "0.45369428", "text": "func (m *MetaData) MachineID() (string, error) {\n\tif m == nil {\n\t\treturn \"\", errors.New(errors.KsiInvalidArgumentError)\n\t}\n\tif m.machineID == nil {\n\t\treturn \"\", nil\n\t}\n\treturn *m.machineID, nil\n}", "title": "" }, { "docid": "d349e9c4d23e9883c3c11b2b1f4f9aec", "score": "0.45301834", "text": "func (p *Provider) CreateMachine(ctx context.Context, req *driver.CreateMachineRequest) (*driver.CreateMachineResponse, error) {\n\tklog.V(2).Infof(\"machine creation request has been recieved for %q\", req.Machine.Name)\n\tproviderSpec, err := decodeProviderSpecAndSecret(req.MachineClass, req.Secret)\n\tif err != nil {\n\t\tklog.Error(err.Error())\n\t\treturn nil, err\n\t}\n\n\tm, err := p.initDriver(req.Secret)\n\tif err != nil {\n\t\tklog.Error(err.Error())\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tnetworks := []metalgo.MachineAllocationNetwork{\n\t\t{\n\t\t\tAutoacquire: true,\n\t\t\tNetworkID: providerSpec.Network,\n\t\t},\n\t}\n\tuserData := strings.TrimSpace(string(req.Secret.Data[\"userData\"]))\n\n\tcreateRequest := &metalgo.MachineCreateRequest{\n\t\tDescription: req.Machine.Name + \" created by Gardener.\",\n\t\tName: req.Machine.Name,\n\t\tHostname: req.Machine.Name,\n\t\tUserData: userData,\n\t\tSize: providerSpec.Size,\n\t\tProject: providerSpec.Project,\n\t\tNetworks: networks,\n\t\tPartition: providerSpec.Partition,\n\t\tImage: providerSpec.Image,\n\t\tTags: providerSpec.Tags,\n\t\tSSHPublicKeys: providerSpec.SSHKeys,\n\t}\n\n\tmcr, err := m.MachineCreate(createRequest)\n\tif err != nil {\n\t\tklog.Errorf(\"could not create machine: %v\", err)\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tklog.V(2).Infof(\"machine creation request has been processed for %q\", req.Machine.Name)\n\n\treturn &driver.CreateMachineResponse{\n\t\tProviderID: encodeMachineID(providerSpec.Partition, *mcr.Machine.ID),\n\t\tNodeName: *mcr.Machine.Allocation.Name,\n\t}, nil\n}", "title": "" }, { "docid": "20c44e38015587c2429c5a00637e7fc2", "score": "0.45202103", "text": "func (i *slogInstance) Tag(tag string) Instance {\n\ti2 := i.clone()\n\ti2.tag = tag\n\treturn i2\n}", "title": "" }, { "docid": "ab862a8fa1fb09a2505d0659a72912c2", "score": "0.45128408", "text": "func (ex *Executor) getMachineByName(_ context.Context, machineName string) (*servers.Server, error) {\n\tvar (\n\t\tsearchClusterName string\n\t\tsearchNodeRole string\n\t)\n\n\tfor key := range ex.Config.Spec.Tags {\n\t\tif strings.Contains(key, cloudprovider.ServerTagClusterPrefix) {\n\t\t\tsearchClusterName = key\n\t\t} else if strings.Contains(key, cloudprovider.ServerTagRolePrefix) {\n\t\t\tsearchNodeRole = key\n\t\t}\n\t}\n\n\tif searchClusterName == \"\" || searchNodeRole == \"\" {\n\t\tklog.Warningf(\"getMachineByName operation can not proceed: cluster/role tags are missing for machine [Name=%q]\", machineName)\n\t\treturn nil, fmt.Errorf(\"getMachineByName operation can not proceed: cluster/role tags are missing for machine [Name=%q]\", machineName)\n\t}\n\n\tlistedServers, err := ex.Compute.ListServers(&servers.ListOpts{\n\t\tName: machineName,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmatchingServers := []servers.Server{}\n\tfor _, server := range listedServers {\n\t\tif server.Name == machineName {\n\t\t\tif _, nameOk := server.Metadata[searchClusterName]; nameOk {\n\t\t\t\tif _, roleOk := server.Metadata[searchNodeRole]; roleOk {\n\t\t\t\t\tmatchingServers = append(matchingServers, server)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(matchingServers) > 1 {\n\t\treturn nil, fmt.Errorf(\"failed to find server [Name=%q]: %w\", machineName, ErrMultipleFound)\n\t} else if len(matchingServers) == 0 {\n\t\treturn nil, fmt.Errorf(\"failed to find server [Name=%q]: %w\", machineName, ErrNotFound)\n\t}\n\n\treturn &matchingServers[0], nil\n}", "title": "" }, { "docid": "220c67197407e0114b3534eb3dfc47ef", "score": "0.4473358", "text": "func (_Casper *CasperSession) MachineInformation(ip string) (*big.Int, error) {\n\treturn _Casper.Contract.MachineInformation(&_Casper.CallOpts, ip)\n}", "title": "" }, { "docid": "ba60d452480607640a66dbea7b69183a", "score": "0.44730508", "text": "func (p *QEMUVirtualization) NewMachine(opts machine.InitOptions) (machine.VM, error) {\n\tvmConfigDir, err := machine.GetConfDir(vmtype)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm := new(MachineVM)\n\tif len(opts.Name) > 0 {\n\t\tvm.Name = opts.Name\n\t}\n\n\t// set VM ignition file\n\tignitionFile, err := machine.NewMachineFile(filepath.Join(vmConfigDir, vm.Name+\".ign\"), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm.IgnitionFile = *ignitionFile\n\n\t// set VM image file\n\timagePath, err := machine.NewMachineFile(opts.ImagePath, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm.ImagePath = *imagePath\n\n\tvm.RemoteUsername = opts.Username\n\n\t// Add a random port for ssh\n\tport, err := utils.GetRandomPort()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm.Port = port\n\n\tvm.CPUs = opts.CPUS\n\tvm.Memory = opts.Memory\n\tvm.DiskSize = opts.DiskSize\n\n\tvm.Created = time.Now()\n\n\t// find QEMU binary\n\texecPath, err := findQEMUBinary()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := vm.setPIDSocket(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Add qmp socket\n\tif err := vm.setQMPMonitorSocket(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := vm.setReadySocket(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// configure command to run\n\tvm.setNewMachineCMD(execPath)\n\treturn vm, nil\n}", "title": "" }, { "docid": "1f6b6e6f10b5d02bb9ca74d6d7f919c0", "score": "0.44683555", "text": "func New(impl *Implementation) *Machine {\n\timpl.mergeStdlib()\n\ti := impl.dup()\n\n\tm := &Machine{\n\t\timpl: i,\n\t\texec: make(chan *mProcess),\n\t\tenv: make(map[string]string, 0),\n\t}\n\n\tgo m.run()\n\n\treturn m\n}", "title": "" }, { "docid": "fe0db52c5fdb500d8a389583c167d149", "score": "0.44613007", "text": "func (vm *VirtualMachine) VirtualMachine(ctx *context.Context) *object.VirtualMachine {\n\tkey := vm.Ref.String()\n\n\tif v := ctx.Value(key); v != nil {\n\t\treturn v.(*object.VirtualMachine)\n\t}\n\n\tf := vm.Datastore.Datacenter.NewFinder(ctx)\n\n\tv, err := f.ObjectReference(ctx, vm.Ref)\n\n\tif err != nil {\n\t\tglog.Fatalf(\"Can't find virtual machine:%s\", vm.Name)\n\t}\n\n\t//\tv := object.NewVirtualMachine(vm.VimClient(), vm.Ref)\n\n\tctx.WithValue(key, v)\n\tctx.WithValue(fmt.Sprintf(\"[%s] %s\", vm.Datastore.Name, vm.Name), v)\n\n\treturn v.(*object.VirtualMachine)\n}", "title": "" }, { "docid": "e20999c7ed4c5e54913563487a5d138f", "score": "0.44391313", "text": "func (a *Client) GetMachineNetworkInterface(params *GetMachineNetworkInterfaceParams, opts ...ClientOption) (*GetMachineNetworkInterfaceOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetMachineNetworkInterfaceParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"getMachineNetworkInterface\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/iaas/api/machines/{id}/network-interfaces/{networkId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetMachineNetworkInterfaceReader{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.(*GetMachineNetworkInterfaceOK)\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 getMachineNetworkInterface: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "a513bc87d5fbf5f18162d4cc7b7a3764", "score": "0.44379705", "text": "func Tag(tag string) string {\n\ttag = strings.TrimSpace(tag)\n\ttag = strings.TrimSuffix(tag, \"/\")\n\n\t// Anime\n\tmatches := animeLinkRegex.FindStringSubmatch(tag)\n\n\tif len(matches) > 1 {\n\t\treturn \"anime:\" + matches[1]\n\t}\n\n\t// Osu beatmap\n\tmatches = osuBeatmapRegex.FindStringSubmatch(tag)\n\n\tif len(matches) > 1 {\n\t\treturn \"osu-beatmap:\" + matches[1]\n\t}\n\n\treturn tag\n}", "title": "" }, { "docid": "d984889049e6fb90e226b5ed546e6fe1", "score": "0.44202474", "text": "func New(prog []byte, mbos ...MachBuildOpt) (*Mach, error) {\n\tvar mb machBuilder\n\tif err := mb.build(prog, mbos...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &mb.Mach, nil\n}", "title": "" }, { "docid": "7ed87216d770f235c16162223a25b419", "score": "0.44185317", "text": "func (az *Cloud) getVirtualMachine(nodeName types.NodeName, crt azcache.AzureCacheReadType) (vm compute.VirtualMachine, err error) {\n\tvmName := string(nodeName)\n\tcachedVM, err := az.vmCache.Get(vmName, crt)\n\tif err != nil {\n\t\treturn vm, err\n\t}\n\n\tif cachedVM == nil {\n\t\treturn vm, cloudprovider.InstanceNotFound\n\t}\n\n\treturn *(cachedVM.(*compute.VirtualMachine)), nil\n}", "title": "" }, { "docid": "00f5f27b84283a60dcae147b04a76a70", "score": "0.44172168", "text": "func (svc *ResourceGroupsService) CreateMachine(data ResourceGroup) (\n\tresponse MachineResourceGroupResponse,\n\terr error,\n) {\n\terr = svc.create(data, &response)\n\treturn\n}", "title": "" }, { "docid": "6abe7ddb362481c0a3fdb8c2da83d20c", "score": "0.44136027", "text": "func readMachineID() []byte {\n\tvar sum [3]byte\n\tid := sum[:]\n\thostname, err1 := os.Hostname()\n\tif err1 != nil {\n\t\te := NewEncoder(0)\n\t\treturn UInt32Bytes(e.PCG32.Random())[0:3]\n\t}\n\thw := md5.New()\n\thw.Write([]byte(hostname))\n\tcopy(id, hw.Sum(nil))\n\treturn id\n}", "title": "" }, { "docid": "aea8f6188b64820988a6c34d2500ed48", "score": "0.4407485", "text": "func NewMachineFactory(\n\tcloudProvider CloudProvider,\n\tnodeType NodeType,\n\tsize string,\n) *MachineFactory {\n\treturn &MachineFactory{\n\t\tcloudProvider: cloudProvider,\n\t\tmachine: &Machine{\n\t\t\tNodeType: nodeType,\n\t\t\tSize: size,\n\t\t\tImage: LatestImage(cloudProvider, nodeType),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "7634f0952fb8f6ab2460f2ce84834ac3", "score": "0.4406645", "text": "func (p *Provider) GetMachineStatus(ctx context.Context, req *driver.GetMachineStatusRequest) (*driver.GetMachineStatusResponse, error) {\n\tklog.V(2).Infof(\"get request has been recieved for %q\", req.Machine.Name)\n\tproviderSpec, err := decodeProviderSpecAndSecret(req.MachineClass, req.Secret)\n\tif err != nil {\n\t\tklog.Error(err.Error())\n\t\treturn nil, err\n\t}\n\n\tclusterIDTag, err := extractClusterTag(providerSpec.Tags)\n\tif err != nil {\n\t\tklog.V(2).Infof(\"get request for machine %q failed because provider spec did not contain metal-stack cluster tag\", req.Machine.Name)\n\t\treturn nil, status.Error(codes.Internal, \"get machine request failed because provider spec did not contain metal-stack cluster tag for\")\n\t}\n\n\tm, err := p.initDriver(req.Secret)\n\tif err != nil {\n\t\tklog.Error(err.Error())\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tid := decodeMachineID(req.Machine.Spec.ProviderID)\n\n\tif id == \"\" {\n\t\treturn nil, status.Error(codes.NotFound, \"machine not found, not yet created\")\n\t}\n\n\tresp, err := m.MachineGet(id)\n\tif err != nil {\n\t\tklog.Error(err.Error())\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tif resp.Machine.Allocation == nil {\n\t\tklog.V(2).Infof(\"machine already released: %q\", req.Machine.Name)\n\t\treturn nil, status.Error(codes.NotFound, \"machine already released\")\n\t}\n\n\tmachineClusterIDTag, err := extractClusterTag(resp.Machine.Tags)\n\tif err != nil {\n\t\tklog.V(2).Infof(\"machine has no cluster tag anymore: %q\", req.Machine.Name)\n\t\treturn nil, status.Error(codes.NotFound, \"machine has no cluster tag anymore\")\n\t}\n\n\tif machineClusterIDTag != clusterIDTag {\n\t\tklog.V(2).Infof(\"machine does not belong to this cluster anymore: %q\", req.Machine.Name)\n\t\treturn nil, status.Error(codes.NotFound, \"machine does not belong to this cluster anymore\")\n\t}\n\n\tklog.V(2).Infof(\"machine get request has been processed successfully for %q\", req.Machine.Name)\n\n\treturn &driver.GetMachineStatusResponse{\n\t\tProviderID: encodeMachineID(*resp.Machine.Partition.ID, *resp.Machine.ID),\n\t\tNodeName: *resp.Machine.Allocation.Name,\n\t}, nil\n}", "title": "" }, { "docid": "df13b7998134ffba36b0c67cf226dd8e", "score": "0.4400831", "text": "func NewResizeMachineNotFound() *ResizeMachineNotFound {\n\treturn &ResizeMachineNotFound{}\n}", "title": "" }, { "docid": "7edaf8084278418d56e277e1d786b414", "score": "0.43994287", "text": "func (s machinePolicyService) Get(machinePoliciesQuery MachinePoliciesQuery) (*MachinePolicies, error) {\n\tpath, err := s.getURITemplate().Expand(machinePoliciesQuery)\n\tif err != nil {\n\t\treturn &MachinePolicies{}, err\n\t}\n\n\tresponse, err := apiGet(s.getClient(), new(MachinePolicies), path)\n\tif err != nil {\n\t\treturn &MachinePolicies{}, err\n\t}\n\n\treturn response.(*MachinePolicies), nil\n}", "title": "" }, { "docid": "53f2abf149eac6a137bea876e4b2121a", "score": "0.4399342", "text": "func NewTag(host ergo.Host) *Tag {\n\treturn &Tag{host: host}\n}", "title": "" }, { "docid": "ff25349ced5f4c56418583db94aab475", "score": "0.4387093", "text": "func FromYAML(file string, manager WatcherManager) (m *Machine, err error) {\n\tafile, err := filepath.Abs(file)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not determine absolute path for %s: %s\", file, err)\n\t}\n\n\tf, err := ioutil.ReadFile(afile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm = &Machine{}\n\terr = yaml.Unmarshal(f, m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm.notifiers = []NotificationService{}\n\tm.manager = manager\n\tm.directory = filepath.Dir(afile)\n\tm.manifest = afile\n\tm.instanceID = m.UniqueID()\n\tm.knownStates = make(map[string]bool)\n\n\terr = m.manager.SetMachine(m)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not register with manager: %s\", err)\n\t}\n\n\terr = m.Setup()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "7f6a5b49f0b8bc8e9f83ce16d387d635", "score": "0.43819192", "text": "func (m Rread) Tag() uint16 { return m.msg.Tag() }", "title": "" }, { "docid": "2c208e06c955227ebb6555ff5df6ee6e", "score": "0.43731534", "text": "func bindMachine(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(MachineABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "d9fdd03ab611077148d7c895fe6316bb", "score": "0.43712163", "text": "func (m *Machine) Remove() error {\n\treturn util.StreamCommand(\"docker-machine\", \"rm\", \"-y\", m.Name)\n}", "title": "" }, { "docid": "319bc0bd5583401ba80b5860592bef2e", "score": "0.43706658", "text": "func InfrastructureMachine() *InfrastructureMachineContract {\n\tonceInfrastructureMachine.Do(func() {\n\t\tinfrastructureMachine = &InfrastructureMachineContract{}\n\t})\n\treturn infrastructureMachine\n}", "title": "" }, { "docid": "fabbce645c13f8e8d163a13652334d04", "score": "0.43662673", "text": "func FromTag(t language.Tag) (Unit, language.Confidence) {\n\tif cur := t.TypeForKey(\"cu\"); len(cur) == 3 {\n\t\tc, _ := ParseISO(cur)\n\t\treturn c, language.Exact\n\t}\n\tr, conf := t.Region()\n\tif cur, ok := FromRegion(r); ok {\n\t\treturn cur, conf\n\t}\n\treturn Unit{}, language.No\n}", "title": "" }, { "docid": "959c55b317cbacf41643fbc5107b06f6", "score": "0.436502", "text": "func (_Casper *CasperCallerSession) MachineInformation(ip string) (*big.Int, error) {\n\treturn _Casper.Contract.MachineInformation(&_Casper.CallOpts, ip)\n}", "title": "" }, { "docid": "693a34f9a972f9744e61f5f20ef5b0f1", "score": "0.4363971", "text": "func (db Database) GetTag(name string) (Tag, error) {\n\tvar doc Tag\n\terr := db.database.C(\"tags\").Find(bson.M{\"name\": name}).One(&doc)\n\treturn doc, err\n}", "title": "" }, { "docid": "29d61c636f6aaed4ceac767ad979f349", "score": "0.43588334", "text": "func (is *ovirtClient) CreateVMByMachine(\n\tmachineName string,\n\tovirtClusterID string,\n\tignition []byte,\n\tproviderSpec *ovirtconfigv1.OvirtMachineProviderSpec) (instance *Instance, err error) {\n\tif machineName == \"\" {\n\t\treturn nil, errors.New(\"machine name must be specified to create instance\")\n\t}\n\tif ovirtClusterID == \"\" {\n\t\treturn nil, errors.New(\"ovirtClusterID must be specified to create instance\")\n\t}\n\tif providerSpec == nil {\n\t\treturn nil, errors.New(\"oVirt machine providerSpec must be specified to create instance\")\n\t}\n\n\tcluster := ovirtsdk.NewClusterBuilder().Id(providerSpec.ClusterId).MustBuild()\n\ttemplate := ovirtsdk.NewTemplateBuilder().Name(providerSpec.TemplateName).MustBuild()\n\tinit := ovirtsdk.NewInitializationBuilder().\n\t\tCustomScript(string(ignition)).\n\t\tHostName(machineName).\n\t\tMustBuild()\n\n\tvmBuilder := ovirtsdk.NewVmBuilder().\n\t\tName(machineName).\n\t\tCluster(cluster).\n\t\tTemplate(template).\n\t\tInitialization(init)\n\n\tif providerSpec.VMType != \"\" {\n\t\tvmBuilder.Type(ovirtsdk.VmType(providerSpec.VMType))\n\t}\n\tif providerSpec.InstanceTypeId != \"\" {\n\t\tvmBuilder.InstanceTypeBuilder(\n\t\t\tovirtsdk.NewInstanceTypeBuilder().\n\t\t\t\tId(providerSpec.InstanceTypeId))\n\t} else {\n\t\tif providerSpec.CPU != nil {\n\t\t\tvmBuilder.CpuBuilder(\n\t\t\t\tovirtsdk.NewCpuBuilder().\n\t\t\t\t\tTopologyBuilder(ovirtsdk.NewCpuTopologyBuilder().\n\t\t\t\t\t\tCores(int64(providerSpec.CPU.Cores)).\n\t\t\t\t\t\tSockets(int64(providerSpec.CPU.Sockets)).\n\t\t\t\t\t\tThreads(int64(providerSpec.CPU.Threads))))\n\t\t}\n\t\tif providerSpec.MemoryMB > 0 {\n\t\t\tvmBuilder.Memory(int64(BytesInMB) * int64(providerSpec.MemoryMB))\n\t\t}\n\t\tif providerSpec.GuaranteedMemoryMB > 0 {\n\t\t\tmemoryPolicyBuilder := ovirtsdk.NewMemoryPolicyBuilder()\n\t\t\tmemoryPolicyBuilder.Guaranteed(int64(BytesInMB) * int64(providerSpec.GuaranteedMemoryMB))\n\t\t\tmemoryPolicy, err := memoryPolicyBuilder.Build()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(\n\t\t\t\t\terr, \"error applying Guaranteed Memory for VM \")\n\t\t\t}\n\t\t\tvmBuilder.MemoryPolicy(memoryPolicy)\n\t\t}\n\t}\n\n\tisAutoPinning := false\n\tif providerSpec.AutoPinningPolicy != \"\" {\n\t\tautoPinningPolicy := mapAutoPinningPolicy(providerSpec.AutoPinningPolicy)\n\n\t\t// if we have a policy, we need to set the pinning to all the hosts in the cluster.\n\t\tif autoPinningPolicy != ovirtsdk.AUTOPINNINGPOLICY_DISABLED {\n\t\t\tisAutoPinning = true\n\t\t\thostsInCluster, err := is.getHostsInCluster(providerSpec.ClusterId)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrapf(\n\t\t\t\t\terr, \"error finding hosts in cluster %s\", providerSpec.ClusterId)\n\t\t\t}\n\t\t\tplacementPolicyBuilder := ovirtsdk.NewVmPlacementPolicyBuilder()\n\t\t\tplacementPolicy, err := placementPolicyBuilder.Hosts(hostsInCluster).\n\t\t\t\tAffinity(ovirtsdk.VMAFFINITY_MIGRATABLE).Build()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"failed to build the placement policy of the vm\")\n\t\t\t}\n\t\t\tvmBuilder.PlacementPolicy(placementPolicy)\n\t\t}\n\t}\n\tif providerSpec.Hugepages > 0 {\n\t\tcustomProp, err := ovirtsdk.NewCustomPropertyBuilder().\n\t\t\tName(\"hugepages\").\n\t\t\tValue(fmt.Sprint(providerSpec.Hugepages)).\n\t\t\tBuild()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"error setting hugepages custom property\")\n\t\t}\n\t\tvmBuilder.CustomPropertiesOfAny(customProp)\n\t}\n\n\tvm, err := vmBuilder.Build()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to construct VM struct\")\n\t}\n\n\tklog.Infof(\"creating VM: %v\", vm.MustName())\n\tresponse, err := is.connection.SystemService().VmsService().Add().Vm(vm).Send()\n\tif err != nil {\n\t\tklog.Errorf(\"Failed creating VM %v\", err)\n\t\treturn nil, errors.Wrap(err, \"error creating VM\")\n\t}\n\n\tvmID := response.MustVm().MustId()\n\n\terr = is.connection.WaitForVM(vmID, ovirtsdk.VMSTATUS_DOWN, time.Minute)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"timed out waiting for the VM creation to finish\")\n\t}\n\n\tvmService := is.connection.SystemService().VmsService().VmService(vmID)\n\n\tif providerSpec.OSDisk != nil {\n\t\terr = is.handleDiskExtension(vmService, response, providerSpec)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\terr = is.handleNics(vmService, providerSpec)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed handling nics creation for VM %s\", vm.MustName())\n\t}\n\n\tif isAutoPinning {\n\t\terr = is.handleAutoPinning(vmID, mapAutoPinningPolicy(providerSpec.AutoPinningPolicy))\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"updating the VM (%s) with auto pinning policy failed! %v\", vmID, err)\n\t\t}\n\t}\n\n\t_, err = is.connection.SystemService().VmsService().\n\t\tVmService(response.MustVm().MustId()).\n\t\tTagsService().Add().\n\t\tTag(ovirtsdk.NewTagBuilder().Name(ovirtClusterID).MustBuild()).\n\t\tSend()\n\tif err != nil {\n\t\tklog.Errorf(\"Failed to add tag to VM, skipping %v\", err)\n\t}\n\n\terr = is.handleAffinityGroups(\n\t\tresponse.MustVm(),\n\t\tproviderSpec.ClusterId,\n\t\tproviderSpec.AffinityGroupsNames)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Instance{response.MustVm()}, nil\n}", "title": "" }, { "docid": "b792148085d1b3dc369bfca58ba4cc0a", "score": "0.43587917", "text": "func (c *Creater) getTag(baseContainer string) string {\n\tif tag, ok := c.hubSpec.ImageTagMap[baseContainer]; ok {\n\t\treturn tag\n\t}\n\treturn c.hubSpec.HubVersion\n}", "title": "" } ]
658727b2eff88aa6d102d97869f9ac9d
String returns the string representation. API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".
[ { "docid": "5b9783019fa2ba07b87ff098aa6eb0a7", "score": "0.0", "text": "func (s UpdateRealtimeLogConfigInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
[ { "docid": "2e110f24163468aae67d3b2ae207c5b6", "score": "0.66352135", "text": "func (s Member) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.65435594", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.65435594", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.65435594", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.65435594", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.6543361", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.65416443", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "209f0ca319514f420a9b219d4e6407fc", "score": "0.6412581", "text": "func (s ApiPassthrough) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "796d3da09122d3a6eda8d85cd2072b9e", "score": "0.6376942", "text": "func (s GetMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "796d3da09122d3a6eda8d85cd2072b9e", "score": "0.6376735", "text": "func (s GetMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d9ee2b223b7036b0844ac2370527fbfe", "score": "0.6333552", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Distribution Params:\n Community Tax: %s\n Withdraw Addr Enabled: %t`,\n\t\tp.CommunityTax, p.WithdrawAddrEnabled)\n}", "title": "" }, { "docid": "0283ad9a395e675fe0a9ec712bceb034", "score": "0.6259585", "text": "func (s RequestParametersStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "41112ccec69ed7e5695800fb71ff6fea", "score": "0.6257606", "text": "func (rp RequestParam) String() string {\n\treturn rp.name + \":\" + rp.value\n}", "title": "" }, { "docid": "74841839d2e20d32eda2604b690f38eb", "score": "0.624718", "text": "func (s CreateMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7422e92ddcee98e4ae227fd7e12e513f", "score": "0.6220902", "text": "func (s GroupMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3604a1d12813ce519872a998508d98c7", "score": "0.6184691", "text": "func (s GetMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5c518cab9a26cf655d1488d854d900db", "score": "0.6176382", "text": "func (s ApiCallDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "accd4137f896762440eab638351d91b7", "score": "0.6166998", "text": "func (s ExtraParam) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "db46495338ceb36924c9a961792081f1", "score": "0.6151628", "text": "func (s Parameter) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "0cac5cf7ba8a7cfec01584f819c0b895", "score": "0.61362016", "text": "func (cwm ClanWarMember) String() string {\n\tb, _ := json.Marshal(cwm)\n\treturn string(b)\n}", "title": "" }, { "docid": "1b1b87fc2777c2421db74b56907cfd22", "score": "0.61262035", "text": "func (o ExportPolicyGetRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "5cfbfb73e613c5fbc899afb26c99fb8b", "score": "0.61179674", "text": "func (o VserverGetRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "fea6b1db8f7c88035ae711e8ab461794", "score": "0.610194", "text": "func (s OriginGroupMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "21b76ca7f7f0d64b84d5a5e4aa7bcffb", "score": "0.61003447", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params:\")\n\tsb.WriteString(fmt.Sprintf(\"TokenCacheSize:%v\\t\", p.TokenCacheSize))\n\tsb.WriteString(fmt.Sprintf(\"NewTokenFee:%v\\t\", p.NewTokenFee))\n\tsb.WriteString(fmt.Sprintf(\"ReservedSymbols:%s\\t\", strings.Join(p.ReservedSymbols, \",\")))\n\n\treturn sb.String()\n}", "title": "" }, { "docid": "be5fe10413aca4c98011d6d93dfe98a4", "score": "0.60903925", "text": "func (s GetMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "be5fe10413aca4c98011d6d93dfe98a4", "score": "0.6090287", "text": "func (s GetMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "27d311f685e6799a5346d860dceb8261", "score": "0.60838133", "text": "func (v *RPC) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [10]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"SpanContext: %v\", v.SpanContext)\n\ti++\n\tfields[i] = fmt.Sprintf(\"CallerName: %v\", v.CallerName)\n\ti++\n\tfields[i] = fmt.Sprintf(\"ServiceName: %v\", v.ServiceName)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Encoding: %v\", v.Encoding)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Procedure: %v\", v.Procedure)\n\ti++\n\tif v.Headers != nil {\n\t\tfields[i] = fmt.Sprintf(\"Headers: %v\", v.Headers)\n\t\ti++\n\t}\n\tif v.ShardKey != nil {\n\t\tfields[i] = fmt.Sprintf(\"ShardKey: %v\", *(v.ShardKey))\n\t\ti++\n\t}\n\tif v.RoutingKey != nil {\n\t\tfields[i] = fmt.Sprintf(\"RoutingKey: %v\", *(v.RoutingKey))\n\t\ti++\n\t}\n\tif v.RoutingDelegate != nil {\n\t\tfields[i] = fmt.Sprintf(\"RoutingDelegate: %v\", *(v.RoutingDelegate))\n\t\ti++\n\t}\n\tif v.Body != nil {\n\t\tfields[i] = fmt.Sprintf(\"Body: %v\", v.Body)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"RPC{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "ff5e36164a3ac20a1c3e997ce41e15b4", "score": "0.60817516", "text": "func (f Method) String() string {\n\treturn fmt.Sprintf(\"Name: %s (params: %s) (results: %s)\", f.Name, f.Params, f.Results)\n}", "title": "" }, { "docid": "73c0cab2005d31098ef74dae88190f1f", "score": "0.6069218", "text": "func (s CreateMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "73c0cab2005d31098ef74dae88190f1f", "score": "0.6069218", "text": "func (s CreateMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3d190d1152af6172b7350972bdbe6848", "score": "0.6043152", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\t\n\tMinters:\t\t\t%s\t\n\t`, p.Minters)\n}", "title": "" }, { "docid": "8652251f99cffbd32be4152d2d6a2ee9", "score": "0.60431224", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Coinswap Params:\n Fee:\t\t\t%s`, p.Fee.String(),\n\t)\n}", "title": "" }, { "docid": "85ce395912b475acdf3ad6330161a646", "score": "0.6038061", "text": "func (s ParameterNameValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d95172027cde329e808e45600a7c3aeb", "score": "0.60094285", "text": "func (p *Param) String() string {\n\tif p.Name != \"\" {\n\t\treturn fmt.Sprintf(\"%v[name=%v]\", p.Type.String(), p.Name)\n\t}\n\treturn p.Type.String()\n}", "title": "" }, { "docid": "e0f5a58ecaf50ed33ec2a7c0afae36ed", "score": "0.59985566", "text": "func (p *Parameter) String() string {\n\tdata, _ := json.Marshal(p) //nolint:errchkjson // returns empty string on error\n\treturn string(data)\n}", "title": "" }, { "docid": "12464d698c01cb5597d16be5802fc720", "score": "0.5993442", "text": "func (s ApiKeyFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "11a4e7851f5e03cc5470dce5aef81d39", "score": "0.5987286", "text": "func (s GetMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c636ce7d494602bf2b03d1557a31bcd2", "score": "0.5982597", "text": "func (p paramHeader) String() string {\n\treturn fmt.Sprintf(\"%s (%d): %s\", p.typ, p.len, hex.Dump(p.raw))\n}", "title": "" }, { "docid": "d882e5469cada469c07e60688de9f546", "score": "0.59538656", "text": "func (o *Developmentactivityaggregateparam) String() string {\n \n o.Metrics = []string{\"\"} \n o.GroupBy = []string{\"\"} \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "a5801cfa047fa37eeeee06eeee90ad7f", "score": "0.5927796", "text": "func (mem *Member) String() string {\n\tstringGenes := make([]string, len(mem.Genes))\n\tfor i, v := range mem.Genes {\n\t\tstringGenes[i] = v.String()\n\t}\n\treturn fmt.Sprintf(\"Member:\\t(fitness: %d)\\n\\t%s\", mem.GetFitness(), strings.Join(stringGenes, \"\\n\\t\"))\n}", "title": "" }, { "docid": "c5ac32b50515a01e38f8086951fb488b", "score": "0.5927087", "text": "func (s CreateMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bc3052ec2d6d17830a144a788ddc57d3", "score": "0.59052646", "text": "func (s ListMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bc3052ec2d6d17830a144a788ddc57d3", "score": "0.59052646", "text": "func (s ListMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bc3052ec2d6d17830a144a788ddc57d3", "score": "0.59047633", "text": "func (s ListMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0d6b867220b19e47e11b2823a3518237", "score": "0.5890439", "text": "func (r Reflection) String() string {\n\tswitch r {\n\tdefault:\n\t\tfallthrough\n\tcase ReflectionNormal:\n\t\treturn \"normal\"\n\tcase ReflectionX:\n\t\treturn \"x\"\n\tcase ReflectionY:\n\t\treturn \"y\"\n\t}\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5882606", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5882606", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b5a12a6a081cfefe02aee76eec1bc881", "score": "0.5876319", "text": "func (s *Stat) String() string {\n\t// Print the name of the field along with value\n\treturn fmt.Sprintf(\"%+v\\n\", *s)\n}", "title": "" }, { "docid": "3815b87970f5ed84eedf754a2150de2c", "score": "0.58689654", "text": "func (s MethodSetting) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f2c7aa22279a96333bf8c8554ceba368", "score": "0.586824", "text": "func (s InviteMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f2c7aa22279a96333bf8c8554ceba368", "score": "0.586824", "text": "func (s InviteMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "698af678258fa8512793cfde326e693f", "score": "0.5866236", "text": "func (s AccessMethod) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a1339644818b1e2a2bf195e71a529b40", "score": "0.5865167", "text": "func (o IgroupGetIterRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "ef0d371c5fc2163aaad4e4044a4ec646", "score": "0.58635646", "text": "func (a arg) String() string {\n\tswitch {\n\tcase a.plainText:\n\t\treturn combineKeyValue(a.key, a.value)\n\tdefault:\n\t\treturn combineKeyValue(a.key, argRedacted)\n\t}\n}", "title": "" }, { "docid": "a69e6d3c524cf7323692232ce1f978d0", "score": "0.58591896", "text": "func (o ExportPolicyGetRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "bca0c3bff94fd964d3a5a9a6198c387f", "score": "0.5835821", "text": "func (oum *OrgUnitMember) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"OrgUnitMember(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", oum.ID))\n\tbuilder.WriteString(\", create_by_user=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", oum.CreateByUser))\n\tbuilder.WriteString(\", update_by_user=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", oum.UpdateByUser))\n\tbuilder.WriteString(\", create_time=\")\n\tbuilder.WriteString(oum.CreateTime.Format(time.ANSIC))\n\tif v := oum.UpdateTime; v != nil {\n\t\tbuilder.WriteString(\", update_time=\")\n\t\tbuilder.WriteString(v.Format(time.ANSIC))\n\t}\n\tbuilder.WriteString(\", is_additional=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", oum.IsAdditional))\n\tbuilder.WriteString(\", user_id=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", oum.UserID))\n\tbuilder.WriteString(\", org_unit_id=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", oum.OrgUnitID))\n\tbuilder.WriteString(\", org_unit_position_id=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", oum.OrgUnitPositionID))\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "8d6355121c22a97fa6189cd1c641837f", "score": "0.58287936", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"DexListFee:%s\\n\", p.ListFee))\n\t//sb.WriteString(fmt.Sprintf(\"DexDelistFee:%s\\n\", p.DelistFee))\n\tsb.WriteString(fmt.Sprintf(\"TransferOwnershipFee:%s\\n\", p.TransferOwnershipFee))\n\tsb.WriteString(fmt.Sprintf(\"DelistMaxDepositPeriod:%s\\n\", p.DelistMaxDepositPeriod))\n\tsb.WriteString(fmt.Sprintf(\"DelistMinDeposit:%s\\n\", p.DelistMinDeposit))\n\tsb.WriteString(fmt.Sprintf(\"DelistVotingPeriod:%s\\n\", p.DelistMaxDepositPeriod))\n\tsb.WriteString(fmt.Sprintf(\"WithdrawPeriod:%d\\n\", p.WithdrawPeriod))\n\treturn sb.String()\n}", "title": "" }, { "docid": "4872527d47e2548d9def20083f60dcdb", "score": "0.5823907", "text": "func (o VserverGetRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "faa3a6df557dd556d32df74f6fe9e1da", "score": "0.5809308", "text": "func StructToString(si interface{}) string {\n\trval := reflect.ValueOf(si).Elem()\n\ttipe := rval.Type()\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"{ \")\n\tfor i := 0; i < rval.NumField(); i++ {\n\t\ttf := tipe.Field(i)\n\t\tif !rval.FieldByName(tf.Name).CanSet() {\n\t\t\tcontinue // skip unexported fields\n\t\t}\n\t\tvar fStr string\n\t\ttagv := tf.Tag.Get(SecretTag)\n\t\tif tagv == \"password\" || tagv == \"username\" {\n\t\t\tfStr = fmt.Sprintf(\"%s:**** \", tf.Name)\n\t\t} else if tagv == \"url\" {\n\t\t\tval, ok := rval.Field(i).Interface().(string)\n\t\t\tif ok {\n\t\t\t\tval = GetMaskedURL(val)\n\t\t\t\tfStr = fmt.Sprintf(\"%s:%v \", tf.Name, val)\n\t\t\t} else {\n\t\t\t\tfStr = fmt.Sprintf(\"%s:%v \", tf.Name, rval.Field(i).Interface())\n\t\t\t}\n\t\t} else {\n\t\t\tfStr = fmt.Sprintf(\"%s:%v \", tf.Name, rval.Field(i).Interface())\n\t\t}\n\t\tbuffer.WriteString(fStr)\n\t}\n\tbuffer.WriteString(\" }\")\n\treturn buffer.String()\n}", "title": "" }, { "docid": "660b6219c36433957afa564a2fd989f0", "score": "0.58029413", "text": "func (s OptionGroupMembership) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "597d4b75ffb5f0cfe6b14ad3f405187b", "score": "0.58024925", "text": "func (id *Identity) String() string {\n\tbuffer := \"\"\n\tbuffer += id.Name\n\tif id.External {\n\t\tbuffer += \"(External)\"\n\t} else {\n\t\tbuffer += \"(Local) \" + id.ContactInfo\n\t}\n\treturn buffer\n}", "title": "" }, { "docid": "8eb7908729d4790cbc3304828f38f9c5", "score": "0.5801953", "text": "func (m *Member) ToString() string {\n\treturn fmt.Sprintf(\n\t\t`ID: %s\nFullName: %s\nUsername: %s`, m.ID, m.FullName, m.Username)\n}", "title": "" }, { "docid": "9c66cccdde8c717e9a130db2918369c1", "score": "0.5796013", "text": "func (s ParameterStringFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ac25f3f6aea8da056068a0cf09489b4d", "score": "0.5785703", "text": "func (s DBParameterGroup) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "14a5d8153fa38ed0e3c2c8e5825e17e4", "score": "0.57736075", "text": "func (s CreateMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "14a5d8153fa38ed0e3c2c8e5825e17e4", "score": "0.57736075", "text": "func (s CreateMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b66208ff2f26bed4c87dc66c3d623072", "score": "0.57728356", "text": "func (s OriginGroupMembers) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "be201c79a8f848e14066af00fcc41926", "score": "0.57709664", "text": "func (s AssociateMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d09cc4d4e9c343ece0da4ec8cc5f6443", "score": "0.5762041", "text": "func (s ApiKeyRestrictions) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7fa9ae680372df047f172b65f4ed06b4", "score": "0.5755284", "text": "func (s ApiKey) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "724ad565afd14fd20d58dfce8e46b8ee", "score": "0.57536346", "text": "func String() string {\n\treturn fmt.Sprintf(\"%s %v Protocol %s %s\", Name, Version, ProtocolCompat, Additional)\n}", "title": "" }, { "docid": "05ea32beea84864b4180f553f66334ae", "score": "0.5748074", "text": "func (s ExportApiOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6c58d1f8601f0c53d043a6c6c5dc49da", "score": "0.5733675", "text": "func layerString(v reflect.Value, anonymous bool, writeSpace bool) string {\n\t// Let String() functions take precedence.\n\tif v.CanInterface() {\n\t\tif s, ok := v.Interface().(fmt.Stringer); ok {\n\t\t\treturn s.String()\n\t\t}\n\t}\n\t// Reflect, and spit out all the exported fields as key=value.\n\tswitch v.Type().Kind() {\n\tcase reflect.Interface, reflect.Ptr:\n\t\tif v.IsNil() {\n\t\t\treturn \"nil\"\n\t\t}\n\t\tr := v.Elem()\n\t\treturn layerString(r, anonymous, writeSpace)\n\tcase reflect.Struct:\n\t\tvar b bytes.Buffer\n\t\ttyp := v.Type()\n\t\tif !anonymous {\n\t\t\tb.WriteByte('{')\n\t\t}\n\t\tfor i := 0; i < v.NumField(); i++ {\n\t\t\t// Check if this is upper-case.\n\t\t\tftype := typ.Field(i)\n\t\t\tf := v.Field(i)\n\t\t\tif ftype.Anonymous {\n\t\t\t\tanonStr := layerString(f, true, writeSpace)\n\t\t\t\twriteSpace = writeSpace || anonStr != \"\"\n\t\t\t\tb.WriteString(anonStr)\n\t\t\t} else if ftype.PkgPath == \"\" { // exported\n\t\t\t\tif writeSpace {\n\t\t\t\t\tb.WriteByte(' ')\n\t\t\t\t}\n\t\t\t\twriteSpace = true\n\t\t\t\tfmt.Fprintf(&b, \"%s=%s\", typ.Field(i).Name, layerString(f, false, writeSpace))\n\t\t\t}\n\t\t}\n\t\tif !anonymous {\n\t\t\tb.WriteByte('}')\n\t\t}\n\t\treturn b.String()\n\tcase reflect.Slice:\n\t\tvar b bytes.Buffer\n\t\tb.WriteByte('[')\n\t\tif v.Len() > 4 {\n\t\t\tfmt.Fprintf(&b, \"..%d..\", v.Len())\n\t\t} else {\n\t\t\tfor j := 0; j < v.Len(); j++ {\n\t\t\t\tif j != 0 {\n\t\t\t\t\tb.WriteString(\", \")\n\t\t\t\t}\n\t\t\t\tb.WriteString(layerString(v.Index(j), false, false))\n\t\t\t}\n\t\t}\n\t\tb.WriteByte(']')\n\t\treturn b.String()\n\t}\n\treturn fmt.Sprintf(\"%v\", v.Interface())\n}", "title": "" }, { "docid": "97a3e0ab0ec36bc8a67461db50075009", "score": "0.5725767", "text": "func (o NvmeRevertAnagrpidsRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "f2998a80b837d9e2adde948576c10b0a", "score": "0.5720582", "text": "func (p *Properties) String() string {\n\ts := p.Wire\n\ts += \",\"\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 != p.OrigName {\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": "7b9f1adb1ea49a857bf6e208595f19a9", "score": "0.5717007", "text": "func (a *Plane) String() string {\n\treturn fmt.Sprintf(\"%+v\", *a)\n}", "title": "" }, { "docid": "cc960b69484075f7d705c86497200ee5", "score": "0.5711764", "text": "func (s VoiceChannelRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d7df7519816a565be014dd5da39cc3f1", "score": "0.570102", "text": "func (s Provider) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b51061d65495b779a4e1e06403b3e5d8", "score": "0.5699166", "text": "func (o *Effectiveconfiguration) String() string {\n o.Properties = map[string]interface{}{\"\": Interface{}} \n o.Advanced = map[string]interface{}{\"\": Interface{}} \n \n \n o.Credentials = map[string]Credentialinfo{\"\": {}} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "05c123f93f222656e1cd07c1a3db6741", "score": "0.5697834", "text": "func (s InstanceInformationStringFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "61aefdbe87e3c94b33459a6e862fcbdc", "score": "0.56927836", "text": "func (o QtreeListIterRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "24f0bfea8419e1d9c7653157a829aa39", "score": "0.56785744", "text": "func (op PipelineOp) String() string {\n\ts := make([]byte, 0, 32)\n\ts = append(s, \"get field \"...)\n\ts = strconv.AppendInt(s, int64(op.Field), 10)\n\tif op.DefaultValue == nil {\n\t\treturn string(s)\n\t}\n\ts = append(s, \" with default\"...)\n\treturn string(s)\n}", "title": "" }, { "docid": "24f0bfea8419e1d9c7653157a829aa39", "score": "0.56785744", "text": "func (op PipelineOp) String() string {\n\ts := make([]byte, 0, 32)\n\ts = append(s, \"get field \"...)\n\ts = strconv.AppendInt(s, int64(op.Field), 10)\n\tif op.DefaultValue == nil {\n\t\treturn string(s)\n\t}\n\ts = append(s, \" with default\"...)\n\treturn string(s)\n}", "title": "" }, { "docid": "653885e901219dba4585ec7155a26237", "score": "0.5676206", "text": "func (info Info) String() string {\n\treturn fmt.Sprintf(\"<key: %s, URL: %s, UID: %s, Inter: %v>\",\n\t\tinfo.Key, info.URL, info.UID, info.Inter)\n}", "title": "" }, { "docid": "1b1e307bd83c6a0f75ba16dd03a65acd", "score": "0.5671215", "text": "func (o *Routingconversationattributesrequest) String() string {\n \n o.SkillIds = []string{\"\"} \n \n o.RequestScoredAgents = []Requestscoredagent{{}} \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": "bdd064e8e8ae04be0f9fb22e3ae855ad", "score": "0.56589264", "text": "func (s ExportApiInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cfd01141b2d7e6ebe283f9534990a302", "score": "0.565831", "text": "func (m *Method) String() string {\n\n\tstr := m.Name + \"(\"\n\n\tparams := []string{}\n\n\tfor _, p := range m.Params {\n\t\tparams = append(params, strings.Join(p.Names, \", \")+\" \"+p.Type)\n\t}\n\n\tstr = str + strings.Join(params, \", \") + \")\"\n\n\tif len(m.Results) > 0 {\n\t\tstr = str + \" \"\n\t\tif len(m.Results) > 1 {\n\t\t\tstr = str + \"(\" + strings.Join(m.Results, \", \") + \")\"\n\t\t} else {\n\t\t\tstr = str + m.Results[0]\n\t\t}\n\t}\n\treturn str\n\n}", "title": "" }, { "docid": "b05fbb366f216fce0c964268232cf3bc", "score": "0.5651294", "text": "func (a Access) String() string {\n\t// Call Access' methods that take non arguments & return Access\n\t// if value == 0, return symbol/method that returns 0\n\t// Else, skip any method/symbol that returns 0;\n\t// append to string any method where return value & f == method's return value\n\t// return string\n\treturn enum.StringUintFlags(uint64(a), reflect.TypeOf(a), 16)\n}", "title": "" }, { "docid": "b09c49d422f61e9129da7177ef187e07", "score": "0.5647023", "text": "func (s BaiduChannelRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f2131126c53ce9d241ade65d4c0e8c8c", "score": "0.56420374", "text": "func (v Verb) String() string {\n\treturn \"%\" + v.flags + v.verb\n}", "title": "" }, { "docid": "e48cc421d8de6ecad5a5da1526316415", "score": "0.5637391", "text": "func (s ListMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e48cc421d8de6ecad5a5da1526316415", "score": "0.5637028", "text": "func (s ListMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e48cc421d8de6ecad5a5da1526316415", "score": "0.5637028", "text": "func (s ListMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "61b9ead56774282db4e04c4b70570b94", "score": "0.56343836", "text": "func (s ParameterMetadata) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f1ea37433a881a056770fd1482b28582", "score": "0.5633405", "text": "func (de *endpoint) String() string {\n\treturn fmt.Sprintf(\"magicsock.endpoint{%v, %v}\", de.publicKey.ShortString(), de.discoShort())\n}", "title": "" }, { "docid": "6e5b320dd95669bf151e7cd1556e77bf", "score": "0.56328845", "text": "func (s UsagePlanKey) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e041c6be9c819de6a5d40d1fd63acfc8", "score": "0.56291497", "text": "func (s ParametersFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "149129bde7e23474e55545125a7e14d0", "score": "0.56282735", "text": "func (s AssociateMemberToGroupOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c491613a0dbf57cdf045506b6be0cb1f", "score": "0.5626301", "text": "func (s RestApi) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "15b198ef69a6aad0707bb9925723c63d", "score": "0.5625643", "text": "func (s ExtendedKeyUsage) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "15b198ef69a6aad0707bb9925723c63d", "score": "0.5625643", "text": "func (s ExtendedKeyUsage) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
08e8e51dabff946b745459499c456407
Send marshals and sends the DeleteServerCertificate API request.
[ { "docid": "828608e0e2bc44174c934ac68c13c139", "score": "0.7579739", "text": "func (r DeleteServerCertificateRequest) Send(ctx context.Context) (*DeleteServerCertificateResponse, 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 := &DeleteServerCertificateResponse{\n\t\tDeleteServerCertificateOutput: r.Request.Data.(*DeleteServerCertificateOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" } ]
[ { "docid": "f8167ef270a55f9fc6c941d1014cd4a8", "score": "0.67629105", "text": "func (c *IAM) DeleteServerCertificate(req *DeleteServerCertificateRequest) (err error) {\n\t// NRE\n\terr = c.client.Do(\"DeleteServerCertificate\", \"POST\", \"/\", req, nil)\n\treturn\n}", "title": "" }, { "docid": "353879e4a11928370b175f1d53d4e199", "score": "0.6132497", "text": "func (c *CertificateClient) Delete(ctx context.Context, certificate *Certificate) (*Response, error) {\n\treq, err := c.client.NewRequest(ctx, \"DELETE\", fmt.Sprintf(\"/certificates/%d\", certificate.ID), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.client.Do(req, nil)\n}", "title": "" }, { "docid": "7d4a6da9649e60792a3f2aa79e3ae300", "score": "0.5939511", "text": "func (client CertificatesClient) DeleteCertificateResponder(resp *http.Response) (result SetObject, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result.Value),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "f6b5db3d38d9516c8f4b9375dbbd2cb9", "score": "0.590581", "text": "func (client CertificatesClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tazure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "e7c31097c1683eeef85a01c763acdf7f", "score": "0.5858472", "text": "func (client AppServiceCertificateOrdersClient) DeleteCertificateResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "cbcca9604760bb542d2fa54da8a9c9ef", "score": "0.5776239", "text": "func (client LoadBalancerClient) deleteCertificate(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/loadBalancers/{loadBalancerId}/certificates/{certificateName}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteCertificateResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"\"\n\t\terr = common.PostProcessServiceError(err, \"LoadBalancer\", \"DeleteCertificate\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "2ec27795730ca715a4c0b224bde23a13", "score": "0.57585037", "text": "func (client AppServiceCertificateOrdersClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "4ecf50778970c920fb28d864f440d839", "score": "0.5752926", "text": "func (a *SecurityApiService) SecurityCertificateDelete(ctx _context.Context, uuid string) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/security/certificates/{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 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\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 localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "e4e8618061976f75def445486b5250bd", "score": "0.5703152", "text": "func (o *WebAccelOp) DeleteCertificate(ctx context.Context, id types.ID) error {\n\t// build request URL\n\tpathBuildParameter := map[string]interface{}{\n\t\t\"rootURL\": SakuraCloudAPIRoot,\n\t\t\"pathSuffix\": o.PathSuffix,\n\t\t\"pathName\": o.PathName,\n\t\t\"zone\": APIDefaultZone,\n\t\t\"id\": id,\n\t}\n\n\turl, err := buildURL(\"{{.rootURL}}/{{.zone}}/{{.pathSuffix}}/site/{{.id}}/certificate\", pathBuildParameter)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// build request body\n\tvar body interface{}\n\n\t// do request\n\t_, err = o.Client.Do(ctx, \"DELETE\", url, body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// build results\n\n\treturn nil\n}", "title": "" }, { "docid": "023c15ec644d35e865eefc7d636e628e", "score": "0.5636663", "text": "func (o *CertificateAuthorityOp) RevokeServer(ctx context.Context, id types.ID, serverID string) error {\n\t// build request URL\n\tpathBuildParameter := map[string]interface{}{\n\t\t\"rootURL\": SakuraCloudAPIRoot,\n\t\t\"pathSuffix\": o.PathSuffix,\n\t\t\"pathName\": o.PathName,\n\t\t\"zone\": APIDefaultZone,\n\t\t\"id\": id,\n\t\t\"serverID\": serverID,\n\t}\n\n\turl, err := buildURL(\"{{.rootURL}}/{{.zone}}/{{.pathSuffix}}/{{.pathName}}/{{.id}}/certificateauthority/servers/{{.serverID}}/revoke\", pathBuildParameter)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// build request body\n\tvar body interface{}\n\n\t// do request\n\t_, err = o.Client.Do(ctx, \"PUT\", url, body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// build results\n\n\treturn nil\n}", "title": "" }, { "docid": "4f82fa57887f40ea3d57a0d3da291488", "score": "0.56129766", "text": "func (client LoadBalancerClient) DeleteCertificate(ctx context.Context, request DeleteCertificateRequest) (response DeleteCertificateResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.deleteCertificate, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = DeleteCertificateResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = DeleteCertificateResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(DeleteCertificateResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into DeleteCertificateResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "312319e86bbf123ba8434955429ca928", "score": "0.55535346", "text": "func (r DeleteCertificateAuthorityRequest) Send(ctx context.Context) (*DeleteCertificateAuthorityResponse, 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 := &DeleteCertificateAuthorityResponse{\n\t\tDeleteCertificateAuthorityOutput: r.Request.Data.(*DeleteCertificateAuthorityOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "778876ee02ac0d33ff679c504e372621", "score": "0.5544771", "text": "func (client CertificatesClient) DeleteCsrResponder(resp *http.Response) (result SetObject, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result.Value),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "7cff247d6d6b54430280ea76e5061477", "score": "0.5430079", "text": "func (api *API) DeleteSSL(ctx context.Context, zoneID, certificateID string) error {\n\turi := \"/zones/\" + zoneID + \"/custom_certificates/\" + certificateID\n\tif _, err := api.makeRequestContext(ctx, http.MethodDelete, uri, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a4ad82d4a65fee0063f49b517d7bc132", "score": "0.5411921", "text": "func (r *IOSScepCertificateProfileRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "d28a0e01be4380304072af722fa2794e", "score": "0.5374854", "text": "func (o *ProxyLBOp) DeleteCertificates(ctx context.Context, id types.ID) error {\n\t// build request URL\n\tpathBuildParameter := map[string]interface{}{\n\t\t\"rootURL\": SakuraCloudAPIRoot,\n\t\t\"pathSuffix\": o.PathSuffix,\n\t\t\"pathName\": o.PathName,\n\t\t\"zone\": APIDefaultZone,\n\t\t\"id\": id,\n\t}\n\n\turl, err := buildURL(\"{{.rootURL}}/{{.zone}}/{{.pathSuffix}}/{{.pathName}}/{{.id}}/proxylb/sslcertificate\", pathBuildParameter)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// build request body\n\tvar body interface{}\n\n\t// do request\n\t_, err = o.Client.Do(ctx, \"DELETE\", url, body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// build results\n\n\treturn nil\n}", "title": "" }, { "docid": "f027f769cadb570671d3f9afe0023fcb", "score": "0.53510404", "text": "func (a *Client) DeleteNetworkServer(params *DeleteNetworkServerParams, opts ...ClientOption) (*DeleteNetworkServerNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteNetworkServerParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"DeleteNetworkServer\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/network/servers/{id}\",\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: &DeleteNetworkServerReader{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.(*DeleteNetworkServerNoContent)\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 DeleteNetworkServer: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "f8f25860bc5f1f7a6e34361543949bfe", "score": "0.531546", "text": "func (r *PrivateLinkPrincipalDeleteRequest) Send() (result *PrivateLinkPrincipalDeleteResponse, err error) {\n\treturn r.SendContext(context.Background())\n}", "title": "" }, { "docid": "f8fe0aa36296ea96a82572ee5eaa2e61", "score": "0.5289033", "text": "func (r *PrivateLinkPrincipalDeleteRequest) SendContext(ctx context.Context) (result *PrivateLinkPrincipalDeleteResponse, err error) {\n\tquery := helpers.CopyQuery(r.query)\n\theader := helpers.CopyHeader(r.header)\n\turi := &url.URL{\n\t\tPath: r.path,\n\t\tRawQuery: query.Encode(),\n\t}\n\trequest := &http.Request{\n\t\tMethod: \"DELETE\",\n\t\tURL: uri,\n\t\tHeader: header,\n\t}\n\tif ctx != nil {\n\t\trequest = request.WithContext(ctx)\n\t}\n\tresponse, err := r.transport.RoundTrip(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\tresult = &PrivateLinkPrincipalDeleteResponse{}\n\tresult.status = response.StatusCode\n\tresult.header = response.Header\n\treader := bufio.NewReader(response.Body)\n\t_, err = reader.Peek(1)\n\tif err == io.EOF {\n\t\terr = nil\n\t\treturn\n\t}\n\tif result.status >= 400 {\n\t\tresult.err, err = errors.UnmarshalErrorStatus(reader, result.status)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = result.err\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "d46e87c6ea9e68f2baace67b1230a231", "score": "0.5286714", "text": "func (r DeleteUserPoolClientRequest) Send(ctx context.Context) (*DeleteUserPoolClientResponse, 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 := &DeleteUserPoolClientResponse{\n\t\tDeleteUserPoolClientOutput: r.Request.Data.(*DeleteUserPoolClientOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "ddff59dd3a449e17f017684cde64d331", "score": "0.5282513", "text": "func (c *FakeAwsApiGatewayClientCertificates) Delete(name string, options *v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewDeleteAction(awsapigatewayclientcertificatesResource, c.ns, name), &aws_v1.AwsApiGatewayClientCertificate{})\n\n\treturn err\n}", "title": "" }, { "docid": "3b329ecd2411a2eec9f3d65a33b37f69", "score": "0.52571976", "text": "func (a *SecurityApiService) SecurityKeyManagerKeyServersDelete(ctx _context.Context, uuid string, server string) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/security/key-managers/{uuid}/key-servers/{server}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"uuid\"+\"}\", _neturl.QueryEscape(parameterToString(uuid, \"\")), -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"server\"+\"}\", _neturl.QueryEscape(parameterToString(server, \"\")), -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 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\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 localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "4116a0cf6edfd1cd11f495f630eab55b", "score": "0.52442926", "text": "func DeleteServer(c *gin.Context) {\n\n\tserver := GameServerDelete{}\n\n\terr1 := c.ShouldBindJSON(&server)\n\tif err1 != nil && err1.Error() == \"EOF\" {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest,\n\t\t\tgin.H{\n\t\t\t\t\"success\": false,\n\t\t\t\t\"message\": \"VALIDATEERR - Invalid Json\",\n\t\t\t\t\"errors\": []string{\"Submitted Json cannot be parsed\"}})\n\t\treturn\n\t}\n\n\terr2 := server.CheckInput()\n\n\terr := errors.Join(err1, err2)\n\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest,\n\t\t\tgin.H{\n\t\t\t\t\"success\": false,\n\t\t\t\t\"message\": \"VALIDATEERR - Invalid Json\",\n\t\t\t\t\"errors\": strings.Split(err.Error(), \"\\n\")})\n\t\treturn\n\t}\n\n\terr = txGameServerDelete(server.Serverurl)\n\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\n\t\t\t\"success\": false, \"message\": \"Database transaction issue\",\n\t\t\t\"errors\": []string{err.Error()}})\n\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusNoContent, gin.H{\"success\": true,\n\t\t\"message\": \"Server correctly deleted\"})\n}", "title": "" }, { "docid": "e72172236098c5d164d64015404055c8", "score": "0.5225092", "text": "func (r DeleteLunaClientRequest) Send(ctx context.Context) (*DeleteLunaClientResponse, 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 := &DeleteLunaClientResponse{\n\t\tDeleteLunaClientOutput: r.Request.Data.(*DeleteLunaClientOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "fcd219191928d7716a970d6d03f40f73", "score": "0.51821953", "text": "func (c *Certificate) Delete() error {\n\terr := handler.Unscoped().Delete(c).Error\n\treturn err\n}", "title": "" }, { "docid": "cb273a77222e77fe9acca61a441a4765", "score": "0.51818234", "text": "func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, certificateName string, options *CertificatesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}\"\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 certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificateName}\", url.PathEscape(certificateName))\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\", \"2022-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "e240adc6dd0514db50233af1401f7e4f", "score": "0.51499474", "text": "func TestDeleteCertif(t *testing.T) {\r\n\r\n\tclientnum=\"1\"\r\n\tcertif = append(certif, Certificate{Id: \"1\", Title: \"Mona Lisa\", Createdat: \"15 feb 2017\", Ownerid: \"1\", Year: \"1503\", Note: \"Not damaged\", Transfer: \"Nil\"})\r\n\t\r\n\t//First step: deleting the above certificate from the database\r\n\trequest, _ := http.NewRequest(\"DELETE\", \"/certificates/1\", nil)\r\n response := httptest.NewRecorder()\r\n Router().ServeHTTP(response, request)\r\n\t\r\n\t//Second step: returning the above certificate\r\n\trequest, _ = http.NewRequest(\"GET\", \"/certificates/1\", nil)\r\n\tresponse = httptest.NewRecorder()\r\n\tRouter().ServeHTTP(response, request)\r\n\t\r\n\t//Verification: the certificate is not supposed to be collected but a message mentioning that the certificate does not exit is displayed\r\n\tassert.Equal(t, \"This certificate does not exist.\", response.Body.String(), \"It is supposed to be deleted.\")\r\n\r\n}", "title": "" }, { "docid": "88cb80b6d7f0c79375493f03b2a7de73", "score": "0.51261395", "text": "func (client CertificatesClient) DeleteCsrSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tazure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "76e04ae7b71357a440eb99a63126496c", "score": "0.5115851", "text": "func (client AppServiceCertificateOrdersClient) Delete(ctx context.Context, resourceGroupName string, certificateOrderName string) (result autorest.Response, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/AppServiceCertificateOrdersClient.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.AppServiceCertificateOrdersClient\", \"Delete\", err.Error())\n\t}\n\n\treq, err := client.DeletePreparer(ctx, resourceGroupName, certificateOrderName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceCertificateOrdersClient\", \"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.AppServiceCertificateOrdersClient\", \"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.AppServiceCertificateOrdersClient\", \"Delete\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "08b75085a9cc475a74903ee4116d2230", "score": "0.50907695", "text": "func (client *GatewayCertificateAuthorityClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, certificateID string, ifMatch string, options *GatewayCertificateAuthorityClientDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}\"\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 gatewayID == \"\" {\n\t\treturn nil, errors.New(\"parameter gatewayID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{gatewayId}\", url.PathEscape(gatewayID))\n\tif certificateID == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificateId}\", url.PathEscape(certificateID))\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.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\", \"2022-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"If-Match\"] = []string{ifMatch}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "55ca51547083d996c92ee6c5b791e015", "score": "0.50829047", "text": "func (o Netscaler) DeleteServer(name string) (err error) {\r\n\tresp := model.Response{}\r\n\terr = o.Session.Delete(BaseURI+\"server/\"+name, &resp)\r\n\tif err != nil {\r\n\t\treturn\r\n\t}\r\n\tif resp.Errorcode != 0 {\r\n\t\terr = errors.New(resp.Message)\r\n\t}\r\n\treturn\r\n}", "title": "" }, { "docid": "c4d310232044777c0403d4d61a2574bc", "score": "0.5073649", "text": "func (a *Client) DeleteAuthorizationServer(params *DeleteAuthorizationServerParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteAuthorizationServerNoContent, error) {\n\t// : Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteAuthorizationServerParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteAuthorizationServer\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/api/admin/{tid}/servers/{aid}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteAuthorizationServerReader{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.(*DeleteAuthorizationServerNoContent)\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 deleteAuthorizationServer: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "31c9e3881d995c46600d895fb25c3852", "score": "0.5064625", "text": "func (c *Client) ServerDelete(serverID int, skipIPMI bool) error {\n\n\tresp, err := c.rpcClient.Call(\"server_delete\", serverID, skipIPMI)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.Error != nil {\n\t\treturn fmt.Errorf(resp.Error.Message)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e7687953d80c228d1799aa0a65120a03", "score": "0.5048258", "text": "func (client *IntegrationAccountCertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, integrationAccountName string, certificateName string, options *IntegrationAccountCertificatesClientDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}\"\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 integrationAccountName == \"\" {\n\t\treturn nil, errors.New(\"parameter integrationAccountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{integrationAccountName}\", url.PathEscape(integrationAccountName))\n\tif certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificateName}\", url.PathEscape(certificateName))\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\", \"2019-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "217e17f364dc38aeeda0d06a29c08bd7", "score": "0.5045939", "text": "func TestClient_DeleteNetworkDomain_Success(test *testing.T) {\n\texpect := expect(test)\n\n\ttestServer := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {\n\t\trequestBody, err := readRequestBodyAsString(request)\n\t\tif err != nil {\n\t\t\ttest.Fatal(\"Failed to read request body: \", err)\n\t\t}\n\n\t\texpect.EqualsString(\"Request.Body\",\n\t\t\t`{\"id\":\"f14a871f-9a25-470c-aef8-51e13202e1aa\"}`,\n\t\t\trequestBody,\n\t\t)\n\n\t\twriter.Header().Set(\"Content-Type\", \"application/json\")\n\t\twriter.WriteHeader(http.StatusOK)\n\n\t\tfmt.Fprintln(writer, deleteNetworkDomainTestResponse)\n\t}))\n\tdefer testServer.Close()\n\n\tclient := NewClientWithBaseAddress(testServer.URL, \"user1\", \"password\")\n\tclient.setAccount(&Account{\n\t\tOrganizationID: \"dummy-organization-id\",\n\t})\n\n\terr := client.DeleteNetworkDomain(\"f14a871f-9a25-470c-aef8-51e13202e1aa\")\n\tif err != nil {\n\t\ttest.Fatal(err)\n\t}\n\n\t// Pass\n}", "title": "" }, { "docid": "4f371f67c3cddfe194841e10af1406b9", "score": "0.5043073", "text": "func (client AppServiceCertificateOrdersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "9255e377c58654d252f03910c5ee98f5", "score": "0.5026745", "text": "func (r DeleteNotificationSubscriptionRequest) Send(ctx context.Context) (*DeleteNotificationSubscriptionResponse, 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 := &DeleteNotificationSubscriptionResponse{\n\t\tDeleteNotificationSubscriptionOutput: r.Request.Data.(*DeleteNotificationSubscriptionOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "1ba2783ff7c1e495711ee2474bbdce2d", "score": "0.5021986", "text": "func (s *CertificatesService) DeleteTrustedCertCommand(input *DeleteTrustedCertCommandInput) (resp *http.Response, err error) {\n\tpath := \"/certificates/{id}\"\n\tpath = strings.Replace(path, \"{id}\", input.Id, -1)\n\n\top := &request.Operation{\n\t\tName: \"DeleteTrustedCertCommand\",\n\t\tHTTPMethod: \"DELETE\",\n\t\tHTTPPath: path,\n\t\tQueryParams: map[string]string{},\n\t}\n\n\treq := s.newRequest(op, nil, nil)\n\n\tif req.Send() == nil {\n\t\treturn req.HTTPResponse, nil\n\t}\n\treturn req.HTTPResponse, req.Error\n}", "title": "" }, { "docid": "c565a2491c438be8be5079936a95fe89", "score": "0.50188494", "text": "func NewCertRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {\n\tvar (\n\t\tcertType string\n\t\tcertSubType string\n\t\tcertQuery certificatepkg.RepositoryCertificateQuery\n\t)\n\tvar command = &cobra.Command{\n\t\tUse: \"rm REPOSERVER\",\n\t\tShort: \"Remove certificate of TYPE for REPOSERVER\",\n\t\tRun: func(c *cobra.Command, args []string) {\n\t\t\tctx := c.Context()\n\n\t\t\tif len(args) < 1 {\n\t\t\t\tc.HelpFunc()(c, args)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tconn, certIf := headless.NewClientOrDie(clientOpts, c).NewCertClientOrDie()\n\t\t\tdefer io.Close(conn)\n\t\t\thostNamePattern := args[0]\n\n\t\t\t// Prevent the user from specifying a wildcard as hostname as precaution\n\t\t\t// measure -- the user could still use \"?*\" or any other pattern to\n\t\t\t// remove all certificates, but it's less likely that it happens by\n\t\t\t// accident.\n\t\t\tif hostNamePattern == \"*\" {\n\t\t\t\terr := fmt.Errorf(\"A single wildcard is not allowed as REPOSERVER name.\")\n\t\t\t\terrors.CheckError(err)\n\t\t\t}\n\t\t\tcertQuery = certificatepkg.RepositoryCertificateQuery{\n\t\t\t\tHostNamePattern: hostNamePattern,\n\t\t\t\tCertType: certType,\n\t\t\t\tCertSubType: certSubType,\n\t\t\t}\n\t\t\tremoved, err := certIf.DeleteCertificate(ctx, &certQuery)\n\t\t\terrors.CheckError(err)\n\t\t\tif len(removed.Items) > 0 {\n\t\t\t\tfor _, cert := range removed.Items {\n\t\t\t\t\tfmt.Printf(\"Removed cert for '%s' of type '%s' (subtype '%s')\\n\", cert.ServerName, cert.CertType, cert.CertSubType)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"No certificates were removed (none matched the given patterns)\")\n\t\t\t}\n\t\t},\n\t}\n\tcommand.Flags().StringVar(&certType, \"cert-type\", \"\", \"Only remove certs of given type (ssh, https)\")\n\tcommand.Flags().StringVar(&certSubType, \"cert-sub-type\", \"\", \"Only remove certs of given sub-type (only for ssh)\")\n\treturn command\n}", "title": "" }, { "docid": "2b592d7ebb6372682124fb056433df27", "score": "0.5007812", "text": "func (a *ZonecryptokeyApiService) DeleteCryptokey(ctx context.Context, serverId string, zoneId string, cryptokeyId string) ( *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/servers/{server_id}/zones/{zone_id}/cryptokeys/{cryptokey_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"server_id\"+\"}\", fmt.Sprintf(\"%v\", serverId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"zone_id\"+\"}\", fmt.Sprintf(\"%v\", zoneId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"cryptokey_id\"+\"}\", fmt.Sprintf(\"%v\", cryptokeyId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-API-Key\"] = key\n\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 nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\treturn localVarHttpResponse, err\n}", "title": "" }, { "docid": "59a7549f5411926b80f3e3558b2f40a7", "score": "0.4972476", "text": "func (client AppServiceCertificateOrdersClient) DeleteCertificate(ctx context.Context, resourceGroupName string, certificateOrderName string, name string) (result autorest.Response, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/AppServiceCertificateOrdersClient.DeleteCertificate\")\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.AppServiceCertificateOrdersClient\", \"DeleteCertificate\", err.Error())\n\t}\n\n\treq, err := client.DeleteCertificatePreparer(ctx, resourceGroupName, certificateOrderName, name)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceCertificateOrdersClient\", \"DeleteCertificate\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.DeleteCertificateSender(req)\n\tif err != nil {\n\t\tresult.Response = resp\n\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceCertificateOrdersClient\", \"DeleteCertificate\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.DeleteCertificateResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceCertificateOrdersClient\", \"DeleteCertificate\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "532fe38068910df97fcf11e7308aabdb", "score": "0.49702466", "text": "func (app *App) RequestDeleteStore(w http.ResponseWriter, r *http.Request) {\n\t// Fetch account based on provided credentials\n\tacc, err := app.AccountFromRequest(r)\n\tif err != nil {\n\t\tapp.HandleError(err, w, r)\n\t\treturn\n\t}\n\n\t// Generate a new delete token\n\ttoken, err := token()\n\tif err != nil {\n\t\tapp.HandleError(err, w, r)\n\t\treturn\n\t}\n\n\t// Save token/email pair in database to we can verify it later\n\terr = app.Put(&DeleteStoreRequest{token, acc.Email, time.Now()})\n\tif err != nil {\n\t\tapp.HandleError(err, w, r)\n\t\treturn\n\t}\n\n\t// Render confirmation email\n\tvar buff bytes.Buffer\n\terr = app.Templates.DeleteStoreEmail.Execute(&buff, map[string]string{\n\t\t\"email\": acc.Email,\n\t\t\"delete_link\": fmt.Sprintf(\"%s://%s/deletestore/?v=%d&t=%s\", schemeFromRequest(r), r.Host, version, token),\n\t})\n\tif err != nil {\n\t\tapp.HandleError(err, w, r)\n\t\treturn\n\t}\n\n\t// Send email with confirmation link\n\tbody := buff.String()\n\tgo app.Send(acc.Email, \"Padlock Cloud Delete Request\", body)\n\n\t// Send ACCEPTED status code\n\tw.WriteHeader(http.StatusAccepted)\n}", "title": "" }, { "docid": "a57085b7cf5c482461babafb4ceb9000", "score": "0.4959247", "text": "func DeleteCertHandler(s store.Storer, w http.ResponseWriter, r *http.Request) *HTTPError {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tcertID := pat.Param(r, \"id\")\n\n\t// update storer\n\terr := s.DeleteCert(certID)\n\tif err != nil {\n\t\treturn newHTTPError(http.StatusNotFound, err.Error())\n\t}\n\n\tw.WriteHeader(http.StatusNoContent)\n\n\treturn nil\n}", "title": "" }, { "docid": "a7bb0b5c06ebf15cc5fac25073c55cb8", "score": "0.49574167", "text": "func (s stack) rpcDeleteServer(ctx context.Context, id string) fail.Error {\n\tif id == \"\" {\n\t\treturn fail.InvalidParameterCannotBeEmptyStringError(\"id\")\n\t}\n\n\treturn stacks.RetryableRemoteCall(ctx,\n\t\tfunc() error {\n\t\t\treturn servers.Delete(s.ComputeClient, id).ExtractErr()\n\t\t},\n\t\tNormalizeError,\n\t)\n}", "title": "" }, { "docid": "36dfc4dc8606fe080bcee1a3868bcdd9", "score": "0.49546167", "text": "func (client CertificatesClient) DeleteCertificate(ctx context.Context, resourceGroupName string, name string) (result SetObject, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/CertificatesClient.DeleteCertificate\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.DeleteCertificatePreparer(ctx, resourceGroupName, name)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.CertificatesClient\", \"DeleteCertificate\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.DeleteCertificateSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"web.CertificatesClient\", \"DeleteCertificate\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.DeleteCertificateResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.CertificatesClient\", \"DeleteCertificate\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "0c4883c29f136bda179ceba6283bbd9a", "score": "0.49356106", "text": "func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, ifMatch string, options *CertificatesDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}\"\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\tif certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificateName}\", url.PathEscape(certificateName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"If-Match\", ifMatch)\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "c3d357353f316a73222c1f3525e23b7a", "score": "0.49282342", "text": "func (client LoadBalancerClient) deleteSSLCipherSuite(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/loadBalancers/{loadBalancerId}/sslCipherSuites/{name}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteSSLCipherSuiteResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"\"\n\t\terr = common.PostProcessServiceError(err, \"LoadBalancer\", \"DeleteSSLCipherSuite\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "9590d0d6130b8bac28a05a0529a8db16", "score": "0.4915783", "text": "func (r *WindowsPhone81SCEPCertificateProfileRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "df4cc21322eda207ca168b2b92158f5d", "score": "0.4909053", "text": "func (r DeleteProvisioningTemplateRequest) Send(ctx context.Context) (*DeleteProvisioningTemplateResponse, 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 := &DeleteProvisioningTemplateResponse{\n\t\tDeleteProvisioningTemplateOutput: r.Request.Data.(*DeleteProvisioningTemplateOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "baa559ebf3f9f4897f70fc130455f640", "score": "0.48973897", "text": "func (c *ServerClient) Delete(ctx context.Context, server *Server) (*Response, error) {\n\t_, resp, err := c.DeleteWithResult(ctx, server)\n\treturn resp, err\n}", "title": "" }, { "docid": "56bcd1dda89b8c25fc01d89c30c4fe5a", "score": "0.48719978", "text": "func (client *RegisteredServersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, options *RegisteredServersClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}\"\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 storageSyncServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter storageSyncServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{storageSyncServiceName}\", url.PathEscape(storageSyncServiceName))\n\tif serverID == \"\" {\n\t\treturn nil, errors.New(\"parameter serverID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serverId}\", url.PathEscape(serverID))\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\", \"2020-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "c60916468cfaa735fc0c7b81e780d53e", "score": "0.4868163", "text": "func (client VirtualNetworkClient) deleteCrossConnect(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/crossConnects/{crossConnectId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteCrossConnectResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"\"\n\t\terr = common.PostProcessServiceError(err, \"VirtualNetwork\", \"DeleteCrossConnect\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "b76eade0ddc2f8368876db245297dfc7", "score": "0.4866668", "text": "func (client AppServiceCertificateOrdersClient) DeleteSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "5f7a8b765c063d09925c270eacbcd6b2", "score": "0.48426124", "text": "func (r DeleteVpcPeeringConnectionRequest) Send(ctx context.Context) (*DeleteVpcPeeringConnectionResponse, 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 := &DeleteVpcPeeringConnectionResponse{\n\t\tDeleteVpcPeeringConnectionOutput: r.Request.Data.(*DeleteVpcPeeringConnectionOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "ba1e4c8e5fbd5ea7b2c0ddd5755f3c3c", "score": "0.4834482", "text": "func DeleteCert(client *netscaler.NitroClient, fileName string) error {\n\treturn client.DeleteResourceWithArgsMap(netscaler.Systemfile.Type(), fileName, map[string]string{\"filelocation\": encodedSSLCertPath})\n}", "title": "" }, { "docid": "178fd17335a59840b702d8ba5f8b2c03", "score": "0.48298806", "text": "func (o *CertificateAuthorityOp) Delete(ctx context.Context, id types.ID) error {\n\t// build request URL\n\tpathBuildParameter := map[string]interface{}{\n\t\t\"rootURL\": SakuraCloudAPIRoot,\n\t\t\"pathSuffix\": o.PathSuffix,\n\t\t\"pathName\": o.PathName,\n\t\t\"zone\": APIDefaultZone,\n\t\t\"id\": id,\n\t}\n\n\turl, err := buildURL(\"{{.rootURL}}/{{.zone}}/{{.pathSuffix}}/{{.pathName}}/{{.id}}\", pathBuildParameter)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// build request body\n\tvar body interface{}\n\n\t// do request\n\t_, err = o.Client.Do(ctx, \"DELETE\", url, body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// build results\n\n\treturn nil\n}", "title": "" }, { "docid": "feeb759c3305e83fc186482fead31a22", "score": "0.48207414", "text": "func (r DeleteContainerPolicyRequest) Send(ctx context.Context) (*DeleteContainerPolicyResponse, 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 := &DeleteContainerPolicyResponse{\n\t\tDeleteContainerPolicyOutput: r.Request.Data.(*DeleteContainerPolicyOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "6de2b8f2dd5a58287dac1176befde573", "score": "0.48166737", "text": "func (r DeleteSizeConstraintSetRequest) Send(ctx context.Context) (*DeleteSizeConstraintSetResponse, 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 := &DeleteSizeConstraintSetResponse{\n\t\tDeleteSizeConstraintSetOutput: r.Request.Data.(*DeleteSizeConstraintSetOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "eccf87a98601fff2f1d461ed796f57b0", "score": "0.48140448", "text": "func (r DeleteTrafficMirrorTargetRequest) Send(ctx context.Context) (*DeleteTrafficMirrorTargetResponse, 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 := &DeleteTrafficMirrorTargetResponse{\n\t\tDeleteTrafficMirrorTargetOutput: r.Request.Data.(*DeleteTrafficMirrorTargetOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "24c2415581d281740a15a2620936146b", "score": "0.4810973", "text": "func (m *MockInstanceServer) DeleteCertificate(fingerprint string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeleteCertificate\", fingerprint)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "3f559fd4e21eaf456977b0626ec7fc35", "score": "0.48009855", "text": "func (s Server) Delete() error {\n\t_, err := s.Client.Request(\"DELETE\", \"/servers/\"+s.Id, []byte{})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b7b91e985426e2e27d553adef58590b3", "score": "0.4787028", "text": "func (r DeleteAssessmentTemplateRequest) Send(ctx context.Context) (*DeleteAssessmentTemplateResponse, 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 := &DeleteAssessmentTemplateResponse{\n\t\tDeleteAssessmentTemplateOutput: r.Request.Data.(*DeleteAssessmentTemplateOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "d40bbe25c68db09f22146169c1621701", "score": "0.47853056", "text": "func (o *ServerOp) Delete(ctx context.Context, zone string, id types.ID) error {\n\t// build request URL\n\tpathBuildParameter := map[string]interface{}{\n\t\t\"rootURL\": SakuraCloudAPIRoot,\n\t\t\"pathSuffix\": o.PathSuffix,\n\t\t\"pathName\": o.PathName,\n\t\t\"zone\": zone,\n\t\t\"id\": id,\n\t}\n\n\turl, err := buildURL(\"{{.rootURL}}/{{.zone}}/{{.pathSuffix}}/{{.pathName}}/{{.id}}\", pathBuildParameter)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// build request body\n\tvar body interface{}\n\n\t// do request\n\t_, err = o.Client.Do(ctx, \"DELETE\", url, body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// build results\n\n\treturn nil\n}", "title": "" }, { "docid": "4a01f793f6de942542edee9090e65ad1", "score": "0.47722605", "text": "func (s *ProfileServer) Delete(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(`{\"message\": \"delete called\"}`))\n}", "title": "" }, { "docid": "eb6b7b6ef14a17632b2aea73cf818a58", "score": "0.47698605", "text": "func (c *ClientMaster) PuppetCertificateDelete(certname string) (error, int) {\n\t// /puppet-ca/v1/certificate/\n\terr, code := c.Delete(\"/puppet-ca/v1/certificate_status/\" + certname)\n\treturn err, code\n}", "title": "" }, { "docid": "daaad8510042619c1ddaa37e1ad6b9a1", "score": "0.47674465", "text": "func (r DeleteDBSecurityGroupRequest) Send() (*DeleteDBSecurityGroupOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DeleteDBSecurityGroupOutput), nil\n}", "title": "" }, { "docid": "daaad8510042619c1ddaa37e1ad6b9a1", "score": "0.47674465", "text": "func (r DeleteDBSecurityGroupRequest) Send() (*DeleteDBSecurityGroupOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DeleteDBSecurityGroupOutput), nil\n}", "title": "" }, { "docid": "1f9853800e226a694bb168c1abbd0548", "score": "0.474779", "text": "func (a *AuthCredential) Delete(server *Server) (*http.Response, error) {\n\tendpoint := fmt.Sprintf(\"/api/v1.0/services/iscsi/authcredential/%d/\", a.ID)\n\tresp, err := server.getSlingConnection().Delete(endpoint).Receive(nil, nil)\n\tif err != nil {\n\t\tglog.Warningln(err)\n\t}\n\treturn resp, err\n}", "title": "" }, { "docid": "1779413aae5b0d36cb62600fa066b454", "score": "0.47450173", "text": "func DeleteTrustline(s *Server, w http.ResponseWriter, req *http.Request) {\n\tif req.FormValue(\"src\") == \"\" || req.FormValue(\"dst\") == \"\" {\n\t\thttp.Error(w, \"Please send a correct url key body\", 400)\n\t\treturn\n\t}\n\n\tif _, err := item.FindTrustline(req.FormValue(\"src\"), req.FormValue(\"dst\")); err != nil {\n\t\terr := item.DeleteTrustline(req.FormValue(\"src\"), req.FormValue(\"dst\"))\n\t\tif err != nil {\n\t\t\thandleError(err, \"Cannont delete trustline: %v\", w)\n\t\t}\n\t\tnd := ClientMock{Source: req.FormValue(\"src\"), Destination: req.FormValue(\"dst\"), Time: time.Now(), Delete: true}\n\n\t\tbs, _ := json.Marshal(nd)\n\t\ts.pushEvent(bs)\n\t\tw.Write([]byte(\"OK\"))\n\t\treturn\n\t}\n\tw.Write([]byte(\"No trustline to delete\"))\n\treturn\n}", "title": "" }, { "docid": "a6cfe5c9b69be2e004e46bf44252d62a", "score": "0.4728596", "text": "func (client CertificatesClient) DeleteCertificatePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"name\": autorest.Encode(\"path\", name),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2015-08-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsDelete(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "5465c898ac36e1bbee1244f8a1b3e412", "score": "0.4700815", "text": "func (r DeleteRouteTableRequest) Send(ctx context.Context) (*DeleteRouteTableResponse, 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 := &DeleteRouteTableResponse{\n\t\tDeleteRouteTableOutput: r.Request.Data.(*DeleteRouteTableOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "551f3dbabc497609c1397eccb46e75e3", "score": "0.46990615", "text": "func (r DeleteVirtualServiceRequest) Send(ctx context.Context) (*DeleteVirtualServiceOutput, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DeleteVirtualServiceOutput), nil\n}", "title": "" }, { "docid": "45c1c40fda8823163d1db38910b970eb", "score": "0.46894518", "text": "func resourceServerDelete(data *schema.ResourceData, provider interface{}) error {\n\tvar id, name, networkDomainID string\n\n\tid = data.Id()\n\tname = data.Get(resourceKeyServerName).(string)\n\tnetworkDomainID = data.Get(resourceKeyServerNetworkDomainID).(string)\n\n\tlog.Printf(\"Delete server '%s' ('%s') in network domain '%s'.\", id, name, networkDomainID)\n\n\tproviderState := provider.(*providerState)\n\n\tapiClient := providerState.Client()\n\tserver, err := apiClient.GetServer(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif server == nil {\n\t\tlog.Printf(\"Server '%s' not found; will treat the server as having already been deleted.\", id)\n\n\t\treturn nil\n\t}\n\n\tserverLock := providerState.GetServerLock(id, \"resourceServerDelete(id = '%s')\", id)\n\tserverLock.Lock()\n\tdefer serverLock.Unlock()\n\n\tif server.Started {\n\t\tlog.Printf(\"Server '%s' is currently running. The server will be powered off.\", id)\n\n\t\terr = apiClient.PowerOffServer(id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = apiClient.WaitForChange(compute.ResourceTypeServer, id, \"Power off server\", serverShutdownTimeout)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Printf(\"Server '%s' is being deleted...\", id)\n\n\terr = apiClient.DeleteServer(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn apiClient.WaitForDelete(compute.ResourceTypeServer, id, resourceDeleteTimeoutServer)\n}", "title": "" }, { "docid": "dcc0356f200a05d6eee38e626871ad94", "score": "0.46890298", "text": "func (c *IAM) UpdateServerCertificate(req *UpdateServerCertificateRequest) (err error) {\n\t// NRE\n\terr = c.client.Do(\"UpdateServerCertificate\", \"POST\", \"/\", req, nil)\n\treturn\n}", "title": "" }, { "docid": "7851b485bd00cda6968ba0d1e6016bdc", "score": "0.46889618", "text": "func (r DeleteLoadBalancerRequest) Send(ctx context.Context) (*DeleteLoadBalancerResponse, 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 := &DeleteLoadBalancerResponse{\n\t\tDeleteLoadBalancerOutput: r.Request.Data.(*DeleteLoadBalancerOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "a1880e7c0ef7ee85a0ca0def4a2d1445", "score": "0.46796793", "text": "func (s Server) Delete(client MetalCloudClient) error {\n\tvar result *Server\n\tvar id int\n\terr := s.Validate()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif s.ServerID != 0 {\n\t\tid = s.ServerID\n\t} else {\n\t\tresult, err = client.ServerGetByUUID(s.ServerUUID, false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tid = result.ServerID\n\t}\n\n\terr = client.ServerDelete(id, true)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7d914c05a444a46225c4d3b9a2680318", "score": "0.46764615", "text": "func (r DeleteManagedPrefixListRequest) Send(ctx context.Context) (*DeleteManagedPrefixListResponse, 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 := &DeleteManagedPrefixListResponse{\n\t\tDeleteManagedPrefixListOutput: r.Request.Data.(*DeleteManagedPrefixListOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "1c31a217416abc893273bab655798d7b", "score": "0.46610087", "text": "func (c *ServerServerGroupRootController) Delete() {\n\tmessages := service.DeleteServerServerGroupCollection()\n\tif messages != nil {\n\t\tc.Data[\"json\"] = commonDto.MessagesToDto(messages)\n\t\tc.Ctx.Output.SetStatus(messages[0].StatusCode)\n\t\tlog.WithFields(log.Fields{\"message\": messages[0].ID}).Warn(\"Delete server-servergroup collection failed.\")\n\t} else {\n\t\tc.Ctx.Output.SetStatus(http.StatusAccepted)\n\t\tlog.Info(\"DELETE all server-servergroups.\")\n\t}\n\tc.ServeJSON()\n}", "title": "" }, { "docid": "df43570e3f0ecc1c91bd3112bfb744e8", "score": "0.4659291", "text": "func (r DeleteDatasetRequest) Send(ctx context.Context) (*DeleteDatasetResponse, 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 := &DeleteDatasetResponse{\n\t\tDeleteDatasetOutput: r.Request.Data.(*DeleteDatasetOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "c9b9b994f32990cdac4e5d9c8e6a5d54", "score": "0.4656318", "text": "func serverDelete(ctx *cli.Context) error {\n\tcf, err := loadConfig(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateServersConfig(cf); err != nil {\n\t\treturn err\n\t}\n\n\tvar serverName string\n\tif ctx.NArg() == 1 {\n\t\tserverName = ctx.Args().First()\n\t} else {\n\t\tserverName, err = serverFromInput(ctx, cf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t_, ok := cf.Servers[serverName]\n\tif !ok {\n\t\treturn errors.New(\"Server not found\")\n\t}\n\n\tdelete(cf.Servers, serverName)\n\terr = cf.Write()\n\tif err != nil {\n\t\treturn err\n\t}\n\tlogrus.Infof(\"Server %s deleted\", serverName)\n\treturn nil\n}", "title": "" }, { "docid": "a8002a0020fc513864eff06e3a08abc4", "score": "0.465126", "text": "func (client *ServersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ServersBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}\"\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 serverName == \"\" {\n\t\treturn nil, errors.New(\"parameter serverName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serverName}\", url.PathEscape(serverName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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": "e816817c0eaa9a46b45db1d8fd326ae0", "score": "0.46464372", "text": "func (s *Server) Delete(c echo.Context) error {\n\ts.s.Delete(c.Param(\"key\"))\n\treturn c.NoContent(http.StatusNoContent)\n}", "title": "" }, { "docid": "51c304fa8a9a36e4b50a145d4f1de838", "score": "0.46458545", "text": "func (c *Client) DeleteCertificateSigningRequests(name string) error {\n\tif err := c.initClient(); err != nil {\n\t\treturn err\n\t}\n\n\treturn c.kubernetes.CertificatesV1().CertificateSigningRequests().Delete(\n\t\tcontext.TODO(),\n\t\tname,\n\t\tmetav1.DeleteOptions{},\n\t)\n}", "title": "" }, { "docid": "11daf7c277be9a7c5025fcb9d84fd459", "score": "0.46389812", "text": "func (o MySqlReplicaConfigurationResponseOutput) VerifyServerCertificate() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v MySqlReplicaConfigurationResponse) bool { return v.VerifyServerCertificate }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "b917975585e303a8adf2d8d5968fe44a", "score": "0.462818", "text": "func (d *NSMClientDescriptor) Delete(key string, cfg *nsm.NetworkServiceClient, metadata *nsmetadata.NsmClientMetadata) error {\n\t// remove connection interface\n\tconfig, err := d.buildInterfaceConfig(cfg, metadata.NsmConn)\n\tif err != nil {\n\t\td.log.Error(err)\n\t\treturn err\n\t}\n\tgo func() {\n\t\tctx := context.Background()\n\t\t// TODO: non-blocking transactions are currently broken in the agent on the orchestrator side\n\t\t//ctx = kvs.WithoutBlocking(ctx)\n\t\t_ = d.localclient.ChangeRequest().Delete(config...).Send(ctx)\n\t}()\n\n\t// close the connection\n\terr = metadata.NsmClient.Close(context.Background(), metadata.NsmConn)\n\tif err != nil {\n\t\td.log.Error(err)\n\t\treturn err\n\t}\n\n\t// destroy the client\n\terr = metadata.NsmClient.Destroy(context.Background())\n\tif err != nil {\n\t\td.log.Error(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "81fac4cdb69c6cc81838227c3c2d5fa2", "score": "0.462807", "text": "func (client VirtualNetworkClient) DeleteCrossConnect(ctx context.Context, request DeleteCrossConnectRequest) (response DeleteCrossConnectResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.DefaultRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.deleteCrossConnect, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = DeleteCrossConnectResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = DeleteCrossConnectResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(DeleteCrossConnectResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into DeleteCrossConnectResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "53a872a8b2a088df749d1776ccd19ec4", "score": "0.4627958", "text": "func (c *novaV2) DeleteServer(id string) error {\n\terr := servers.Delete(c.serviceClient, id).ExtractErr()\n\n\tmetrics.APIRequestCount.With(prometheus.Labels{\"provider\": \"openstack\", \"service\": \"nova\"}).Inc()\n\tif err != nil && !IsNotFoundError(err) {\n\t\tmetrics.APIFailedRequestCount.With(prometheus.Labels{\"provider\": \"openstack\", \"service\": \"nova\"}).Inc()\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f6fc1dea35c1e272f6435ba79bc892d9", "score": "0.46247596", "text": "func (srv *Server) RemoveCertificate(id string) error {\n\tif _, ok := srv.certMap[id]; !ok {\n\t\treturn errors.New(\"certificate doesn't exist\")\n\t}\n\tdelete(srv.certMap, id)\n\tsrv.certMapToSlice()\n\treturn nil\n}", "title": "" }, { "docid": "e2e05dc084d3660d550e2a42e79957ba", "score": "0.46212906", "text": "func (client *PrivateEndpointConnectionProxiesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionProxyID string, options *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyId}\"\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\tif privateEndpointConnectionProxyID == \"\" {\n\t\treturn nil, errors.New(\"parameter privateEndpointConnectionProxyID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateEndpointConnectionProxyId}\", url.PathEscape(privateEndpointConnectionProxyID))\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\", \"2020-03-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "c76d6b8dba8557319528cd771b57b668", "score": "0.4619699", "text": "func (r DeleteApplicationReferenceDataSourceRequest) Send(ctx context.Context) (*DeleteApplicationReferenceDataSourceResponse, 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 := &DeleteApplicationReferenceDataSourceResponse{\n\t\tDeleteApplicationReferenceDataSourceOutput: r.Request.Data.(*DeleteApplicationReferenceDataSourceOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "01d5b5c7377a3b2bd7649585f0082dff", "score": "0.4616319", "text": "func (r DeleteAppLaunchConfigurationRequest) Send(ctx context.Context) (*DeleteAppLaunchConfigurationResponse, 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 := &DeleteAppLaunchConfigurationResponse{\n\t\tDeleteAppLaunchConfigurationOutput: r.Request.Data.(*DeleteAppLaunchConfigurationOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "cf85dbc7170bb3d3e42959f70d092d3c", "score": "0.46145803", "text": "func (r DeleteSamplingRuleRequest) Send() (*DeleteSamplingRuleOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DeleteSamplingRuleOutput), nil\n}", "title": "" }, { "docid": "ae738b1a16273bd820d70bf663432282", "score": "0.46049896", "text": "func (r ExportCertificateRequest) Send(ctx context.Context) (*ExportCertificateResponse, 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 := &ExportCertificateResponse{\n\t\tExportCertificateOutput: r.Request.Data.(*ExportCertificateOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "10849ff6064f7f4336e68fe032406c3b", "score": "0.4604261", "text": "func TestClient_RemoveServerNic_Success(test *testing.T) {\n\texpect := expect(test)\n\n\ttestServer := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {\n\t\trequestBody, err := readRequestBodyAsString(request)\n\t\tif err != nil {\n\t\t\ttest.Fatal(err.Error())\n\t\t}\n\n\t\texpect.EqualsString(\"Request.Body\",\n\t\t\t`{\"id\":\"5999db1d-725c-46ba-9d4e-d33991e61ab1\"}`,\n\t\t\trequestBody,\n\t\t)\n\n\t\twriter.Header().Set(\"Content-Type\", \"application/json\")\n\t\twriter.WriteHeader(http.StatusOK)\n\n\t\tfmt.Fprintln(writer, removeNicFromServerTestResponse)\n\t}))\n\tdefer testServer.Close()\n\n\tclient := NewClient(\"au1\", \"user1\", \"password\")\n\tclient.setBaseAddress(testServer.URL)\n\tclient.setAccount(&Account{\n\t\tOrganizationID: \"dummy-organization-id\",\n\t})\n\n\terr := client.RemoveNicFromServer(\"5999db1d-725c-46ba-9d4e-d33991e61ab1\")\n\tif err != nil {\n\t\ttest.Fatal(err)\n\t}\n\n}", "title": "" }, { "docid": "4e69804fe3fa31fa630ad0695d8db1c2", "score": "0.4598082", "text": "func (apiGatewayControllerApi *ApiGatewayControllerApiV1) DeleteSubscription(deleteSubscriptionOptions *DeleteSubscriptionOptions) (response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(deleteSubscriptionOptions, \"deleteSubscriptionOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(deleteSubscriptionOptions, \"deleteSubscriptionOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathSegments := []string{\"v2/subscriptions\"}\n\tpathParameters := []string{*deleteSubscriptionOptions.ID}\n\n\tbuilder := core.NewRequestBuilder(core.DELETE)\n\t_, err = builder.ConstructHTTPURL(apiGatewayControllerApi.Service.Options.URL, pathSegments, pathParameters)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range deleteSubscriptionOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"api_gateway_controller_api\", \"V1\", \"DeleteSubscription\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tif deleteSubscriptionOptions.Authorization != nil {\n\t\tbuilder.AddHeader(\"authorization\", fmt.Sprint(*deleteSubscriptionOptions.Authorization))\n\t}\n\n\tbuilder.AddQuery(\"artifact_id\", fmt.Sprint(*deleteSubscriptionOptions.ArtifactID))\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresponse, err = apiGatewayControllerApi.Service.Request(request, nil)\n\n\treturn\n}", "title": "" }, { "docid": "a1e03a0e2ac49f04bb9f993bcc3b9b5b", "score": "0.45865247", "text": "func del(w http.ResponseWriter, r *http.Request) {\n\tps := newLoggedPage(w, r)\n\tif ps == nil {\n\t\treturn\n\t}\n\tcert := r.FormValue(\"cert\")\n\tvar err error\n\tif cert != \"\" {\n\t\tc, err := FindCertOrFail(cert)\n\t\tif handleError(w, r, err) {\n\t\t\treturn\n\t\t}\n\t\tps[\"Cert\"] = c\n\t\tif c.Childs == nil || len(c.Childs) == 0 {\n\t\t\tDeleteCert(c)\n\t\t\tindex(w, r)\n\t\t\treturn\n\t\t} else if c.Crt.IsCA {\n\t\t\tps[\"PendingConfirmation\"] = true\n\t\t\tps[\"Childs\"] = c.Childs\n\t\t}\n\t}\n\terr = templates.ExecuteTemplate(w, \"certControl\", ps)\n\thandleError(w, r, err)\n}", "title": "" }, { "docid": "85909d833a66c2aeb4d4e5872bc13c82", "score": "0.4586518", "text": "func (client LoadBalancerClient) DeleteSSLCipherSuite(ctx context.Context, request DeleteSSLCipherSuiteRequest) (response DeleteSSLCipherSuiteResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.deleteSSLCipherSuite, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = DeleteSSLCipherSuiteResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = DeleteSSLCipherSuiteResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(DeleteSSLCipherSuiteResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into DeleteSSLCipherSuiteResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "19f9a00bcbd43872eb78c049f96f4b51", "score": "0.45815936", "text": "func (r DeleteSignalingChannelRequest) Send(ctx context.Context) (*DeleteSignalingChannelResponse, 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 := &DeleteSignalingChannelResponse{\n\t\tDeleteSignalingChannelOutput: r.Request.Data.(*DeleteSignalingChannelOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "103112854c3e9e02f41488a377f3f9f0", "score": "0.4578214", "text": "func (o *ServerOp) Delete(ctx context.Context, zone string, id types.ID) error {\n\turl, err := buildURL(\"{{.rootURL}}/{{.zone}}/{{.pathSuffix}}/{{.pathName}}/{{.id}}\", map[string]interface{}{\n\t\t\"rootURL\": SakuraCloudAPIRoot,\n\t\t\"pathSuffix\": o.PathSuffix,\n\t\t\"pathName\": o.PathName,\n\t\t\"zone\": zone,\n\t\t\"id\": id,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar body interface{}\n\n\t_, err = o.Client.Do(ctx, \"DELETE\", url, body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9de578290b04b08eaa385edc108de53d", "score": "0.4576046", "text": "func (r DeleteServiceRequest) Send(ctx context.Context) (*DeleteServiceResponse, 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 := &DeleteServiceResponse{\n\t\tDeleteServiceOutput: r.Request.Data.(*DeleteServiceOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" } ]
4cebbfa1c07cd1d134f121b6b327388c
DeletePolicyRuleAddress removes addresses from the specified NetworkPolicy rule. If addrType is srcAddress, the addresses are removed from PolicyRule.From, else from PolicyRule.To.
[ { "docid": "b292465684a6315dd3b6c6c45810d814", "score": "0.774255", "text": "func (c *client) DeletePolicyRuleAddress(ruleID uint32, addrType types.AddressType, addresses []types.Address, priority *uint16) error {\n\tc.replayMutex.RLock()\n\tdefer c.replayMutex.RUnlock()\n\n\tconj := c.getPolicyRuleConjunction(ruleID)\n\t// If policyRuleConjunction doesn't exist in client's policyCache return not found error. It should not happen, since\n\t// NetworkPolicyController will guarantee the policyRuleConjunction is created before this method is called. The check\n\t//\there is for safety.\n\tif conj == nil {\n\t\treturn newConjunctionNotFound(ruleID)\n\t}\n\n\tvar clause = conj.getAddressClause(addrType)\n\t// Check if the clause is nil or not. The clause is nil if the addrType is an unsupported type.\n\tif clause == nil {\n\t\treturn fmt.Errorf(\"no clause is using addrType %d\", addrType)\n\t}\n\n\tc.conjMatchFlowLock.Lock()\n\tdefer c.conjMatchFlowLock.Unlock()\n\t// Remove policyRuleConjunction to actions of conjunctive match using specific address.\n\tchanges := clause.deleteAddrFlows(addrType, addresses, priority)\n\t// Update the Openflow entries on the OVS bridge, and update local cache.\n\treturn c.applyConjunctiveMatchFlows(changes)\n}", "title": "" } ]
[ { "docid": "08fa4441ebc24a1a911ba779867f302c", "score": "0.5704261", "text": "func DeleteAddress(ctx context.Context, pk string) {\n\tdeleteAddress(ctx, pk)\n}", "title": "" }, { "docid": "84d22939102e9c573a37767f93b29787", "score": "0.56052375", "text": "func (wallet *Walletd) DeleteAddress(address string) (map[string]interface{}, error) {\n\terr := wallet.check()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparams := make(map[string]interface{})\n\tparams[\"address\"] = address\n\tresp, err := wallet.makePostRequest(\"deleteAddress\", params)\n\tif resp != nil {\n\t\treturn resp.(map[string]interface{}), err\n\t}\n\n\treturn nil, err\n}", "title": "" }, { "docid": "aa785e63401e86928dcbdaf34bc78cd0", "score": "0.5445411", "text": "func (c *client) AddPolicyRuleAddress(ruleID uint32, addrType types.AddressType, addresses []types.Address, priority *uint16) error {\n\tc.replayMutex.RLock()\n\tdefer c.replayMutex.RUnlock()\n\n\tconj := c.getPolicyRuleConjunction(ruleID)\n\t// If policyRuleConjunction doesn't exist in client's policyCache return not found error. It should not happen, since\n\t// NetworkPolicyController will guarantee the policyRuleConjunction is created before this method is called. The check\n\t// here is for safety.\n\tif conj == nil {\n\t\treturn newConjunctionNotFound(ruleID)\n\t}\n\tvar clause = conj.getAddressClause(addrType)\n\t// Check if the clause is nil or not. The clause is nil if the addrType is an unsupported type.\n\tif clause == nil {\n\t\treturn fmt.Errorf(\"no clause is using addrType %d\", addrType)\n\t}\n\n\tc.conjMatchFlowLock.Lock()\n\tdefer c.conjMatchFlowLock.Unlock()\n\tflowChanges := clause.addAddrFlows(c, addrType, addresses, priority)\n\treturn c.applyConjunctiveMatchFlows(flowChanges)\n}", "title": "" }, { "docid": "b538376ca1adcbed84c7913a2a7e2c00", "score": "0.5242169", "text": "func DeleteAddress(id int32) error {\n\treturn dalums.DeleteAddress(id)\n}", "title": "" }, { "docid": "b49ff35c0c2e26273cdad01070ef03f4", "score": "0.5237934", "text": "func DeleteAddress(id int32) error {\n\ta, err := GetAddress(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tresult := db.DB().Delete(a)\n\treturn result.Error\n}", "title": "" }, { "docid": "41014329ffc754d81d361c8f2d554617", "score": "0.51876056", "text": "func (cfg *ConfigFile) RemoveAddressPoolByAddress(addr string) {\n\tif addr == \"\" {\n\t\treturn\n\t}\n\t// go through the pools and see if we have a match\n\tpools := make([]AddressPool, 0)\n\t// go through the pools and see if we have one with our hostname\n\tfor _, pool := range cfg.Pools {\n\t\tvar found bool\n\t\tfor _, ipaddr := range pool.Addresses {\n\t\t\tif addr == ipaddr {\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tpools = append(pools, pool)\n\t\t}\n\t}\n\tcfg.Pools = pools\n}", "title": "" }, { "docid": "cb5ac63c1757d832821a6697168f2166", "score": "0.5143771", "text": "func (runner *runner) DeleteIPAddress(args []string) error {\n\tglog.V(4).Infof(\"running netsh interface ipv4 delete address %v\", args)\n\tout, err := runner.exec.Command(cmdNetsh, args...).CombinedOutput()\n\n\tif err == nil {\n\t\treturn nil\n\t}\n\tif ee, ok := err.(utilexec.ExitError); ok {\n\t\t// netsh uses exit(0) to indicate a success of the operation,\n\t\t// as compared to a malformed commandline, for example.\n\t\tif ee.Exited() && ee.ExitStatus() == 0 {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn fmt.Errorf(\"error deleting ipv4 address: %v: %s\", err, out)\n}", "title": "" }, { "docid": "6a15970d189cdf79be62e68fb56c615e", "score": "0.5072759", "text": "func (d *InterfaceAddressDescriptor) Delete(key string, _ *interfaces.Interface, metadata interface{}) (err error) {\n\tiface, addr, source, _, _ := interfaces.ParseInterfaceAddressKey(key)\n\tif source == netalloc_api.IPAddressSource_EXISTING {\n\t\t// already existed before Create, nothing to do\n\t\treturn nil\n\t}\n\n\tifMeta, found := d.intfIndex.LookupByName(iface)\n\tif !found {\n\t\terr = errors.Errorf(\"failed to find interface %s\", iface)\n\t\td.log.Error(err)\n\t\treturn err\n\t}\n\n\tipAddr, err := d.addrAlloc.GetOrParseIPAddress(addr, iface, netalloc_api.IPAddressForm_ADDR_WITH_MASK)\n\tif err != nil {\n\t\td.log.Error(err)\n\t\treturn err\n\t}\n\n\t// switch to the namespace with the interface\n\tnsCtx := nslinuxcalls.NewNamespaceMgmtCtx()\n\trevert, err := d.nsPlugin.SwitchToNamespace(nsCtx, ifMeta.Namespace)\n\tif err != nil {\n\t\tif _, ok := err.(*nsplugin.UnavailableMicroserviceErr); ok {\n\t\t\t// Assume that the delete was called by scheduler because the namespace\n\t\t\t// was removed. Do not return error in this case.\n\t\t\td.log.Debugf(\"Interface %s IP address %s assumed deleted, required namespace %+v does not exist\",\n\t\t\t\tiface, ipAddr, ifMeta.Namespace)\n\t\t\treturn nil\n\t\t}\n\t\td.log.Error(err)\n\t\treturn err\n\t}\n\tdefer revert()\n\n\terr = d.ifHandler.DelInterfaceIP(ifMeta.HostIfName, ipAddr)\n\treturn err\n}", "title": "" }, { "docid": "07c8f61c1643b87b322cd8ee401a5d27", "score": "0.5004647", "text": "func (client *Client) DeleteRule(sourceKey string, destinationKey string) (err error) {\n\tconn := client.Pool.Get()\n\tdefer conn.Close()\n\t_, err = conn.Do(DELETERULE_CMD, sourceKey, destinationKey)\n\treturn err\n}", "title": "" }, { "docid": "dab3753244b4e349a604e8cc4f9e7e1a", "score": "0.49967957", "text": "func (client *Client) DeleteRule(sourceKey string, destinationKey string) (err error) {\n\tconn := client.Pool.Get()\n\tdefer conn.Close()\n\t_, err = conn.Do(\"TS.DELETERULE\", sourceKey, destinationKey)\n\treturn err\n}", "title": "" }, { "docid": "829b27ea4d5cea298585f83cd10a3512", "score": "0.4984039", "text": "func (broker *Broker) DeleteAddress(ctx context.Context, userID, addressID, pin string) error {\n\ttoken, err := broker.SignTokenWithPIN(userID, 60, pin)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn broker.BrokerHandler.DeleteAddress(ctx, addressID, token)\n}", "title": "" }, { "docid": "ff8990ef85274c5525b857f82b74dfc0", "score": "0.49802336", "text": "func (_IdentityRegistry *IdentityRegistryTransactorSession) RemoveAddressFromWhitelist(_address common.Address) (*types.Transaction, error) {\n\treturn _IdentityRegistry.Contract.RemoveAddressFromWhitelist(&_IdentityRegistry.TransactOpts, _address)\n}", "title": "" }, { "docid": "b69cca9d0b8c044e72c1e936d5b1aa4c", "score": "0.49723932", "text": "func (runner *runner) DeletePortProxyRule(args []string) error {\n\tglog.V(4).Infof(\"running netsh interface portproxy delete v4tov4 %v\", args)\n\tout, err := runner.exec.Command(cmdNetsh, args...).CombinedOutput()\n\n\tif err == nil {\n\t\treturn nil\n\t}\n\tif ee, ok := err.(utilexec.ExitError); ok {\n\t\t// netsh uses exit(0) to indicate a success of the operation,\n\t\t// as compared to a malformed commandline, for example.\n\t\tif ee.Exited() && ee.ExitStatus() == 0 {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn fmt.Errorf(\"error deleting portproxy rule: %v: %s\", err, out)\n}", "title": "" }, { "docid": "758543ec0e23b21ee63465a24fc77fba", "score": "0.49670997", "text": "func (s *Service) DeleteDomainACLGeoIPRule(domainName string, ruleID string) error {\n\t_, err := s.deleteDomainACLGeoIPRuleResponseBody(domainName, ruleID)\n\n\treturn err\n}", "title": "" }, { "docid": "0e935d06a4c0594114c010c8189f6f20", "score": "0.49653333", "text": "func (c *SrcIPRuleConfigurator) Delete(ctx context.Context, item depgraph.Item) error {\n\trule := item.(SrcIPRule)\n\tnetlinkRule, err := c.makeNetlinkRule(rule)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn netlink.RuleDel(netlinkRule)\n}", "title": "" }, { "docid": "55bb75132874ee146898ae5bce340bc4", "score": "0.49613073", "text": "func (c *clause) deleteAddrFlows(addrType types.AddressType, addresses []types.Address, priority *uint16) []*conjMatchFlowContextChange {\n\tvar ctxChanges []*conjMatchFlowContextChange\n\tfor _, addr := range addresses {\n\t\tmatch := generateAddressConjMatch(c.ruleTable.GetID(), addr, addrType, priority)\n\t\tcontextKey := match.generateGlobalMapKey()\n\t\tctxChange := c.deleteConjunctiveMatchFlow(contextKey)\n\t\tif ctxChange != nil {\n\t\t\tctxChanges = append(ctxChanges, ctxChange)\n\t\t}\n\t}\n\treturn ctxChanges\n}", "title": "" }, { "docid": "f81b055a40fbb021bdc7e15f992ef847", "score": "0.49600655", "text": "func (broker *BrokerHandler) DeleteAddress(ctx context.Context, addressID, token string) error {\n\tb, err := broker.Request(ctx, \"DELETE\", \"/api/address/\"+addressID, nil, token)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar data struct {\n\t\tError\n\t}\n\tif err := jsoniter.Unmarshal(b, &data); err != nil {\n\t\treturn errors.New(string(b))\n\t}\n\n\tif data.Code == 0 {\n\t\treturn nil\n\t}\n\treturn errorWithWalletError(&data.Error)\n}", "title": "" }, { "docid": "7c2cfc5369f4b4d8afcd1a9fa410a19b", "score": "0.4945048", "text": "func (_Whitelistable *WhitelistableTransactor) RemoveAddressFromWhitelist(opts *bind.TransactOpts, _address common.Address) (*types.Transaction, error) {\n\treturn _Whitelistable.contract.Transact(opts, \"removeAddressFromWhitelist\", _address)\n}", "title": "" }, { "docid": "c8129094fec350243e17f21079e093e9", "score": "0.49430075", "text": "func (_IdentityRegistry *IdentityRegistrySession) RemoveAddressFromWhitelist(_address common.Address) (*types.Transaction, error) {\n\treturn _IdentityRegistry.Contract.RemoveAddressFromWhitelist(&_IdentityRegistry.TransactOpts, _address)\n}", "title": "" }, { "docid": "1a8989f0e4b403b58415033622210990", "score": "0.4915763", "text": "func (_IdentityRegistry *IdentityRegistryTransactor) RemoveAddressFromWhitelist(opts *bind.TransactOpts, _address common.Address) (*types.Transaction, error) {\n\treturn _IdentityRegistry.contract.Transact(opts, \"removeAddressFromWhitelist\", _address)\n}", "title": "" }, { "docid": "87bb9b04a2b49acbeb535368d71bd06e", "score": "0.4892345", "text": "func (_Whitelistable *WhitelistableTransactorSession) RemoveAddressFromWhitelist(_address common.Address) (*types.Transaction, error) {\n\treturn _Whitelistable.Contract.RemoveAddressFromWhitelist(&_Whitelistable.TransactOpts, _address)\n}", "title": "" }, { "docid": "8ddc354f050cd540ae9a54e88c08fc88", "score": "0.48786998", "text": "func (a *Adapter) RemovePolicy(sec string, ptype string, rule []string) (err error) {\n\treturn\n\t// line := a.createPolicyRule(ptype, rule)\n\t// err = a.deletePolicyLine(&line)\n\t// if err != nil {\n\t// \treturn\n\t// }\n\t// return err\n}", "title": "" }, { "docid": "dc6c0071822dffea901fc02a5e81916e", "score": "0.4876021", "text": "func (c *NatConfigurator) delAddressPool(addressPools []*nat.Nat44Global_AddressPool) error {\n\tfor _, addressPool := range addressPools {\n\t\tif addressPool.FirstSrcAddress == \"\" && addressPool.LastSrcAddress == \"\" {\n\t\t\t// No address pool to remove\n\t\t\tcontinue\n\t\t}\n\t\tvar firstIP []byte\n\t\tvar lastIP []byte\n\t\tif addressPool.FirstSrcAddress != \"\" {\n\t\t\tfirstIP = net.ParseIP(addressPool.FirstSrcAddress).To4()\n\t\t\tif firstIP == nil {\n\t\t\t\t// Do not return error here\n\t\t\t\tc.log.Warnf(\"First NAT44 address pool IP %s cannot be parsed and removed, skipping\",\n\t\t\t\t\taddressPool.FirstSrcAddress)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif addressPool.LastSrcAddress != \"\" {\n\t\t\tlastIP = net.ParseIP(addressPool.LastSrcAddress).To4()\n\t\t\tif lastIP == nil {\n\t\t\t\t// Do not return error here\n\t\t\t\tc.log.Warnf(\"Last NAT44 address pool IP %s cannot be parsed and removed, skipping\",\n\t\t\t\t\taddressPool.LastSrcAddress)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\t// Both fields have to be set, at least at the same value if only one of them is set\n\t\tif firstIP == nil {\n\t\t\tfirstIP = lastIP\n\t\t} else if lastIP == nil {\n\t\t\tlastIP = firstIP\n\t\t}\n\n\t\t// remove address pool\n\t\tif err := c.natHandler.DelNat44AddressPool(firstIP, lastIP, addressPool.VrfId, addressPool.TwiceNat); err != nil {\n\t\t\terrors.Errorf(\"failed to delete NAT44 address pool %s - %s: %v\", firstIP, lastIP, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "417e97366bd38afd794ce99c5df5a23e", "score": "0.48247397", "text": "func (c *FakeIPAddresses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewRootDeleteActionWithOptions(ipaddressesResource, name, opts), &v1alpha1.IPAddress{})\n\treturn err\n}", "title": "" }, { "docid": "f7fe1c770eba8c095b3d9056805465a9", "score": "0.4807783", "text": "func ValidateAddress(coinType, addr string) (bool, error) {\n\tcoin, ok := coinMap[coinType]\n\tif !ok {\n\t\treturn false, fmt.Errorf(\"%s is not supported\", coinType)\n\t}\n\n\tif err := coin.ValidateAddr(addr); err != nil {\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "8f28fb47a84e3e35eefcfa93724009ea", "score": "0.47857216", "text": "func (_StockToken *StockTokenTransactor) RemoveAddressFromWhitelist(opts *bind.TransactOpts, _address common.Address) (*types.Transaction, error) {\n\treturn _StockToken.contract.Transact(opts, \"removeAddressFromWhitelist\", _address)\n}", "title": "" }, { "docid": "997ec1fd0d0dae175d4a7d3cdfb67375", "score": "0.47836134", "text": "func (f *Facade) RemoveAddressAssignment(ctx datastore.Context, id string) error {\n\tstore := addressassignment.NewStore()\n\tkey := addressassignment.Key(id)\n\n\tvar assignment addressassignment.AddressAssignment\n\tif err := store.Get(ctx, key, &assignment); err != nil {\n\t\treturn err\n\t}\n\n\tif err := store.Delete(ctx, key); err != nil {\n\t\treturn err\n\t}\n\n\tvar svc *service.Service\n\tvar err error\n\tif svc, err = f.GetService(ctx, assignment.ServiceID); err != nil {\n\t\tglog.V(2).Infof(\"ControlPlaneDao.GetService service=%+v err=%s\", assignment.ServiceID, err)\n\t\treturn err\n\t}\n\n\tif err := f.updateService(ctx, svc); err != nil {\n\t\tglog.V(2).Infof(\"ControlPlaneDao.updateService service=%+v err=%s\", assignment.ServiceID, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "db732f7661778becb7223bac29f563f5", "score": "0.47808522", "text": "func (_Whitelistable *WhitelistableSession) RemoveAddressFromWhitelist(_address common.Address) (*types.Transaction, error) {\n\treturn _Whitelistable.Contract.RemoveAddressFromWhitelist(&_Whitelistable.TransactOpts, _address)\n}", "title": "" }, { "docid": "a94556c9c9b139438efd98ff8955abfb", "score": "0.47498554", "text": "func (s *Service) DeleteDomainACLIPRule(domainName string, ruleID string) error {\n\t_, err := s.deleteDomainACLIPRuleResponseBody(domainName, ruleID)\n\n\treturn err\n}", "title": "" }, { "docid": "c008c7f3a48be89448796366a690b05d", "score": "0.47470227", "text": "func (o *AccountIdentityMatchScore) UnsetAddress() {\n\to.Address.Unset()\n}", "title": "" }, { "docid": "a9e9845197256f568ac1aebcbfecc7ef", "score": "0.47166112", "text": "func DeleteAddress(c *gin.Context) {\n\t// Get model if exist\n\tvar address models.Address\n\tif err := utils.DB.Where(\"id = ?\", c.Param(\"id\")).First(&address).Error; err != nil {\n\t\tfmt.Println(err)\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"Record not found!\"})\n\t\treturn\n\t}\n\tutils.DB.Delete(&address, c.Param(\"id\"))\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": true})\n}", "title": "" }, { "docid": "432086f64f2defb48a2b779d63aae78f", "score": "0.4695678", "text": "func RemoveInterfaceAddress(ifaceName string, ipAddr net.IP) error {\n\tcmd := fmt.Sprintf(`Remove-NetIPAddress -InterfaceAlias \"%s\" -IPAddress %s -Confirm:$false`, ifaceName, ipAddr.String())\n\t_, err := ps.RunCommand(cmd)\n\t// If the address does not exist, ignore the error.\n\tif err != nil && !strings.Contains(err.Error(), \"No matching\") {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "33b4971ce2068a27631f12df96d998d4", "score": "0.4691221", "text": "func (_StockToken *StockTokenTransactorSession) RemoveAddressFromWhitelist(_address common.Address) (*types.Transaction, error) {\n\treturn _StockToken.Contract.RemoveAddressFromWhitelist(&_StockToken.TransactOpts, _address)\n}", "title": "" }, { "docid": "7f3dbb7aced3c716394c5f0a82dea8cd", "score": "0.46882632", "text": "func (obj *User) UserAddressDelete(input CoUserAddress, _opt ...map[string]string) (output Result, err error) {\n\tctx := context.Background()\n\treturn obj.UserAddressDeleteWithContext(ctx, input, _opt...)\n}", "title": "" }, { "docid": "a33dba228ec0ef78769accda1f3cec89", "score": "0.4650177", "text": "func (_StockToken *StockTokenSession) RemoveAddressFromWhitelist(_address common.Address) (*types.Transaction, error) {\n\treturn _StockToken.Contract.RemoveAddressFromWhitelist(&_StockToken.TransactOpts, _address)\n}", "title": "" }, { "docid": "c5c556ee9f856509844ca1db7219ff9e", "score": "0.45979986", "text": "func (a *adapter) RemovePolicy(sec string, ptype string, rule []string) error {\n\tline := savePolicyLine(ptype, rule)\n\n\tctx, cancel := context.WithTimeout(context.TODO(), a.timeout)\n\tdefer cancel()\n\n\tif _, err := a.collection.DeleteOne(ctx, line); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "19859a91acfeb7c2dd293aa94e65f1f7", "score": "0.45662537", "text": "func (cfg *ConfigFile) RemoveAddressPool(remove *AddressPool) {\n\tif remove == nil {\n\t\treturn\n\t}\n\t// go through the pools and see if we have a match\n\tpools := make([]AddressPool, 0)\n\t// remove that one, keep all others\n\tfor _, pool := range cfg.Pools {\n\t\tif !pool.Equal(remove) {\n\t\t\tpools = append(pools, pool)\n\t\t}\n\t}\n\tcfg.Pools = pools\n}", "title": "" }, { "docid": "53f9ade659f72448898e62cc5ddbaf0e", "score": "0.4565142", "text": "func (o *AccountIdentityMatchScoreAllOf) UnsetAddress() {\n\to.Address.Unset()\n}", "title": "" }, { "docid": "d347648f2e1df45b32a7e42dd1f87332", "score": "0.45635402", "text": "func (org *Organization) RemoveAddress() error {\n\tif org.PostalAddresses == (postalAddress{}) {\n\t\treturn ErrPostalAddressNotSet\n\t} else {\n\t\torg.PostalAddresses = postalAddress{}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "abee5624b2f38631a76a1284b6ce633d", "score": "0.4512503", "text": "func (mr *MockIMessagerMockRecorder) DeleteAddress(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteAddress\", reflect.TypeOf((*MockIMessager)(nil).DeleteAddress), arg0, arg1)\n}", "title": "" }, { "docid": "ee5774fa6e1b6be9b7eb0d89fc777e48", "score": "0.4505815", "text": "func (dsl *DeleteDSL) NAT44AddressPool(pool *nat.Nat44AddressPool) vppclient.DeleteDSL {\n\tdsl.parent.txn.Delete(models.Key(pool))\n\treturn dsl\n}", "title": "" }, { "docid": "f1f620456e55882140b92e2b2e61b6e5", "score": "0.4491608", "text": "func (dp *DelphiDatapath) DeleteNetworkSecurityPolicy(sgp *netproto.NetworkSecurityPolicy, vrfID uint64) error {\n\tvrfKey := &halproto.VrfKeyHandle{\n\t\tKeyOrHandle: &halproto.VrfKeyHandle_VrfId{\n\t\t\tVrfId: vrfID,\n\t\t},\n\t}\n\n\tsgPolicy := &halproto.SecurityPolicySpec{\n\t\tKeyOrHandle: &halproto.SecurityPolicyKeyHandle{\n\t\t\tPolicyKeyOrHandle: &halproto.SecurityPolicyKeyHandle_SecurityPolicyKey{\n\t\t\t\tSecurityPolicyKey: &halproto.SecurityPolicyKey{\n\t\t\t\t\tSecurityPolicyId: sgp.Status.NetworkSecurityPolicyID,\n\t\t\t\t\tVrfIdOrHandle: vrfKey,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\terr := dp.delphiClient.DeleteObject(sgPolicy)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cf228b90dda0b3f9c5e99ca3fc798498", "score": "0.44525695", "text": "func (ipaddress *IPAddress) Delete(ctx context.Context, client *Client) error {\n\tif ipaddress.ID == \"\" {\n\t\treturn fmt.Errorf(\"An IPAddress may only be deleted using ID\")\n\t}\n\n\treturn client.BooleanRequestWithContext(ctx, &DisassociateIPAddress{\n\t\tID: ipaddress.ID,\n\t})\n}", "title": "" }, { "docid": "3a7156c15e7b7f2241cff900f8fbfd6b", "score": "0.4448697", "text": "func (ipt *IpTableClient) DeletePreroutingFilters(loadBalancerConfig cns.LBConfiguration) error {\n\tsourceIP := loadBalancerConfig.SourceIP\n\tsourcePort := loadBalancerConfig.SourcePort\n\tdestinationIPs := loadBalancerConfig.DestinationConfig.IPAddresses\n\tdestinationPort := loadBalancerConfig.DestinationConfig.Port\n\tnumIps := len(destinationIPs)\n\tvar err error\n\n\tfor i := 0; i < numIps; i++ {\n\t\tprobability := 1 / float64(numIps-i)\n\n\t\tcommand := fmt.Sprintf(\n\t\t\t\"iptables -t nat -D PREROUTING -p tcp -d %s --dport %s -m state --state NEW -m statistic --mode random --probability %f -j DNAT --to-destination %s:%s\",\n\t\t\tsourceIP, sourcePort, probability, destinationIPs[i], destinationPort)\n\t\terr := executeShellCommand(command)\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error adding prerouting filter on DNAT.\")\n\t\t\treturn err\n\t\t}\n\n\t\tcommand = fmt.Sprintf(\n\t\t\t\"iptables -t nat -D OUTPUT -p tcp -d %s --dport %s -m state --state NEW -m statistic --mode random --probability %f -j DNAT --to-destination %s:%s\",\n\t\t\tsourceIP, sourcePort, probability, destinationIPs[i], destinationPort)\n\t\terr = executeShellCommand(command)\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error deleting output filter on DNAT.\")\n\t\t\treturn err\n\t\t}\n\t}\n\tlog.Printf(\"Finished deleting filter rules to Load Balancer.\")\n\treturn err\n}", "title": "" }, { "docid": "d0cd57273a4ac93acbb2d25bf63d0389", "score": "0.44394338", "text": "func (h *StnVppHandler) DeleteSTNRule(stnRule *stn.Rule) error {\n\treturn h.addDelStnRule(stnRule, false)\n}", "title": "" }, { "docid": "588fa819427ffa07554446e70674e7aa", "score": "0.44251564", "text": "func (a *AddressApiService) ClientAddressDelete(ctx _context.Context, clientUuid string, uuid string) ApiClientAddressDeleteRequest {\n\treturn ApiClientAddressDeleteRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tclientUuid: clientUuid,\n\t\tuuid: uuid,\n\t}\n}", "title": "" }, { "docid": "cb8a6a443ba386ec314567453a4de589", "score": "0.4424657", "text": "func (a *adapter) RemovePolicy(sec string, ptype string, rule []string) error {\n\tline := savePolicyLine(ptype, rule)\n\n\tsession := a.session.Copy()\n\tdefer session.Close()\n\n\tif err := a.collection.With(session).Remove(line); err != nil {\n\t\tswitch err {\n\t\tcase mgo.ErrNotFound:\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f2404ab1dc87d3c908d76e9e490d3cd5", "score": "0.44197828", "text": "func DeleteGCPAddress(s *Sandbox, name string) error {\n\tif err := s.f.Cloud.GlobalAddresses().Delete(context.Background(), meta.GlobalKey(name)); err != nil {\n\t\treturn err\n\t}\n\tklog.V(2).Infof(\"Global static IP %s deleted\", name)\n\n\treturn nil\n}", "title": "" }, { "docid": "c9efbb12e21a8f89c4ba70e3bb43dc1e", "score": "0.4415243", "text": "func (a *CustomersApiService) DeleteAddress(ctx _context.Context, customerID string, addressID string) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/customers/{customerID}/addresses/{addressID}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"customerID\"+\"}\", _neturl.QueryEscape(parameterToString(customerID, \"\")), -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"addressID\"+\"}\", _neturl.QueryEscape(parameterToString(addressID, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v 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 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": "6d6e33127113f5216bc8000861fd0906", "score": "0.44141924", "text": "func (m *RuleManager) DeleteRule(group, id string) error {\n\tm.Lock()\n\tdefer m.Unlock()\n\tp := m.beginPatch()\n\tp.deleteRule(group, id)\n\tif err := m.tryCommitPatch(p); err != nil {\n\t\treturn err\n\t}\n\tlog.Info(\"placement rule is removed\", zap.String(\"group\", group), zap.String(\"id\", id))\n\treturn nil\n}", "title": "" }, { "docid": "a7704a66fa88d175ac15745c62c07470", "score": "0.44112104", "text": "func (h *Handler) DeleteFromBytes(data []byte) error {\n\tnetpolJson, err := yaml.ToJSON(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnetpol := &networkingv1.NetworkPolicy{}\n\tif err = json.Unmarshal(netpolJson, netpol); err != nil {\n\t\treturn err\n\t}\n\treturn h.deleteNetpol(netpol)\n}", "title": "" }, { "docid": "9b9f574529b40e548ebc59eeaeb01d3d", "score": "0.43972045", "text": "func (v *Tezos) ValidateAddress(addr string, network NetworkType) *Result {\n\tdata, err := base58check.BitcoinEncoder.CheckDecode(addr)\n\tif err != nil {\n\t\treturn &Result{Success, false, Unknown, \"\"}\n\t}\n\n\tprefix := []byte{data[0], data[1], data[2]}\n\tif contains(tezosPrefixes, prefix) {\n\t\treturn &Result{Success, true, Normal, \"\"}\n\t}\n\n\treturn &Result{Success, false, Unknown, \"\"}\n}", "title": "" }, { "docid": "da15f0601c364aeb075db34a1c650ed2", "score": "0.43679553", "text": "func ExampleRemoveDepositAddress() {}", "title": "" }, { "docid": "1a9dc14eefe4d9d3d3a0588f35366b23", "score": "0.4361962", "text": "func (a *Client) DeleteAddresses(params *DeleteAddressesParams) (*DeleteAddressesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteAddressesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteAddresses\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/v1/enmasse/addresses\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &DeleteAddressesReader{formats: a.formats},\n\t\tContext: params.Context,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DeleteAddressesOK), nil\n\n}", "title": "" }, { "docid": "d6a688c0194b093f2aa8a015c6d33ea1", "score": "0.43597543", "text": "func (client BaseClient) DeleteAddressByName(ctx context.Context, addressName string, resourceGroupName string) (result DeleteAddressByNameFuture, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/BaseClient.DeleteAddressByName\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.FutureAPI != nil && result.FutureAPI.Response() != nil {\n\t\t\t\tsc = result.FutureAPI.Response().StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: addressName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"addressName\", Name: validation.MaxLength, Rule: 24, Chain: nil},\n\t\t\t\t{Target: \"addressName\", Name: validation.MinLength, Rule: 3, Chain: nil},\n\t\t\t\t{Target: \"addressName\", Name: validation.Pattern, Rule: `^[-\\w\\.]+$`, Chain: nil}}},\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(\"edgeorder.BaseClient\", \"DeleteAddressByName\", err.Error())\n\t}\n\n\treq, err := client.DeleteAddressByNamePreparer(ctx, addressName, resourceGroupName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"edgeorder.BaseClient\", \"DeleteAddressByName\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresult, err = client.DeleteAddressByNameSender(req)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"edgeorder.BaseClient\", \"DeleteAddressByName\", result.Response(), \"Failure sending request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "ed6686adfc76bf1df8343a89ec5f4b21", "score": "0.4336865", "text": "func (client BaseClient) DeleteAddressByNamePreparer(ctx context.Context, addressName string, resourceGroupName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"addressName\": autorest.Encode(\"path\", addressName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-12-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsDelete(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "54a7af8578fd4288512916640138a4d3", "score": "0.43331927", "text": "func (c *Client) DeleteRule(name, namespace string) error {\n\tif err := c.initClient(); err != nil {\n\t\treturn err\n\t}\n\treturn c.stork.StorkV1alpha1().Rules(namespace).Delete(context.TODO(), name, metav1.DeleteOptions{\n\t\tPropagationPolicy: &deleteForegroundPolicy,\n\t})\n}", "title": "" }, { "docid": "164dacdf0bf1593de22ed779fe3e0c81", "score": "0.43314403", "text": "func (m *DeleteRequest_Body) SetAddress(v *refs.Address) {\n\tif m != nil {\n\t\tm.Address = v\n\t}\n}", "title": "" }, { "docid": "edbd192d91a35815c4a203922ee428d0", "score": "0.43288532", "text": "func (n *nomadFSM) applyACLPolicyDelete(buf []byte, index uint64) interface{} {\n\tdefer metrics.MeasureSince([]string{\"nomad\", \"fsm\", \"apply_acl_policy_delete\"}, time.Now())\n\tvar req structs.ACLPolicyDeleteRequest\n\tif err := structs.Decode(buf, &req); err != nil {\n\t\tpanic(fmt.Errorf(\"failed to decode request: %v\", err))\n\t}\n\n\tif err := n.state.DeleteACLPolicies(index, req.Names); err != nil {\n\t\tn.logger.Printf(\"[ERR] nomad.fsm: DeleteACLPolicies failed: %v\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4a888c8472a427dc9ad173ea69ef9552", "score": "0.4326762", "text": "func (h *HubClient) NatRuleDelete(id int) (err error) {\n\treturn h.client.deleteChildXPathValue(strings.Replace(h.firmware.natRuleXPath(), \"#\", strconv.Itoa(id), 1))\n}", "title": "" }, { "docid": "3f1500001c513150eafec58701923c6c", "score": "0.43251142", "text": "func (addrs *IPAddresses) Del(addr net.IP) {\n\tnewAddrs := []net.IP{}\n\tfor _, addr2 := range addrs.list {\n\t\tif !addr2.Equal(addr) {\n\t\t\tnewAddrs = append(newAddrs, addr2)\n\t\t}\n\t}\n\taddrs.list = newAddrs\n}", "title": "" }, { "docid": "0a5a2b39f30885abb5e86dd72b5e8d9e", "score": "0.43214253", "text": "func (a *AntifraudApiService) DeleteRuleWhitelist(ctx context.Context, id string) ApiDeleteRuleWhitelistRequest {\n\treturn ApiDeleteRuleWhitelistRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "b07a1659b1a9896b96428da47dc71f42", "score": "0.4318321", "text": "func (c *FakePortAddressTranslations) Delete(name string, options *v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewDeleteAction(portaddresstranslationsResource, c.ns, name), &v1beta1.PortAddressTranslation{})\n\n\treturn err\n}", "title": "" }, { "docid": "5b26114a6a442526bd1a345fbeaf20e6", "score": "0.43163526", "text": "func (o *AccountIdentityMatchScoreAllOf) SetAddress(v AddressMatchScore) {\n\to.Address.Set(&v)\n}", "title": "" }, { "docid": "c9a19b38fcc4907311e87e68cb13418d", "score": "0.42676064", "text": "func (o *PostMsgauthGrantersGranterAddressGranteesGranteeAddressGrantsMsgTypeParams) SetGranteeAddress(granteeAddress string) {\n\to.GranteeAddress = granteeAddress\n}", "title": "" }, { "docid": "0111d8c4d198d02ee57f35c94b280f68", "score": "0.42669666", "text": "func (tp *TxPool) removeScriptFromAddrIndex(pkScript []byte, tx *massutil.Tx) error {\n\t_, addresses, _, _, err := txscript.ExtractPkScriptAddrs(pkScript,\n\t\t&config.ChainParams)\n\tif err != nil {\n\t\tlogging.CPrint(logging.ERROR, \"Unable to extract encoded addresses from script for addrindex\",\n\t\t\tlogging.LogFormat{\n\t\t\t\t\"addrindex\": err,\n\t\t\t})\n\t\treturn err\n\t}\n\tfor _, addr := range addresses {\n\t\tdelete(tp.addrindex[addr.EncodeAddress()], *tx.Hash())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "603d866d98d52662182c786706e4123d", "score": "0.42610312", "text": "func AddRule(proto, appPort, magicIp, hostInterface, hostIP string) error {\n\n if err := checkInterfaceExists(hostInterface); err != nil {\n return err\n }\n\n if hostIP == \"\" {\n return errors.New(\"--host-ip must be set\")\n }\n\n ipt, err := iptables.New()\n if err != nil {\n return err\n }\n\n\t table := \"nat\"\n\t chain := \"PREROUTING\"\n \t rules, err := ipt.List(table, chain)\n for _, r := range rules {\n\t\t\tdMatched := strings.Contains(r, fmt.Sprintf(\"-d %s\", magicIp))\n\t\t\tiMatched := strings.Contains(r, fmt.Sprintf(\"-i %s\", hostInterface))\n\t\t\tdportMatched := strings.Contains(r, fmt.Sprintf(\"--dport %d\", appPort))\n\t\t\tprotoMatched := strings.Contains(r, fmt.Sprintf(\"-p %s\", proto))\n\n\t\t\tif !dMatched {\n\t\t\t\tlog.Infof(\"Skipping %s from deletion because it doesn't match: -d %s\", r, magicIp)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tif !iMatched {\n\t\t\t\tlog.Infof(\"Skipping %s from deletion because it doesn't match: -i %s\", r, hostInterface)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tif !dportMatched {\n\t\t\t\tlog.Infof(\"Skipping %s from deletion because it doesn't match: --dport %s\", r, appPort)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tif !protoMatched {\n\t\t\t\tlog.Infof(\"Skipping %s from deletion because it doesn't match: -p %s\", r, proto)\n\t\t\t\treturn nil\n\t\t\t}\n\n \tspecstr := strings.Replace(r, fmt.Sprintf(\"-A %s \", chain), \"\", 1)\n \tspec := strings.Split(specstr, \" \")\n\n\t\t\terr = ipt.Delete(table, chain, spec...)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed while deleting old iptable rule \\\"%s\\\": %v\", specstr, err)\n\t\t\t}\n\t\t}\n\n return ipt.AppendUnique(\n\t\t\ttable, chain, \"-p\", proto, \"-d\", magicIp, \"--dport\", appPort,\n \"-j\", \"DNAT\", \"--to-destination\", hostIP+\":\"+appPort, \"-i\", hostInterface,\n )\n}", "title": "" }, { "docid": "b3f7ab31a80273121096d44a79c86350", "score": "0.4260418", "text": "func (this *NetServer) RemovePeerConsAddress(addr string) {\n\tthis.PeerAddrMap.Lock()\n\tdefer this.PeerAddrMap.Unlock()\n\tif _, ok := this.PeerConsAddress[addr]; ok {\n\t\tdelete(this.PeerConsAddress, addr)\n\t\tthis.log.Debugf(\"[p2p] delete Cons Address %s\", addr)\n\t}\n}", "title": "" }, { "docid": "0fba604d64a56b6605ab076ec6ccf3ec", "score": "0.42512688", "text": "func deleteEndpointAddress(index int, addrArray *[]apiv1.EndpointAddress) *[]apiv1.EndpointAddress {\n\t// remove the element at index by overwriting it with the last element\n\t(*addrArray)[index] = (*addrArray)[len(*addrArray)-1]\n\t// overwrite the last element with an empty element to avoid a memory leak\n\t(*addrArray)[len(*addrArray)-1] = apiv1.EndpointAddress{}\n\t// return the slice minus the last element\n\t*addrArray = (*addrArray)[:len(*addrArray)-1]\n\treturn addrArray\n}", "title": "" }, { "docid": "ed9d5f3a50a55633d86ca51ef5f64680", "score": "0.42456946", "text": "func (a *CasbinAdapter) RemovePolicy(sec string, ptype string, rule []string) error {\n\treturn nil\n}", "title": "" }, { "docid": "1c2703afe6cbc5cec603fff56e1c4247", "score": "0.42375296", "text": "func (op Operations) DeleteNetworkSecurityRule(UUID string) error {\n\tctx := context.TODO()\n\n\tpath := fmt.Sprintf(\"/network_security_rules/%s\", UUID)\n\n\treq, err := op.client.NewRequest(ctx, http.MethodDelete, path, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn op.client.Do(ctx, req, nil)\n}", "title": "" }, { "docid": "d73891110f4495d28efbebfc0f332c0b", "score": "0.4226857", "text": "func (pMgr *PolicyManager) removePolicy(policy *NPMNetworkPolicy, endpointList map[string]string) error {\n\tif endpointList == nil {\n\t\tif len(policy.PodEndpoints) == 0 {\n\t\t\tklog.Infof(\"[PolicyManagerWindows] No Endpoints to remove policy %s on\", policy.PolicyKey)\n\t\t\treturn nil\n\t\t}\n\t\tendpointList = policy.PodEndpoints\n\t}\n\n\trulesToRemove, err := pMgr.getSettingsFromACL(policy)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// FIXME rulesToRemove is a list of pointers\n\tklog.Infof(\"[PolicyManagerWindows] To Remove Policy: %s \\n To Delete ACLs: %+v \\n To Remove From %+v endpoints\", policy.PolicyKey, rulesToRemove, endpointList)\n\t// If remove bug is solved we can directly remove the exact policy from the endpoint\n\t// but if the bug is not solved then get all existing policies and remove relevant policies from list\n\t// then apply remaining policies onto the endpoint\n\tvar aggregateErr error\n\tnumOfRulesToRemove := len(rulesToRemove)\n\tfor epIPAddr, epID := range endpointList {\n\t\terr := pMgr.removePolicyByEndpointID(rulesToRemove[0].Id, epID, numOfRulesToRemove, removeOnlyGivenPolicy)\n\t\tif err != nil {\n\t\t\tif aggregateErr == nil {\n\t\t\t\taggregateErr = fmt.Errorf(\"skipping removing policy on %s ID Endpoint with err: %w\", epID, err)\n\t\t\t} else {\n\t\t\t\taggregateErr = fmt.Errorf(\"skipping removing policy on %s ID Endpoint with err: %s. previous err: [%w]\", epID, err.Error(), aggregateErr)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// Delete podendpoint from policy cache\n\t\tdelete(policy.PodEndpoints, epIPAddr)\n\t}\n\n\tif aggregateErr != nil {\n\t\treturn fmt.Errorf(\"[PolicyManagerWindows] while removing policy %s, %w\", policy.PolicyKey, aggregateErr)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8a9108c7bd376c2fea44b7f11865c883", "score": "0.4226564", "text": "func (_Ytm *YtmTransactor) RemoveRule(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) {\n\treturn _Ytm.contract.Transact(opts, \"removeRule\", addr)\n}", "title": "" }, { "docid": "ae455e4d11f6fe4f0f7fe110c4a8abc9", "score": "0.42155382", "text": "func deleteRule(seq uint64) error {\n\n\tvar url string = fmt.Sprintf(\"%s%s%d\", tnsrhost, ACL_Delete, seq)\n\n\t_, err := rest(\"DELETE\", url, \"\")\n\n\tif err != nil {\n\t\treturn (err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "195ae3edb13acd1dc482d3093ae291d2", "score": "0.4214691", "text": "func (s *Subnet) ReleaseAddress(ip net.IP) error {\n\tif err := s.context.kv.Delete(s.addressKey(ip.String()), false); err != nil {\n\t\treturn err\n\t}\n\tdelete(s.addresses, ipToI32(ip))\n\treturn nil\n}", "title": "" }, { "docid": "f8ad163f9bc0a76f253ce6d84acbafcb", "score": "0.42144784", "text": "func (o *AccountIdentityMatchScore) SetAddress(v AddressMatchScore) {\n\to.Address.Set(&v)\n}", "title": "" }, { "docid": "9f4d0eccba34088c12af35081770fb81", "score": "0.420843", "text": "func (_Whitelistable *WhitelistableFilterer) FilterAddressRemovedFromWhitelist(opts *bind.FilterOpts, AuthorizedBy []common.Address, AddressRemoved []common.Address) (*WhitelistableAddressRemovedFromWhitelistIterator, error) {\n\n\tvar AuthorizedByRule []interface{}\n\tfor _, AuthorizedByItem := range AuthorizedBy {\n\t\tAuthorizedByRule = append(AuthorizedByRule, AuthorizedByItem)\n\t}\n\tvar AddressRemovedRule []interface{}\n\tfor _, AddressRemovedItem := range AddressRemoved {\n\t\tAddressRemovedRule = append(AddressRemovedRule, AddressRemovedItem)\n\t}\n\n\tlogs, sub, err := _Whitelistable.contract.FilterLogs(opts, \"AddressRemovedFromWhitelist\", AuthorizedByRule, AddressRemovedRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &WhitelistableAddressRemovedFromWhitelistIterator{contract: _Whitelistable.contract, event: \"AddressRemovedFromWhitelist\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "8874258bd12f5b5213ff07c9de3d845b", "score": "0.4194247", "text": "func (rndr *Renderer) DeletePolicy(serviceInfo *common.ServiceInfo, sp *sasemodel.SaseConfig) error {\n\treturn nil\n}", "title": "" }, { "docid": "a725f0830b8dcda33c195b678e4af297", "score": "0.41843385", "text": "func (c *addressManager) delAddr(ip net.IP) bool {\n\tc.Lock()\n\tdefer c.Unlock()\n\tif c.addresses.Has(ip.String()) && c.isValidNodeIP(ip) {\n\t\tklog.V(5).Infof(\"Removing IP: %s, from node IP manager\", ip)\n\t\tc.addresses.Delete(ip.String())\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ee3df1373d2e4921a2d30a526f7ed0aa", "score": "0.41825545", "text": "func (pm *PortMapper) DeleteForwardingTableEntry(proto string, sourceIP net.IP, sourcePort int, containerIP string, containerPort int) error {\n\treturn pm.forward(iptables.Delete, proto, sourceIP, sourcePort, containerIP, containerPort)\n}", "title": "" }, { "docid": "062c28fa60c29d4e7b5276b1ca1cff79", "score": "0.41606954", "text": "func ReverseAddr(addr string) (arpa string, err error) {\n\tip := net.ParseIP(addr)\n\tif ip == nil {\n\t\treturn \"\", &Error{err: \"unrecognized address: \" + addr}\n\t}\n\tif v4 := ip.To4(); v4 != nil {\n\t\tbuf := make([]byte, 0, net.IPv4len*4+len(\"in-addr.arpa.\"))\n\t\t// Add it, in reverse, to the buffer\n\t\tfor i := len(v4) - 1; i >= 0; i-- {\n\t\t\tbuf = strconv.AppendInt(buf, int64(v4[i]), 10)\n\t\t\tbuf = append(buf, '.')\n\t\t}\n\t\t// Append \"in-addr.arpa.\" and return (buf already has the final .)\n\t\tbuf = append(buf, \"in-addr.arpa.\"...)\n\t\treturn string(buf), nil\n\t}\n\t// Must be IPv6\n\tbuf := make([]byte, 0, net.IPv6len*4+len(\"ip6.arpa.\"))\n\t// Add it, in reverse, to the buffer\n\tfor i := len(ip) - 1; i >= 0; i-- {\n\t\tv := ip[i]\n\t\tbuf = append(buf, hexDigit[v&0xF], '.', hexDigit[v>>4], '.')\n\t}\n\t// Append \"ip6.arpa.\" and return (buf already has the final .)\n\tbuf = append(buf, \"ip6.arpa.\"...)\n\treturn string(buf), nil\n}", "title": "" }, { "docid": "54d7f696f814055a64dd577abc38f492", "score": "0.41507155", "text": "func (this *AddressImpl) SetAddressType(atype int) {\n\tthis.addressType = atype\n}", "title": "" }, { "docid": "3a94589d77f8443698cb1acdcb67a7bc", "score": "0.4144812", "text": "func (a *ABFServer) DeleteFromIpFilter(ctx context.Context, req *api.IPFilterData) (*api.IPFilterResponse, error) { // nolint\n\t_, cidr, err := net.ParseCIDR(req.GetNetwork())\n\tif err != nil {\n\t\treturn &api.IPFilterResponse{\n\t\t\tError: status.Error(codes.Internal, err.Error()).Error(),\n\t\t}, err\n\t}\n\n\terr = a.abfService.DeleteIPNetwork(ctx, *cidr, req.GetColor())\n\n\tif err != nil {\n\t\treturn &api.IPFilterResponse{\n\t\t\tError: status.Error(codes.Internal, err.Error()).Error(),\n\t\t}, err\n\t}\n\n\treturn &api.IPFilterResponse{\n\t\tError: errors.ErrNoGrpcError.Error(),\n\t}, nil\n}", "title": "" }, { "docid": "a7030017d2dd5defe920dff5ee29d5e9", "score": "0.41371593", "text": "func CheckAddressType(urlStr string) AddressType {\n\tif ip := net.ParseIP(urlStr); ip != nil {\n\t\treturn AddressTypeIP\n\t} else if DNPattern.MatchString(urlStr) {\n\t\treturn AddressTypeFQDN\n\t} else {\n\t\treturn AddressTypeError\n\t}\n}", "title": "" }, { "docid": "b315e9aab875acb1c5b4c862325f4eaf", "score": "0.41357613", "text": "func (o DistributionOutput) IpAddressType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Distribution) pulumi.StringPtrOutput { return v.IpAddressType }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f267f36a56b2578660d6e7a233d06103", "score": "0.41201472", "text": "func parseAddr(addrType scion.AddrType, addrLen scion.AddrLen, raw []byte) (net.Addr, error) {\n\tswitch addrLen {\n\tcase scion.AddrLen4:\n\t\tswitch addrType {\n\t\tcase scion.T4Ip:\n\t\t\treturn &net.IPAddr{IP: net.IP(raw)}, nil\n\t\tcase scion.T4Svc:\n\t\t\treturn addr.HostSVC(binary.BigEndian.Uint16(raw[:addr.HostLenSVC])), nil\n\t\t}\n\tcase scion.AddrLen16:\n\t\tswitch addrType {\n\t\tcase scion.T16Ip:\n\t\t\treturn &net.IPAddr{IP: net.IP(raw)}, nil\n\t\t}\n\t}\n\treturn nil, serrors.New(\"unsupported address type/length combination\",\n\t\t\"type\", addrType, \"len\", addrLen)\n}", "title": "" }, { "docid": "f8a7c32c7bcafb11b1e4e08816570125", "score": "0.41141158", "text": "func (rndr *Renderer) DeleteIPSecServiceConfig(serviceInfo *common.ServiceInfo, sp *sasemodel.IPSecVpnTunnel) error {\n\t// Switch on tunnel type\n\tswitch sp.TunnelType {\n\tcase config.InterfaceIPSecTunnel:\n\t\trndr.DeleteIPSecIPinIPVpnTunnel(serviceInfo, sp)\n\tcase config.InterfaceGreTunnel:\n\t\trndr.DeleteGreTunnel(serviceInfo, sp)\n\tcase config.InterfaceIPinIPTunnel:\n\t\trndr.DeleteIPinIPTunnel(serviceInfo, sp)\n\tdefault:\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c980bb3dd17f2c106e60522d1476cbf7", "score": "0.4111131", "text": "func (c *Controller) clearAdminNetworkPolicy(anpName string) error {\n\t// See if we need to handle this: https://github.com/ovn-org/ovn-kubernetes/pull/3659#discussion_r1284645817\n\tanp, loaded := c.anpCache[anpName]\n\tif !loaded {\n\t\t// there is no existing ANP configured with this name, nothing to clean\n\t\tklog.Infof(\"ANP %s not found in cache, nothing to clear\", anpName)\n\t\treturn nil\n\t}\n\n\t// clear NBDB objects for the given ANP (PG, ACLs on that PG, AddrSets used by the ACLs)\n\tvar err error\n\t// remove PG for Subject (ACLs will get cleaned up automatically)\n\tportGroupName, readableGroupName := getAdminNetworkPolicyPGName(anp.name, false)\n\t// no need to batch this with address-set deletes since this itself will contain a bunch of ACLs that need to be deleted which is heavy enough.\n\terr = libovsdbops.DeletePortGroups(c.nbClient, portGroupName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to delete PG %s for ANP %s: %w\", readableGroupName, anp.name, err)\n\t}\n\t// remove address-sets that were created for the peers of each rule fpr the whole ANP\n\t// do this after ACLs are gone so that there is no lingering references\n\terr = c.clearASForPeers(anp.name, libovsdbops.AddressSetAdminNetworkPolicy)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to delete address-sets for ANP %s/%d: %w\", anp.name, anp.anpPriority, err)\n\t}\n\t// we can delete the object from the cache now.\n\tdelete(c.anpPriorityMap, anp.anpPriority)\n\tdelete(c.anpCache, anpName)\n\n\treturn nil\n}", "title": "" }, { "docid": "3eb57ad8a2562c711d3c741681615cc9", "score": "0.4111123", "text": "func (r ReconcilerBase) DeleteNetworkPolicy(name string, namespace string, ctx context.Context, log logr.Logger) error {\n\tnetworkPolicy, err := r.GetNetworkPolicy(name, namespace, ctx)\n\tif err != nil {\n\t\tlog.V(1).Info(\"Unable to get network policy when cleaning up\", \"err\", err)\n\t\treturn err\n\t}\n\tif err := r.GetClient().Delete(ctx, networkPolicy); err != nil {\n\t\tlog.Error(err, \"unable to delete network policy for device when cleaning up\")\n\t\treturn err\n\t}\n\tlog.V(1).Info(\"Deleted network policy for the device\", \"network-policy\", networkPolicy)\n\treturn nil\n\n}", "title": "" }, { "docid": "0be3687ef4f8ef8f6295bc2df9f76f57", "score": "0.41071585", "text": "func (c *FakeDnsRules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewRootDeleteAction(dnsrulesResource, name), &binddnsv1.DnsRule{})\n\treturn err\n}", "title": "" }, { "docid": "421c3971723c704ce1bc7decb4e1b886", "score": "0.41019207", "text": "func iptablesDeleteRules(v *seesaw.Vserver, clusterVIP seesaw.Host, af seesaw.AF) error {\n\trules, err := iptablesRules(v, clusterVIP, af)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, r := range rules {\n\t\tif err := iptablesRun(r.AF, string(iptDelete)+\" \"+r.rule); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b3eb98d354e1cd48f5718d800bf39c34", "score": "0.41015452", "text": "func (o TargetGroupConfigOutput) IpAddressType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TargetGroupConfig) *string { return v.IpAddressType }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8c60e7f3ffa419fab43e0cb18fe2dd83", "score": "0.40931356", "text": "func RemovePolicy(ip, policyName string) (string, error) {\n\tlog.Printf(\"Removing policy [%s] on esx [%s]\\n\", policyName, ip)\n\treturn ssh.InvokeCommand(ip, admincli.RemovePolicy+policyName)\n}", "title": "" }, { "docid": "25ee52e3a359cb025c3619870e7a91be", "score": "0.40907192", "text": "func DeleteAddressByID(w http.ResponseWriter,r *http.Request) {\n\tID,_ := strconv.Atoi(r.PostFormValue(\"ID\")) \n\tservice.DeleteAddressByID(ID)\n}", "title": "" }, { "docid": "8b00263fc8d54d2c8f4b5a3d63cb57c2", "score": "0.40901512", "text": "func (_Ytm *YtmSession) RemoveRule(addr common.Address) (*types.Transaction, error) {\n\treturn _Ytm.Contract.RemoveRule(&_Ytm.TransactOpts, addr)\n}", "title": "" }, { "docid": "83b8035359c0664eb8df6a8e724fe318", "score": "0.40860066", "text": "func (f *Filter) delRule(rule *Rule) error {\n\tif rule == nil {\n\t\treturn fmt.Errorf(\"nil rule\")\n\t}\n\n\treturn f.m.DeleteElement(f.fmap, unsafe.Pointer(rule))\n}", "title": "" }, { "docid": "3d79bdb3acb3b7abed5bda2f6142dd0a", "score": "0.4080885", "text": "func (iptMgr *IptablesManager) Delete(entry *IptEntry) error {\n\tlog.Logf(\"Deleting iptables entry: %+v\", entry)\n\n\texists, err := iptMgr.exists(entry)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !exists {\n\t\treturn nil\n\t}\n\n\tiptMgr.OperationFlag = util.IptablesDeletionFlag\n\tif _, err := iptMgr.run(entry); err != nil {\n\t\tmetrics.SendErrorLogAndMetric(util.IptmID, \"Error: failed to delete iptables rules.\")\n\t\treturn err\n\t}\n\n\tmetrics.DecNumACLRules()\n\treturn nil\n}", "title": "" }, { "docid": "ed3bcdd23bd5d5000c72e73ae33743ed", "score": "0.407298", "text": "func (am *addressManager) TearDownAddressIPIfNetworkTierMismatch() error {\n\tif am.targetIP == \"\" {\n\t\treturn nil\n\t}\n\taddr, err := am.svc.GetRegionAddressByIP(am.region, am.targetIP)\n\tif utils.IsNotFoundError(err) {\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tif addr != nil && addr.NetworkTier != am.networkTier.ToGCEValue() {\n\t\tif !am.isManagedAddress(addr) {\n\t\t\treturn utils.NewNetworkTierErr(fmt.Sprintf(\"User specific address IP (%v)\", am.name), string(am.networkTier), addr.NetworkTier)\n\t\t}\n\t\tklog.V(3).Infof(\"Deleting IP address %v because has wrong network tier\", am.targetIP)\n\t\tif err := am.svc.DeleteRegionAddress(addr.Name, am.targetIP); err != nil {\n\t\t\tklog.Errorf(\"Unable to delete region address %s on target ip %s, err: %v\", addr.Name, am.targetIP, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8313f29c4ab0c5943a6ed7554ea64c08", "score": "0.4066291", "text": "func (client *VirtualNetworkRulesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, virtualNetworkRuleName string, options *VirtualNetworkRulesDeleteOptions) (VirtualNetworkRulesDeleteResponse, error) {\n\treq, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, virtualNetworkRuleName, options)\n\tif err != nil {\n\t\treturn VirtualNetworkRulesDeleteResponse{}, err\n\t}\n\tresp, err := client.pl.Do(req)\n\tif err != nil {\n\t\treturn VirtualNetworkRulesDeleteResponse{}, err\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) {\n\t\treturn VirtualNetworkRulesDeleteResponse{}, client.deleteHandleError(resp)\n\t}\n\treturn VirtualNetworkRulesDeleteResponse{RawResponse: resp}, nil\n}", "title": "" }, { "docid": "12ba7366cacfb708cf88f3ed3dc8de8e", "score": "0.40504852", "text": "func TestDelArp(t *testing.T) {\n\tctx := vppcallmock.SetupTestCtx(t)\n\tdefer ctx.TeardownTestCtx()\n\n\tctx.MockVpp.MockReply(&ip.IPNeighborAddDelReply{})\n\terr := vppcalls.VppDelArp(&arpEntries[0], ctx.MockChannel, nil)\n\tExpect(err).To(Succeed())\n}", "title": "" } ]
3e1484e2ed3a7dd6f57b11b21518f14c
SetStatelessRules sets the StatelessRules field's value.
[ { "docid": "7eca07dcb576cc068bd0222e307b7685", "score": "0.731191", "text": "func (s *StatelessRulesAndCustomActions) SetStatelessRules(v []*StatelessRule) *StatelessRulesAndCustomActions {\n\ts.StatelessRules = v\n\treturn s\n}", "title": "" } ]
[ { "docid": "3a6b351088581c94b071ae17f3afc641", "score": "0.56959", "text": "func (s *RulesSource) SetStatefulRules(v []*StatefulRule) *RulesSource {\n\ts.StatefulRules = v\n\treturn s\n}", "title": "" }, { "docid": "e17b6046c4fa716bc2d777cc29743831", "score": "0.49851552", "text": "func SetRuleState(key string, isActive bool) bool {\n\tlog.Println(infoLog, \"Invoke SetRuleState\")\n\tdb := GetDatabase()\n\tif rule, found := db[key]; found {\n\t\trule.IsActive = isActive\n\t\tdb[key] = rule\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6d543b9f9eae3614062bb6a25f4d4db6", "score": "0.49121478", "text": "func (m *HostReputation) SetRules(value []HostReputationRuleable)() {\n err := m.GetBackingStore().Set(\"rules\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1c3c2bc9af5f38d530cceb7a4cb08698", "score": "0.48154375", "text": "func (m *MessageRuleActions) SetStopProcessingRules(value *bool)() {\n err := m.GetBackingStore().Set(\"stopProcessingRules\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "dd6d5175a63b949b2889e9c991bad667", "score": "0.4750242", "text": "func (b *Backend) SetRules(direction string, rule []string) {\n\tb.sync.Lock()\n\tdefer b.sync.Unlock()\n\tswitch direction {\n\tcase \"prein\":\n\t\tb.PreInboundRule = rule\n\n\tcase \"in\":\n\t\tb.InboundRule = rule\n\n\tcase \"out\":\n\t\tb.OutboundRule = rule\n\t}\n}", "title": "" }, { "docid": "29c2890999434bd721e737babb8ff828", "score": "0.47067553", "text": "func (m *WindowsFirewallNetworkProfile) SetFirewallEnabled(value *StateManagementSetting)() {\n m.firewallEnabled = value\n}", "title": "" }, { "docid": "17934bc04478456ef08853d5ff12831a", "score": "0.46880466", "text": "func SetEnabled(on bool) {\n\tdisabled.Store(!on)\n}", "title": "" }, { "docid": "8872627761f20803d73cd6c3dc312181", "score": "0.46504435", "text": "func (m *X509CertificateAuthenticationModeConfiguration) SetRules(value []X509CertificateRuleable)() {\n m.rules = value\n}", "title": "" }, { "docid": "7c6464e639a8a2731b9660996a9d1b5f", "score": "0.45026252", "text": "func (s *RulesSource) SetStatelessRulesAndCustomActions(v *StatelessRulesAndCustomActions) *RulesSource {\n\ts.StatelessRulesAndCustomActions = v\n\treturn s\n}", "title": "" }, { "docid": "3f32aca56fe2ba07c389578fb499e51f", "score": "0.450128", "text": "func (s *FirewallPolicyResponse) SetConsumedStatelessRuleCapacity(v int64) *FirewallPolicyResponse {\n\ts.ConsumedStatelessRuleCapacity = &v\n\treturn s\n}", "title": "" }, { "docid": "b18cfd3161f61d7497b488c209ff9273", "score": "0.44834334", "text": "func (srv *PCRFDiamServer) SetRules(\n\tctx context.Context,\n\taccountRules *protos.AccountRules,\n) (*orcprotos.Void, error) {\n\taccount, ok := srv.subscribers[accountRules.Imsi]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Could not find imsi %s\", accountRules.Imsi)\n\t}\n\taccount.RuleNames = accountRules.StaticRuleNames\n\taccount.RuleBaseNames = accountRules.StaticRuleBaseNames\n\taccount.RuleDefinitions = accountRules.DynamicRuleDefinitions\n\treturn &orcprotos.Void{}, nil\n}", "title": "" }, { "docid": "ae58eab78f90cc4e46e65d72faca8a5b", "score": "0.4470979", "text": "func (m *DeviceHealthAttestationState) SetSafeMode(value *string)() {\n m.safeMode = value\n}", "title": "" }, { "docid": "5d146b11496f4d9694f25233410a7c3f", "score": "0.43585378", "text": "func SetSSHEnabled(new func() error) (previous func() error) {\n\tprevious = sshEnabled\n\tsshEnabled = new\n\treturn previous\n}", "title": "" }, { "docid": "61740cd604ced37b02c23ff655bf0f57", "score": "0.43530983", "text": "func (m *MailFolder) SetMessageRules(value []MessageRuleable)() {\n err := m.GetBackingStore().Set(\"messageRules\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "186fba8c4acbdf9c161055faf2c57077", "score": "0.4338118", "text": "func (d *BrowserHost) SetWindowlessFrameRate(frameRate int32) {\n\tC.gocef_browser_host_set_windowless_frame_rate(d.toNative(), C.int(frameRate), d.set_windowless_frame_rate)\n}", "title": "" }, { "docid": "b93c0d3aaab20bc937f8ffe0487f2e25", "score": "0.4333563", "text": "func (s *Server) SetFeedState(c *gin.Context) {\n\turl := c.Param(\"url\")\n\turl = strings.TrimPrefix(url, \"/\")\n\n\t// Need to make sure URL is absolute and scheme is HTTP or HTTPS\n\tif !core.IsValideAbsoluteURL(url) {\n\t\ts.Logger.Info(\"url provided is not valid\")\n\t\tRespondWithError(c, 400, \"url provided is not valid\")\n\t\treturn\n\t}\n\n\tbodyData := struct {\n\t\t// Need to make Enabled a bool pointer to validate it exists\n\t\tEnabled *bool `json:\"enabled\" binding:\"required\"`\n\t}{}\n\n\terr := c.ShouldBindJSON(&bodyData)\n\tif err != nil {\n\t\ts.Logger.Info(fmt.Sprintf(\"error parsing body: %s\", err.Error()))\n\t\tRespondWithError(c, 400, err.Error())\n\t\treturn\n\t}\n\n\terr = s.Repo.SetFeedState(url, *bodyData.Enabled)\n\tif errT, ok := err.(*repository.DBNotFoundError); ok {\n\t\ts.Logger.Error(errT.Error())\n\t\tRespondWithError(c, 404, \"URL not found\")\n\t\treturn\n\t} else if err != nil {\n\t\ts.Logger.Error(err.Error())\n\t\tRespondWithError(c, 500, \"Internal error\")\n\t\treturn\n\t}\n\n\tc.Status(204)\n}", "title": "" }, { "docid": "e8a1db365f33c42ddaa0bb102b3ef617", "score": "0.42978495", "text": "func (o *NewRuleset) SetRules(v []Rule) {\n\to.Rules = v\n}", "title": "" }, { "docid": "2a14ba3d903e4ff1552cfa514d374625", "score": "0.4291376", "text": "func (ftc *FileTypeCreate) SetNillableState(f *filetype.State) *FileTypeCreate {\n\tif f != nil {\n\t\tftc.SetState(*f)\n\t}\n\treturn ftc\n}", "title": "" }, { "docid": "4e086447013f037eda26f6fac02fd552", "score": "0.42899838", "text": "func (m *RuleManager) SetRules(rules []*Rule) error {\n\truleOps := make([]RuleOp, len(rules))\n\tfor i, rule := range rules {\n\t\terr := m.adjustRule(rule)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\truleOps[i] = RuleOp{Rule: rule, Action: RuleOpAdd}\n\t}\n\treturn m.Batch(ruleOps)\n}", "title": "" }, { "docid": "5481c2f630be87cfe584e0be43d9e77f", "score": "0.42801464", "text": "func (uu *UserUpdate) SetNillableState(u *user.State) *UserUpdate {\n\tif u != nil {\n\t\tuu.SetState(*u)\n\t}\n\treturn uu\n}", "title": "" }, { "docid": "1853d482f52d8b71e0796a5dd0a60edd", "score": "0.4247796", "text": "func (c *component) SetEnabled(enable bool) {\n\tc.Call(\"setEnabled\", enable)\n}", "title": "" }, { "docid": "19b5dcb8cd372f3c808984a16f2eee82", "score": "0.42450467", "text": "func (me *TxsdTableRules) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "32ff9b89093544ff09ac6401e55dbe79", "score": "0.42449367", "text": "func (s *RuleGroup) SetStatefulRuleOptions(v *StatefulRuleOptions) *RuleGroup {\n\ts.StatefulRuleOptions = v\n\treturn s\n}", "title": "" }, { "docid": "badade6aa5f903436de487b842dd2424", "score": "0.4228345", "text": "func (state *ScanState) SetImmutable() {\n\tstate.scan.setImmutable()\n}", "title": "" }, { "docid": "11ec05ebc511d82e196ca8968c75b47f", "score": "0.42182928", "text": "func (s *FirewallPolicy) SetStatelessRuleGroupReferences(v []*StatelessRuleGroupReference) *FirewallPolicy {\n\ts.StatelessRuleGroupReferences = v\n\treturn s\n}", "title": "" }, { "docid": "89149d9d1f5c7b2bf80f298b3525ad00", "score": "0.42169794", "text": "func SetWirelessEnabled(value bool) error {\n\tnm, err := System()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nm.SetWirelessEnabled(value)\n}", "title": "" }, { "docid": "8453017b52b385e25a712a06f65fa330", "score": "0.41891545", "text": "func (r *Redirect) updateRules(p policy.ProxyPolicy) revert.RevertFunc {\n\toldRules := r.rules\n\tr.rules = p.CopyL7RulesPerEndpoint()\n\treturn func() error {\n\t\tr.mutex.Lock()\n\t\tr.rules = oldRules\n\t\tr.mutex.Unlock()\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "3f6e08edd7161638929120bcfc180b98", "score": "0.4177932", "text": "func (m *LegalHold) SetIsEnabled(value *bool)() {\n err := m.GetBackingStore().Set(\"isEnabled\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "37b71c5e8925da45462c8eb90414cfaa", "score": "0.41724712", "text": "func (ftu *FileTypeUpdate) SetNillableState(f *filetype.State) *FileTypeUpdate {\n\tif f != nil {\n\t\tftu.SetState(*f)\n\t}\n\treturn ftu\n}", "title": "" }, { "docid": "d12258fbfa1fd6daed24e55d31fd3955", "score": "0.41313", "text": "func (m *DeviceHealthAttestationState) SetVirtualSecureMode(value *string)() {\n m.virtualSecureMode = value\n}", "title": "" }, { "docid": "a70a015da49d52a53a442eefd2c8dce1", "score": "0.41206762", "text": "func (uuo *UserUpdateOne) SetNillableState(u *user.State) *UserUpdateOne {\n\tif u != nil {\n\t\tuuo.SetState(*u)\n\t}\n\treturn uuo\n}", "title": "" }, { "docid": "6e67f6eb7a0d399ed49054b6522f94c9", "score": "0.40953368", "text": "func (m *OcrSettings) SetIsEnabled(value *bool)() {\n err := m.GetBackingStore().Set(\"isEnabled\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "95e7843687e63f8b5a6e35cc89c0d1ee", "score": "0.40880594", "text": "func (m *AuthenticationMethodsRegistrationCampaign) SetState(value *AdvancedConfigState)() {\n m.state = value\n}", "title": "" }, { "docid": "7a186a1d4444234f32ed39c09227edf5", "score": "0.40874922", "text": "func SetEnabled(b bool) {\n\tenabled = b\n}", "title": "" }, { "docid": "49a1599687b5c13b1252f4232df7da1d", "score": "0.4053126", "text": "func SetImplicitState(uname string, state models.UserState) (e error) {\n\te = setUserState(uname, state)\n\treturn\n}", "title": "" }, { "docid": "f1be7a80530aa89f112f5427ed75dfd0", "score": "0.404162", "text": "func (m *WindowsFirewallNetworkProfile) SetConnectionSecurityRulesFromGroupPolicyMerged(value *bool)() {\n m.connectionSecurityRulesFromGroupPolicyMerged = value\n}", "title": "" }, { "docid": "d6e28ec36e287c0bb71764931db9849d", "score": "0.40389892", "text": "func (ftuo *FileTypeUpdateOne) SetNillableState(f *filetype.State) *FileTypeUpdateOne {\n\tif f != nil {\n\t\tftuo.SetState(*f)\n\t}\n\treturn ftuo\n}", "title": "" }, { "docid": "d8256c9a4073c47f59e55e195bb4fa38", "score": "0.39937875", "text": "func SetBorderless(bs bool) error {\n\tinitDefaultWindow()\n\treturn defaultWindow.SetBorderless(bs)\n}", "title": "" }, { "docid": "cbcc2679046838defdfb6a03c43bb434", "score": "0.3990056", "text": "func (in *TrafficWebhookRules) DeepCopy() *TrafficWebhookRules {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TrafficWebhookRules)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "868c8bd1fcf52fa92a9f25fc697662d8", "score": "0.398297", "text": "func (m *Windows81VpnConfiguration) SetApplyOnlyToWindows81(value *bool)() {\n err := m.GetBackingStore().Set(\"applyOnlyToWindows81\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "99ca18e2b1c208222d75e0a0eaf88877", "score": "0.39716712", "text": "func (m *WindowsFirewallNetworkProfile) SetInboundConnectionsBlocked(value *bool)() {\n m.inboundConnectionsBlocked = value\n}", "title": "" }, { "docid": "137c3d0d6a992ca64a6ef3d0aaf44b30", "score": "0.3967285", "text": "func (rule *NetworkSecurityGroupsSecurityRule) SetStatus(status genruntime.ConvertibleStatus) error {\n\t// If we have exactly the right type of status, assign it\n\tif st, ok := status.(*NetworkSecurityGroups_SecurityRule_STATUS); ok {\n\t\trule.Status = *st\n\t\treturn nil\n\t}\n\n\t// Convert status to required version\n\tvar st NetworkSecurityGroups_SecurityRule_STATUS\n\terr := status.ConvertStatusTo(&st)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to convert status\")\n\t}\n\n\trule.Status = st\n\treturn nil\n}", "title": "" }, { "docid": "fc5ad9e8552d5c0cf2bbb1a2bf206283", "score": "0.39660096", "text": "func (m *OathTokenMetadata) SetEnabled(value *bool)() {\n err := m.GetBackingStore().Set(\"enabled\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "aa50f5e15d83f8acdfaab7c810fd624f", "score": "0.39644492", "text": "func (m *Security) SetSecureScoreControlProfiles(value []SecureScoreControlProfileable)() {\n err := m.GetBackingStore().Set(\"secureScoreControlProfiles\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "60b3f4397a3b6b68b95315e9961bdefb", "score": "0.39588144", "text": "func (rb *ResourceBuilder) SetK8sStatefulsetName(val string) {\n\tif rb.config.K8sStatefulsetName.Enabled {\n\t\trb.res.Attributes().PutStr(\"k8s.statefulset.name\", val)\n\t}\n}", "title": "" }, { "docid": "52984e75970810b096f6ee7793253126", "score": "0.3957272", "text": "func (m *WindowsFirewallNetworkProfile) SetStealthModeBlocked(value *bool)() {\n m.stealthModeBlocked = value\n}", "title": "" }, { "docid": "37d70428801578cb5b244b8dad3dc984", "score": "0.39439827", "text": "func (o *OVN) LogicalSwitchSetACLRules(switchName OVNSwitch, aclRules ...OVNACLRule) error {\n\t// Remove any existing rules assigned to the entity.\n\targs := []string{\"clear\", \"logical_switch\", string(switchName), \"acls\"}\n\n\t// Add new rules.\n\texternalIDs := map[string]string{\n\t\tovnExtIDLXDSwitch: string(switchName),\n\t}\n\n\targs = o.aclRuleAddAppendArgs(args, \"logical_switch\", string(switchName), externalIDs, nil, aclRules...)\n\n\t_, err := o.nbctl(args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d0f4b1a9c8b967e315fa1a9410a8b79d", "score": "0.3941306", "text": "func (_class PoolClass) SetWlbEnabled(sessionID SessionRef, self PoolRef, value bool) (_err error) {\n\t_method := \"pool.set_wlb_enabled\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertPoolRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_valueArg, _err := convertBoolToXen(fmt.Sprintf(\"%s(%s)\", _method, \"value\"), value)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)\n\treturn\n}", "title": "" }, { "docid": "037a1d3f99daad9a15c67429337fd943", "score": "0.39296174", "text": "func (o *PostLolGameflowV1PreEndGameTransitionParams) SetEnabled(enabled bool) {\n\to.Enabled = enabled\n}", "title": "" }, { "docid": "854ef6343b15fc7e59b63b499ed798b4", "score": "0.39285532", "text": "func (s *FirewallPolicy) SetStatelessCustomActions(v []*CustomAction) *FirewallPolicy {\n\ts.StatelessCustomActions = v\n\treturn s\n}", "title": "" }, { "docid": "ff93ed8c931ec7b9fedb04634d07f192", "score": "0.39202178", "text": "func (a *ServerWithRoles) UpdateHeadlessAuthenticationState(ctx context.Context, name string, state types.HeadlessAuthenticationState, mfaResp *proto.MFAAuthenticateResponse) error {\n\tif !hasLocalUserRole(a.context) {\n\t\treturn trace.AccessDenied(\"non-local user roles cannot approve or deny headless authentication resources\")\n\t}\n\tusername := a.context.User.GetName()\n\n\theadlessAuthn, err := a.authServer.GetHeadlessAuthentication(ctx, username, name)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tif !headlessAuthn.State.IsPending() {\n\t\treturn trace.AccessDenied(\"cannot update a headless authentication state from a non-pending state\")\n\t}\n\n\t// Shallow copy headless authn for compare and swap below.\n\treplaceHeadlessAuthn := *headlessAuthn\n\treplaceHeadlessAuthn.State = state\n\n\tswitch state {\n\tcase types.HeadlessAuthenticationState_HEADLESS_AUTHENTICATION_STATE_APPROVED:\n\t\t// The user must authenticate with MFA to change the state to approved.\n\t\tif mfaResp == nil {\n\t\t\treturn trace.BadParameter(\"expected MFA auth challenge response\")\n\t\t}\n\n\t\t// Only WebAuthn is supported in headless login flow for superior phishing prevention.\n\t\tif _, ok := mfaResp.Response.(*proto.MFAAuthenticateResponse_Webauthn); !ok {\n\t\t\treturn trace.BadParameter(\"expected WebAuthn challenge response, but got %T\", mfaResp.Response)\n\t\t}\n\n\t\tmfaDevice, _, err := a.authServer.validateMFAAuthResponse(ctx, mfaResp, headlessAuthn.User, false /* passwordless */)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\n\t\treplaceHeadlessAuthn.MfaDevice = mfaDevice\n\tcase types.HeadlessAuthenticationState_HEADLESS_AUTHENTICATION_STATE_DENIED:\n\t\t// continue to compare and swap without MFA.\n\tdefault:\n\t\treturn trace.AccessDenied(\"cannot update a headless authentication state to %v\", state.String())\n\t}\n\n\t_, err = a.authServer.CompareAndSwapHeadlessAuthentication(ctx, headlessAuthn, &replaceHeadlessAuthn)\n\treturn trace.Wrap(err)\n}", "title": "" }, { "docid": "183252d9f7f49600ba96b37553ec5b2d", "score": "0.39197114", "text": "func (m *AccessPackageAssignmentReviewSettings) SetIsEnabled(value *bool)() {\n m.isEnabled = value\n}", "title": "" }, { "docid": "0b25cff4bbed4d2eaa2e672c170a3893", "score": "0.39153874", "text": "func (this *DirectLog) SetEnabled(enabled bool) {\n this.lock.Lock()\n defer this.lock.Unlock()\n\n this.enabled = enabled\n}", "title": "" }, { "docid": "48a87d215e0fc3ea73228ee3b33bb210", "score": "0.39144236", "text": "func (apic *APICache) SetLessFn(lessFn func(bi, bj *CachedBlock) bool) {\n\tapic.Lock()\n\tdefer apic.Unlock()\n\tapic.expireQueue.SetLessFn(lessFn)\n}", "title": "" }, { "docid": "df042628c949ab7f96fe5e3fedef7c98", "score": "0.3910733", "text": "func (nb *NodeBase) SetEnabledState(enabled bool) {\n\tnb.SetFlagState(!enabled, int(Disabled))\n}", "title": "" }, { "docid": "373ec3aa5433d20f76262990791cd3bf", "score": "0.39061937", "text": "func (m *CustomSecurityAttributeDefinition) SetUsePreDefinedValuesOnly(value *bool)() {\n err := m.GetBackingStore().Set(\"usePreDefinedValuesOnly\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e91727e5b4adde9bff925a05eeba766d", "score": "0.39043632", "text": "func (c *actionImp) SetEnabled(b bool) {\n\tc.Set(\"enabled\", b)\n}", "title": "" }, { "docid": "953f8967ff196d0acfeb94adccc9063b", "score": "0.38953933", "text": "func (s StatelessRule) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "8e462ae18d9f02fb6b6ec933bc872539", "score": "0.38854486", "text": "func (m *DeploymentState) SetEffectiveValue(value *DeploymentStateValue)() {\n err := m.GetBackingStore().Set(\"effectiveValue\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "5d9ff087ca56ac0ffdf724d98e4b0389", "score": "0.38835993", "text": "func (m *DeviceManagementSettings) SetSecureByDefault(value *bool)() {\n err := m.GetBackingStore().Set(\"secureByDefault\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "89fb30367965339d38e61a4fe804e8c1", "score": "0.38805208", "text": "func (s *DescribeRuleGroupMetadataOutput) SetStatefulRuleOptions(v *StatefulRuleOptions) *DescribeRuleGroupMetadataOutput {\n\ts.StatefulRuleOptions = v\n\treturn s\n}", "title": "" }, { "docid": "831adaf324f967729df17d39eef535bb", "score": "0.38747272", "text": "func (s *writeState) setRuleWritten(ruleName string) {\n\ts.writtenRules = append(s.writtenRules, ruleName)\n}", "title": "" }, { "docid": "30903e0783471797c951308b35679308", "score": "0.38700664", "text": "func ExampleWAFRegional_ListRules_shared00() {\n\tsvc := wafregional.New(session.New())\n\tinput := &waf.ListRulesInput{\n\t\tLimit: aws.Int64(100),\n\t}\n\n\tresult, err := svc.ListRules(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase wafregional.ErrCodeWAFInternalErrorException:\n\t\t\t\tfmt.Println(wafregional.ErrCodeWAFInternalErrorException, aerr.Error())\n\t\t\tcase wafregional.ErrCodeWAFInvalidAccountException:\n\t\t\t\tfmt.Println(wafregional.ErrCodeWAFInvalidAccountException, aerr.Error())\n\t\t\tdefault:\n\t\t\t\tfmt.Println(aerr.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t\t// Message from an error.\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tfmt.Println(result)\n}", "title": "" }, { "docid": "ef1e0a4dade694d98100ecfa073e5a61", "score": "0.3868585", "text": "func (e *endpoint) setEnabled(v bool) {\n\tif v {\n\t\te.enabled.Store(1)\n\t} else {\n\t\te.enabled.Store(0)\n\t}\n}", "title": "" }, { "docid": "1c84b99cddb3c2622a3fd654afc636d1", "score": "0.38671196", "text": "func (assistant *AssistantV2) MessageStateless(messageStatelessOptions *MessageStatelessOptions) (result *MessageResponseStateless, response *core.DetailedResponse, err error) {\n\treturn assistant.MessageStatelessWithContext(context.Background(), messageStatelessOptions)\n}", "title": "" }, { "docid": "86391136a08ce39a3effd353ef196240", "score": "0.38294065", "text": "func (m *WindowsFirewallNetworkProfile) SetPolicyRulesFromGroupPolicyMerged(value *bool)() {\n m.policyRulesFromGroupPolicyMerged = value\n}", "title": "" }, { "docid": "1cb8565da2ebf31ef36b017edb13af90", "score": "0.3826879", "text": "func (rule *NetworkSecurityGroupsSecurityRule) SetConditions(conditions conditions.Conditions) {\n\trule.Status.Conditions = conditions\n}", "title": "" }, { "docid": "656e4416a811a351ab20092922bd09a0", "score": "0.38261098", "text": "func SetPolicyEnabled(val string) {\n\tmutex.Lock()\n\tenablePolicy = val\n\tmutex.Unlock()\n}", "title": "" }, { "docid": "f01285905c84e6d286328049bc3962bd", "score": "0.3822852", "text": "func (storage DBStorage) EnableRuleSystemWide(\n\torgID types.OrgID,\n\truleID types.RuleID,\n\terrorKey types.ErrorKey,\n) error {\n\tlog.Info().Int(\"org_id\", int(orgID)).Msgf(\"re-enabling rule %v|%v\", ruleID, errorKey)\n\n\tconst query = `DELETE FROM rule_disable\n\t WHERE org_id = $1\n\t AND rule_id = $2\n\t AND error_key = $3\n\t `\n\n\t// try to execute the query and check for (any) error\n\t_, err := storage.connection.Exec(\n\t\tquery,\n\t\torgID,\n\t\truleID,\n\t\terrorKey,\n\t)\n\n\tif err != nil {\n\t\tconst msg = \"Error during execution SQL exec for system wide rule enable\"\n\t\tlog.Error().Err(err).Msg(msg)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0e5a103a59c77b0cc6dc1a0556872a98", "score": "0.38123792", "text": "func (m *FileSecurityProfile) SetMalwareStates(value []MalwareStateable)() {\n err := m.GetBackingStore().Set(\"malwareStates\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "bea378c7ed61955f934fbe92903ea879", "score": "0.37906164", "text": "func (m *CustomSecurityAttributeDefinition) SetAllowedValues(value []AllowedValueable)() {\n err := m.GetBackingStore().Set(\"allowedValues\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "de704bbd02a266fa378d60c41252c33c", "score": "0.37818632", "text": "func (c *RuleCache) Rules() *RuleSet {\n\tc.matcherLock.Lock()\n\tdefer c.matcherLock.Unlock()\n\tif !c.updating {\n\t\tnow := time.Now()\n\t\tif now.After(c.deadline) {\n\t\t\tc.updating = true\n\t\t\tgo func() {\n\t\t\t\tlog.Printf(\"updating\")\n\t\t\t\terr := c.update()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"update error: %s\\n\", err)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Printf(\"update succeeded, next one: %s\\n\",\n\t\t\t\t\t\tc.deadline.Format(time.RFC822))\n\t\t\t\t}\n\t\t\t\tc.matcherLock.Lock()\n\t\t\t\tc.updating = false\n\t\t\t\tc.matcherLock.Unlock()\n\t\t\t}()\n\t\t}\n\t}\n\treturn c.matcher\n}", "title": "" }, { "docid": "f35e187022ef9fb7f44973a53a428e32", "score": "0.37802514", "text": "func (s *UpdateCostCategoryDefinitionInput) SetRules(v []*CostCategoryRule) *UpdateCostCategoryDefinitionInput {\n\ts.Rules = v\n\treturn s\n}", "title": "" }, { "docid": "0b89d8fd30df7eabdf76fd615dc8ea9d", "score": "0.377904", "text": "func (ruleset *DnsForwardingRuleset) SetConditions(conditions conditions.Conditions) {\n\truleset.Status.Conditions = conditions\n}", "title": "" }, { "docid": "1a13f73efbca56341c8a8fba7f668e4d", "score": "0.37661445", "text": "func (s *CreateCostCategoryDefinitionInput) SetRules(v []*CostCategoryRule) *CreateCostCategoryDefinitionInput {\n\ts.Rules = v\n\treturn s\n}", "title": "" }, { "docid": "dad2c0dc99e888444ac2de35f34d5652", "score": "0.37648502", "text": "func New() *SecurityTradingRules {\n\tvar m SecurityTradingRules\n\treturn &m\n}", "title": "" }, { "docid": "a32cb8dfbd818319104f1bb6079c722d", "score": "0.37553212", "text": "func (m *SecurityAction) SetStates(value []SecurityActionStateable)() {\n err := m.GetBackingStore().Set(\"states\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "31a75f7c381d0586d0b7beeb63b5b6b6", "score": "0.3753722", "text": "func (m *AppliedConditionalAccessPolicy) SetEnforcedSessionControls(value []string)() {\n err := m.GetBackingStore().Set(\"enforcedSessionControls\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c5d6f51909e3b19970eb2b02ac4adb09", "score": "0.37455016", "text": "func (m *WindowsFirewallNetworkProfile) SetIncomingTrafficBlocked(value *bool)() {\n m.incomingTrafficBlocked = value\n}", "title": "" }, { "docid": "962e2acc7d8d22b4f11bc0718a59f5d7", "score": "0.37408194", "text": "func (s *CostCategory) SetRules(v []*CostCategoryRule) *CostCategory {\n\ts.Rules = v\n\treturn s\n}", "title": "" }, { "docid": "91d57464db48dd7354f6f78516947d7e", "score": "0.37354138", "text": "func (a *PricingRulesApiService) ResetPricingRulesExecute(r ApiResetPricingRulesRequest) (ApplyNewPricingRuleResponse, *_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 ApplyNewPricingRuleResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"PricingRulesApiService.ResetPricingRules\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/pricing-rules\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.pricingRule == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"pricingRule is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = r.pricingRule\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 == 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\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 422 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\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\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": "e3aec911a15fc3a463268396c1f6f97e", "score": "0.3735266", "text": "func (m *WindowsFirewallNetworkProfile) SetOutboundConnectionsBlocked(value *bool)() {\n m.outboundConnectionsBlocked = value\n}", "title": "" }, { "docid": "f9bc6285a7edb1358aa3bb66a37201f1", "score": "0.37217343", "text": "func (nb *NodeBase) SetEnabledStateUpdt(enabled bool) {\n\tcur := nb.IsEnabled()\n\tnb.SetFlagState(!enabled, int(Disabled))\n\tif enabled != cur {\n\t\tnb.UpdateSig()\n\t}\n}", "title": "" }, { "docid": "72b3b971cbbcfbd958986cba2fd947bc", "score": "0.37080634", "text": "func (s *GetBucketLifecycleConfigurationOutput) SetRules(v []*LifecycleRule) *GetBucketLifecycleConfigurationOutput {\n\ts.Rules = v\n\treturn s\n}", "title": "" }, { "docid": "fff4e3aabfcd6b17a0891ff0bcbe8a19", "score": "0.37079477", "text": "func (in *SystemRulesList) DeepCopy() *SystemRulesList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SystemRulesList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3dc746088ae23501e698f3349d36a980", "score": "0.37047094", "text": "func (in *TrafficAPIServerRules) DeepCopy() *TrafficAPIServerRules {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TrafficAPIServerRules)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "07567c83fd2b66d7a458618012f5752d", "score": "0.3704609", "text": "func newSLORuleJSON() *sloRuleJSON {\n\treturn &sloRuleJSON{\n\t\tAppliesToJSON: AppliesToJSON{Issues: true, PRs: false},\n\t\tComplianceSettingsJSON: ComplianceSettingsJSON{RequiresAssignee: false},\n\t}\n}", "title": "" }, { "docid": "73965aaf22f83b14ff92894d4348d579", "score": "0.37013388", "text": "func (mfd *Memfd) SetImmutable() error {\n\terr := mfd.SetSeals(SealAll)\n\tif err == nil {\n\t\treturn nil\n\t}\n\t// already immutable, will return EPERM\n\tif mfd.IsImmutable() {\n\t\treturn nil\n\t}\n\treturn err\n}", "title": "" }, { "docid": "b497d24657425181f58e4d4ef3d80dde", "score": "0.3699055", "text": "func (in *CircuitBreakerRulesList) DeepCopy() *CircuitBreakerRulesList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CircuitBreakerRulesList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d3f30ca6136235b156810836300853ac", "score": "0.36979964", "text": "func (rsl StateLoader) SetHardState(\n\tctx context.Context, batch engine.ReadWriter, st raftpb.HardState,\n) error {\n\treturn engine.MVCCPutProto(ctx, batch, nil,\n\t\trsl.RaftHardStateKey(), hlc.Timestamp{}, nil, &st)\n}", "title": "" }, { "docid": "ea7f86c69e43a10f18d9cb0ae098ea33", "score": "0.36977395", "text": "func (gtm *GitTrackMode) Set(s string) error {\n\tlowered := strings.ToLower(s)\n\tswitch lowered {\n\tcase \"disabled\":\n\t\t*gtm = false\n\t\treturn nil\n\tcase \"enabled\":\n\t\t*gtm = true\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid value %q for gittrack-mode; valid values are Disabled and Enabled\", s)\n\t}\n}", "title": "" }, { "docid": "a8d7dbb0c37677cf0b3504b6928fada8", "score": "0.36941534", "text": "func (m *PlannerCategoryDescriptions) SetCategory20(value *string)() {\n err := m.GetBackingStore().Set(\"category20\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "fabd8f487a4b4886f2e8112f7e52298c", "score": "0.36917728", "text": "func (s *State) SetFree(ordinal int32, value int32) {\n\ts.FreeCap = grow(s.FreeCap, ordinal, s.Capacity)\n\ts.FreeCap[int(ordinal)] = value\n}", "title": "" }, { "docid": "73940b8bca74414e4c04c62a492c6872", "score": "0.36884704", "text": "func (simple SimpleAction) SetEnabled(enabled bool) {\n\tC.g_simple_action_set_enabled(simple.native(), C.gboolean(util.Bool2Int(enabled)) /*go:.util*/)\n}", "title": "" }, { "docid": "f7ca865b211de71ba68ed434eb746089", "score": "0.36829817", "text": "func (m *EducationClass) SetAssignmentSettings(value EducationAssignmentSettingsable)() {\n m.assignmentSettings = value\n}", "title": "" }, { "docid": "38fff0a1f982d62132c007a722366554", "score": "0.36825022", "text": "func (c *Client) CreateSecurityRules(request *CreateSecurityRulesRequest) (response *CreateSecurityRulesResponse, err error) {\n if request == nil {\n request = NewCreateSecurityRulesRequest()\n }\n response = NewCreateSecurityRulesResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "383d049e7eb2d18e419c85b81cf55335", "score": "0.36812103", "text": "func (m *MockDataSeriesStore) SetSeriesEnabled(v0 context.Context, v1 string, v2 bool) error {\n\tr0 := m.SetSeriesEnabledFunc.nextHook()(v0, v1, v2)\n\tm.SetSeriesEnabledFunc.appendCall(DataSeriesStoreSetSeriesEnabledFuncCall{v0, v1, v2, r0})\n\treturn r0\n}", "title": "" }, { "docid": "ddca2a6b626e58e37bfbefeab9d729da", "score": "0.36805344", "text": "func (s *UpdateRuleGroupInput) SetRules(v string) *UpdateRuleGroupInput {\n\ts.Rules = &v\n\treturn s\n}", "title": "" }, { "docid": "6099e80511e3b1976b0318c2c28068d8", "score": "0.36745882", "text": "func (c *Chall) SetState(state uint32, role uint8) {\n\toldState := c.DispatchState\n\tmod := uint32(^(0xf << (4 * role)))\n\toldState = oldState & mod // all bit keep unchanged and bits you want update change to 0\n\tc.DispatchState = oldState + state<<(4*role)\n}", "title": "" }, { "docid": "b08796ecb77468a1ed72386ae7b35e16", "score": "0.36739987", "text": "func (in *IsolationRules) DeepCopy() *IsolationRules {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IsolationRules)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
c16178b2cb905e2b85f7f2e6317588db
Client returns attributes for a client network connection to address. See net.Dial for information about acceptable address values, address should be the same as the one used to create conn. If conn is nil, only network peer attributes will be returned that describe address. Otherwise, the socket level information about conn will also be included.
[ { "docid": "2869f849ef2fb98e59a524cd48013228", "score": "0.66661817", "text": "func Client(address string, conn net.Conn) []attribute.KeyValue {\n\treturn nc.Client(address, conn)\n}", "title": "" } ]
[ { "docid": "e707bf1c8bd98e7a5236eb9d3e771588", "score": "0.7388056", "text": "func (c *NetConv) Client(address string, conn net.Conn) []attribute.KeyValue {\n\tif conn == nil {\n\t\treturn c.Peer(address)\n\t}\n\n\tlAddr, rAddr := conn.LocalAddr(), conn.RemoteAddr()\n\n\tvar network string\n\tswitch {\n\tcase lAddr != nil:\n\t\tnetwork = lAddr.Network()\n\tcase rAddr != nil:\n\t\tnetwork = rAddr.Network()\n\tdefault:\n\t\treturn c.Peer(address)\n\t}\n\n\tpeerName, peerPort := splitHostPort(address)\n\tvar (\n\t\tsockFamily string\n\t\tsockPeerAddr string\n\t\tsockPeerPort int\n\t\tsockHostAddr string\n\t\tsockHostPort int\n\t)\n\n\tif lAddr != nil {\n\t\tsockHostAddr, sockHostPort = splitHostPort(lAddr.String())\n\t}\n\n\tif rAddr != nil {\n\t\tsockPeerAddr, sockPeerPort = splitHostPort(rAddr.String())\n\t}\n\n\tswitch {\n\tcase sockHostAddr != \"\":\n\t\tsockFamily = family(network, sockHostAddr)\n\tcase sockPeerAddr != \"\":\n\t\tsockFamily = family(network, sockPeerAddr)\n\t}\n\n\tn := nonZeroStr(peerName, network, sockPeerAddr, sockHostAddr, sockFamily)\n\tn += positiveInt(peerPort, sockPeerPort, sockHostPort)\n\tattr := make([]attribute.KeyValue, 0, n)\n\tif peerName != \"\" {\n\t\tattr = append(attr, c.PeerName(peerName))\n\t\tif peerPort > 0 {\n\t\t\t// Only if net.peer.name is set should net.peer.port be.\n\t\t\tattr = append(attr, c.PeerPort(peerPort))\n\t\t}\n\t}\n\tif network != \"\" {\n\t\tattr = append(attr, c.Transport(network))\n\t}\n\tif sockFamily != \"\" {\n\t\tattr = append(attr, c.NetSockFamilyKey.String(sockFamily))\n\t}\n\tif sockPeerAddr != \"\" {\n\t\tattr = append(attr, c.NetSockPeerAddrKey.String(sockPeerAddr))\n\t\tif sockPeerPort > 0 {\n\t\t\t// Only if net.sock.peer.addr is set should net.sock.peer.port be.\n\t\t\tattr = append(attr, c.NetSockPeerPortKey.Int(sockPeerPort))\n\t\t}\n\t}\n\tif sockHostAddr != \"\" {\n\t\tattr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr))\n\t\tif sockHostPort > 0 {\n\t\t\t// Only if net.sock.host.addr is set should net.sock.host.port be.\n\t\t\tattr = append(attr, c.NetSockHostPortKey.Int(sockHostPort))\n\t\t}\n\t}\n\treturn attr\n}", "title": "" }, { "docid": "8e3ec55d8b7e07c31666ffb03cbbaff7", "score": "0.595657", "text": "func (c *Client) Address() string {\n\treturn c.conn.Address()\n}", "title": "" }, { "docid": "96eab101b4a311567e9f45cb5a590c71", "score": "0.5790573", "text": "func (c *client) Address() string {\n\treturn c.address\n}", "title": "" }, { "docid": "a8557bfdb94e36b7a6db04e1a988d0d8", "score": "0.57716584", "text": "func (b *ClientAdaptor) Address() string { return b.address }", "title": "" }, { "docid": "5bdd2e93fcc3ec2e5e15739784f722be", "score": "0.57003504", "text": "func Client(conn net.Conn, config *Config) *Conn {\n\treturn &Conn{conn: conn, config: config, isClient: true}\n}", "title": "" }, { "docid": "8aff5ded42ecfa8a852086cdab312937", "score": "0.5676135", "text": "func (c connection) GetAddress() mynet.Address {\n\treturn c.address\n}", "title": "" }, { "docid": "382cea74039c94f877648e43eadbf11f", "score": "0.5663778", "text": "func (t *TrudyPipe) ClientInfo() (addr net.Addr) {\n\taddr = t.clientConn.RemoteAddr()\n\treturn\n}", "title": "" }, { "docid": "3800155a2f40f0683a633ed94953eea5", "score": "0.558393", "text": "func (c *Client) Address() string {\n\treturn c.config.Address\n}", "title": "" }, { "docid": "b248076f8f832ff31aa33ed606af1457", "score": "0.5490825", "text": "func (c *Client) Addr() string {\n\treturn c.addr\n}", "title": "" }, { "docid": "af8e046caf91403b790c958272547818", "score": "0.53769153", "text": "func (c *ReplicaClient) GetAddress() string {\n\treturn c.address\n}", "title": "" }, { "docid": "b895759f91a6a96a034ca14fd56fa0c4", "score": "0.5183984", "text": "func (addr *Address) Network() string { return \"tcp\" }", "title": "" }, { "docid": "4b8fe16370619165b57f5eae5f6e7a44", "score": "0.5170916", "text": "func (c *Client) Address() string {\n\tc.modifyLock.RLock()\n\tdefer c.modifyLock.RUnlock()\n\n\treturn c.addr.String()\n}", "title": "" }, { "docid": "5248d069a2eed888d6293a2e94928e07", "score": "0.5155615", "text": "func (c *Client) GetAddress() (addrType, address string) {\n\treturn c.addrType, c.dbServer\n}", "title": "" }, { "docid": "4f7f947076f9973593f68b640da1c56e", "score": "0.5129692", "text": "func GetClientConnection(address string) (*grpc.ClientConn, error){\n\tconn, err := grpc.Dial(address, grpc.WithInsecure())\n\tif err != nil {\n\t\tlog.Fatalf(\"could not connect to %s \", err)\n\t}\n\n\treturn conn, err\n}", "title": "" }, { "docid": "44018ff094fea8aa5a9d9574568ecb13", "score": "0.50802606", "text": "func (auth *AuthManager) conn(conn comms.Link) *clientInfo {\n\tauth.connMtx.RLock()\n\tdefer auth.connMtx.RUnlock()\n\treturn auth.conns[conn.ID()]\n}", "title": "" }, { "docid": "ce4cc453a74156dc10fa36b7a8cf1092", "score": "0.5054134", "text": "func (c *ChannelsCreateChannelRequest) GetAddress() (value string, ok bool) {\n\tif !c.Flags.Has(2) {\n\t\treturn value, false\n\t}\n\treturn c.Address, true\n}", "title": "" }, { "docid": "16a4e19d2e938e71d59ffc2941d99854", "score": "0.5028963", "text": "func (c *Client) String() string {\n\treturn c.addr\n}", "title": "" }, { "docid": "21af5fc551f02a3d4770673b794571d0", "score": "0.50063026", "text": "func (c *Connection) Addr() string {\n\treturn c.Conn.RemoteAddr().String()\n}", "title": "" }, { "docid": "a14bd60418adb9e43704d61e035813a2", "score": "0.5004924", "text": "func (networkClient NetworkClient) IpAddress() net.IP {\n\treturn networkClient.ipAddress\n}", "title": "" }, { "docid": "96602779512037445a6742ea90798dcb", "score": "0.49846748", "text": "func (t *TrudyPipe) ClientConn() net.Conn {\n\treturn t.clientConn\n}", "title": "" }, { "docid": "ba0757601c88729df7c25ffa6d113969", "score": "0.49749672", "text": "func ClientConnect(addr string) (MiningConn, error) {\n\tminingConn := MiningConn{}\n\n\tDebug.Printf(\"Client connecting to %s\\n\", addr)\n\n\tconn, err := net.Dial(\"tcp\", addr)\n\tif err != nil {\n\t\treturn miningConn, err\n\t}\n\n\tminingConn.Conn = conn\n\tminingConn.Enc = gob.NewEncoder(conn)\n\tminingConn.Dec = gob.NewDecoder(conn)\n\n\t// Send ClientHello Message\n\tSendMsg(miningConn, ClientHelloMsg())\n\n\treturn miningConn, nil\n}", "title": "" }, { "docid": "82cfdcdb02ebc5bd2d9ab3ca8193f34a", "score": "0.4961892", "text": "func (c *Client) Addr() net.Addr {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\treturn c.addr\n}", "title": "" }, { "docid": "0456aef60c12621be2621bc3bf19d3cb", "score": "0.49447638", "text": "func TestDial(network, address string) (*Client, error) {\n conn, err := net.Dial(network, address)\n if err != nil {\n return nil, err\n }\n return NewTestClient(conn), nil\n}", "title": "" }, { "docid": "691ab999d711fb39a4f8ec12b9fef52b", "score": "0.4927424", "text": "func (m *MockUDPClient) ClientAddr() *net.UDPAddr {\n\treturn m.conn.LocalAddr().(*net.UDPAddr)\n}", "title": "" }, { "docid": "374422629268c2bb92b8ffed43dbeeb7", "score": "0.49026483", "text": "func (t DNSOverTCP) Address() string {\n\treturn t.address\n}", "title": "" }, { "docid": "efce5c1893237c3904be38379b54f9fd", "score": "0.48886433", "text": "func Client(conn net.Conn, ctx *Ctx) (*Conn, error) {\n\tc, err := newConn(conn, ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tC.SSL_set_connect_state(c.ssl)\n\treturn c, nil\n}", "title": "" }, { "docid": "f892a58f60b0d43403a146667bd4094b", "score": "0.486052", "text": "func getClientConnection(addresse string) *grpc.ClientConn {\n\tvar err error\n\tvar cc *grpc.ClientConn\n\tif cc == nil {\n\t\tcc, err = grpc.Dial(addresse, grpc.WithInsecure())\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"could not connect: %v\", err)\n\t\t}\n\t}\n\treturn cc\n}", "title": "" }, { "docid": "c67ac364a2f30af12de017526fae6c11", "score": "0.48425347", "text": "func Client(conn net.Conn, config *tls.Config,) *tls.Conn", "title": "" }, { "docid": "a249520c04c914de4eaac905ff1cedfa", "score": "0.4839493", "text": "func (c *Client) String() string {\n\treturn c.addr.String()\n}", "title": "" }, { "docid": "eab82a662aee41cd0b41d77fb1dd9abd", "score": "0.48380336", "text": "func printClientConnInfo() {\n addrs, err := net.InterfaceAddrs()\n if err != nil {\n log.Fatal(err)\n return\n }\n\n fmt.Println(\"clients can connect at the following addresses:\")\n for _, a := range addrs {\n if a.String() != \"0.0.0.0\" {\n fmt.Println(\"http://\" + a.String() + \":8000/\\n\")\n }\n }\n}", "title": "" }, { "docid": "1624eb4f36e278749423ab63994c4b95", "score": "0.48250774", "text": "func Client(client net.Addr) Option {\n\treturn func(o *options) {\n\t\to.client = client\n\t}\n}", "title": "" }, { "docid": "3ac782adc9249f0a476184013feed80e", "score": "0.48157397", "text": "func (c *ClusterConnectionInfoResolver) IPAddress() string {\n\treturn c.ipAddress\n}", "title": "" }, { "docid": "4eeff9d1717d56fe7fc95b8b984ee245", "score": "0.4812716", "text": "func (c *Client) Conn() net.Conn {\n\treturn c.conn\n}", "title": "" }, { "docid": "63626c0df20289f312ffdf84d862bdf9", "score": "0.4809334", "text": "func DialRead(address string) (*ConnClient, error) {\n\treturn DefaultDialer.DialRead(address)\n}", "title": "" }, { "docid": "9741d5c3061177de3052073872dbcd40", "score": "0.4796002", "text": "func (fa TestAddr) Network() string { return fa.Addr }", "title": "" }, { "docid": "cf24b520a074d65fa4977c9ed5c64de7", "score": "0.47913486", "text": "func (t transporter) GetLeaderClientAddress() string {\n\tresp, _ := t.Get(raftServer.Leader() + \"/client\")\n\tif resp != nil {\n\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\tresp.Body.Close()\n\t\treturn string(body)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e49c6da44645eab553f54483ca978918", "score": "0.47833905", "text": "func getClientConnection() *grpc.ClientConn {\n\tvar err error\n\tvar cc *grpc.ClientConn\n\tif cc == nil {\n\t\tcc, err = grpc.Dial(addresse, grpc.WithInsecure())\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"could not connect: %v\", err)\n\t\t}\n\t}\n\treturn cc\n}", "title": "" }, { "docid": "ced2b6a4c3794d082711ad70bbcb678a", "score": "0.47794616", "text": "func getClientConnection() *grpc.ClientConn {\n\tvar err error\n\tvar cc *grpc.ClientConn\n\tif cc == nil {\n\t\tcc, err = grpc.Dial(addresse, grpc.WithInsecure())\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"could not connect: %v\", err)\n\t\t}\n\n\t}\n\treturn cc\n}", "title": "" }, { "docid": "10d103aac9098ec9178ab015a3fbe8df", "score": "0.47737813", "text": "func (c *Client) ClientDetails(site string, mac string) (*GenericResponse, error) {\n\tif mac == \"\" {\n\t\treturn nil, fmt.Errorf(\"must specify a client MAC\")\n\t}\n\n\tvar resp GenericResponse\n\terr := c.doSiteRequest(http.MethodGet, site, fmt.Sprintf(\"stat/user/%s\", strings.ToLower(mac)), nil, &resp)\n\treturn &resp, err\n}", "title": "" }, { "docid": "ce9bbaf5b2959f3f28e14fd89ca6be12", "score": "0.47731885", "text": "func (a *TCPAddr) Network() string { return \"tcp\" }", "title": "" }, { "docid": "4e954a09b74de93bb57138cc644c521e", "score": "0.47671038", "text": "func Dial(network, address string, opts ...*Option) (client *Client, err error) {\n\topt, err := parseOptions(opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconn, err := net.Dial(network, address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// close the connection if client is nil\n\tdefer func() {\n\t\tif client == nil {\n\t\t\t_ = conn.Close()\n\t\t}\n\t}()\n\treturn NewClient(conn, opt)\n}", "title": "" }, { "docid": "3c9b53a6000bfe55415d6a57783b4b63", "score": "0.47581115", "text": "func GetClientInfo(clid string) ts3.Command {\n\treturn ts3.Command{\n\t\tCommand: \"clientinfo\",\n\t\tParams: map[string][]string{\n\t\t\t\"clid\": []string{clid},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "dc1ade530552284f6d95dcee99280238", "score": "0.47544357", "text": "func (a Addr) Network() string {\n\treturn a.network\n}", "title": "" }, { "docid": "b8d35a9b3cc9ebdffde068b3734b3ed1", "score": "0.4748414", "text": "func (client *Client) connect(connType string) net.Conn {\n\tconn, err := net.Dial(connType, client.ipAddr+\":\"+client.port)\n\tif err != nil {\n\t\tlog.Fatal(\"Error during the connection :\", err)\n\t}\n\treturn conn\n}", "title": "" }, { "docid": "33fd2281d6f0f6d7d5cdc137107389d9", "score": "0.47083113", "text": "func Client(c net.Conn, config *ClientConfig) (*ClientConn, error) {\n\tconn := &ClientConn{\n\t\ttransport: newTransport(c, config.rand()),\n\t\tconfig: config,\n\t}\n\tif err := conn.handshake(); err != nil {\n\t\tconn.Close()\n\t\treturn nil, err\n\t}\n\tgo conn.mainLoop()\n\treturn conn, nil\n}", "title": "" }, { "docid": "bc18f372283f1b1dcad53776fcbf65d5", "score": "0.47057125", "text": "func NewClient(address string) (retClient protocol.MessageReadWriteCloser, err error) {\n\tpool := x509.NewCertPool()\n\tca, err := Asset(\"self-signed-ca.cert\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpool.AppendCertsFromPEM(ca)\n\n\ttlsConf := &tls.Config{\n\t\tRootCAs: pool,\n\t\t// Hologram only uses TLS to ensure the credentials that go across the wire are kept secret, and since go uses\n\t\t// ECDHE by default, we actually don't care about leaking keys or authenticating either end of the connection.\n\t\tInsecureSkipVerify: true,\n\t}\n\n\tsocket, err := tls.Dial(\"tcp\", address, tlsConf)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tretClient = protocol.NewMessageConnection(socket)\n\treturn\n}", "title": "" }, { "docid": "c9ed7ba6b85104d17fe376a7fc6a5b4c", "score": "0.46919644", "text": "func Dial(address string) (c *Client, err error) {\n\tconn, err := net.Dial(\"tcp\", address)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn NewClient(conn)\n}", "title": "" }, { "docid": "065c6a395bfe6db0a2a26a2d21236acf", "score": "0.46843538", "text": "func Dial(network, address string) (*Client, error) {\n\tconn, err := net.Dial(network, address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewClient(conn)\n}", "title": "" }, { "docid": "e80eaae0c18e70a32d7e2c1b4b7e2816", "score": "0.4683814", "text": "func conn(ctx context.Context) *jsonrpc2.Conn { return ctx.Value(connKey{}).(*jsonrpc2.Conn) }", "title": "" }, { "docid": "96df82c5d018e5ff0e84b2f7f943ae18", "score": "0.4663157", "text": "func dial(address string) (net.Conn, error) {\n\treturn &connection{}, nil\n}", "title": "" }, { "docid": "c6626987a7747faefd402d29d9971bcb", "score": "0.465386", "text": "func Dial(address string, options ...func(*AMIClient)) (*AMIClient, error) {\n\tclient := &AMIClient{\n\t\taddress: address,\n\t\tamiUser: \"\",\n\t\tamiPass: \"\",\n\t\tmutexAsyncAction: new(sync.RWMutex),\n\t\twaitNewConnection: make(chan struct{}),\n\t\tresponse: make(map[string]chan *AMIResponse),\n\t\tEvents: make(chan *AMIEvent, 100),\n\t\tError: make(chan error, 1),\n\t\tNetError: make(chan error, 1),\n\t\tuseTLS: false,\n\t\tunsecureTLS: false,\n\t\ttlsConfig: new(tls.Config),\n\t}\n\tfor _, op := range options {\n\t\top(client)\n\t}\n\terr := client.NewConn()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "50738e833603b1079f029ee239c2df38", "score": "0.465317", "text": "func (i *InputClientProxy) GetAddress() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.Address\n}", "title": "" }, { "docid": "2320b4638024cb0e9134042c7d46a973", "score": "0.46498138", "text": "func (c ConnInfo) String() string {\n\tswitch c.Type {\n\tcase TCP:\n\t\treturn c.TCPAddr.String()\n\tdefault:\n\t\tlog.Warn(\"Unsupported network address\", \"typeCode\", c.Type)\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "274a1ad4041506a61ad77371e5f298d3", "score": "0.46398342", "text": "func (p Profile) Address() *attribute.StringAttribute {\n\treturn p.GetStringAttribute(AttrConstAddress)\n}", "title": "" }, { "docid": "fd5fdb278c481805b3fba7b13b3cb3a5", "score": "0.46317905", "text": "func getClientIP(ctx context.Context) string {\n\t/* method 1: using peer package get ip address */\n\t// get tcpAddrn w/o port\n\t// tcpAddr, ok := pr.Addr.(*net.TCPAddr)\n\t// addr = tcpAddr.IP.String()\n\tvar addr string\n\tif pr, ok := peer.FromContext(ctx); ok {\n\t\taddr = pr.Addr.String()\n\t}\n\treturn addr\n\n\t/* method 2: replace [::1] to 127.0.0.1 */\n\t// if client and server at the same machine, it will return [::1]:port\n\t// https://razil.cc/post/2018/09/go-grpc-get-requestaddr/\n\t// pr, ok := peer.FromContext(ctx)\n\t// if !ok {\n\t// \treturn \"\", fmt.Errorf(\"[getClinetIP] invoke FromContext() failed\")\n\t// }\n\t// if pr.Addr == net.Addr(nil) {\n\t// \treturn \"\", fmt.Errorf(\"[getClientIP] peer.Addr is nil\")\n\t// }\n\n\t// addSlice := strings.Split(pr.Addr.String(), \":\")\n\t// if addSlice[0] == \"[\" {\n\t// \treturn \"127.0.0.1\"\n\t// }\n\t// return addSlice[0]\n\n\t/* method 3: use metadata get IP address : localhost:50051 */\n\t// https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md\n\t// md, _ := metadata.FromIncomingContext(ctx)\n\t// fmt.Println(\"md[:authority]\", md[\":authority\"][0])\n\t// return md[\":authority\"][0]\n}", "title": "" }, { "docid": "b4e94568e8ee8e8e5fd6389e55332f9e", "score": "0.46271548", "text": "func (c *Config) Client() (*Conn, error) {\n\tcf := singularity.NewConfig().\n\t\tSetHost(c.Host).\n\t\tSetPort(c.Port).\n\t\tSetRetry(c.Retry).\n\t\tBuild()\n\n\tclient := singularity.NewClient(cf)\n\n\treturn &Conn{\n\t\tsclient: client,\n\t}, nil\n}", "title": "" }, { "docid": "e1e764d034c170fb1cb09560c5247ba6", "score": "0.46269828", "text": "func (d *InfoOutput) ClientOptions() map[string]any {\n\tval := d.reply[\"client_options\"]\n\n\treturn val.(map[string]any)\n\n}", "title": "" }, { "docid": "00aca9adc2a457fcf199d9417f70ca19", "score": "0.46178293", "text": "func OptClientLinkLayerAddress(ht iana.HWType, lla net.HardwareAddr) *optClientLinkLayerAddress {\n\treturn &optClientLinkLayerAddress{LinkLayerType: ht, LinkLayerAddress: lla}\n}", "title": "" }, { "docid": "5c67f91179c64fa0cd5a94a1da325c8f", "score": "0.46162394", "text": "func (s *Socks5) clientConnect(conn net.Conn, addr Addr) error {\n\tdebugForward(conn, addr)\n\n\treqLen := 4 + len(addr.Host) + 2\n\tif addr.Type == ADDR_DOMAIN_NAME {\n\t\treqLen++\n\t}\n\treq := make([]byte, reqLen, _MAX_CONNECT_DATA_LEN)\n\treq[0] = SOCKS_VER\n\treq[1] = CMD_CONNECT\n\treq[2] = 0x00\n\treq[3] = addr.Type\n\tif addr.Type == ADDR_DOMAIN_NAME {\n\t\treq[4] = byte(len(addr.Host))\n\t}\n\tcopy(req[reqLen-2-len(addr.Host):], addr.Host)\n\tbinary.BigEndian.PutUint16(req[reqLen-2:], addr.Port)\n\n\t_, err := conn.Write(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq = req[:_MAX_CONNECT_DATA_LEN]\n\tn, err := io.ReadAtLeast(conn, req, 5)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif req[0] != SOCKS_VER {\n\t\treturn ErrUnsupportedSocksVersion\n\t}\n\tif req[1] != 0x00 {\n\t\treturn replyError(req[1])\n\t}\n\tswitch req[3] {\n\tcase ADDR_IPV4:\n\t\treq = req[n : 4+net.IPv4len+2]\n\tcase ADDR_IPV6:\n\t\treq = req[n : 4+net.IPv6len+2]\n\tcase ADDR_DOMAIN_NAME:\n\t\treq = req[n : 5+int(req[4])+2]\n\tdefault:\n\t\treturn errors.New(\"invalid response format\")\n\t}\n\t_, err = io.ReadFull(conn, req)\n\treturn err\n}", "title": "" }, { "docid": "65f66fdcbd4bd15caac6b30325078387", "score": "0.46051416", "text": "func (a *Address) GetConnection() (proto.BrunoCoinClient, *grpc.ClientConn, error) {\n\tcc, err := connectToServer(a.Addr)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn proto.NewBrunoCoinClient(cc), cc, err\n}", "title": "" }, { "docid": "98386a89ee59e6bc8e64ddc4744dc5ca", "score": "0.46031213", "text": "func (t *DNSOverTCPTransport) Address() string {\n\treturn t.address\n}", "title": "" }, { "docid": "c335b3b9ac50ecc443f3f05a04f53a79", "score": "0.45983478", "text": "func (a *Addr) Network() string {\n\treturn a.NetworkStr\n}", "title": "" }, { "docid": "245fbc498d96542b4fff0aa8dbe8464b", "score": "0.45930412", "text": "func (c *connAttrs) Host() string { c.mu.RLock(); defer c.mu.RUnlock(); return c._host }", "title": "" }, { "docid": "6dff58bcaff9e460daa7764977094deb", "score": "0.45901555", "text": "func (s *LEAdvertisement1) Conn() *dbus.Conn {\n\treturn s.config.conn\n}", "title": "" }, { "docid": "32cbfd15fa86bc98a2e26367bb484406", "score": "0.45820457", "text": "func (n *Node) GetClient() *avalanchegoclient.Client {\n\treturn n.client\n}", "title": "" }, { "docid": "ad3496c4d2c3f966fb9c69a7574d38bc", "score": "0.45716617", "text": "func Dial(network, addr string) (*Client, error) {\n\tpc, err := proto.Dial(Proto(), network, addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{Client: pc}, nil\n}", "title": "" }, { "docid": "26d8e457105ad2b9e1a799988c0e30b7", "score": "0.45674032", "text": "func getClientConnection() *grpc.ClientConn {\n\tvar err error\n\tvar cc *grpc.ClientConn\n\tif cc == nil {\n\t\tcc, err = grpc.Dial(\"localhost:10003\", grpc.WithInsecure())\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"could not connect: %v\", err)\n\t\t}\n\n\t}\n\treturn cc\n}", "title": "" }, { "docid": "970cc9ca740358078ec214024f1f70eb", "score": "0.45668247", "text": "func (bridge *BridgeContract) GetContractAdress() common.Address {\n\treturn bridge.networkConfig.ContractAddress\n}", "title": "" }, { "docid": "aadb4bf0565dbc1d62d5fd73714d07d3", "score": "0.4565766", "text": "func ClientInfo(message string) string {\n\treturn Encode(CLIENTINFO, message)\n}", "title": "" }, { "docid": "f9aeb2aa8e1b41c9668e2056ed52a958", "score": "0.45648953", "text": "func (m AddressMutation) Client() *Client {\n\tclient := &Client{config: m.config}\n\tclient.init()\n\treturn client\n}", "title": "" }, { "docid": "b5b06a2040f3481c29340726b3968027", "score": "0.4564135", "text": "func (r *RPCClientTCP) Address() (address string, err error) {\n\terr = r.r.c.Call(\"tcp.Address\", struct{}{}, &address)\n\treturn\n}", "title": "" }, { "docid": "b6878b003cf18f9a42b507a912e52bd2", "score": "0.4563009", "text": "func (lu *litUiClient) Address() (string, error) {\n\n\t// cointype of 0 means default, not mainnet.\n\t// this is ugly but does prevent mainnet use for now.\n\n\tvar cointype, numadrs uint32\n\n\t// if no arguments given, generate 1 new address.\n\t// if no cointype given, assume type 1 (testnet)\n\n\tnumadrs = 0\n\n\treply := new(litrpc.AddressReply)\n\n\targs := new(litrpc.AddressArgs)\n\targs.CoinType = cointype\n\targs.NumToMake = numadrs\n\n\tfmt.Printf(\"adr cointye: %d num:%d\\n\", args.CoinType, args.NumToMake)\n\terr := lu.rpccon.Call(\"LitRPC.Address\", args, reply)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tresponse := reply.WitAddresses[len(reply.WitAddresses)-1]\n\treturn response, nil\n}", "title": "" }, { "docid": "a035bd42b481a069299ac0e6cc12a6a2", "score": "0.456148", "text": "func (addr *Addr) Network() string { return \"websocket\" }", "title": "" }, { "docid": "9696bc7bcbf3b633b8fccbb4ffc0224a", "score": "0.4561339", "text": "func (mock *CloudMock) ClientConn() *grpc.ClientConn {\n\treturn mock.conn\n}", "title": "" }, { "docid": "d5fe3c5de86553aba0833ed11de3096e", "score": "0.45552066", "text": "func (r *ProviderRegister) GetNetworkInfoClient() string {\n\treturn r.NetworkInfoClient\n}", "title": "" }, { "docid": "d477b47b8f30e0b517b19da4703db5f1", "score": "0.45518363", "text": "func NewClient(address string) (*Client, error) {\n\tconn, err := net.Dial(\"tcp\", address)\n\tif err != nil {\n\t\treturn nil, nil\n\t}\n\treturn &Client{connection: conn}, nil\n}", "title": "" }, { "docid": "a5149d7c10acf6175d4c8def77259808", "score": "0.45510387", "text": "func (networkClient NetworkClient) ClientName() string {\n\treturn networkClient.clientName\n}", "title": "" }, { "docid": "90a68e4ba57d22d62acd3702a03c1e54", "score": "0.45455393", "text": "func (o TestMatrixOutput) ClientInfo() ClientInfoResponseOutput {\n\treturn o.ApplyT(func(v *TestMatrix) ClientInfoResponseOutput { return v.ClientInfo }).(ClientInfoResponseOutput)\n}", "title": "" }, { "docid": "dc6989a2836e133b7c2abf38acafb2d1", "score": "0.45365015", "text": "func (c *Client) Network() NetworkType {\n\treturn c.network\n}", "title": "" }, { "docid": "0fca169e851d8ad4a14d22cb6fbd071d", "score": "0.45341957", "text": "func (c *Client) Conn() *grpc.ClientConn {\n\treturn c.conn\n}", "title": "" }, { "docid": "0fca169e851d8ad4a14d22cb6fbd071d", "score": "0.45341957", "text": "func (c *Client) Conn() *grpc.ClientConn {\n\treturn c.conn\n}", "title": "" }, { "docid": "1faa7cf0e04c6a9eb2d6d73311ebdd28", "score": "0.4533554", "text": "func newClient(address string) (c *client, err error) {\n\tif address, err = Host(address); err != nil {\n\t\treturn\n\t}\n\tc = new(client)\n\tif c.client, err = rpc.Dial(\"tcp\", address); err != nil {\n\t\treturn nil, err\n\t}\n\tc.address = address\n\treturn\n}", "title": "" }, { "docid": "e6510fe842c9c190b782abab12b6ea7c", "score": "0.4532468", "text": "func (c *INDIClient) Connect(network, address string) error {\n\tconn, err := c.dialer.Dial(network, address)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Clear out all devices\n\tc.delProperty(&DelProperty{})\n\n\tc.conn = conn\n\n\tc.read = make(chan interface{}, c.bufferSize)\n\tc.write = make(chan interface{}, c.bufferSize)\n\n\tc.startRead()\n\tc.startWrite()\n\n\treturn nil\n}", "title": "" }, { "docid": "a8da37f89ec72dc9a07e17d9c8ad2e45", "score": "0.45318723", "text": "func (c *Client) AccountInfo(listenKey string) (*AccountInfo, error) {\n\tvar b strings.Builder\n\tb.WriteString(baseWS)\n\tb.WriteString(listenKey)\n\tconn, err := fastws.Dial(b.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconn.ReadTimeout = 0\n\treturn &AccountInfo{wsClient{conn: conn}}, nil\n}", "title": "" }, { "docid": "8b13a79d99acbe61e8151a910401459e", "score": "0.4529697", "text": "func (m *Settings_ConsulConfiguration) GetAddress() string {\n\tif m != nil {\n\t\treturn m.Address\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "f05b2944ca02fb2d64da5bbed0ec570b", "score": "0.4509584", "text": "func (o *NetworkingProjectNetworkCreate) GetAddress() string {\n\tif o == nil || o.Address == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Address\n}", "title": "" }, { "docid": "9513c0a0d62eafc7bc61cb9d42250f72", "score": "0.45084134", "text": "func ClientMode(host string, roomID int) {\n\tconn, err := net.Dial(\"tcp\", host)\n\tdefer conn.Close()\n\tcheckError(err)\n\tlog.Println(\"Client connect on\", host)\n\n\tclient := &Client{\n\t\tRoomID: roomID,\n\t\tConn: conn,\n\t}\n\n\t// Prepare, send roomID to server\n\tclient.prepare()\n\n\t// Goroutine to receive message\n\tgo client.receive()\n\n\t// Ready to send message\n\treader := bufio.NewReader(os.Stdin)\n\tfor {\n\t\tmsg, err := reader.ReadString('\\n')\n\t\tcheckError(err)\n\t\t_, err = client.Conn.Write([]byte(msg))\n\t\tcheckError(err)\n\t}\n}", "title": "" }, { "docid": "c9194b6dabaaad1bd7e8a097837c0f34", "score": "0.45004708", "text": "func (p *peer) Addr() net.Addr {\r\n\treturn p.peerConn.conn.RemoteAddr()\r\n}", "title": "" }, { "docid": "51b62776334f87db271e3aa099e95800", "score": "0.44903657", "text": "func formatClientInformation(req *http.Request) *webConfig {\n\t// Get the cient ip\n\tip, port, _ := net.SplitHostPort(req.RemoteAddr)\n\n\tconfig := new(webConfig)\n\tconfig.Ip = ip\n\tconfig.Host = req.Host\n\tconfig.Port = port\n\tconfig.Method = req.Method\n\tconfig.Language = req.Header.Get(\"Accept-Language\")\n\tconfig.UserAgent = req.Header.Get(\"User-Agent\")\n\tconfig.XForwardedFor = req.Header.Get(\"X-Forwarded-For\")\n\n\treturn config\n}", "title": "" }, { "docid": "72fb7c1c1282e3946ed165cd0e7d39d1", "score": "0.44889107", "text": "func (s *SocksAdapter) Conn() net.Conn {\n\treturn s.conn\n}", "title": "" }, { "docid": "03da3834e22944f567736c9db8a22488", "score": "0.44826892", "text": "func (networkClient NetworkClient) String() string {\n\tname := networkClient.ClientName()\n\tif len(name) == 0 {\n\t\tname = \"\\\"\\\"\"\n\t}\n\treturn \"Name:\" + name + \"; Address:\" + networkClient.IpAddress().String()\n}", "title": "" }, { "docid": "75d30eba31df65104511a14e647d2595", "score": "0.4480133", "text": "func establishConnection(addr string) (net.Conn, error) {\n\treturn net.Dial(\"tcp\", addr)\n}", "title": "" }, { "docid": "48329967b37a06a27373795a53635741", "score": "0.44724455", "text": "func GetAddressFromCtx(ctx context.Context) (string, bool) {\n\tpr, ok := peer.FromContext(ctx)\n\tif !ok {\n\t\treturn \"\", false\n\t}\n\n\tif pr.Addr == net.Addr(nil) {\n\t\treturn \"\", false\n\t}\n\n\treturn pr.Addr.String(), true\n}", "title": "" }, { "docid": "fc16f5ff24135f0f6cc86afb955fb1f8", "score": "0.44657427", "text": "func (web *webConfig) SocketAddress() string {\n\treturn fmt.Sprintf(\"%s:%d\", web.Address, web.Port)\n}", "title": "" }, { "docid": "4cf8625e42175bd5c917dd53e0272e2c", "score": "0.44624236", "text": "func (n *natsBroker) Address() string {\n\treturn n.options.Address\n}", "title": "" }, { "docid": "f9760f1fe1a989c41c1edef5b4e8a75e", "score": "0.44607925", "text": "func (s *SocksAdapter) Addr() *C.Addr {\n\treturn s.addr\n}", "title": "" }, { "docid": "8b1ce59ddf70360a06a817b414d76cd6", "score": "0.44589996", "text": "func (c VaultConfig) GetAddress() string {\n\treturn c.Address\n}", "title": "" }, { "docid": "a5f2eb3fc9e20730b38938cc27630649", "score": "0.4455074", "text": "func (client *Client) RemoteAddress() string {\n\treturn client.address\n}", "title": "" }, { "docid": "8a683702f4b6efdbf0070215b1ce79d9", "score": "0.44550622", "text": "func (s *Server) metaConnect(addr string) (*grpc.ClientConn, error) {\n\tvar opts []grpc.DialOption\n\t// TODO(jaypipes): Don't hardcode this to WithInsecure\n\topts = append(opts, grpc.WithInsecure())\n\tconn, err := grpc.Dial(addr, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn conn, nil\n}", "title": "" }, { "docid": "a6daf6ed53dd1e2f7607183aa1a645dd", "score": "0.44531643", "text": "func (w *rpcWallet) client() rpcClient {\n\tw.rpcMtx.RLock()\n\tdefer w.rpcMtx.RUnlock()\n\treturn w.rpcClient\n}", "title": "" } ]
5fb3d6965d7abd76f35a83745cfb731d
Sets the play status of the audio stream.
[ { "docid": "7c382da2b0842c450104bcf628ee2b39", "score": "0.7219504", "text": "func (self *AudioStream) SetPlaying(val bool) bool {\n return cb2b(C.al_set_audio_stream_playing(self.handle, b2cb(val)))\n}", "title": "" } ]
[ { "docid": "baa90e316daffb8f585c0156a58428c8", "score": "0.67122006", "text": "func (self *Mixer) SetPlaying(val bool) bool {\n return cb2b(C.al_set_mixer_playing(self.handle, b2cb(val)))\n}", "title": "" }, { "docid": "524bd770d2be07ae81f045172d5e0c13", "score": "0.6664038", "text": "func (self *AudioStream) SetPlaymode(val PlayMode) bool {\n return cb2b(C.al_set_audio_stream_playmode(self.handle, val.toC()))\n}", "title": "" }, { "docid": "bf4a7b1daa66b93c3ff46e9655e1ba9e", "score": "0.6540776", "text": "func (self *SampleInstance) SetPlaying(val bool) bool {\n return cb2b(C.al_set_sample_instance_playing(self.handle, b2cb(val)))\n}", "title": "" }, { "docid": "6a4fdff9469fd6bd173a9dced4e18bef", "score": "0.65093464", "text": "func (self *Voice) SetPlaying(val bool) bool {\n return cb2b(C.al_set_voice_playing(self.handle, b2cb(val)))\n}", "title": "" }, { "docid": "7d42f606b8fe8abf3cf219a01562cbf8", "score": "0.5859421", "text": "func (self *AudioStream) Playmode() PlayMode {\n return PlayMode(C.al_get_audio_stream_playmode(self.handle))\n}", "title": "" }, { "docid": "193e6fd2b9c87d58f6fbdbd6d9f7418a", "score": "0.57591623", "text": "func UpdateVoiceStatus(status bool) {\n\tvoiceIsPlaying = status\n}", "title": "" }, { "docid": "fbf4b670ad216547c32e996cf6405676", "score": "0.56619084", "text": "func (self *SampleInstance) SetPlaymode(val PlayMode) bool {\n return cb2b(C.al_set_sample_instance_playmode(self.handle, val.toC()))\n}", "title": "" }, { "docid": "c563f6d125890606fe6f4618bfc10a8e", "score": "0.56321377", "text": "func (self *AudioStream) Playing() bool {\n return cb2b(C.al_get_audio_stream_playing(self.handle))\n}", "title": "" }, { "docid": "670f5d9d2b88bdb20135ddd760ef5851", "score": "0.5511227", "text": "func (this *Roomba) PauseStream() {\n\tthis.StreamPaused <- true\n}", "title": "" }, { "docid": "11a9f160ec50ed3bfbf21bf961bd26e9", "score": "0.550681", "text": "func (p *Player) SetStatus(status uint) {\n\tp.status = status\n\tp.stat.Status = model.STATUS_DESCRIPTIONS[p.status]\n}", "title": "" }, { "docid": "f2dc55074eaaccb30d426dd93c7d6b99", "score": "0.5495677", "text": "func (p *Player) Start(t soundcloud.Track) error {\n\tvar sf *StreamerFormat\n\tvar s io.ReadCloser\n\tvar err error\n\tif sf, s, err = p.StreamerFromTrack(t); err != nil {\n\t\treturn fmt.Errorf(\"unable to get streamer from track: %w\", err)\n\t}\n\tp.source = s\n\tdefer p.source.Close()\n\n\tif err = speaker.Init(sf.Format.SampleRate, sf.Format.SampleRate.N(100*time.Millisecond)); err != nil {\n\t\treturn err\n\t}\n\n\tctrl := &beep.Ctrl{Streamer: sf.Streamer, Paused: false}\n\tspeaker.Play(beep.Seq(ctrl, beep.Callback(func() {\n\t\tp.next <- true\n\t})))\n\tp.streamerc <- sf\n\n\tfor {\n\t\tselect {\n\t\tcase track := <-p.tc:\n\t\t\tif sf, s, err = p.StreamerFromTrack(track); err != nil {\n\t\t\t\t// If an error occurs, go to the next track\n\t\t\t\tp.streamerc <- nil\n\t\t\t\tp.next <- true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tspeaker.Clear()\n\t\t\tif p.source != nil {\n\t\t\t\tp.source.Close()\n\t\t\t}\n\t\t\tp.source = s\n\t\t\tctrl.Streamer = sf.Streamer\n\t\t\tctrl.Paused = false\n\t\t\tspeaker.Play(beep.Seq(ctrl, beep.Callback(func() {\n\t\t\t\tp.next <- true\n\t\t\t})))\n\t\t\tp.streamerc <- sf\n\t\tcase <-p.toggle:\n\t\t\tspeaker.Lock()\n\t\t\tctrl.Paused = !ctrl.Paused\n\t\t\tspeaker.Unlock()\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "e8f047f2eface6c69d50eb8150844021", "score": "0.54837924", "text": "func VoiceStatusSwitch() {\n\tvoiceIsPlaying = !voiceIsPlaying\n}", "title": "" }, { "docid": "daa8e3fe39e6006b3eec75ad7324eff9", "score": "0.54388416", "text": "func (p *sessionPlayer) setState(state tshPlayerState) {\n\tp.state = state\n\tp.cond.Broadcast()\n}", "title": "" }, { "docid": "d6fab49d48d63baac0cb9a77e78f0534", "score": "0.54165715", "text": "func (s *span) SetStatus(status Status) {\n\tif !s.IsRecordingEvents() {\n\t\treturn\n\t}\n\ts.mu.Lock()\n\ts.data.Status = status\n\ts.mu.Unlock()\n}", "title": "" }, { "docid": "1ea0f0a65d041c4cd75d8a3092e348f7", "score": "0.53992957", "text": "func (o *Play) SetOpen(arg int) {\n o.Open = arg\n o.IsOpenDirty = true\n}", "title": "" }, { "docid": "212db7da5b6cdd5b6a837b93ec176184", "score": "0.53643256", "text": "func (p *Player) PlayStream(message *rtmp.Message) {\n\tswitch message.Type {\n\tcase rtmp.VIDEO_TYPE:\n\t\tif p.stat.VideoBytes == 0 {\n\t\t\tp.stat.VideoStartUpTime = time.Now().Unix() - p.start_command_time\n\t\t}\n\t\tif p.startedAt == 0 && p.stat.VideoBytes > 0 {\n\t\t\tp.startedAt = time.Now().Unix()\n\t\t}\n\t\tp.stat.VideoBytes += int64(message.Buf.Len())\n\t\tp.stat.TotalFrames++\n\tcase rtmp.AUDIO_TYPE:\n\t\tif p.stat.AudioBytes == 0 {\n\t\t\tp.stat.AudioStartUpTime = time.Now().Unix() - p.start_command_time\n\t\t}\n\t\tp.stat.AudioBytes += int64(message.Buf.Len())\n\t}\n}", "title": "" }, { "docid": "23a1c4807a9579d22ddb2088b1c3c795", "score": "0.5276643", "text": "func (h *Session) SetStatus(s uint32) {\n\th.status = s\n}", "title": "" }, { "docid": "eb7a57f12031d00c2282677113c1f5f8", "score": "0.52553487", "text": "func (k Keeper) SetPauseStatus(ctx sdk.Context, owner sdk.AccAddress, denom string, status bool) error {\n\tasset, found := k.GetAsset(ctx, denom)\n\tif !found {\n\t\treturn errorsmod.Wrapf(types.ErrAssetNotFound, \"denom: %s\", denom)\n\t}\n\tif strings.Compare(owner.String(), asset.Owner) != 0 {\n\t\treturn errorsmod.Wrapf(types.ErrNotAuthorized, \"owner: %s, address: %s\", asset.Owner, owner)\n\t}\n\tif asset.Paused == status {\n\t\treturn nil\n\t}\n\tasset.Paused = !asset.Paused\n\tk.SetAsset(ctx, asset)\n\tctx.EventManager().EmitEvent(\n\t\tsdk.NewEvent(\n\t\t\ttypes.EventTypePause,\n\t\t\tsdk.NewAttribute(types.AttributeKeyPauseStatus, fmt.Sprintf(\"%t\", status)),\n\t\t\tsdk.NewAttribute(types.AttributeKeyDenom, asset.Denom),\n\t\t),\n\t)\n\treturn nil\n}", "title": "" }, { "docid": "25baaa2ff44cabb563816f4d154e1f83", "score": "0.5254792", "text": "func (s *Sound) Play(vc *discordgo.VoiceConnection) {\n\tvc.Speaking(true)\n\tdefer vc.Speaking(false)\n\n\t// t := time.NewTicker(time.Duration(1) * time.Second)\n\t// go s.control(t)\n\n\tfor _, buff := range s.buffer {\n\t\tvc.OpusSend <- buff\n\t\tif skips[vc.GuildID] == true {\n\t\t\t//skips[vc.GuildID] = false\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "57143f0cd4ffdb2df7d0fe032d49ac11", "score": "0.5213471", "text": "func (p *Player) SetStream(stream rtmp.OutboundStream) {\n\tp.createStreamChan <- stream\n}", "title": "" }, { "docid": "90b37d1dc909de57d7dc122fccc0def5", "score": "0.5194776", "text": "func (s *sound) play(vol float32) {\n\n\tif !s.played {\n\t\tmix.HaltChannel(s.channel)\n\t\ts.played = true\n\t}\n\n\tvar errObj error\n\ts.channel, errObj = s.chunk.Play(-1, 0)\n\t_ = errObj\n\n\ts.chunk.Volume(int(vol * 128))\n\n}", "title": "" }, { "docid": "7daed3cf34ec71e8601ba4534ba1387b", "score": "0.5135814", "text": "func (self *Sample) Play(gain, pan, speed float32, loop PlayMode) (ok bool, id SampleId) {\n ok = cb2b(C.al_play_sample(self.handle, C.float(gain), C.float(pan), C.float(speed), loop.toC(), (&id).toC()))\n return ok, id\n}", "title": "" }, { "docid": "4c774f071f93301cec0dddf8e5653890", "score": "0.508852", "text": "func (s *state) SetStatus(status models.LoopStatus) {\n\ts.statusMu.Lock()\n\tdefer s.statusMu.Unlock()\n\ts.status = status\n}", "title": "" }, { "docid": "7f04694d4cc1b3fb93bb865cd1757062", "score": "0.50737906", "text": "func (player *Player) Play(track string) error {\n\treturn player.PlayAt(track, 0, 0)\n}", "title": "" }, { "docid": "507b8d440e76fd2d0d0f864a3516d473", "score": "0.5073657", "text": "func (h *RTMPHandler) OnPlayStart(stream rtmp.OutboundStream) {\n\t// Does nothing.\n}", "title": "" }, { "docid": "fc96389c00fa15768bfb030847b32d2a", "score": "0.5068713", "text": "func (lp *LocalPlayer) Play(session *rtsp.Session) {\n\tgo lp.playStream(session)\n}", "title": "" }, { "docid": "8c39ab09d53b7b16988466326794307e", "score": "0.50270605", "text": "func (self *AudioStream) SetSpeed(val float32) bool {\n return cb2b(C.al_set_audio_stream_speed(self.handle, C.float(val)))\n}", "title": "" }, { "docid": "f19433584655c2bf32d02a5e6b50b692", "score": "0.5021793", "text": "func (p *MusicPlugin) play(vc *voiceConnection, close <-chan struct{}, control <-chan controlMessage, s song) {\n\tvar err error\n\n\tif close == nil || control == nil || vc == nil || vc.conn == nil {\n\t\tlog.Println(\"musicplugin: play exited because [close|control|vc|vc.conn] is nil.\")\n\t\treturn\n\t}\n\n\toptions := dca.StdEncodeOptions\n\toptions.RawOutput = true\n\toptions.Bitrate = 64\n\toptions.Application = \"lowdelay\"\n\n\tytdl := exec.Command(\"youtube-dl\", \"-v\", \"-f\", \"bestaudio\", \"-o\", \"-\", s.URL)\n\tytdlout, err := ytdl.StdoutPipe()\n\tif err != nil {\n\t\tlog.Println(\"ytdl StdoutPipe err:\", err)\n\t\treturn\n\t}\n\tytdlbuf := bufio.NewReaderSize(ytdlout, 16384)\n\n\tencodingSession, err := dca.EncodeMem(ytdlbuf, options)\n\tif err != nil {\n\t\tfmt.Println(\"error creating encoding session\", err.Error())\n\t\treturn\n\t}\n\tdefer encodingSession.Cleanup()\n\n\terr = ytdl.Start()\n\tif err != nil {\n\t\tlog.Println(\"ytdl Start err:\", err)\n\t\treturn\n\t}\n\tdefer func() {\n\t\tgo ytdl.Wait()\n\t}()\n\n\tvc.conn.Speaking(true)\n\tdefer vc.conn.Speaking(false)\n\n\td := make(chan error)\n\tstream := dca.NewStream(encodingSession, vc.conn, d)\n\n\tstart := time.Now()\n\tfor {\n\t\tselect {\n\t\tcase <-close:\n\t\t\tlog.Println(\"musicplugin: play() exited due to close channel.\")\n\t\t\treturn\n\t\tcase err = <-d:\n\t\t\tif err == io.EOF {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err.Error())\n\t\t\t\treturn\n\t\t\t}\n\t\tdefault:\n\t\t}\n\t\tselect {\n\t\tcase ctl := <-control:\n\t\t\tswitch ctl {\n\t\t\tcase Skip:\n\t\t\t\treturn\n\t\t\tcase Pause:\n\t\t\t\tstream.SetPaused(true)\n\t\t\t\tb := false\n\t\t\t\tfor {\n\t\t\t\t\tctl, ok := <-control\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tswitch ctl {\n\t\t\t\t\tcase Skip:\n\t\t\t\t\t\treturn\n\t\t\t\t\tcase Resume:\n\t\t\t\t\t\tstream.SetPaused(false)\n\t\t\t\t\t\tb = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tif b == true {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t}\n\n\t\tvc.playing.Remaining = (vc.playing.Duration - int(time.Since(start).Seconds()))\n\t\ttime.Sleep(500 * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "1e49ab31373997d69cf3bcc3d9d1796e", "score": "0.5021077", "text": "func (self *AudioStream) SetGain(val float32) bool {\n return cb2b(C.al_set_audio_stream_gain(self.handle, C.float(val)))\n}", "title": "" }, { "docid": "58479018bda0826474ea172e284b67e2", "score": "0.50118846", "text": "func (s *Sound) Play(vc *discordgo.VoiceConnection, skip chan bool) {\n\tvc.Speaking(true)\n\tdefer vc.Speaking(false)\n\n\tfor _, buff := range s.buffer {\n\t\tvc.OpusSend <- buff\n\t\tdoSkip := false\n\t\tselect {\n\t\tcase <-skip:\n\t\t\tdoSkip = true\n\t\tdefault:\n\t\t}\n\t\tif doSkip {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6b404ef0dbb6b283280e6f01e534e0a9", "score": "0.5008907", "text": "func (player *Player) SetState(state byte) {\n\tswitch state {\n\n\tcase StateConnecting:\n\t\tfmt.Printf(\"[Connection] Player %d connected from %s\\n\", player.id, player.connection.RemoteAddr())\n\n\tcase StatePlaying:\n\t\tswitch player.state {\n\t\tcase StateLinkdead:\n\t\t\tfmt.Printf(\"[Connection] Player %d reconnected\\n\", player.id)\n\t\tdefault:\n\t\t\tfmt.Printf(\"[Connection] Player %d connected from %s\\n\", player.id, player.connection.RemoteAddr())\n\t\t}\n\n\tcase StateLinkdead:\n\t\tfmt.Printf(\"[Connection] Player %d disconnected (link dead)\\n\", player.id)\n\t\tplayer.connection.Close()\n\t\tplayer.connection = nil\n\t\tplayer.lastActive = time.Now()\n\n\t}\n\n\tplayer.state = state\n}", "title": "" }, { "docid": "a0b55bd9a97e40e6489907e90d935a20", "score": "0.49818584", "text": "func (self *Mixer) Playing() bool {\n return cb2b(C.al_get_mixer_playing(self.handle))\n}", "title": "" }, { "docid": "4bcab8b2a5616ab06b874ce75ec205bf", "score": "0.49816534", "text": "func playStaged(ctx context.Context, h *ari.PlaybackHandle, timeout time.Duration) (Status, error) {\n\tstarted := h.Subscribe(ari.Events.PlaybackStarted)\n\tdefer started.Cancel()\n\n\tfinished := h.Subscribe(ari.Events.PlaybackFinished)\n\tdefer finished.Cancel()\n\n\tif timeout == 0 {\n\t\ttimeout = DefaultPlaybackStartTimeout\n\t}\n\n\tif err := h.Exec(); err != nil {\n\t\treturn Failed, eris.Wrap(err, \"failed to start playback\")\n\t}\n\n\tdefer h.Stop() // nolint: errcheck\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn Cancelled, nil\n\tcase <-started.Events():\n\tcase <-finished.Events():\n\t\treturn Finished, nil\n\tcase <-time.After(timeout):\n\t\treturn Timeout, eris.New(\"timeout waiting for playback to start\")\n\t}\n\n\t// Wait for playback to complete\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn Cancelled, nil\n\tcase <-finished.Events():\n\t\treturn Finished, nil\n\t}\n}", "title": "" }, { "docid": "b05ed9b0ca1b0c278d7d0aba65b0faff", "score": "0.49729308", "text": "func (m *MusicPlayer) PlayTune(tune int) {\n\tif tune > len(m.tunes)-1 {\n\t\ttune = 0\n\t}\n\tm.CurrentTune = tune\n\tm.tunes[tune].Play(0, -1)\n\tm.tunes[tune].Volume(m.VolumePercent)\n}", "title": "" }, { "docid": "fdef6d1b9f87df3ba1a4877370cabfee", "score": "0.49713787", "text": "func (o *Play) SetLow(arg int) {\n o.Low = arg\n o.IsLowDirty = true\n}", "title": "" }, { "docid": "38ca350e317785a7bec7cd5e8adfa639", "score": "0.4969446", "text": "func (s *Song) SetLooping(loop bool) {\n if loop {\n C.vox_set_autostop(s.slot, C.int(0));\n } else {\n C.vox_set_autostop(s.slot, C.int(1));\n }\n}", "title": "" }, { "docid": "dd98072080c6d1fcf80d5e221d892f69", "score": "0.4935914", "text": "func (this *Roomba) Play(num byte) error {\n\tif num > 4 {\n\t\treturn fmt.Errorf(\"only 4 songs are allowed\")\n\t}\n\n\treturn this.Write(rb.PLAY, Pack([]interface{}{num}))\n}", "title": "" }, { "docid": "609b52a2ff889052e7f0a0c821228c1d", "score": "0.49313843", "text": "func (t TapePlayer) start(song string) {\n\tfmt.Println(\"Playing \", song)\n}", "title": "" }, { "docid": "7c5ce5d8715eb83d64909c56d7cdf4c1", "score": "0.49296707", "text": "func (r *RedditVideo) SetAudioURL() (err error) {\n\tif strings.Contains(r.VideoURL, \"DASH_\") {\n\t\tr.AudioURL = strings.Split(r.VideoURL, \"DASH_\")[0] + \"audio\"\n\t} else {\n\t\terr = ErrNotDASH\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e072ac81d29607f44831420b4a40d749", "score": "0.49019593", "text": "func (m MediaStateRecorder) Notify(status mediaplayers.MediaPlayerStatus) {\n\tif status.State == 2 {\n\t\tm.store.UpdatePosition(status.NowPlaying, status.Position)\n\t\tm.store.UpdateDuration(status.NowPlaying, status.Duration)\n\t}\n}", "title": "" }, { "docid": "89bad1a4c2a5f193b3042d970b133799", "score": "0.48981327", "text": "func (self *Voice) Playing() bool {\n return cb2b(C.al_get_voice_playing(self.handle))\n}", "title": "" }, { "docid": "265c6a7dc7b24d8f8598904e3d36a675", "score": "0.48956922", "text": "func (self *Mixer) SetFrequency(val uint) bool {\n return cb2b(C.al_set_mixer_frequency(self.handle, C.uint(val)))\n}", "title": "" }, { "docid": "4b6a1362c0543ea14d073605a8ee4e92", "score": "0.488688", "text": "func (p *Player) Play() {\n\tp.playChan <- struct{}{}\n}", "title": "" }, { "docid": "81090d35d5f8efb07f7bb34bdddde61e", "score": "0.4882998", "text": "func (c *Client) Play(filename string) error {\n\treturn discardResult(c.Cmd(\"player-play \" + filename))\n}", "title": "" }, { "docid": "b9408d0ad982927d8c131b5043bc550c", "score": "0.48814648", "text": "func ready(s *discordgo.Session, event *discordgo.Ready) {\r\n\t// Set the playing status.\r\n\ts.UpdateStatus(0, prefix)\r\n}", "title": "" }, { "docid": "3d3ef3f84d6d7421be13c433b55408ea", "score": "0.48809552", "text": "func (g *GroupedSound) Play() {\n\tif g.playing {\n\t\treturn\n\t}\n\tg.playing = true\n\tif g.s.groupedCount == 0 {\n\t\tg.s.groupedPlayer = g.s.Play()\n\t}\n\tg.s.groupedCount++\n}", "title": "" }, { "docid": "cf11720f390f0bbb6db06f843a8ad8f8", "score": "0.48783037", "text": "func (self *SampleInstance) Play() bool {\n return cb2b(C.al_play_sample_instance(self.handle))\n}", "title": "" }, { "docid": "7c9c18e832ba03ebf848c8056442786f", "score": "0.48597434", "text": "func (a Audio) Play() error {\n\n\tif a.ID == 0 {\n\t\treturn errors.New(\"need a id in order to play audio\")\n\t}\n\n\taudio, artist, _, err := db.AllSongInfo(a.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogrus.Infof(\"playing %s by %s\", audio.Title, artist.Name)\n\n\tfile, err := os.Open(audio.Location)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar (\n\t\tstream beep.StreamSeekCloser\n\t\tformat beep.Format\n\t)\n\n\tswitch audio.MIME {\n\tcase \"audio/mpeg\":\n\t\tstream, format, err = mp3.Decode(file)\n\tcase \"audio/x-wav\":\n\t\tstream, format, err = wav.Decode(file)\n\tcase \"audio/x-flac\":\n\t\tstream, format, err = flac.Decode(file)\n\tcase \"audio/ogg\":\n\t\tstream, format, err = vorbis.Decode(file)\n\tdefault:\n\t\treturn errors.New(\"MIME is missing\")\n\t}\n\n\tif err := speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10)); err != nil {\n\t\treturn err\n\t}\n\n\tdone := make(chan struct{})\n\n\tspeaker.Play(beep.Seq(stream, beep.Callback(func() {\n\t\tclose(done)\n\t})))\n\n\t<-done\n\n\t// if err := speaker.Play(stream); err != nil {\n\t// \treturn err\n\t// }\n\n\t// s, format, err := wav.Decode(file)\n\t// if err != nil {\n\t// \treturn err\n\t// }\n\n\treturn nil\n\n}", "title": "" }, { "docid": "94c7bb5e10d1131944abd1510f58bdd7", "score": "0.4850757", "text": "func (a *App) PlayPause() {\n\tspeaker.Lock()\n\ta.ctrl.Paused = !a.ctrl.Paused\n\tspeaker.Unlock()\n}", "title": "" }, { "docid": "2549825d69a3a53f99d5cb7661e94f3d", "score": "0.48001507", "text": "func (js *jetStream) setStarted() {\n\tjs.mu.Lock()\n\tdefer js.mu.Unlock()\n\tjs.started = time.Now()\n}", "title": "" }, { "docid": "9fb086e0f8a087965572c423196cee81", "score": "0.47926813", "text": "func (ps *PeerState) SetRunning(v bool) {\n\tps.mtx.Lock()\n\tdefer ps.mtx.Unlock()\n\n\tps.running = v\n}", "title": "" }, { "docid": "3657eaf155d35d546a4f14adaf8eee54", "score": "0.47873408", "text": "func (self *Voice) SetPosition(val uint) bool {\n return cb2b(C.al_set_voice_position(self.handle, C.uint(val)))\n}", "title": "" }, { "docid": "0a1f79837d89aefaf6f6f6dbe560c94f", "score": "0.47869802", "text": "func (self *AudioStream) Rewind() bool {\n return cb2b(C.al_rewind_audio_stream(self.handle))\n}", "title": "" }, { "docid": "dd44163a83f5d1b4ebf13ed127d51084", "score": "0.47862682", "text": "func (p *Player) Play(mediaURI string) (h *ari.PlaybackHandle, err error) {\n\th = p.results[0].Handle\n\terr = p.results[0].Err\n\tp.results = p.results[1:]\n\n\tp.Next <- struct{}{}\n\n\treturn\n}", "title": "" }, { "docid": "1a370fc58cfef595b844fad48ff2810d", "score": "0.47835812", "text": "func Play(client *spotify.Client, command []string) error {\n\tdefer resetFlags()\n\terr := flagsPlay.Parse(command)\n\tif err == flag.ErrHelp {\n\t\treturn nil\n\t} else if err != nil {\n\t\treturn err\n\t}\n\tif playStart {\n\t\tdevices, err := client.PlayerDevices()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(devices) == 0 {\n\t\t\treturn errors.New(\"there are no available devices\")\n\t\t}\n\t\treturn client.PlayOpt(&spotify.PlayOptions{DeviceID: &devices[0].ID})\n\t}\n\t// Switch and play on different device\n\tif deviceID != \"\" {\n\t\treturn client.TransferPlayback(spotify.ID(deviceID), true)\n\t}\n\treturn client.Play()\n\n}", "title": "" }, { "docid": "0a656d8bbf03a2d3a5306f09b09bfcad", "score": "0.47701806", "text": "func (player *Player) PlayAt(track string, startTime int, endTime int) error {\n\tplayer.paused = false\n\tplayer.track = track\n\n\tstart := strconv.Itoa(startTime)\n\tend := strconv.Itoa(endTime)\n\n\tmsg := message{\n\t\tOp: opPlay,\n\t\tGuildID: player.guildID,\n\t\tTrack: track,\n\t\tStartTime: start,\n\t\tEndTime: end,\n\t}\n\tdata, err := json.Marshal(msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = player.node.wsConn.WriteMessage(websocket.TextMessage, data)\n\treturn err\n}", "title": "" }, { "docid": "00eb4279a60520f946928df92377ba77", "score": "0.4698079", "text": "func (self *SampleInstance) Playing() bool {\n return cb2b(C.al_get_sample_instance_playing(self.handle))\n}", "title": "" }, { "docid": "d11b2eb3b16a6d19a6fcb572158f015c", "score": "0.46917582", "text": "func (me *ShairportClient) TogglePause() {\n\tme.clientRequest(\"playpause\")\n}", "title": "" }, { "docid": "34719da84ef7dad4a89c184389650488", "score": "0.4689183", "text": "func StartPlayback() {\n\tputRequest(startURL)\n}", "title": "" }, { "docid": "402b4b7339bdc6e244df871c480a1c44", "score": "0.46888572", "text": "func (self *Mixer) SetGain(val float32) bool {\n return cb2b(C.al_set_mixer_gain(self.handle, C.float(val)))\n}", "title": "" }, { "docid": "003455363981076789e6f734d47f24b2", "score": "0.46840692", "text": "func (c *WebAudio) Enable() (*gcdmessage.ChromeResponse, error) {\n\treturn gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"WebAudio.enable\"})\n}", "title": "" }, { "docid": "a3f53688429387cf72b97275a1e2620e", "score": "0.46839353", "text": "func (s *Song) Play() error {\n if C.vox_play(s.slot) != C.int(0) {\n return errors.New(fmt.Sprintf(\"Could not play slot %v\", s))\n }\n return nil\n}", "title": "" }, { "docid": "f05765232d022eb50d340dad044155a1", "score": "0.46826997", "text": "func (s *Sound) Play() *audiowrap.Player {\n\treturn s.PlayAtVolume(1.0)\n}", "title": "" }, { "docid": "71946d6c321ec3ff1893e322d20795ff", "score": "0.4670713", "text": "func SetAudioOutput(mode int) {\n\taudio_output = mode\n}", "title": "" }, { "docid": "0b7438ac4839119dd1efebeed4039031", "score": "0.4664696", "text": "func (self *Mixer) SetQuality(val MixerQuality) bool {\n return cb2b(C.al_set_mixer_quality(self.handle, val.toC()))\n}", "title": "" }, { "docid": "4ac39892c8b9fdf58d17b223acf566f3", "score": "0.4657824", "text": "func (p *MusicPlugin) start(vc *voiceConnection, close <-chan struct{}, control <-chan controlMessage, service rikka.Service) {\n\n\tif close == nil || control == nil || vc == nil {\n\t\tlog.Println(\"musicplugin: start() exited due to nil channels\")\n\t\treturn\n\t}\n\n\tvar i int\n\tvar s song\n\n\t// main loop keeps this going until close\n\tfor {\n\n\t\t// exit if close channel is closed\n\t\tselect {\n\t\tcase <-close:\n\t\t\tlog.Println(\"musicplugin: start() exited due to close channel.\")\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\n\t\t// loop until voice connection is ready and songs are in the queue.\n\t\tif vc.conn == nil || vc.conn.Ready == false || len(vc.Queue) < 1 {\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Get song to play and store it in local Song var\n\t\tvc.Lock()\n\t\tif vc.Loop && vc.Repeat {\n\t\t\tservice.SendMessage(vc.playing.TextChannelID, \"There was an error. Resetting loop and repeat\")\n\t\t\tvc.Loop = false\n\t\t\tvc.Repeat = false\n\t\t}\n\n\t\tvcLen := len(vc.Queue)\n\t\tif vcLen-1 >= i {\n\t\t\ts = vc.Queue[i]\n\t\t} else {\n\t\t\ti = 0\n\t\t\tvc.Unlock()\n\t\t\tcontinue\n\t\t}\n\t\tvc.Unlock()\n\n\t\tvc.playing = &s\n\t\ttimeLeft := time.Duration(0)\n\t\tfor _, v := range vc.Queue {\n\t\t\ttimeLeft += time.Duration(v.Duration)\n\t\t}\n\t\ttimeLeft *= time.Second\n\t\tif vc.Announce {\n\t\t\ts.announceSongPlaying(service, vc.playing.TextChannelID, vcLen, timeLeft.String())\n\t\t}\n\t\tp.play(vc, close, control, s)\n\t\tvc.playing = nil\n\n\t\tvc.Lock()\n\t\tif len(vc.Queue) > 0 {\n\t\t\tif !vc.Repeat && !vc.Loop {\n\t\t\t\tvc.Queue = append(vc.Queue[:i], vc.Queue[i+1:]...)\n\t\t\t}\n\t\t\tif vc.Repeat {\n\t\t\t\t// do nothing\n\t\t\t}\n\t\t\tif vc.Loop {\n\t\t\t\tvar pop song\n\t\t\t\tpop, vc.Queue = vc.Queue[0], vc.Queue[1:]\n\t\t\t\tvc.Queue = append(vc.Queue, pop)\n\t\t\t}\n\t\t}\n\t\tvc.Unlock()\n\t}\n}", "title": "" }, { "docid": "ac97c5ec474f6fafc9d0f09de5b2a873", "score": "0.46540394", "text": "func (client *RTMServerClient) SetListenStatus(allGroups bool, allRooms bool, allP2P bool, allEvents bool, rest ...interface{}) error {\n\n\tvar timeout time.Duration\n\tvar callback func(int, string)\n\n\tfor _, value := range rest {\n\t\tswitch value := value.(type) {\n\t\tcase time.Duration:\n\t\t\ttimeout = value\n\t\tcase func(int, string):\n\t\t\tcallback = value\n\t\tdefault:\n\t\t\treturn errors.New(\"Invaild params when call RTMServerClient.SetListen() function.\")\n\t\t}\n\t}\n\n\tquest := client.genServerQuest(\"setlisten\")\n\tquest.Param(\"group\", allGroups)\n\tquest.Param(\"room\", allRooms)\n\tquest.Param(\"p2p\", allP2P)\n\tquest.Param(\"ev\", allEvents)\n\tclient.setRTMListenStateCache(allP2P, allGroups, allRooms, allEvents)\n\treturn client.sendSilentQuest(quest, timeout, callback)\n}", "title": "" }, { "docid": "ad1a12dabcf2b5db1a50e41b23c6f2bd", "score": "0.46488047", "text": "func (m *UserExperienceAnalyticsDeviceScope) SetStatus(value *DeviceScopeStatus)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0a820af1480cbba698ea8966a370f190", "score": "0.4643497", "text": "func (ss *sounds) setListener(p *Pov) {\n\tif p != nil {\n\t\tss.soundListener = p\n\t}\n}", "title": "" }, { "docid": "03e46471ae23c81f3af80aa247633364", "score": "0.4642824", "text": "func (p *State) SetStatusRunning() {\n\tp.state.Status = agent.StatusRunning\n\tp.state.Progress = 0.0\n\tp.state.Report.Status = string(agent.StatusRunning)\n\tp.pusher.UpdateState(p.state)\n}", "title": "" }, { "docid": "9b4c4ab9c5aae86a6e5cabac229c7828", "score": "0.46402127", "text": "func (s *Session) EnableStreamManagement(o *Config) {\n\tif s.err != nil {\n\t\treturn\n\t}\n\tif !s.Features.DoesStreamManagement() || !o.StreamManagementEnable {\n\t\treturn\n\t}\n\tq := stanza.NewUnAckQueue()\n\tebleNonza := stanza.SMEnable{Resume: &o.streamManagementResume}\n\tpktStr, err := xml.Marshal(ebleNonza)\n\tif err != nil {\n\t\ts.err = err\n\t\treturn\n\t}\n\t_, err = s.transport.Write(pktStr)\n\tif err != nil {\n\t\ts.err = err\n\t\treturn\n\t}\n\n\tvar packet stanza.Packet\n\tpacket, s.err = stanza.NextPacket(s.transport.GetDecoder())\n\tif s.err == nil {\n\t\tswitch p := packet.(type) {\n\t\tcase stanza.SMEnabled:\n\t\t\t// Server allows resumption or not using SMEnabled attribute \"resume\". We must read the server response\n\t\t\t// and update config accordingly\n\t\t\tb, err := strconv.ParseBool(p.Resume)\n\t\t\tif err != nil || !b {\n\t\t\t\to.StreamManagementEnable = false\n\t\t\t}\n\t\t\ts.SMState = SMState{Id: p.Id, preferredReconAddr: p.Location}\n\t\t\ts.SMState.UnAckQueue = q\n\t\tcase stanza.SMFailed:\n\t\t\t// TODO: Store error in SMState, for later inspection\n\t\t\ts.SMState = SMState{StreamErrorGroup: p.StreamErrorGroup}\n\t\t\ts.SMState.UnAckQueue = q\n\t\t\ts.err = errors.New(\"failed to establish session : \" + s.SMState.StreamErrorGroup.GroupErrorName())\n\t\tdefault:\n\t\t\ts.err = errors.New(\"unexpected reply to SM enable\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "0d15e90345f2c633fd5075600e25588e", "score": "0.46388996", "text": "func (s *Stream) Start() startResponse {\n\turi := \"rtmp://\" + s.Host + \"/\" + s.Application + \"/\" + s.Name\n\tresp := startResponse{\n\t\tURL: uri,\n\t}\n\targs := []string{}\n\targs = append(args, \"-hide_banner\")\n\tif !s.AudioDisabled {\n\t\tcardId := s.Camera.CardId()\n\t\targs = append(args, \"-f\", s.AudioInput)\n\t\targs = append(args, \"-i\", fmt.Sprintf(\"hw:%d\", cardId))\n\t\targs = append(args, \"-ac\", strconv.Itoa(s.Camera.NAudioChannels(cardId)))\n\t}\n\targs = append(args, \"-f\", s.VideoInputFormat)\n\targs = append(args, \"-r\", \"60\")\n\targs = append(args, \"-i\", s.Camera.Device)\n\tif s.VideoResolution != \"\" {\n\t\targs = append(args, \"-vf\", \"scale=\"+s.VideoResolution)\n\t}\n\targs = append(args, \"-c:v\", s.VideoEncoding)\n\tif !s.AudioDisabled {\n\t\targs = append(args, \"-c:a\", s.AudioEncoding)\n\t\targs = append(args, \"-ar\", strconv.Itoa(s.AudioRate))\n\t\targs = append(args, \"-ab\", strconv.Itoa(s.AverageBitRate))\n\t}\n\targs = append(args, \"-f\", s.OutputEncoding, uri)\n\tresp.Cmd = strings.Join(append([]string{\"ffmpeg\"}, args...), \" \")\n\tresp.Status = \"on\"\n\tcmd := exec.Command(\"ffmpeg\", args...)\n\tcmd.Stderr = new(bytes.Buffer)\n\ts.cmd = cmd\n\tgo func() {\n\t\tdefer func() { s.Live = false }()\n\t\ts.Live = true\n\t\terr := cmd.Run()\n\t\tif err != nil && !strings.Contains(err.Error(), \"signal: killed\") {\n\t\t\tlog.Printf(\"Failed to start stream: %s\\n%s\\n\", strings.Join(append([]string{\"ffmpeg\"}, args...), \" \"), cmd.Stderr)\n\t\t}\n\t}()\n\treturn resp\n}", "title": "" }, { "docid": "06eb94c2370a1e3a7234c465d7f271e2", "score": "0.46349615", "text": "func (self *AudioStream) LoopSeconds(start, end float64) bool {\n return cb2b(C.al_set_audio_stream_loop_secs(self.handle, C.double(start), C.double(end)))\n}", "title": "" }, { "docid": "245f04e057bd49f584967c3700a56b5a", "score": "0.4631994", "text": "func (c *Context) SetStatus(s int) {\n\tc.ResponseWriter.WriteHeader(s)\n}", "title": "" }, { "docid": "5ae6c07b1e2621acd53fff2f6c4868dd", "score": "0.46281216", "text": "func (event *Event) PlaySound() {\n\trl.PlaySound(event.Sound)\n}", "title": "" }, { "docid": "e5ad66e2dc7e842e5bae7f3192f70aa2", "score": "0.46273106", "text": "func (udpTunnel *UdpTunnel) SetStatus(s TunnelStatus) {\n\tudpTunnel.rwMutex.Lock()\n\tudpTunnel.status = s\n\tudpTunnel.rwMutex.Unlock()\n}", "title": "" }, { "docid": "9aa7a562fbeee62029d08c07e522e346", "score": "0.46270862", "text": "func (self *AudioStream) SetPan(val float32) bool {\n return cb2b(C.al_set_audio_stream_pan(self.handle, C.float(val)))\n}", "title": "" }, { "docid": "5789031d278e3b86541705ea3ce8a13e", "score": "0.4619726", "text": "func (c *Client) SetStatus(ctx context.Context, local *azurev1alpha1.TrafficManager) (bool, error) {\n\tremote, err := c.internal.Get(ctx, local.Spec.ResourceGroup, local.Spec.Name)\n\t// Care about 400 and 5xx, not 404.\n\tfound := !remote.IsHTTPStatus(http.StatusNotFound)\n\tif err != nil && !remote.HasHTTPStatus(http.StatusNotFound, http.StatusConflict) {\n\t\treturn found, err\n\t}\n\n\tlocal.Status.ID = remote.ID\n\tif remote.ProfileProperties != nil {\n\t\tlocal.Status.FQDN = remote.ProfileProperties.DNSConfig.Fqdn\n\t\tlocal.Status.ProfileMonitorStatus = string(remote.ProfileProperties.MonitorConfig.ProfileMonitorStatus)\n\t}\n\treturn found, nil\n}", "title": "" }, { "docid": "6bc0c8b8ff1aa4c70d0f5be37cf46c1e", "score": "0.46184894", "text": "func play(file string, wavFile bool) {\n\t// Open first sample File\n\tf, err := os.Open(file)\n\n\t// Check for errors when opening the file\n\tif err != nil {\n\t\tfmt.Println(\"Could not open audio file\", file)\n\t\treturn\n\t}\n\n\t// Decode the .mp3 File, if you have a .wav file, use wav.Decode(f)\n\tvar (\n\t\ts beep.StreamSeekCloser\n\t\tformat beep.Format\n\t)\n\tif wavFile {\n\t\ts, format, _ = wav.Decode(f)\n\t} else {\n\t\ts, format, _ = mp3.Decode(f)\n\t}\n\n\t// Init the Speaker with the SampleRate of the format and a buffer size.\n\tspeaker.Init(format.SampleRate, format.SampleRate.N(3*time.Second))\n\n\t// Channel, which will signal the end of the playback.\n\tplaying := make(chan struct{})\n\n\t// Now we Play our Streamer on the Speaker\n\tspeaker.Play(beep.Seq(s, beep.Callback(func() {\n\t\t// Callback after the stream Ends\n\t\tclose(playing)\n\t})))\n\t<-playing\n}", "title": "" }, { "docid": "148fc7570b6f005f560d8529b73ad893", "score": "0.46169257", "text": "func (m *MediaStream) SetStreamId(value *string)() {\n m.streamId = value\n}", "title": "" }, { "docid": "41a4444891df53bbca5caed2709b57ea", "score": "0.46121037", "text": "func (s *Sound) toggle(channel byte, on bool) {\n\tvar c *Channel\n\tswitch channel {\n\tcase 1:\n\t\tc = s.channel1\n\tcase 2:\n\t\tc = s.channel2\n\tcase 3:\n\t\tc = s.channel3\n\tcase 4:\n\t\tc = s.channel4\n\t}\n\tif on && s.shouldPlay(channel) {\n\t\tc.On()\n\t\ts.gb.Memory.HighRAM[0x26] = bits.Set(s.gb.Memory.HighRAM[0x26], channel-1)\n\t} else {\n\t\tc.Off()\n\t\ts.gb.Memory.HighRAM[0x26] = bits.Reset(s.gb.Memory.HighRAM[0x26], channel-1)\n\t}\n}", "title": "" }, { "docid": "e5015a6261dbf7aa28abc6b0057741e2", "score": "0.460867", "text": "func (lp *LocalPlayer) SetTrack(album string, artist string, title string) {\n\t// no op for now\n}", "title": "" }, { "docid": "982444a4fe1731400ae52210f2c38316", "score": "0.46064332", "text": "func SetPlayStoreEnabled(ctx context.Context, tconn *chrome.TestConn, enabled bool) error {\n\treturn tconn.Call(ctx, nil, `tast.promisify(chrome.autotestPrivate.setPlayStoreEnabled)`, enabled)\n}", "title": "" }, { "docid": "1ddbd6a4e0c5a5cb126cfb46e71a624a", "score": "0.46039996", "text": "func (m *MediaStream) SetWasMediaBypassed(value *bool)() {\n m.wasMediaBypassed = value\n}", "title": "" }, { "docid": "0a806fe031c214b68995320ed3475c54", "score": "0.45905125", "text": "func (c *Client) Play(ctx context.Context) error {\n\tc.cleanLastPlay()\n\tlog.Printf(\"Clearing Last Play - Completed.\")\n\tctx, c.playCancel = context.WithCancel(ctx)\n\tc.mpdSrc.StatzAgg = c.StatzAgg\n\tmpdChan := c.mpdSrc.GetMpdUpdates(ctx, &c.plagWg)\n\tlog.Printf(\"MpdSource Updates requested.\")\n\tc.plagWg.Add(1)\n\tgo c.handleMpdUpdates(ctx, &c.plagWg, mpdChan)\n\tlog.Printf(\"MpdSource Updates initiated.\")\n\treturn nil\n}", "title": "" }, { "docid": "8c77f6e10027794caf649cd5c31c68dc", "score": "0.4588918", "text": "func (d *StreamMessage) SetStatus(code StatusCode) {\n\td.StatusCode = code\n}", "title": "" }, { "docid": "5624bd1d095cdb4b00a2183464302444", "score": "0.45877713", "text": "func (o *OktaAssignmentV1) SetStatus(status string) error {\n\tinvalidTransition := false\n\tswitch o.Spec.Status {\n\tcase OktaAssignmentSpecV1_PENDING:\n\t\tswitch status {\n\t\tcase constants.OktaAssignmentStatusProcessing:\n\t\tdefault:\n\t\t\tinvalidTransition = true\n\t\t}\n\tcase OktaAssignmentSpecV1_PROCESSING:\n\t\tswitch status {\n\t\tcase constants.OktaAssignmentStatusProcessing:\n\t\tcase constants.OktaAssignmentStatusSuccessful:\n\t\tcase constants.OktaAssignmentStatusFailed:\n\t\tdefault:\n\t\t\tinvalidTransition = true\n\t\t}\n\tcase OktaAssignmentSpecV1_SUCCESSFUL:\n\t\tswitch status {\n\t\tcase constants.OktaAssignmentStatusProcessing:\n\t\tdefault:\n\t\t\tinvalidTransition = true\n\t\t}\n\tcase OktaAssignmentSpecV1_FAILED:\n\t\tswitch status {\n\t\tcase constants.OktaAssignmentStatusProcessing:\n\t\tdefault:\n\t\t\tinvalidTransition = true\n\t\t}\n\tcase OktaAssignmentSpecV1_UNKNOWN:\n\t\t// All transitions are allowed from UNKNOWN.\n\tdefault:\n\t\tinvalidTransition = true\n\t}\n\n\tif invalidTransition {\n\t\treturn trace.BadParameter(\"invalid transition: %s -> %s\", o.GetStatus(), status)\n\t}\n\n\to.Spec.Status = OktaAssignmentStatusToProto(status)\n\n\treturn nil\n}", "title": "" }, { "docid": "1466adce5baa09e2a8913c59baa42241", "score": "0.45852104", "text": "func (c *Client) PlayPause() error {\n\treturn discardResult(c.Cmd(\"player-pause\"))\n}", "title": "" }, { "docid": "9258fc750b5d612601dc30f8fe691b0c", "score": "0.4551851", "text": "func (s *Session) EnableStreamManagement(o Config) {\n\tif s.err != nil {\n\t\treturn\n\t}\n\tif !s.Features.DoesStreamManagement() {\n\t\treturn\n\t}\n\n\tfmt.Fprintf(s.transport, \"<enable xmlns='%s' resume='true'/>\", stanza.NSStreamManagement)\n\n\tvar packet stanza.Packet\n\tpacket, s.err = stanza.NextPacket(s.transport.GetDecoder())\n\tif s.err == nil {\n\t\tswitch p := packet.(type) {\n\t\tcase stanza.SMEnabled:\n\t\t\ts.SMState = SMState{Id: p.Id}\n\t\tcase stanza.SMFailed:\n\t\t\t// TODO: Store error in SMState, for later inspection\n\t\tdefault:\n\t\t\ts.err = errors.New(\"unexpected reply to SM enable\")\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "84a80596acfcae3bcdc0b163e8b56d1b", "score": "0.45456368", "text": "func SetStatus(w http.ResponseWriter, code, msg string) {\n\tr := &Status{Code: code, Message: msg}\n\tif js, err := json.Marshal(r); err == nil {\n\t\tw.Write(js)\n\t} else {\n\t\tpanic(fmt.Sprintf(\"Unable to marshal: %+v\", r))\n\t}\n}", "title": "" }, { "docid": "17f6a06005e7b3e8bbb0794380e16b3f", "score": "0.45402685", "text": "func (m *UnifiedRoleScheduleBase) SetStatus(value *string)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "950c419f3664dc529804363340a0c319", "score": "0.45374933", "text": "func (out *DefaultIOHandler) SetStatus(status contracts.ResultStatus) {\n\tout.Status = status\n}", "title": "" }, { "docid": "207aaf2d497431cc4c861c9c1b565feb", "score": "0.4535802", "text": "func (m *MediaStream) SetStreamDirection(value *MediaStreamDirection)() {\n m.streamDirection = value\n}", "title": "" }, { "docid": "e3a198c01bdb772776e74bdd26c4e624", "score": "0.4528026", "text": "func UpdateSongAndStatus(firestoreClient *firestore.Client, conn redis.Conn, spotifyClient spotify.Client) {\n\tvar song SpotifyTrack\n\tvar lastSong SpotifyTrack\n\tdocsnap, err := firestoreClient.Doc(\"songs/mostUpvoted\").Get(context.Background())\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\terr = docsnap.DataTo(&song)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tspotifyClient.PlayOpt(&spotify.PlayOptions{\n\t\tURIs: []spotify.URI{\n\t\t\tspotify.URI(song.URI),\n\t\t},\n\t})\n\tdocsnap, err = firestoreClient.Doc(\"songs/nowPlaying\").Get(context.Background())\n\terr = docsnap.DataTo(&lastSong)\n\tfirestoreClient.Doc(\"recentSongs\"+lastSong.URI).Create(context.Background(), lastSong)\n\tfirestoreClient.Doc(\"songs/nowPlaying\").Set(context.Background(), song)\n\tconn.Do(\"SETEX\", song.URI, song.Duration/1000, song.Duration)\n}", "title": "" }, { "docid": "d975e2a6451fb4f6a82b860b217199d7", "score": "0.45273778", "text": "func (e *NoteOffEvent) SetRunningStatus(status bool) {\n\te.runningStatus = status\n}", "title": "" }, { "docid": "4fe5c2ef8361b04b9225f6ce890394c5", "score": "0.4515736", "text": "func (o *GetStreamDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "d6a7b5dd14c7148678851dfb3b72040e", "score": "0.45118207", "text": "func (s *Session) resume(o Config) bool {\n\tif !s.Features.DoesStreamManagement() {\n\t\treturn false\n\t}\n\tif s.SMState.Id == \"\" {\n\t\treturn false\n\t}\n\n\tfmt.Fprintf(s.transport, \"<resume xmlns='%s' h='%d' previd='%s'/>\",\n\t\tstanza.NSStreamManagement, s.SMState.Inbound, s.SMState.Id)\n\n\tvar packet stanza.Packet\n\tpacket, s.err = stanza.NextPacket(s.transport.GetDecoder())\n\tif s.err == nil {\n\t\tswitch p := packet.(type) {\n\t\tcase stanza.SMResumed:\n\t\t\tif p.PrevId != s.SMState.Id {\n\t\t\t\ts.err = errors.New(\"session resumption: mismatched id\")\n\t\t\t\ts.SMState = SMState{}\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\tcase stanza.SMFailed:\n\t\tdefault:\n\t\t\ts.err = errors.New(\"unexpected reply to SM resume\")\n\t\t}\n\t}\n\ts.SMState = SMState{}\n\treturn false\n}", "title": "" }, { "docid": "03f5b59e2eb10fc4e8cccadb59f21532", "score": "0.45108467", "text": "func (ss *sounds) play(id eid, index int) {\n\tif snds, ok := ss.active[id]; ok {\n\t\tif index < 0 || index >= len(snds) {\n\t\t\treturn\n\t\t}\n\t\ts := snds[index]\n\t\tif p := ss.eng.povs.get(id); p != nil {\n\t\t\tx, y, z := p.At()\n\t\t\tgo func(sid uint64, x, y, z float64) {\n\t\t\t\tss.eng.machine <- &playSound{sid: sid, x: x, y: y, z: z}\n\t\t\t}(s.sid, x, y, z)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ddee2cd9265c8e8740fcaf79ee8133de", "score": "0.45035785", "text": "func (service MovieService) SetAudio(setter media.MovieBlockSetter, key resource.Key, soundData audio.L8) {\n\tbaseContainer := service.getBaseContainer(key)\n\tbaseContainer.Audio.Sound = soundData\n\tservice.movieSetter.Set(setter, key, baseContainer)\n}", "title": "" }, { "docid": "88cc5007f3bb5472998c6a891a5a3500", "score": "0.45030528", "text": "func (stream *AudioStream) Attach(mixer *Mixer) bool {\n return cb2b(C.al_attach_audio_stream_to_mixer(stream.handle, mixer.handle))\n}", "title": "" } ]
1dab691f1311c4e656e1ecbf69c84ed8
String returns the string representation
[ { "docid": "4d94697333eae7bbee40dd0c98801f40", "score": "0.0", "text": "func (s DeleteSubscriptionFilterOutput) 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": "d2f6e24fdd02f3ebb7dc1eebba3a17a0", "score": "0.7078128", "text": "func (r *Record) String() string {\n\tif result, err := toolbox.AsJSONText(r.AsMap()); err == nil {\n\t\treturn result\n\t}\n\treturn fmt.Sprintf(\"%v\", (*r))\n}", "title": "" }, { "docid": "11de7267cdfe6d4a59aabf06ee58f2c5", "score": "0.7077297", "text": "func (a Create) String() string {\n\traw, err := json.MarshalIndent(\n\t\ta,\n\t\t\" \",\n\t\t\".\",\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(raw)\n}", "title": "" }, { "docid": "3023f5a9db8caee3b526dd77ddbfe5a1", "score": "0.70727754", "text": "func (signatory Signatory) String() string {\n\treturn base64.RawURLEncoding.EncodeToString(signatory[:])\n}", "title": "" }, { "docid": "2c919d18685112d798d30ef9bae4a391", "score": "0.7046963", "text": "func (s CreateRouteCalculatorOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e1f1295f482f2ba6ac0ee700f4a89e70", "score": "0.70317215", "text": "func (c Classes) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "26a09912d58bbdc945167d21189682db", "score": "0.7029279", "text": "func (s Eirp) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1b505a985665493e7eb90ed069f5a4b3", "score": "0.70279396", "text": "func (o *Createworkplanshift) 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": "cc697c6d4e0f438b8f84aa8e9261c240", "score": "0.7017076", "text": "func (o *Assessmentquestionscore) 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": "6c1d126231febc2e0b30f3ac4e51ea1c", "score": "0.70147383", "text": "func (o *Flowversion) 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": "70261f40e54aed965b66b3c549042fa9", "score": "0.7008673", "text": "func (c Class) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "7462eb31995ca0f7bd9f1c33651e0461", "score": "0.70079106", "text": "func (o *Dialerrule) String() string {\n \n \n \n o.Conditions = []Condition{{}} \n o.Actions = []Dialeraction{{}} \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": "ca774620ae67ba8bc5f87e3d91608649", "score": "0.69989693", "text": "func (g Game) String() string {\n\tjg, _ := json.Marshal(g)\n\treturn string(jg)\n}", "title": "" }, { "docid": "f567f4d9cc26fe5a2b4c893f59399681", "score": "0.69932973", "text": "func (s OutputSerialization) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a80e5b23ee4915c2e43addc35691ab99", "score": "0.6990454", "text": "func (o *Createobjective) String() string {\n \n o.Zones = []Objectivezone{{}} \n \n o.TopicIds = []string{\"\"} \n o.MediaTypes = []string{\"\"} \n o.QueueIds = []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": "2745ac7ea507c32cfddbffafb7732f51", "score": "0.69855314", "text": "func String() (string, error) {\n\tverInfo := versionInfo{\n\t\tVersion: Version,\n\t\tGitShortHash: GitShortHash,\n\t\tBuilt: BuildTime,\n\t}\n\n\tverInfoJSON, err := json.Marshal(verInfo)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"version: failed to marshal version info: %v: %v\", verInfo, err)\n\t}\n\n\treturn string(verInfoJSON), nil\n}", "title": "" }, { "docid": "53384305cea99c20995c3e82f8fad13d", "score": "0.6976536", "text": "func (r Record) String() string {\n return fmt.Sprintf(\"[simp: %q trad: %q pinyin: %q english: %q]\", r.Simp, r.Trad, r.Pinyin, r.English)\n}", "title": "" }, { "docid": "1eb083aaf7a236100539da1df9286041", "score": "0.6974436", "text": "func (s CreateQuantumTaskOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "81cd62e74f3f737aa4f474916ce5bd85", "score": "0.69702286", "text": "func (n *Node) String() string {\n\tbuf := new(bytes.Buffer)\n\tn.print(buf, 0)\n\treturn string(buf.Bytes())\n}", "title": "" }, { "docid": "aaa6e4b43d3c57b4c7a86832cdbdd72d", "score": "0.696803", "text": "func (bez *T) String() string {\n\treturn fmt.Sprintf(\"%s %s %s %s\",\n\t\tbez.P0.String(), bez.P1.String(),\n\t\tbez.P2.String(), bez.P3.String(),\n\t)\n}", "title": "" }, { "docid": "d8f3b98fe1d974bbb19e49ead6a443b3", "score": "0.69663584", "text": "func (o *Createcallrequest) String() string {\n \n \n \n \n \n \n \n \n o.RoutingSkillsIds = []string{\"\"} \n o.ConversationIds = []string{\"\"} \n o.Participants = []Destination{{}} \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": "f17b3e7c6347aebbc9891ab19e6072ae", "score": "0.6962862", "text": "func (s CalculateRouteMatrixOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d798fbd67817a88e5402a939856b9a53", "score": "0.69563717", "text": "func (c Components) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "29fe56f84fefe1d26283f3d907ab0870", "score": "0.6953571", "text": "func (sc stateComponent) String() string {\n\treturn fmt.Sprintf(\"ID:%s, Type:%s, Class:%s, NID:%d, Role:%s\", sc.ID, sc.Type, sc.Class, sc.NID, sc.Role)\n}", "title": "" }, { "docid": "a617ce575f08753fabe0393d338aefe8", "score": "0.6949237", "text": "func (s GetObjectTorrentOutput) 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": "62139d383a9352c35a1017272ea215eb", "score": "0.69460964", "text": "func (s CreateRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "8cb3c5de81427803c32de22ad41884e2", "score": "0.6944171", "text": "func (a Antis) String() string {\n\tja, _ := json.Marshal(a)\n\treturn string(ja)\n}", "title": "" }, { "docid": "87383e35a84c04a5044e15ec5c87659c", "score": "0.69354516", "text": "func (g Games) String() string {\n\tjg, _ := json.Marshal(g)\n\treturn string(jg)\n}", "title": "" }, { "docid": "87383e35a84c04a5044e15ec5c87659c", "score": "0.69354516", "text": "func (g Games) String() string {\n\tjg, _ := json.Marshal(g)\n\treturn string(jg)\n}", "title": "" }, { "docid": "dd312d9ed43050379b479b499e8fd811", "score": "0.69305265", "text": "func (s Spec) String() string {\n\tres := make([]string, 5)\n\tres[0] = \"Status: \" + reform.Inspect(s.Status, true)\n\tres[1] = \"Filename: \" + reform.Inspect(s.Filename, true)\n\tres[2] = \"LineNumber: \" + reform.Inspect(s.LineNumber, true)\n\tres[3] = \"CommitID: \" + reform.Inspect(s.CommitID, true)\n\tres[4] = \"CreatedAt: \" + reform.Inspect(s.CreatedAt, true)\n\treturn strings.Join(res, \", \")\n}", "title": "" }, { "docid": "c888b42fa516bb64f8356548203c1e07", "score": "0.69232535", "text": "func (s DefineExpressionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7f4bbcccf67bc135dbb05e551b36219c", "score": "0.69180065", "text": "func (v version) String() string {\n\treturn string(v)\n}", "title": "" }, { "docid": "c746f062957e541550ffc94162967b06", "score": "0.6911018", "text": "func (s CreateReceiptRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2a7047abe98f55cdae1f8f9737cdce8d", "score": "0.6910465", "text": "func (s GetRawMessageContentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "90d3947115ca45e33d944b1ef0bb05d6", "score": "0.6910086", "text": "func (o *Outcomeeventscore) String() string {\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": "4695cdd7ab10fbe10b475b0a5a2a237e", "score": "0.6901282", "text": "func (s TestDNSAnswerOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4885cf08e9c364b48c7f2d49c8df9678", "score": "0.6898203", "text": "func (x *Rat) String() string", "title": "" }, { "docid": "fd6bdcb061edefea01e1cc2a37078332", "score": "0.68971384", "text": "func (o *Learningmoduleinformstep) String() string {\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": "c655591c051e2135db6fccdfbbea1dc0", "score": "0.6896518", "text": "func (A Accounts) String() string {\n\treturn A.writeXML()\n}", "title": "" }, { "docid": "e4cea371f2b2989690e639e9950a2ce2", "score": "0.6885997", "text": "func (s EnableMacieOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b3e04d34cdac2bf400cb7203f726c8bf", "score": "0.68852645", "text": "func (s RestoreCertificateAuthorityOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "aec3537a77a10d483658684e01e1f449", "score": "0.6883603", "text": "func (s TestRenderTemplateOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "712a9cc6d85a3a1ab32a01c8e60cd601", "score": "0.6879803", "text": "func (b *Binary) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"(\")\n\tsb.WriteString(b.Operator.Lexeme)\n\tsb.WriteString(\" \")\n\tsb.WriteString(b.Left.String())\n\tsb.WriteString(\" \")\n\tsb.WriteString(b.Right.String())\n\tsb.WriteString(\")\")\n\treturn sb.String()\n}", "title": "" }, { "docid": "06b6988992d65aa140e3258ba3a93cef", "score": "0.6878558", "text": "func (s RestoreObjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "447d893eb90b28ea965bfd1b0cf796fe", "score": "0.6870243", "text": "func (g *Game) String() string {\n\tjg, _ := json.Marshal(g)\n\treturn string(jg)\n}", "title": "" }, { "docid": "9b033cab4ea26cecaff8d0dcd7c34b9b", "score": "0.68700796", "text": "func (s *stringer) String() string {\n return string(s.data)\n}", "title": "" }, { "docid": "ac117d500dab5d61e6910b44453a74f1", "score": "0.6868373", "text": "func (c Contratos) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e7629ffc579da02c648cad037e83e4d0", "score": "0.6867409", "text": "func (s CreateActivationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b76314b06d7057f3a3bc93ecdec21520", "score": "0.68670464", "text": "func (s CreateResourceDefinitionVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6bd53f307d46f82cb70fa2bd0bf2edaf", "score": "0.68668526", "text": "func (s SendVoiceMessageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "029903bc8a5b7ad12cbf235053a286b4", "score": "0.6866799", "text": "func (d *SequenceDiagram) String() string { return toString(d) }", "title": "" }, { "docid": "a35002b20d87122946dfdadc9ea4143d", "score": "0.68643457", "text": "func String() string {\n\treturn string(JSON())\n}", "title": "" }, { "docid": "beb0625ef00757a3591d57e639cb2f90", "score": "0.68594575", "text": "func (s UpdateRouteCalculatorOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "8025f47695a150198fb5b6ab12bcf4eb", "score": "0.68574107", "text": "func (s CreateAnomalyDetectorOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "37d07d983159533a650d97deae401221", "score": "0.6857289", "text": "func (xsk *SK) String() string {\n\treturn fmt.Sprintf(\"%x\", xsk.serialize())\n}", "title": "" }, { "docid": "d40ec5ba7a0ee645a5c049425aaadf9a", "score": "0.6856373", "text": "func (of OutputFormat) String() string {\n\treturn string(of)\n}", "title": "" }, { "docid": "e956b308bd2b3e7002b5c3e0f2f9d291", "score": "0.68557215", "text": "func (s ExecuteGremlinQueryOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ab6d8e4ffa02c276637e4fbda71e824", "score": "0.6853781", "text": "func (s CreateThingOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3f1a632e93310c4f56222960d6eedb1c", "score": "0.68502903", "text": "func (s CreatePatchBaselineOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bbab7ca9e7be50e80b0aede77160166d", "score": "0.6843722", "text": "func (s CreateCaseOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5279750ae5344e06aacacad3d45f5087", "score": "0.68410385", "text": "func (s GetObjectOutput) 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": "a27c6f2c4d08aaaaff984e8c1b13b24d", "score": "0.6839273", "text": "func (s DeleteRouteCalculatorOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7f798df7871e2e709220a58cb5480b25", "score": "0.68381226", "text": "func (s CreateResourceOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3f9b199981a4e1345a0566bee40b0dc9", "score": "0.6836858", "text": "func (g Feature) String() string {\n\treturn g.JSON()\n}", "title": "" }, { "docid": "6ebe18c38e96ee3753db3e9737addecc", "score": "0.68365705", "text": "func (s RenewCertificateOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "018196cdcad01969d05f6f46213c6a26", "score": "0.6834549", "text": "func (o *Schedulegenerationwarning) 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": "fb608105c88d8d9b4d83e2bf3a746bb0", "score": "0.68340653", "text": "func (pow *ProofOfWork) String() string {\n\treturn fmt.Sprintf(\"%d$%s$%d\", pow.Bits, base64.StdEncoding.EncodeToString([]byte(pow.Data)), pow.Proof)\n}", "title": "" }, { "docid": "e296f79efad274b1ee2529476cf22803", "score": "0.6833212", "text": "func (s CreateTapesOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a00fef8a863683f38d8f14178d8771fd", "score": "0.68314844", "text": "func (s StartContactRecordingOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "71f910834eed090a5e1f11f4d044794a", "score": "0.68292266", "text": "func (s CreateLicenseVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7c410f7aa74b661bbce07184a32cf96d", "score": "0.6828218", "text": "func (s GetFieldLevelEncryptionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1a07953427d1700328d3c85e14e52ee2", "score": "0.6827104", "text": "func (s SendActivationCodeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cd9cd46e1c2a167461134960f71b7b1b", "score": "0.6825796", "text": "func (i FrameSideInfo) String() string {\n\tstr := \"\"\n\tstr += fmt.Sprintf(\" NDataBegin: %v\\n\", i.NDataBegin())\n\treturn str\n}", "title": "" }, { "docid": "2a9695d6d4471e3c3918037c09ea8126", "score": "0.6823897", "text": "func (o *Subjectdivisiongrants) String() string {\n \n o.Divisions = []Division{{}} \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": "b95fa873ee43e7f8cc2dc963dd9c8268", "score": "0.6823129", "text": "func (s GetQuantumTaskOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0bcfee642a4cedb68d5a16da6f0d361a", "score": "0.6821906", "text": "func (d Databases) String() string {\n\tjd, _ := json.Marshal(d) //nolint:errchkjson\n\treturn string(jd)\n}", "title": "" }, { "docid": "8bb555389652c57f0120c25a3aed3a79", "score": "0.68199235", "text": "func (s *SBool) String() string {\n\treturn fmt.Sprint(*s)\n}", "title": "" }, { "docid": "9810048edb9556797d53431514014128", "score": "0.68161494", "text": "func (s DeletePatchBaselineOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "82bab7334c8fde9585a49aa7f75b22ca", "score": "0.6815921", "text": "func (s DeleteFHIRDatastoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "51e0720d5b211fe544c6bff31c4c5bdb", "score": "0.681579", "text": "func (s QueryLanguageVersion) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4911d14a8bd38fdb0ab3d6cdc570274f", "score": "0.68135107", "text": "func (s CreatePipelineOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5cffc469884407888a214486914a99ce", "score": "0.6812447", "text": "func (s ObjectVersion) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7e02601ea48e78fde14e4697dbc50f36", "score": "0.68123573", "text": "func (s OpenXJsonSerDe) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "792ef5244901c7cacd921482cf3db163", "score": "0.6808788", "text": "func (o *Predictiverouting) 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": "7c9b88633d0c46e5f69db8e84b190924", "score": "0.6808454", "text": "func (s CreateLoggerDefinitionVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7fbb434a1cde960c67c35825e67523bc", "score": "0.68051094", "text": "func (o *Worktypeversion) 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": "6cb501a262e9dff7ddb21b43536b0be2", "score": "0.68044376", "text": "func (s DefineAnalysisSchemeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "82f85525c13e6387fa0fd172ffead5cd", "score": "0.6803043", "text": "func (a Arn) String() string {\n\treturn fmt.Sprintf(\"{Service:%s, AccountID:%s, ResourceID:%s}\", a.Service, a.AccountID, a.ResourceID)\n}", "title": "" }, { "docid": "e279c3f5cbce815af4ea333fe924f849", "score": "0.68030185", "text": "func (s CreateFunctionDefinitionVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "777bb879e4bcbecfb1b5e68162f15da3", "score": "0.68019754", "text": "func (s VerifyTrustOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0545224b6172b31603560985e9d8945a", "score": "0.6800078", "text": "func (o ExportRuleCreateRequestProtocol) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "694636a40918776eb4b46072e4e9325f", "score": "0.6799967", "text": "func (s CreateKeysAndCertificateOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "81298d9e7cc8ba7be587c5b07057f683", "score": "0.6799033", "text": "func (t *Object) String() string {\n\treturn t.SDL()\n}", "title": "" }, { "docid": "09b4e971f70da12d92b94dd018b1048d", "score": "0.6798273", "text": "func (s CreateCertificateAuthorityOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c56713aa0b86717b260d3ef7c35b288c", "score": "0.6796843", "text": "func (o *Wfmagent) String() string {\n \n \n \n \n o.Queues = []Queuereference{{}} \n o.Languages = []Languagereference{{}} \n o.Skills = []Routingskillreference{{}} \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": "9778a44a506538c1ad098df38d8b69f7", "score": "0.67959684", "text": "func (r Resources) String() string {\n\tvar b bytes.Buffer\n\tb.WriteString(\"{\")\n\tr.writeResources(&b)\n\tb.WriteString(\"}\")\n\treturn b.String()\n}", "title": "" }, { "docid": "f7300cc90ebe73c18e9f58e4cfc1f2b6", "score": "0.6795427", "text": "func (t Teams) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "title": "" }, { "docid": "539554306a81391dcbabdf6b2ad71df4", "score": "0.67932236", "text": "func (s JSONOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
3c88933d4846d37fb562e90d53cb832e
AddPlaceDetails will look up the Place on the Google Places API to fill in details. It will not look it up if the Place already has the GooglePlaceID set.
[ { "docid": "5433fb8fa11d26e7d15222a47c64c2f3", "score": "0.83401287", "text": "func AddPlaceDetails(ctx context.Context, apiKey string, places []*Place) error {\n\tc, err := maps.NewClient(maps.WithAPIKey(apiKey))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfieldMask := []maps.PlaceSearchFieldMask{\n\t\tmaps.PlaceSearchFieldMaskName,\n\t\tmaps.PlaceSearchFieldMaskPlaceID,\n\t\tmaps.PlaceSearchFieldMaskFormattedAddress,\n\t\tmaps.PlaceSearchFieldMaskGeometry,\n\t\tmaps.PlaceSearchFieldMaskTypes,\n\t}\n\tfor _, p := range places {\n\t\tif p.GooglePlaceID != \"\" {\n\t\t\t// skip places that are already filled in (saves an API call)\n\t\t\tcontinue\n\t\t}\n\n\t\ttitle, err := getSearchQuery(p)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresp, err := c.FindPlaceFromText(ctx, &maps.FindPlaceFromTextRequest{\n\t\t\tInput: title,\n\t\t\tInputType: maps.FindPlaceFromTextInputTypeTextQuery,\n\t\t\tLocationBias: maps.FindPlaceFromTextLocationBiasCircular,\n\t\t\tLocationBiasRadius: 20,\n\t\t\tLocationBiasCenter: &p.Geometry.Location,\n\t\t\tFields: fieldMask,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(resp.Candidates) > 1 {\n\t\t\treturn fmt.Errorf(\"found more than one place for %v\", resp.Candidates)\n\t\t}\n\n\t\terr = p.fromPlacesSearchResult(resp.Candidates[0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "2287d84ae82cbb07729c7ba9dcf7c4bd", "score": "0.722598", "text": "func PlaceDetails(id string) (maps.PlaceDetailsResult, error) {\n\tif id == \"\" {\n\t\treturn maps.PlaceDetailsResult{}, errors.New(\"Invalid place ID\")\n\t}\n\treq := &maps.PlaceDetailsRequest{PlaceID: id}\n\tctx := context.Background()\n\n\treturn MapClient().PlaceDetails(ctx, req)\n}", "title": "" }, { "docid": "17b9944083757da6118d6aab2514f980", "score": "0.7052266", "text": "func AddPlaceDetailsForID(ctx context.Context, apiKey string, places []*Place) error {\n\tc, err := maps.NewClient(maps.WithAPIKey(apiKey))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfieldMask := []maps.PlaceDetailsFieldMask{\n\t\tmaps.PlaceDetailsFieldMaskName,\n\t\tmaps.PlaceDetailsFieldMaskPlaceID,\n\t\tmaps.PlaceDetailsFieldMaskFormattedAddress,\n\t\tmaps.PlaceDetailsFieldMaskGeometry,\n\t\tmaps.PlaceDetailsFieldMaskTypes,\n\t}\n\tfor _, p := range places {\n\n\t\tresp, err := c.PlaceDetails(ctx, &maps.PlaceDetailsRequest{\n\t\t\tPlaceID: p.GooglePlaceID,\n\t\t\tFields: fieldMask,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = p.fromPlaceDetailsResult(resp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a74ade846e67fc41f08f5b3311fb347a", "score": "0.64071774", "text": "func GetDetails(placeID string) (maps.PlaceDetailsResult, error) {\n\treq := &maps.PlaceDetailsRequest{\n\t\tPlaceID: placeID,\n\t}\n\n\tmapsClient, err := globals.GetMapClient()\n\tif err != nil {\n\t\tpretty.Printf(\"fatal error: %s \\n\", err)\n\t\treturn maps.PlaceDetailsResult{}, err\n\t}\n\n\tres, err := mapsClient.PlaceDetails(context.Background(), req)\n\tif err != nil {\n\t\tpretty.Printf(\"fatal error: %s \\n\", err)\n\t\treturn maps.PlaceDetailsResult{}, err\n\t}\n\n\tif err != nil {\n\t\tpretty.Printf(\"fatal error: %s \\n\", err)\n\t\treturn maps.PlaceDetailsResult{}, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "964353d3ce774495046c4b8c15c67883", "score": "0.5670067", "text": "func (m *PlaceDB) Add(ctx context.Context, model *Place) error {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"place\", \"add\"}, time.Now())\n\n\terr := m.Db.Create(model).Error\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"error adding Place\", \"error\", err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dd3372b6a77ccefd2c33001c289adfd4", "score": "0.5644418", "text": "func NewPlace(ctx context.Context, zoneID int, placetype string,\n\tgeo string, deviceID int) (PlaceResponse, error) {\n\tctx, cancel := context.WithTimeout(ctx, 5*time.Second)\n\tdefer cancel()\n\n\tvar place PlaceResponse\n\n\tplace.PlaceID = -1\n\n\terr := pool.QueryRowContext(ctx,\n\t\t`INSERT INTO places\n\t\t(\n\t\t\tzone_id, \n\t\t\ttype,\n\t\t\tgeo,\n\t\t\tdevice_id\n\t\t) VALUES\n\t\t(\n\t\t\t$1,\n\t\t\t$2,\n\t\t\t$3,\n\t\t\t$4\n\t\t) RETURNING place_id`, zoneID, placetype, geo, deviceID).Scan(&place.PlaceID)\n\n\tif err == sql.ErrNoRows {\n\t\tlog.Printf(\"no place created\\n\")\n\t\treturn place, err\n\t}\n\n\tif err != nil {\n\t\tlog.Printf(\"query error: %v\\n\", err)\n\t\treturn place, err\n\t}\n\n\treturn place, nil\n}", "title": "" }, { "docid": "991bb7180555060731638f77b85ac16a", "score": "0.56195277", "text": "func (s *PlacesService) CreatePlace(placeCreateRequest *PlaceCreateRequest) (*Place, *resty.Response, error) {\n\n\tpath := \"/places/\"\n\n\tresponse, err := s.client.R().\n\t\tSetBody(placeCreateRequest).\n\t\tSetResult(&Place{}).\n\t\tSetError(&Error{}).\n\t\tPost(path)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresult := response.Result().(*Place)\n\treturn result, response, err\n\n}", "title": "" }, { "docid": "b6f9548dc57bdb3ef77aa57adb83dcd4", "score": "0.5516137", "text": "func (h *WorkplaceHandler) Add(w http.ResponseWriter, r *http.Request) {\n\tvar request model.WorkplaceInfo\n\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"invalid request: %s\", err), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif err := h.service.Add(r.Context(), &request); err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"error to add workplace info: %s\", err.Error()), err.Code())\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "5145abb879a07eb90ac8c457b4440024", "score": "0.54501414", "text": "func (places *Places) AddPlace(item Place) []Place {\n\tplaces.Items = append(places.Items, item)\n\treturn places.Items\n}", "title": "" }, { "docid": "3088eb59aebf38a4edf82c1a473eb450", "score": "0.53438455", "text": "func (spec *WOFPlacetypeSpecification) AppendPlacetype(pt WOFPlacetype) error {\n\n\tspec.mu.Lock()\n\tdefer spec.mu.Unlock()\n\n\texisting_pt, _ := spec.GetPlacetypeById(pt.Id)\n\n\tif existing_pt != nil {\n\t\treturn fmt.Errorf(\"Placetype ID %d (%s) already registered\", pt.Id, pt.Name)\n\t}\n\n\texisting_pt, _ = spec.GetPlacetypeByName(pt.Name)\n\n\tif existing_pt != nil {\n\t\treturn fmt.Errorf(\"Placetype name '%s' (%d) already registered\", pt.Name, pt.Id)\n\t}\n\n\t/*\n\n\t\tWe used to do this but it makes merging external specifications problematic and I\n\t\tno longer even remember why it seemed necessary in the first place...\n\t\t(20230302/thisisaaronland)\n\n\t\tfor _, pid := range pt.Parent {\n\n\t\t\t_, err := spec.GetPlacetypeById(pid)\n\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to get placetype by ID %d, %w\", pid, err)\n\t\t\t}\n\t\t}\n\t*/\n\n\tstr_id := strconv.FormatInt(pt.Id, 10)\n\tspec.catalog[str_id] = pt\n\treturn nil\n}", "title": "" }, { "docid": "16c2d9d8dad1b53a4fecc093bd517c22", "score": "0.52209896", "text": "func (s *PlacesService) GetPlace(placeID string) (*Place, *resty.Response, error) {\n\n\tpath := \"/places/{placeId}\"\n\tpath = strings.Replace(path, \"{\"+\"placeId\"+\"}\", fmt.Sprintf(\"%v\", placeID), -1)\n\n\tresponse, err := s.client.R().\n\t\tSetResult(&Place{}).\n\t\tSetError(&Error{}).\n\t\tGet(path)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresult := response.Result().(*Place)\n\treturn result, response, err\n\n}", "title": "" }, { "docid": "75840a0e41463182f33330936a5cd5f7", "score": "0.51930135", "text": "func (m *Place) PlaceToPlace() *app.Place {\n\tplace := &app.Place{}\n\tplace.CityID = m.CityID\n\tplace.CityName = m.CityName\n\tplace.GooglePlaceID = m.GooglePlaceID\n\tplace.ID = m.ID\n\tplace.Latitude = m.Latitude\n\tplace.Longitude = m.Longitude\n\tplace.Name = m.Name\n\tplace.Type = m.Type\n\n\treturn place\n}", "title": "" }, { "docid": "93fee89fa12dd58b412e5e4e4ca60073", "score": "0.51406413", "text": "func GetPlace(ctx context.Context, placeID int) (Place, error) {\n\tctx, cancel := context.WithTimeout(ctx, 5*time.Second)\n\tdefer cancel()\n\n\tvar place Place\n\n\terr := pool.QueryRowContext(ctx, `\n\t\tSELECT place_id, zone_id, type, geo, device_id, created_at, updated_at\n\t\tFROM places \n\t\tWHERE place_id = $1\n\t`, placeID).\n\t\tScan(&place.PlaceID, &place.ZoneID, &place.Type, &place.Geography, &place.DeviceID,\n\t\t\t&place.CreatedAt, &place.UpdatedAt)\n\n\tif err != nil {\n\t\treturn place, err\n\t}\n\n\treturn place, nil\n}", "title": "" }, { "docid": "f6017a66d8bff026a7f694fc044e373b", "score": "0.5105112", "text": "func AppendPlacetype(pt WOFPlacetype) error {\n\treturn specification.AppendPlacetype(pt)\n}", "title": "" }, { "docid": "0663c82cd8eb89abbc6b7aaca6641697", "score": "0.50297296", "text": "func (p *Place) fromPlaceDetailsResult(s maps.PlaceDetailsResult) error {\n\tp.FormattedAddress = s.FormattedAddress\n\t// overwrite the geometry from places API since it has more info\n\tp.Geometry = s.Geometry\n\tp.Categories = s.Types\n\n\treturn nil\n}", "title": "" }, { "docid": "3e597252bdc8f43580a7e256b473be09", "score": "0.4995031", "text": "func (s *Server) Create(c *gin.Context) {\r\n\tvar item entities.Place\r\n\r\n\tif err := c.ShouldBindWith(&item, binding.JSON); err != nil {\r\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\r\n\t\treturn\r\n\t}\r\n\r\n\titem.Id = bson.NewObjectId()\r\n\r\n\tres, err := s.PlacesUsecase.Create(&item)\r\n\tif err != nil {\r\n\t\tif err != errors.New(entities.ErrNotFound) {\r\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\r\n\t\t\treturn\r\n\t\t}\r\n\t\tc.JSON(http.StatusNotFound, gin.H{\"error\": err.Error()})\r\n\t\treturn\r\n\t}\r\n\tc.JSON(http.StatusOK, res)\r\n}", "title": "" }, { "docid": "699dee7706cfc98b3bd3894d254fe685", "score": "0.4972876", "text": "func CreatePlace(w http.ResponseWriter, r *http.Request) {\n //params := mux.Vars(r)\n user := getUser(w,r)\n if (user!=nil && checkDBadmin(user.Sub)){\n var place Place\n _ = json.NewDecoder(r.Body).Decode(&place)\n insertPlace(place, w)\n w.Write([]byte(\"entered production\"))\n } else {\n var place Place\n _ = json.NewDecoder(r.Body).Decode(&place)\n insertSuggestedPlace(place, w)\n w.Write([]byte(\"Suggested\"))\n }\n}", "title": "" }, { "docid": "b1ee3c55d919c3909a8355fca746af80", "score": "0.49365568", "text": "func UpdatePlace(ctx context.Context, placeID int, zoneID int,\n\tplacetype string, geo string, deviceID int) (PlaceResponse, error) {\n\tctx, cancel := context.WithTimeout(ctx, 5*time.Second)\n\tdefer cancel()\n\n\tvar place PlaceResponse\n\n\tplace.PlaceID = -1\n\n\tif (zoneID == 0) && (placetype == \"\") && (geo == \"\") && (deviceID == 0) {\n\t\treturn place, errors.New(\"invalid input fields (database/places.go\")\n\t}\n\n\t// modify zoneID\n\tif zoneID != 0 {\n\t\terr := pool.QueryRowContext(ctx, `\n\t\t\tUPDATE places SET zone_id = $1 \n\t\t\tWHERE place_id = $2 RETURNING place_id\n\t\t`, zoneID, placeID).Scan(&place.PlaceID)\n\n\t\tif err == sql.ErrNoRows {\n\t\t\tlog.Printf(\"no place with id %d\\n\", placeID)\n\t\t\treturn place, err\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"query error: %v\\n\", err)\n\t\t\treturn place, err\n\t\t}\n\t}\n\n\t// modify type\n\tif placetype != \"\" {\n\t\terr := pool.QueryRowContext(ctx, `\n\t\t\tUPDATE places SET type = $1 \n\t\t\tWHERE place_id = $2 RETURNING place_id\n\t\t`, placetype, placeID).Scan(&place.PlaceID)\n\n\t\tif err == sql.ErrNoRows {\n\t\t\tlog.Printf(\"no place with id %d\\n\", placeID)\n\t\t\treturn place, err\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"query error: %v\\n\", err)\n\t\t\treturn place, err\n\t\t}\n\t}\n\n\t// modify geo\n\tif geo != \"\" {\n\t\terr := pool.QueryRowContext(ctx, `\n\t\t\tUPDATE places SET geo = $1 \n\t\t\tWHERE place_id = $2 RETURNING place_id\n\t\t`, geo, placeID).Scan(&place.PlaceID)\n\n\t\tif err == sql.ErrNoRows {\n\t\t\tlog.Printf(\"no place with id %d\\n\", placeID)\n\t\t\treturn place, err\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"query error: %v\\n\", err)\n\t\t\treturn place, err\n\t\t}\n\t}\n\n\t// modify deviceID\n\tif deviceID != 0 {\n\t\terr := pool.QueryRowContext(ctx, `\n\t\t\tUPDATE places SET device_id = $1 \n\t\t\tWHERE place_id = $2 RETURNING place_id\n\t\t`, deviceID, placeID).Scan(&place.PlaceID)\n\n\t\tif err == sql.ErrNoRows {\n\t\t\tlog.Printf(\"no place with id %d\\n\", placeID)\n\t\t\treturn place, err\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"query error: %v\\n\", err)\n\t\t\treturn place, err\n\t\t}\n\t}\n\n\treturn place, nil\n}", "title": "" }, { "docid": "509e6dc9e80a2b07b92335fb8bb8b41b", "score": "0.49162665", "text": "func withPlaceID(id int) placeOption {\n\treturn func(m *PlaceMutation) {\n\t\tvar (\n\t\t\terr error\n\t\t\tonce sync.Once\n\t\t\tvalue *Place\n\t\t)\n\t\tm.oldValue = func(ctx context.Context) (*Place, 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().Place.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": "086088361cf3db10b6127d68c8beaf3b", "score": "0.4889664", "text": "func (o *UpdateSourceDevice200Response) SetPlace(v float32) {\n\to.Place = v\n}", "title": "" }, { "docid": "b6248aaa2ed79a0030f15eec830bf93a", "score": "0.48656705", "text": "func (m *PlaceDB) OnePlace(ctx context.Context, id int) (*app.Place, error) {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"place\", \"oneplace\"}, time.Now())\n\n\tvar native Place\n\terr := m.Db.Scopes().Table(m.TableName()).Where(\"id = ?\", id).Find(&native).Error\n\n\tif err != nil && err != gorm.ErrRecordNotFound {\n\t\tgoa.LogError(ctx, \"error getting Place\", \"error\", err.Error())\n\t\treturn nil, err\n\t}\n\n\tview := *native.PlaceToPlace()\n\treturn &view, err\n}", "title": "" }, { "docid": "3777b69f615e1a0187187512556975b6", "score": "0.47928047", "text": "func (s *PlacesService) UpdatePlace(placeID string, placeUpdateRequest *PlaceUpdateRequest) (*Place, *resty.Response, error) {\n\n\tpath := \"/places/{placeId}\"\n\tpath = strings.Replace(path, \"{\"+\"placeId\"+\"}\", fmt.Sprintf(\"%v\", placeID), -1)\n\n\tresponse, err := s.client.R().\n\t\tSetBody(placeUpdateRequest).\n\t\tSetResult(&Place{}).\n\t\tSetError(&Error{}).\n\t\tPut(path)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresult := response.Result().(*Place)\n\treturn result, response, err\n\n}", "title": "" }, { "docid": "f4a6c8dea81b8105abd8438475e54947", "score": "0.47737867", "text": "func NewPlaceDB(db *gorm.DB) *PlaceDB {\n\treturn &PlaceDB{Db: db}\n}", "title": "" }, { "docid": "4c94baa7fdf3060f3c2d7df2409ff7f7", "score": "0.475632", "text": "func (cli *OpsGenieAlertV2Client) AddDetails(req alertsv2.AddDetailsRequest) (*AsyncRequestResponse, error) {\n\treturn cli.sendAsyncPostRequest(&req)\n}", "title": "" }, { "docid": "e334cf2b24094db400e8994c759f7f92", "score": "0.47520244", "text": "func (drc *DataRoomCreate) AddDetails(f ...*FurnitureDetail) *DataRoomCreate {\n\tids := make([]int, len(f))\n\tfor i := range f {\n\t\tids[i] = f[i].ID\n\t}\n\treturn drc.AddDetailIDs(ids...)\n}", "title": "" }, { "docid": "0a69968c3f65f2f505d8a6bb7b6b68ec", "score": "0.47121805", "text": "func (s *SmartContract) PlaceQuote(ctx contractapi.TransactionContextInterface, quoteId string, vendorId string, desc string,\n\titemsList string, buyerId string, quoteDate string, totalAmount string,\n\textimatedDeliveryDate string, status string) error {\n\texists, err := s.IsExists(ctx, quoteId)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif exists {\n\t\treturn fmt.Errorf(\"the quote %s already exists\", quoteId)\n\t}\n\n\tquote := Quote{\n\t\tQuoteId: quoteId,\n\t\tVendorId: vendorId,\n\t\tDesc: desc,\n\t\tItemsList: itemsList,\n\t\tBuyerId: buyerId,\n\t\tQuoteDate: quoteDate,\n\t\tTotalAmount: totalAmount,\n\t\tEstimatedDeliveryDate: extimatedDeliveryDate,\n\t\tStatus: status,\n\t}\n\tquoteJSON, err := json.Marshal(quote)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ctx.GetStub().PutState(quoteId, quoteJSON)\n}", "title": "" }, { "docid": "d47f7ea5bcea1c90bae9e9eb38d5b9cd", "score": "0.4700411", "text": "func (o GoogleCloudRetailV2betaLocalInventoryResponseOutput) PlaceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleCloudRetailV2betaLocalInventoryResponse) string { return v.PlaceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8a323b265e916a75d8d823ce97de43a0", "score": "0.4690662", "text": "func NewPlaces(log *zap.SugaredLogger, mapsClient clients.Client) Places {\n\treturn Places{\n\t\tlog: log,\n\t\tmapsClient: mapsClient,\n\t}\n}", "title": "" }, { "docid": "4ebd150a91ad024f8155a849695e1944", "score": "0.46903569", "text": "func GetPlacetypeById(id int64) (*WOFPlacetype, error) {\n\treturn specification.GetPlacetypeById(id)\n}", "title": "" }, { "docid": "a06e07fbc82e9fd93570e6d0bb7cb8af", "score": "0.46841127", "text": "func (b *BankAccountParams) AppendDetails(values *url.Values) {\n\tvalues.Add(\"bank_account[country]\", b.Country)\n\tvalues.Add(\"bank_account[routing_number]\", b.Routing)\n\tvalues.Add(\"bank_account[account_number]\", b.Account)\n}", "title": "" }, { "docid": "74712f2cb3081046d64536fbbf7cde62", "score": "0.46061325", "text": "func (ftuo *FurnitureTypeUpdateOne) AddDetails(f ...*FurnitureDetail) *FurnitureTypeUpdateOne {\n\tids := make([]int, len(f))\n\tfor i := range f {\n\t\tids[i] = f[i].ID\n\t}\n\treturn ftuo.AddDetailIDs(ids...)\n}", "title": "" }, { "docid": "db7b2ee8f89ed014b0bf1ef90fedd32b", "score": "0.4593894", "text": "func (puo *PlaceUpdateOne) AddPlaceActi(a ...*Activity) *PlaceUpdateOne {\n\tids := make([]int, len(a))\n\tfor i := range a {\n\t\tids[i] = a[i].ID\n\t}\n\treturn puo.AddPlaceActiIDs(ids...)\n}", "title": "" }, { "docid": "02a4ce99e467d754391ea26b8652fefc", "score": "0.4574353", "text": "func (ftu *FurnitureTypeUpdate) AddDetails(f ...*FurnitureDetail) *FurnitureTypeUpdate {\n\tids := make([]int, len(f))\n\tfor i := range f {\n\t\tids[i] = f[i].ID\n\t}\n\treturn ftu.AddDetailIDs(ids...)\n}", "title": "" }, { "docid": "45a769976ec4b538e046a48408ee4b8d", "score": "0.45639968", "text": "func (o *Order) Place() error {\n\tif int(o.UserID) > len(Data.Users)-1 {\n\t\treturn UserNotExistErr\n\t}\n\n\tuser := Data.Users[o.UserID]\n\tif !user.CheckBalanceForOrder(*o) {\n\t\treturn BalanceNotEnoughErr\n\t}\n\n\to.Remain = o.Quantity\n\to.CreatedAt = time.Now().UnixNano()\n\n\tData.Orders = append(Data.Orders, o)\n\tuser.Orders = append(user.Orders, o)\n\treturn nil\n}", "title": "" }, { "docid": "6fa81fe33e301ddfde348a642957af1e", "score": "0.4554488", "text": "func (a *Client) PlaceGet(params *PlaceGetParams) (*PlaceGetOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPlaceGetParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Place_Get\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/Place/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/xml\", \"text/json\", \"text/xml\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PlaceGetReader{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.(*PlaceGetOK)\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 Place_Get: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "5281350bf290970b9ca53a9171aa50e5", "score": "0.45377594", "text": "func (m *Location) Find(api string) error {\n\tstart := time.Now()\n\tdb := Db()\n\n\tif err := db.Preload(\"Place\").First(m, \"id = ?\", m.ID).Error; err == nil {\n\t\tlog.Infof(\"location: found %s (%+v)\", m.ID, m)\n\t\treturn nil\n\t}\n\n\tl := &maps.Location{\n\t\tID: s2.NormalizeToken(m.ID),\n\t}\n\n\tif err := l.QueryApi(api); err != nil {\n\t\tlog.Errorf(\"location: %s failed %s\", m.ID, err)\n\t\treturn err\n\t}\n\n\tif place := FindPlace(l.PrefixedToken(), l.Label()); place != nil {\n\t\tm.Place = place\n\t} else {\n\t\tplace = &Place{\n\t\t\tID: l.PrefixedToken(),\n\t\t\tLocLabel: l.Label(),\n\t\t\tLocCity: l.City(),\n\t\t\tLocState: l.State(),\n\t\t\tLocCountry: l.CountryCode(),\n\t\t\tLocKeywords: l.KeywordString(),\n\t\t\tPhotoCount: 1,\n\t\t}\n\n\t\tif err := place.Create(); err != nil {\n\t\t\tlog.Errorf(\"place: failed adding %s %s\", place.ID, err.Error())\n\t\t\tm.Place = &UnknownPlace\n\t\t} else {\n\t\t\tevent.Publish(\"count.places\", event.Data{\n\t\t\t\t\"count\": 1,\n\t\t\t})\n\n\t\t\tlog.Infof(\"place: added %s [%s]\", place.ID, time.Since(start))\n\n\t\t\tm.Place = place\n\t\t}\n\t}\n\n\tm.PlaceID = m.Place.ID\n\tm.LocName = l.Name()\n\tm.LocCategory = l.Category()\n\tm.LocSource = l.Source()\n\n\tif err := db.Create(m).Error; err == nil {\n\t\tlog.Infof(\"location: added %s [%s]\", m.ID, time.Since(start))\n\t\treturn nil\n\t} else if err := db.Preload(\"Place\").First(m, \"id = ?\", m.ID).Error; err != nil {\n\t\tlog.Errorf(\"location: failed adding %s %s [%s]\", m.ID, err.Error(), time.Since(start))\n\t\treturn err\n\t} else {\n\t\tlog.Infof(\"location: found %s after second try [%s]\", m.ID, time.Since(start))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c4a18a588077454bc92babe626b24add", "score": "0.45326495", "text": "func (s *PlacesService) DeletePlace(placeID string) (*resty.Response, error) {\n\n\tpath := \"/places/{placeId}\"\n\tpath = strings.Replace(path, \"{\"+\"placeId\"+\"}\", fmt.Sprintf(\"%v\", placeID), -1)\n\n\tresponse, err := s.client.R().\n\t\tDelete(path)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, err\n\n}", "title": "" }, { "docid": "1255b270517f7645eddc858eea8d41de", "score": "0.45234185", "text": "func (r *ProjectsLocationsCatalogsBranchesProductsService) AddFulfillmentPlaces(product string, googlecloudretailv2addfulfillmentplacesrequest *GoogleCloudRetailV2AddFulfillmentPlacesRequest) *ProjectsLocationsCatalogsBranchesProductsAddFulfillmentPlacesCall {\n\tc := &ProjectsLocationsCatalogsBranchesProductsAddFulfillmentPlacesCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.product = product\n\tc.googlecloudretailv2addfulfillmentplacesrequest = googlecloudretailv2addfulfillmentplacesrequest\n\treturn c\n}", "title": "" }, { "docid": "7a23a34d6ac83f14af5233b8a1299c16", "score": "0.45205736", "text": "func (m *PlaceDB) Get(ctx context.Context, id int) (*Place, error) {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"place\", \"get\"}, time.Now())\n\n\tvar native Place\n\terr := m.Db.Table(m.TableName()).Where(\"id = ?\", id).Find(&native).Error\n\tif err == gorm.ErrRecordNotFound {\n\t\treturn nil, err\n\t}\n\n\treturn &native, err\n}", "title": "" }, { "docid": "bfa0539935904d5249a4118be22108f6", "score": "0.45144746", "text": "func (c *client) PlaceOrder(ctx context.Context, req PlaceOrderRequest) (*PlaceExecutionReport, error) {\n\tvar response PlaceExecutionReport\n\n\tif err := c.getResource(ctx, BettingURL+placeOrders, req, &response); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &response, nil\n}", "title": "" }, { "docid": "dcf7c0caba36a599ef2abf98d7f37104", "score": "0.4489433", "text": "func (details *ErrorDetails) Add(key, val string) {\n\tif (*details)[key] != \"\" {\n\t\t(*details)[key] += \" | \"\n\t}\n\t(*details)[key] += val\n}", "title": "" }, { "docid": "76fa9c3c477b22922213fb92c9374900", "score": "0.44819385", "text": "func DeletePlace(ctx context.Context, placeID int) (bool, error) {\n\tctx, cancel := context.WithTimeout(ctx, 5*time.Second)\n\tdefer cancel()\n\n\t// update the device id into places\n\tresult, err := pool.ExecContext(ctx, `\n\t\tDELETE FROM places WHERE place_id = $1\n\t`, placeID)\n\n\tif err != nil {\n\t\tlog.Printf(\"query error: %v\\n\", err)\n\t\treturn false, err\n\t}\n\n\treturn checkDeletion(result)\n}", "title": "" }, { "docid": "1683214fd6ae45b89d9fac5e3705b4dd", "score": "0.44647554", "text": "func (puo *PlaceUpdateOne) SetPLACE(s string) *PlaceUpdateOne {\n\tpuo.mutation.SetPLACE(s)\n\treturn puo\n}", "title": "" }, { "docid": "284c21313b8ff8bd6d2e918ed2b83d78", "score": "0.44454235", "text": "func (t *Trips) UpdateTripPlaces(w rest.ResponseWriter, r *rest.Request) {\n\tid := r.PathParam(\"id\")\n\tres, err := rethink.Table(tableName).Get(id).Run(t.Conn)\n\tif err != nil {\n\t\trest.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif res.IsNil() {\n\t\trest.NotFound(w, r)\n\t\treturn\n\t}\n\tvar trip *Trip\n\tres.One(&trip)\n\n\ttripPlaces := []TripPlace{}\n\terr = r.DecodeJsonPayload(&tripPlaces)\n\tif err != nil {\n\t\trest.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\ttrip.Updated = time.Now()\n\ttrip.Places = tripPlaces\n\ttrip.TotalPlaces = len(tripPlaces)\n\n\t_, err = rethink.Table(tableName).Get(id).Update(trip).RunWrite(t.Conn)\n\tif err != nil {\n\t\trest.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteJson(&trip)\n}", "title": "" }, { "docid": "6f1572afb747f959da84211b2c3f7662", "score": "0.44342297", "text": "func (a *Client) PlaceMetaPlaceTypes(params *PlaceMetaPlaceTypesParams) (*PlaceMetaPlaceTypesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPlaceMetaPlaceTypesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Place_MetaPlaceTypes\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/Place/Meta/PlaceTypes\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/xml\", \"text/json\", \"text/xml\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PlaceMetaPlaceTypesReader{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.(*PlaceMetaPlaceTypesOK)\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 Place_MetaPlaceTypes: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "b7dd2c5ea8be3ea82ec2c0c349767306", "score": "0.4430095", "text": "func (pu *PlaceUpdate) SetPLACE(s string) *PlaceUpdate {\n\tpu.mutation.SetPLACE(s)\n\treturn pu\n}", "title": "" }, { "docid": "0b4ead6629207d7234cb124d5fa4a5f6", "score": "0.44179854", "text": "func (pu *PlaceUpdate) AddPlaceActi(a ...*Activity) *PlaceUpdate {\n\tids := make([]int, len(a))\n\tfor i := range a {\n\t\tids[i] = a[i].ID\n\t}\n\treturn pu.AddPlaceActiIDs(ids...)\n}", "title": "" }, { "docid": "d970fafb1d7c2e79eb3eeca80a588832", "score": "0.4415589", "text": "func FindPlace(id string, label string) *Place {\n\tplace := &Place{}\n\n\tif label == \"\" {\n\t\tif err := Db().First(place, \"id = ?\", id).Error; err != nil {\n\t\t\tlog.Debugf(\"place: %s for id %s\", err.Error(), id)\n\t\t\treturn nil\n\t\t}\n\t} else if err := Db().First(place, \"id = ? OR loc_label = ?\", id, label).Error; err != nil {\n\t\tlog.Debugf(\"place: %s for id %s / label %s\", err.Error(), id, txt.Quote(label))\n\t\treturn nil\n\t}\n\n\treturn place\n}", "title": "" }, { "docid": "40c697818a63b9c8b7e9c4fca75e13b6", "score": "0.44055116", "text": "func GetPlaceFor(zipcode string, client *http.Client) (ZippoPlace, error) {\n\tzippo, err := GetDetailsFor(zipcode, client)\n\tif err != nil {\n\t\treturn ZippoPlace{}, err\n\t}\n\tif len(zippo.Places) != 1 {\n\t\treturn ZippoPlace{}, fmt.Errorf(\"error in zippo response: zipcode returned more than one city for zipcode: %s\", zipcode)\n\t}\n\treturn zippo.Places[0], nil\n}", "title": "" }, { "docid": "d1b567feae3e9ecf475b499a2343801e", "score": "0.4391694", "text": "func (a *Adapter) PlaceOrder(ctx context.Context, order persistence.PlacedOrder) error {\n\tlog.Print(order)\n\treturn nil\n}", "title": "" }, { "docid": "c831dbc519c5ac665038b1b840d39d1e", "score": "0.4389359", "text": "func AppendPlacetypeSpecification(spec *WOFPlacetypeSpecification) error {\n\treturn specification.AppendPlacetypeSpecification(spec)\n}", "title": "" }, { "docid": "9a98b45912a60812199f2d306261b7bf", "score": "0.4374533", "text": "func (p *Place) fromPlacesSearchResult(s maps.PlacesSearchResult) error {\n\t// don't change the name or formatted address because these are used for the db ID\n\tp.GooglePlaceID = s.PlaceID\n\t// overwrite the geometry from places API since it has more info\n\tp.Geometry = s.Geometry\n\tp.Categories = s.Types\n\n\treturn nil\n}", "title": "" }, { "docid": "c26c3925db383ac7ec079580106a0449", "score": "0.43739554", "text": "func FirstOrCreatePlace(m *Place) *Place {\n\tif m.ID == \"\" {\n\t\tlog.Errorf(\"place: id must not be empty\")\n\t\treturn nil\n\t}\n\n\tif m.LocLabel == \"\" {\n\t\tlog.Errorf(\"place: label must not be empty (id %s)\", m.ID)\n\t\treturn nil\n\t}\n\n\tresult := Place{}\n\n\tif err := Db().Where(\"id = ? OR loc_label = ?\", m.ID, m.LocLabel).First(&result).Error; err == nil {\n\t\treturn &result\n\t} else if err := m.Create(); err != nil {\n\t\tlog.Errorf(\"place: %s\", err)\n\t\treturn nil\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "42eb68c0783787cc81b9438517362259", "score": "0.43696094", "text": "func (o *UpdateSourceDevice200Response) GetPlace() float32 {\n\tif o == nil {\n\t\tvar ret float32\n\t\treturn ret\n\t}\n\n\treturn o.Place\n}", "title": "" }, { "docid": "010d4828124ce6351ed9378f53b9ef69", "score": "0.43428215", "text": "func (m *PlaceMutation) AddField(name string, value ent.Value) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Place numeric field %s\", name)\n}", "title": "" }, { "docid": "fae4f00d62b18d0fb0d7aeab77334485", "score": "0.43176508", "text": "func (p *Places) GetPlaces(input string, radius uint, location maps.LatLng) maps.AutocompleteResponse {\n\tr := &maps.PlaceAutocompleteRequest{\n\t\tInput: input,\n\t\tRadius: radius,\n\t\tLocation: &location,\n\t}\n\n\tres, err := p.mapsClient.C.PlaceAutocomplete(context.Background(), r)\n\tif err != nil {\n\t\tp.log.Fatalf(\"fatal error: %s\", err)\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "c77fb288c58bffde934815dba0823af6", "score": "0.42897284", "text": "func (mr *MockAdminRestaurantRepoMockRecorder) AddAddress(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddAddress\", reflect.TypeOf((*MockAdminRestaurantRepo)(nil).AddAddress), arg0, arg1, arg2)\n}", "title": "" }, { "docid": "0afb8aa449d6ead6897d3d7b747fa841", "score": "0.42854184", "text": "func (s *Server) PlaceWager(c *gin.Context) {\n\tvar req serializers.PlaceWagerReq\n\tif err := c.ShouldBindJSON(&req); err != nil {\n\t\trespondError(c, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\twager, err := s.wagerSrv.PlaceWager(&req)\n\tif err != nil {\n\t\trespondError(c, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusCreated, wager)\n}", "title": "" }, { "docid": "1f295d29556eb245d9d56861b700b4d1", "score": "0.42718834", "text": "func (m *PlaceDB) Update(ctx context.Context, model *Place) error {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"place\", \"update\"}, time.Now())\n\n\tobj, err := m.Get(ctx, model.ID)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"error updating Place\", \"error\", err.Error())\n\t\treturn err\n\t}\n\terr = m.Db.Model(obj).Updates(model).Error\n\n\treturn err\n}", "title": "" }, { "docid": "ec432b56d05355a1e63d69b986d1fdba", "score": "0.42667857", "text": "func (bitvavo Bitvavo) PlaceOrder(market string, side string, orderType string, body map[string]string) (Order, error) {\n body[\"market\"] = market\n body[\"side\"] = side\n body[\"orderType\"] = orderType\n jsonResponse := bitvavo.sendPrivate(\"/order\", \"\", body, \"POST\")\n var t Order\n err := json.Unmarshal(jsonResponse, &t)\n if err != nil {\n return Order{}, MyError{Err: err}\n }\n if t.OrderId == \"\" {\n return Order{}, handleAPIError(jsonResponse)\n }\n return t, nil\n}", "title": "" }, { "docid": "4ba6a692346ea7a4a4c326c20fed31f8", "score": "0.42565593", "text": "func (spec *WOFPlacetypeSpecification) GetPlacetypeById(id int64) (*WOFPlacetype, error) {\n\n\tfor str_id, pt := range spec.catalog {\n\n\t\tpt_id, err := strconv.Atoi(str_id)\n\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tpt_id64 := int64(pt_id)\n\n\t\tif pt_id64 == id {\n\t\t\tpt.Id = pt_id64\n\t\t\treturn &pt, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"Invalid placetype\")\n}", "title": "" }, { "docid": "177a965b169cd404dd723435abe0f80c", "score": "0.42494053", "text": "func (spec *WOFPlacetypeSpecification) AppendPlacetypeSpecification(other_spec *WOFPlacetypeSpecification) error {\n\n\tspec.ensureIndexingRelationshipsComplete()\n\n\tfor _, pt := range other_spec.Catalog() {\n\n\t\terr := spec.AppendPlacetype(pt)\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to append placetype %v, %w\", pt, err)\n\t\t}\n\t}\n\n\t// Note the way we are not doing this in a Go routine; we want to block\n\t// until things the relationships between the two specifications have been\n\t// updated.\n\n\tspec.indexRelationships()\n\n\treturn nil\n}", "title": "" }, { "docid": "ba6c498ad5bd27b56ed9f384c4f9bed3", "score": "0.42445883", "text": "func (m *PlaceMutation) SetPLACE(s string) {\n\tm._PLACE = &s\n}", "title": "" }, { "docid": "893cdb7469790d4d2f6f316269a2d628", "score": "0.42437953", "text": "func addRecord(w http.ResponseWriter, req *http.Request) {\n\tparams := mux.Vars(req)\n\tvar record Record\n\t_ = json.NewDecoder(req.Body).Decode(&record)\n\trecord.ID = params[\"id\"]\n\taddressRecord = append(addressRecord, record)\n\tjson.NewEncoder(w).Encode(addressRecord)\n\texportRecords()\n}", "title": "" }, { "docid": "66660fb5eb1df2fef59c833d019b24bb", "score": "0.42297307", "text": "func (m *Place) Create() error {\n\treturn Db().Create(m).Error\n}", "title": "" }, { "docid": "7445e3df44c57a3b86e70a1cba8f7cf1", "score": "0.42200005", "text": "func (mr *MockUserUsecaseMockRecorder) AddAddress(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddAddress\", reflect.TypeOf((*MockUserUsecase)(nil).AddAddress), arg0, arg1, arg2)\n}", "title": "" }, { "docid": "6d5892ca6fa2fee0d8332954b2d86a5f", "score": "0.42150304", "text": "func (mr *MockInterfaceMockRecorder) GetPlaces() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetPlaces\", reflect.TypeOf((*MockInterface)(nil).GetPlaces))\n}", "title": "" }, { "docid": "818517d0ed306a31b2b0f063c543b672", "score": "0.42108095", "text": "func AddProductDetails(c *gin.Context) {\n\tvar product Models.Product\n\tc.BindJSON(&product)\n\terr := Models.AddProductDetails(&product)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t} else {\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"prodId\": product.ID,\n\t\t\t\"name\": product.Name,\n\t\t\t\"quantity\": product.Quantity,\n\t\t\t\"price\": product.Price,\n\t\t\t\"message\": \"product added successfully\",\n\t\t})\n\t}\n}", "title": "" }, { "docid": "81f64fc7f15100434e2c6b3ce88dc04c", "score": "0.420208", "text": "func (usrlogic *UserLogic) AddNewAddressToUser(address models.Addresses) (interface{}, bool, error) {\n\tvar err error\n\trestfulds := dataaccess.RESTFul{}\n\trestfulds.ServiceURI = usrlogic.ServiceList[\"utility\"]\n\tsavedEntity, statusCode, err := restfulds.SaveObjectAuthToken(address, \"address\", usrlogic.AuthorizationToken)\n\tif statusCode != 0 {\n\t\tusrlogic.Logger.Error(err.Error())\n\t\treturn nil, false, err\n\t}\n\treturn savedEntity, true, nil\n}", "title": "" }, { "docid": "2c7e3954849152e1f72ea83d66a42b72", "score": "0.4189528", "text": "func (m *PlaceDB) ListPlace(ctx context.Context) []*app.Place {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"place\", \"listplace\"}, time.Now())\n\n\tvar native []*Place\n\tvar objs []*app.Place\n\terr := m.Db.Scopes().Table(m.TableName()).Find(&native).Error\n\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"error listing Place\", \"error\", err.Error())\n\t\treturn objs\n\t}\n\n\tfor _, t := range native {\n\t\tobjs = append(objs, t.PlaceToPlace())\n\t}\n\n\treturn objs\n}", "title": "" }, { "docid": "96197f36675e3f29139136ba5c44136d", "score": "0.41841608", "text": "func (addresses *Addresses) addAddress(address Address,addressType AddressType) {\n\tpaddrr:=PersonAddress{}\n\tpaddrr.Address=address\n\tpaddrr.Type=addressType\n\taddresses.Addresses=append(addresses.Addresses,paddrr)\n}", "title": "" }, { "docid": "1af0fc49613e18de5fb6618d40f17509", "score": "0.41838875", "text": "func IsValidPlacetypeId(id int64) bool {\n\treturn specification.IsValidPlacetypeId(id)\n}", "title": "" }, { "docid": "a83562581b4cfe2cc038523d197d3126", "score": "0.41806704", "text": "func (c Card) AddAddress(address *Address) {\n\tc.Add(FieldAddress, address.field())\n}", "title": "" }, { "docid": "5e193886f6202cd954424f34cec1253c", "score": "0.41655198", "text": "func (m *PlaceDB) Delete(ctx context.Context, id int) error {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"place\", \"delete\"}, time.Now())\n\n\tvar obj Place\n\n\terr := m.Db.Delete(&obj, id).Error\n\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"error deleting Place\", \"error\", err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "355215d39baf61c52e90d07a877e3506", "score": "0.41653842", "text": "func NewDetails(app *App, title, subject string, searchable bool) *Details {\n\td := Details{\n\t\tFlex: tview.NewFlex(),\n\t\ttext: tview.NewTextView(),\n\t\tapp: app,\n\t\ttitle: title,\n\t\tsubject: subject,\n\t\tactions: make(ui.KeyActions),\n\t\tcmdBuff: model.NewFishBuff('/', model.FilterBuffer),\n\t\tmodel: model.NewText(),\n\t\tsearchable: searchable,\n\t}\n\td.AddItem(d.text, 0, 1, true)\n\n\treturn &d\n}", "title": "" }, { "docid": "cad47b0060d6c4ad582f2050866b9a68", "score": "0.4158219", "text": "func (c *jsiiProxy_CfnPlacement) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "a3a976c7a1d6514981247bd67a155ecf", "score": "0.41548246", "text": "func (m *MockAdminRestaurantRepo) AddAddress(arg0 context.Context, arg1 int, arg2 models.Address) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AddAddress\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "100b190641960ec444f22d67f3b43de1", "score": "0.41518462", "text": "func (g *graph) addStreet(startLocation, targetLocation string, distance int) {\n\tg.houses[startLocation] = append(g.houses[startLocation], street{house: targetLocation, distance: distance})\n\tg.houses[targetLocation] = append(g.houses[targetLocation], street{house: startLocation, distance: distance})\n}", "title": "" }, { "docid": "a3de216f3f86a906e194d714bc84f33b", "score": "0.4149971", "text": "func (m *ServiceAnnouncementBase) SetDetails(value []KeyValuePairable)() {\n m.details = value\n}", "title": "" }, { "docid": "33bb8a545f4ea4121df453acf9e0a0bc", "score": "0.41257837", "text": "func (o GoogleCloudRetailV2alphaFulfillmentInfoResponseOutput) PlaceIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GoogleCloudRetailV2alphaFulfillmentInfoResponse) []string { return v.PlaceIds }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "daa41ad5bd5f5a3633122085fce6ca62", "score": "0.4117844", "text": "func (mr *MockIFullAPIMockRecorder) AddNewAddress(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddNewAddress\", reflect.TypeOf((*MockIFullAPI)(nil).AddNewAddress), arg0, arg1)\n}", "title": "" }, { "docid": "6da1951d86b26dd8be5ee9884769a13a", "score": "0.4113685", "text": "func (puo *PlaceUpdateOne) AddPlaceActiIDs(ids ...int) *PlaceUpdateOne {\n\tpuo.mutation.AddPlaceActiIDs(ids...)\n\treturn puo\n}", "title": "" }, { "docid": "2ccc60ee41b0ea3c8b82d9b7816dc081", "score": "0.41131008", "text": "func (puo *PlaceUpdateOne) Save(ctx context.Context) (*Place, error) {\n\tif v, ok := puo.mutation.PLACE(); ok {\n\t\tif err := place.PLACEValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"PLACE\", err: fmt.Errorf(\"ent: validator failed for field \\\"PLACE\\\": %w\", err)}\n\t\t}\n\t}\n\n\tvar (\n\t\terr error\n\t\tnode *Place\n\t)\n\tif len(puo.hooks) == 0 {\n\t\tnode, err = puo.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.(*PlaceMutation)\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\tpuo.mutation = mutation\n\t\t\tnode, err = puo.sqlSave(ctx)\n\t\t\tmutation.done = true\n\t\t\treturn node, err\n\t\t})\n\t\tfor i := len(puo.hooks) - 1; i >= 0; i-- {\n\t\t\tmut = puo.hooks[i](mut)\n\t\t}\n\t\tif _, err := mut.Mutate(ctx, puo.mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn node, err\n}", "title": "" }, { "docid": "e9b37e33d60c85795cc300389ea5c273", "score": "0.41110042", "text": "func (s *Service) PlaceOrder(ctx context.Context, cartID, userID, billingID, shippingID string) (*Order, error) {\n\tcontextLogger := log.WithContext(ctx)\n\tcontextLogger.Debugf(\"service: PlaceOrder(ctx, cartID=%q, customerID=%q, billingID=%q, shippingID=%q)\",\n\t\tcartID, userID, billingID, shippingID)\n\n\torow, oirows, urow, bill, ship, err := s.model.AddOrder(ctx, cartID, userID, billingID, shippingID)\n\tif err == postgres.ErrCartNotFound {\n\t\treturn nil, ErrCartNotFound\n\t}\n\tif err == postgres.ErrCartEmpty {\n\t\treturn nil, ErrCartEmpty\n\t}\n\tif err == postgres.ErrAddressNotFound {\n\t\treturn nil, ErrAddressNotFound\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"service: s.model.AddOrder(ctx, ...) failed\")\n\t}\n\n\torderItems := make([]*OrderItem, 0, len(oirows))\n\tfor _, row := range oirows {\n\t\toi := OrderItem{\n\t\t\tObject: \"order_item\",\n\t\t\tID: row.UUID,\n\t\t\tPath: row.Path,\n\t\t\tSKU: row.SKU,\n\t\t\tName: row.Name,\n\t\t\tQty: row.Qty,\n\t\t\tUnitPrice: row.UnitPrice,\n\t\t\tCurrency: row.Currency,\n\t\t\tDiscount: row.Discount,\n\t\t\tTaxCode: row.TaxCode,\n\t\t\tVAT: row.VAT,\n\t\t\tCreated: &row.Created,\n\t\t}\n\t\torderItems = append(orderItems, &oi)\n\t}\n\n\torder := Order{\n\t\tObject: \"order\",\n\t\tID: orow.UUID,\n\t\tOrderID: orow.ID,\n\t\tStatus: orow.Status,\n\t\tPayment: orow.Payment,\n\t\tUser: &OrderUser{\n\t\t\tID: &urow.UUID,\n\t\t},\n\t\tBilling: &OrderAddress{\n\t\t\tContactName: bill.ContactName,\n\t\t\tAddr1: bill.Addr1,\n\t\t\tAddr2: bill.Addr2,\n\t\t\tCity: bill.City,\n\t\t\tCounty: bill.County,\n\t\t\tPostcode: bill.Postcode,\n\t\t\tCountry: bill.CountryCode,\n\t\t},\n\t\tShipping: &OrderAddress{\n\t\t\tContactName: ship.ContactName,\n\t\t\tAddr1: ship.Addr1,\n\t\t\tAddr2: ship.Addr2,\n\t\t\tCity: ship.City,\n\t\t\tCounty: ship.County,\n\t\t\tPostcode: ship.Postcode,\n\t\t\tCountry: ship.CountryCode,\n\t\t},\n\t\tCurrency: orow.Currency,\n\t\tTotalExVAT: orow.TotalExVAT,\n\t\tVATTotal: orow.VATTotal,\n\t\tTotalIncVAT: orow.TotalIncVAT,\n\t\tItems: orderItems,\n\t\tCreated: orow.Created,\n\t\tModified: orow.Modified,\n\t}\n\tif err := s.PublishTopicEvent(ctx, EventOrderCreated, &order); err != nil {\n\t\treturn nil, errors.Wrapf(err,\n\t\t\t\"service: s.PublishTopicEvent(ctx, event=%q, data=%v) failed\",\n\t\t\tEventOrderCreated, order)\n\t}\n\tcontextLogger.Infof(\"service: EventOrderCreated published\")\n\treturn &order, nil\n}", "title": "" }, { "docid": "5e5fce3f1208b457f50cdaf2490bdc96", "score": "0.4108246", "text": "func CreateUnknownPlace() {\n\tFirstOrCreatePlace(&UnknownPlace)\n}", "title": "" }, { "docid": "02ae616f3394bd414230c955b8c693d0", "score": "0.41061446", "text": "func (e DecodeErr) IsPlace(p DecodeErrPlace) bool {\n\treturn e.Place == p\n}", "title": "" }, { "docid": "15bfe92c025ed54d12727f002827b7f8", "score": "0.4103102", "text": "func (a *Client) PlaceSearch(params *PlaceSearchParams) (*PlaceSearchOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPlaceSearchParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Place_Search\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/Place/Search\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/xml\", \"text/json\", \"text/xml\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PlaceSearchReader{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.(*PlaceSearchOK)\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 Place_Search: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "fcb00485bd7bb1c68fed6444dbc5fac8", "score": "0.40959147", "text": "func (m *MockUserUsecase) AddAddress(arg0 context.Context, arg1 int, arg2 models.Address) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AddAddress\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "a9ebf979ea6487ba61ab0cded5dfec43", "score": "0.40905803", "text": "func (m *Map) TrackAdd(t *Track) {\n\tC.osm_gps_map_track_add(m.Native(), t.Native())\n}", "title": "" }, { "docid": "20fe2f45527f22c8e409294f0be531ef", "score": "0.40786606", "text": "func (m *MockIFullAPI) AddNewAddress(arg0 context.Context, arg1 []address.Address) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AddNewAddress\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "701b0c93c3de5b3dc9cde763a3e4626b", "score": "0.40761828", "text": "func (m *Message) SetDetails(d string) {\n\tm.details = d\n}", "title": "" }, { "docid": "2f26ce7b45c17bacd41fc211bfc3e24f", "score": "0.4070633", "text": "func (db *CXDBMemory) PlaceAuctionOrder(order *match.AuctionOrder) (err error) {\n\n\t// TODO: Determine where order validation should go if not here\n\t// What determines a valid order should be in one place\n\tif _, err = order.Price(); err != nil {\n\t\terr = fmt.Errorf(\"No price can be determined, so invalid order\")\n\t\treturn\n\t}\n\n\tdb.ordersMtx.Lock()\n\tdb.orders[order.AuctionID] = append(db.orders[order.AuctionID], order)\n\tdb.ordersMtx.Unlock()\n\treturn\n}", "title": "" }, { "docid": "54e94d9f168a7605c12834567daebc37", "score": "0.40654314", "text": "func NewPutDetails(transport PutDetailsTransport, service service, errorProcessor errorProcessor) fasthttp.RequestHandler {\n\tls := putDetails{\n\t\ttransport: transport,\n\t\tservice: service,\n\t\terrorProcessor: errorProcessor,\n\t}\n\treturn ls.ServeHTTP\n}", "title": "" }, { "docid": "a807be9a249b5bc82be4479d57d8b5cc", "score": "0.4062966", "text": "func (o *UnexpectedError) HasDetails() bool {\n\tif o != nil && o.Details != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5c6e243eb30c1e74603c88ad9aa77d9c", "score": "0.40597805", "text": "func (o GoogleCloudRetailV2betaFulfillmentInfoResponseOutput) PlaceIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GoogleCloudRetailV2betaFulfillmentInfoResponse) []string { return v.PlaceIds }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "8c5fb510e624631142aeaa1a6fb6abcc", "score": "0.40566707", "text": "func AddDetailsAction(c *gcli.Context) {\n\tcli, err := NewAlertClient(c)\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n\n\treq := alerts.AddDetailsAlertRequest{}\n\tif val, success := getVal(\"id\", c); success {\n\t\treq.ID = val\n\t}\n\tif val, success := getVal(\"alias\", c); success {\n\t\treq.Alias = val\n\t}\n\treq.User = grabUsername(c)\n\tif val, success := getVal(\"source\", c); success {\n\t\treq.Source = val\n\t}\n\tif val, success := getVal(\"note\", c); success {\n\t\treq.Note = val\n\t}\n\tif c.IsSet(\"D\") {\n\t\treq.Details = extractDetailsFromCommand(c)\n\t}\n\tprintVerboseMessage(\"Add details request prepared from flags, sending request to OpsGenie..\")\n\n\t_, err = cli.AddDetails(req)\n\tif err != nil {\n\t\tfmt.Printf(\"%s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\tprintVerboseMessage(\"Details added successfully.\")\n}", "title": "" }, { "docid": "bc5d8b2560f29c75cc16a79e0d1d250b", "score": "0.40504342", "text": "func (e *Event) UpdateDetails(newDetails string) {\n\tif newDetails != \"\" && e.Details != newDetails {\n\t\te.Details = newDetails\n\t}\n}", "title": "" }, { "docid": "fa57bd2a7c5ff133bfb120dc21c3f606", "score": "0.404757", "text": "func (a *Client) PlaceGetByType(params *PlaceGetByTypeParams) (*PlaceGetByTypeOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPlaceGetByTypeParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Place_GetByType\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/Place/Type/{types}\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/xml\", \"text/json\", \"text/xml\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PlaceGetByTypeReader{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.(*PlaceGetByTypeOK)\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 Place_GetByType: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "09a0b2577fae7be338d0d70ce257c227", "score": "0.40466473", "text": "func AddNewCity(w http.ResponseWriter, r *http.Request) {\n\tcity := &models.City{}\n\n\t// Decode the request to server\n\terr := json.NewDecoder(r.Body).Decode(&city)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\tutils.Respond(w, utils.Message(false, \"Cannot decode recieved json object\"))\n\t\treturn\n\t}\n\n\tfmt.Print(city)\n\t// CreateSeller new User and UserProfile\n\terr = city.Create()\n\tif err != nil {\n\t\tutils.Respond(w, utils.Message(false, \"Cannot add new city object to the database\"))\n\t\tlog.Fatal(err.Error())\n\t\treturn\n\t}\n\n\tresp := utils.Message(true, \"New City was successfully added\")\n\tutils.Respond(w, resp)\n}", "title": "" }, { "docid": "a1976c5bb00246d66a090e07e0c90c0e", "score": "0.40421194", "text": "func withPlace(node *Place) placeOption {\n\treturn func(m *PlaceMutation) {\n\t\tm.oldValue = func(context.Context) (*Place, error) {\n\t\t\treturn node, nil\n\t\t}\n\t\tm.id = &node.ID\n\t}\n}", "title": "" }, { "docid": "0fa79cbfe1a47c28036e32bd8d59fa4d", "score": "0.4036841", "text": "func GetPlaces(ctx context.Context, zoneID int, paging Paging) ([]Place, error) {\n\tctx, cancel := context.WithTimeout(ctx, 5*time.Second)\n\tdefer cancel()\n\n\tvar places []Place\n\tvar place Place\n\n\torder := setOrderBy(\"place_id\")\n\n\trows, err := pool.QueryContext(\n\t\tctx,\n\t\tfmt.Sprintf(`\n\t\t\tSELECT DISTINCT place_id, zone_id, type, geo, device_id, created_at, updated_at\n\t\t\tFROM places \n\t\t\tWHERE zone_id = $1\n\t\t\t%s\n\t\t\t%s\n\t\t`, order, paging.buildQuery()),\n\t\tzoneID,\n\t)\n\n\tif err != nil {\n\t\treturn places, err\n\t}\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(&place.PlaceID, &place.ZoneID, &place.Type, &place.Geography, &place.DeviceID,\n\t\t\t&place.CreatedAt, &place.UpdatedAt)\n\t\tif err != nil {\n\t\t\treturn places, err\n\t\t}\n\t\tplaces = append(places, place)\n\t}\n\n\t// get any error encountered during iteration\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn places, err\n\t}\n\n\treturn places, nil\n}", "title": "" } ]
e4fd09596ddc67aeef02bc1c59092935
BaselineMeasurementUpperLimitNotIn applies the NotIn predicate on the "baseline_measurement_upper_limit" field.
[ { "docid": "cdbdabf07a67807c0219149da343bd25", "score": "0.8552178", "text": "func BaselineMeasurementUpperLimitNotIn(vs ...string) predicate.BaselineMeasurement {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldBaselineMeasurementUpperLimit), v...))\n\t})\n}", "title": "" } ]
[ { "docid": "14fb44d4152127da0d54adb130d0895a", "score": "0.7563201", "text": "func BaselineMeasurementUpperLimitIn(vs ...string) predicate.BaselineMeasurement {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.BaselineMeasurement(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(FieldBaselineMeasurementUpperLimit), v...))\n\t})\n}", "title": "" }, { "docid": "c7e81bce925430ea5ca1590d0e7f7bc6", "score": "0.75466025", "text": "func BaselineMeasurementLowerLimitNotIn(vs ...string) predicate.BaselineMeasurement {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldBaselineMeasurementLowerLimit), v...))\n\t})\n}", "title": "" }, { "docid": "2401a2ca2aba954a90ae316772e2431d", "score": "0.6905572", "text": "func BaselineMeasurementValueNotIn(vs ...string) predicate.BaselineMeasurement {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldBaselineMeasurementValue), v...))\n\t})\n}", "title": "" }, { "docid": "5594fc535108b9786616c988d351023b", "score": "0.6781328", "text": "func BaselineMeasurementUpperLimitNEQ(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldBaselineMeasurementUpperLimit), v))\n\t})\n}", "title": "" }, { "docid": "5df00af2ddfe31aa8b4ccbd46d7a5483", "score": "0.6429704", "text": "func BaselineMeasurementUpperLimitContains(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldBaselineMeasurementUpperLimit), v))\n\t})\n}", "title": "" }, { "docid": "9e405205adb48ac831e8deef742b193c", "score": "0.62468195", "text": "func BaselineMeasurementUpperLimit(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldBaselineMeasurementUpperLimit), v))\n\t})\n}", "title": "" }, { "docid": "f70c7bda5b673ecabfc374d1ab497813", "score": "0.62375236", "text": "func BaselineMeasurementUpperLimitLTE(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldBaselineMeasurementUpperLimit), v))\n\t})\n}", "title": "" }, { "docid": "b47385b8ca4d383ca15ffddf7178f568", "score": "0.6229626", "text": "func BaselineMeasurementCommentNotIn(vs ...string) predicate.BaselineMeasurement {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldBaselineMeasurementComment), v...))\n\t})\n}", "title": "" }, { "docid": "bb85cd5fdfa18044301795d3eadfbdfb", "score": "0.6070659", "text": "func BaselineMeasurementUpperLimitGT(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldBaselineMeasurementUpperLimit), v))\n\t})\n}", "title": "" }, { "docid": "3659ebfea62bdd0934183f6a71774bf5", "score": "0.6066023", "text": "func BaselineMeasurementGroupIDNotIn(vs ...string) predicate.BaselineMeasurement {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldBaselineMeasurementGroupID), v...))\n\t})\n}", "title": "" }, { "docid": "3c6d26a9359f24152407c7eae3dcf696", "score": "0.6043981", "text": "func BaselineMeasurementUpperLimitLT(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldBaselineMeasurementUpperLimit), v))\n\t})\n}", "title": "" }, { "docid": "3dab1446634cd2a705b69d97092430fb", "score": "0.60260046", "text": "func BaselineMeasurementUpperLimitEQ(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldBaselineMeasurementUpperLimit), v))\n\t})\n}", "title": "" }, { "docid": "091d2c03e04ba3d4d88bfc9bdd1ff7bd", "score": "0.5931443", "text": "func BaselineMeasurementSpreadNotIn(vs ...string) predicate.BaselineMeasurement {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldBaselineMeasurementSpread), v...))\n\t})\n}", "title": "" }, { "docid": "23f6ebf15ca58982e9d6c7c2802b9d13", "score": "0.59083146", "text": "func BaselineMeasurementUpperLimitContainsFold(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldBaselineMeasurementUpperLimit), v))\n\t})\n}", "title": "" }, { "docid": "c33e68c56ffae3e2578c534245d6bea2", "score": "0.5901184", "text": "func EndNotIn(vs ...time.Time) predicate.BarTimeRange {\n\treturn predicate.BarTimeRange(sql.FieldNotIn(FieldEnd, vs...))\n}", "title": "" }, { "docid": "54fbb4c0b9c9274ca2fd768e9caf173d", "score": "0.58861643", "text": "func MaximumAgeNotIn(vs ...string) predicate.StudyEligibility {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldMaximumAge), v...))\n\t})\n}", "title": "" }, { "docid": "150ede5d31c8c581f1585ab5995f2626", "score": "0.58504283", "text": "func BaselineMeasurementUpperLimitHasSuffix(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldBaselineMeasurementUpperLimit), v))\n\t})\n}", "title": "" }, { "docid": "d13a2f556a77b70e2f878bcb9310ee0e", "score": "0.5748653", "text": "func SemaineBNotIn(vs ...int) predicate.StockManager {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.StockManager(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldSemaineB), v...))\n\t})\n}", "title": "" }, { "docid": "1b95792e6357628727dcef549da79c93", "score": "0.5726142", "text": "func BaselineMeasurementLowerLimitIn(vs ...string) predicate.BaselineMeasurement {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.BaselineMeasurement(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(FieldBaselineMeasurementLowerLimit), v...))\n\t})\n}", "title": "" }, { "docid": "32acc3cfe17ffa9ab60736901be963e2", "score": "0.5714713", "text": "func BaselineMeasurementUpperLimitGTE(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldBaselineMeasurementUpperLimit), v))\n\t})\n}", "title": "" }, { "docid": "b74a9932eb8360a9621fcaa553a5bc1c", "score": "0.5648531", "text": "func BusinessScopeNotIn(vs ...string) predicate.QccEnterpriseData {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.QccEnterpriseData(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldBusinessScope), v...))\n\t})\n}", "title": "" }, { "docid": "8e5cc7b8273f8065e6b90cc2435f2fce", "score": "0.5572855", "text": "func AvailableBalanceNotIn(vs ...float32) predicate.Account {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldAvailableBalance), v...))\n\t})\n}", "title": "" }, { "docid": "1407e379f0f5f1174a7dfb4abfd86394", "score": "0.5557493", "text": "func CurrentBalanceNotIn(vs ...float32) predicate.Account {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldCurrentBalance), v...))\n\t})\n}", "title": "" }, { "docid": "c7975f539513a6b38dc2a1550085ac79", "score": "0.5417803", "text": "func BaselineMeasurementLowerLimitNEQ(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldBaselineMeasurementLowerLimit), v))\n\t})\n}", "title": "" }, { "docid": "c2dd1f88ac4acb1da53a0f2c01cb041a", "score": "0.5401038", "text": "func BankAccountNotIn(vs ...string) predicate.BankingData {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.BankingData(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldBankAccount), v...))\n\t})\n}", "title": "" }, { "docid": "7416ba84a54c425614a63f451a90b0e7", "score": "0.5379969", "text": "func (p *Predicate) NotIn(col string, args ...interface{}) *Predicate {\n\tp.b.Append(col).WriteString(\" NOT IN \")\n\tp.b.Nested(func(b *Builder) {\n\t\tb.Args(args...)\n\t})\n\treturn p\n}", "title": "" }, { "docid": "dca02ff66d1021bf89a940a8987f5e4a", "score": "0.5370358", "text": "func IntervalIDNotIn(vs ...int) predicate.BarTimeRange {\n\treturn predicate.BarTimeRange(sql.FieldNotIn(FieldIntervalID, vs...))\n}", "title": "" }, { "docid": "c6f216bcb1fa85618402f36b42a0e240", "score": "0.53593004", "text": "func PointLBNotIn(vs ...int) predicate.Pendingloanbinding {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Pendingloanbinding(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldPointLB), v...))\n\t})\n}", "title": "" }, { "docid": "c68773b1bd7ea3b726ffc6df591d162e", "score": "0.53464407", "text": "func ClientipFlowLimitNotIn(vs ...int) predicate.AccessControl {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.AccessControl(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldClientipFlowLimit), v...))\n\t})\n}", "title": "" }, { "docid": "a608069c5000af779fe70df62f913ab0", "score": "0.5333645", "text": "func (m *Model) WhereNotIn(column string, in interface{}) *Model {\n\treturn m.Where(fmt.Sprintf(`%s NOT IN (?)`, m.db.GetCore().QuoteWord(column)), in)\n}", "title": "" }, { "docid": "edf6578cde4c270628b62e35bef39a31", "score": "0.53292257", "text": "func CountNotIn(vs ...int) predicate.BarTimeRange {\n\treturn predicate.BarTimeRange(sql.FieldNotIn(FieldCount, vs...))\n}", "title": "" }, { "docid": "f8b749e5e8dc0256454fdcc5ffb03e9c", "score": "0.5325688", "text": "func MaxDurationNotIn(vs ...int) predicate.PingDetectorResult {\n\treturn predicate.PingDetectorResult(sql.FieldNotIn(FieldMaxDuration, vs...))\n}", "title": "" }, { "docid": "41cb4f40f2fd7df2f026672237c5c6d2", "score": "0.5312017", "text": "func SubDistrictNotIn(vs ...string) predicate.Areahistory {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Areahistory(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldSubDistrict), v...))\n\t})\n}", "title": "" }, { "docid": "1c90462df6b1ad639230d5d69d8a3ce2", "score": "0.5303316", "text": "func EndIn(vs ...time.Time) predicate.BarTimeRange {\n\treturn predicate.BarTimeRange(sql.FieldIn(FieldEnd, vs...))\n}", "title": "" }, { "docid": "c9718ddfa2ef2a8de28896b090fd6835", "score": "0.53003216", "text": "func ServiceFlowLimitNotIn(vs ...int) predicate.AccessControl {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.AccessControl(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldServiceFlowLimit), v...))\n\t})\n}", "title": "" }, { "docid": "a46c6142b7d3fb78fede4c7ef510f265", "score": "0.5288291", "text": "func BaselineMeasurementUpperLimitEqualFold(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldBaselineMeasurementUpperLimit), v))\n\t})\n}", "title": "" }, { "docid": "e785f2eee44960cc278e643c179bf84a", "score": "0.52693266", "text": "func Not(p predicate.BaselineMeasurement) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\tp(s.Not())\n\t})\n}", "title": "" }, { "docid": "187469c7d0de8efcce0ea4ce58dff860", "score": "0.5265485", "text": "func (m *Model) WhereNotBetween(column string, min, max interface{}) *Model {\n\treturn m.Where(fmt.Sprintf(`%s NOT BETWEEN ? AND ?`, m.db.GetCore().QuoteWord(column)), min, max)\n}", "title": "" }, { "docid": "514d470ef4775b355b9ecbbaafa74d44", "score": "0.52507985", "text": "func BaselineMeasurementValueIn(vs ...string) predicate.BaselineMeasurement {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.BaselineMeasurement(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(FieldBaselineMeasurementValue), v...))\n\t})\n}", "title": "" }, { "docid": "99b006cc7b2692aeed078e9ef4e49e09", "score": "0.52389276", "text": "func SemaineHNotIn(vs ...int) predicate.StockManager {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.StockManager(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldSemaineH), v...))\n\t})\n}", "title": "" }, { "docid": "4f282c633d3874e6f55a1d9e97d63286", "score": "0.5238448", "text": "func AgeNotIn(vs ...uint32) predicate.User {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.User(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldAge), v...))\n\t})\n}", "title": "" }, { "docid": "ad80ec473dae56c998e0ce53223b1044", "score": "0.52302355", "text": "func LastSigninAtNotIn(vs ...time.Time) predicate.Account {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldLastSigninAt), v...))\n\t})\n}", "title": "" }, { "docid": "42dcfeafb7d118834d595a4324f1a716", "score": "0.52183324", "text": "func NumberNotIn(vs ...string) predicate.Account {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldNumber), v...))\n\t})\n}", "title": "" }, { "docid": "0c0378680546469fe113eb1e81cba114", "score": "0.5217718", "text": "func YNotIn(vs ...int) predicate.Harbor {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Harbor(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldY), v...))\n\t})\n}", "title": "" }, { "docid": "0bb457ca2ce90e9ca587e2d22057c379", "score": "0.51972747", "text": "func (o RuleOutput) NotIn() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v Rule) []string { return v.NotIn }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "3686e3e5c870fdb607c34ff3db459b45", "score": "0.5188664", "text": "func (i identifier) NotBetween(val RangeVal) RangeExpression { return notBetween(i, val) }", "title": "" }, { "docid": "a2f305364990d56c013a6c177a0581fd", "score": "0.5168246", "text": "func AmountNotIn(vs ...int) predicate.GroupBudget {\n\treturn predicate.GroupBudget(sql.FieldNotIn(FieldAmount, vs...))\n}", "title": "" }, { "docid": "8a565c1d43fdb6fcbf344f6655ccbafc", "score": "0.51674604", "text": "func (c ConditionField) NotIn(data interface{}) *Condition {\n\treturn c.AddOperator(operator.NotIn, data)\n}", "title": "" }, { "docid": "229b26598da8d5fb7296d34fcc3dbff7", "score": "0.5153692", "text": "func MaximumAgeIn(vs ...string) predicate.StudyEligibility {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.StudyEligibility(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(FieldMaximumAge), v...))\n\t})\n}", "title": "" }, { "docid": "f3237dc5d8b4db414584c88a00889721", "score": "0.5146008", "text": "func SemaineGNotIn(vs ...int) predicate.StockManager {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.StockManager(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldSemaineG), v...))\n\t})\n}", "title": "" }, { "docid": "2342b6359990cf4d16be66475f062452", "score": "0.5138106", "text": "func BarcodeNotIn(vs ...string) predicate.Book {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldBarcode), v...))\n\t})\n}", "title": "" }, { "docid": "11c52ba83043e8947d27ccb2471984be", "score": "0.5137441", "text": "func NotIn(col string, args ...interface{}) *Predicate {\n\treturn (&Predicate{}).NotIn(col, args...)\n}", "title": "" }, { "docid": "25be5efd82d8d9f529ce04d4712dcfbe", "score": "0.5131023", "text": "func (o RuleResponseOutput) NotIn() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v RuleResponse) []string { return v.NotIn }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "3f740bf74494dab84f7ffa8a4342c768", "score": "0.5130334", "text": "func AgeNotIn(vs ...int) predicate.User {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.User(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldAge), v...))\n\t})\n}", "title": "" }, { "docid": "15a61c981649cfe8cc7e4a20f2019f73", "score": "0.51133937", "text": "func AgeNotIn(vs ...int) 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(\n\t\tfunc(s *sql.Selector) {\n\t\t\t// if not arguments were provided, append the FALSE constants,\n\t\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\t\tif len(vs) == 0 {\n\t\t\t\ts.Where(sql.False())\n\t\t\t\treturn\n\t\t\t}\n\t\t\ts.Where(sql.NotIn(s.C(FieldAge), v...))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "b469dbf79222e6a89505ce71714dfc88", "score": "0.51106507", "text": "func EthnicityNotIn(vs ...string) predicate.StudyEligibility {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldEthnicity), v...))\n\t})\n}", "title": "" }, { "docid": "e5049d1eb4e7556ea9baab77b02fc9bf", "score": "0.51013595", "text": "func MinimumAgeNotIn(vs ...string) predicate.StudyEligibility {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldMinimumAge), v...))\n\t})\n}", "title": "" }, { "docid": "1fc5d5fc7d79a8f1271d40bc30db680f", "score": "0.5085985", "text": "func BaselineMeasurementLowerLimitGT(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldBaselineMeasurementLowerLimit), v))\n\t})\n}", "title": "" }, { "docid": "27845474cab88c09cfee6d832bf8cdbd", "score": "0.5085562", "text": "func RemedyNotIn(vs ...string) predicate.Remedy {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Remedy(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldRemedy), v...))\n\t})\n}", "title": "" }, { "docid": "a7e7858b8ffca92ab5bd1c6598b122a0", "score": "0.50855386", "text": "func SemaineCNotIn(vs ...int) predicate.StockManager {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.StockManager(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldSemaineC), v...))\n\t})\n}", "title": "" }, { "docid": "c39383b9a624c3e639690075874ab601", "score": "0.5081877", "text": "func EligibilityCriteriaNotIn(vs ...string) predicate.StudyEligibility {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldEligibilityCriteria), v...))\n\t})\n}", "title": "" }, { "docid": "8b4d7cfa3addf97bd580a2f13aced2f2", "score": "0.5078674", "text": "func Outside( t *testing.T, name string, value ,start, end interface{}) {\n\tvalueI := value.(int64) / 1\n\tstartI := start.(int64) / 1\n\tendI := end.(int64) / 1\n\tif startI > endI {\n\t\ttmp := endI\n\t\tendI = startI\n\t\tstartI = tmp\n\t}\n\tif valueI >= startI || valueI <= endI {\n t.Errorf(\"Failed %s\\n%v is within bounds(%v,%v)\\n\\n\", name, value, start, end)\n\t\tt.FailNow()\n\t}\n}", "title": "" }, { "docid": "9a8a51d230cef8309d6a2fa4d7464454", "score": "0.5074355", "text": "func BaselineMeasurementLowerLimitHasSuffix(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldBaselineMeasurementLowerLimit), v))\n\t})\n}", "title": "" }, { "docid": "e6686fde5a687d169efc47f68942104b", "score": "0.50490564", "text": "func SemaineFNotIn(vs ...int) predicate.StockManager {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.StockManager(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldSemaineF), v...))\n\t})\n}", "title": "" }, { "docid": "c2d3989fe64c5cdbe2f65aa6ff079f52", "score": "0.504782", "text": "func WheelCenterNotIn(vs ...float64) predicate.CarInspection {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.CarInspection(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldWheelCenter), v...))\n\t})\n}", "title": "" }, { "docid": "845b48349744dd15eec1574d2c600406", "score": "0.50366783", "text": "func BlackListNotIn(vs ...string) predicate.AccessControl {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.AccessControl(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldBlackList), v...))\n\t})\n}", "title": "" }, { "docid": "9a5aa0e010db356f910e6eb1b0fd62aa", "score": "0.50104374", "text": "func AmountNotIn(vs ...int) predicate.Dentalappointment {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Dentalappointment(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldAmount), v...))\n\t})\n}", "title": "" }, { "docid": "02ce842fc6c0c163cf00ce0e602b0624", "score": "0.49937597", "text": "func DistanceUnitNotIn(vs ...DistanceUnit) predicate.User {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.User(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldDistanceUnit), v...))\n\t})\n}", "title": "" }, { "docid": "1eba049b857af77f722f9ba432fb4efa", "score": "0.49822578", "text": "func NewNotInFilterMethod(ctx QsFieldContext) InFilterMethod {\n\treturn newInFilterMethodImpl(ctx, \"NotIn\", \"NOT IN\")\n}", "title": "" }, { "docid": "ae29162b5c43e8c28f5ce0481812160c", "score": "0.49418652", "text": "func RegisteredCapitalNotIn(vs ...string) predicate.QccEnterpriseData {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.QccEnterpriseData(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldRegisteredCapital), v...))\n\t})\n}", "title": "" }, { "docid": "e544f6c76bd118cbd95803d6258a0630", "score": "0.4940097", "text": "func NameLBNotIn(vs ...string) predicate.Pendingloanbinding {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Pendingloanbinding(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldNameLB), v...))\n\t})\n}", "title": "" }, { "docid": "97da2192062267ab47693e3ff7926d5a", "score": "0.493955", "text": "func CAWalletIDNotIn(vs ...string) predicate.Pendingloanbinding {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Pendingloanbinding(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldCAWalletID), v...))\n\t})\n}", "title": "" }, { "docid": "b6ee6c35c8a8223d4ba8c1fea066044a", "score": "0.49244195", "text": "func UuidNotIn(any []string) *UuidsCondition {\n\treturn &UuidsCondition{\n\t\tOp: OP_NOT_IN,\n\t\tUuids: any,\n\t}\n}", "title": "" }, { "docid": "bd587c348cd22615f17737ecfc93817f", "score": "0.49157062", "text": "func (a UnsignedValues) Exclude(min, max int64) UnsignedValues {\n\trmin, rmax := a.FindRange(min, max)\n\tif rmin == -1 && rmax == -1 {\n\t\treturn a\n\t}\n\n\t// a[rmin].UnixNano() ≥ min\n\t// a[rmax].UnixNano() ≥ max\n\n\tif rmax < len(a) {\n\t\tif a[rmax].UnixNano() == max {\n\t\t\trmax++\n\t\t}\n\t\trest := len(a) - rmax\n\t\tif rest > 0 {\n\t\t\tb := a[:rmin+rest]\n\t\t\tcopy(b[rmin:], a[rmax:])\n\t\t\treturn b\n\t\t}\n\t}\n\n\treturn a[:rmin]\n}", "title": "" }, { "docid": "aa106444a425484fa963ebb9bf050da3", "score": "0.49150726", "text": "func SizeNotIn(vs ...uint64) predicate.PostAttachment {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.PostAttachment(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldSize), v...))\n\t})\n}", "title": "" }, { "docid": "ed94dc927eff7bd46d42d8e1381a937d", "score": "0.4911786", "text": "func ValidatorNotIn(vs ...string) predicate.Question {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Question(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(vs) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldValidator), v...))\n\t})\n}", "title": "" }, { "docid": "8217ae5684758fbad6222fe733522bb3", "score": "0.4897406", "text": "func (s *NodeSelectorWrapper) NotIn(key string, vals []string) *NodeSelectorWrapper {\n\texpression := v1.NodeSelectorRequirement{\n\t\tKey: key,\n\t\tOperator: v1.NodeSelectorOpNotIn,\n\t\tValues: vals,\n\t}\n\tselectorTerm := v1.NodeSelectorTerm{}\n\tselectorTerm.MatchExpressions = append(selectorTerm.MatchExpressions, expression)\n\ts.NodeSelectorTerms = append(s.NodeSelectorTerms, selectorTerm)\n\treturn s\n}", "title": "" }, { "docid": "ea22318ba8a75c29092d54a37b0ca41a", "score": "0.4897051", "text": "func SoundLevelNotIn(vs ...float64) predicate.CarInspection {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.CarInspection(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldSoundLevel), v...))\n\t})\n}", "title": "" }, { "docid": "475fddf64226f82cfdd4bb7f16ddfcd5", "score": "0.48951402", "text": "func MtimeNotIn(vs ...time.Time) predicate.Item {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Item(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldMtime), v...))\n\t})\n}", "title": "" }, { "docid": "6e0d9168d222ffe3327fdf521275c374", "score": "0.48926064", "text": "func MainBranchNotIn(vs ...string) predicate.Pendingloanbinding {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Pendingloanbinding(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldMainBranch), v...))\n\t})\n}", "title": "" }, { "docid": "1804518f60f728927948e002669bcf35", "score": "0.4891002", "text": "func StatusNotIn(vs ...Status) predicate.BarTimeRange {\n\treturn predicate.BarTimeRange(sql.FieldNotIn(FieldStatus, vs...))\n}", "title": "" }, { "docid": "ace31486f3655ba07a273e77dbc25eb8", "score": "0.4890488", "text": "func IndustryInvolvedNotIn(vs ...string) predicate.QccEnterpriseData {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.QccEnterpriseData(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldIndustryInvolved), v...))\n\t})\n}", "title": "" }, { "docid": "cbc1a5f7b311c195797a82c4a25af78b", "score": "0.4889568", "text": "func BaselineMeasurementLowerLimitContains(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldBaselineMeasurementLowerLimit), v))\n\t})\n}", "title": "" }, { "docid": "d58b9b0f2225d5a4a950c4d2472f6e17", "score": "0.48861092", "text": "func OpinionNotIn(vs ...string) predicate.StatusOpinion {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.StatusOpinion(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldOpinion), v...))\n\t})\n}", "title": "" }, { "docid": "e120b0031f0649fa0e880212d64ee882", "score": "0.48845136", "text": "func EmailChangeTokenNotIn(vs ...string) predicate.Account {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldEmailChangeToken), v...))\n\t})\n}", "title": "" }, { "docid": "46694461ea9853c63bfc6f163c4378e5", "score": "0.4879468", "text": "func CAPortNotIn(vs ...string) predicate.Pendingloanbinding {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Pendingloanbinding(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldCAPort), v...))\n\t})\n}", "title": "" }, { "docid": "3846e077f1e0ba8a68802cf46976ea3c", "score": "0.4874025", "text": "func ProviderNotIn(vs ...string) predicate.Account {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldProvider), v...))\n\t})\n}", "title": "" }, { "docid": "df11808e89d9c5aefa604344484fb559", "score": "0.4871208", "text": "func NotIn(fieldPath string, valueList []interface{}) ConditionOptions {\n\treturn func(condition *Condition) (*Condition, error) {\n\t\tcondition.tokens.PushRight(map[string]interface{}{\n\t\t\tconditionQueryOperations[NOT_IN]: map[string]interface{}{fieldPath: valueList}})\n\t\treturn condition, nil\n\t}\n}", "title": "" }, { "docid": "4ad3581010131a2ad3e54b41dbc2b853", "score": "0.48676276", "text": "func (objx *UserXSession) NotIn(query string, args ...interface{}) *UserXSession {\n\treturn (*UserXSession)(((*xorm.Session)(objx)).NotIn(query, args...))\n}", "title": "" }, { "docid": "431a4a7a1dfbe8421cf1bd5bb8641a96", "score": "0.4865934", "text": "func AttributeBytesNotIn(vs ...[]byte) predicate.Account {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldAttributeBytes), v...))\n\t})\n}", "title": "" }, { "docid": "c28eb188aa6dc99f9de845c36cf88f02", "score": "0.48554954", "text": "func RecordinsuranceAddressNotIn(vs ...string) predicate.Recordinsurance {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Recordinsurance(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldRecordinsuranceAddress), v...))\n\t})\n}", "title": "" }, { "docid": "4fb8b47c4655f413ee4777cf751668af", "score": "0.4841359", "text": "func OrganizationCodeNotIn(vs ...string) predicate.QccEnterpriseData {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.QccEnterpriseData(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldOrganizationCode), v...))\n\t})\n}", "title": "" }, { "docid": "68ae0d101fae89444d9c2eaa2bb5fd60", "score": "0.4839585", "text": "func InsurancePersonNumsNotIn(vs ...string) predicate.QccEnterpriseData {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.QccEnterpriseData(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldInsurancePersonNums), v...))\n\t})\n}", "title": "" }, { "docid": "5b624a95cd818172bb8c3f0a330afd76", "score": "0.4836743", "text": "func SizeNotIn(vs ...int64) predicate.GithubGist {\n\treturn predicate.GithubGist(sql.FieldNotIn(FieldSize, vs...))\n}", "title": "" }, { "docid": "4d290657186f42684144e3c1156e821d", "score": "0.48361397", "text": "func (a IntegerValues) Exclude(min, max int64) IntegerValues {\n\trmin, rmax := a.FindRange(min, max)\n\tif rmin == -1 && rmax == -1 {\n\t\treturn a\n\t}\n\n\t// a[rmin].UnixNano() ≥ min\n\t// a[rmax].UnixNano() ≥ max\n\n\tif rmax < len(a) {\n\t\tif a[rmax].UnixNano() == max {\n\t\t\trmax++\n\t\t}\n\t\trest := len(a) - rmax\n\t\tif rest > 0 {\n\t\t\tb := a[:rmin+rest]\n\t\t\tcopy(b[rmin:], a[rmax:])\n\t\t\treturn b\n\t\t}\n\t}\n\n\treturn a[:rmin]\n}", "title": "" }, { "docid": "f8d64db1b57f42489c1c24e9bfcf3773", "score": "0.48326692", "text": "func PrivateKeyNotIn(vs ...string) predicate.Account {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.NotIn(s.C(FieldPrivateKey), v...))\n\t})\n}", "title": "" }, { "docid": "23f621f8211638a8a21f627d71c555ed", "score": "0.4829179", "text": "func outsideSupportedRange(version string) bool {\n\treturn belowSupportedRange(version) || aboveSupportedRange(version)\n}", "title": "" }, { "docid": "d95e623eb845d6ab0fd92f256502dd0d", "score": "0.48202178", "text": "func IdentificationNumberNotIn(vs ...string) predicate.User {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.User(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldIdentificationNumber), v...))\n\t})\n}", "title": "" }, { "docid": "aad100ffefa76101c7f66bd5cd9e4c1a", "score": "0.4819108", "text": "func (a Values) Exclude(min, max int64) Values {\n\trmin, rmax := a.FindRange(min, max)\n\tif rmin == -1 && rmax == -1 {\n\t\treturn a\n\t}\n\n\t// a[rmin].UnixNano() ≥ min\n\t// a[rmax].UnixNano() ≥ max\n\n\tif rmax < len(a) {\n\t\tif a[rmax].UnixNano() == max {\n\t\t\trmax++\n\t\t}\n\t\trest := len(a) - rmax\n\t\tif rest > 0 {\n\t\t\tb := a[:rmin+rest]\n\t\t\tcopy(b[rmin:], a[rmax:])\n\t\t\treturn b\n\t\t}\n\t}\n\n\treturn a[:rmin]\n}", "title": "" }, { "docid": "80b61a648eb0b8c2cb5b1df5791f0d14", "score": "0.48157215", "text": "func BaselineMeasurementUpperLimitHasPrefix(v string) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldBaselineMeasurementUpperLimit), v))\n\t})\n}", "title": "" } ]
588a91f6264f1aebce9ad13807cb666b
JSONString returns path representation is JSON convention
[ { "docid": "26c6d42ae73151867a70f4019712d167", "score": "0.71316844", "text": "func (fp *ListSecretsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" } ]
[ { "docid": "916933a21d15255ccd93e735f2f29078", "score": "0.78427774", "text": "func (j jsonPath) String() string {\n\treturn j.path\n}", "title": "" }, { "docid": "6912119595cad67e08867498e4130e2f", "score": "0.7444574", "text": "func (fps *Distribution_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "5409858729dee618ddc311f531727e9d", "score": "0.7411472", "text": "func (fpm *ProvisioningPolicySpec_FieldPathMap) JSONString() string {\n\treturn strcase.ToLowerCamel(fpm.selector.String()) + \".\" + fpm.key\n}", "title": "" }, { "docid": "92a4016a99e92f1f2b1eb3624bbd4921", "score": "0.73902994", "text": "func (fp *OrganizationInvitation_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "e1675363cab1a168b4774e3eccc05049", "score": "0.73864913", "text": "func (fp *Distribution_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "c2f24f6951955244d143bbbce9521035", "score": "0.73827815", "text": "func (fps *CreateSecretRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "0998a1c0f26de49ff756e2670fe54762", "score": "0.7351476", "text": "func (fp *PCR_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "3b8b3db6b789fcef47b324ebef68f021", "score": "0.7329634", "text": "func (fps *BatchGetSecretsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "c93fa2b19437636b9be15591b27cd3ae", "score": "0.73230547", "text": "func (fp *DistributionSpec_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "357478b523881536e3df223561e16cf6", "score": "0.73220515", "text": "func (fps *DistributionSpec_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "da9df52c3319b751fb2004ec514e136c", "score": "0.7319604", "text": "func (fps *LabelSelector_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "e56443af798b26d9be43340de577291b", "score": "0.7315143", "text": "func (fps *CreateDeviceRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "ec6e3acbb7e5a890852de3d4e3995022", "score": "0.73109424", "text": "func (fps *UpdateSecretRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "528b3e090a76ac873eb504e83bf2318f", "score": "0.72959286", "text": "func (fp *LabelSelectorRequirement_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "45419dba900bee9c9fd56d73235e3c03", "score": "0.7283604", "text": "func (fps *OrganizationInvitation_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "adac8b8ba25f94c4598c022941830121", "score": "0.7281271", "text": "func (fps *ListSecretsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "1e443bd8523a074748908c2ee0d1143a", "score": "0.7278531", "text": "func (fp *DistributionStatus_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "2745e703bf3d8371c8602cb6d94cd7e2", "score": "0.72729707", "text": "func (fps *UpdateSecretRequestCAS_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "f44e11a543da3c673835efe004314a9d", "score": "0.72640693", "text": "func JSONPath(elem ...string) string {\n\tif len(elem) == 0 {\n\t\treturn \"\"\n\t}\n\n\tf := elem[len(elem)-1]\n\tif path.Ext(f) == \"\" {\n\t\telem[len(elem)-1] = f + \".\" + jsonFileExt\n\t}\n\n\treturn path.Join(elem...)\n}", "title": "" }, { "docid": "c642120295d988e0a379095c81116950", "score": "0.7263588", "text": "func (fp *LabelSelector_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "aa1f8fa8d0a57592fc7913b1f49cdf66", "score": "0.7259482", "text": "func (fps *UpdateDeviceRequestCAS_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "92fee792039317d92730e7e0f85079ca", "score": "0.7252853", "text": "func (o InputAttributeOutput) JsonPath() pulumi.StringOutput {\n\treturn o.ApplyT(func(v InputAttribute) string { return v.JsonPath }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3f03d7ff16529f35b4183e915040dca6", "score": "0.7252716", "text": "func (fps *WatchSecretsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "fa2bbe878509896102e0890ef36adb3c", "score": "0.72479856", "text": "func (fpm *LabelSelector_FieldPathMap) JSONString() string {\n\treturn strcase.ToLowerCamel(fpm.selector.String()) + \".\" + fpm.key\n}", "title": "" }, { "docid": "4b82fef6c54f6bc75d84aebac0ace1c7", "score": "0.7247816", "text": "func (fps *UpdateDeviceRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "f34f1a6fc4620c0e70b98582023d5b7c", "score": "0.7234632", "text": "func (fp *DistributionSpecTemplate_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "09862786f0df10f321ab52621cf1fb32", "score": "0.72277635", "text": "func (fps *CreateConditionRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "05dc0f915d3853568ab5d77800d652b5", "score": "0.72182715", "text": "func (fps *ProvisioningPolicy_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "669f6c0b841b1fa75978a5e581f28c28", "score": "0.72123283", "text": "func (fps *CreateServiceAccountKeyRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "1f071f0badea7345898a7c94953a8b6c", "score": "0.72091633", "text": "func (fp *WatchSecretsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "de412834a31c0932b2c6d5fe1321dd07", "score": "0.720811", "text": "func (fps *DistributionSpecTemplate_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "10876f13b05d224e060b3429d39278d3", "score": "0.7177229", "text": "func (fp *WatchSecretsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "08eef4703fc688d69b4b4b8ab123b274", "score": "0.7170673", "text": "func (fp *BatchGetSecretsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "04348476c7c4ee3627dae79d6cee014e", "score": "0.7170648", "text": "func (fps *UpdateConditionRequestCAS_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "561680d131e17baa44537a6efd54ed72", "score": "0.71649", "text": "func (fp *WatchSecretsResponsePageTokenChange_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "09fe9db9a50f5f9629a9636c9ece4f83", "score": "0.71618736", "text": "func (fp *GetDeviceRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "18d66594c6d44c17f51080cf488eb547", "score": "0.71578616", "text": "func (fp *WatchDeviceRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "47d830f35a393654d1603ef338fffe39", "score": "0.71557724", "text": "func (fp *ProvisioningPolicy_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "22c8afb9aa8353d59a2c7d3ca1dbf65f", "score": "0.71471065", "text": "func (fp *WatchConditionsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "36ff3b0e74cb26ae7a7bfcfc2131d0b1", "score": "0.7141125", "text": "func (fps *UpdateConditionRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "0d3c35aeea030ef482d2d16b6cc6c05f", "score": "0.713543", "text": "func (fps *BatchGetDevicesResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "77e184fd515f497f995781d23c434036", "score": "0.7132872", "text": "func (fp *UpdateConditionRequestCAS_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "14f1c24ebdd11e208dea110f65ca53f9", "score": "0.71313566", "text": "func (fps *BatchGetConditionsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "e8f6353404f6daaacd23133fbffab07d", "score": "0.71307397", "text": "func (fp *WatchDevicesRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "081b5cfeeb250cad285558b58dd8e1a1", "score": "0.71302265", "text": "func (fps *BatchGetServiceAccountKeysResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "b218d4f8a99588e9caa06391b207d6ec", "score": "0.7129184", "text": "func (fp *UpdateDeviceRequestCAS_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "10bfd2bb8fcd69c0c8587247b7a2a585", "score": "0.71268225", "text": "func (fps *WatchConditionsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "afde0ff25a9f8c98a45a55f79790d87c", "score": "0.7126049", "text": "func (fps *UpdateServiceAccountKeyRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "55973bb930bce211974e5ad74e54bbe4", "score": "0.7125113", "text": "func (fps *WatchDevicesResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "541bcda602f323714f2c0a563554e40d", "score": "0.7123434", "text": "func (fp *WatchConditionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "b6ff5d5e83b72464a9e7d04a0319ea0d", "score": "0.71217257", "text": "func (fp *ServiceBusinessTier_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "d50509cbae755de89da3fd7e0a6ebba2", "score": "0.710318", "text": "func (fp *WatchDeviceResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "4bec149bde02079ccbde7e171a9cbeca", "score": "0.71022683", "text": "func (fps *CreateAcceptedPlanRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "d3fa1182da57d30a91d041b15a364e02", "score": "0.70981175", "text": "func (fp *AttestationDomain_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "45830519104eba145e29935959776c58", "score": "0.70975363", "text": "func (fps *UpdateServiceAccountKeyRequestCAS_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "ddd21810458210f0c849950f8fe4a039", "score": "0.7095929", "text": "func (fp *WatchConditionsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "7002575682b6885f5c7260c4366e70c7", "score": "0.7095861", "text": "func (fp *BatchGetSecretsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "1b2372438acb4dc35479fcdf7143b245", "score": "0.70928425", "text": "func (fp *WatchSecretRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "5ab1fcf291df433fe8a33d9f1f5590a7", "score": "0.70896226", "text": "func (fp *GetConditionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "98ec55629fc2cbc684d6d8cf859c3929", "score": "0.70875525", "text": "func (fp *WatchConditionResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "e26f20e46dff8735492f7c4fe0f3c2a7", "score": "0.7087488", "text": "func (fp *WatchDevicesResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "a7d3c47b04cb86cf69637b4a03eb11f7", "score": "0.7084037", "text": "func (fps *ListDevicesResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "7a215a00e5379bc21822c22d8c4f6737", "score": "0.70784044", "text": "func (fps *WatchServiceAccountKeysResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "2200940924e1d4d503fade05aa8de536", "score": "0.70777035", "text": "func (fps *ProvisioningPolicySpec_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "d9359f42ae21fbf98c12db3bd8e825c5", "score": "0.70766276", "text": "func (fp *CreateDeviceRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "eef50912290dd6e270be6e1c028daa03", "score": "0.7070907", "text": "func (fp *ListSecretsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "30b3752080b86a14cfc09ac60ff4c3ff", "score": "0.7067776", "text": "func (fp *UpdateSecretRequestCAS_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "589cac941df63e3e2752557df99225f5", "score": "0.70659107", "text": "func (fps *ListServiceAccountKeysResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "afd1d7f632f5a1228debcbd94e05c162", "score": "0.70633817", "text": "func (fps *ListConditionsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "596db0eeb156c12ec3d4077d04e6bc57", "score": "0.7050576", "text": "func (fp *BatchGetDevicesRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "e2eb4b0520d0dba56064b826106f09af", "score": "0.7050019", "text": "func (fps *AttestationDomain_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "f152478c26a9f43b4341c7e4ccc297a5", "score": "0.70489806", "text": "func (fp *ProvisioningPolicySpec_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "dd324cbb443b7fe52713ed4d380cc665", "score": "0.7046996", "text": "func (fp *BatchGetConditionsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "8e84a8ec1e05444c0631d484cb3f21bf", "score": "0.7045047", "text": "func (fp *AttestationDomainEnrolledKey_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "21f1317e29788b44c7bd17f7042edde8", "score": "0.70404494", "text": "func (fp *CreateConditionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "ebc0b002f980ebac316d2db66686bc6f", "score": "0.70380634", "text": "func (fp *UpdateDeviceRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "e14e52d56c7f219d3892f1f51c31fb60", "score": "0.70375085", "text": "func (fp *WatchServiceAccountKeyRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "2b3a0e07de5563c7e57157d14329e98b", "score": "0.70365995", "text": "func (fps *UpdateAcceptedPlanRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "68a5c32f95bf84f2c40ad4e0b1f85e91", "score": "0.7027966", "text": "func (fp *WatchDevicesResponsePageTokenChange_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "5b97c16789bae3338f3bfbb6c24cf890", "score": "0.70246077", "text": "func (fp *WatchSecretResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "a7b584d4c7638dd5ce3d48baf34c2911", "score": "0.70224", "text": "func (fp *WatchServiceAccountKeysRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "aa2ea5e85fb2b2ab0c727819fd69842b", "score": "0.7017642", "text": "func (fp *GetServiceAccountKeyRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "6fb1550df40ed12f66b85f33f3d2c385", "score": "0.7009853", "text": "func (fp *UpdateServiceAccountKeyRequestCAS_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "ec28dca0e91aeff125d9dac0b9d3666b", "score": "0.700959", "text": "func (fp *UpdateConditionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "7bfc3ac8345a5d193fc1c8e0ec228143", "score": "0.7007234", "text": "func (fp *ProvisioningPolicyStatus_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "cbd5bdcefdfb0066322b1ae9309f1467", "score": "0.7003502", "text": "func (fps *UpdateAcceptedPlanRequestCAS_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "cb93c23d6001969929684ec870555581", "score": "0.70017403", "text": "func (fp *WatchConditionsResponsePageTokenChange_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "26bfd200097723e6d7af291db80e6742", "score": "0.69945943", "text": "func (fp *ProvisioningPolicySpecTemplate_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "407cb4f3d1763cc98b96bdbefe29b1a6", "score": "0.6990523", "text": "func (fp *WatchServiceAccountKeyResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "3b1cfbea6c2406f373d98d90dbfb6751", "score": "0.69886655", "text": "func (fp *GetSecretRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "0bb0c014d749a0799c4871d60c0e98ff", "score": "0.6988402", "text": "func (fp *DeleteConditionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "5320ac8473c3c799fc79ba6bc193cfb5", "score": "0.69883394", "text": "func (fp *WatchMonitoredResourceDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "c0fe609683b55fa16436656e5f82673e", "score": "0.6986813", "text": "func (fp *CreateSecretRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "575ce149b920a1d2cc1f96b5c583c553", "score": "0.6983486", "text": "func (fp *DeleteSecretRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "9301bbb518b18caf5e07f2f5d40dea59", "score": "0.69831955", "text": "func (fp *BatchGetDevicesResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "f86823f1d6980f1bacbd715c79df8cae", "score": "0.6980538", "text": "func (fp *BatchGetConditionsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "27a29e3e8ce65dfa84ee5216e8fb5bfc", "score": "0.6980319", "text": "func (fp *DeleteDeviceRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "819661b03616f2a802a0661e40af8b96", "score": "0.6980279", "text": "func (fps *ProvisioningPolicySpecTemplate_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "9b93b952bde5947e8c5c3d11d29c3ca4", "score": "0.6977901", "text": "func (fp *WatchMonitoredResourceDescriptorsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "14b269a00e63147e878c9958ed601408", "score": "0.69710565", "text": "func (fp *WatchServiceAccountKeysResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" } ]
3fd1d0187379a5197542e94c0f155fd4
IsAndroid check plat is android or ipad.
[ { "docid": "cba6c8ef84113d8aedfc6fc00574d0d8", "score": "0.8657334", "text": "func IsAndroid(plat int8) bool {\n\treturn plat == PlatAndroid || plat == PlatAndroidG || plat == PlatAndroidI || plat == PlatAndroidB\n}", "title": "" } ]
[ { "docid": "2e15059da39da6be847ccb5ffaec1308", "score": "0.8609563", "text": "func IsAndroid(plat int8) bool {\n\treturn plat == PlatAndroid || plat == PlatAndroidG\n}", "title": "" }, { "docid": "db36167868cc42935edddfdc59560bb2", "score": "0.7556385", "text": "func (ua UserAgent) IsAndroid() bool {\n\treturn ua.OS == Android\n}", "title": "" }, { "docid": "6c2fe3df1ec50b5b25b4b79a4bb9dd7e", "score": "0.6299092", "text": "func ConditionalAccessDevicePlatformPAndroid() *ConditionalAccessDevicePlatform {\n\tv := ConditionalAccessDevicePlatformVAndroid\n\treturn &v\n}", "title": "" }, { "docid": "0923b4aee62dcb948db0f712efe05819", "score": "0.5794156", "text": "func PlatformPAndroid() *Platform {\n\tv := PlatformVAndroid\n\treturn &v\n}", "title": "" }, { "docid": "762b0ef522a4a9eb6a850274df008863", "score": "0.577331", "text": "func IsAndroidUUID(uuid string) bool {\n\tif !FastValidateUUID(uuid) {\n\t\treturn false\n\t}\n\treturn uuidRegexAndroid.MatchString(uuid)\n}", "title": "" }, { "docid": "7be609fa72aca38dd6e3a8ce148ec194", "score": "0.575937", "text": "func DeviceTypePAndroid() *DeviceType {\n\tv := DeviceTypeVAndroid\n\treturn &v\n}", "title": "" }, { "docid": "7eacc4f2b6980b63fc716700b8a6297b", "score": "0.5530507", "text": "func Detect_devices(installdir string) bool {\n\t//if device is arch64 return 1, else return 0\n\t//device_arch, _ := exec.Command(\"bash\", \"-c\", `. ~/.bashrc && adb shell getprop ro.product.cpu.abi`).Output()\n\tadb_path := filepath.Join(installdir, \"android-sdk-linux\", \"platform-tools\", \"adb\")\n\tdevice_arch, _ := exec.Command(\"bash\", \"-c\", adb_path+\" shell getprop ro.product.cpu.abi\").Output()\n\n\tis_64 := false\n\tif strings.Contains(string(device_arch), \"arm64-v8a\") {\n\t\tis_64 = true\n\t} else if strings.Contains(string(device_arch), \"armeabi-v7a\") {\n\t\tis_64 = false\n\t} else {\n\t\tfmt.Println(\"cannot detect the device\")\n\t\tos.Exit(2)\n\t}\n\treturn is_64\n}", "title": "" }, { "docid": "1ece0ccb3ac4bf20235597e65965b489", "score": "0.5499493", "text": "func isMobile(ua *ua.UserAgent) bool {\n\t// workaround as the library does not recognise iOS string inside the user agent\n\tisIOS := ua.IsIOS() || strings.Contains(ua.String, \"iOS\")\n\treturn !isWeb(ua) && (ua.IsAndroid() || isIOS)\n}", "title": "" }, { "docid": "e02deed4574e2ec24d2f29377cc5ba6a", "score": "0.53697646", "text": "func IsPlatformLinux(pCheck string) bool {\n\treturn (pCheck == \"ubuntu\" || pCheck == \"centos\" || pCheck == \"rhel\" || pCheck == \"fedora\" || pCheck == \"debian\" || pCheck == \"opensuse\" || pCheck == \"arch\" || pCheck == \"amzn\")\n}", "title": "" }, { "docid": "2c3fb8f24066c8f4f1ab40cf94c3b591", "score": "0.5335018", "text": "func DeviceTypePAndroidForWork() *DeviceType {\n\tv := DeviceTypeVAndroidForWork\n\treturn &v\n}", "title": "" }, { "docid": "48c27c473c1793107fd9bb2a40ae8afb", "score": "0.5323318", "text": "func Linux() bool {\n\treturn runtime.GOOS == \"linux\"\n}", "title": "" }, { "docid": "1ae5eca88ad308d21323ad51d4a55a55", "score": "0.52810264", "text": "func IsIPad(plat int8) bool {\n\treturn plat == PlatIPad || plat == PlatIPadI || plat == PlatIpadHD\n}", "title": "" }, { "docid": "2bf5a9a59a18a2e79a5d483a4e68901a", "score": "0.5279135", "text": "func (t *builderTrait) IsPlatformTrait() bool {\n\treturn true\n}", "title": "" }, { "docid": "dcf4902ca88ab5de1915cbc599b11d66", "score": "0.5275705", "text": "func (ua UserAgent) IsLinux() bool {\n\treturn ua.OS == Linux\n}", "title": "" }, { "docid": "dc6b3590f8f7172928188d9323ea7336", "score": "0.52696836", "text": "func IsIOS(plat int8) bool {\n\treturn plat == PlatIPad || plat == PlatIPhone || plat == PlatIPadI || plat == PlatIPhoneI\n}", "title": "" }, { "docid": "ffdebb4f0bc78b61789ef96deb173722", "score": "0.5232816", "text": "func AndroidCompileFlags(s string) bool {\n\treturn !(machineSpecificFlag(s) || compilerStandard(s))\n}", "title": "" }, { "docid": "7ae4d03d76b28e28a482e25130f38c12", "score": "0.5203741", "text": "func IsIOS(plat int8) bool {\n\treturn plat == PlatIPad || plat == PlatIPhone || plat == PlatIPadI || plat == PlatIPhoneI || plat == PlatIPhoneB\n}", "title": "" }, { "docid": "f93ea64d15d3a142769f9842537132b6", "score": "0.5202427", "text": "func (appCtx *AppContext) IsMobile() bool {\n\treturn (appCtx.Platform == types.DeviceAndroid ||\n\t\tappCtx.Platform == types.DeviceIOS)\n}", "title": "" }, { "docid": "97ed7f840cef5bcba85a76863b2ca03a", "score": "0.518591", "text": "func DeviceTypePAndroidEnterprise() *DeviceType {\n\tv := DeviceTypeVAndroidEnterprise\n\treturn &v\n}", "title": "" }, { "docid": "c470d9e58494efb8dbfd2fcd240e4df2", "score": "0.51474065", "text": "func IsLinux() bool {\n\treturn runtime.GOOS == \"linux\"\n}", "title": "" }, { "docid": "c470d9e58494efb8dbfd2fcd240e4df2", "score": "0.51474065", "text": "func IsLinux() bool {\n\treturn runtime.GOOS == \"linux\"\n}", "title": "" }, { "docid": "c470d9e58494efb8dbfd2fcd240e4df2", "score": "0.51474065", "text": "func IsLinux() bool {\n\treturn runtime.GOOS == \"linux\"\n}", "title": "" }, { "docid": "c470d9e58494efb8dbfd2fcd240e4df2", "score": "0.51474065", "text": "func IsLinux() bool {\n\treturn runtime.GOOS == \"linux\"\n}", "title": "" }, { "docid": "8069056fdd4593d217a86e126231988f", "score": "0.50956684", "text": "func AndroidLinkFlags(s string) bool {\n\treturn !machineSpecificFlag(s)\n}", "title": "" }, { "docid": "9d977e3a11d06d07da79690abce6fd2c", "score": "0.5013062", "text": "func (o *LinkTokenCreateRequest) HasAndroidPackageName() bool {\n\tif o != nil && o.AndroidPackageName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f2f94a0bb3deac24742d5fffe3091d3c", "score": "0.4977221", "text": "func (t *platformTrait) IsPlatformTrait() bool {\n\treturn true\n}", "title": "" }, { "docid": "ba193149a8660ed6029fb818b00d1c65", "score": "0.49426776", "text": "func (s *Service) platform(resID string) (platform string) {\n\tvar (\n\t\terr error\n\t\tios, android bool\n\t\tmobiAPPs []string\n\t)\n\tplatform = _platAll // default value\n\tif mobiAPPs, err = s.pushDao.Platform(ctx, resID); err != nil {\n\t\treturn\n\t}\n\tfor _, value := range mobiAPPs {\n\t\tswitch value {\n\t\tcase _vAndroid:\n\t\t\tandroid = true\n\t\tcase _vAndroidB:\n\t\t\tandroid = true\n\t\tcase _vIPad:\n\t\t\tios = true\n\t\tcase _vIPhone:\n\t\t\tios = true\n\t\tdefault:\n\t\t\tlog.Error(\"ResourceID %d, Limit Wrong Value %s\", resID, value)\n\t\t}\n\t}\n\tif ios && !android {\n\t\treturn _platIOS\n\t}\n\tif !ios && android {\n\t\treturn _platAndroid\n\t}\n\treturn // other case like all or none, just return the default value\n}", "title": "" }, { "docid": "84385649ef8d5a81b373064b13bf7621", "score": "0.49425527", "text": "func (a *Android) Name() string {\n\treturn \"android\"\n}", "title": "" }, { "docid": "57260d0378c7b0762a74cd853eead8e1", "score": "0.4940621", "text": "func Os(os string) string {\n\tif os == \"\" {\n\t\treturn \"\"\n\t}\n\tif MatchOsiOS(os) {\n\t\treturn \"ios\"\n\t}\n\tif MatchOsAndroid(os) {\n\t\treturn \"android\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "8803095651b6ae4ba6732481cf2cd6df", "score": "0.48807192", "text": "func SetAndroid(path string) {\n\tandroid = true\n\tcwd = path\n}", "title": "" }, { "docid": "bd170a832088dd3bc46bbf0090353182", "score": "0.48699734", "text": "func IsTablet() bool {\n\treturn C.SDL_IsTablet() == C.SDL_TRUE\n}", "title": "" }, { "docid": "8bae71ee55b32090fdf3bdcc49e6f9dc", "score": "0.48613292", "text": "func IsUnix() bool {\n\tsys_type := runtime.GOOS\n\n\tif sys_type == \"windows\" {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "57644fc6552508a0d1d14a735fa88dc0", "score": "0.4845148", "text": "func IsMobile(r *http.Request) bool {\n\t//put headers in a map\n\theaders := make(map[string]string)\n\n\t//net/http中获取headers\n\tif len(r.Header) > 0 {\n\t\tfor k, v := range r.Header {\n\t\t\theaders[k] = v[0]\n\t\t\t//fmt.Printf(\"%s=%s\\n\", k, v[0])\n\t\t}\n\t}\n\tvar is_mobile = false\n\tvia := strings.ToLower(headers[\"VIA\"])\n\taccept := strings.ToUpper(headers[\"Accept\"])\n\tHTTP_X_WAP_PROFILE := headers[\"X_WAP_PROFILE\"]\n\tHTTP_PROFILE := headers[\"PROFILE\"]\n\tHTTP_USER_AGENT := headers[\"User-Agent\"]\n\tif via != \"\" && strings.Index(via, \"wap\") != -1 {\n\t\tis_mobile = true\n\t} else if accept != \"\" && strings.Index(accept, \"VND.WAP.WML\") != -1 {\n\t\tis_mobile = true\n\t} else if HTTP_X_WAP_PROFILE != \"\" || HTTP_PROFILE != \"\" {\n\t\tis_mobile = true\n\t} else if HTTP_USER_AGENT != \"\" {\n\n\t\treg := regexp.MustCompile(`(?i:(blackberry|configuration\\/cldc|hp |hp-|htc |htc_|htc-|iemobile|kindle|midp|mmp|motorola|mobile|nokia|opera mini|opera |Googlebot-Mobile|YahooSeeker\\/M1A1-R2D2|android|iphone|ipod|mobi|palm|palmos|pocket|portalmmm|ppc;|smartphone|sonyericsson|sqh|spv|symbian|treo|up.browser|up.link|vodafone|windows ce|xda |xda_|MicroMessenger))`)\n\n\t\tfmt.Printf(\"%q\\n\", reg.FindAllString(HTTP_USER_AGENT, -1))\n\n\t\tif len(reg.FindAllString(HTTP_USER_AGENT, -1)) > 0 {\n\t\t\tis_mobile = true\n\t\t}\n\n\t}\n\n\tif is_mobile == true {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "42f1f2dbd4d867f35a070a5b70765650", "score": "0.48331147", "text": "func (m *AndroidLobApp) GetMinimumSupportedOperatingSystem()(AndroidMinimumOperatingSystemable) {\n return m.minimumSupportedOperatingSystem\n}", "title": "" }, { "docid": "e416a573278cc4aa4843ee8b54430436", "score": "0.48136526", "text": "func (i ApexInfo) IsForPlatform() bool {\n\treturn i.ApexVariationName == \"\"\n}", "title": "" }, { "docid": "211caadd786b359a3e8b769d19e0384b", "score": "0.47884673", "text": "func isDevice(path string) bool {\n\tinfo, err := loggedStat(path)\n\treturn err == nil && info.Mode()&os.ModeDevice != 0\n}", "title": "" }, { "docid": "a02433a5e274131c90c988f4b137aba5", "score": "0.47441292", "text": "func (a *Android) Enabled() bool {\n\treturn a.enabled\n}", "title": "" }, { "docid": "b3f3107408f3df245d1574506036ff92", "score": "0.47416246", "text": "func (t OSType) IsLinux() bool {\n\tswitch t {\n\tcase Ubuntu, CentOS, GenericLinux, OpenSUSE:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "eb878c476a96470927a026e0029631ba", "score": "0.47244182", "text": "func CheckOS(c *selector.Context, in mr.AdData) bool {\n\treturn in.CampaignPlatforms.Has(true, c.RequestData.PlatformID)\n}", "title": "" }, { "docid": "64464aaf97d112ec7aa0abcbdc96d9bd", "score": "0.47116727", "text": "func IsAliKernel() bool {\n\tcmd := \"uname -r | grep -i alios\"\n\tif icmd.RunCommand(\"bash\", \"-c\", cmd).ExitCode == 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "88ba24fbfd7362f59af05111aa11b9fd", "score": "0.4663914", "text": "func isValidOSArch(os, arch string) bool {\n\tswitch fmt.Sprintf(\"%s/%s\", os, arch) {\n\tcase \"android/386\",\n\t\t\"android/amd64\",\n\t\t\"android/arm\",\n\t\t\"android/arm64\",\n\t\t\"darwin/386\",\n\t\t\"darwin/amd64\",\n\t\t\"darwin/arm\",\n\t\t\"darwin/arm64\",\n\t\t\"dragonfly/amd64\",\n\t\t\"freebsd/386\",\n\t\t\"freebsd/amd64\",\n\t\t\"freebsd/arm\",\n\t\t\"js/wasm\",\n\t\t\"linux/386\",\n\t\t\"linux/amd64\",\n\t\t\"linux/arm\",\n\t\t\"linux/arm64\",\n\t\t\"linux/mips\",\n\t\t\"linux/mips64\",\n\t\t\"linux/mips64le\",\n\t\t\"linux/mipsle\",\n\t\t\"linux/ppc64\",\n\t\t\"linux/ppc64le\",\n\t\t\"linux/riscv64\",\n\t\t\"linux/s390x\",\n\t\t\"nacl/386\",\n\t\t\"nacl/amd64p32\",\n\t\t\"nacl/arm\",\n\t\t\"netbsd/386\",\n\t\t\"netbsd/amd64\",\n\t\t\"netbsd/arm\",\n\t\t\"openbsd/386\",\n\t\t\"openbsd/amd64\",\n\t\t\"openbsd/arm\",\n\t\t\"plan9/386\",\n\t\t\"plan9/amd64\",\n\t\t\"plan9/arm\",\n\t\t\"solaris/amd64\",\n\t\t\"windows/386\",\n\t\t\"windows/amd64\":\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "5654979bdb5389594b109dec32023d20", "score": "0.46611634", "text": "func OperatingSystemIs(os string) bool {\n\treturn runtime.GOOS == os\n}", "title": "" }, { "docid": "6b2df4e448130da006de857d1cc8cb16", "score": "0.4610523", "text": "func (cmd *Android) Name() string {\n\treturn \"android\"\n}", "title": "" }, { "docid": "1f276b03d2d843bf4156f7884a7f394a", "score": "0.4605666", "text": "func IsOS(os string) bool {\n\treturn runtime.GOOS == os\n}", "title": "" }, { "docid": "9933475ccf46e987034cd862a804a97e", "score": "0.46044412", "text": "func detectPlatform(c *cli.Context) (string, error) {\n\tUI.Debug(\"Attempting to determine the platform\")\n\n\tcontext := context.New(middleware.GetSession(c))\n\tif c.String(\"instances\") != \"\" {\n\t\treturn ec2utils.DetectPlatformForInstances(\n\t\t\tcontext,\n\t\t\tinstanceList(c),\n\t\t)\n\t}\n\n\tif c.String(\"autoscale-group\") != \"\" {\n\t\tUI.Debug(\"Determining Autoscale Group Platform\")\n\t\treturn ec2utils.DetectPlatformForAutoscaleGroup(\n\t\t\tcontext,\n\t\t\tc.String(\"autoscale-group\"),\n\t\t)\n\t}\n\n\treturn ec2utils.DetectPlatformForTag(\n\t\tcontext,\n\t\tc.String(\"tag-key\"),\n\t\tc.String(\"tag-value\"),\n\t)\n}", "title": "" }, { "docid": "4f88d5ca4c64d1313c30a28225b9c196", "score": "0.46014756", "text": "func IsDevMode() bool {\r\n\tenv, ok := os.LookupEnv(\"DEV_MODE\")\r\n\tif !ok {\r\n\t\treturn false\r\n\t}\r\n\r\n\tif env == \"true\" {\r\n\t\treturn true\r\n\t}\r\n\r\n\tenvInt, err := strconv.Atoi(env)\r\n\tif err != nil {\r\n\t\treturn false\r\n\t}\r\n\r\n\treturn envInt > 0\r\n}", "title": "" }, { "docid": "c3c13b039e96e6350f422f8c7f84227e", "score": "0.4575453", "text": "func IsIOSNormal(plat int8) bool {\n\treturn plat == PlatIPad || plat == PlatIPhone || plat == PlatIPadI || plat == PlatIPhoneI\n}", "title": "" }, { "docid": "c3703af7efee4cc53a5ba97332ef4d60", "score": "0.45564538", "text": "func IsDevlike(serviceEnv string) bool {\n\treturn !IsProdlike(serviceEnv)\n}", "title": "" }, { "docid": "ba32f17c266364c2608f2e94049b55ad", "score": "0.45377287", "text": "func (ua UserAgent) IsIOS() bool {\n\treturn ua.OS == IOS\n}", "title": "" }, { "docid": "6f6c8c769c2f299eba552a9efdc5a59a", "score": "0.45326123", "text": "func IsIPad(plat int8) bool {\n\treturn plat == PlatIPad || plat == PlatIPadI\n}", "title": "" }, { "docid": "3289a4c17de7dc904e153c03767257d1", "score": "0.4495853", "text": "func (o *AndroidLobApp) HasMinimumSupportedOperatingSystem() bool {\n\tif o != nil && o.MinimumSupportedOperatingSystem != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7053a5ed3a7baf416a01c45e6375cc5b", "score": "0.44773975", "text": "func (c *Config) IsOPDK() bool {\n\treturn !c.IsGCPManaged() && !c.IsApigeeManaged()\n}", "title": "" }, { "docid": "50d958818bf0ccfb6931f989d1807cd2", "score": "0.44765002", "text": "func InitCommonOSAndroidMultiTargetsArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib Multilib) {\n\tInitAndroidArchModule(m, hod, defaultMultilib)\n\tm.base().commonProperties.UseTargetVariants = false\n\tm.base().commonProperties.CreateCommonOSVariant = true\n}", "title": "" }, { "docid": "35bc4b1787cf0165c801eb03ab59fa47", "score": "0.4460456", "text": "func (c *VersionInfo) IsSupport(goos, goarch string) bool {\n\ts := fmt.Sprintf(\"%s/%s\", goos, goarch)\n\tfor _, p := range c.Platforms {\n\t\tif p == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "feecc26aa0f8cf23d4a04018e9b039a8", "score": "0.44525954", "text": "func (user *CurrentUser) Platform() string {\n\tswitch strconv.Itoa(user.applicationID) {\n\tcase os.Getenv(\"GKKKB_ANDROID_APP_ID\"):\n\t\treturn \"gkkkbandroid\"\n\tcase os.Getenv(\"GKKKB_IOS_APP_ID\"):\n\t\treturn \"gkkkbios\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "afcab3fa724ef40595ddef5aa24ac36b", "score": "0.44509095", "text": "func (s *Stat) IsDevice() bool {\n\treturn s.Mode&Device == Device\n}", "title": "" }, { "docid": "68dd7ca00ca934128d3ff984abbdd763", "score": "0.44378924", "text": "func (d *Data) IsUbuntu() bool {\n\treturn d.ID == UbuntuID\n}", "title": "" }, { "docid": "13e18bc1d795ee9471b14e2ae065164d", "score": "0.44336483", "text": "func AndroidPhoneConstruct(brand, model string) androidPhone {\n\treturn androidPhone{brand: brand, model: model, phoneType: \"smartphone\", os: \"Android\"}\n}", "title": "" }, { "docid": "fe51a87daf6805d534fefa0afce083c1", "score": "0.4431252", "text": "func getIsOnDeviceSpecific(internal *DeviceUpdateMessage) bool {\n\tswitch internal.DeviceType { // nolint: gocritic\n\tcase enums.DevVacuum:\n\t\tst, ok := internal.State[enums.PropVacStatus]\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\n\t\treturn st == enums.VacCleaning\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "beebd4a9132acea77a9774739fd7b74f", "score": "0.43944082", "text": "func buildModeSupported(compiler, buildmode, goos, goarch string) bool {\n\tif compiler == \"gccgo\" {\n\t\treturn true\n\t}\n\n\tplatform := goos + \"/\" + goarch\n\n\tswitch buildmode {\n\tcase \"archive\":\n\t\treturn true\n\n\tcase \"c-archive\":\n\t\tswitch goos {\n\t\tcase \"aix\", \"darwin\", \"ios\", \"windows\":\n\t\t\treturn true\n\t\tcase \"linux\":\n\t\t\tswitch goarch {\n\t\t\tcase \"386\", \"amd64\", \"arm\", \"armbe\", \"arm64\", \"arm64be\", \"loong64\", \"ppc64le\", \"riscv64\", \"s390x\":\n\t\t\t\t// linux/ppc64 not supported because it does\n\t\t\t\t// not support external linking mode yet.\n\t\t\t\treturn true\n\t\t\tdefault:\n\t\t\t\t// Other targets do not support -shared,\n\t\t\t\t// per ParseFlags in\n\t\t\t\t// cmd/compile/internal/base/flag.go.\n\t\t\t\t// For c-archive the Go tool passes -shared,\n\t\t\t\t// so that the result is suitable for inclusion\n\t\t\t\t// in a PIE or shared library.\n\t\t\t\treturn false\n\t\t\t}\n\t\tcase \"freebsd\":\n\t\t\treturn goarch == \"amd64\"\n\t\t}\n\t\treturn false\n\n\tcase \"c-shared\":\n\t\tswitch platform {\n\t\tcase \"linux/amd64\", \"linux/arm\", \"linux/arm64\", \"linux/loong64\", \"linux/386\", \"linux/ppc64le\", \"linux/riscv64\", \"linux/s390x\",\n\t\t\t\"android/amd64\", \"android/arm\", \"android/arm64\", \"android/386\",\n\t\t\t\"freebsd/amd64\",\n\t\t\t\"darwin/amd64\", \"darwin/arm64\",\n\t\t\t\"windows/amd64\", \"windows/386\", \"windows/arm64\":\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\n\tcase \"default\":\n\t\treturn true\n\n\tcase \"exe\":\n\t\treturn true\n\n\tcase \"pie\":\n\t\tswitch platform {\n\t\tcase \"linux/386\", \"linux/amd64\", \"linux/arm\", \"linux/arm64\", \"linux/loong64\", \"linux/ppc64le\", \"linux/riscv64\", \"linux/s390x\",\n\t\t\t\"android/amd64\", \"android/arm\", \"android/arm64\", \"android/386\",\n\t\t\t\"freebsd/amd64\",\n\t\t\t\"darwin/amd64\", \"darwin/arm64\",\n\t\t\t\"ios/amd64\", \"ios/arm64\",\n\t\t\t\"aix/ppc64\",\n\t\t\t\"windows/386\", \"windows/amd64\", \"windows/arm\", \"windows/arm64\":\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\n\tcase \"shared\":\n\t\tswitch platform {\n\t\tcase \"linux/386\", \"linux/amd64\", \"linux/arm\", \"linux/arm64\", \"linux/ppc64le\", \"linux/s390x\":\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\n\tcase \"plugin\":\n\t\tswitch platform {\n\t\tcase \"linux/amd64\", \"linux/arm\", \"linux/arm64\", \"linux/386\", \"linux/s390x\", \"linux/ppc64le\",\n\t\t\t\"android/amd64\", \"android/386\",\n\t\t\t\"darwin/amd64\", \"darwin/arm64\",\n\t\t\t\"freebsd/amd64\":\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "0b6184deae76c41957b57729ebfef8f4", "score": "0.43870503", "text": "func isOsMatch(os string) bool {\n\tout, _ := ExecCmd(\"grep\", os, \"/etc/issue\")\n\tif len(out) > 0 {\n\t\tlog.Printf(\"[isOsMatch] host OS is determined to be %s\", os)\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "563c4dd61ee119615213beef3ddeefbd", "score": "0.43814632", "text": "func getPlatform(comment []string) string {\n\tif len(comment) > 0 {\n\t\tif comment[0] != \"compatible\" {\n\t\t\tif strings.HasPrefix(comment[0], \"Windows\") {\n\t\t\t\treturn \"Windows\"\n\t\t\t} else if strings.HasPrefix(comment[0], \"Symbian\") {\n\t\t\t\treturn \"Symbian\"\n\t\t\t} else if strings.HasPrefix(comment[0], \"webOS\") {\n\t\t\t\treturn \"webOS\"\n\t\t\t} else if comment[0] == \"BB10\" {\n\t\t\t\treturn \"BlackBerry\"\n\t\t\t}\n\t\t\treturn comment[0]\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "9599c41e5720b9b3251f965d4863b9d5", "score": "0.43763113", "text": "func (ap AddressFamilyAndProtocol) IsUnix() bool {\n\treturn 0x30 == ap&0xF0\n}", "title": "" }, { "docid": "9599c41e5720b9b3251f965d4863b9d5", "score": "0.43763113", "text": "func (ap AddressFamilyAndProtocol) IsUnix() bool {\n\treturn 0x30 == ap&0xF0\n}", "title": "" }, { "docid": "1b2e4dc25a5905c80c8e7feb1fff13e6", "score": "0.43713948", "text": "func IsDevModeOn(app App) bool {\n\treturn app.ObjectMeta().Labels[model.DevLabel] == \"true\"\n}", "title": "" }, { "docid": "1954b1bbeca7843a17addc366dc48c34", "score": "0.43712783", "text": "func AndroidWiFiSecurityTypePOpen() *AndroidWiFiSecurityType {\n\tv := AndroidWiFiSecurityTypeVOpen\n\treturn &v\n}", "title": "" }, { "docid": "9392a43a2d46333627d24a110cccc15c", "score": "0.43696102", "text": "func (c *ServiceConfig) MatchesPlatform() bool {\n\treturn len(c.Platform) == 0 || c.Platform == runtime.GOOS\n}", "title": "" }, { "docid": "d2af05e22852899454fa5620e9de6dcd", "score": "0.43675247", "text": "func isDesktop(ua *ua.UserAgent) bool {\n\treturn ua.Desktop && !isWeb(ua)\n}", "title": "" }, { "docid": "baa5a4cdf4aeb874d4c3c29a7b4f9f31", "score": "0.43548384", "text": "func isAppEngine() bool {\n\t_, service := os.LookupEnv(\"GAE_SERVICE\")\n\t_, version := os.LookupEnv(\"GAE_VERSION\")\n\t_, instance := os.LookupEnv(\"GAE_INSTANCE\")\n\n\treturn service && version && instance\n}", "title": "" }, { "docid": "b1fb22fa6fc7e5daea7d23fa63223e07", "score": "0.43514782", "text": "func AndroidForWorkCrossProfileDataSharingTypePAllowPersonalToWork() *AndroidForWorkCrossProfileDataSharingType {\n\tv := AndroidForWorkCrossProfileDataSharingTypeVAllowPersonalToWork\n\treturn &v\n}", "title": "" }, { "docid": "400a41127a3efbc02fd93959b4b6d2d6", "score": "0.43477964", "text": "func MatchesPlatform(image imgspecv1.Platform, wanted imgspecv1.Platform) bool {\n\treturn image.Architecture == wanted.Architecture &&\n\t\timage.OS == wanted.OS &&\n\t\timage.Variant == wanted.Variant\n}", "title": "" }, { "docid": "b19473f3af1ba2248bceabb3d8818152", "score": "0.43346116", "text": "func AndroidWiFiSecurityTypePWpaEnterprise() *AndroidWiFiSecurityType {\n\tv := AndroidWiFiSecurityTypeVWpaEnterprise\n\treturn &v\n}", "title": "" }, { "docid": "06a50bcf11e04959ffe5f03966037f84", "score": "0.43288136", "text": "func (r *resource) isAppEngine() bool {\n\tservice := r.attrs.EnvVar(\"GAE_SERVICE\")\n\tversion := r.attrs.EnvVar(\"GAE_VERSION\")\n\tinstance := r.attrs.EnvVar(\"GAE_INSTANCE\")\n\treturn service != \"\" && version != \"\" && instance != \"\"\n}", "title": "" }, { "docid": "f4e5666ba2e9e9e3948a5fe43b74a0b1", "score": "0.43102598", "text": "func isWeb(ua *ua.UserAgent) bool {\n\treturn ua.IsChrome() || ua.IsEdge() || ua.IsFirefox() || ua.IsSafari() ||\n\t\tua.IsInternetExplorer() || ua.IsOpera() || ua.IsOperaMini()\n}", "title": "" }, { "docid": "048e1af976449a53c7225b844967e7df", "score": "0.43097618", "text": "func isDev() bool {\n\tfor _, v := range os.Args {\n\t\tif v == \"--dev\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a1e5c57e35f1bb83d5399ccd26ed6c1e", "score": "0.4300943", "text": "func (manifest *BuildManifest) IsRunnable() (bool, error) {\n\tif len(manifest.Android.Apk) == 0 || len(manifest.Android.ApkInstrumentation) == 0 {\n\t\treturn false, fmt.Errorf(\"Missing Android apk or apk_instrumentation\")\n\t}\n\tif len(manifest.DevicePool) == 0 {\n\t\treturn false, fmt.Errorf(\"Missing devicepool\")\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "3657bc2621871e7992bcd512c39e4057", "score": "0.42971542", "text": "func IsDev() bool {\n\tenv, ok := os.LookupEnv(\"ENV\")\n\tif !ok {\n\t\treturn false\n\t}\n\tenv = strings.ToLower(env)\n\tif env == \"development\" || env == \"dev\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ab0347e7defc2371d62d032b0a03bbca", "score": "0.42951235", "text": "func IsDev(serviceEnv string) bool {\n\tswitch serviceEnv {\n\tcase ServiceEnvDev:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "582741f66e1992483a180d75ed81c76f", "score": "0.4291545", "text": "func CheckOS() string {\n\tswitch os := runtime.GOOS; os {\n\tcase \"darwin\":\n\t\treturn \"macos\"\n\tcase \"linux\":\n\t\treturn \"linux\"\n\tcase \"windows\":\n\t\treturn \"windows\"\n\tdefault:\n\t\tlog.Fatal(\"Tokaido is currently only compatible with limited Linux distributions, Windows 10 Pro and MacOS High Sierra or newer.\")\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "36e3df9721a9829f04543a1d9a4504e3", "score": "0.42860714", "text": "func platformValidate(osFilterList, archFilterList []string, platform *manifest.Schema2PlatformSpec) bool {\n\tosMatched := true\n\tarchMatched := true\n\n\tif len(osFilterList) != 0 && platform.OS != \"\" {\n\t\tosMatched = false\n\t\tfor _, o := range osFilterList {\n\t\t\t// match os:osversion\n\t\t\tif colonMatch(o, platform.OS, platform.OSVersion) {\n\t\t\t\tosMatched = true\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(archFilterList) != 0 && platform.Architecture != \"\" {\n\t\tarchMatched = false\n\t\tfor _, a := range archFilterList {\n\t\t\t// match architecture:variant\n\t\t\tif colonMatch(a, platform.Architecture, platform.Variant) {\n\t\t\t\tarchMatched = true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn osMatched && archMatched\n}", "title": "" }, { "docid": "c5ab859e48b1db7144260afe02dde1eb", "score": "0.4283734", "text": "func (*myos) IsWindows() bool {\n\treturn \"windows\" == runtime.GOOS\n}", "title": "" }, { "docid": "aba3f9b750dc17dbbe028d4aa72776c0", "score": "0.42836908", "text": "func OpenAndroidApp(ctx context.Context, s *testing.State) {\n\tfixtData := s.FixtValue().(*assistant.FixtData)\n\tcr := fixtData.Chrome\n\n\ttconn, err := cr.TestAPIConn(ctx)\n\tif err != nil {\n\t\ts.Fatal(\"Creating test API connection failed: \", err)\n\t}\n\n\ts.Log(\"Waiting for ARC package list initial refreshed\")\n\tif err := waitForArcPackageListInitialRefreshed(ctx, s, tconn); err != nil {\n\t\ts.Fatal(\"Failed to wait for ARC package to become ready: \", err)\n\t}\n\n\ts.Log(\"Sending open Play Store query to the Assistant\")\n\tif _, err := assistant.SendTextQuery(ctx, tconn, \"open Play Store\"); err != nil {\n\t\ts.Fatal(\"Failed to send the Assistant text query: \", err)\n\t}\n\n\ts.Log(\"Waiting for Play Store window to be shown\")\n\tif err := ash.WaitForApp(ctx, tconn, apps.PlayStore.ID, time.Minute); err != nil {\n\t\ts.Fatal(\"Play Store failed to launch: \", err)\n\t}\n}", "title": "" }, { "docid": "871541d0c3c784c9d492fa6debb618d1", "score": "0.42741495", "text": "func IsDevTest(serviceEnv string) bool {\n\tswitch serviceEnv {\n\tcase ServiceEnvDev, ServiceEnvTest:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "1ec652a845f379b286b877ce0573309b", "score": "0.42717457", "text": "func IsPlatformSupported(platform string) bool {\n\ti := sort.SearchStrings(SupportedPlatforms, platform)\n\treturn i < len(SupportedPlatforms) && SupportedPlatforms[i] == platform\n}", "title": "" }, { "docid": "6d933f6a0776e5c9e4443dac1c3e4650", "score": "0.4270169", "text": "func (md *MobileDetect) IsMobile() bool {\n\tif md.CheckHttpHeadersForMobile() {\n\t\treturn true\n\t}\n\treturn md.matchDetectionRulesAgainstUA()\n}", "title": "" }, { "docid": "7522005c95363a0be628ab7ab77ef94f", "score": "0.42651823", "text": "func (ad *FabricAdapter) IsRoutingDevice(ctx context.Context, ModelVersion string) bool {\n\tdata := strings.Split(ModelVersion, \"_\")\n\tModel := data[0]\n\treturn adapter.AvalancheType == Model || adapter.OrcaType == Model || adapter.OrcaTType == Model\n\n}", "title": "" }, { "docid": "8d410bc0093b97759ce12872fa55fbb9", "score": "0.4250813", "text": "func (cmd *Android) Description() string {\n\treturn \"Build and package a fyne application for the android OS\"\n}", "title": "" }, { "docid": "c2115af4246cdc45c3d0f337da3a8441", "score": "0.42501128", "text": "func isProd() bool {\n\treturn model.BuildNumber != \"dev\"\n}", "title": "" }, { "docid": "58103f6bef92117229afc96f626edc69", "score": "0.42488614", "text": "func IsProd() bool {\n\tenv := os.Getenv(\"HOLLY_ENV\")\n\treturn env == \"PROD\"\n}", "title": "" }, { "docid": "3df1553d6bf6c497e692dd0a81014e96", "score": "0.4241622", "text": "func IsWindowsPlatform() bool {\n\treturn runtime.GOOS == \"windows\"\n}", "title": "" }, { "docid": "3ff25e112c5134cc178d0b9da76cede1", "score": "0.42364714", "text": "func (asset Asset) IsNative() bool {\n\treturn asset.Type == NativeType\n}", "title": "" }, { "docid": "aade26dde6343be2d9b9e33a88031c01", "score": "0.42361027", "text": "func (cfg *Config) OnProd() bool {\n return cfg.Env == env.Prod\n}", "title": "" }, { "docid": "339b63589deeeefc596af453941af145", "score": "0.42299876", "text": "func Plat(mobiApp, device string) int8 {\n\tswitch mobiApp {\n\tcase \"iphone\":\n\t\tif device == \"pad\" {\n\t\t\treturn PlatIPad\n\t\t}\n\t\treturn PlatIPhone\n\tcase \"white\":\n\t\treturn PlatIPhone\n\tcase \"ipad\":\n\t\treturn PlatIPad\n\tcase \"android\", \"android_b\":\n\t\treturn PlatAndroid\n\tcase \"win\":\n\t\treturn PlatWPhone\n\tcase \"android_G\":\n\t\treturn PlatAndroidG\n\tcase \"android_i\":\n\t\treturn PlatAndroidI\n\tcase \"iphone_i\":\n\t\tif device == \"pad\" {\n\t\t\treturn PlatIPadI\n\t\t}\n\t\treturn PlatIPhoneI\n\tcase \"ipad_i\":\n\t\treturn PlatIPadI\n\tcase \"android_tv\":\n\t\treturn PlatAndroidTV\n\tcase \"iphone_b\":\n\t\treturn PlatIPhoneB\n\t}\n\treturn PlatIPhone\n}", "title": "" }, { "docid": "c0760ba0e58e36821672597601e41a72", "score": "0.42261118", "text": "func NewAndroidMinimumOperatingSystem()(*AndroidMinimumOperatingSystem) {\n m := &AndroidMinimumOperatingSystem{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "title": "" }, { "docid": "a9aa70e737dec1f2ef321cdbb07d3f5d", "score": "0.42204124", "text": "func deviceProviderMatch(deviceScanCfg DeviceScan, provider string, systemDevice string) bool {\n\tdeviceAffinity, err := GetAffinityForDevice(deviceScanCfg)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif deviceAffinity.DeviceName == systemDevice {\n\t\tlog.Debugf(\"Device %s supports provider: %s\", systemDevice, provider)\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "bd801b7a13cf325cc92f380a681b6559", "score": "0.42160735", "text": "func (i *InstanceContext) IsPlatformUsingSystemD(log log.T) (result bool, err error) {\n\tcompareResult := 0\n\tsystemDVersions := getMinimumVersionForSystemD()\n\n\t// check if current platform has systemd\n\tif val, ok := (*systemDVersions)[i.Platform]; ok {\n\t\t// compare current agent version with minimum supported version\n\t\tif compareResult, err = VersionCompare(i.PlatformVersion, val); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif compareResult >= 0 {\n\t\t\treturn true, nil\n\t\t}\n\t} else if _, ok := possiblyUsingSystemD[i.Platform]; ok {\n\t\t// attempt to execute 'systemctl --version' to verify systemd\n\t\tif _, commandErr := execCommand(\"systemctl\", \"--version\").Output(); commandErr != nil {\n\t\t\treturn false, nil\n\t\t}\n\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "e9b03438ba2210a388f27a3834808ce8", "score": "0.42053726", "text": "func isApparmorEnabled() bool {\n\treturn false\n}", "title": "" }, { "docid": "932738a6890711db7c37f3bd16d18e7f", "score": "0.42018098", "text": "func IsMacos() bool {\n\treturn runtime.GOOS == \"darwin\"\n}", "title": "" }, { "docid": "a64c23642ef75b9d4a656d6e8effef11", "score": "0.41974223", "text": "func (ua UserAgent) IsWindows() bool {\n\treturn ua.OS == Windows\n}", "title": "" }, { "docid": "f213f68bf9f55f0046488cd47af20837", "score": "0.41972113", "text": "func (p Platform) BuildPlatform() api.Build_Platform {\n\tswitch p {\n\tcase PlatformLinuxGlibc:\n\t\treturn api.Build_LINUX_GLIBC\n\tcase PlatformDarwin:\n\t\treturn api.Build_DARWIN\n\tdefault:\n\t\tpanic(fmt.Errorf(\"unknown platform %q\", p))\n\t}\n}", "title": "" } ]
62cd74ac18ad646ab0303946a2992cb0
SetName sets field value
[ { "docid": "623409a06f5afcc4a0a68593bcceab5d", "score": "0.0", "text": "func (o *ConnectableDatacenter) SetName(v string) {\n\to.Name = &v\n}", "title": "" } ]
[ { "docid": "3ab8c8e8174a90b682face3929a7e4eb", "score": "0.6830485", "text": "func (this *GenericRecord) Set(name string, value interface{}) {\n\tthis.fields[name] = value\n}", "title": "" }, { "docid": "75b5e0f298ce836f4a210f81b9f2a796", "score": "0.67083895", "text": "func (me *TmediumType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "970c85bc14ccc71f7a01408afc4805a5", "score": "0.67037874", "text": "func (me *TframeType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "2192097b2aa33f924539c9065965be00", "score": "0.67009497", "text": "func (fm *FieldModelStructSimple) Set(fbeValue *StructSimple) error {\n fbeBegin, err := fm.SetBegin()\n if fbeBegin == 0 {\n return err\n }\n\n err = fm.SetFields(fbeValue)\n fm.SetEnd(fbeBegin)\n return err\n}", "title": "" }, { "docid": "86360b47158b9da078f4279660ee9906", "score": "0.6655043", "text": "func (d *rawDescriptor) setName(name string) error {\n\tif len(name) > len(d.Name) {\n\t\treturn errNameTooLarge\n\t}\n\n\tfor i := copy(d.Name[:], name); i < len(d.Name); i++ {\n\t\td.Name[i] = 0\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "855e3e1fb0b2f030f56ba278061d8e6e", "score": "0.6566513", "text": "func (o *Datatableexportjob) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "1a766de4ba7891aa3d7b8423e95213c5", "score": "0.65628666", "text": "func (f *structField) Set(s string) (err error) {\n\n\t// If this is a pointer or a slice, allocate a new Value\n\tswitch f.fieldType.Kind() {\n\t\tcase reflect.Ptr:\n\t\t\telemPtr := reflect.New(f.elemType)\n\t\t\tf.val.Set(elemPtr)\n\t\t\tf.elem = reflect.Indirect(elemPtr)\n\t\tcase reflect.Slice:\n\t\t\telem := reflect.Indirect(reflect.New(f.elemType))\n\t\t\tf.val.Set(reflect.Append(f.val, elem))\n\t\t\tf.elem = f.val.Index(f.val.Len() - 1)\n\t\tdefault:\n\t\t\tf.elem = f.val\n\t}\n\n\terr = setValue(f.elem, s)\n\treturn\n}", "title": "" }, { "docid": "4f0fa6bacf7d990c41d663c5817e3923", "score": "0.6543276", "text": "func setField(v interface{}, name string, value string) error {\n\trv := reflect.ValueOf(v)\n\tif rv.Kind() != reflect.Ptr || rv.Elem().Kind() != reflect.Struct {\n\t\treturn errors.New(\"v must be pointer to struct\")\n\t}\n\trv = rv.Elem()\n\n\tfv := rv.FieldByName(name)\n\tif !fv.IsValid() {\n\t\treturn fmt.Errorf(\"not a field name: %s\", name)\n\t}\n\n\tif !fv.CanSet() {\n\t\treturn fmt.Errorf(\"cannot set field %s\", name)\n\t}\n\n\tif fv.Kind() != reflect.String {\n\t\treturn fmt.Errorf(\"%s is not a string field\", name)\n\t}\n\n\tfv.SetString(value)\n\treturn nil\n}", "title": "" }, { "docid": "ded3d4746dbf10eaeae60df7cc8a44f0", "score": "0.6503575", "text": "func (me *TvalignType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "e7d3b3757634334a5750a673dce89489", "score": "0.6492681", "text": "func (me *TalignType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "457a051744cfb3a6ea9e66eb6e45ca75", "score": "0.64240605", "text": "func (me *TpgWideType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "52f15c6cb7b1a06d40f29ae264454ee0", "score": "0.6416392", "text": "func (o *Agentlessemailsendrequestdto) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "f1a16a099f392ff490539f83fe06ec01", "score": "0.63810027", "text": "func setField(elem *reflect.Value, section, key, value string) (err error) {\n //fmt.Printf(\"\\t[%s] SET FIELD: %s = %s\\n\", section, key, value)\n\n section = toFieldName(section)\n key = toFieldName(key)\n\n field, err := findField(elem, section, key)\n if err != nil {\n return err\n }\n\n if err = isFieldModifiable(field, key, reflect.String); err != nil {\n return err\n }\n\n field.SetString(value)\n return\n}", "title": "" }, { "docid": "aca7e31ebb38666c9b64f34fc019c9a2", "score": "0.634982", "text": "func (o *Knowledgedocument) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "5b3e0f18b5da426b78724a980cdee335", "score": "0.63373953", "text": "func (b *Builder) Set(name string, val interface{}) *Builder {\n\tcontainer := reflect.Indirect(reflect.ValueOf(b.base))\n\tfield := container.FieldByName(name)\n\n\tif !field.IsValid() {\n\t\tb.badFields = append(b.badFields, name)\n\t\treturn b\n\t}\n\n\tfield.Set(reflect.ValueOf(val))\n\tb.Use(name)\n\treturn b\n}", "title": "" }, { "docid": "09eb375eca5003d39dcc0674b6dcaf1d", "score": "0.633567", "text": "func (me *TxsdEType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "b44ec1d8686dac9bb4559fb35d462a77", "score": "0.631889", "text": "func (d *DriverCore) setName(name string) {\n\td.Name = name\n}", "title": "" }, { "docid": "5d8d7b222999db38cb34e806113f9826", "score": "0.6308801", "text": "func SetField(obj interface{}, fieldname, value string) error {\n\tv, valid := Deref(obj)\n\tif !valid || v.Kind() != reflect.Struct {\n\t\treturn nil\n\t}\n\n\tfield := v.FieldByNameFunc(func(a string) bool { return strings.ToLower(a) == strings.ToLower(fieldname) })\n\tif !field.IsValid() {\n\t\treturn fmt.Errorf(\"Field not found when binding: %s\", fieldname)\n\t}\n\n\tval, err := ParseString(field.Type(), value)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to parse value: %v\", err)\n\t}\n\n\tfield.Set(val)\n\treturn nil\n}", "title": "" }, { "docid": "6aa9453edfa0406694eabd1c7df120cd", "score": "0.6304165", "text": "func (o *Timezonemappingpreview) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "9f0043924a479207002ae5c7af0cb2b9", "score": "0.62931967", "text": "func (me *TnymType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "f0ecbeb638060028e074b0342a7e7a1c", "score": "0.6290866", "text": "func (me *TfloatType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "64b1a03dff5d566ee1611b025f9999a9", "score": "0.6287369", "text": "func (o *Writabledialercontact) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "44a5aba3cf6d3b08c1455b36c120d82f", "score": "0.6234698", "text": "func (o *Architectjobstateresponse) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "e22adb38c953c654f5fb4ed2300a6433", "score": "0.62158626", "text": "func (o *Ucintegration) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "5a8e8d01a41ba7dd0c881f06be1159c1", "score": "0.6199992", "text": "func (me *TxsdFmCollectionRefInvert) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "b9a3ee3446f4a5dc96c975d9cb3b4512", "score": "0.61956245", "text": "func (o *Nludomainversion) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "bff384e351bdff967774774be9b9da89", "score": "0.61654884", "text": "func (me *TxsdTtType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "9180dd3cd5eedad0a3521fa6cc3b11aa", "score": "0.61422783", "text": "func (me *TxsdNmlistNametype) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "7abe31ee752dced8b34c3fd6b1ffffe1", "score": "0.6131694", "text": "func (m *StructMapper) set(to reflect.Value, i int, name string, value reflect.Value) {\n to.Field(i).Set(value)\n}", "title": "" }, { "docid": "d94b2f9dd1a72f36aeb4a8e7481db712", "score": "0.6115179", "text": "func (o *Messagedata) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "0261a9476fe61db6cba0b678f4400ef4", "score": "0.611324", "text": "func (of *ObjField) Set(value interface{}) error {\n\tif err := of.assertValid(); err != nil {\n\t\treturn err\n\t}\n\n\tif !of.IsSettable() {\n\t\treturn fmt.Errorf(\"field %s in %T not settable\", of.name, of.obj.iface)\n\t}\n\n\tof.value.Set(reflect.ValueOf(value))\n\n\treturn nil\n}", "title": "" }, { "docid": "dbd3826bd69ffcb8762ffa4cc4887590", "score": "0.6104576", "text": "func (m *SFModelMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase sfmodel.FieldName:\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.SetName(v)\n\t\treturn nil\n\tcase sfmodel.FieldPhoneNumber:\n\t\tv, ok := value.(int64)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetPhoneNumber(v)\n\t\treturn nil\n\tcase sfmodel.FieldAddress:\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.SetAddress(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown SFModel field %s\", name)\n}", "title": "" }, { "docid": "7e4b04a16f9f3084a533dc2a63376fb2", "score": "0.6103259", "text": "func (o *Punctualityevent) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "6659b04f5715b27a5313be6e40144ce3", "score": "0.6093712", "text": "func (me *TshapeEnumType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "025a591be8730944c95923dda256b3a8", "score": "0.60907656", "text": "func (o *Auditmessage) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "6ce2d78bc0375284a3a59ff6fa11b67f", "score": "0.6085991", "text": "func (me *TxsdGraphicEditfit) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "8a864d0b007ebc436d3ffd96adfa8d30", "score": "0.6072271", "text": "func (m *ColumnDefinition) SetName(value *string)() {\n m.name = value\n}", "title": "" }, { "docid": "8cd1d7c82bbd59d6693f815bdc42093b", "score": "0.60709405", "text": "func (m *JDModelMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase jdmodel.FieldName:\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.SetName(v)\n\t\treturn nil\n\tcase jdmodel.FieldNickname:\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.SetNickname(v)\n\t\treturn nil\n\tcase jdmodel.FieldPassword:\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.SetPassword(v)\n\t\treturn nil\n\tcase jdmodel.FieldEmail:\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.SetEmail(v)\n\t\treturn nil\n\tcase jdmodel.FieldIDNumber:\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.SetIDNumber(v)\n\t\treturn nil\n\tcase jdmodel.FieldPhoneNumber:\n\t\tv, ok := value.(int64)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetPhoneNumber(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown JDModel field %s\", name)\n}", "title": "" }, { "docid": "e070bba1e1e39c77fd90f38f3ae4980b", "score": "0.60498357", "text": "func Set(t *testing.T, data []byte) {\n\tSetNamed(t, \"\", data)\n}", "title": "" }, { "docid": "1aab04de5b039573c57241276728da03", "score": "0.60438424", "text": "func (o *Domainorganizationrole) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "302d661a133fd6a7ff1d70cfe345c9fe", "score": "0.6040308", "text": "func (o *Assignment) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "3f328e1a341e27cb057c71bf9765ab7e", "score": "0.60381174", "text": "func (this *Field) SetValue(value string) *Field {\n\tthis.value = value\n\treturn this\n}", "title": "" }, { "docid": "641e51042ac7264efe8f4f7420de0f63", "score": "0.60290694", "text": "func (e *EnumType) Set(name string, value int64) error {\n\tif _, ok := e.toInt[name]; ok {\n\t\treturn fmt.Errorf(\"field %s already assigned\", name)\n\t}\n\tif oname, ok := e.toString[value]; e.unique && ok {\n\t\treturn fmt.Errorf(\"fields %s and %s conflict on value %d\", name, oname, value)\n\t}\n\tif value < e.min {\n\t\treturn fmt.Errorf(\"value %d for %s too small (minimum is %d)\", value, name, e.min)\n\t}\n\tif value > e.max {\n\t\treturn fmt.Errorf(\"value %d for %s too large (maximum is %d)\", value, name, e.max)\n\t}\n\te.toString[value] = name\n\te.toInt[name] = value\n\tif value >= e.last {\n\t\te.last = value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "881a9dcca66c01d8e1f3e488b68e1719", "score": "0.601303", "text": "func (me *TxsdModificationType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "a5313380ca756769471541c1fd74c6f9", "score": "0.6012091", "text": "func (m *CategoryMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase category.FieldName:\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.SetName(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Category field %s\", name)\n}", "title": "" }, { "docid": "421cbeeb4961b3e29d35b166524c1c9d", "score": "0.6008717", "text": "func (m *DiseaseMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase disease.FieldDiseaseName:\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.SetDiseaseName(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Disease field %s\", name)\n}", "title": "" }, { "docid": "b2634a65e002fa36c0532f8bb0ebe1e8", "score": "0.6008574", "text": "func (me *TcoordinatesType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "d968f225ef63d8a5d774d9175ba79d1d", "score": "0.60020626", "text": "func (entry *Entry) SetField(fieldName string, fieldValue string) error {\n\tif len(fieldName) < 1 {\n\t\treturn errors.New(\"empty field name\")\n\t}\n\tentry.Fields[fieldName] = fieldValue\n\n\t// Any kind of editing invalidates the signatures and hashes\n\tentry.Signatures = make(map[string]string)\n\treturn nil\n}", "title": "" }, { "docid": "ac6423af6b1592d23aeb5b66dcdd8570", "score": "0.59834236", "text": "func (m *TreatmentTypeMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase treatmenttype.FieldType:\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.SetType(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown TreatmentType field %s\", name)\n}", "title": "" }, { "docid": "a2fb3ed208997618f6f41ea9be3d5064", "score": "0.5982866", "text": "func Set_field(name string, value interface{}) option {\n\tif valid_field.FindString(name) == \"\" {\n\t\treturn func(o *Journal) option {\n\t\t\treturn Set_field(``, nil)\n\t\t}\n\t}\n\tif value == nil {\n\t\treturn func(o *Journal) option {\n\t\t\tprev := o.default_fields[name]\n\t\t\tdelete(o.default_fields, name)\n\t\t\treturn Set_field(name, prev)\n\t\t}\n\t} else {\n\t\treturn func(o *Journal) option {\n\t\t\tprev := o.default_fields[name]\n\t\t\to.default_fields[name] = value\n\t\t\treturn Set_field(name, prev)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c206b2bb48bc9f1f947aa7285842cd8c", "score": "0.5978014", "text": "func (o *Callhistoryparticipant) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "dd621f4fcd9328fb3d5dd54277cc32c0", "score": "0.5975734", "text": "func (o *Webmessagingmessage) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "33428331a1efd01ba93dafdbeeddb135", "score": "0.59645915", "text": "func (me *TxsdFmToolIdAware) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "d9032b98d5563c1f6b442e7fb0bb1031", "score": "0.5957793", "text": "func (me *TlistItemTypeEnumType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "afe2230abea0c75fa0b9695037182931", "score": "0.59495586", "text": "func (me *TunitsEnumType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "687bfb5446770b4e0b3fd22a2ba2f21a", "score": "0.59486544", "text": "func (o *Historyentry) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "a15f21bacac7ed7d0d18e2e7e84a6958", "score": "0.594736", "text": "func (me *TrefreshModeEnumType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "2c9b85040ad6650ecff3944cb086c99d", "score": "0.5944379", "text": "func (this *Meta) SetFieldName(name string) {\n\tthis.FieldName = name\n}", "title": "" }, { "docid": "8a978c9b62d4822aa45eba14d43f9400", "score": "0.59412956", "text": "func (m *Message) SetField(name string, val starlark.Value) error {\n\t// Check we have this field defined in the message.\n\tfd, err := m.fieldDesc(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Setting a field to None removes it completely.\n\tif val == starlark.None {\n\t\tif err := m.checkMutable(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdelete(m.fields, name)\n\t\treturn nil\n\t}\n\n\t// Check the type, do implicit type casts.\n\trhs, err := prepareRHS(m.typ.loader, fd, val)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't assign %s to field %q in %s: %s\", val.Type(), name, m.Type(), err)\n\t}\n\tif err := m.checkMutable(); err != nil {\n\t\treturn err\n\t}\n\tm.fields[name] = rhs\n\n\t// When assigning to a oneof alternative, clear its all other alternatives.\n\tif oneof := fd.ContainingOneof(); oneof != nil {\n\t\talts := oneof.Fields()\n\t\tfor i := 0; i < alts.Len(); i++ {\n\t\t\tif altfd := alts.Get(i); altfd != fd {\n\t\t\t\tdelete(m.fields, string(altfd.Name()))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a68c734233896257d2eb61f2f50b3897", "score": "0.5939187", "text": "func (x *fastReflection_SimpleExample) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {\n\tswitch fd.FullName() {\n\tcase \"testpb.SimpleExample.name\":\n\t\tx.Name = value.Interface().(string)\n\tcase \"testpb.SimpleExample.unique\":\n\t\tx.Unique = value.Interface().(string)\n\tcase \"testpb.SimpleExample.not_unique\":\n\t\tx.NotUnique = value.Interface().(string)\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.SimpleExample\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.SimpleExample does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "fcd53d3933cb7b18859006b67fd3a21f", "score": "0.5938385", "text": "func (me *TxsdFmDrbfmParametersIsdrbfmcause) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "9904948c64a11088981451d07a0a0a0c", "score": "0.5934975", "text": "func (me *TxsdTableOrient) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "851155bab764bfe3b387370c21e3f895", "score": "0.5923776", "text": "func (fe *fieldExtract) Set(field field, v int) error {\n\tif !fe.wanted.Has(field) {\n\t\treturn errors.AssertionFailedf(\"field %s is not wanted in %v\", errors.Safe(field.Pretty()), errors.Safe(fe.wanted))\n\t}\n\tfe.data[field] = v\n\tfe.has = fe.has.Add(field)\n\tfe.wanted = fe.wanted.Clear(field)\n\n\treturn nil\n}", "title": "" }, { "docid": "31f29e6fb8e26c290ef6e7a57215eeef", "score": "0.5914397", "text": "func (m *GroupMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase group.FieldName:\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.SetName(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Group field %s\", name)\n}", "title": "" }, { "docid": "2ccc1c3c0326b17132b1102c12c682ca", "score": "0.59030515", "text": "func (o *Dialercampaignprogresseventcampaignprogress) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "cae7caf61866f957c79ff8eb3ca0beef", "score": "0.59008497", "text": "func (me *TkeepWithPreviousType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "172cd774b26201113bc744bfe03beb77", "score": "0.589901", "text": "func (x *fastReflection_QuerySupplyRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1alpha1.QuerySupplyRequest.batch_denom\":\n\t\tx.BatchDenom = value.Interface().(string)\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1alpha1.QuerySupplyRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1alpha1.QuerySupplyRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "eec2cf5b8733128a9bd6b086424efc0e", "score": "0.5891064", "text": "func (me *TbooleanType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "974fde22c1c9a60bc4d9288f6e11f129", "score": "0.5887946", "text": "func (me *TdisplayModeEnumType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "1dde3dc9cf20b18a4e3d9ffce3106cde", "score": "0.58843064", "text": "func (m *FlowMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase flow.FieldState:\n\t\tv, ok := value.(uuid.UUID)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetState(v)\n\t\treturn nil\n\tcase flow.FieldStateTable:\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.SetStateTable(v)\n\t\treturn nil\n\tcase flow.FieldInitialState:\n\t\tv, ok := value.(uuid.UUID)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetInitialState(v)\n\t\treturn nil\n\tcase flow.FieldTerminationState:\n\t\tv, ok := value.(uuid.UUID)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetTerminationState(v)\n\t\treturn nil\n\tcase flow.FieldPastState:\n\t\tv, ok := value.(uuid.UUID)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetPastState(v)\n\t\treturn nil\n\tcase flow.FieldInputs:\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.SetInputs(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Flow field %s\", name)\n}", "title": "" }, { "docid": "7fbd4b9a045592e4895e98189b6e3a78", "score": "0.5883306", "text": "func (au *AliasUser) setName(name string) error {\n\tif !validAliasUserName(name) {\n\t\treturn ErrInvalidAliasUserName\n\t}\n\n\tau.name = name\n\n\treturn nil\n}", "title": "" }, { "docid": "81523ce37714bc51387fb98ac23789d8", "score": "0.5871892", "text": "func (m *PersonMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase person.FieldName:\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.SetName(v)\n\t\treturn nil\n\tcase person.FieldLastActivity:\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.SetLastActivity(v)\n\t\treturn nil\n\tcase person.FieldUsername:\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.SetUsername(v)\n\t\treturn nil\n\tcase person.FieldPicture:\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.SetPicture(v)\n\t\treturn nil\n\tcase person.FieldRoles:\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.SetRoles(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Person field %s\", name)\n}", "title": "" }, { "docid": "916be6c2f9850d01b0951aae74ac17fd", "score": "0.5864654", "text": "func (c *Config) setField(name string, idx int, v value, options []Option) Error {\n\topts := makeOptions(options)\n\tp := parsePathIdx(name, opts.pathSep, idx)\n\n\terr := p.SetValue(c, opts, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif opts.meta != nil {\n\t\tv.setMeta(opts.meta)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c22339fddd567902f447d683bc01f189", "score": "0.5854496", "text": "func (self *Text) SetNameA(member string) {\n self.Object.Set(\"name\", member)\n}", "title": "" }, { "docid": "93f32c77957f44f1eafbb4ea12ead8f1", "score": "0.58540225", "text": "func (x *fastReflection_MsgCreateResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.basket.v1.MsgCreateResponse.basket_denom\":\n\t\tx.BasketDenom = value.Interface().(string)\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.basket.v1.MsgCreateResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.basket.v1.MsgCreateResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "91d625e8d522200e1dc2764e15657da2", "score": "0.5853768", "text": "func (me *TxsdFmXrefIdClass) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "8b7879f0854264e5b9c75f92640a2536", "score": "0.5849996", "text": "func (m *AttachmentBase) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "10a650f95165ec203f5e38a712ed96cd", "score": "0.58497524", "text": "func (n *Name) Set(index int, component NameComponent) error {\n\tif index < 0 || index >= len(n.components) {\n\t\treturn util.ErrOutOfRange\n\t}\n\n\t//n.components[index] = reflect.New(reflect.ValueOf(component).Elem().Type()).Interface().(NameComponent)\n\tn.components[index] = component\n\tn.wire = nil\n\tn.cachedString = \"\"\n\treturn nil\n}", "title": "" }, { "docid": "a300eaa88b6d9db6216c36764b113b43", "score": "0.5833759", "text": "func (m *ShortMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase short.FieldKey:\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.SetKey(v)\n\t\treturn nil\n\tcase short.FieldValue:\n\t\tv, ok := value.(uuid.UUID)\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 Short field %s\", name)\n}", "title": "" }, { "docid": "fbdeb635e9910e010bb4a022b96fb6f5", "score": "0.5832828", "text": "func (o *Userroutingstatuserrorinfo) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must create a new Value (creates **type) then get its element (*type), which will be nil pointer of the appropriate type\n\t\tx := reflect.Indirect(reflect.New(targetField.Type()))\n\t\ttargetField.Set(x)\n\t}\n\n\t// Add field to set field names list\n\tif o.SetFieldNames == nil {\n\t\to.SetFieldNames = make(map[string]bool)\n\t}\n\to.SetFieldNames[field] = true\n}", "title": "" }, { "docid": "66ea89060a1c016cde236e21fba5fab5", "score": "0.5830042", "text": "func (me *TxsdFmCollectionRoot) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "b350372bcff64686e3bfc682c38535d9", "score": "0.58211964", "text": "func (me *TDeviceTypeType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "01c32779205a625765b23333882934c0", "score": "0.58145094", "text": "func (m *UnitMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase unit.FieldUnitType:\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.SetUnitType(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Unit field %s\", name)\n}", "title": "" }, { "docid": "21c230abbeddc3d5aacf6440b558da4d", "score": "0.5812622", "text": "func (me *TcolorModeEnumType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "1fdd77a25b99cefd7f19939a61cc6576", "score": "0.5812591", "text": "func (m *TodoMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase todo.FieldTask:\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.SetTask(v)\n\t\treturn nil\n\tcase todo.FieldStatus:\n\t\tv, ok := value.(todo.Status)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetStatus(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Todo field %s\", name)\n}", "title": "" }, { "docid": "2453d57a8f86eeae39034b4a9c15d3e8", "score": "0.5792467", "text": "func (m *ItemReference) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a5a59a0a882e3d60e642e68d7a0fdf3a", "score": "0.5790613", "text": "func (m *DirectoryDefinition) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "5ed2cb6e9102dfefb8c7174b06af0a64", "score": "0.5787069", "text": "func (me *TviewRefreshModeEnumType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "dea0bcc0147333bf8496a343db0cfcbe", "score": "0.57844025", "text": "func (m *ContactMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase contact.FieldName:\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.SetName(v)\n\t\treturn nil\n\tcase contact.FieldValue:\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.SetValue(v)\n\t\treturn nil\n\tcase contact.FieldKind:\n\t\tv, ok := value.(contact.Kind)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetKind(v)\n\t\treturn nil\n\tcase contact.FieldPrincipal:\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.SetPrincipal(v)\n\t\treturn nil\n\tcase contact.FieldValidated:\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.SetValidated(v)\n\t\treturn nil\n\tcase contact.FieldFromAccount:\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.SetFromAccount(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Contact field %s\", name)\n}", "title": "" }, { "docid": "a5886efc44c9e082b8d7dd8421cd361c", "score": "0.5783888", "text": "func (m *MedicalRecordMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase medicalrecord.FieldEmail:\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.SetEmail(v)\n\t\treturn nil\n\tcase medicalrecord.FieldPassword:\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.SetPassword(v)\n\t\treturn nil\n\tcase medicalrecord.FieldName:\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.SetName(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown MedicalRecord field %s\", name)\n}", "title": "" }, { "docid": "363994564036e454f20d37d413449541", "score": "0.5779916", "text": "func (me *TxsdListType) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "ae852845e113a325144de3b4d7a9274f", "score": "0.577709", "text": "func (me *Tangle90Type) Set(s string) { (*xsdt.Double)(me).Set(s) }", "title": "" }, { "docid": "726a690c1fdbeac076cae519693aa673", "score": "0.57767195", "text": "func (me *TaltitudeModeEnumType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "e92877a63469fa6e4555c1cc15397175", "score": "0.57757527", "text": "func (f *field) setter(v string) {\n\t// find owner\n\towner := util.FindOwner(reflect.ValueOf(f.root), f.fullname)\n\tfor owner.Kind() != reflect.Struct {\n\t\tlog.Warnf(\"set field[%v] failed, can't find owner Struct\", f.fullname)\n\t\treturn\n\t}\n\t// convert input argument\n\tvar tmp interface{}\n\tif err := json.Unmarshal([]byte(v), &tmp); err != nil {\n\t\tlog.Warnf(\"can't unmarshal field[%v]'s argument: %v\", f.fullname, v)\n\t\ttmp = v // fallback\n\t}\n\t// check it's real Set method.\n\tm := owner.Addr().MethodByName(\"Set\" + f.name)\n\tif m.Kind() == reflect.Func && m.Type().NumOut() == 0 && m.Type().NumIn() == 1 && core.ParseQType(m.Type().In(0)) == f.qtype {\n\t\targType := m.Type().In(0)\n\t\tif arg, err := util.ConvertToValue(argType, tmp); err == nil {\n\t\t\tm.Call([]reflect.Value{owner.Addr(), arg})\n\t\t} else {\n\t\t\tlog.Warnf(\"set field[%v] failed, can't resolve [%v] as [%v]: %v\", f.fullname, v, argType, err)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tfieldV := owner.FieldByName(f.name)\n\t\tif result, err := util.ConvertToValue(fieldV.Type(), tmp); err == nil {\n\t\t\tfieldV.Set(result)\n\t\t} else {\n\t\t\tlog.Warnf(\"set field[%v] failed, can't resolve [%v] as [%v]: %v\", f.fullname, v, fieldV.Type(), err)\n\t\t\treturn\n\t\t}\n\t}\n\t// update cache\n\tf.cache = nil\n}", "title": "" }, { "docid": "17e4c287ece8a2ca3383212814f1ea32", "score": "0.5770751", "text": "func (t *MigrateType) Set(value string) error {\n\tswitch strings.ToLower(value) {\n\tcase \"migrate\":\n\t\t*t = Migrate\n\tcase \"rollback\":\n\t\t*t = Rollback\n\tcase \"check\":\n\t\t*t = Check\n\tdefault:\n\t\t*t = Check\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "76c559360b74095a16e0f216fe800b78", "score": "0.57645", "text": "func (m *WorkbookTable) SetName(value *string)() {\n m.name = value\n}", "title": "" }, { "docid": "b1ffc98525e96ac08f54fafd01af2f06", "score": "0.57625747", "text": "func (me *TxsdGenerationMechanism) Set(s string) { (*xsdt.Nmtoken)(me).Set(s) }", "title": "" }, { "docid": "ec97b4436c09446e463fa62e49449136", "score": "0.5760871", "text": "func (me *TgridOriginEnumType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "83a8b34bcd23ec1ad3f67b8503a37579", "score": "0.57530946", "text": "func (tpe *Type) SetName(name string) {\n\ttpe.name = name\n\ttpe._type.Name = ast.NewIdent(name)\n\n\ttpe.file.Save()\n}", "title": "" }, { "docid": "c5a3c0fa42608700069016409433edf5", "score": "0.57510066", "text": "func (m *machineTestBuilder) setName(name string) *machineTestBuilder {\n\tm.name = name\n\treturn m\n}", "title": "" }, { "docid": "ed47786a90f9caba01042eb94ed2ba7f", "score": "0.5750209", "text": "func (x *fastReflection_QuerySupplyRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {\n\tswitch fd.FullName() {\n\tcase \"cosmos.nft.v1beta1.QuerySupplyRequest.class_id\":\n\t\tx.ClassId = value.Interface().(string)\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.nft.v1beta1.QuerySupplyRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.nft.v1beta1.QuerySupplyRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" } ]
078e44c54d8c69c0747ad76063d23d01
Update delegates to the next hook function in the queue and stores the parameter and result values of this invocation.
[ { "docid": "91f51b5c746147750834e49251d4b3f0", "score": "0.0", "text": "func (m *MockUserCredentialsStore) Update(v0 context.Context, v1 *database.UserCredential) error {\n\tr0 := m.UpdateFunc.nextHook()(v0, v1)\n\tm.UpdateFunc.appendCall(UserCredentialsStoreUpdateFuncCall{v0, v1, r0})\n\treturn r0\n}", "title": "" } ]
[ { "docid": "5110aecd2ceec9b4ea12bb8c6afb26b9", "score": "0.5592701", "text": "func invokeHooks(current fixer.Currency, poster webhook.PostFunc) (invocations int) {\n\tinvocations = 0\n\thooks := []webhook.SubsciptionOut{}\n\tcurrent.Rates[current.Base] = 1\n\tglobalDB.GetAll(\"webhook\", &hooks)\n\tfor _, hook := range hooks {\n\t\thookRate := current.Rates[hook.Target] / current.Rates[hook.Base]\n\t\tif hook.Min <= hookRate && hook.Max >= hookRate {\n\t\t\thook.Invoke(hookRate, poster)\n\t\t\tinvocations++\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "8b60e4c983c855846f28c3d9ec6f89cc", "score": "0.5544408", "text": "func (f *LSIFStoreMonikerResultsFunc) PushHook(hook func(context.Context, int, string, string, string, int, int) ([]lsifstore.Location, int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "c2add1f6eb98d20038bcfd983290d66f", "score": "0.50692016", "text": "func InvokeHooks(current fixer.Currency) int {\n\treturn invokeHooks(current, http.DefaultClient.Post)\n}", "title": "" }, { "docid": "6ff1af79e095ba523c97c7632c6ab043", "score": "0.5029746", "text": "func (f *WorkerStoreQueuedCountFunc) PushHook(hook func(context.Context, []*sqlf.Query) (int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "83e46b7438ef72074732e6bd2bd6c992", "score": "0.49635592", "text": "func (f *WorkerStoreDequeueFunc) PushHook(hook func(context.Context, string, []*sqlf.Query) (workerutil.Record, bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "a8da89646bd75d013a664f36d42c3edf", "score": "0.494839", "text": "func (f *WorkerStoreUpdateExecutionLogEntryFunc) PushHook(hook func(context.Context, int, int, workerutil.ExecutionLogEntry, store.ExecutionLogEntryOptions) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "ca4c6a393894b833a8cd9cadb7006071", "score": "0.49240744", "text": "func callNextHookEx(hhk HHOOK, nCode int, wParam WPARAM, lParam LPARAM) LRESULT {\n\tret, _, _ := procCallNextHookEx.Call(\n\t\tuintptr(hhk),\n\t\tuintptr(nCode),\n\t\tuintptr(wParam),\n\t\tuintptr(lParam),\n\t)\n\n\treturn LRESULT(ret)\n}", "title": "" }, { "docid": "e095b38d853a194eacb2e4a8eeb44b2b", "score": "0.48891765", "text": "func (f *WorkerStoreResetStalledFunc) PushHook(hook func(context.Context) ([]int, []int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "9bd94c61f4d97eee897a36cbb4493574", "score": "0.48804164", "text": "func (f *ReferencePagerDoneFunc) PushHook(hook func(error) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "0fdedb588e8c3eacc7b6cc9a45bf8df8", "score": "0.48799276", "text": "func (f *UpdaterTryUpdateFunc) PushHook(hook func(context.Context, int, int) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "f34d406b78b0ad0908beaf2a61e20a50", "score": "0.48401448", "text": "func (c UpdaterUpdateFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0}\n}", "title": "" }, { "docid": "946e696e591227b2fc53ab2df4fbe916", "score": "0.48249504", "text": "func (f *ExecutionLogEntryStoreUpdateExecutionLogEntryFunc) PushHook(hook func(context.Context, int, int, workerutil.ExecutionLogEntry) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "a9e44a7e3eda42df95e9d4f9e27fbfe8", "score": "0.481722", "text": "func (_m *Registerable) Run(ctx context.Context, hooks []config.Hook, results <-chan common.Result) {\n\t_m.Called(ctx, hooks, results)\n}", "title": "" }, { "docid": "bea1be0dbce6714039994509496b3a8e", "score": "0.4802625", "text": "func (executor *Executor) forwardReply(reply interface{}) []interface{} {\n\n\tvar (\n\t\tactions []interface{}\n\t)\n\n\tfmt.Printf(\"forwarding (%T)%+v to %s handler \\n\\n\", reply, reply, executor.status.State())\n\n\tswitch res := reply.(type) {\n\tcase iface.MsgAppendEntriesReply:\n\t\tswitch executor.status.State() {\n\t\tcase iface.StateFollower:\n\t\t\tactions = executor.handler.FollowerOnAppendEntriesReply(\n\t\t\t\tres,\n\t\t\t\texecutor.log,\n\t\t\t\texecutor.status)\n\n\t\tcase iface.StateCandidate:\n\t\t\tactions = executor.handler.CandidateOnAppendEntriesReply(\n\t\t\t\tres,\n\t\t\t\texecutor.log,\n\t\t\t\texecutor.status)\n\n\t\tcase iface.StateLeader:\n\t\t\tactions = executor.handler.LeaderOnAppendEntriesReply(\n\t\t\t\tres,\n\t\t\t\texecutor.log,\n\t\t\t\texecutor.status)\n\n\t\t}\n\n\tcase iface.MsgRequestVoteReply:\n\t\tswitch executor.status.State() {\n\t\tcase iface.StateFollower:\n\t\t\tactions = executor.handler.FollowerOnRequestVoteReply(\n\t\t\t\tres,\n\t\t\t\texecutor.log,\n\t\t\t\texecutor.status)\n\n\t\tcase iface.StateCandidate:\n\t\t\tactions = executor.handler.CandidateOnRequestVoteReply(\n\t\t\t\tres,\n\t\t\t\texecutor.log,\n\t\t\t\texecutor.status)\n\n\t\tcase iface.StateLeader:\n\t\t\tactions = executor.handler.LeaderOnRequestVoteReply(\n\t\t\t\tres,\n\t\t\t\texecutor.log,\n\t\t\t\texecutor.status)\n\n\t\t}\n\n\tdefault:\n\t\tpanic(\"unknown reply type\")\n\t}\n\n\treturn actions\n}", "title": "" }, { "docid": "c8f17e1ad19d737d9d8b3f8a14a8baa7", "score": "0.48018107", "text": "func (c WorkerStoreUpdateExecutionLogEntryFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0}\n}", "title": "" }, { "docid": "e355e740b92b8718f372376367b6b5a6", "score": "0.4801681", "text": "func (f *AccessTokenStoreListFunc) PushHook(hook func(context.Context, database.AccessTokensListOptions) ([]*database.AccessToken, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "51420422449296f17a71ec0a777368dd", "score": "0.47951493", "text": "func (c ExecutionLogEntryStoreUpdateExecutionLogEntryFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0}\n}", "title": "" }, { "docid": "035267fee2c695e7ddae09042f3565ba", "score": "0.47945094", "text": "func (f *WorkerStoreRequeueFunc) PushHook(hook func(context.Context, int, time.Time) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "9392d6c0639bb5d1330bc8f8c5995e1e", "score": "0.47881684", "text": "func (f *StoreVersionsFunc) PushHook(hook func(context.Context) ([]int, []int, []int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "d53fd25ff1b89bf5bfbcfd86b01cc97d", "score": "0.47809902", "text": "func (u *upgrader) wrapHooks(ctx context.Context, hooks hook.SliceMap, hookPair hook.Pair, f func() error) error {\n\terr := u.execHooks(ctx, hooks[hookPair.Pre])\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := f(); err != nil {\n\t\treturn err\n\t}\n\n\treturn u.execHooks(ctx, hooks[hookPair.Post])\n}", "title": "" }, { "docid": "3d5d1e669fe3eb248f1523bb872d6e4d", "score": "0.47659817", "text": "func (f *AccessTokenStoreCreateInternalFunc) PushHook(hook func(context.Context, int32, []string, string, int32) (int64, string, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "024425a49e554d1eadf10f47ecb2e393", "score": "0.47649541", "text": "func (f *StoreDoneFunc) PushHook(hook func(error) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "2fa8b243cf15dfb40a94e3692e9d8ebf", "score": "0.4764849", "text": "func (f *AutoIndexingServiceNumRepositoriesWithCodeIntelligenceFunc) PushHook(hook func(context.Context) (int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "2fa92efade22b0aa45c88b5845fbbafc", "score": "0.4751766", "text": "func (o *TokenHistory) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range tokenHistoryAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1cd26646c4f5bee8e7016ee88aa9c25f", "score": "0.47479442", "text": "func (f *LSIFStoreMonikersByPositionFunc) PushHook(hook func(context.Context, int, string, int, int) ([][]lsifstore.MonikerData, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "9eecdaa9f405b9a8d703f549f9b1ef9b", "score": "0.4720571", "text": "func (f *WorkerStoreMarkCompleteFunc) PushHook(hook func(context.Context, int, store.MarkFinalOptions) (bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "ad5ac50faf83c502c699182a3f638b66", "score": "0.4717221", "text": "func (m *MockUpdater) Update(v0 context.Context, v1 int, v2 commits.CheckFunc) error {\n\tr0 := m.UpdateFunc.nextHook()(v0, v1, v2)\n\tm.UpdateFunc.appendCall(UpdaterUpdateFuncCall{v0, v1, v2, r0})\n\treturn r0\n}", "title": "" }, { "docid": "87c03bbeef4660221df2178a6cb44236", "score": "0.46746972", "text": "func tuneHooks(logger *logrus.Logger, config Config) error {\n\tfor _, name := range config.GetList(hooksKey) {\n\t\thookFn := getHook(name)\n\n\t\tif hookFn == nil {\n\t\t\treturn fmt.Errorf(\"hook %s not found\", name)\n\t\t}\n\n\t\thook, err := hookFn(config)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlogger.AddHook(hook)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "30dcdfd628ee87ad9d1af7bd1fc402ba", "score": "0.46708798", "text": "func (c WorkerStoreRequeueFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0}\n}", "title": "" }, { "docid": "1de99d76687427861ef58f07008f1e32", "score": "0.46707344", "text": "func (o *LoginToken) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range loginTokenAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c711d31d68dba0cb1e26dcd9bd5a8181", "score": "0.46608096", "text": "func (f *DBStoreSameRepoPagerFunc) PushHook(hook func(context.Context, int, string, string, string, string, int) (int, ReferencePager, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "e31a5c2ef1d90301480ff9e9e8e3cdab", "score": "0.46598", "text": "func (f *AccessTokenStoreLookupFunc) PushHook(hook func(context.Context, string, string) (int32, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "eafd2d6ad8ef4a88be2374713df8b46c", "score": "0.4653233", "text": "func (f *AutoIndexingServiceRepositoryIDsWithConfigurationFunc) PushHook(hook func(context.Context, int, int) ([]shared.RepositoryWithAvailableIndexers, int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "05e32786b9a1cc6c658038a908f76b16", "score": "0.46515617", "text": "func (f *UpdaterUpdateFunc) PushHook(hook func(context.Context, int, commits.CheckFunc) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "c30a509c4058229d86ef031005adcaf8", "score": "0.4651231", "text": "func (f *SearchContextsStoreDoneFunc) PushHook(hook func(error) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "6ee454bc24257479a8b7d47e6f32811c", "score": "0.4629117", "text": "func (hooks Hooks) Run(name string, direction HookDirection, w http.ResponseWriter, r *http.Request, data interface{}) {\n\tif direction == HookDirectionNormal {\n\t\tfor _, hook := range hooks[name] {\n\t\t\thook(w, r, data)\n\t\t}\n\t} else {\n\t\ts := hooks[name]\n\t\tfor i := len(s) - 1; i >= 0; i-- {\n\t\t\ts[i](w, r, data)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "654ef9f4ab8683d8e9220f29e5591c9a", "score": "0.46275374", "text": "func (o *Function) doAfterUpdateHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range functionAfterUpdateHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "463cba8e0abbd9e0a321c8cafae487f0", "score": "0.46265683", "text": "func (f *IndexableReposListerListFunc) PushHook(hook func(context.Context) ([]types.MinimalRepo, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "c48aeb7f80d2cae3ab12f6ebf4652d34", "score": "0.46237132", "text": "func (c WorkerStoreMarkCompleteFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0, c.Result1}\n}", "title": "" }, { "docid": "cf687eff39de3824a2e9fed6f8821649", "score": "0.4623424", "text": "func (f *DBStorePackageReferencePagerFunc) PushHook(hook func(context.Context, string, string, string, int, int) (int, ReferencePager, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "1408ca724493e175fc8d258a55555d3c", "score": "0.46232122", "text": "func (c OrgStoreUpdateFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0, c.Result1}\n}", "title": "" }, { "docid": "af02762f36c74fdf724c1f63d5875393", "score": "0.46224555", "text": "func (o *FollowedChannel) doAfterUpdateHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range followedChannelAfterUpdateHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9d3c9bb4c73ebb103a1755c9d3b3284e", "score": "0.46201596", "text": "func (p *Proxy) Register(funcs ...func(*Event) (*Response, error)) {\n\t// the core of the pipeline (i.e. the innermost function) is ForwardRequest\n\t// all registered functions are wrapping layers around this initial value of\n\t// the roundTripPipeline\n\tif p.roundTripPipeline == nil {\n\t\tp.roundTripPipeline = p.ForwardRequest\n\t}\n\n\tfor _, f := range funcs {\n\t\t// the anonymous function scope is used to create copies of the state\n\t\t// of f and p.roundTripPipeline in this loop iteration\n\t\tfunc(pipelineCopy func(*Event) (*Response, error),\n\t\t\tfuncCopy func(*Event) (*Response, error)) {\n\t\t\t// now the function f will be wrapped around the current pipeline\n\t\t\tp.roundTripPipeline = func(e *Event) (*Response, error) {\n\t\t\t\te.ForwardRequest = func() (*Response, error) {\n\t\t\t\t\treturn pipelineCopy(e)\n\t\t\t\t}\n\t\t\t\tresponse, err := funcCopy(e)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\treturn response, nil\n\t\t\t}\n\t\t}(p.roundTripPipeline, f)\n\n\t}\n}", "title": "" }, { "docid": "efb0eecd3c43973ffb70b09dfe26e2c6", "score": "0.46184137", "text": "func (f *AccessTokenStoreTransactFunc) PushHook(hook func(context.Context) (database.AccessTokenStore, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "a0d705de32f92aff82a39175b5602420", "score": "0.4615175", "text": "func (c WorkerStoreDequeueFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0, c.Result1, c.Result2}\n}", "title": "" }, { "docid": "44f1720d7b0d39bc930109fcb2f8f90b", "score": "0.4611609", "text": "func (f *PhabricatorStoreTransactFunc) PushHook(hook func(context.Context) (database.PhabricatorStore, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "688ba3763ac4848a8d4d6e32dda7c8cd", "score": "0.46024877", "text": "func (f *AccessTokenStoreCreateFunc) PushHook(hook func(context.Context, int32, []string, string, int32) (int64, string, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "58c6f6a9d115bc8aee095ca0706d0888", "score": "0.45933574", "text": "func (o *Film) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range filmAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "71bc4cc30db4305628b5c01c375cdb64", "score": "0.45923787", "text": "func (o *Measure) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range measureAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "41693cca6ec2c79078a2602cf1c3bde5", "score": "0.45834744", "text": "func (f *AccessTokenStoreGetByTokenFunc) PushHook(hook func(context.Context, string) (*database.AccessToken, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "ad97bfe6a93ddf92a2382f338cb12db7", "score": "0.458286", "text": "func (f *AccessTokenStoreCountFunc) PushHook(hook func(context.Context, database.AccessTokensListOptions) (int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "e783c38f80fd57500ab442ff0d197881", "score": "0.45792428", "text": "func (o *Question) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range questionAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "831f13090106239b378d94d4c44f9749", "score": "0.45770326", "text": "func (f *WorkerStoreAddExecutionLogEntryFunc) PushHook(hook func(context.Context, int, workerutil.ExecutionLogEntry, store.ExecutionLogEntryOptions) (int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "ded763c9b71396e6cca1ddba77d82955", "score": "0.4572486", "text": "func (f *AutoIndexingServiceQueueIndexesForPackageFunc) PushHook(hook func(context.Context, shared.MinimialVersionedPackageRepo, bool) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "b6d5a7ed5552fd2ff0f1573765944137", "score": "0.45713398", "text": "func (o *CastMember) doAfterUpdateHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range castMemberAfterUpdateHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c055294b20fd82565811db209f2b22e3", "score": "0.45519218", "text": "func (o *FilmActor) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range filmActorAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6121322e38de61e14e254c2c780a3425", "score": "0.4544422", "text": "func (f *ExternalServiceStoreListFunc) PushHook(hook func(context.Context, database.ExternalServicesListOptions) ([]*types.ExternalService, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "cbcd6b47062d85b9c706c3b3bdd7350a", "score": "0.4541301", "text": "func (f *SearchContextsStoreUpdateSearchContextWithRepositoryRevisionsFunc) PushHook(hook func(context.Context, *types.SearchContext, []*types.SearchContextRepositoryRevisions) (*types.SearchContext, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "27938d911b06242dd97569379dce3225", "score": "0.45381114", "text": "func (c UpdaterTryUpdateFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0}\n}", "title": "" }, { "docid": "76747c62b409af3fc693c00dbf5b1f94", "score": "0.45377368", "text": "func (f *ReferencePagerPageFromOffsetFunc) PushHook(hook func(context.Context, int) ([]lsifstore.PackageReference, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "411de1e275ffdc194c10c0cec4204cb3", "score": "0.45332506", "text": "func (o *CMFAnchorPolicyLog) doAfterUpdateHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range cmfAnchorPolicyLogAfterUpdateHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b258dd546e726d65573d4ec6f571ad26", "score": "0.45222005", "text": "func (f *UserCredentialsStoreUpdateFunc) PushHook(hook func(context.Context, *database.UserCredential) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "952024cba49a4ba2519b2546af0b62dc", "score": "0.4516471", "text": "func (f *PhabricatorStoreHandleFunc) PushHook(hook func() *basestore.TransactableHandle) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "f64fd5aa76f1631113871b9dc85c4e05", "score": "0.45162222", "text": "func Queue(f func()) {\n\trender_funcs <- f\n}", "title": "" }, { "docid": "dadcbe4aad77f096f41e40c3663ac6de", "score": "0.45152482", "text": "func (f *AccessTokenStoreHandleFunc) PushHook(hook func() *basestore.TransactableHandle) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "1d649d1cc8f0c940242e5215aa2df0e9", "score": "0.4513024", "text": "func (f *SearchContextsStoreGetSearchContextRepositoryRevisionsFunc) PushHook(hook func(context.Context, int64) ([]*types.SearchContextRepositoryRevisions, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "0b41089524a0b0becf361924b1da5876", "score": "0.45108914", "text": "func (m *MockFreetextFetcher) UpdateHooks(arg0 func(string) string, arg1 func(string, string), arg2 func(string)) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"UpdateHooks\", arg0, arg1, arg2)\n}", "title": "" }, { "docid": "cca85b91ae3f4857f1fc775f4e908aa8", "score": "0.4504602", "text": "func (o *Link) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range linkAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2aa35601fe75b4dcfa782a8109db3819", "score": "0.45033252", "text": "func (f *DBStoreDirtyRepositoriesFunc) PushHook(hook func(context.Context) (map[int]int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "a42037db26d2def46feb9e33ddd6dafa", "score": "0.45005655", "text": "func (f *LSIFStoreReferencesFunc) PushHook(hook func(context.Context, int, string, int, int) ([]lsifstore.Location, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "35f5edf2e071e513c3e98c88b4c32637", "score": "0.44976258", "text": "func (f *UserCredentialsStoreListFunc) PushHook(hook func(context.Context, database.UserCredentialsListOpts) ([]*database.UserCredential, int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "804c50d75dcfaa041d30b80004d9d1b5", "score": "0.44920576", "text": "func (o *Exchange) doAfterUpdateHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range exchangeAfterUpdateHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0cbd21c013c642895f18fdc271716f7f", "score": "0.44919574", "text": "func (o *Skill) doAfterUpdateHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range skillAfterUpdateHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "43b3e398b7c4f738163a9939b5c68319", "score": "0.44894013", "text": "func (f *RepoStoreListFunc) PushHook(hook func(context.Context, database.ReposListOptions) ([]*types.Repo, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "f05cdc33dc9612399e081afa9bd459c6", "score": "0.44886807", "text": "func (f *UploadsServiceGetUploadsByIDsFunc) PushHook(hook func(context.Context, ...int) ([]types.Upload, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "f1c0c17d7b1072738f1578b8e7789396", "score": "0.44854805", "text": "func (f *SearchContextsStoreExecFunc) PushHook(hook func(context.Context, *sqlf.Query) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "094b4d23160eda9c48443667cac611a8", "score": "0.4458788", "text": "func (f *WorkerStoreQueuedCountFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context, []*sqlf.Query) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "b9000569d4767600a37d397dca147510", "score": "0.44587156", "text": "func (o *ProposeBookList) doAfterUpdateHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range proposeBookListAfterUpdateHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6194466743663dfbc98e4ac067849419", "score": "0.4457909", "text": "func (rm *RequestManager) RegisterHook(\n\thook graphsync.OnResponseReceivedHook) {\n\tselect {\n\tcase rm.messages <- &responseHook{hook}:\n\tcase <-rm.ctx.Done():\n\t}\n}", "title": "" }, { "docid": "d2b582d5f45142018c5ba95aa0226a77", "score": "0.44559115", "text": "func (o *StockKeepingUnit) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range stockKeepingUnitAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ce542eb6719139653cb460c470234c22", "score": "0.44548127", "text": "func (f *LSIFStoreDefinitionsFunc) PushHook(hook func(context.Context, int, string, int, int) ([]lsifstore.Location, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "bc0756c1058c10e66984a382c0985166", "score": "0.44499135", "text": "func (o *JWTKey) doAfterUpdateHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range jwtKeyAfterUpdateHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "56fe4c9f188e6af4fb57c781e306a9d5", "score": "0.4449216", "text": "func (o *UserLink) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range userLinkAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8ade0d6a26c60aec1d8724e77bb5509e", "score": "0.44464964", "text": "func (o *Analysi) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range analysiAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "be1a4e56becfb1efe4d768da2fc06361", "score": "0.44438678", "text": "func (mock *HandlerMock) SetNextHostCalls() []struct {\n\tCtx context.Context\n\tService *values.Service\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tService *values.Service\n\t}\n\tmock.lockSetNextHost.RLock()\n\tcalls = mock.calls.SetNextHost\n\tmock.lockSetNextHost.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "2bc51401e9980342005fe2a75ec91115", "score": "0.4442332", "text": "func (c WorkerStoreAddExecutionLogEntryFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0, c.Result1}\n}", "title": "" }, { "docid": "e6c1560ae2beb6ed7c1389eb296d7b6a", "score": "0.44420034", "text": "func (f *StoreVersionFunc) PushHook(hook func(context.Context) (int, bool, bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "b95bada6f119dbf869538d75fe1b3520", "score": "0.4435535", "text": "func (f *ExecutionLogEntryStoreAddExecutionLogEntryFunc) PushHook(hook func(context.Context, int, workerutil.ExecutionLogEntry) (int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "83354e7fec88244c9200cc6e0148b0f2", "score": "0.4434389", "text": "func (o *MeasureDate) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range measureDateAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dcf5974914e40a7725414ebda8f7ac6a", "score": "0.44319507", "text": "func (o *Merchant) doAfterUpdateHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range merchantAfterUpdateHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dc2815b9927635a6e113013e9a5491bd", "score": "0.44183907", "text": "func (c Chain) Hook() models.Hook {\n\treturn func(mutator models.Mutator) models.Mutator {\n\t\tfor i := len(c.hooks) - 1; i >= 0; i-- {\n\t\t\tmutator = c.hooks[i](mutator)\n\t\t}\n\t\treturn mutator\n\t}\n}", "title": "" }, { "docid": "a590e55048e37cddd0933f74c1093601", "score": "0.441455", "text": "func (o *TokenHistory) doAfterUpsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range tokenHistoryAfterUpsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f0acfb9020832a57f19e365758f1a0f3", "score": "0.44075164", "text": "func (c *Context) Next() {\n\tc.index++\n\ts := int8(len(c.handlers))\n\tfor ; c.index < s; c.index++ {\n\t\t//fmt.Println(\"executing:\", getFunctionName(c.handlers[c.index]), c.Writer.Written())\n\t\tc.handlers[c.index](c)\n\t}\n}", "title": "" }, { "docid": "4fb2abd3e961fc854654b6ee04445c91", "score": "0.43986568", "text": "func (o *Destination) doAfterUpdateHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range destinationAfterUpdateHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1716b5a9595ba4933d790875630e0bf7", "score": "0.43980154", "text": "func (o *CMFMusicClassify) doAfterUpdateHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range cmfMusicClassifyAfterUpdateHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8d8d035b592640b32db346ab2c885b02", "score": "0.43936568", "text": "func (o *Pallet) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range palletAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f0963c083e6bd392cd2a5972255c302a", "score": "0.43925115", "text": "func (ch *ChainHandler) Apply(obj interface{}, event model.Event) error {\n\tfor _, f := range ch.funcs {\n\t\tif err := f(obj, event); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8a26f3e5e43910ce5eb921305841a8d0", "score": "0.43921584", "text": "func (o *Genotypeprop) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range genotypepropAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3319efb13434e7c08658fdd4c2e8083a", "score": "0.4379966", "text": "func (f *DBStoreGetUploadsFunc) PushHook(hook func(context.Context, dbstore.GetUploadsOptions) ([]dbstore.Upload, int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "6578afd6dd553f6ae96a530445935bee", "score": "0.43791026", "text": "func (o *FeatureCvterm) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range featureCvtermAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "03209b997147d6c0e5c1d61ebe9fcdcf", "score": "0.437692", "text": "func (f *WorkerStoreHeartbeatFunc) PushHook(hook func(context.Context, []int, store.HeartbeatOptions) ([]int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" } ]
36bdd6a8e6d641b28258a8c8639e9281
SetDestinationAddress sets the DestinationAddress field's value.
[ { "docid": "d73760489efbd77ac364aba017cf20aa", "score": "0.82481974", "text": "func (s *ListCustomRoutingPortMappingsByDestinationInput) SetDestinationAddress(v string) *ListCustomRoutingPortMappingsByDestinationInput {\n\ts.DestinationAddress = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "e5204ee3166f54b7f66c03a938bfe3b2", "score": "0.78679174", "text": "func (b IPv4) SetDestinationAddress(addr tcpip.Address) {\n\tcopy(b[dstAddr:dstAddr+IPv4AddressSize], addr.AsSlice())\n}", "title": "" }, { "docid": "3c435949b8a861d04cfff0d513ccc22d", "score": "0.6765106", "text": "func (a *Member) SetAddress(address string) {\n\ta.address = address\n}", "title": "" }, { "docid": "061b5f8c540649c3744044e4b34dcd38", "score": "0.66599756", "text": "func (ta *TransAddress) SetAddress(address interfaces.IAddress) {\n\tta.Address = address\n}", "title": "" }, { "docid": "074f3ed1c4f9b4e82dc969d671f461e7", "score": "0.6647523", "text": "func (in *ActionNetworkCreateInput) SetAddress(value string) *ActionNetworkCreateInput {\n\tin.Address = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Address\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "debb961a72662e805bafff1bd7260cb7", "score": "0.6579204", "text": "func (o *TravelExpensePerDiemCompensationSearchParams) SetAddress(address *string) {\n\to.Address = address\n}", "title": "" }, { "docid": "7af6077392140c72fc83161a4884e4b2", "score": "0.6523942", "text": "func (o LookupRouteResultOutput) DestinationAddress() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupRouteResult) string { return v.DestinationAddress }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "bc9151763575d715f99d3684890c2de6", "score": "0.65066314", "text": "func (s *DestinationType) SetAddress(v string) *DestinationType {\n\ts.Address = &v\n\treturn s\n}", "title": "" }, { "docid": "f534d211747a3086b889602e562e24a1", "score": "0.65051204", "text": "func (m *SFModelMutation) SetAddress(s string) {\n\tm.address = &s\n}", "title": "" }, { "docid": "d44ec91d24a89bec383cb22637fafd0c", "score": "0.6480033", "text": "func (s *SourceType) SetAddress(v string) *SourceType {\n\ts.Address = &v\n\treturn s\n}", "title": "" }, { "docid": "23d0c31355a0f40c2f57845b1464f138", "score": "0.6450984", "text": "func (s *PortMapping) SetDestinationSocketAddress(v *SocketAddress) *PortMapping {\n\ts.DestinationSocketAddress = v\n\treturn s\n}", "title": "" }, { "docid": "fe88bceeb8a3a03b5e577a3bfbfaf318", "score": "0.642199", "text": "func (s *SourceStruct) SetAddress(v string) *SourceStruct {\n\ts.Address = &v\n\treturn s\n}", "title": "" }, { "docid": "408c32c6a033efd1582c6661ae00b1fe", "score": "0.6392595", "text": "func (o *MerchantMatch) SetAddress(v string) {\n\to.Address = &v\n}", "title": "" }, { "docid": "535cad0b1fe9675ca1552b7dcdafe80e", "score": "0.63591784", "text": "func (s *TranslationStruct) SetAddress(v string) *TranslationStruct {\n\ts.Address = &v\n\treturn s\n}", "title": "" }, { "docid": "c65c467e4ca654211abc864b89a48a7a", "score": "0.6356132", "text": "func (s *DestinationPortMapping) SetDestinationSocketAddress(v *SocketAddress) *DestinationPortMapping {\n\ts.DestinationSocketAddress = v\n\treturn s\n}", "title": "" }, { "docid": "799fb24619555a675743131392da6775", "score": "0.6355153", "text": "func SetAddress(newAddress string) {\n\taddress = newAddress\n}", "title": "" }, { "docid": "92e22c450a4aa7edc00d847c2bf48885", "score": "0.63414484", "text": "func (server *Server) SetAddress(address string) {\n\tserver.Address = address\n}", "title": "" }, { "docid": "3e91628c2867a277dabdf80de8f1ef39", "score": "0.63212764", "text": "func (n *Acl_AclSet_AclEntry_Ipv4Path) DestinationAddress() *Acl_AclSet_AclEntry_Ipv4_DestinationAddressPath {\n\treturn &Acl_AclSet_AclEntry_Ipv4_DestinationAddressPath{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"destination-address\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6b2de587a82b5b332e6c803581204f99", "score": "0.6312731", "text": "func (n *Acl_AclSet_AclEntry_Ipv4PathAny) DestinationAddress() *Acl_AclSet_AclEntry_Ipv4_DestinationAddressPathAny {\n\treturn &Acl_AclSet_AclEntry_Ipv4_DestinationAddressPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"destination-address\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "204411cf86acad6e4e9eef8a16a378f5", "score": "0.62818724", "text": "func (na *NetAddress) SetAddress(ip net.IP, port uint16) {\n\tna.IP = ip\n\tna.Port = port\n}", "title": "" }, { "docid": "82f4a9d8a3c65adfc1ea5a45df8f5b38", "score": "0.6279031", "text": "func (d *DeclareCandidacyData) SetAddress(address string) (*DeclareCandidacyData, error) {\n\tbytes, err := wallet.AddressToHex(address)\n\tif err != nil {\n\t\treturn d, err\n\t}\n\tcopy(d.Address[:], bytes)\n\treturn d, nil\n}", "title": "" }, { "docid": "c7fdc9775108c3595dc1b38781d12bc1", "score": "0.6276831", "text": "func (_options *CreateSubnetReservedIPOptions) SetAddress(address string) *CreateSubnetReservedIPOptions {\n\t_options.Address = core.StringPtr(address)\n\treturn _options\n}", "title": "" }, { "docid": "dbb756192cb5194182f891ff6f90e1f0", "score": "0.6270494", "text": "func (_options *CreateVPCRoutingTableRouteOptions) SetDestination(destination string) *CreateVPCRoutingTableRouteOptions {\n\t_options.Destination = core.StringPtr(destination)\n\treturn _options\n}", "title": "" }, { "docid": "cdf8983421d6123d4bce4a8cae8518d6", "score": "0.6257272", "text": "func (ei *endpointInfo) SetAddress(addr net.Addr) error {\n\tei.address = addr\n\treturn nil\n}", "title": "" }, { "docid": "573c79b0f77ae6ed6ab3b810e2fcf6ae", "score": "0.61955833", "text": "func (uu *UserUpdate) SetAddress(s string) *UserUpdate {\n\tuu.mutation.SetAddress(s)\n\treturn uu\n}", "title": "" }, { "docid": "aacd4b0e810883d21b69ad3b94da9b62", "score": "0.6176474", "text": "func (_options *CreateVPCRouteOptions) SetDestination(destination string) *CreateVPCRouteOptions {\n\t_options.Destination = core.StringPtr(destination)\n\treturn _options\n}", "title": "" }, { "docid": "46d129e06eddeea569ca1bc22c8d729f", "score": "0.61761785", "text": "func (n *NetworkInstance_PolicyForwarding_Policy_Rule_Ipv4Path) DestinationAddress() *NetworkInstance_PolicyForwarding_Policy_Rule_Ipv4_DestinationAddressPath {\n\treturn &NetworkInstance_PolicyForwarding_Policy_Rule_Ipv4_DestinationAddressPath{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"destination-address\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "339f33c460272edfd4cb5123c2c98d8a", "score": "0.6172431", "text": "func (s *Syslog) SetAddress(address string) *Syslog {\n\ts.stream.Lock()\n\tdefer s.stream.Unlock()\n\n\tif address == \"\" {\n\t\taddress = DefaultSyslogAddress\n\t}\n\n\tif s.address != address {\n\t\ts.address = address\n\t\ts.stream.Reopen()\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "5e832df5269cfae87beb9f46da5521d6", "score": "0.6153817", "text": "func (n *Acl_AclSet_AclEntry_Ipv6Path) DestinationAddress() *Acl_AclSet_AclEntry_Ipv6_DestinationAddressPath {\n\treturn &Acl_AclSet_AclEntry_Ipv6_DestinationAddressPath{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"destination-address\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ce7ffe9e23bcf41826af5b8e6068ff24", "score": "0.61472857", "text": "func (cns *Info) SetAddress(newAddress string) {\n\tcns.Address = newAddress\n}", "title": "" }, { "docid": "0c7ac2c573e0c14c147d4e4906c519e1", "score": "0.61349565", "text": "func SetAddress(address string) common.Address {\n\treturn common.HexToAddress(address)\n}", "title": "" }, { "docid": "4c9cf2fa7abf9c482b351128803c72ba", "score": "0.6131402", "text": "func (uuo *UserUpdateOne) SetAddress(s string) *UserUpdateOne {\n\tuuo.mutation.SetAddress(s)\n\treturn uuo\n}", "title": "" }, { "docid": "f869e259720f3432f89525398c1c9041", "score": "0.61218095", "text": "func (s *TranslationType) SetAddress(v string) *TranslationType {\n\ts.Address = &v\n\treturn s\n}", "title": "" }, { "docid": "42904d7019f73a908b948b63e96258a4", "score": "0.6104799", "text": "func (n *Acl_AclSet_AclEntry_Ipv6PathAny) DestinationAddress() *Acl_AclSet_AclEntry_Ipv6_DestinationAddressPathAny {\n\treturn &Acl_AclSet_AclEntry_Ipv6_DestinationAddressPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"destination-address\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "88227ccefa37f578f60452c5ea738762", "score": "0.6099251", "text": "func (o *MemberInfoProfile) SetAddress(v GroupAddress) {\n\to.Address = &v\n}", "title": "" }, { "docid": "e96c9317b90fa05342c594549727eb8e", "score": "0.60968405", "text": "func (s *EndpointRequest) SetAddress(v string) *EndpointRequest {\n\ts.Address = &v\n\treturn s\n}", "title": "" }, { "docid": "ee2a9d3a1200b44692016ea15fb40c2b", "score": "0.60877275", "text": "func (_AddressManager *AddressManagerTransactor) SetAddress(opts *bind.TransactOpts, _name string, _address common.Address) (*types.Transaction, error) {\n\treturn _AddressManager.contract.Transact(opts, \"setAddress\", _name, _address)\n}", "title": "" }, { "docid": "45e1b27389a071d2cda3c6c4eaa571d1", "score": "0.6084178", "text": "func (x *Writer) SetAddress(a uint32) {\n\tx.Flush()\n\tx.addr = a\n}", "title": "" }, { "docid": "3f3c1256a9ce3b415c62736ea021c931", "score": "0.60739356", "text": "func (n *NetworkInstance_PolicyForwarding_Policy_Rule_Ipv4PathAny) DestinationAddress() *NetworkInstance_PolicyForwarding_Policy_Rule_Ipv4_DestinationAddressPathAny {\n\treturn &NetworkInstance_PolicyForwarding_Policy_Rule_Ipv4_DestinationAddressPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"destination-address\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "24f31c75b558b400add3f70c2ed79dc6", "score": "0.6055675", "text": "func (config *Configuration) SetAddr(addr string) {\n\tconfig.Addr = addr\n}", "title": "" }, { "docid": "fa4e7fea3f0778f50438b2466fb93ddf", "score": "0.6055074", "text": "func (s *Endpoint) SetAddress(v string) *Endpoint {\n\ts.Address = &v\n\treturn s\n}", "title": "" }, { "docid": "e326fbde2becee7177d54aab4565686e", "score": "0.60422534", "text": "func SetAddr(addr string) {\n\taddress = addr\n}", "title": "" }, { "docid": "970e2532b6dcb7d8a3e9c2f4c2cd5f36", "score": "0.60355026", "text": "func (o *BillingInfoResponse) SetAddress(v string) {\n\to.Address = v\n}", "title": "" }, { "docid": "644e117275e3026bbcbfdfc69c57541a", "score": "0.5999087", "text": "func (s *EndpointResponse) SetAddress(v string) *EndpointResponse {\n\ts.Address = &v\n\treturn s\n}", "title": "" }, { "docid": "b8ba9350d627fa1f26cf36d579bc938a", "score": "0.5996246", "text": "func (s *EndpointBatchItem) SetAddress(v string) *EndpointBatchItem {\n\ts.Address = &v\n\treturn s\n}", "title": "" }, { "docid": "3d59fb04fbeb55b283b0f94d423d114c", "score": "0.59823084", "text": "func (s *EndpointMessageResult) SetAddress(v string) *EndpointMessageResult {\n\ts.Address = &v\n\treturn s\n}", "title": "" }, { "docid": "a8f1354576be14da25f647b4d08e637d", "score": "0.59748924", "text": "func (_BalanceContract *BalanceContractTransactor) SetAddress(opts *bind.TransactOpts, _address common.Address) (*types.Transaction, error) {\n\treturn _BalanceContract.contract.Transact(opts, \"setAddress\", _address)\n}", "title": "" }, { "docid": "7d5a0c223c817d63227ad4633c3e3ae8", "score": "0.59616584", "text": "func (this *Raven) SetDestination(d Destination) *Raven {\n\tthis.destination = d\n\treturn this\n}", "title": "" }, { "docid": "b9decf0d57a362853d0c1678ef374928", "score": "0.5948742", "text": "func (o *GetPrivateRemoveFromAddressBookParams) SetAddress(address string) {\n\to.Address = address\n}", "title": "" }, { "docid": "fe297c370eb0d9828241f7da8be01d19", "score": "0.59311706", "text": "func (r *Ref) SetDestination(destinations []Identifiable) {\n\tfor i := range destinations {\n\t\tif destinations[i].GetId() == r.Id {\n\t\t\tr.Destination = destinations[i]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c496e8cfbddabd1977c620b72d4754d3", "score": "0.58947426", "text": "func (o *PaystubOverrideEmployee) SetAddress(v PaystubOverrideEmployeeAddress) {\n\to.Address = &v\n}", "title": "" }, { "docid": "46c053a5e1e652b423ccb25e146a6ace", "score": "0.5878306", "text": "func (w *Watch) SetDestination(tx *pop.Connection, location Location) error {\n\tif w.DestinationID.Valid {\n\t\tlocation.ID = w.DestinationID.Int\n\t\treturn location.Update(tx)\n\t}\n\tif err := location.Create(tx); err != nil {\n\t\treturn err\n\t}\n\tw.DestinationID = nulls.NewInt(location.ID)\n\treturn w.Update(tx)\n}", "title": "" }, { "docid": "c8f2faf313ab1537bea0744ee5345887", "score": "0.5851955", "text": "func (s *PublicEndpoint) SetAddress(v string) *PublicEndpoint {\n\ts.Address = &v\n\treturn s\n}", "title": "" }, { "docid": "20a2bd70150cc20059a4b7f7fa3258a7", "score": "0.5843512", "text": "func (n *NetworkInstance_PolicyForwarding_Policy_Rule_Ipv6Path) DestinationAddress() *NetworkInstance_PolicyForwarding_Policy_Rule_Ipv6_DestinationAddressPath {\n\treturn &NetworkInstance_PolicyForwarding_Policy_Rule_Ipv6_DestinationAddressPath{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"destination-address\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e4548f17264c841f3d7e43265ecf721f", "score": "0.58121336", "text": "func (o *CreditPayStubEmployee) SetAddress(v CreditPayStubAddress) {\n\to.Address = v\n}", "title": "" }, { "docid": "75f46f9e2a52401ada65ec13bc5e1263", "score": "0.58063734", "text": "func (b IPv4) DestinationAddress() tcpip.Address {\n\treturn tcpip.AddrFrom4([4]byte(b[dstAddr : dstAddr+IPv4AddressSize]))\n}", "title": "" }, { "docid": "cdc15bef804aeec68e9807880ddd6084", "score": "0.5800277", "text": "func (s *SimulationAppEndpointInfo) SetAddress(v string) *SimulationAppEndpointInfo {\n\ts.Address = &v\n\treturn s\n}", "title": "" }, { "docid": "a3ebe69999cb36032c817b1387d27986", "score": "0.57934856", "text": "func (_AddressManager *AddressManagerTransactorSession) SetAddress(_name string, _address common.Address) (*types.Transaction, error) {\n\treturn _AddressManager.Contract.SetAddress(&_AddressManager.TransactOpts, _name, _address)\n}", "title": "" }, { "docid": "f28952c6b36f7173eb4f8fcc83e63d69", "score": "0.577709", "text": "func (o *IamIpAddressAllOf) SetAddress(v string) {\n\to.Address = &v\n}", "title": "" }, { "docid": "482f4ec285cfbd21a78941f82831995f", "score": "0.57683593", "text": "func (n *NetworkInstance_PolicyForwarding_Policy_Rule_Ipv6PathAny) DestinationAddress() *NetworkInstance_PolicyForwarding_Policy_Rule_Ipv6_DestinationAddressPathAny {\n\treturn &NetworkInstance_PolicyForwarding_Policy_Rule_Ipv6_DestinationAddressPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"destination-address\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b8b47e5a83c21646d0bda59d3a6a98ce", "score": "0.57605886", "text": "func (l *Link) SetAddress(address net.HardwareAddr) error {\n\t_, err := shared.RunCommand(\"ip\", \"link\", \"set\", \"dev\", l.Name, \"address\", address.String())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dcffc325ceb5e168789df194cc970885", "score": "0.5757108", "text": "func (aid *AccountId) SetAddress(address string) error {\n\tif aid == nil {\n\t\treturn nil\n\t}\n\n\traw, err := strkey.Decode(strkey.VersionByteAccountID, address)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(raw) != 32 {\n\t\treturn errors.New(\"invalid address\")\n\t}\n\n\tvar ui Uint256\n\tcopy(ui[:], raw)\n\n\t*aid, err = NewAccountId(PublicKeyTypePublicKeyTypeEd25519, ui)\n\n\treturn err\n}", "title": "" }, { "docid": "b0496e73f57d5fc6208095a1126618f7", "score": "0.5756731", "text": "func (bs *BrokerStatus) SetAddress(hostname string) {\n\tbs.Address.Hostname = hostname\n\tif hostname != \"\" {\n\t\tbrokerCondSet.Manage(bs).MarkTrue(BrokerConditionAddressable)\n\t} else {\n\t\tbrokerCondSet.Manage(bs).MarkFalse(BrokerConditionAddressable, \"emptyHostname\", \"hostname is the empty string\")\n\t}\n}", "title": "" }, { "docid": "7ee7617e026b3bc15de51a6381645209", "score": "0.57285124", "text": "func (o *GossiperAssassinateByAddrPostParams) SetAddr(addr string) {\n\to.Addr = addr\n}", "title": "" }, { "docid": "24914716da8b44ec33aa2e12f032491a", "score": "0.5726131", "text": "func (s *Output) SetDestination(v string) *Output {\n\ts.Destination = &v\n\treturn s\n}", "title": "" }, { "docid": "4cb44225085a34411c7f072854f41304", "score": "0.5710397", "text": "func (b Ethernet) DestinationAddress() tcpip.LinkAddress {\n\treturn tcpip.LinkAddress(b[dstMAC:][:EthernetAddressSize])\n}", "title": "" }, { "docid": "cfdef187017a120a0afe7ca9bffbec11", "score": "0.5694116", "text": "func (c *Client) SetAddress(address string) (bool, bool, error) {\n\treply, err := c.I2PControl(I2PControl{\n\t\tAddress: address,\n\t})\n\tif err != nil {\n\t\treturn false, false, fmt.Errorf(\"SetAddress failed: %w\", err)\n\t}\n\treturn reply.RestartNeeded, reply.SettingsSaved, err\n}", "title": "" }, { "docid": "e315e99244793907e13b75bf959a17d9", "score": "0.56727403", "text": "func (b *Contract) SetAddress(address common.Address) error {\n\tcode, err := b.Client.Client.CodeAt(context.TODO(), address, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif code == nil || len(code) == 0 {\n\t\tlog.Println(\"Account \", address.Hex(), \" has no code\")\n\t\treturn ErrAddressHasNoCode\n\t}\n\tb.Address = &address\n\treturn nil\n}", "title": "" }, { "docid": "0fa695f18b55b697f3f93b81b1fe8257", "score": "0.56714267", "text": "func (d *Device) SetAddress(address uint8) {\n\td.writeReg(I2C_SLAVE_DEVICE_ADDRESS, address)\n\td.Address = uint16(address)\n}", "title": "" }, { "docid": "497774accdf98ace1976bf205d6c8857", "score": "0.5658155", "text": "func (_AddressManager *AddressManagerSession) SetAddress(_name string, _address common.Address) (*types.Transaction, error) {\n\treturn _AddressManager.Contract.SetAddress(&_AddressManager.TransactOpts, _name, _address)\n}", "title": "" }, { "docid": "ca1607fcf5e8663f08e3630fffee3453", "score": "0.56569743", "text": "func (s *GetSiteAddressOutput) SetAddress(v *Address) *GetSiteAddressOutput {\n\ts.Address = v\n\treturn s\n}", "title": "" }, { "docid": "a614b535d143967e209fc1128500c84a", "score": "0.56153953", "text": "func (s *NiftyCreateNatRuleInput) SetDestination(v *DestinationStruct) *NiftyCreateNatRuleInput {\n\ts.Destination = v\n\treturn s\n}", "title": "" }, { "docid": "70753c60d1058d253c5e37bc37021f6d", "score": "0.559936", "text": "func (m *NetworkAccessTraffic) SetDestinationIp(value *string)() {\n err := m.GetBackingStore().Set(\"destinationIp\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1de0e2295a7e24981ad40225b51a6759", "score": "0.5597495", "text": "func (b *Builder) SetAddr(addr *iotxaddress.Address) *Builder {\n\tb.addr = addr\n\treturn b\n}", "title": "" }, { "docid": "fa8d9f0617e7ee893768e60f24f90614", "score": "0.5596367", "text": "func (s *NatRuleType) SetDestination(v *DestinationType) *NatRuleType {\n\ts.Destination = v\n\treturn s\n}", "title": "" }, { "docid": "256d94d2b90c4b3e17c6bc45f9cc837f", "score": "0.55932295", "text": "func (s *UpdateSiteAddressOutput) SetAddress(v *Address) *UpdateSiteAddressOutput {\n\ts.Address = v\n\treturn s\n}", "title": "" }, { "docid": "24bf117fa79eeba34c752b23b445150d", "score": "0.5582627", "text": "func (s *UpdateFlowOutputInput) SetDestination(v string) *UpdateFlowOutputInput {\n\ts.Destination = &v\n\treturn s\n}", "title": "" }, { "docid": "0ea112cc4d277d4834a266cf0e5a6192", "score": "0.5577949", "text": "func (s *AddOutputRequest) SetDestination(v string) *AddOutputRequest {\n\ts.Destination = &v\n\treturn s\n}", "title": "" }, { "docid": "bc6d955df7292cb8c6893f1062636fae", "score": "0.5571698", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_SessionPath) DestinationAddress() *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session_DestinationAddressPath {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session_DestinationAddressPath{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"destination-address\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d799fc0172cb0ee22dd632b7948d762e", "score": "0.5537733", "text": "func (s *NiftyReplaceNatRuleInput) SetDestination(v *DestinationStruct) *NiftyReplaceNatRuleInput {\n\ts.Destination = v\n\treturn s\n}", "title": "" }, { "docid": "5c60568cb84bc5536120fbfb727071f5", "score": "0.55370927", "text": "func (m *Location) SetAddress(value PhysicalAddressable)() {\n err := m.GetBackingStore().Set(\"address\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d25a24ebf49ce298aa460203627d605b", "score": "0.553356", "text": "func (s *UpdateSiteAddressInput) SetAddress(v *Address) *UpdateSiteAddressInput {\n\ts.Address = v\n\treturn s\n}", "title": "" }, { "docid": "6f955e49fa887afe783a9a4af3add5c2", "score": "0.5528401", "text": "func (o *LogsArchiveAttributes) SetDestination(v LogsArchiveDestination) {\n\to.Destination.Set(&v)\n}", "title": "" }, { "docid": "b2919739a868f306b891f18ab419d995", "score": "0.5510643", "text": "func (_e *MockDataNode_Expecter) SetAddress(address interface{}) *MockDataNode_SetAddress_Call {\n\treturn &MockDataNode_SetAddress_Call{Call: _e.mock.On(\"SetAddress\", address)}\n}", "title": "" }, { "docid": "ac8273b21c9712cb2e9da24a4879185b", "score": "0.54899794", "text": "func SetUdpAddress(address string) {\n\tudpAddress = address\n\testablishConn()\n}", "title": "" }, { "docid": "08362e39e0f8f62a4e03320252a5a078", "score": "0.5433931", "text": "func (s *DenyCustomRoutingTrafficInput) SetDestinationAddresses(v []*string) *DenyCustomRoutingTrafficInput {\n\ts.DestinationAddresses = v\n\treturn s\n}", "title": "" }, { "docid": "23ab0975e15fca590a7189a87aec22dc", "score": "0.5427113", "text": "func (s *ShopeeClient) SetAddress(req *SetAddressRequest) (resp *SetAddressResponse, err error) {\n\tb, err := s.post(\"SetAddress\", req)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = json.Unmarshal(b, &resp)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "0051b8759daaf001ebc67ebf7e167a12", "score": "0.5413224", "text": "func (p *PaymentRequestedInfo) SetShippingAddress(value PostAddress) {\n\tp.Flags.Set(3)\n\tp.ShippingAddress = value\n}", "title": "" }, { "docid": "a9f107fff8892c2bc9fd97574441bb6a", "score": "0.5411215", "text": "func (s *VerifyOTPMessageRequestParameters) SetDestinationIdentity(v string) *VerifyOTPMessageRequestParameters {\n\ts.DestinationIdentity = &v\n\treturn s\n}", "title": "" }, { "docid": "34c01c9bdd180ce02ad249aac9ddf9bd", "score": "0.5403082", "text": "func (skey *SignerKey) SetAddress(address string) error {\n\tif skey == nil {\n\t\treturn nil\n\t}\n\n\tvb, err := strkey.Version(address)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to extract address version\")\n\t}\n\n\tvar keytype SignerKeyType\n\n\tswitch vb {\n\tcase strkey.VersionByteAccountID:\n\t\tkeytype = SignerKeyTypeSignerKeyTypeEd25519\n\tcase strkey.VersionByteHashX:\n\t\tkeytype = SignerKeyTypeSignerKeyTypeHashX\n\tcase strkey.VersionByteHashTx:\n\t\tkeytype = SignerKeyTypeSignerKeyTypePreAuthTx\n\tdefault:\n\t\treturn errors.Errorf(\"invalid version byte: %v\", vb)\n\t}\n\n\traw, err := strkey.Decode(vb, address)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(raw) != 32 {\n\t\treturn errors.New(\"invalid address\")\n\t}\n\n\tvar ui Uint256\n\tcopy(ui[:], raw)\n\n\t*skey, err = NewSignerKey(keytype, ui)\n\n\treturn err\n}", "title": "" }, { "docid": "9f8f2c0767bea85f0101fe222773da2d", "score": "0.5402333", "text": "func (m *NetworkAccessTraffic) SetDestinationFQDN(value *string)() {\n err := m.GetBackingStore().Set(\"destinationFQDN\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "afb8eeae0e9fbf205949e694934d7967", "score": "0.5387878", "text": "func (o SecurityRuleTypeOutput) DestinationAddressPrefix() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SecurityRuleType) string { return v.DestinationAddressPrefix }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7fcf3b75b0df36b3ef85824f057883e1", "score": "0.5384341", "text": "func (s *S3BucketSinkConfiguration) SetDestination(v string) *S3BucketSinkConfiguration {\n\ts.Destination = &v\n\treturn s\n}", "title": "" }, { "docid": "953ba09f6b25f98f713504c5258435ea", "score": "0.53754693", "text": "func (s *SendOTPMessageRequestParameters) SetDestinationIdentity(v string) *SendOTPMessageRequestParameters {\n\ts.DestinationIdentity = &v\n\treturn s\n}", "title": "" }, { "docid": "ef11e17a567d6ddb05a4de82f875a1ce", "score": "0.53625435", "text": "func (m *Message) SetAddressHeader(field, address, name string) {\n\tm.header[field] = []string{m.FormatAddress(address, name)}\n}", "title": "" }, { "docid": "f64851becceeeec432d69007b928ea7c", "score": "0.5349578", "text": "func (s *ReplicationRule) SetDestination(v *Destination) *ReplicationRule {\n\ts.Destination = v\n\treturn s\n}", "title": "" }, { "docid": "7a275c0d2af53fe06ecb3c60590c173b", "score": "0.5341379", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_SessionPathAny) DestinationAddress() *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session_DestinationAddressPathAny {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session_DestinationAddressPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"destination-address\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2cc900a28c5fe13b03436efd07eb5fba", "score": "0.5331325", "text": "func (_BalanceContract *BalanceContractTransactorSession) SetAddress(_address common.Address) (*types.Transaction, error) {\n\treturn _BalanceContract.Contract.SetAddress(&_BalanceContract.TransactOpts, _address)\n}", "title": "" }, { "docid": "2c6a624c317d82b3d998c10867ae37c4", "score": "0.5330183", "text": "func (s *CreateSnapshotInput) SetDestination(v *S3Destination) *CreateSnapshotInput {\n\ts.Destination = v\n\treturn s\n}", "title": "" }, { "docid": "44a28889204bdcf6a527a8f63d115f49", "score": "0.5311769", "text": "func (s *AllowCustomRoutingTrafficInput) SetDestinationAddresses(v []*string) *AllowCustomRoutingTrafficInput {\n\ts.DestinationAddresses = v\n\treturn s\n}", "title": "" }, { "docid": "7b287442beea7f9b269b3eb5b0e26863", "score": "0.5311542", "text": "func (m *NetworkAccessTraffic) SetDestinationPort(value *int32)() {\n err := m.GetBackingStore().Set(\"destinationPort\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" } ]
ef0eae05098be4d03eb1ea53707cf341
AddToRxCache add RemoteMessage id to rxMsgCache if not exists. Returns if msg id is added (instead of loaded) and error when adding
[ { "docid": "a069e30f2c5fe7ce27e5f4ae312f3c2f", "score": "0.7939875", "text": "func (ln *LocalNode) AddToRxCache(msgID []byte) (bool, error) {\n\t_, found := ln.rxMsgCache.Get(msgID)\n\tif found {\n\t\treturn false, nil\n\t}\n\n\terr := ln.rxMsgCache.Add(msgID, struct{}{})\n\tif err != nil {\n\t\tif _, found := ln.rxMsgCache.Get(msgID); found {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "title": "" } ]
[ { "docid": "297d8e603152a7bd2237f27e4e6374f8", "score": "0.67625713", "text": "func (u *User) AddMessageToCache(message *communication.Message) {\n\tif u.isMsgMine(message) {\n\t\treturn\n\t}\n\t//如果为虚拟用户,那么在线时才会接收消息\n\tif u.detail.IsFake() && !u.online() {\n\t\treturn\n\t}\n\n\tmsgID := message.GetID()\n\n\t// r := newMessageRecord(m)\n\tmsg := u.messageStore.GetMessage(msgID)\n\tswitch msg.GetProtoType() {\n\tcase communication.ProtoReply:\n\t\tu.MessageRecords = append([]string{msgID}, u.MessageRecords...)\n\tdefault:\n\t\tu.MessageRecords = append(u.MessageRecords, msgID)\n\t}\n\n\tif len(u.MessageRecords) > maxMessageCountCache {\n\t\tu.MessageRecords = u.MessageRecords[:maxMessageCountCache]\n\t}\n}", "title": "" }, { "docid": "96b8ad2d32aec54a6ce19d0a2c320f71", "score": "0.59445757", "text": "func (s *messageStore) Add(id uint64) *Message {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\tif s.messages == nil {\n\t\ts.messages = make(map[uint64]*Message)\n\t}\n\tif _, ok := s.messages[id]; ok {\n\t\tpanic(fmt.Sprintf(\"ID %v is not unique\", id))\n\t}\n\n\tm := &Message{\n\t\tID: id,\n\t\tresponseChan: make(chan Message),\n\t}\n\ts.messages[id] = m\n\treturn m\n}", "title": "" }, { "docid": "10921c2e3cd72f034f7b25163688ee5b", "score": "0.5762468", "text": "func (c *msgsCache) add(seq uint64, msg *pb.MsgProto, isNew, checkPresent bool) {\n\tif checkPresent {\n\t\t// If the message is already in the cache, msgsCache.get() will move\n\t\t// it to the end of the list and update its expiration.\n\t\tif c.get(seq) != nil {\n\t\t\treturn\n\t\t}\n\t}\n\texp := cacheTTL\n\tif isNew {\n\t\texp += msg.Timestamp\n\t} else {\n\t\texp += time.Now().UnixNano()\n\t}\n\tcMsg := &cachedMsg{\n\t\texpiration: exp,\n\t\tmsg: msg,\n\t}\n\tif c.tail == nil {\n\t\tc.head = cMsg\n\t} else {\n\t\tc.tail.next = cMsg\n\t\t// Ensure last expiration is at least >= previous one.\n\t\tif cMsg.expiration < c.tail.expiration {\n\t\t\tcMsg.expiration = c.tail.expiration\n\t\t}\n\t}\n\tcMsg.prev = c.tail\n\tc.tail = cMsg\n\tc.seqMaps[seq] = cMsg\n\tif len(c.seqMaps) == 1 {\n\t\tatomic.StoreInt32(&c.tryEvict, 1)\n\t}\n}", "title": "" }, { "docid": "046dccbefe2447fc3d2546578480fb18", "score": "0.576185", "text": "func updateCache(msg UserInfo) {\n\n log.Infof(\"REFRESH: Updating usermap entry for uid=%d\", msg.UID)\n\n userInfoMap[msg.UID] = msg\n}", "title": "" }, { "docid": "9916a8fe9e877c9b3015e736df0a05e2", "score": "0.5716258", "text": "func (d *Dao) addCache(c context.Context, key string, views []*model.ToView) (err error) {\n\tconn := d.redis.Get(c)\n\tdefer conn.Close()\n\tfor _, v := range views {\n\t\tif err = conn.Send(\"ZADD\", key, v.Unix, v.Aid); err != nil {\n\t\t\tlog.Error(\"conn.Send(ZREM %s,%d) error(%v)\", key, v.Aid, err)\n\t\t\treturn\n\t\t}\n\t}\n\tif err = conn.Send(\"EXPIRE\", key, d.expire); err != nil {\n\t\tlog.Error(\"conn.Send(EXPIRE) error(%v)\", err)\n\t\treturn\n\t}\n\tif err = conn.Flush(); err != nil {\n\t\tlog.Error(\"conn.Flush() error(%v)\", err)\n\t\treturn\n\t}\n\tfor i := 0; i < len(views)+1; i++ {\n\t\tif _, err = conn.Receive(); err != nil {\n\t\t\tlog.Error(\"conn.Receive() error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "1fd70f60c3ef493f9e089c21b26e2764", "score": "0.5485266", "text": "func (v *RtmpConnection) CacheMessage(m *RtmpMessage) (err error) {\n\tv.writeLock.Lock()\n\tdefer v.writeLock.Unlock()\n\n\t// push to queue.\n\tv.out = append(v.out, m)\n\n\t// notify when messages is enough and sender is not working.\n\tif len(v.out) >= v.requiredMessages() && !v.isFlusherWorking {\n\t\tv.needNotifyFlusher = true\n\t}\n\n\t// unblock the sender when got enough messages.\n\tif v.toggleNotify() {\n\t\tselect {\n\t\tcase v.shouldFlush <- true:\n\t\tdefault:\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d12c56ba3c79d7a5d6b72a10f34e6e14", "score": "0.5275665", "text": "func (c *txIdCache) addRing(key [HASH_PREFIX_SIZE]byte, id int64) int64 {\n\tc.Lock()\n\n\tresult := int64(-1)\n\n\tif hit, ok := c.recent[key]; ok {\n\t\tresult = hit\n\t\tc.dups++\n\t} else {\n\t\tc.recent[key] = id\n\t}\n\n\tc.ring_n++\n\tif c.ring_n == RECENT_RING_SIZE {\n\t\tc.ring_n = 0\n\t}\n\n\tif c.ring[c.ring_n] != zeroHashPrefix && result == -1 {\n\t\tdelete(c.recent, c.ring[c.ring_n])\n\t}\n\n\tc.ring[c.ring_n] = key\n\n\tc.Unlock()\n\treturn result\n}", "title": "" }, { "docid": "a66b895408fde02e87ac9f59bb2ec52f", "score": "0.52621055", "text": "func AddGroupCache(ur []*pb.UserRecord, gInfo *pb.GroupInfo, rd redis.Conn) error {\n\tif rd == nil {\n\t\treturn errors.New(\"rd is null\")\n\t}\n\tdefer rd.Close()\n\n\tgrpData, err := json.Marshal(pb.GroupInfo{Gid: gInfo.Gid, GroupName: gInfo.GroupName, GroupManager: gInfo.GroupManager})\n\tif err != nil {\n\t\tlog.Printf(\"json marshal error: %s\\n\", err)\n\t\treturn err\n\t}\n\n\tgrpKey := MakeGroupDataKey(gInfo.Gid)\n\tmemKey := MakeGroupMemKey(gInfo.Gid)\n\n\t_ = rd.Send(\"MULTI\")\n\tfor _, v := range ur {\n\t\t_ = rd.Send(\"SADD\", memKey, v.Uid)\n\t}\n\t_ = rd.Send(\"SET\", grpKey, grpData)\n\n\t_, err = rd.Do(\"EXEC\")\n\tif err != nil {\n\t\tlog.Printf(\"add group to cache error: %s\\n\", err)\n\t\treturn err\n\t}\n\t//log.Printf(\"reply:%T\", reply)\n\n\treturn nil\n}", "title": "" }, { "docid": "c274d3d112d4af0f0c4ca8224057435f", "score": "0.5208874", "text": "func (d *Dao) addViewCache(c context.Context, aid int64, vp *arcwar.ViewReply) (err error) {\n\tconn := d.arcMc.Get(c)\n\tkey := keyView(aid)\n\titem := &memcache.Item{Key: key, Object: vp, Flags: memcache.FlagJSON, Expiration: d.expireView}\n\tif err = conn.Set(item); err != nil {\n\t\terr = errors.Wrapf(err, \"conn.Set(%s,%v,%d)\", key, vp, d.expireView)\n\t}\n\tconn.Close()\n\treturn\n}", "title": "" }, { "docid": "b346ec489e594c079119373c664b17e2", "score": "0.5124569", "text": "func (rc *RequestCache) add(rp namenode_rpc.ReqPacket, \nresp namenode_rpc.ResponsePacket) error {\n\n\t//the central assumption does not hold if \n\t//we do not have equal packet numbers\n\tif rp != nil && resp != nil {\n\t\tif rp.GetPacketNumber() != resp.GetPacketNumber() {\n\t\t\treturn errors.New(\"Packet numbers are not equal for request \n\t\t\tand response\")\n\t\t}\n\t}\n\n\tpp := namenode_rpc.NewPacketPair();\n\tpp.Request = rp;\n\tpp.Response = resp;\n\n\tpacketNum := PacketNumber(0)\n\tif rp != nil {\n\t\tpacketNum = PacketNumber(rp.GetPacketNumber())\n\t} else {\n\t\tpacketNum = PacketNumber(resp.GetPacketNumber())\n\t}\n\n\trc.RequestResponse[packetNum] = *pp\n\trc.PacketNumbers = append(rc.PacketNumbers, packetNum)\n\n\t//we have to get rid of something from the beginning of the list\n\t//since that is supposed to have been inserted earlier\n\tif len(rc.RequestResponse) > rc.CacheSize {\n\t\t//get the least recently used packet number\n\t\tlruPacketNumber := rc.PacketNumbers[0]\n\n\t\tdelete(rc.RequestResponse, lruPacketNumber)\n\n\t\t//get rid of that packet number\n\t\trc.PacketNumbers = rc.PacketNumbers[1:]\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f26be5e52cdea9b3ecea9d37282192c3", "score": "0.51029986", "text": "func (d *Dao) addStatCache(c context.Context, mid int64, st *data.Stat) (err error) {\n\tvar (\n\t\tkey = keyStat(mid)\n\t)\n\tconn := d.mc.Get(c)\n\tdefer conn.Close()\n\tif err = conn.Set(&memcache.Item{Key: key, Object: st, Flags: memcache.FlagJSON, Expiration: d.mcExpire}); err != nil {\n\t\tlog.Error(\"memcache.Set(%v) error(%v)\", key, err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "9018caef560122b4aa44192188369ef8", "score": "0.50904226", "text": "func (d *Dao) AddCacheVip(c context.Context, mid int64, v *v1.VipInfo) (err error) {\n\tconn := d.mc.Get(c)\n\tconn.Set(&mc.Item{\n\t\tKey: keyVip(mid),\n\t\tObject: v,\n\t\tFlags: mc.FlagProtobuf,\n\t\tExpiration: d.mcExpire,\n\t})\n\tconn.Close()\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"dao vip add cache\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "742ff9189f602f43caafef2cd3c4e80d", "score": "0.50840616", "text": "func (c *Cache) addRegistryToCache(r *registry.Registry) {\n\n\t// if it already exists\n\n\tif ir, ok := c.rs[r.Reference()]; ok == true {\n\t\tir.touch(c.c.conf.CachePolicy)\n\t\treturn\n\t}\n\n\t// clean if need\n\n\tif len(c.rs) == c.c.conf.CacheRegistries {\n\n\t\tvar (\n\t\t\ttormr registry.RegistryRef // reference\n\t\t\ttormp cachePoints // points\n\t\t)\n\n\t\tfor rr, ir := range c.rs {\n\t\t\tif ir.cachePoints > tormp {\n\t\t\t\ttormr = rr\n\t\t\t\ttormp = ir.cachePoints\n\t\t\t}\n\t\t}\n\n\t\tdelete(c.rs, tormr)\n\n\t}\n\n\t// add\n\n\tvar ir = &itemRegistry{r: r}\n\n\tir.touch(c.c.conf.CachePolicy)\n\tc.rs[r.Reference()] = ir\n}", "title": "" }, { "docid": "3b4ce122c80f2d67720880f03bf1b6fb", "score": "0.5008034", "text": "func (m *RawManager) getMsgID() uint64 {\n\treturn atomic.AddUint64(&m.nextMsgID, 1)\n}", "title": "" }, { "docid": "2f04168bbe7ec9969c282f8b2728b0f3", "score": "0.500352", "text": "func (t *TmpMap) add(b *bytes.Buffer, round uint64) bool {\n\tset, found := t.msgSets[round]\n\tif !found {\n\t\tset = hashset.New()\n\t}\n\n\tret := set.Add(b.Bytes())\n\tt.msgSets[round] = set\n\treturn ret\n}", "title": "" }, { "docid": "cf66bd706de019fc1e8c58cfd1432d58", "score": "0.49942145", "text": "func (rr *redisReceiver) register(conn *websocket.Conn) string {\n\trr.Mutex.Lock()\n\tdefer rr.Mutex.Unlock()\n\tid := uuid.NewV4().String()\n\trr.conns[id] = conn\n\treturn id\n}", "title": "" }, { "docid": "d20369f8cbf46588b373ba7f6c7a774d", "score": "0.49900225", "text": "func (d *Dao) AddCacheUserInfo(c context.Context, id interface{}, val *model.UserInfo) (err error) {\n\tif val == nil {\n\t\treturn\n\t}\n\tkey := keyInfo(id)\n\titem := &memcache.Item{Key: key, Object: val, Expiration: d.demoExpire, Flags: memcache.FlagJSON}\n\tif err = d.mc.Set(c, item); err != nil {\n\t\tlog.Errorv(c, log.KV(\"AddCacheUserInfo\", fmt.Sprintf(\"%+v\", err)), log.KV(\"key\", key))\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "2b343900fb9310476aef6631791db8a5", "score": "0.49843347", "text": "func (g *DLTGroup) addUnreadedFile(fileId uint32, id int) bool {\n\tif index := g.dlt.unreadFilesIndexs[fileId]; index == 0 {\n\t\tif g.dlt.cachedFilesCache[fileId] == 0 {\n\t\t\tg.unreadFiles[g.unreadFileNum] = fileId\n\t\t\tg.unreadFileNum++\n\t\t\tg.dlt.unreadFilesIndexs[fileId] = g.unreadFileNum\n\t\t\tif g.unreadFileNum == 1 {\n\t\t\t\tg.condPreread.Signal()\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\n\t\tLogFromtln(\"Warning: addUnreadedFile already in cached files\", id, fileId)\n\t\treturn false\n\t}\n\tLogFromtln(\"Warning: addUnreadedFile already in unread files\", id, fileId)\n\treturn false\n}", "title": "" }, { "docid": "d523ec7adfde8f1632f3ed5ac36e5e34", "score": "0.49719077", "text": "func AddGroupSingleMemCache(gid, uid int32, rd redis.Conn) error {\n\tif rd == nil {\n\t\treturn fmt.Errorf(\"rd is nil\")\n\t}\n\tdefer rd.Close()\n\n\tkey := MakeGroupMemKey(gid)\n\t_, err := rd.Do(\"SADD\", key, uid)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"add new group key(%s) error: %s\", key, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e7c84c69d2a2229d48badbdb54861f1a", "score": "0.49541354", "text": "func (manager *registryCacheManager) PushCache(cacheID string, digestPair *image.DigestPair) error {\n\tmanager.Lock()\n\tdefer manager.Unlock()\n\n\tkey := _cachePrefix + cacheID\n\tentry := createEntry(digestPair)\n\tmanager.memKVStore[key] = entry\n\n\tif manager.registryClient == nil {\n\t\tmanager.pushErrors.Add(fmt.Errorf(\"registry client not configured to push cache\"))\n\t\treturn nil\n\t}\n\n\tmanager.wg.Add(1)\n\n\tgo func() {\n\t\tdefer manager.wg.Done()\n\n\t\tif digestPair != nil {\n\t\t\tif err := manager.registryClient.PushLayer(digestPair.GzipDescriptor.Digest); err != nil {\n\t\t\t\tmanager.pushErrors.Add(fmt.Errorf(\"push layer %s: %s\", digestPair.GzipDescriptor.Digest, err))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tmanager.Lock()\n\t\tdefer manager.Unlock()\n\n\t\tif err := manager.kvStore.Put(_cachePrefix+cacheID, entry); err != nil {\n\t\t\tmanager.pushErrors.Add(fmt.Errorf(\"store tag mapping (%s,%s): %s\", cacheID, entry, err))\n\t\t\treturn\n\t\t}\n\n\t\tlog.Infof(\"Stored cacheID mapping to KVStore: %s => %s\", cacheID, entry)\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "21ec21816029cda2b99d7dcf3281cd17", "score": "0.49350685", "text": "func addMessageToReceiveChannel(message Message) {\n\tif message.Source == LocalNode.Name && message.Destination == defs.MULTICAST_DEST {\n\t\tlocalReceivedSeqNum += 1\n\t} else {\n\t\ttimestampMutex.Lock()\n\t\tUpdateTimestamp(&vectorTimeStamp, &message.Timestamp)\n\t\ttimestampMutex.Unlock()\n\t}\n\treceiveChannel <- message\n}", "title": "" }, { "docid": "b5ec77eb83c35345d33a5bbb88de2e93", "score": "0.49272445", "text": "func (d *Dao) PushDynamicCache(c context.Context, info *model.DynamicCacheRetry) (err error) {\n\tvar (\n\t\tlength int64\n\t\tbs []byte\n\t\tconn = d.redis.Get(c)\n\t)\n\tdefer conn.Close()\n\tif length, err = redis.Int64(conn.Do(\"LLEN\", _retryDynamicCacheKey)); err != nil {\n\t\tlog.Error(\"conn.Do(%s) error(%+v)\", _retryDynamicCacheKey, err)\n\t\tPromError(\"redis:重试dynamic缓存LLEN\")\n\t\treturn\n\t}\n\tcacheLen.State(\"redis:retry_dynamic_cache_length\", length)\n\tif bs, err = json.Marshal(info); err != nil {\n\t\tlog.Error(\"json.Marshal(%v) error(%+v)\", info, err)\n\t\tPromError(\"redis:重试dynamic缓存Marshal\")\n\t\treturn\n\t}\n\tif _, err = conn.Do(\"RPUSH\", _retryDynamicCacheKey, bs); err != nil {\n\t\tlog.Error(\"conn.Do(RPUSH, %s) error(%+v)\", bs, err)\n\t\tPromError(\"redis:重试dynamic缓存RPUSH\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "11171a9886b3464e89ee2644503c641f", "score": "0.4926387", "text": "func (s *MemorySessionStore) Add(id string, req *http.Request) {\n\ts.Lock()\n\tdefer s.Unlock()\n\tn, ok := s.ConnIds[id]\n\tif !ok {\n\t\ts.ConnIds[id] = 1\n\t\treturn\n\t}\n\tn++\n\ts.ConnIds[id] = n\n\treturn\n}", "title": "" }, { "docid": "68f765037a5519ba06b5521ab4fb50f4", "score": "0.49056414", "text": "func (g *DLTGroup) moveFromUnreadToCachedFile(fileId uint32) bool {\n\tok := g.removeFromUnreadFile(fileId)\n\tif !ok {\n\t\treturn false\n\t}\n\n\t// add to cached\n\tif index := g.dlt.cachedFilesCache[fileId]; index != 0 {\n\t\tLogFromtln(\"Warning: addUnreadedFile already in cached files\", fileId)\n\t\treturn false\n\t}\n\n\tg.cachedFiles[g.cachedFileNum] = fileId\n\tg.cachedFileNum++\n\tg.dlt.cachedFilesCache[fileId] = g.cachedFileNum\n\n\treturn true\n}", "title": "" }, { "docid": "a539952e2956faded66bacfe500287f5", "score": "0.48818424", "text": "func (this *DubboClient) AddWaitMsg(msgID int64, result *RespondResult) {\n\tthis.mapMutex.Lock()\n\tif this.msgWaitRspMap != nil {\n\t\tthis.msgWaitRspMap[msgID] = result\n\t}\n\tthis.mapMutex.Unlock()\n}", "title": "" }, { "docid": "dc7b63536fe75feb697b2d83810d2066", "score": "0.48769262", "text": "func (d *Dao) addRelatesCache(c context.Context, aid int64, rls []*view.Relate) (err error) {\n\tconn := d.arcMc.Get(c)\n\tkey := keyRl(aid)\n\titem := &memcache.Item{Key: key, Object: rls, Flags: memcache.FlagJSON, Expiration: d.expireRlt}\n\tif err = conn.Set(item); err != nil {\n\t\terr = errors.Wrapf(err, \"conn.Set(%s,%v,%d)\", key, rls, d.expireRlt)\n\t}\n\tconn.Close()\n\treturn\n}", "title": "" }, { "docid": "e5cedf42dba23ffedc3a80f46bf6e157", "score": "0.4868948", "text": "func (c *Client) addToCache(key *datastore.Key, data interface{}) {\n\t// Put data into the cache, indexed by the string representation of the datastore key.\n\tkeyStr := key.String()\n\tc.cacheMx.Lock()\n\tc.Cache[keyStr] = data\n\tc.cacheMx.Unlock()\n\n\t// Put the datastore key string into the slice of cache keys.\n\tc.cacheKeysMx.Lock()\n\tc.cacheKeys = append(c.cacheKeys, keyStr)\n\tc.cacheKeysMx.Unlock()\n\n\tc.shrinkCacheIfFull()\n}", "title": "" }, { "docid": "b053bae9931a6d9ced48ae65ca6c0ab9", "score": "0.4865086", "text": "func (d *Dao) addArcCache(c context.Context, aid int64, cached *arcwar.Arc) (err error) {\n\tconn := d.arcMc.Get(c)\n\tkey := keyArc(aid)\n\titem := &memcache.Item{Key: key, Object: cached, Flags: memcache.FlagJSON, Expiration: d.expireArc}\n\tif err = conn.Set(item); err != nil {\n\t\terr = errors.Wrapf(err, \"conn.Set(%s,%v,%d)\", key, cached, d.expireArc)\n\t}\n\tconn.Close()\n\treturn\n}", "title": "" }, { "docid": "207fc2ee7c1e98b11fb8e1127555dcb6", "score": "0.48477122", "text": "func (d *Dao) AddCacheUpSpecial(c context.Context, id int64, val *upgrpc.UpSpecial) (err error) {\n\tif val == nil {\n\t\treturn\n\t}\n\tconn := d.mc.Get(c)\n\tdefer conn.Close()\n\tkey := upSpecialCacheKey(id)\n\titem := &memcache.Item{Key: key, Object: val, Expiration: d.upSpecialExpire, Flags: memcache.FlagProtobuf}\n\tif err = conn.Set(item); err != nil {\n\t\tprom.BusinessErrCount.Incr(\"mc:AddCacheUpSpecial\")\n\t\tlog.Errorv(c, log.KV(\"AddCacheUpSpecial\", fmt.Sprintf(\"%+v\", err)), log.KV(\"key\", key))\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "0b494a714694f1155e787bbdc39110fb", "score": "0.48084626", "text": "func TestAddMessage(t *testing.T) {\n\tmb := NewMessageBuffer(false) // don't start buffer monitor routine\n\n\tclientId := util.RandomBytes(8)\n\n\trequire.Equal(t, 0, mb.GetClientMsgSize(clientId))\n\n\tpbMsg := &pb.Relay{SrcIdentifier: \"from\", DestId: []byte(\"to\"), Payload: []byte(\"payload\"),\n\t\tMaxHoldingSeconds: 0} // cache 0 seconds\n\tmNode := mb.AddMessage(clientId, pbMsg)\n\trequire.Equal(t, (*msgNode)(nil), mNode)\n\trequire.Equal(t, 0, mb.GetClientMsgSize(clientId))\n\n\tpbMsg, mNode = addRandMsg(mb, clientId)\n\n\trequire.Equal(t, 1, mb.GetClientMsgSize(clientId))\n\trequire.Equal(t, 1, mb.treeCreate.Size())\n\trequire.Equal(t, 1, mb.treeExpire.Size())\n\trequire.Equal(t, mNode.GetSize(), mb.totalBufSize)\n\n\tmsgs := mb.PopMessages(clientId)\n\trequire.Equal(t, 1, len(msgs))\n\trequire.Equal(t, pbMsg, msgs[0])\n\n\tconst msgNum = 1000\n\tvar totalSize = 0\n\tpbMsg1, mNode1 := addRandMsg(mb, clientId) // first msg\n\ttotalSize += mNode1.GetSize()\n\tfor i := 0; i < msgNum; i++ {\n\t\t_, mNode := addRandMsg(mb, clientId)\n\t\ttotalSize += mNode.GetSize()\n\t}\n\tpbMsg2 := &pb.Relay{SrcIdentifier: \"from\", DestId: []byte(\"to\"), Payload: []byte(\"payload\"),\n\t\tMaxHoldingSeconds: math.MaxUint32} // cache MaxUint32 seconds\n\tmNode2 := mb.AddMessage(clientId, pbMsg2) // last msg\n\n\ttotalSize += mNode2.GetSize()\n\n\trequire.Equal(t, msgNum+2, mb.GetClientMsgSize(clientId))\n\trequire.Equal(t, msgNum+2, mb.treeCreate.Size())\n\trequire.Equal(t, msgNum+2, mb.treeExpire.Size())\n\trequire.Equal(t, totalSize, mb.totalBufSize)\n\n\tmsgs = mb.PopMessages(clientId) // pop out to check what we added in.\n\trequire.Equal(t, msgNum+2, len(msgs))\n\trequire.Equal(t, pbMsg1, msgs[0]) // first msg\n\trequire.Equal(t, pbMsg2, msgs[msgNum+1]) // last msg\n\n\trequire.Equal(t, 0, mb.GetClientMsgSize(clientId))\n\trequire.Equal(t, 0, mb.treeCreate.Size())\n\trequire.Equal(t, 0, mb.treeExpire.Size())\n\trequire.Equal(t, 0, mb.totalBufSize)\n\n}", "title": "" }, { "docid": "8568465de307ce3390c091febb36df72", "score": "0.48076427", "text": "func updateLogMsgID(appUUID string) uint64 {\n\tvar msgid uint64\n\tif appUUID == \"\" {\n\t\tmsgid = msgIDDevCnt\n\t\tmsgIDDevCnt++\n\t} else {\n\t\tif val, ok := domainUUID.Load(appUUID); ok {\n\t\t\tappD := val.(appDomain)\n\t\t\tmsgid = appD.msgIDAppCnt\n\t\t\tappD.msgIDAppCnt++\n\t\t\tdomainUUID.Store(appUUID, appD)\n\t\t}\n\t}\n\n\treturn msgid\n}", "title": "" }, { "docid": "251f805c872ed011d6abbbb419982d1a", "score": "0.48022786", "text": "func (c *RedisLRUCache) Add(key, value interface{}) bool {\n\tprefixedKey, rawKey, err := c.encodeKey(key)\n\tif err != nil {\n\t\tglog.Errorf(\"Unable to create redis key: %s\", err)\n\t\treturn false\n\t}\n\n\tbyteVal, err := c.encodeVal(value)\n\tif err != nil {\n\t\tglog.Errorf(\"Unable to create redis value: %s\", err)\n\t\treturn false\n\t}\n\n\tconn := c.pool.Get()\n\tdefer util.Close(conn)\n\n\tutil.LogErr(conn.Send(\"MULTI\"))\n\tutil.LogErr(conn.Send(\"SET\", prefixedKey, byteVal))\n\tutil.LogErr(conn.Send(\"SADD\", c.indexSetKey, rawKey))\n\t_, err = conn.Do(\"EXEC\")\n\tif err != nil {\n\t\tglog.Errorf(\"Unable to add key: %s\", err)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "9d197af4ba07da251748947ac610ef6f", "score": "0.47977188", "text": "func (c *Cache) AddRegistryToCache(r *registry.Registry) {\n\n\tif c.c.conf.CacheRegistries <= 0 {\n\t\treturn\n\t}\n\n\tc.mx.Lock()\n\tdefer c.mx.Unlock()\n\n\tc.addRegistryToCache(r)\n\n}", "title": "" }, { "docid": "9a85f98dd5d5c0685166610c3c0013af", "score": "0.47868884", "text": "func (os *OutputStream) Add(msgs []Message) error {\n\tvar key [8]byte\n\n\tos.messagesMu.Lock()\n\tdefer os.messagesMu.Unlock()\n\n\tos.batch.Reset()\n\n\tos.lastseen.NextID = uint64(msgs[0].Id.Id)\n\tbinary.BigEndian.PutUint64(key[:], uint64(os.lastseen.Messages[0].Id.Id))\n\tos.batch.Put(key[:], os.lastseen.marshal())\n\tos.cacheMu.Lock()\n\tdelete(os.messagesCache, uint64(os.lastseen.Messages[0].Id.Id))\n\tos.cacheMu.Unlock()\n\n\tos.lastseen = messageBatch{\n\t\tMessages: msgs,\n\t\tNextID: math.MaxUint64,\n\t}\n\tbinary.BigEndian.PutUint64(key[:], uint64(msgs[0].Id.Id))\n\tos.batch.Put(key[:], os.lastseen.marshal())\n\tif err := os.db.Write(&os.batch, nil); err != nil {\n\t\treturn err\n\t}\n\n\tos.newMessage.Broadcast()\n\treturn nil\n}", "title": "" }, { "docid": "eb0031b3b234b8eaedff5414742a59c3", "score": "0.47809735", "text": "func (t *Tsdb) getOrAddID(s []byte) uint32 {\n\thash := t.getID(s)\n\tif _, ok := t.ss[hash]; ok {\n\t\treturn hash\n\t}\n\tt.ss[hash] = s\n\tt.internalRecord(TsdbOverheadMetric, 0, time.Now(), float64(len(s)+4))\n\treturn hash\n}", "title": "" }, { "docid": "63dc2b04f8834779d466831947e5e367", "score": "0.47807178", "text": "func TestInitContextWithAuthProxy_CachedInvalidUserID(t *testing.T) {\n\tconst name = \"markelog\"\n\n\tsvc := getContextHandler(t)\n\n\treq, err := http.NewRequest(\"POST\", \"http://example.com\", nil)\n\trequire.NoError(t, err)\n\tctx := &contextmodel.ReqContext{\n\t\tContext: &web.Context{Req: req},\n\t\tLogger: log.New(\"Test\"),\n\t}\n\treq.Header.Set(svc.Cfg.AuthProxyHeaderName, name)\n\th, err := authproxy.HashCacheKey(name)\n\trequire.NoError(t, err)\n\tkey := fmt.Sprintf(authproxy.CachePrefix, h)\n\n\tt.Logf(\"Injecting stale user ID in cache with key %q\", key)\n\tuserIdPayload := []byte(strconv.FormatInt(int64(33), 10))\n\terr = svc.RemoteCache.Set(context.Background(), key, userIdPayload, 0)\n\trequire.NoError(t, err)\n\n\tauthEnabled := svc.initContextWithAuthProxy(ctx, orgID)\n\trequire.True(t, authEnabled)\n\n\trequire.Equal(t, userID, ctx.SignedInUser.UserID)\n\trequire.True(t, ctx.IsSignedIn)\n\n\tcachedByteArray, err := svc.RemoteCache.Get(context.Background(), key)\n\trequire.NoError(t, err)\n\n\tcacheUserId, err := strconv.ParseInt(string(cachedByteArray), 10, 64)\n\n\trequire.NoError(t, err)\n\trequire.Equal(t, userID, cacheUserId)\n}", "title": "" }, { "docid": "5d093c12b77fe0da60848c2dcfa59dde", "score": "0.47624093", "text": "func (d *Dao) AddViewCache(aid int64, vp *arcwar.ViewReply) {\n\td.addCache(func() {\n\t\td.addViewCache(context.TODO(), aid, vp)\n\t})\n}", "title": "" }, { "docid": "bdfd8ee826e0ff68f8dfcf99f51eb1fc", "score": "0.47601265", "text": "func (d *Dao) AddCacheOrderUser(c context.Context, id string, val *model.Order) (err error) {\n\tif val == nil {\n\t\treturn\n\t}\n\tconn := d.mc.Get(c)\n\tdefer conn.Close()\n\tkey := orderKey(id)\n\titem := &memcache.Item{Key: key, Object: val, Expiration: conf.Conf.CacheTTL.OrderTTL, Flags: memcache.FlagJSON}\n\tif err = conn.Set(item); err != nil {\n\t\tprom.BusinessErrCount.Incr(\"mc:AddCacheOrderUser\")\n\t\tlog.Errorv(c, log.KV(\"AddCacheOrderUser\", fmt.Sprintf(\"%+v\", err)), log.KV(\"key\", key))\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "428213b4575ef3b1293993aaace09fa6", "score": "0.47511548", "text": "func (c *rrCache) Add(rr dns.RR) bool {\n\t// Create an entry for the domain name if none exists.\n\tdnmap, ok := c.cache[rr.Header().Name]\n\tif !ok {\n\t\tdnmap = make(map[uint16][]*rrCacheEntry, 0)\n\t\tc.cache[rr.Header().Name] = dnmap\n\t}\n\n\t// Remove all rr's matching this one's type if a cache flush is requested.\n\tif rr.Header().Class&0x8000 == 0x8000 {\n\t\tif c.logLevel >= 2 {\n\t\t\tlog.Printf(\"cache flush for %v\\n\", rr)\n\t\t}\n\t\tdnmap[rr.Header().Rrtype] = make([]*rrCacheEntry, 0)\n\t}\n\n\tswitch {\n\tcase rr.Header().Ttl > 4500:\n\t\t// Don't believe TTLs greater than 75 minutes. Entries should refresh much faster than this.\n\t\trr.Header().Ttl = 4500\n\tcase rr.Header().Ttl == 0:\n\t\t// This is a goodbye packet. RFC 6762 specifies that queriers receiving a multicast DNS\n\t\t// response with a TTL of zero should record a TTL of 1 and then delete the record one\n\t\t// second later. This gives the other cooperating responders one second to rescue the\n\t\t// records when the goodbye packet was sent incorrectly.\n\t\trr.Header().Ttl = 1\n\t}\n\n\t// Add absolute expiration time to the entry.\n\tentry := &rrCacheEntry{time.Now().Add(time.Duration(rr.Header().Ttl) * time.Second), rr}\n\n\t// If the slice doesn't exist yet, create it.\n\trrslice, ok := dnmap[rr.Header().Rrtype]\n\tif !ok {\n\t\tdnmap[rr.Header().Rrtype] = make([]*rrCacheEntry, 0)\n\t\trrslice = dnmap[rr.Header().Rrtype]\n\t}\n\n\t// If an existing cache rr has the same data fields, replace it. Otherwise, just append. We just\n\t// worry about a subset of rr types used by mdns.\n\tfirstnil := -1\n\tfor i := range rrslice {\n\t\tif rrslice[i] == nil {\n\t\t\t// When we take down entries with expired TTLs, we just nil out the pointer so we\n\t\t\t// remember the first nil'd pointer for subsequent reuse.\n\t\t\tif firstnil < 0 {\n\t\t\t\tfirstnil = i\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tsame := false\n\t\tswitch x := rr.(type) {\n\t\tcase *dns.RR_A:\n\t\t\ty := rrslice[i].rr.(*dns.RR_A)\n\t\t\tif same = x.A == y.A; same {\n\t\t\t\tbreak\n\t\t\t}\n\t\tcase *dns.RR_AAAA:\n\t\t\ty := rrslice[i].rr.(*dns.RR_AAAA)\n\t\t\tsame = true\n\t\t\tfor j := range x.AAAA {\n\t\t\t\tif x.AAAA[j] != y.AAAA[j] {\n\t\t\t\t\tsame = false\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif same {\n\t\t\t\tbreak\n\t\t\t}\n\t\tcase *dns.RR_TXT:\n\t\t\ty := rrslice[i].rr.(*dns.RR_TXT)\n\t\t\tif same = reflect.DeepEqual(x.Txt, y.Txt); same {\n\t\t\t\tbreak\n\t\t\t}\n\t\tcase *dns.RR_PTR:\n\t\t\ty := rrslice[i].rr.(*dns.RR_PTR)\n\t\t\tif same = x.Ptr == y.Ptr; same {\n\t\t\t\tbreak\n\t\t\t}\n\t\tcase *dns.RR_SRV:\n\t\t\ty := rrslice[i].rr.(*dns.RR_SRV)\n\t\t\tif same = x.Priority == y.Priority && x.Weight == y.Weight && x.Port == y.Port && x.Target == y.Target; same {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif same {\n\t\t\tif c.logLevel >= 2 {\n\t\t\t\tlog.Printf(\"replacing cached entry for %v with %v\\n\", rrslice[i].rr, rr)\n\t\t\t}\n\t\t\trrslice[i] = entry\n\t\t\treturn false\n\t\t}\n\t}\n\t// If we get to here, we have a new record.\n\tif firstnil >= 0 {\n\t\t// Fill in a hole.\n\t\trrslice[firstnil] = entry\n\t\tif c.logLevel >= 2 {\n\t\t\tlog.Printf(\"adding cached entry for %v (in a hole)\\n\", rr)\n\t\t}\n\t} else {\n\t\t// Append to the end of the list.\n\t\tdnmap[rr.Header().Rrtype] = append(rrslice, entry)\n\t\tif c.logLevel >= 2 {\n\t\t\tlog.Printf(\"adding cached entry for %v (append)\\n\", rr)\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "7d1e077571df95ebb460b0ce42d9bd75", "score": "0.47368112", "text": "func (con *ConnectionCache) AddClientToCache(devID uint64, cl ListenerInterface) error {\r\n\tif cl != nil {\r\n\t\tcon.ml.Lock()\r\n\t\tdefer con.ml.Unlock()\r\n\t\t_, ok := con.onlineClientsCashe[devID]\r\n\t\tif ok {\r\n\t\t\tlog.Warning(\"Can not append new abonent with diviceID \", devID, \" abonent exist\")\r\n\t\t\treturn fmt.Errorf(\"Abonent exist\")\r\n\t\t}\r\n\t\tallReaders := make([]ListenerInterface, 0, configuration.Config.MaxPeerConnection) // Для избежания случайных переалокаций\r\n\t\tcon.onlineClientsCashe[devID] = cachedClient{\r\n\t\t\tbase: cl,\r\n\t\t\tconnectedReaders: allReaders,\r\n\t\t\tmtx: new(sync.RWMutex),\r\n\t\t}\r\n\t\treturn nil\r\n\t}\r\n\treturn fmt.Errorf(\"Client is nil\")\r\n}", "title": "" }, { "docid": "268a6d77a22a38949a60d8decdeb284a", "score": "0.47159714", "text": "func (d *Dao) AddCacheCards(c context.Context, cm map[int64]*v1.Card) (err error) {\n\tconn := d.mc.Get(c)\n\tdefer conn.Close()\n\tfor _, card := range cm {\n\t\titem := &mc.Item{\n\t\t\tKey: keyCard(card.Mid),\n\t\t\tObject: card,\n\t\t\tFlags: mc.FlagProtobuf,\n\t\t\tExpiration: d.mcExpire,\n\t\t}\n\t\terr = conn.Set(item)\n\t\tif err != nil {\n\t\t\terr = errors.Wrap(err, \"dao add cards cache\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f62b9298859986853ed6b4661c07e426", "score": "0.46911427", "text": "func (ms *FileMsgStore) initCache() {\n\tms.cache = &msgsCache{\n\t\tseqMaps: make(map[uint64]*cachedMsg),\n\t}\n}", "title": "" }, { "docid": "a5f688d3ef670ccf3cc233dbb2ee6e6e", "score": "0.46882534", "text": "func (l *Conn) nextMessageID() (messageID uint64) {\n defer func() { if r := recover(); r != nil { messageID = 0 } }()\n messageID = <-l.chanMessageID\n return\n}", "title": "" }, { "docid": "cd4b267068c3407680ed44b756400767", "score": "0.46800643", "text": "func (s *Store) cacheDroppedVoteMsg(cellID uint64, msg raftpb.Message) {\n\tif msg.Type == raftpb.MsgVote {\n\t\ts.droppedLock.Lock()\n\t\ts.droppedVoteMsgs[cellID] = msg\n\t\ts.droppedLock.Unlock()\n\t}\n}", "title": "" }, { "docid": "a056f130455e80dce9ba1a5f187b1c31", "score": "0.46787697", "text": "func (rlic *redisLayerInfoCache) Add(ctx context.Context, repo string, dgst digest.Digest) error {\n\tconn := rlic.pool.Get()\n\tdefer conn.Close()\n\n\tctxu.GetLogger(ctx).Debugf(\"(*redisLayerInfoCache).Add(%q, %q)\", repo, dgst)\n\t_, err := conn.Do(\"SADD\", rlic.repositoryBlobSetKey(repo), dgst)\n\treturn err\n}", "title": "" }, { "docid": "5faed32c986a1e93ff455b3716481f02", "score": "0.4676597", "text": "func (d *Dao) AddCacheCard(c context.Context, mid int64, v *v1.Card) (err error) {\n\titem := &mc.Item{\n\t\tKey: keyCard(mid),\n\t\tObject: v,\n\t\tFlags: mc.FlagProtobuf,\n\t\tExpiration: d.mcExpire,\n\t}\n\tconn := d.mc.Get(c)\n\terr = conn.Set(item)\n\tconn.Close()\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"dao add card cache\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "6e874294acf64bab45f21931c39316a6", "score": "0.4670389", "text": "func addRandMsg(mb *MessageBuffer, clientId []byte) (pbMsg *pb.Relay, mNode *msgNode) {\n\n\tr := rand.New(rand.NewSource(time.Now().UnixNano()))\n\tn := r.Intn(20)\n\tif n <= 0 {\n\t\tn = 8\n\t}\n\tsrc := util.RandomBytes(n)\n\n\tn = r.Intn(20)\n\tif n <= 0 {\n\t\tn = 8\n\t}\n\tdestId := util.RandomBytes(n)\n\n\tn = r.Intn(1024)\n\tif n <= 0 {\n\t\tn = 256\n\t}\n\tpayload := util.RandomBytes(n)\n\n\tpbMsg = &pb.Relay{SrcIdentifier: hex.EncodeToString(src), DestId: destId, Payload: payload}\n\n\tpbMsg.MaxHoldingSeconds = uint32(r.Intn(20))\n\tif pbMsg.MaxHoldingSeconds == 0 { // if 0, no cache.\n\t\tpbMsg.MaxHoldingSeconds = 1\n\t}\n\n\tmNode = mb.AddMessage(clientId, pbMsg)\n\n\treturn pbMsg, mNode\n}", "title": "" }, { "docid": "5902c446fcc419f22d617173ec06068d", "score": "0.4668269", "text": "func (c *imageCacher) addLRULocked(img *CachedImage) {\n\tee, ok := c.lruMap[img.ID]\n\tif ok {\n\t\tc.lruList.MoveToFront(ee)\n\t} else {\n\t\tc.lruSize += img.Size\n\t\tc.lruMap[img.ID] = c.lruList.PushFront(img)\n\t}\n}", "title": "" }, { "docid": "acc66f0f6c05ee3397500bd866f937c1", "score": "0.46622878", "text": "func (d *Dao) SetPlStatCache(c context.Context, mid, pid int64, stat *model.PlStat) (err error) {\n\tvar (\n\t\tbs []byte\n\t\tok bool\n\t\tkeyMid = keyStat(mid)\n\t\tkeyPid = keyPl(pid)\n\t\tconn = d.redis.Get(c)\n\t)\n\tdefer conn.Close()\n\tif ok, err = redis.Bool(conn.Do(\"EXPIRE\", keyMid, d.statExpire)); err != nil {\n\t\tlog.Error(\"conn.Do(EXPIRE %s) error(%v)\", keyMid, err)\n\t\treturn\n\t}\n\tif ok {\n\t\tif bs, err = json.Marshal(stat); err != nil {\n\t\t\tlog.Error(\"json.Marshal() error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tif err = conn.Send(\"HSET\", keyMid, pid, bs); err != nil {\n\t\t\tlog.Error(\"conn.Send(HSET,%s,%d) error(%v)\", keyMid, pid, err)\n\t\t\treturn\n\t\t}\n\t\tif err = conn.Send(\"EXPIRE\", keyMid, d.statExpire); err != nil {\n\t\t\tlog.Error(\"conn.Send(EXPIRE,%s) error(%v)\", keyMid, err)\n\t\t\treturn\n\t\t}\n\t\tif err = conn.Send(\"SET\", keyPid, bs); err != nil {\n\t\t\tlog.Error(\"conn.Send(SET,%s,%s) error(%v)\", keyPid, string(bs), err)\n\t\t\treturn\n\t\t}\n\t\tif err = conn.Send(\"EXPIRE\", keyPid, d.plExpire); err != nil {\n\t\t\tlog.Error(\"conn.Send(EXPIRE,%s) error(%v)\", keyPid, err)\n\t\t\treturn\n\t\t}\n\t\tif err = conn.Flush(); err != nil {\n\t\t\tlog.Error(\"add conn.Flush error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tfor i := 0; i < 4; i++ {\n\t\t\tif _, err = conn.Receive(); err != nil {\n\t\t\t\tlog.Error(\"add conn.Receive()%d error(%v)\", i+1, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n\n}", "title": "" }, { "docid": "d972a6c1ad20d5d243fba050761dcfaa", "score": "0.46604282", "text": "func (c *TreeCache) Add(id *plumbing.Hash, tree *gitiles.Tree) error {\n\tif err := c.add(id, tree); err != nil {\n\t\treturn err\n\t}\n\n\tif id.String() != tree.ID {\n\t\t// Ugh: error handling?\n\t\ttreeID, err := parseID(tree.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn c.add(treeID, tree)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4227c1946cdd2aaeb744d87fb4f1785e", "score": "0.46567705", "text": "func (c *msgsCache) get(seq uint64) *pb.MsgProto {\n\tcMsg := c.seqMaps[seq]\n\tif cMsg == nil {\n\t\treturn nil\n\t}\n\t// Bump the expiration\n\tcMsg.expiration = time.Now().UnixNano() + cacheTTL\n\t// If not already at the tail of the list, move it there\n\tif cMsg != c.tail {\n\t\tif cMsg.prev != nil {\n\t\t\tcMsg.prev.next = cMsg.next\n\t\t}\n\t\tif cMsg.next != nil {\n\t\t\tcMsg.next.prev = cMsg.prev\n\t\t}\n\t\tif cMsg == c.head {\n\t\t\tc.head = cMsg.next\n\t\t}\n\t\tcMsg.prev = c.tail\n\t\tc.tail.next = cMsg\n\t\tcMsg.next = nil\n\t\t// Ensure last expiration is at least >= previous one.\n\t\tif cMsg.expiration < c.tail.expiration {\n\t\t\tcMsg.expiration = c.tail.expiration\n\t\t}\n\t\tc.tail = cMsg\n\t}\n\treturn cMsg.msg\n}", "title": "" }, { "docid": "a7a98b36840083c090af77e312034d79", "score": "0.46414927", "text": "func (s *Service) addCache(f func()) {\n\tselect {\n\tcase s.mCh <- f:\n\tdefault:\n\t\tlog.Warn(\"cacheproc chan full\")\n\t}\n}", "title": "" }, { "docid": "a68dfbf5ae3ba83d5f083d99e80a0470", "score": "0.46339926", "text": "func (s *StoreStub) AddMessage(m storage.Message) (id string, err error) {\n\tmb := m.Mailbox()\n\tmsgs := s.mailboxes[mb]\n\ts.mailboxes[mb] = append(msgs, m)\n\treturn m.ID(), nil\n}", "title": "" }, { "docid": "5190415f58c6d3e077e819f0ec6abc98", "score": "0.4631842", "text": "func (r *register) RegisterMsgByID(assignID interface{}, msg interface{}) Meta {\n\tmetaData := r.registerMsgByName(msg)\n\tmetaData.msgID = assignID\n\tr.msgIDInfo[fmt.Sprintf(\"%v\", assignID)] = metaData\n\n\tlog.Debugf(\"register metaData %+v by id: %+v\", metaData, metaData.msgID)\n\treturn metaData\n}", "title": "" }, { "docid": "ea2e70e2be6c617a75b4c73ac96a630b", "score": "0.46293905", "text": "func (d *Dao) AddSortCache(c context.Context, categoryID int64, field int, aid, score int64) (err error) {\n\tvar (\n\t\tkey = sortedKey(categoryID, field)\n\t\tconn = d.redis.Get(c)\n\t)\n\tdefer conn.Close()\n\tif _, err = conn.Do(\"ZADD\", key, \"CH\", score, aid); err != nil {\n\t\tPromError(\"redis:增加排序\b缓存\")\n\t\tlog.Error(\"conn.Do(ZADD, %s, %d, %v) error(%+v)\", key, score, aid, err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "653928ba5b04d57286576886ac8598d3", "score": "0.46270752", "text": "func (m *Message) IncrMsgIdGroup(groupId uint64) (int64, error) {\n\tconn := db.DefaultRedisPool.GetMsgIdPool()\n\tkey := fmt.Sprintf(\"%s_%d\", kRedisKeyGroupMsgId, groupId)\n\treturn conn.Incr(key).Result()\n}", "title": "" }, { "docid": "b40b9b64ef6c16829b548c0c6eb47c1e", "score": "0.46248716", "text": "func addToRemote(gid messaging.GoogleID, teamID messaging.TeamID) error {\n\t// log.Debug(\"add to remote rocks\", \"gid\", gid, \"teamID\", teamID)\n\tt := model.TeamID(teamID)\n\tcid, err := t.RocksKey()\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\n\tif cid == \"\" || gid == \"\" {\n\t\treturn nil\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), holdtime)\n\tdefer cancel()\n\tif err := limiter.Wait(ctx); err != nil {\n\t\tlog.Infow(\"timeout waiting on .rocks rate limiter\", \"GID\", gid)\n\t}\n\n\tc := config.Get().Rocks\n\tclient := &http.Client{\n\t\tTimeout: holdtime,\n\t}\n\tapiurl := fmt.Sprintf(\"%s/%s?key=%s\", c.CommunityEndpoint, gid, cid)\n\t// #nosec\n\tresp, err := client.PostForm(apiurl, url.Values{\"Agent\": {string(gid)}})\n\tif err != nil {\n\t\terr := fmt.Errorf(\"error adding agent to rocks community\")\n\t\tlog.Errorw(err.Error(), \"GID\", gid)\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\trr := rocksPushResponse{}\n\tif err := json.NewDecoder(resp.Body).Decode(&rr); err != nil {\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\n\tif !rr.Success {\n\t\tlog.Errorw(\"unable to add to remote rocks team\", \"teamID\", teamID, \"gid\", gid, \"cid\", cid, \"error\", rr.Error)\n\n\t\t// try to alert the team owner\n\t\towner, _ := t.Owner()\n\t\tmsg := fmt.Sprintf(\"unable to add agent to rocks community for teamID: %s. Check that your community ID and api key are correct.\", teamID)\n\t\tmessaging.SendMessage(messaging.GoogleID(owner), msg)\n\n\t\tif rr.Error == \"Invalid key\" {\n\t\t\tc, _ := t.RocksCommunity()\n\t\t\t_ = t.SetRocks(\"\", c) // unlink\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fc7bded647238ea681260810a7d44df0", "score": "0.4612401", "text": "func (c *MongoChat) AddMessage(message models.Message) (*models.Message, *conf.ApiError) {\n s := c.mongoSession.Clone()\n defer s.Close()\n db := s.DB(c.mongo.DBName)\n\n if !bson.IsObjectIdHex(message.RoomID) {\n return nil, conf.ErrInvalidId\n }\n\n message.ID = bson.NewObjectId().Hex()\n message.Reactions = make(map[string]string)\n message.Timestamp = models.Timestamp(time.Now())\n\n if err := db.C(c.mongo.MessagesCollectionName).Insert(message); err != nil {\n return nil, parseMongoDBError(err)\n }\n return &message, nil\n}", "title": "" }, { "docid": "6c36c2b74161f0697ecf099f76f23633", "score": "0.46076238", "text": "func (p *remotePeerImpl) requestIDNotFoundReceiver(msg p2pcommon.Message, msgBody p2pcommon.MessageBody) bool {\n\treturn true\n}", "title": "" }, { "docid": "aac7e6df52df64bed73fd5d164ab6512", "score": "0.46035424", "text": "func addPeer(msg Message){\n\tmutex.Lock()\n\tPeerIPs[msg.Username]=msg.IP\n\tconn:=createConnection(msg.IP)\n\tConnections[msg.Username]=conn\n\tmutex.Unlock()\n\tlog.Println(msg.Username+\" just joined\")\n}", "title": "" }, { "docid": "44a4199e30302112c04951601b4e330b", "score": "0.45842612", "text": "func cacheAdd(cache *map[string]*objCache, drivePath string, obj interface{}) {\n\titem := &objCache{obj, time.Now()}\n\tm := *cache\n\tm[drivePath] = item\n}", "title": "" }, { "docid": "6cb6c8182af96bcd634f06ec34587830", "score": "0.45840308", "text": "func (c *XConnectConfigurator) putOrUpdateCache(xc *l2.XConnectPairs_XConnectPair, cacheTypeAdd bool) {\n\tif cacheTypeAdd {\n\t\tif _, _, found := c.xcAddCacheIndexes.LookupIdx(xc.ReceiveInterface); found {\n\t\t\tc.xcAddCacheIndexes.UpdateMetadata(xc.ReceiveInterface, xc)\n\t\t\tc.log.Debugf(\"XConnect %s-%s cached (add) medatada updated\", xc.ReceiveInterface, xc.TransmitInterface)\n\t\t} else {\n\t\t\tc.xcAddCacheIndexes.RegisterName(xc.ReceiveInterface, c.xcIndexSeq, xc)\n\t\t\tc.xcIndexSeq++\n\t\t\tc.log.Debugf(\"XConnect %s-%s registered to (add) cache\", xc.ReceiveInterface, xc.TransmitInterface)\n\t\t}\n\t} else {\n\t\tif _, _, found := c.xcDelCacheIndexes.LookupIdx(xc.ReceiveInterface); found {\n\t\t\tc.xcDelCacheIndexes.UpdateMetadata(xc.ReceiveInterface, xc)\n\t\t\tc.log.Debugf(\"XConnect %s-%s cached (del) medatada updated\", xc.ReceiveInterface, xc.TransmitInterface)\n\t\t} else {\n\t\t\tc.xcDelCacheIndexes.RegisterName(xc.ReceiveInterface, c.xcIndexSeq, xc)\n\t\t\tc.xcIndexSeq++\n\t\t\tc.log.Debugf(\"XConnect %s-%s registered to (del) cache\", xc.ReceiveInterface, xc.TransmitInterface)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bf33df74896ce46f9038399631ebd56f", "score": "0.45822415", "text": "func (c *idCache) insert(id ID) bool {\n\tif _, ok := c.ids[id]; ok {\n\t\treturn false\n\t}\n\n\tif _, exists := c.leased[id]; exists {\n\t\treturn false\n\t}\n\n\tc.ids[id] = struct{}{}\n\treturn true\n}", "title": "" }, { "docid": "5dfd16068ddaec008b04b7c5eb45e857", "score": "0.45746368", "text": "func set(conn net.Conn,commands []string,noReply *bool) {\n\n key:= strings.TrimSpace(commands[0])\n exptime,_:= strconv.ParseInt(commands[1],10,32)\n numbytes,_:= strconv.ParseInt(commands[2],10,64) \n lastLived:=time.Now().Add(time.Duration(exptime)*time.Second)\n\n var value string\n if(commands[3]==\"noreply\"){\n *noReply=true\n value= strings.TrimSpace(commands[4])\n } else {\n value= strings.TrimSpace(commands[3])\n }\n unique_version+=1\n\n m_instance:= Memcache{\n value,\n numbytes,\n unique_version,\n exptime,\n lastLived,\n }\n \n mutex.Lock()\n store[key]=m_instance\n mutex.Unlock() \n \n if(!(*noReply)) {\n conn.Write([]byte(\"OK \"+strconv.FormatInt(unique_version,10)+\"\\r\\n\"))\n *noReply=false\n }\n}", "title": "" }, { "docid": "d3ad647cf2d96d22ff78ef54990f53ac", "score": "0.45728454", "text": "func LoadMsgByID(ctx context.Context, db *DB, id *uuid.UUID) (context.Context, *Message, error) {\n\tstmt := fmt.Sprintf(\"SELECT BIN_TO_UUID(secondary_id),BIN_TO_UUID(from_user_id),BIN_TO_UUID(from_client_id),BIN_TO_UUID(to_user_id),BIN_TO_UUID(to_client_id),to_email,data FROM %s WHERE id=UUID_TO_BIN(?)\", dbTableMessage)\n\tctx, row, err := db.QueryRow(ctx, stmt, id)\n\tif err != nil {\n\t\treturn ctx, nil, errors.Wrap(err, \"query row message\")\n\t}\n\n\t//read the row\n\tvar secondaryIDStr string\n\tvar fromUserIDStr sql.NullString\n\tvar fromClientIDStr sql.NullString\n\tvar toUserIDStr sql.NullString\n\tvar toClientIDStr sql.NullString\n\tvar email string\n\tvar dataStr string\n\terr = row.Scan(&secondaryIDStr, &fromUserIDStr, &fromClientIDStr, &toUserIDStr, &toClientIDStr, &email, &dataStr)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn ctx, nil, fmt.Errorf(\"no message: %s\", id)\n\t\t}\n\t\treturn ctx, nil, errors.Wrap(err, \"select message\")\n\t}\n\n\t//parse the uuid\n\tsecondaryID, err := uuid.FromString(secondaryIDStr)\n\tif err != nil {\n\t\treturn ctx, nil, errors.Wrap(err, \"parse uuid message secondary id\")\n\t}\n\tvar fromUserID *uuid.UUID\n\tif fromUserIDStr.Valid {\n\t\tid, err := uuid.FromString(fromUserIDStr.String)\n\t\tif err != nil {\n\t\t\treturn ctx, nil, errors.Wrap(err, \"parse uuid message from user id\")\n\t\t}\n\t\tfromUserID = &id\n\t}\n\tvar fromClientID *uuid.UUID\n\tif fromClientIDStr.Valid {\n\t\tid, err := uuid.FromString(fromClientIDStr.String)\n\t\tif err != nil {\n\t\t\treturn ctx, nil, errors.Wrap(err, \"parse uuid message from client id\")\n\t\t}\n\t\tfromClientID = &id\n\t}\n\tvar toUserID *uuid.UUID\n\tif toUserIDStr.Valid {\n\t\tid, err := uuid.FromString(toUserIDStr.String)\n\t\tif err != nil {\n\t\t\treturn ctx, nil, errors.Wrap(err, \"parse uuid message to user id\")\n\t\t}\n\t\ttoUserID = &id\n\t}\n\tvar toClientID *uuid.UUID\n\tif toClientIDStr.Valid {\n\t\tid, err := uuid.FromString(toClientIDStr.String)\n\t\tif err != nil {\n\t\t\treturn ctx, nil, errors.Wrap(err, \"parse uuid message to client id\")\n\t\t}\n\t\ttoClientID = &id\n\t}\n\n\t//unmarshal the data\n\tvar msg Message\n\terr = json.Unmarshal([]byte(dataStr), &msg)\n\tif err != nil {\n\t\treturn ctx, nil, errors.Wrap(err, \"unjson message\")\n\t}\n\tmsg.ID = id\n\tmsg.SecondaryID = &secondaryID\n\tmsg.FromUserID = fromUserID\n\tmsg.FromClientID = fromClientID\n\tmsg.ToUserID = toUserID\n\tmsg.ToClientID = toClientID\n\tmsg.ToEmail = email\n\treturn ctx, &msg, nil\n}", "title": "" }, { "docid": "d176aabdaa555c0b8bde0c128e78c216", "score": "0.45674017", "text": "func lisp_lml_add_entry(mc *Lisp_map_cache) {\n\n\t//\n\t// The EID-prefix slot in the array of hash-tables is based on its\n\t// prefix mask-length. Allocate memory for hash-table if this is the\n\t// first entry for the mask-length.\n\t//\n\tht := lisp_lml_cache[mc.eid_prefix.mask_len]\n\tif (ht == nil) {\n\t\tht = new(Lisp_hash_table)\n\t\tlisp_lml_cache[mc.eid_prefix.mask_len] = ht\n\t}\n\n\t//\n\t// Hash the address to get a hash-table slot between the values of 0 and\n\t// 255. Insert at slot by \"pushing down\" all othe entries.\n\t//\n\thash := lisp_lml_hash(mc.eid_prefix.address, mc.eid_prefix.mask_len)\n\tmc.next_mc = ht.hash_table[hash]\n\tht.hash_table[hash] = mc\n\tht.ht_count += 1\n}", "title": "" }, { "docid": "3a69995aab38cfe3d51c9502c87a963f", "score": "0.45627287", "text": "func (trb *RingBuffer) Add(title string, body []byte) {\n\tif len(trb.msgs) <= 0 {\n\t\treturn\n\t}\n\n\tmsg := &Msg{\n\t\tTitle: title,\n\t\tBody: body,\n\t\tRepeats: 1,\n\t}\n\n\ttrb.m.Lock()\n\n\tif trb.consolidateFunc != nil {\n\t\tmsg = trb.consolidateFunc(msg, trb.lastUNLOCKED())\n\t\tif msg == nil {\n\t\t\ttrb.m.Unlock()\n\n\t\t\treturn\n\t\t}\n\t}\n\n\ttrb.msgs[trb.next] = *msg\n\n\ttrb.next++\n\tif trb.next >= len(trb.msgs) {\n\t\ttrb.next = 0\n\t}\n\n\ttrb.m.Unlock()\n}", "title": "" }, { "docid": "47e91f9ce72f334bd5ea5cf62459745f", "score": "0.45549303", "text": "func (c *cache) Add(k string, x interface{}, d time.Duration, rd time.Duration) error {\n\tc.storage.Lock()\n\t_, found := c.get(k)\n\tif found {\n\t\tc.storage.Unlock()\n\t\treturn fmt.Errorf(\"Item %s already exists\", k)\n\t}\n\tc.set(k, x, d, rd)\n\tc.storage.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "459dc46644406e1a76860b576e3a182d", "score": "0.45544383", "text": "func (ms *FileMsgStore) lookup(seq uint64) (*pb.MsgProto, error) {\n\t// Reject message for sequence outside valid range\n\tif seq < ms.first || seq > ms.last {\n\t\treturn nil, nil\n\t}\n\t// Check first if it's in the cache.\n\tmsg := ms.cache.get(seq)\n\tif msg == nil && ms.bufferedMsgs != nil {\n\t\t// Possibly in bufferedMsgs\n\t\tbm := ms.bufferedMsgs[seq]\n\t\tif bm != nil {\n\t\t\tmsg = bm.msg\n\t\t\tms.cache.add(seq, msg, false, false)\n\t\t}\n\t}\n\t// If not, we need to read it from disk...\n\tif msg == nil {\n\t\tfslice := ms.getFileSliceForSeq(seq)\n\t\tif fslice == nil {\n\t\t\treturn nil, nil\n\t\t}\n\t\terr := ms.lockFiles(fslice)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif ms.readBufSize > 0 && seq != fslice.lastSeq {\n\t\t\tmsg, err = ms.readAheadMsgs(fslice, seq)\n\t\t\tif err == nil {\n\t\t\t\tms.unlockFiles(fslice)\n\t\t\t\treturn msg, err\n\t\t\t}\n\t\t}\n\t\tmsgIndex, err := ms.readMsgIndex(fslice, seq)\n\t\tif msgIndex != nil {\n\t\t\tfile := fslice.file.handle\n\t\t\t// Position file to message's offset. 0 means from start.\n\t\t\t_, err = file.Seek(msgIndex.offset, io.SeekStart)\n\t\t\tif err == nil {\n\t\t\t\tms.tmpMsgBuf, err = ms.readMsgRecord(file, ms.tmpMsgBuf, msgIndex.msgSize)\n\t\t\t}\n\t\t}\n\t\tms.unlockFiles(fslice)\n\t\tif err != nil || msgIndex == nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Recover this message\n\t\tmsg = &pb.MsgProto{}\n\t\terr = msg.Unmarshal(ms.tmpMsgBuf[recordHeaderSize : recordHeaderSize+msgIndex.msgSize])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tms.cache.add(seq, msg, false, false)\n\t}\n\treturn msg, nil\n}", "title": "" }, { "docid": "128cc8d0bc27a6b00316b6b7a69059f5", "score": "0.45520276", "text": "func (bn *BufferNode) bufferMsg(msg Msg) {\n\tmsg.SetRecvId(bn.msgsProcessed)\n\tbn.msgsProcessed++\n\tbn.msgsBuffered++\n\tbn.msgs[msg.Priority()].PushBack(msg)\n}", "title": "" }, { "docid": "e0d50c7dac034eefbe8a4d113bef0daa", "score": "0.4550775", "text": "func AddToErrorQueue(killID int32, message string, source string, client *redis.Client) {\n\tmsg := types.ErrorMessage{\n\t\tKillID: killID,\n\t\tMessage: message,\n\t\tSourceQueue: source,\n\t}\n\n\tbt, err := json.Marshal(msg)\n\tif err != nil {\n\t\tlog.Fatal(errors.Wrap(err, fmt.Sprintf(\"Failed to add to error queue: %d\", killID)))\n\t}\n\n\tclient.RPush(errored, string(bt))\n}", "title": "" }, { "docid": "a014bbccb62d9e500a29aa874c35f987", "score": "0.4548078", "text": "func (c *Client) PublishCache(key string, message *dns.Msg) {\n\tif len(key) > 0 && message != nil {\n\t\tc.sendBuffer <- &bufferMessage{\n\t\t\tKey: key,\n\t\t\tMessage: message,\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7ca698e11fda26f4ed92205ca7933418", "score": "0.454743", "text": "func AddToCache (c appengine.Context, key string, elem interface {}) {\n\n\titem := &memcache.Item {\n\t\tKey : key,\n\t\tObject : elem,\n\t}\n\tmemcache.Gob.Set (c, item)\n\tc.Infof (\"Added element with key\" + key, elem)\n}", "title": "" }, { "docid": "8a536652bfbbd4bd03c17f7bd48164fc", "score": "0.45470724", "text": "func (mab *memoryAddrBook) Addrs(t thread.ID, p peer.ID) ([]ma.Multiaddr, error) {\n\tvar (\n\t\taddrExpired bool\n\t\tgood = make([]ma.Multiaddr, 0)\n\t)\n\tmab.segments.processAddrs(t, p, false, false, func(amap map[string]*expiringAddr) {\n\t\tnow := time.Now()\n\t\tfor _, m := range amap {\n\t\t\tif !m.ExpiredBy(now) {\n\t\t\t\tgood = append(good, m.Addr)\n\t\t\t} else {\n\t\t\t\taddrExpired = true\n\t\t\t}\n\t\t}\n\t})\n\tif addrExpired {\n\t\tgo mab.segments.updateEdge(t)\n\t}\n\treturn good, nil\n}", "title": "" }, { "docid": "f2f7083114b26be479904c060af26d93", "score": "0.45426616", "text": "func (n *NotificationsMap) Add(notifyID string, objectRegEx *regexp.Regexp) string {\n\tn.mutex.Lock()\n\tdefer n.mutex.Unlock()\n\n\t// If no regex was provided we add a single entry.\n\tregexStr := \"\"\n\tif objectRegEx != nil {\n\t\tregexStr = objectRegEx.String()\n\t}\n\tif _, ok := n.notifications[notifyID]; !ok {\n\t\tn.notifications[notifyID] = map[string]*regexp.Regexp{}\n\t}\n\tn.notifications[notifyID][regexStr] = objectRegEx\n\treturn getChannelID(notifyID, objectRegEx)\n}", "title": "" }, { "docid": "b054d081865ed82cb90bb5c78dc942b6", "score": "0.45372775", "text": "func (session *session) checkCache(message []byte) (int, []byte) {\n\tif len(session.responseCache.response) == 0 ||\n\t\tsession.responseCache.sessionStatus != session.status ||\n\t\tsession.lastActive.Before(time.Now().Add(-retryTimeLimit)) ||\n\t\tsha256.Sum256(session.responseCache.message) != sha256.Sum256(message) {\n\t\tsession.responseCache = responseCache{}\n\t\treturn 0, nil\n\t}\n\treturn session.responseCache.status, session.responseCache.response\n}", "title": "" }, { "docid": "1baa69db318f355f42da6b22c22512f6", "score": "0.4537224", "text": "func (cc *Cache) AddIPAddressToCache(data *datamappings.CachedGeolocation) {\n\tcc.geolocationsMutex.Lock()\n\tcc.geolocations[data.IPAddress] = data\n\tcc.geolocationsMutex.Unlock()\n}", "title": "" }, { "docid": "cfb2efe45bc7d49057babc0fff663942", "score": "0.45338702", "text": "func (d *Dao) AddCache(c context.Context, mid, aid, now int64) error {\n\treturn d.addCache(c, key(mid), []*model.ToView{&model.ToView{Aid: aid, Unix: now}})\n}", "title": "" }, { "docid": "c4c3154e52674c4533a14f634b272c6c", "score": "0.4528272", "text": "func (r *RrdpParseQueue) AddRrdpUrl(url string, dest string) {\n\n\tr.rrdpAddedUrlsMutex.Lock()\n\tdefer r.rrdpAddedUrlsMutex.Unlock()\n\tdefer func() {\n\t\tbelogs.Debug(\"AddRrdpUrl():defer rpQueue.RrdpingParsingCount:\", atomic.LoadInt64(&r.RrdpingParsingCount))\n\t\tif atomic.LoadInt64(&r.RrdpingParsingCount) == 0 {\n\t\t\tr.RrdpParseEndChan <- RrdpParseEndChan{}\n\t\t}\n\t}()\n\tbelogs.Debug(\"AddRrdpUrl():url:\", url, \" dest:\", dest)\n\tif len(url) == 0 || len(dest) == 0 {\n\t\tbelogs.Error(\"AddRrdpUrl():len(url) == 0 || len(dest) == 0, before RrdpingParsingCount-1:\", atomic.LoadInt64(&r.RrdpingParsingCount))\n\t\tatomic.AddInt64(&r.RrdpingParsingCount, -1)\n\t\tbelogs.Debug(\"AddRrdpUrl():len(url) == 0 || len(dest) == 0, after RrdpingParsingCount-1:\", atomic.LoadInt64(&r.RrdpingParsingCount))\n\t\treturn\n\t}\n\tif strings.HasPrefix(url, \"https://localhost\") || strings.HasPrefix(url, \"https://127.0.0.1\") {\n\t\tbelogs.Error(\"AddRrdpUrl():url is localhost:\", url)\n\t\tbelogs.Debug(\"AddRrdpUrl():url is localhost, before RrdpingParsingCount-1:\", atomic.LoadInt64(&r.RrdpingParsingCount))\n\t\tatomic.AddInt64(&r.RrdpingParsingCount, -1)\n\t\tbelogs.Debug(\"AddRrdpUrl()::url is localhost, after RrdpingParsingCount-1:\", atomic.LoadInt64(&r.RrdpingParsingCount))\n\t\treturn\n\t}\n\te := r.rrdpAddedUrls.Front()\n\tfor e != nil {\n\t\tif strings.Contains(url, e.Value.(RrdpModelChan).Url) {\n\t\t\tbelogs.Debug(\"AddRrdpUrl():have existed:\", url, \" in \", e.Value.(RrdpModelChan).Url,\n\t\t\t\t\" len(r.RrdpModelChan):\", len(r.RrdpModelChan))\n\t\t\tbelogs.Debug(\"AddRrdpUrl():have existed, before RrdpingParsingCount-1:\", atomic.LoadInt64(&r.RrdpingParsingCount))\n\t\t\tatomic.AddInt64(&r.RrdpingParsingCount, -1)\n\t\t\tbelogs.Debug(\"AddRrdpUrl():have existed, after RrdpingParsingCount-1:\", atomic.LoadInt64(&r.RrdpingParsingCount))\n\t\t\treturn\n\t\t}\n\t\te = e.Next()\n\t}\n\n\trrdpModelChan := RrdpModelChan{Url: url, Dest: dest}\n\te = r.rrdpAddedUrls.PushBack(rrdpModelChan)\n\tbelogs.Debug(\"AddRrdpUrl():will send to rrdpModelChan:\", rrdpModelChan,\n\t\t\" len(r.RrdpModelChan):\", len(r.RrdpModelChan), \" len(rrdpAddedUrls):\", r.rrdpAddedUrls.Len())\n\tr.RrdpModelChan <- rrdpModelChan\n\tbelogs.Debug(\"AddRrdpUrl():after send to rrdpModelChan:\", rrdpModelChan,\n\t\t\" len(r.RrdpModelChan):\", len(r.RrdpModelChan), \" len(rrdpAddedUrls):\", r.rrdpAddedUrls.Len())\n\treturn\n}", "title": "" }, { "docid": "7c11e5ba0c4a7e072b7ab7b38d736bd6", "score": "0.45248008", "text": "func (c *DNSCache) Add(host, addr string) error {\n\treturn c.cache.Add(host, addr, 10*time.Minute)\n}", "title": "" }, { "docid": "f0a316b615623f367a9f217a652fd78a", "score": "0.45228297", "text": "func messageLocal(pack settings.PackageTCP, message string) {\n settings.Mutex.Lock()\n _, err := settings.DataBase.Exec(\n \"INSERT INTO Local\" + pack.From.Name + \" (User, Body) VALUES ($1, $2)\",\n pack.From.Name, \n crypto.Encrypt(settings.User.Password, message),\n )\n settings.Messages.CurrentIdLocal[pack.From.Name]++\n settings.Mutex.Unlock()\n utils.CheckError(err)\n go func() {\n settings.Messages.NewDataExistLocal[pack.From.Name] <- true\n }()\n}", "title": "" }, { "docid": "b4e519b8e46b909c57438ddc468cb45a", "score": "0.4521303", "text": "func (r *register) RegisterMsg(msg interface{}) (meta Meta) {\n\tm := r.registerMsgByName(msg)\n\tr.msgIDInfo[m.msgName] = m\n\treturn m\n}", "title": "" }, { "docid": "46a747ad9ada5a8cd72c7833c35b8161", "score": "0.45150226", "text": "func (d *Dao) AddCacheLessTime(c context.Context, val int64) (err error) {\n\tconn := d.mc.Get(c)\n\tdefer conn.Close()\n\tkey := lessTimeKey()\n\tbs := []byte(strconv.FormatInt(int64(val), 10))\n\titem := &memcache.Item{Key: key, Value: bs, Expiration: d.lessTimeExpire, Flags: memcache.FlagRAW}\n\tif err = conn.Set(item); err != nil {\n\t\tprom.BusinessErrCount.Incr(\"mc:AddCacheLessTime\")\n\t\tlog.Errorv(c, log.KV(\"AddCacheLessTime\", fmt.Sprintf(\"%+v\", err)), log.KV(\"key\", key))\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "ced18ea76f50dee9d1e51b2197172e40", "score": "0.4513921", "text": "func (d *Dao) AddCacheInfo(c context.Context, mid int64, v *v1.Info) (err error) {\n\titem := &mc.Item{\n\t\tKey: keyInfo(mid),\n\t\tObject: v,\n\t\tFlags: mc.FlagProtobuf,\n\t\tExpiration: d.mcExpire,\n\t}\n\tconn := d.mc.Get(c)\n\terr = conn.Set(item)\n\tconn.Close()\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"dao add info cache\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "1c9e893aa54e80e9374602c5fe2dfce0", "score": "0.45138443", "text": "func (d *Dao) AddCachePromoOrder(c context.Context, orderID int64, promoOrder *model.PromotionOrder) (err error) {\n\tvar (\n\t\tdata []byte\n\t\tkey = keyPromoOrder(orderID)\n\t)\n\n\tconn := d.redis.Get(c)\n\tdefer conn.Close()\n\n\tif data, err = json.Marshal(promoOrder); err != nil {\n\t\treturn\n\t}\n\n\tconn.Do(\"SET\", key, data, \"EX\", model.RedisExpirePromoOrder)\n\treturn\n}", "title": "" }, { "docid": "0809b959b731af0bb1cc03cc0c4e069b", "score": "0.4510966", "text": "func (_MessageTester *MessageTesterCaller) AddMessageToVMInboxHash(opts *bind.CallOpts, inboxTuplePreimage [32]byte, inboxTupleSize *big.Int, blockNumber *big.Int, timestamp *big.Int, txId *big.Int, messageTuplePreimage [32]byte, messageTupleSize *big.Int) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _MessageTester.contract.Call(opts, out, \"addMessageToVMInboxHash\", inboxTuplePreimage, inboxTupleSize, blockNumber, timestamp, txId, messageTuplePreimage, messageTupleSize)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "0d1396bf4f6d5caa959e97f1a97e8b6d", "score": "0.4510464", "text": "func PushToQueueCache(songList *QueueMessage) {\n\tif len(QueueMessageCache) > 5 {\n\t\tQueueMessageCache = QueueMessageCache[1:]\n\t\tQueueMessageCache = append(QueueMessageCache, songList)\n\t\treturn\n\t}\n\tQueueMessageCache = append(QueueMessageCache, songList)\n}", "title": "" }, { "docid": "373fd4865e4f7d1e1b77783b0f293191", "score": "0.45015258", "text": "func (srv *Server) populateCaches(msgs []*Message) {\n\tvar (\n\t\tn int\n\t\tinserted bool\n\t\tisLocal = true\n\t)\n\n\tfor x := 0; x < len(msgs); x++ {\n\t\tan := newAnswer(msgs[x], isLocal)\n\t\tinserted = srv.caches.upsert(an)\n\t\tif inserted {\n\t\t\tn++\n\t\t}\n\t\tmsgs[x] = nil\n\t}\n\n\tfmt.Printf(\"dns: %d out of %d records cached\\n\", n, len(msgs))\n}", "title": "" }, { "docid": "42aba04072c8e2b48a2b5f53fc48a38f", "score": "0.4493081", "text": "func (manager *Manager) addToFetched(link string) {\n\t// log.Println(\"addToFetched\", link)\n\tlink = strings.TrimSpace(link)\n\n\t// add to fetched set\n\tmanager.urlFetchedLock.Lock()\n\tdefer manager.urlFetchedLock.Unlock()\n\tif _, ok := manager.urlFetched[link]; ok == true {\n\t\treturn\n\t}\n\tmanager.urlFetched[link] = true\n\n\tmanager.distinctPagesFetched++\n\tif manager.distinctPagesFetched >= conf.System.MaxDistinctPagesToFetchPerSite {\n\t\t// TODO: end go routine\n\t}\n\n\t// if in InQueue map, move it from there to fetched\n\tmanager.urlInQueueLock.Lock()\n\tdefer manager.urlInQueueLock.Unlock()\n\tif _, ok := manager.urlInQueue[link]; ok == true {\n\t\t// remove from InQueue\n\t\tdelete(manager.urlInQueue, link)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "0f9a460fbeec29d447dbec5a051bf1b8", "score": "0.4491073", "text": "func (_MessageTester *MessageTesterCaller) AddMessageToInbox(opts *bind.CallOpts, inboxHash [32]byte, messageHash [32]byte, blockNumber *big.Int, timestamp *big.Int, messageNum *big.Int) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _MessageTester.contract.Call(opts, out, \"addMessageToInbox\", inboxHash, messageHash, blockNumber, timestamp, messageNum)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "3d1580389cc2ea0711948de8612002f9", "score": "0.44847858", "text": "func (mem *Mempool) AddTx(peerID string, tx types.Tx) (err error) {\n\t// CACHE\n\tif !mem.cache.Push(tx) {\n\t\treturn types.ErrTxDuplicate\n\t}\n\t// END CACHE\n\n\tif _, exist := canAddTxType[tx.TypeName()]; !exist {\n\t\tmem.cache.Remove(tx)\n\t\treturn types.ErrParams\n\t}\n\n\tif err = mem.app.CheckTx(tx, BasicCheck); err != nil {\n\t\tmem.cache.Remove(tx)\n\t\treturn\n\t}\n\n\tvar from common.Address\n\tif from, err = tx.From(); err != nil {\n\t\tmem.cache.Remove(tx)\n\t\treturn\n\t}\n\tmem.cache.SetTxFrom(tx.Hash(), &from)\n\n\tmem.proxyMtx.Lock()\n\tdefer mem.proxyMtx.Unlock()\n\n\tswitch tx.(type) {\n\tcase *types.UTXOTransaction:\n\t\terr = mem.addUTXOTx(tx)\n\tcase *types.Transaction, *types.TokenTransaction, *types.ContractCreateTx, *types.ContractUpgradeTx:\n\t\terr = mem.addLocalTx(tx)\n\tcase *types.MultiSignAccountTx:\n\t\terr = mem.addLocalSpecTx(tx)\n\tdefault:\n\t\tmem.logger.Error(\"AddTx fail,Invaild tx type\")\n\t\tmem.cache.Remove(tx)\n\t\treturn types.ErrParams\n\t}\n\n\tif err != nil {\n\t\tmem.cache.Remove(tx)\n\t} else if mem.config.Broadcast {\n\t\tselect {\n\t\tcase mem.broadcastTxChan <- &RecieveMessage{PeerID: peerID, Tx: tx}:\n\t\tdefault:\n\t\t\tmem.logger.Info(\"broadcastTxChan is full\", \"size\", mem.config.BroadcastChanSize, \"hash\", tx.Hash().Hex())\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "920cf3d664dc5daaefb0a06be4ec415c", "score": "0.44839385", "text": "func (memory *InMemory) Store(m *data.Message) (string, error) {\n\tmemory.Messages[string(m.ID)] = m\n\tmemory.MessageIndex = append(memory.MessageIndex, string(m.ID))\n\tmemory.MessageRIndex[string(m.ID)] = len(memory.MessageIndex) - 1\n\treturn string(m.ID), nil\n}", "title": "" }, { "docid": "cf12ac8921a7cf5961ea3f2bebc206a2", "score": "0.44824746", "text": "func (p *PushState) FetchMsgs(msgID uint64) []*pubtypes.ChatMessage {\n\tpushedMsgID := p.pushedMsgID\n\n\tif pushedMsgID == 0 {\n\t\t// 初始状态, 等待一会儿,防止#n+m比#n先到的情况, 会错过m条消息\n\t\ttime.Sleep(10 * time.Millisecond)\n\t\t// 选择所有缓存消息中最小id的确定pushedMsgID\n\t\tpushedMsgID = msgID - 1\n\t\tif len(p.msgs) > 1 {\n\t\t\tfor _, msg := range p.msgs {\n\t\t\t\tif msg.ID <= pushedMsgID {\n\t\t\t\t\tpushedMsgID = msg.ID - 1\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tp.RLock()\n\tcount := 0\n\tmsgCount := int(msgID - pushedMsgID)\n\tmsgs := make([]*pubtypes.ChatMessage, msgCount)\n\tfor _, msg := range p.msgs {\n\t\tif msg.ID <= msgID {\n\t\t\tidx := msg.ID - pushedMsgID - 1\n\t\t\tif msgs[idx] == nil {\n\t\t\t\tmsgs[idx] = msg\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\t}\n\tdefer p.RUnlock()\n\n\tif count < msgCount {\n\t\tmissedIDs := []uint64{}\n\t\tfor i, msg := range msgs {\n\t\t\tif msg == nil {\n\t\t\t\tmissedIDs = append(missedIDs, uint64(i)+pushedMsgID+1)\n\t\t\t}\n\t\t}\n\n\t\tmissedMsgs := []pubtypes.ChatMessage{}\n\t\targs := &types.FetchChatMessagesByIDsArgs{\n\t\t\tChatID: p.chatID,\n\t\t\tChatType: p.chatType,\n\t\t\tMsgIDs: missedIDs,\n\t\t}\n\t\tif err := xchatLogic.Call(types.RPCXChatFetchChatMessagesByIDs, args, &missedMsgs); err != nil {\n\t\t\tl.Warning(\"fetch chat[%d] messages by ids error: %+v, %s\", p.chatID, args, err.Error())\n\t\t}\n\t\tfor i := range missedMsgs {\n\t\t\tmsg := &missedMsgs[i]\n\t\t\tmsgs[msg.ID-pushedMsgID-1] = msg\n\t\t}\n\t}\n\n\treturn msgs\n}", "title": "" }, { "docid": "9818b3e8a1e877db283f341ccc82d611", "score": "0.4482159", "text": "func messageGlobal(pack settings.PackageTCP, message string) {\n settings.Mutex.Lock()\n _, err := settings.DataBase.Exec(\n \"INSERT INTO GlobalMessages (User, Body) VALUES ($1, $2)\",\n pack.From.Name, \n crypto.Encrypt(settings.User.Password, message),\n )\n settings.Messages.CurrentIdGlobal++\n settings.Mutex.Unlock()\n utils.CheckError(err)\n go func() {\n settings.Messages.NewDataExistGlobal <- true\n }()\n}", "title": "" }, { "docid": "0e1058475b10fdf346a20efe5a2877b7", "score": "0.44770697", "text": "func (d *Dao) AddRegionArcCache(c context.Context, rid, reid int16, as ...*api.RegionArc) (err error) {\n\tvar (\n\t\tkey = rgAllKey(rid)\n\t\tokey = rgOriginKey(rid)\n\t\ttpKey = rgTopKey(reid)\n\t\tcount int\n\t\tconn = d.rgRds.Get(c)\n\t)\n\tdefer conn.Close()\n\tdefer func() {\n\t\tif err != nil {\n\t\t\td.errProm.Incr(\"regin_redis\")\n\t\t}\n\t}()\n\tfor _, a := range as {\n\t\tif !a.AllowShow() {\n\t\t\tcontinue\n\t\t}\n\t\tif err = conn.Send(\"ZADD\", tpKey, a.PubDate, a.Aid); err != nil {\n\t\t\tlog.Error(\"conn.Send(ZADD, %s, %d, %d) error(%v)\")\n\t\t\treturn\n\t\t}\n\t\tcount++\n\t\tif err = conn.Send(\"ZREMRANGEBYSCORE\", tpKey, \"-inf\", time.Now().Add(-time.Duration(topTypeExpire)).Unix()); err != nil {\n\t\t\tlog.Error(\"conn.Send(ZREMRANGEBYSCORE, %s, %d, %d) error(%v)\", tpKey)\n\t\t\treturn\n\t\t}\n\t\tcount++\n\t\tif err = conn.Send(\"ZADD\", key, a.PubDate, a.Aid); err != nil {\n\t\t\tlog.Error(\"conn.Send(ZADD, %s, %d) error(%v)\", key, a.Aid, err)\n\t\t\treturn\n\t\t}\n\t\tcount++\n\t\tif a.Copyright == commarc.CopyrightOriginal {\n\t\t\tif err = conn.Send(\"ZADD\", okey, a.PubDate, a.Aid); err != nil {\n\t\t\t\tlog.Error(\"conn.Send(ZADD, %s, %d) error(%v)\", okey, a.Aid, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcount++\n\t\t}\n\t\t// 连载动画不记录\n\t\tif rid != 33 {\n\t\t\tif err = conn.Send(\"ZADD\", _allTypeKey, a.PubDate, a.Aid); err != nil {\n\t\t\t\tlog.Error(\"conn.Send(ZADD, %s, %d, %d) error(%v)\", _allTypeKey, a.PubDate, a.Aid, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcount++\n\t\t\tif err = conn.Send(\"ZREMRANGEBYSCORE\", _allTypeKey, \"-inf\", time.Now().Add(-time.Duration(allTypeExpire)).Unix()); err != nil {\n\t\t\t\tlog.Error(\"conn.Send()\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcount++\n\t\t}\n\t}\n\tif count == 0 {\n\t\treturn\n\t}\n\tif err = conn.Flush(); err != nil {\n\t\tlog.Error(\"conn.Flush error(%v)\", err)\n\t\treturn\n\t}\n\tfor i := 0; i < count; i++ {\n\t\tif _, err = conn.Receive(); err != nil {\n\t\t\tlog.Error(\"conn.Receive() error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "fa218bc39d96affee932e9cdce768792", "score": "0.44734064", "text": "func convertMessage(message *redisMessage, ttl time.Duration) (*CacheMessage, error) {\n\tmsg := dns.Msg{}\n\n\terr := msg.Unpack(message.Message)\n\tif err == nil {\n\t\tif ttl > 0 {\n\t\t\tfor _, a := range msg.Answer {\n\t\t\t\ta.Header().Ttl = uint32(ttl.Seconds())\n\t\t\t}\n\t\t}\n\n\t\tres := &CacheMessage{\n\t\t\tKey: message.Key,\n\t\t\tResponse: &model.Response{\n\t\t\t\tRType: model.ResponseTypeCACHED,\n\t\t\t\tReason: cacheReason,\n\t\t\t\tRes: &msg,\n\t\t\t},\n\t\t}\n\n\t\treturn res, nil\n\t}\n\n\treturn nil, err\n}", "title": "" }, { "docid": "26a5d8657e90f87ed772299b6dec218c", "score": "0.44620863", "text": "func (ac *_dbCache) add(name string, al *alias) (added bool) {\n\tac.mux.Lock()\n\tdefer ac.mux.Unlock()\n\tif _, ok := ac.cache[name]; !ok {\n\t\tac.cache[name] = al\n\t\tadded = true\n\t}\n\treturn\n}", "title": "" }, { "docid": "e37c45cc9f5d40e0dd22762232e83e13", "score": "0.4459603", "text": "func (rsc *ReplicaSetCache) Add(rs *appsv1.ReplicaSet) {\n\t// check if any replicaset exist in this replicaset namespace yet\n\tif _, exists := rsc.namespaceRsUIDCache[rs.Namespace]; !exists {\n\t\trsc.namespaceRsUIDCache[rs.Namespace] = make(map[types.UID]bool)\n\t}\n\trsc.cachedReplicaSets[rs.UID] = newCachedReplicaSet(rs)\n\trsc.namespaceRsUIDCache[rs.Namespace][rs.UID] = true\n}", "title": "" }, { "docid": "18c82549a9210b74aa7d9650749cce00", "score": "0.44531548", "text": "func (l *Local) SendMessage(message []byte) error {\n\tvar id string\n\tl.messagesMutex.Lock()\n\t// make sure id is truly unique; usually this loop should always finish\n\t// after the first iteration, but better to be safe than sorry\n\tfor {\n\t\tid = uuid.NewV4().String()\n\t\tif _, ok := l.messages[id]; !ok {\n\t\t\tbreak\n\t\t}\n\t}\n\tl.messages[id] = message\n\tl.messagesMutex.Unlock()\n\tl.queueMutex.Lock()\n\tl.queue = append(l.queue, id)\n\tl.queueMutex.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "310836734e7f4e26d6e32166d6fe22df", "score": "0.44481587", "text": "func (ro *readOnly) addRequest(index uint64, m pb.Message) {\n\ts := string(m.Entries[0].Data)\n\tif _, ok := ro.pendingReadIndex[s]; ok {\n\t\treturn\n\t}\n\tro.pendingReadIndex[s] = &readIndexStatus{index: index, req: m, acks: make(map[uint64]bool)}\n\tro.readIndexQueue = append(ro.readIndexQueue, s)\n}", "title": "" } ]
7714801d9512d1cde822021d796ab323
ClearServiceType clears the "service_type" edge to type ServiceType.
[ { "docid": "46db30f79ce4b15bdf75a051eca1fd62", "score": "0.7601799", "text": "func (ptu *PropertyTypeUpdate) ClearServiceType() *PropertyTypeUpdate {\n\tptu.mutation.ClearServiceType()\n\treturn ptu\n}", "title": "" } ]
[ { "docid": "e436860a24d0a69eccccd91795e63f28", "score": "0.7728825", "text": "func (m *ServiceEndpointDefinitionMutation) ClearServiceType() {\n\tm.clearedservice_type = true\n}", "title": "" }, { "docid": "454d9b0f06f056272c35e4c4801284b5", "score": "0.7694178", "text": "func (ptuo *PropertyTypeUpdateOne) ClearServiceType() *PropertyTypeUpdateOne {\n\tptuo.mutation.ClearServiceType()\n\treturn ptuo\n}", "title": "" }, { "docid": "87ca149fcb0b6e143bce4a71c6144557", "score": "0.7570515", "text": "func (m *PropertyTypeMutation) ClearServiceType() {\n\tm.clearedservice_type = true\n}", "title": "" }, { "docid": "030dd9ce307180cca5a8dc28e86f6b59", "score": "0.73615015", "text": "func (m *ServiceEndpointDefinitionMutation) ResetServiceType() {\n\tm.service_type = nil\n\tm.clearedservice_type = false\n}", "title": "" }, { "docid": "36afa35d79dc2ea508691e9fbc1ff616", "score": "0.71538025", "text": "func (m *PropertyTypeMutation) ResetServiceType() {\n\tm.service_type = nil\n\tm.clearedservice_type = false\n}", "title": "" }, { "docid": "ce6eba0c91aa85ea132660637909952b", "score": "0.70926636", "text": "func (meshData *MeshData) RemoveServiceType(serviceType *ServiceType) {\n\tfor idx, svcTypeExisting := range meshData.ServiceTypes {\n\t\tif strings.EqualFold(svcTypeExisting.Name, serviceType.Name) { // Remove the service type by its name\n\t\t\tlastIdx := len(meshData.ServiceTypes) - 1\n\t\t\tmeshData.ServiceTypes[idx] = meshData.ServiceTypes[lastIdx]\n\t\t\tmeshData.ServiceTypes[lastIdx] = nil\n\t\t\tmeshData.ServiceTypes = meshData.ServiceTypes[:lastIdx]\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "936f68260adf451966542766fab2ecf5", "score": "0.68092215", "text": "func (m *ServiceTypeMutation) ClearServices() {\n\tm.clearedservices = true\n}", "title": "" }, { "docid": "04db7ad2ff47ffd598c2ee9f024a6353", "score": "0.6534006", "text": "func (m *ServiceTypeMutation) ResetServices() {\n\tm.services = nil\n\tm.clearedservices = false\n\tm.removedservices = nil\n}", "title": "" }, { "docid": "a2f7932ee76bf2a67099265ce482d90d", "score": "0.64726603", "text": "func (m *ServiceTypeMutation) ClearPropertyTypes() {\n\tm.clearedproperty_types = true\n}", "title": "" }, { "docid": "2c6f46ef5f5ef19a638e76e0978b6a48", "score": "0.63129306", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NssaExternalLsa) DeleteTypeOfService(Tos uint8) {\n\tkey := Tos\n\n\tdelete(t.TypeOfService, key)\n}", "title": "" }, { "docid": "9c8922caee12ea2d5a389353109dd408", "score": "0.62776035", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_AsExternalLsa) DeleteTypeOfService(Tos uint8) {\n\tkey := Tos\n\n\tdelete(t.TypeOfService, key)\n}", "title": "" }, { "docid": "f400e6d560595542cdf870f6ac003997", "score": "0.62729037", "text": "func (o *PostServiceDetailsParams) SetServiceType(serviceType *string) {\n\to.ServiceType = serviceType\n}", "title": "" }, { "docid": "07fd1a831871e3db797d720145fcbf36", "score": "0.6268944", "text": "func (s *DeletePerformanceAnalysisReportInput) SetServiceType(v string) *DeletePerformanceAnalysisReportInput {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "28d957d19c5db4f8a69e2d7dfd6bc70f", "score": "0.626705", "text": "func (s *AnalysisReport) SetServiceType(v string) *AnalysisReport {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "e739d455ca05cec2d2969f3e0366a9f9", "score": "0.6254382", "text": "func (s *GetPerformanceAnalysisReportInput) SetServiceType(v string) *GetPerformanceAnalysisReportInput {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "b2fb3eef6802bdfe4ca0b5c30feb5990", "score": "0.6232899", "text": "func (su *ServiceUpdate) ClearType() *ServiceUpdate {\n\tsu.clearedType = true\n\treturn su\n}", "title": "" }, { "docid": "eef57d97837f6e4301fc420ffbc92f4b", "score": "0.6228476", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsa) DeleteTypeOfService(Tos uint8) {\n\tkey := Tos\n\n\tdelete(t.TypeOfService, key)\n}", "title": "" }, { "docid": "b6a7fb2035369cd27e937e27ed873e94", "score": "0.6210751", "text": "func (s *CreatePerformanceAnalysisReportInput) SetServiceType(v string) *CreatePerformanceAnalysisReportInput {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "f0c4d7a293a89eaad10de86f4234e4dd", "score": "0.61892575", "text": "func (s *GetDimensionKeyDetailsInput) SetServiceType(v string) *GetDimensionKeyDetailsInput {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "c085036f62b0570406b36d439e447e75", "score": "0.6181465", "text": "func (s *ListPerformanceAnalysisReportsInput) SetServiceType(v string) *ListPerformanceAnalysisReportsInput {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "34d9f7ac9b8120db4b1952d31fd332f9", "score": "0.610762", "text": "func (s *DescribeDimensionKeysInput) SetServiceType(v string) *DescribeDimensionKeysInput {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "afbc876c497d914361a044345d7ae103", "score": "0.6100258", "text": "func (s *ListAvailableResourceDimensionsInput) SetServiceType(v string) *ListAvailableResourceDimensionsInput {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "1d3ddeb6eca21bc909d5fba5a8ddd2b0", "score": "0.60448766", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa) DeleteTypeOfService(Tos uint8) {\n\tkey := Tos\n\n\tdelete(t.TypeOfService, key)\n}", "title": "" }, { "docid": "35d7ec63bf376367f79b2194b656f46a", "score": "0.6041144", "text": "func (suo *ServiceUpdateOne) ClearType() *ServiceUpdateOne {\n\tsuo.clearedType = true\n\treturn suo\n}", "title": "" }, { "docid": "643fd2e7628a4c16e11c58ff9684e683", "score": "0.60238093", "text": "func (s *ListAvailableResourceMetricsInput) SetServiceType(v string) *ListAvailableResourceMetricsInput {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "a826bbe896f3b67cd60c4f38af5e92ae", "score": "0.60115623", "text": "func (s *UntagResourceInput) SetServiceType(v string) *UntagResourceInput {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "4928cbb7c38ea1d01b91fa060bec57ca", "score": "0.5989027", "text": "func (s *GetResourceMetricsInput) SetServiceType(v string) *GetResourceMetricsInput {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "b6f6131ef9f67b1c723a22a151c7bcb4", "score": "0.59037364", "text": "func (s *GetResourceMetadataInput) SetServiceType(v string) *GetResourceMetadataInput {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "f30562516525c344e2df4247b0335b14", "score": "0.5869192", "text": "func (s *ListTagsForResourceInput) SetServiceType(v string) *ListTagsForResourceInput {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "30637315d97edb3f184dbf634002f195", "score": "0.586682", "text": "func (m *ServiceTypeMutation) ResetPropertyTypes() {\n\tm.property_types = nil\n\tm.clearedproperty_types = false\n\tm.removedproperty_types = nil\n}", "title": "" }, { "docid": "b5d0f1d1f549ce677946665c79f41241", "score": "0.58455896", "text": "func (m *EquipmentTypeMutation) ClearServiceEndpointDefinitions() {\n\tm.clearedservice_endpoint_definitions = true\n}", "title": "" }, { "docid": "99a48257078762a9d427e3462fabad11", "score": "0.5828093", "text": "func (m *ServiceTypeMutation) ClearEndpointDefinitions() {\n\tm.clearedendpoint_definitions = true\n}", "title": "" }, { "docid": "6d8bf0f1a5d42696aaa6cb6c83bf8fbb", "score": "0.581959", "text": "func (m *ServiceEndpointDefinitionMutation) ServiceTypeCleared() bool {\n\treturn m.clearedservice_type\n}", "title": "" }, { "docid": "f537bc2ecf1a7fd801bdcc4386ec7383", "score": "0.5817835", "text": "func (ptuo *PropertyTypeUpdateOne) SetServiceType(s *ServiceType) *PropertyTypeUpdateOne {\n\treturn ptuo.SetServiceTypeID(s.ID)\n}", "title": "" }, { "docid": "384ab455cd9f32f15b146a0cccb3600c", "score": "0.5766675", "text": "func (s *TagResourceInput) SetServiceType(v string) *TagResourceInput {\n\ts.ServiceType = &v\n\treturn s\n}", "title": "" }, { "docid": "2b1a9b47fb6afc31adc24ee5e8a9f7a2", "score": "0.5761047", "text": "func (dtu *DeviceTypeUpdate) ClearTypes() *DeviceTypeUpdate {\n\tdtu.mutation.ClearTypes()\n\treturn dtu\n}", "title": "" }, { "docid": "b969b200f29f529d4336cea4abffa40f", "score": "0.5742596", "text": "func (dtuo *DeviceTypeUpdateOne) ClearTypes() *DeviceTypeUpdateOne {\n\tdtuo.mutation.ClearTypes()\n\treturn dtuo\n}", "title": "" }, { "docid": "8a7f0f2085802fee2e219a4f67a92545", "score": "0.5712895", "text": "func (meshData *MeshData) AddServiceType(serviceType *ServiceType) {\n\tif svcTypeExisting := meshData.FindServiceType(serviceType.Name); svcTypeExisting != nil {\n\t\t*svcTypeExisting = *serviceType\n\t} else {\n\t\tmeshData.ServiceTypes = append(meshData.ServiceTypes, serviceType)\n\t}\n}", "title": "" }, { "docid": "093f270533a073562d593a4def47f3b4", "score": "0.5711778", "text": "func (seuo *ServiceEndpointUpdateOne) ClearService() *ServiceEndpointUpdateOne {\n\tseuo.clearedService = true\n\treturn seuo\n}", "title": "" }, { "docid": "093f270533a073562d593a4def47f3b4", "score": "0.5711778", "text": "func (seuo *ServiceEndpointUpdateOne) ClearService() *ServiceEndpointUpdateOne {\n\tseuo.clearedService = true\n\treturn seuo\n}", "title": "" }, { "docid": "361913f121f143d5e17da9afd91a6411", "score": "0.56612444", "text": "func (seu *ServiceEndpointUpdate) ClearService() *ServiceEndpointUpdate {\n\tseu.clearedService = true\n\treturn seu\n}", "title": "" }, { "docid": "361913f121f143d5e17da9afd91a6411", "score": "0.56612444", "text": "func (seu *ServiceEndpointUpdate) ClearService() *ServiceEndpointUpdate {\n\tseu.clearedService = true\n\treturn seu\n}", "title": "" }, { "docid": "5b33f4f9634d1c394eb5083e15aefcc6", "score": "0.5646007", "text": "func (c *BackgroundService) ClearEvents(service string) (*gcdmessage.ChromeResponse, error) {\n\tvar v BackgroundServiceClearEventsParams\n\tv.Service = service\n\treturn c.ClearEventsWithParams(&v)\n}", "title": "" }, { "docid": "a938f65fa3a1302864c3d6f7ea56a0a4", "score": "0.55781114", "text": "func (m *EquipmentTypeMutation) ResetServiceEndpointDefinitions() {\n\tm.service_endpoint_definitions = nil\n\tm.clearedservice_endpoint_definitions = false\n\tm.removedservice_endpoint_definitions = nil\n}", "title": "" }, { "docid": "db9ceb62bae15e5c2f05aa42d0c30919", "score": "0.55695987", "text": "func (m *CustomerMutation) ClearServices() {\n\tm.clearedservices = true\n}", "title": "" }, { "docid": "ad077d4a152baea2b0fa779a28fa7fd8", "score": "0.5563518", "text": "func (m *ServiceMutation) ClearType() {\n\tm.cleared_type = true\n}", "title": "" }, { "docid": "4da363ba1303ab1f5ac270d862985866", "score": "0.555782", "text": "func (ptu *PropertyTypeUpdate) SetServiceType(s *ServiceType) *PropertyTypeUpdate {\n\treturn ptu.SetServiceTypeID(s.ID)\n}", "title": "" }, { "docid": "0b55c8039ffb33e5aaf846cea1379bee", "score": "0.5525226", "text": "func (m *PropertyTypeMutation) ServiceTypeCleared() bool {\n\treturn m.clearedservice_type\n}", "title": "" }, { "docid": "13750fcf9404843075802aa9b6a27cfc", "score": "0.5456772", "text": "func (m *CustomerMutation) ResetServices() {\n\tm.services = nil\n\tm.clearedservices = false\n\tm.removedservices = nil\n}", "title": "" }, { "docid": "8fb484d57bc552bab4ef56f4f2da9408", "score": "0.53784", "text": "func (ptc *PropertyTypeCreate) SetServiceType(s *ServiceType) *PropertyTypeCreate {\n\treturn ptc.SetServiceTypeID(s.ID)\n}", "title": "" }, { "docid": "73f609ae3d78b66899267dc4671094d5", "score": "0.5352999", "text": "func (m *PropertyMutation) ClearService() {\n\tm.clearedservice = true\n}", "title": "" }, { "docid": "066f67572b4d0e3390b0781d5eac833d", "score": "0.53488314", "text": "func (m *ServiceEndpointMutation) ClearService() {\n\tm.clearedservice = true\n}", "title": "" }, { "docid": "c127b21eb57a19e9b73f0785fcf5f06c", "score": "0.5348178", "text": "func GetServiceType() string {\n\tv := GetEnv(\"SERVICE_TYPE\", \"query\")\n\treturn v\n}", "title": "" }, { "docid": "6ee0ac42a074c6dbe9017ff2b0e57cf4", "score": "0.53023326", "text": "func (m *ServiceTypeMutation) ResetEndpointDefinitions() {\n\tm.endpoint_definitions = nil\n\tm.clearedendpoint_definitions = false\n\tm.removedendpoint_definitions = nil\n}", "title": "" }, { "docid": "4414de7e6fd0214a605ff2fc5505f510", "score": "0.5281666", "text": "func (m *EquipmentCategoryMutation) ClearTypes() {\n\tm.clearedtypes = true\n}", "title": "" }, { "docid": "eb307dcb7b48e5024be3180ca80a72d7", "score": "0.5277043", "text": "func (m *LinkMutation) ClearService() {\n\tm.clearedservice = true\n}", "title": "" }, { "docid": "e387f9a295f0d9f4ca9288452a8fe8af", "score": "0.52613014", "text": "func (m *ServiceMutation) ResetType() {\n\tm._type = nil\n\tm.cleared_type = false\n}", "title": "" }, { "docid": "81657236b4ed10087dfa9064e28d65ec", "score": "0.52281004", "text": "func (in *BackboneServiceType) DeepCopy() *BackboneServiceType {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BackboneServiceType)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e7946dea503b4ca6076033e1d6d5d3a8", "score": "0.521011", "text": "func (m *LinkMutation) ResetService() {\n\tm.service = nil\n\tm.clearedservice = false\n\tm.removedservice = nil\n}", "title": "" }, { "docid": "3879a20373bc92d5a9d2fd1558ca96fe", "score": "0.52077645", "text": "func (m *ServiceMutation) ClearPorts() {\n\tm.clearedports = true\n}", "title": "" }, { "docid": "9d381589984610c702d6d26cdf2eabe3", "score": "0.51659614", "text": "func (m *PropertyMutation) ResetService() {\n\tm.service = nil\n\tm.clearedservice = false\n}", "title": "" }, { "docid": "9d1130552db2466c3a7d5892214e95fe", "score": "0.51653385", "text": "func (s *Server) RemoveAllServices(machineID string) {\n\tif machineID == \"\" {\n\t\treturn\n\t}\n\n\ts.logDebug(\"Removing all services for MachineID\", machineID)\n\n\tn := []gopifinder.ServiceInfo{}\n\tfor _, i := range s.Services {\n\t\tif i.MachineID != machineID {\n\t\t\tn = append(n, i)\n\t\t}\n\t}\n\ts.Services = n\n}", "title": "" }, { "docid": "fcd4d8c7ce6a25ef54098254deae5f05", "score": "0.515859", "text": "func (wodu *WorkOrderDefinitionUpdate) ClearType() *WorkOrderDefinitionUpdate {\n\twodu.clearedType = true\n\treturn wodu\n}", "title": "" }, { "docid": "f432c205ef6d9289fc004741c9bc6719", "score": "0.51439995", "text": "func (woduo *WorkOrderDefinitionUpdateOne) ClearType() *WorkOrderDefinitionUpdateOne {\n\twoduo.clearedType = true\n\treturn woduo\n}", "title": "" }, { "docid": "f3da748b8db34ed01a46d6d34fb29daa", "score": "0.5137879", "text": "func (m *ResourceTypeMutation) ClearPropertyTypes() {\n\tm.clearedproperty_types = true\n}", "title": "" }, { "docid": "1a2d13de07a8fd1433d696c027832cf5", "score": "0.513131", "text": "func (in *ServerServiceType) DeepCopy() *ServerServiceType {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServerServiceType)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6bd3a5ceb5e543c7dd6c9c9c5afee2c0", "score": "0.5116981", "text": "func (a *ServiceTypeAndNgksi) SetServiceTypeValue(serviceTypeValue uint8) {}", "title": "" }, { "docid": "5afb78f95fa9f5f2be4d952cc380dec8", "score": "0.51105607", "text": "func (m *ServiceEndpointMutation) ResetService() {\n\tm.service = nil\n\tm.clearedservice = false\n}", "title": "" }, { "docid": "967ed0a173e16d6c7b32d8c204fcd3d1", "score": "0.51072496", "text": "func (m *ServiceTypeMutation) ServicesCleared() bool {\n\treturn m.clearedservices\n}", "title": "" }, { "docid": "817ea36393467a92fddd18e3d4b36e6d", "score": "0.5098413", "text": "func (m *EquipmentPortTypeMutation) ClearPropertyTypes() {\n\tm.clearedproperty_types = true\n}", "title": "" }, { "docid": "4983ba9824eef610065f470f860978f0", "score": "0.50913596", "text": "func (d DummyService) Clear(context.Context) error {\n\treturn d.err\n}", "title": "" }, { "docid": "2f48a372a12ff1582b44d9d4aeb13b71", "score": "0.50913066", "text": "func (m *EquipmentPortMutation) ClearService() {\n\tm.clearedservice = true\n}", "title": "" }, { "docid": "b3eb5e080e356626fec89b3bfc9124f8", "score": "0.5089056", "text": "func (m *ServiceTypeMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown ServiceType nullable field %s\", name)\n}", "title": "" }, { "docid": "9b279c315e595555e4f8220269dad716", "score": "0.5076127", "text": "func removeTypeDefinitions(set typeSet, d *ast.GenDecl) {\n\tif d.Tok != token.TYPE {\n\t\treturn\n\t}\n\n\ti := 0\n\tfor _, gs := range d.Specs {\n\t\ts := gs.(*ast.TypeSpec)\n\t\tif _, ok := set[s.Name.Name]; !ok {\n\t\t\td.Specs[i] = gs\n\t\t\ti++\n\t\t}\n\t}\n\n\td.Specs = d.Specs[:i]\n}", "title": "" }, { "docid": "e0b080c1efaaf7a05b4d0eadf858bd98", "score": "0.5051239", "text": "func (mpuo *MedicalProcedureUpdateOne) ClearProcedureType() *MedicalProcedureUpdateOne {\n\tmpuo.mutation.ClearProcedureType()\n\treturn mpuo\n}", "title": "" }, { "docid": "c92eabc449b039fc8a40e2419eb40383", "score": "0.5050311", "text": "func (o LookupSubnetResultOutput) ServiceTypes() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupSubnetResult) []string { return v.ServiceTypes }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "e48401b7a0619ffb9914053c9e96f32d", "score": "0.5027628", "text": "func (m *LocationTypeMutation) ClearPropertyTypes() {\n\tm.clearedproperty_types = true\n}", "title": "" }, { "docid": "1099bb90085a2f5c4e5647b60d059578", "score": "0.5003698", "text": "func (o *Cvterm) RemoveTypeContacts(exec boil.Executor, related ...*Contact) error {\n\tvar err error\n\tfor _, rel := range related {\n\t\trel.TypeID.Valid = false\n\t\tif rel.R != nil {\n\t\t\trel.R.Type = nil\n\t\t}\n\t\tif err = rel.Update(exec, \"type_id\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif o.R == nil {\n\t\treturn nil\n\t}\n\n\tfor _, rel := range related {\n\t\tfor i, ri := range o.R.TypeContacts {\n\t\t\tif rel != ri {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tln := len(o.R.TypeContacts)\n\t\t\tif ln > 1 && i < ln-1 {\n\t\t\t\to.R.TypeContacts[i] = o.R.TypeContacts[ln-1]\n\t\t\t}\n\t\t\to.R.TypeContacts = o.R.TypeContacts[:ln-1]\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b58448aae402e67b20f51f915d48a3be", "score": "0.50035954", "text": "func (m *WorkOrderTypeMutation) ClearPropertyTypes() {\n\tm.clearedproperty_types = true\n}", "title": "" }, { "docid": "3ec16ee677332778e504fb5f4fe4209f", "score": "0.49998719", "text": "func (mpu *MedicalProcedureUpdate) ClearProcedureType() *MedicalProcedureUpdate {\n\tmpu.mutation.ClearProcedureType()\n\treturn mpu\n}", "title": "" }, { "docid": "0e6757ca633e448ac6c701372db95c44", "score": "0.49867877", "text": "func (dbd DataBrokerData) Clear(typeURL string) {\n\tdelete(dbd, typeURL)\n}", "title": "" }, { "docid": "eb70f2e146b9b32207f77062e29e44db", "score": "0.4982108", "text": "func (s *Store) DeleteServices() error {\n\tserviceCollection := s.client.Database(s.Database).Collection(\"services\")\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\terr := serviceCollection.Drop(ctx)\n\treturn err\n}", "title": "" }, { "docid": "684a3420c782ba58c589405d045769a0", "score": "0.49761143", "text": "func (b *Builder) ClearPorts() {\n\tb.OCIv1.Config.ExposedPorts = map[string]struct{}{}\n\tb.Docker.Config.ExposedPorts = docker.PortSet{}\n}", "title": "" }, { "docid": "ebc790c9c77714297e9c431cc4f251bd", "score": "0.49368763", "text": "func (s *EventStore) Clear(ctx context.Context) error {\n\tif err := s.events.Drop(ctx); err != nil {\n\t\treturn &eh.EventStoreError{\n\t\t\tErr: fmt.Errorf(\"could not clear events collection: %w\", err),\n\t\t}\n\t}\n\n\tif err := s.streams.Drop(ctx); err != nil {\n\t\treturn &eh.EventStoreError{\n\t\t\tErr: fmt.Errorf(\"could not clear streams collection: %w\", err),\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0781d991d45cc81556f7959fb3089174", "score": "0.49332294", "text": "func (gimple *Gimple) UnsetService(id string) {\n\tdelete(gimple.values, id)\n}", "title": "" }, { "docid": "dd390ff61a8a27bba4cd1c0cce94eca0", "score": "0.4932788", "text": "func (this *Teletype) Clear() {\n\tthis.pending = nil\n\t//this.cursed = nil\n}", "title": "" }, { "docid": "3d68761dc0150bf1ffa9e4cfa6ff5582", "score": "0.49323434", "text": "func (m *EquipmentTypeMutation) ClearPropertyTypes() {\n\tm.clearedproperty_types = true\n}", "title": "" }, { "docid": "805add51509eb61a449ec1e1fb967872", "score": "0.49272117", "text": "func (euo *EquipmentUpdateOne) ClearType() *EquipmentUpdateOne {\n\teuo.clearedType = true\n\treturn euo\n}", "title": "" }, { "docid": "0692d65894bed4fa19fc484c20ae71c6", "score": "0.4924943", "text": "func (o *PostServiceDetailsParams) WithServiceType(serviceType *string) *PostServiceDetailsParams {\n\to.SetServiceType(serviceType)\n\treturn o\n}", "title": "" }, { "docid": "5559acb424ed3af5324d55fed0b4d2e0", "score": "0.4914503", "text": "func (m *WorkerTypeMutation) ClearPropertyTypes() {\n\tm.clearedproperty_types = true\n}", "title": "" }, { "docid": "b739ac65e91b3c3ad184ad0df31180f6", "score": "0.49144378", "text": "func (m *EquipmentCategoryMutation) ResetTypes() {\n\tm.types = nil\n\tm.clearedtypes = false\n\tm.removedtypes = nil\n}", "title": "" }, { "docid": "f38d14b0367a29452ddb4d15e73945c2", "score": "0.4914243", "text": "func (m TypeDescriptorMap) Clear() {\n\tfor k := range m {\n\t\tdelete(m, k)\n\t}\n}", "title": "" }, { "docid": "5442bbd3ab0447c30250f254870341d8", "score": "0.48812786", "text": "func (m *ServiceEndpointDefinitionMutation) SetServiceTypeID(id int) {\n\tm.service_type = &id\n}", "title": "" }, { "docid": "4228203293e8ad28f9b010b4c1fc8873", "score": "0.48702046", "text": "func (m *ServiceTypeMutation) PropertyTypesCleared() bool {\n\treturn m.clearedproperty_types\n}", "title": "" }, { "docid": "4f96de79d869e4fa48491a06dc49c85e", "score": "0.4869385", "text": "func (x *fastReflection_QueryCreditTypesRequest) Clear(fd protoreflect.FieldDescriptor) {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.QueryCreditTypesRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.QueryCreditTypesRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "71bafa944d728a73f7977f7da4d07a4a", "score": "0.48668075", "text": "func (x *fastReflection_SignatureDescriptors) Clear(fd protoreflect.FieldDescriptor) {\n\tswitch fd.FullName() {\n\tcase \"cosmos.tx.signing.v1beta1.SignatureDescriptors.signatures\":\n\t\tx.Signatures = nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.tx.signing.v1beta1.SignatureDescriptors\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.tx.signing.v1beta1.SignatureDescriptors does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "7269dd998f5775627b27566a2128d15a", "score": "0.48543108", "text": "func (m *WorkOrderTemplateMutation) ClearPropertyTypes() {\n\tm.clearedproperty_types = true\n}", "title": "" }, { "docid": "1e0cd4a5a8735009061fb5e7cb432859", "score": "0.4854152", "text": "func (m *ServiceMutation) ClearEndpoints() {\n\tm.clearedendpoints = true\n}", "title": "" }, { "docid": "3b684d6df074d3da92f3e05c50562333", "score": "0.48501596", "text": "func (eu *EquipmentUpdate) ClearType() *EquipmentUpdate {\n\teu.clearedType = true\n\treturn eu\n}", "title": "" }, { "docid": "38903ff05d40052c73e6fe2d314914a0", "score": "0.4831682", "text": "func (s *Service) Clear(bytes []byte) ([]byte, error) {\n\ts.values = make(map[string]bool)\n\treturn proto.Marshal(&ClearResponse{})\n}", "title": "" } ]
2f97168d10425a56ad63c9132e5d812e
PublishUnit publishes unit to image
[ { "docid": "68af7f4e3ed1a10e62b88f101be04ac5", "score": "0.7982606", "text": "func (bh *BraveHost) PublishUnit(name string, backend Backend) error {\n\t_, err := backend.Info()\n\tif err != nil {\n\t\treturn errors.New(\"Failed to get host info: \" + err.Error())\n\t}\n\n\ttimestamp := time.Now()\n\n\t// Create an image based on running container and export it. Image saved as tar.gz in project local directory.\n\tfmt.Println(\"Publishing unit ...\")\n\n\tvar unitFingerprint string\n\tunitFingerprint, err = Publish(name, timestamp.Format(\"20060102150405\"), bh.Remote)\n\tif err != nil {\n\t\tDeleteImage(unitFingerprint, bh.Remote)\n\t\treturn errors.New(\"Failed to publish image: \" + err.Error())\n\t}\n\n\tfmt.Println(\"Exporting archive ...\")\n\terr = ExportImage(unitFingerprint, name+\"-\"+timestamp.Format(\"20060102150405\"), bh.Remote)\n\tif err != nil {\n\t\tDeleteImage(unitFingerprint, bh.Remote)\n\t\treturn errors.New(\"Failed to export unit: \" + err.Error())\n\t}\n\n\tfmt.Println(\"Cleaning ...\")\n\tDeleteImage(unitFingerprint, bh.Remote)\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "9623e7c386995b48dd0ef5ec671edeeb", "score": "0.591534", "text": "func (i *Integration) Publish() error {\n\tif i.storer != nil {\n\t\tif err := i.storer.Save(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\toutput, err := i.toJSON(i.prettyOutput)\n\tif err != nil {\n\t\treturn err\n\t}\n\toutput = append(output, []byte{'\\n'}...)\n\t_, err = i.writer.Write(output)\n\tdefer i.Clear()\n\n\treturn err\n}", "title": "" }, { "docid": "38bc33d0f0d383a7929f37d097530931", "score": "0.5852343", "text": "func TestKoPublish(t *testing.T) {\n\tic, err := installer.ProduceImages()\n\tif err != nil {\n\t\tt.Fatalf(\"failed to produce images, %s\", err)\n\t}\n\n\ttemplateString := `\n\trigging.WithImages(map[string]string{\n\t\t{{ range $key, $value := . }}\"{{ $key }}\": \"{{ $value }}\",{{ end }}\n\t}),`\n\n\ttp := template.New(\"t\")\n\ttemp, err := tp.Parse(templateString)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = temp.Execute(os.Stdout, ic)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_, _ = fmt.Fprint(os.Stdout, \"\\n\\n\")\n}", "title": "" }, { "docid": "40454dabb7a32ec4c1906c5db075fbbf", "score": "0.57672554", "text": "func (f OIMetric) Publish(mts []plugin.Metric, cfg plugin.Config) error {\n\t\n\tif len(mts) > 0 {\n\t\tlog.Println(\"Source\")\n\t\tf.Source = \"snap\"\n\n\t\tlog.Println(\"Determining hostname/nodename\")\n\t\thostname, err = os.Hostname()\n\t\tif err != nil {\n\t\t\thostname = \"localhost\"\n\t\t}\n\t\tf.Node = hostname\n\t}\n\n\t// Iterate over the supplied metrics\n\tfor _, m := range mts {\n\n\t\tlog.Println(\"Setting Timestamp\")\n\t\tf.Timestamp = m.Timestamp\n\n\t\t/*\n\t\t// Metric contains all info related to a Snap Metric\n\t\ttype Metric struct {\n\t\t\tNamespace Namespace\n\t\t\tVersion int64\n\t\t\tConfig Config\n\t\t\tData interface{}\n\t\t\tTags map[string]string\n\t\t\tTimestamp time.Time\n\t\t\tUnit string\n\t\t\tDescription string\n\t\t\t//Unexported but passed through for legacy reasons\n\t\t\tlastAdvertisedTime time.Time\n\t\t}\n\t\t*/\n\n\t\t// Do some type conversion and send the data\n\t\tswitch v := m.Data.(type) {\n\t\tcase uint:\n\t\t\ts.sendIntValue(int64(v))\n\t\tcase uint32:\n\t\t\ts.sendIntValue(int64(v))\n\t\tcase uint64:\n\t\t\ts.sendIntValue(int64(v))\n\t\tcase int:\n\t\t\ts.sendIntValue(int64(v))\n\t\tcase int32:\n\t\t\ts.sendIntValue(int64(v))\n\t\tcase int64:\n\t\t\ts.sendIntValue(int64(v))\n\t\tcase float32:\n\t\t\ts.sendFloatValue(float64(v))\n\t\tcase float64:\n\t\t\ts.sendFloatValue(float64(v))\n\t\tdefault:\n\t\t\tlog.Printf(\"Ignoring %T: %v\\n\", v, v)\n\t\t\tlog.Printf(\"Contact the plugin author if you think this is an error\")\n\t\t}\n\t}\n\t\n\t/*\n\tfile, err := cfg.GetString(\"file\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif val, err := cfg.GetBool(\"return_error\"); err == nil && val {\n\t\treturn errors.New(\"Houston we have a problem\")\n\t}\n\tfileHandle, _ := os.Create(file)\n\twriter := bufio.NewWriter(fileHandle)\n\tdefer fileHandle.Close()\n\n\tfor _, m := range mts {\n\t\tfmt.Fprintf(writer, \"%s|%v|%d|%s|%s|%s|%v|%v\\n\",\n\t\t\tm.Namespace.Strings(),\n\t\t\tm.Data,\n\t\t\tm.Version,\n\t\t\tm.Unit,\n\t\t\tm.Description,\n\t\t\tm.Timestamp,\n\t\t\tm.Tags,\n\t\t\tm.Config,\n\t\t)\n\t}\n\twriter.Flush()\n\t*/\n\treturn nil\n}", "title": "" }, { "docid": "4011ef2b10c35a53bb5a21f839ed7727", "score": "0.57473373", "text": "func work(publishCommand commands.PublishCommand) {\n\tpublishCommand.Publish(\"test\", []byte(\"hello world\"))\n}", "title": "" }, { "docid": "ec789ec1b5b13fa06deb78806cdc5f0b", "score": "0.57295495", "text": "func (app *Application) Publish(dir string) error {\n // Defer to a build task if defined\n if app.HasBuilder() {\n app.Build(&DefaultTaskComplete{})\n return nil\n }\n return app.FileSystem.Publish(dir, nil)\n}", "title": "" }, { "docid": "9ad2413a6de6b2629a4e4f1ec6f89648", "score": "0.5592897", "text": "func (d *SANStorageDriver) Publish(name string, publishInfo *utils.VolumePublishInfo) error {\n\n\tif d.Config.DebugTraceFlags[\"method\"] {\n\t\tfields := log.Fields{\n\t\t\t\"Method\": \"Publish\",\n\t\t\t\"Type\": \"SANStorageDriver\",\n\t\t\t\"name\": name,\n\t\t}\n\t\tlog.WithFields(fields).Debug(\">>>> Publish\")\n\t\tdefer log.WithFields(fields).Debug(\"<<<< Publish\")\n\t}\n\n\t// Get the volume\n\tvol, err := d.API.GetVolume(name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not find volume %s: %v\", name, err)\n\t}\n\tif !d.API.IsRefValid(vol.VolumeRef) {\n\t\treturn fmt.Errorf(\"could not find volume %s\", name)\n\t}\n\n\t// Get the Target IQN\n\ttargetIQN, err := d.API.GetTargetIQN()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not get target IQN from array: %v\", err)\n\t}\n\n\t// Get the fstype\n\tfstype := \"\"\n\tfor _, tag := range vol.VolumeTags {\n\t\tif tag.Key == \"fstype\" {\n\t\t\tfstype = tag.Value\n\t\t\tlog.WithFields(log.Fields{\"LUN\": name, \"fstype\": fstype}).Debug(\"Found LUN fstype.\")\n\t\t\tbreak\n\t\t}\n\t}\n\tif fstype == \"\" {\n\t\tfstype = \"ext4\"\n\t\tlog.WithFields(log.Fields{\"LUN\": name, \"fstype\": fstype}).Warn(\"LUN fstype not found, using default.\")\n\t}\n\n\tvar iqn string\n\tvar hostname string\n\tvar mapping api.LUNMapping\n\n\tif publishInfo.Localhost {\n\n\t\t// Lookup local host IQNs\n\t\tiqns, err := utils.GetInitiatorIqns()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error determining host initiator IQN: %v\", err)\n\t\t} else if len(iqns) == 0 {\n\t\t\treturn errors.New(\"could not determine host initiator IQN\")\n\t\t}\n\t\tiqn = iqns[0]\n\n\t\t// Map the volume to the local host\n\t\tmapping, err = d.MapVolumeToLocalHost(vol)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not map volume %s: %v\", name, err)\n\t\t}\n\n\t} else {\n\n\t\t// Host IQN must have been passed in\n\t\tif len(publishInfo.HostIQN) == 0 {\n\t\t\treturn errors.New(\"host initiator IQN not specified\")\n\t\t}\n\t\tiqn = publishInfo.HostIQN[0]\n\t\thostname = publishInfo.HostName\n\n\t\t// Get the host group\n\t\thostGroup, err := d.API.EnsureHostGroup()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not get host group: %v\", err)\n\t\t}\n\n\t\t// See if there is already a host for the specified IQN\n\t\thost, err := d.API.GetHostForIQN(iqn)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not get host for IQN %s: %v\", iqn, err)\n\t\t}\n\n\t\t// Create the host if necessary\n\t\tif host.HostRef == \"\" {\n\t\t\thost, err = d.API.CreateHost(hostname, iqn, d.Config.HostType, hostGroup)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"could not create host for IQN %s: %v\", iqn, err)\n\t\t\t}\n\t\t}\n\n\t\t// If we got a host, make sure it's in the right group\n\t\tif host.HostRef != \"\" && host.ClusterRef != hostGroup.ClusterRef {\n\t\t\treturn fmt.Errorf(\"found for IQN %s, but it is in host group %s: %v\", iqn, d.Config.AccessGroup, err)\n\t\t}\n\n\t\t// Map the volume directly to the Host Group\n\t\tmapHost := api.HostEx{\n\t\t\tHostRef: api.NullRef,\n\t\t\tClusterRef: hostGroup.ClusterRef,\n\t\t}\n\t\tmapping, err = d.API.MapVolume(vol, mapHost)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not map volume %s to Host Group %s: %v\", name, hostGroup.Label, err)\n\t\t}\n\t}\n\n\t// Add fields needed by Attach\n\tpublishInfo.IscsiLunNumber = int32(mapping.LunNumber)\n\tpublishInfo.IscsiTargetPortal = d.Config.HostDataIP\n\tpublishInfo.IscsiTargetIQN = targetIQN\n\tpublishInfo.FilesystemType = fstype\n\tpublishInfo.UseCHAP = false\n\tpublishInfo.SharedTarget = true\n\n\treturn nil\n}", "title": "" }, { "docid": "2c9d573de9eda07cc2b0636f0b388659", "score": "0.55838627", "text": "func (p *Publisher) Publish(m sensor.Measurement) (err error) {\n\t// convert our measurement into a map of metrics\n\t// send the map on to the librato aggregator\n\tp.aggregator.C <- mapMeasurement(m)\n\treturn\n}", "title": "" }, { "docid": "b3004ed14dbffb1aa486db70624cea19", "score": "0.5505865", "text": "func TestPublishStart(t *testing.T) {\n\tPrintTestMessage(\"==========Publish tests start==========\")\n}", "title": "" }, { "docid": "e5ab7d93cfd460087d58df0c055903f2", "score": "0.54862106", "text": "func (b *InMemory) Publish(_ context.Context, events ...event.Domain) error {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\n\tfor _, e := range events {\n\t\te.Version = b.cfg.Version\n\t\te.Stage = b.cfg.Stage\n\n\t\teJSON, err := e.MarshalBinary()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tb.bus.Publish(e.Topic, eJSON)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8d7f41fe8db39b816ccaf07c4bc5aae7", "score": "0.54800546", "text": "func (p *MockPublisher) Publish(msg string) error {\n\treturn p.PublishFn(msg)\n}", "title": "" }, { "docid": "437a3395b902df541b12df5d496165f4", "score": "0.5473614", "text": "func (bh *BraveHost) BuildUnit(bravefile *shared.Bravefile) error {\n\tvar fingerprint string\n\n\tif strings.ContainsAny(bravefile.PlatformService.Name, \"/_. !@£$%^&*(){}:;`~,?\") {\n\t\treturn errors.New(\"Image names should not contain special characters\")\n\t}\n\n\tif bravefile.PlatformService.Name == \"\" {\n\t\treturn errors.New(\"Service Name is empty\")\n\t}\n\n\terr := checkUnits(bravefile.PlatformService.Name, bh)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = listHostImages(bh.Remote)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t//if len(images) > 0 {\n\t//\terr = deleteHostImages(bh.Remote)\n\t//\tif err != nil {\n\t//\t\treturn err\n\t//\t}\n\t//}\n\n\tprocessInterruptHandler(fingerprint, bravefile, bh)\n\n\tswitch bravefile.Base.Location {\n\tcase \"public\":\n\t\tfingerprint, err = importLXD(bravefile, bh.Remote)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\terr = Start(bravefile.PlatformService.Name, bh.Remote)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\tcase \"github\":\n\t\terr = importGitHub(bravefile, bh)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\terr = Start(bravefile.PlatformService.Name, bh.Remote)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\tdefault:\n\t\tif bravefile.Base.Location == \"local\" {\n\t\t\terr = importLocal(bravefile, bh.Remote)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t}\n\t}\n\n\tpMan := bravefile.SystemPackages.Manager\n\n\tswitch pMan {\n\tcase \"apk\":\n\t\t_, err := Exec(bravefile.PlatformService.Name, []string{\"apk\", \"update\", \"--no-cache\"}, bh.Remote)\n\t\tif err != nil {\n\t\t\tDeleteImage(fingerprint, bh.Remote)\n\t\t\tDelete(bravefile.PlatformService.Name, bh.Remote)\n\t\t\treturn errors.New(\"Failed to update repositories: \" + err.Error())\n\t\t}\n\n\t\targs := []string{\"apk\", \"--no-cache\", \"add\"}\n\t\tfor _, p := range bravefile.SystemPackages.System {\n\t\t\targs = append(args, p)\n\t\t}\n\t\tstatus, err := Exec(bravefile.PlatformService.Name, args, bh.Remote)\n\t\tif err != nil {\n\t\t\tDeleteImage(fingerprint, bh.Remote)\n\t\t\tDelete(bravefile.PlatformService.Name, bh.Remote)\n\t\t\treturn errors.New(\"Failed to install packages: \" + err.Error())\n\t\t}\n\t\tif status > 0 {\n\t\t\tDeleteImage(fingerprint, bh.Remote)\n\t\t\tDelete(bravefile.PlatformService.Name, bh.Remote)\n\t\t\treturn errors.New(shared.Fatal(\"Failed to install packages\"))\n\t\t}\n\n\tcase \"apt\":\n\t\t_, err := Exec(bravefile.PlatformService.Name, []string{\"apt\", \"update\"}, bh.Remote)\n\t\tif err != nil {\n\t\t\tDeleteImage(fingerprint, bh.Remote)\n\t\t\tDelete(bravefile.PlatformService.Name, bh.Remote)\n\t\t\treturn errors.New(\"Failed to update repositories: \" + err.Error())\n\t\t}\n\n\t\targs := []string{\"apt\", \"install\"}\n\t\tfor _, p := range bravefile.SystemPackages.System {\n\t\t\targs = append(args, p)\n\t\t}\n\t\targs = append(args, \"--yes\")\n\t\tstatus, err := Exec(bravefile.PlatformService.Name, args, bh.Remote)\n\n\t\tif err != nil {\n\t\t\tDeleteImage(fingerprint, bh.Remote)\n\t\t\tDelete(bravefile.PlatformService.Name, bh.Remote)\n\t\t\treturn errors.New(\"Failed to install packages: \" + err.Error())\n\t\t}\n\t\tif status > 0 {\n\t\t\tDeleteImage(fingerprint, bh.Remote)\n\t\t\tDelete(bravefile.PlatformService.Name, bh.Remote)\n\t\t\treturn errors.New(shared.Fatal(\"Failed to install packages\"))\n\t\t}\n\t}\n\n\t// Go through \"Copy\" section\n\terr = bravefileCopy(bravefile.Copy, bravefile.PlatformService.Name, bh.Remote)\n\tif err != nil {\n\t\tDeleteImage(fingerprint, bh.Remote)\n\t\tDelete(bravefile.PlatformService.Name, bh.Remote)\n\t\treturn err\n\t}\n\n\t// Go through \"Run\" section\n\tstatus, err := bravefileRun(bravefile.Run, bravefile.PlatformService.Name, bh.Remote)\n\tif err != nil {\n\t\tDeleteImage(fingerprint, bh.Remote)\n\t\tDelete(bravefile.PlatformService.Name, bh.Remote)\n\t\treturn errors.New(\"Failed to execute command: \" + err.Error())\n\t}\n\tif status > 0 {\n\t\tDeleteImage(fingerprint, bh.Remote)\n\t\tDelete(bravefile.PlatformService.Name, bh.Remote)\n\t\treturn errors.New(shared.Fatal(\"Non-zero exit code: \" + strconv.Itoa(status)))\n\t}\n\n\t// Create an image based on running container and export it. Image saved as tar.gz in project local directory.\n\tvar unitFingerprint string\n\tunitFingerprint, err = Publish(bravefile.PlatformService.Name, bravefile.PlatformService.Version, bh.Remote)\n\tif err != nil {\n\t\tDeleteImage(fingerprint, bh.Remote)\n\t\tDelete(bravefile.PlatformService.Name, bh.Remote)\n\t\treturn errors.New(\"Failed to publish image: \" + err.Error())\n\t}\n\n\terr = ExportImage(unitFingerprint, bravefile.PlatformService.Name+\"-\"+bravefile.PlatformService.Version, bh.Remote)\n\tif err != nil {\n\t\tDeleteImage(fingerprint, bh.Remote)\n\t\tDeleteImage(unitFingerprint, bh.Remote)\n\t\tDelete(bravefile.PlatformService.Name, bh.Remote)\n\t\treturn errors.New(\"Failed to export image: \" + err.Error())\n\t}\n\n\tDeleteImage(fingerprint, bh.Remote)\n\tDeleteImage(unitFingerprint, bh.Remote)\n\tDelete(bravefile.PlatformService.Name, bh.Remote)\n\n\thome, _ := os.UserHomeDir()\n\tlocalImageFile := bravefile.PlatformService.Name + \"-\" + bravefile.PlatformService.Version + \".tar.gz\"\n\tlocalHashFile := localImageFile + \".md5\"\n\n\timageHash, err := shared.FileHash(localImageFile)\n\tif err != nil {\n\t\treturn errors.New(\"Failed to generate image hash: \" + err.Error())\n\t}\n\n\tfmt.Println(imageHash)\n\n\t// Write image hash to a file\n\tf, err := os.Create(localHashFile)\n\tif err != nil {\n\t\treturn errors.New(err.Error())\n\t}\n\tdefer f.Close()\n\n\t_, err = f.WriteString(imageHash)\n\tif err != nil {\n\t\treturn errors.New(err.Error())\n\t}\n\tf.Close()\n\n\terr = shared.CopyFile(localImageFile, home+shared.ImageStore+localImageFile)\n\tif err != nil {\n\t\treturn errors.New(\"Failed to copy image archive to local storage: \" + err.Error())\n\t}\n\n\terr = shared.CopyFile(localHashFile, home+shared.ImageStore+localHashFile)\n\tif err != nil {\n\t\treturn errors.New(\"Failed to copy images hash into local storage: \" + err.Error())\n\t}\n\n\terr = os.Remove(localImageFile)\n\tif err != nil {\n\t\treturn errors.New(\"Failed to clean up image archive: \" + err.Error())\n\t}\n\n\terr = os.Remove(localHashFile)\n\tif err != nil {\n\t\treturn errors.New(\"Failed to clean up image hash: \" + err.Error())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "870e2f924b6b587d8c5d362b79195125", "score": "0.5435753", "text": "func (bus *GBus) PublishPayload(nodeSource, nodeTarget, groupSource, groupTarget, command, payload string) error {\n\n\tbus.PublishMsg(Msg{\n\t\tNodeSource: nodeSource,\n\t\tNodeTarget: nodeTarget,\n\t\tGroupSource: groupSource,\n\t\tGroupTarget: groupTarget,\n\t\tCommand: command,\n\t\tPayload: payload,\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "c7bf11c07b3fff016ca8f02c34ddd312", "score": "0.543351", "text": "func (r *Release) Publish(cli RepositoriesClient) error {\n\t// create release\n\to, _, err := cli.CreateRelease(\n\t\tcontext.Background(),\n\t\tr.Slug.Owner,\n\t\tr.Slug.Name,\n\t\t&github.RepositoryRelease{\n\t\t\tName: &r.Name,\n\t\t\tTagName: &r.Reference.Tag,\n\t\t\tTargetCommitish: &r.Reference.CommitHash,\n\t\t\tBody: &r.Changelog,\n\t\t\tDraft: &r.Draft,\n\t\t\tPrerelease: &r.PreRelease,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Info(\"release created successfully 🎉\")\n\n\t// upload assets\n\tif r.Assets != nil {\n\t\terrs := make(chan error, len(*r.Assets))\n\n\t\twg := new(sync.WaitGroup)\n\t\twg.Add(len(*r.Assets))\n\n\t\tfor _, a := range *r.Assets {\n\t\t\tasset := a\n\t\t\tgo asset.Upload(r, cli, o.GetID(), errs, wg)\n\t\t}\n\n\t\tvar failure bool\n\t\tfor i := 0; i <= (len(*r.Assets) - 1); i++ {\n\t\t\terr = <-errs\n\n\t\t\tif err != nil {\n\t\t\t\tfailure = true\n\t\t\t\tlog.Error(err)\n\t\t\t}\n\t\t}\n\n\t\twg.Wait()\n\n\t\tif failure {\n\t\t\treturn errors.New(\"error uploading assets\")\n\t\t}\n\n\t\tlog.Info(\"assets uploaded successfully 🎉\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "13a4ef20a7174da6aef568f8be90c7e2", "score": "0.5414807", "text": "func TestPublishSuccessNotStubbed(t *testing.T) {\n\tassert := assert.New(t)\n\n\tpn := pubnub.NewPubNub(config)\n\n\tpn.Config.CipherKey = \"enigma\"\n\n\tres, _, err := pn.Publish().\n\t\tChannel(randomized(\"ch\")).Message(\"hey\").UsePost(true).Serialize(true).Execute()\n\n\tassert.Nil(err)\n\tif res != nil {\n\t\tassert.True(14981595400555832 < res.Timestamp)\n\t}\n\tpn.Config.CipherKey = \"\"\n}", "title": "" }, { "docid": "4e7108c317b4e0f323c3485514fe4bf7", "score": "0.5409425", "text": "func HandlePublish(env *api.Env, w http.ResponseWriter, r *http.Request) error {\n\t// Set maximum upload size to 2GB.\n\tr.ParseMultipartForm((2 * 1000) << 20)\n\n\t// Retrieve namespace.\n\tnamespace, err := api.GetAuthorizedNamespace(env, r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Extract archive to temp folder.\n\tcontextDir, err := extractContext(namespace, r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer os.RemoveAll(contextDir) // Clean up.\n\n\t// Build and push image.\n\tif err := generate(namespace, contextDir, env); err != nil {\n\t\treturn err\n\t}\n\n\t// Setup client stream.\n\tw.WriteHeader(http.StatusOK)\n\tw.Header().Set(\"Content-Type\", \"text/event-stream\")\n\n\t// Build with Skaffold.\n\tif err := Skaffold(\"build\", contextDir, contextDir+\"/skaffold.yaml\", w); err != nil {\n\t\treturn err\n\t}\n\n\t// Load the manifest.\n\tmanifestFile := filepath.FromSlash(contextDir + \"/kuda.yaml\")\n\tmanifest, err := utils.LoadManifest(manifestFile)\n\tif err != nil {\n\t\treturn api.StatusError{Code: 400, Err: err}\n\t}\n\n\t// Register API.\n\tapiVersion := &api.Version{\n\t\tIsPublic: true,\n\t\tVersion: manifest.Version,\n\t\tManifest: manifest,\n\t}\n\tif err := registerAPI(env, namespace, apiVersion); err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Fprintf(w, \"Publish successful!\\n\")\n\treturn nil\n}", "title": "" }, { "docid": "bbd9a0eb050dccfe2ca2cc897830b259", "score": "0.5380243", "text": "func TestPublishSigned(t *testing.T) {\n\tassert := assert.New(t)\n\n\t// Not allowed characters: /?#,\n\tvalidCharacters := \"-._~:[]@!$&'()*+;=`|\"\n\n\tconfig := pamConfigCopy()\n\tconfig.SetUserId(pubnub.UserId(validCharacters))\n\n\tpn := pubnub.NewPubNub(config)\n\n\t_, _, err := pn.Publish().Channel(randomized(\"ch\")).\n\t\tMessage([]string{\"hey\", \"hey2\", \"hey3\"}).Execute()\n\n\tassert.Nil(err)\n}", "title": "" }, { "docid": "c60f6de08e241ce8ba07c0d439f21b59", "score": "0.53738004", "text": "func (m *MockKnativePublisher) Publish(knativeLib *knative.KnativeLib, namespace *string,\n\theaders *map[string][]string, payload *[]byte, source string, eventType string,\n\teventTypeVersion string) (error *api.Error, status string, channelName string) {\n\treturn nil, publisher.Published, channelName\n}", "title": "" }, { "docid": "cc44e41b94a249e5bbbb00bde3593a52", "score": "0.534258", "text": "func (as *adapterService) Publish(ctx context.Context, token string, m Message) error {\n\t// Get route map of OPC-UA Node Namespace\n\tchannelID, err := as.channelsRM.Get(m.Namespace)\n\tif err != nil {\n\t\treturn ErrNotFoundNamespace\n\t}\n\n\t// Get route map of OPC-UA Node Identifier\n\tthingID, err := as.thingsRM.Get(m.ID)\n\tif err != nil {\n\t\treturn ErrNotFoundIdentifier\n\t}\n\n\t// Publish on Mainflux NATS broker\n\tSenML := fmt.Sprintf(`[{\"n\":\"opcua\",\"v\":%f}]`, m.Data)\n\tpayload := []byte(SenML)\n\tmsg := mainflux.Message{\n\t\tPublisher: thingID,\n\t\tProtocol: protocol,\n\t\tContentType: \"Content-Type\",\n\t\tChannel: channelID,\n\t\tPayload: payload,\n\t}\n\n\treturn as.publisher.Publish(ctx, token, msg)\n}", "title": "" }, { "docid": "4fa855a310b1163bed44ba848d3d4dcc", "score": "0.5340497", "text": "func Publish(pp *packets.PublishPacket, w io.Writer) error {\n\tb, err := pp.Encode()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = w.Write(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "214781979805f400b2ad2494728cd568", "score": "0.532066", "text": "func (d *NFSStorageDriver) Publish(\n\tctx context.Context, volConfig *storage.VolumeConfig, publishInfo *utils.VolumePublishInfo,\n) error {\n\tname := volConfig.InternalName\n\tfields := LogFields{\n\t\t\"Method\": \"Publish\",\n\t\t\"Type\": \"NFSStorageDriver\",\n\t\t\"name\": name,\n\t}\n\tLogd(ctx, d.Name(), d.Config.DebugTraceFlags[\"method\"]).WithFields(fields).Trace(\">>>> Publish\")\n\tdefer Logd(ctx, d.Name(), d.Config.DebugTraceFlags[\"method\"]).WithFields(fields).Trace(\"<<<< Publish\")\n\n\t// Get the volume\n\tcreationToken := name\n\n\tvolume, err := d.API.GetVolumeByCreationToken(ctx, creationToken)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not find volume %s: %v\", creationToken, err)\n\t}\n\n\t// Heal the ID on legacy volumes\n\tif volConfig.InternalID == \"\" {\n\t\tvolConfig.InternalID = d.CreateGCPInternalID(volume)\n\t}\n\n\tif len(volume.MountPoints) == 0 {\n\t\treturn fmt.Errorf(\"volume %s has no mount targets\", name)\n\t}\n\n\t// Determine mount options (volume config wins, followed by backend config)\n\tmountOptions := d.Config.NfsMountOptions\n\tif volConfig.MountOptions != \"\" {\n\t\tmountOptions = volConfig.MountOptions\n\t}\n\n\t// Add fields needed by Attach\n\tpublishInfo.NfsServerIP = (volume.MountPoints)[0].Server\n\tpublishInfo.NfsPath = (volume.MountPoints)[0].Export\n\tpublishInfo.FilesystemType = \"nfs\"\n\tpublishInfo.MountOptions = mountOptions\n\n\treturn nil\n}", "title": "" }, { "docid": "9065faaf14e125564a273f20e93943fa", "score": "0.52762574", "text": "func (urls *Urls) Publish(journey *Journey, uploader *s3manager.Uploader, wg *sync.WaitGroup) (*s3manager.UploadOutput, error) {\n\tdefer wg.Done()\n\tlog.Printf(\"Starting to upload static asset urls to this bucket: %v\", journey.Bucket)\n\n\tkey := journey.Name + \"/\" + journey.Version + \"/journey-urls.json\"\n\n\tdata, err := json.Marshal(urls)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to parse the journey urls into json\")\n\t}\n\n\t// Upload the static assest urls to S3\n\treturn uploader.Upload(&s3manager.UploadInput{\n\t\tBucket: aws.String(journey.Bucket),\n\t\tKey: aws.String(key),\n\t\tBody: bytes.NewReader(data),\n\t\tContentType: aws.String(\"application/javascript\"),\n\t})\n}", "title": "" }, { "docid": "268cb5e9165d09f25d06a048e44a047a", "score": "0.5252177", "text": "func (p *InfluxDBPublisher) Publish(name string, metric int64) {\n\tline := fmt.Sprintf(\"%s avg=%d\", name, metric)\n\tp.writeAPI.WriteRecord(line)\n}", "title": "" }, { "docid": "2465b4d576ce2c6489704bfc61d80231", "score": "0.52516574", "text": "func (np *SQSPublisher) Publish(targetName string, commit cqrskit.EventCommit, fn cqrskit.AckHandler) error {\n\tregion, err := np.getSQSRegion(targetName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcommitBytes, err := np.encoder.Encode(commit)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar message sqs.SendMessageInput\n\tmessage.QueueUrl = aws.String(region.URL)\n\tmessage.MessageBody = aws.String(string(commitBytes))\n\n\toutput, err := region.Service.SendMessage(&message)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfn(cqrskit.PubAck{\n\t\tResponse: output,\n\t\tNamespace: region.URL,\n\t\tVersion: commit.Version,\n\t\tCommitID: commit.CommitID,\n\t\tInstanceID: commit.InstanceID,\n\t\tAggregateID: commit.AggregateID,\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "d02bfe973f4634e512ef02a0ad353747", "score": "0.52470976", "text": "func (s *MDNSService) Publish() error {\n\tip, err := GetFirstLocalIPAddress()\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Println(\"[INFO] Accessory IP is\", ip)\n\n\t// Host should end with '.'\n\thostname, _ := os.Hostname()\n\thost := fmt.Sprintf(\"%s.\", strings.Trim(hostname, \".\"))\n\ttext := s.txtRecords()\n\tserver, err := bonjour.RegisterProxy(s.name, \"_hap._tcp.\", \"\", s.port, host, ip.String(), text, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ts.server = server\n\treturn err\n}", "title": "" }, { "docid": "291d457873f4e9b182f374e88f6e6cc0", "score": "0.5233847", "text": "func TestPublishWithNoAction(t *testing.T) {\n\ttestProjectDir := setUpGödelTestAndDownload(t, testRootDir, gödelTGZ, version)\n\tsrc := `package main\n\timport \"fmt\"\n\n\tfunc main() {\n\t\tfmt.Println(\"hello, world!\")\n\t}`\n\terr := ioutil.WriteFile(path.Join(testProjectDir, \"main.go\"), []byte(src), 0644)\n\trequire.NoError(t, err)\n\n\tcmd := exec.Command(\"./godelw\", \"publish\")\n\tcmd.Dir = testProjectDir\n\toutput, err := cmd.CombinedOutput()\n\trequire.Error(t, err)\n\tassert.Regexp(t, regexp.MustCompile(`(?s)NAME:.+publish - Publish product distributions.+USAGE:.+godel publish.+SUBCOMMANDS:.+FLAGS:.+`), string(output))\n}", "title": "" }, { "docid": "13c15cccf6b8e5bcd4fefcd79efd4d6e", "score": "0.52093434", "text": "func (ps *PubSub) Publish(evt events.Event) {\n\tjson, err := json.Marshal(evt)\n\tif err == nil {\n\t\tps.client.Publish(ps.eventChannel, string(json))\n\t}\n}", "title": "" }, { "docid": "7f3abd5254a0629b7737ee723a35af0b", "score": "0.52046824", "text": "func DockerPublish(origImg, manifest, registry, org, username, password, jobDirectory string,\n\tforce, P, pm, pp, J, jm, jp bool) (string, error) {\n\n\tif origImg == \"\" {\n\t\tutil.PrintUtil(\"INFO: Image name not specified. Attempting to use manifest: %v\\n\", manifest)\n\t\ttemp, err := objects.GetImageNameFromManifest(manifest, jobDirectory)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\torigImg = temp\n\t}\n\n\tif origImg == \"\" {\n\t\terr := errors.New(\"ERROR: No input image specified.\")\n\t\tutil.PrintUtil(\"%s\\n\", err.Error())\n\t\treturn \"\", err\n\t}\n\n\tif exists, err := util.ImageExists(origImg); !exists {\n\t\tif err != nil {\n\t\t\tutil.PrintUtil(\"%s\\n\", err.Error())\n\t\t\treturn \"\", err\n\t\t}\n\t\tmsg := fmt.Sprintf(\"Unable to find image: %s. Did you specify a valid tag?\", origImg)\n\t\tutil.PrintUtil(\"%s\\n\", msg)\n\t\treturn \"\", errors.New(msg)\n\t}\n\n\ttemp := strings.Split(origImg, \":\")\n\tif len(temp) != 2 {\n\t\terr := errors.New(\"ERROR: Invalid seed name: %s. Unable to split into name/tag pair\\n\")\n\t\treturn \"\", err\n\t}\n\trepoName := temp[0]\n\trepoTag := temp[1]\n\n\tif username != \"\" {\n\t\t//set config dir so we don't stomp on other users' logins with sudo\n\t\tconfigDir := common_const.DockerConfigDir + time.Now().Format(time.RFC3339)\n\t\tos.Setenv(common_const.DockerConfigKey, configDir)\n\t\tdefer util.RemoveAllFiles(configDir)\n\t\tdefer os.Unsetenv(common_const.DockerConfigKey)\n\n\t\terr := util.Login(registry, username, password)\n\t\tif err != nil {\n\t\t\tutil.PrintUtil(err.Error())\n\t\t}\n\t}\n\n\t//1. Check names and verify it doesn't conflict\n\ttag := \"\"\n\timg := origImg\n\n\t// docker tag if registry and/or org specified\n\tif registry != \"\" || org != \"\" {\n\t\tif org != \"\" {\n\t\t\ttag = org + \"/\"\n\t\t\trepoName = tag + repoName\n\t\t}\n\t\tif registry != \"\" {\n\t\t\ttag = registry + \"/\" + tag\n\t\t}\n\n\t\timg = tag + img\n\t}\n\n\t// Check for image confliction.\n\tconflict := false\n\tif !force {\n\t\treg, err := RegistryFactory.CreateRegistry(registry, org, username, password)\n\t\tif err != nil {\n\t\t\terr = errors.New(checkError(err, registry, username, password))\n\t\t\treturn \"\", err\n\t\t}\n\t\tif reg == nil {\n\t\t\terr = errors.New(\"Unknown error connecting to registry\")\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tif reg != nil && err == nil {\n\t\t\tmanifest, _ := reg.GetImageManifest(repoName, repoTag)\n\t\t\tconflict = manifest != \"\"\n\t\t}\n\n\t\tif conflict {\n\t\t\tutil.PrintUtil(\"INFO: Image %s exists on registry %s\\n\", img, registry)\n\t\t}\n\t}\n\n\t// If it conflicts, bump specified version number\n\tif conflict && !force {\n\t\tutil.PrintUtil(\"INFO: Force flag not specified, attempting to rebuild with new version number.\\n\")\n\n\t\t//1. Verify we have a valid manifest\n\t\tseedFileName := \"\"\n\t\tif manifest != \".\" && manifest != \"\" {\n\t\t\tseedFileName = util.GetFullPath(manifest, jobDirectory)\n\t\t\tif _, err := os.Stat(seedFileName); os.IsNotExist(err) {\n\t\t\t\tutil.PrintUtil(\"ERROR: Seed manifest not found. %s\\n\", err.Error())\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t} else {\n\t\t\ttemp, err := util.SeedFileName(jobDirectory)\n\t\t\tseedFileName = temp\n\t\t\tif err != nil {\n\t\t\t\tutil.PrintUtil(\"ERROR: %s\\n\", err.Error())\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\n\t\tversion := objects.SeedFromImageLabel(origImg).SeedVersion\n\t\tValidateSeedFile(false, \"\", version, seedFileName, common_const.SchemaManifest)\n\t\tseed := objects.SeedFromManifestFile(seedFileName)\n\n\t\tutil.PrintUtil(\"INFO: An image with the name %s already exists. \", img)\n\t\t// Bump the package patch version\n\t\tif pp {\n\t\t\tpkgVersion := strings.Split(seed.Job.PackageVersion, \".\")\n\t\t\tpatchVersion, _ := strconv.Atoi(pkgVersion[2])\n\t\t\tpkgVersion[2] = strconv.Itoa(patchVersion + 1)\n\t\t\tseed.Job.PackageVersion = strings.Join(pkgVersion, \".\")\n\t\t\tutil.PrintUtil(\"The package patch version will be increased to %s.\\n\",\n\t\t\t\tseed.Job.PackageVersion)\n\n\t\t\t// Bump the package minor verion\n\t\t} else if pm {\n\t\t\tpkgVersion := strings.Split(seed.Job.PackageVersion, \".\")\n\t\t\tminorVersion, _ := strconv.Atoi(pkgVersion[1])\n\t\t\tpkgVersion[1] = strconv.Itoa(minorVersion + 1)\n\t\t\tpkgVersion[2] = \"0\"\n\t\t\tseed.Job.PackageVersion = strings.Join(pkgVersion, \".\")\n\n\t\t\tutil.PrintUtil(\"The package version will be increased to %s.\\n\",\n\t\t\t\tseed.Job.PackageVersion)\n\n\t\t\t// Bump the package major version\n\t\t} else if P {\n\t\t\tpkgVersion := strings.Split(seed.Job.PackageVersion, \".\")\n\t\t\tmajorVersion, _ := strconv.Atoi(pkgVersion[0])\n\t\t\tpkgVersion[0] = strconv.Itoa(majorVersion + 1)\n\t\t\tpkgVersion[1] = \"0\"\n\t\t\tpkgVersion[2] = \"0\"\n\t\t\tseed.Job.PackageVersion = strings.Join(pkgVersion, \".\")\n\n\t\t\tutil.PrintUtil(\"The major package version will be increased to %s.\\n\",\n\t\t\t\tseed.Job.PackageVersion)\n\t\t}\n\t\t// Bump the job patch version\n\t\tif jp {\n\t\t\tjobVersion := strings.Split(seed.Job.JobVersion, \".\")\n\t\t\tpatchVersion, _ := strconv.Atoi(jobVersion[2])\n\t\t\tjobVersion[2] = strconv.Itoa(patchVersion + 1)\n\t\t\tseed.Job.JobVersion = strings.Join(jobVersion, \".\")\n\t\t\tutil.PrintUtil(\"The job patch version will be increased to %s.\\n\",\n\t\t\t\tseed.Job.JobVersion)\n\n\t\t\t// Bump the job minor verion\n\t\t} else if jm {\n\t\t\tjobVersion := strings.Split(seed.Job.JobVersion, \".\")\n\t\t\tminorVersion, _ := strconv.Atoi(jobVersion[1])\n\t\t\tjobVersion[1] = strconv.Itoa(minorVersion + 1)\n\t\t\tjobVersion[2] = \"0\"\n\t\t\tseed.Job.JobVersion = strings.Join(jobVersion, \".\")\n\t\t\tutil.PrintUtil(\"The minor job version will be increased to %s.\\n\",\n\t\t\t\tseed.Job.JobVersion)\n\n\t\t\t// Bump the job major verion\n\t\t} else if J {\n\t\t\tjobVersion := strings.Split(seed.Job.JobVersion, \".\")\n\t\t\tmajorVersion, _ := strconv.Atoi(jobVersion[0])\n\t\t\tjobVersion[0] = strconv.Itoa(majorVersion + 1)\n\t\t\tjobVersion[1] = \"0\"\n\t\t\tjobVersion[2] = \"0\"\n\t\t\tseed.Job.JobVersion = strings.Join(jobVersion, \".\")\n\n\t\t\tutil.PrintUtil(\"The major job version will be increased to %s.\\n\",\n\t\t\t\tseed.Job.JobVersion)\n\t\t}\n\t\tif !J && !jm && !jp && !P && !pm && !pp {\n\t\t\tutil.PrintUtil(\"ERROR: No tag deconfliction method specified. Aborting seed publish.\\n\")\n\t\t\tutil.PrintUtil(\"Exiting seed...\\n\")\n\t\t\treturn \"\", errors.New(\"Image exists and no tag deconfliction method specified.\")\n\t\t}\n\n\t\timg = objects.BuildImageName(&seed)\n\t\tutil.PrintUtil(\"\\nNew image name: %s\\n\", img)\n\n\t\t// write version back to the seed manifest\n\t\tseedJSON, _ := json.MarshalIndent(&seed, \"\", \" \")\n\t\terr := ioutil.WriteFile(seedFileName, seedJSON, os.ModePerm)\n\t\tif err != nil {\n\t\t\tutil.PrintUtil(\"ERROR: Error occurred writing updated seed version to %s.\\n%s\\n\",\n\t\t\t\tseedFileName, err.Error())\n\t\t\treturn \"\", errors.New(\"Error updating seed version in manifest.\")\n\t\t}\n\n\t\t// Build Docker image\n\t\tutil.PrintUtil(\"INFO: Building %s\\n\", img)\n\t\tvar buildArgs, dockerCommand = cliutil.DockerCommandArgsInit()\n\t\tbuildArgs = append(buildArgs, \"build\", \"-t\", img, jobDirectory)\n\t\tif util.DockerVersionHasLabel() {\n\t\t\t// Set the seed.manifest.json contents as an image label\n\t\t\tlabel := \"com.ngageoint.seed.manifest=\" + objects.GetManifestLabel(seedFileName)\n\t\t\tbuildArgs = append(buildArgs, \"--label\", label)\n\t\t}\n\t\tutil.PrintUtil(\"INFO: Running Docker command:\\n%s %s\\n\", dockerCommand, strings.Join(buildArgs, \" \"))\n\t\trebuildCmd := exec.Command(dockerCommand, buildArgs...)\n\t\tvar errs bytes.Buffer\n\t\tif util.StdErr != nil {\n\t\t\trebuildCmd.Stderr = io.MultiWriter(util.StdErr, &errs)\n\t\t} else {\n\t\t\trebuildCmd.Stderr = &errs\n\t\t}\n\t\trebuildCmd.Stdout = util.StdErr\n\n\t\t// Run docker build\n\t\trebuildCmd.Run()\n\n\t\t// check for errors on stderr\n\t\tif errs.String() != \"\" {\n\t\t\tutil.PrintUtil(\"ERROR: Error re-building image '%s':\\n%s\\n\",\n\t\t\t\timg, errs.String())\n\t\t\tutil.PrintUtil(\"Exiting seed...\\n\")\n\t\t\treturn \"\", errors.New(errs.String())\n\t\t}\n\n\t\t// Set final image name to tag + image\n\t\torigImg = img\n\t\timg = tag + img\n\t}\n\n\terr := util.Tag(origImg, img)\n\tif err != nil {\n\t\treturn img, err\n\t}\n\n\terr = util.Push(img)\n\tif err != nil {\n\t\treturn img, err\n\t}\n\n\terr = util.RemoveImage(img)\n\tif err != nil {\n\t\treturn img, err\n\t}\n\n\treturn img, nil\n}", "title": "" }, { "docid": "5bbcfa2e723d80d4d526c48460fb3591", "score": "0.5185791", "text": "func TestPublishEnd(t *testing.T) {\n\tPrintTestMessage(\"==========Publish tests end==========\")\n}", "title": "" }, { "docid": "7fcd721e6ffade4236abe12d5c7179ab", "score": "0.51848024", "text": "func (p *Publisher) Publish(sd *SensorData) error {\n\tb, err := json.Marshal(sd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Print(string(b))\n\n\terr = p.c.Publish(&client.PublishOptions{\n\t\tTopicName: []byte(p.Topic),\n\t\tMessage: b,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7db875929905bf44dae06334c1a44a30", "score": "0.51668656", "text": "func (p *Porter) Publish(ctx context.Context, opts PublishOptions) error {\n\tctx, log := tracing.StartSpan(ctx)\n\tdefer log.EndSpan()\n\n\tif opts.ArchiveFile == \"\" {\n\t\treturn p.publishFromFile(ctx, opts)\n\t}\n\treturn p.publishFromArchive(ctx, opts)\n}", "title": "" }, { "docid": "669185ec5bdd42d190fbbfccbb24d6da", "score": "0.5164766", "text": "func (s *Client) Publish(projectPath, domain string) error {\n\tfmt.Println(fmt.Sprintf(\"publish %s -> %s\", projectPath, domain))\n\n\tfullProjectPath, err := filepath.Abs(projectPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(fullProjectPath)\n\n\tzipPath, err := filepath.Abs(\"./publish.zip\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutputFile, err := os.Create(zipPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tzip.Archive(fullProjectPath, outputFile, func(archivePath string) {\n\t\tfmt.Println(archivePath)\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "e1e94726a3a5ae961fab23eb4c525f18", "score": "0.515863", "text": "func publishSimpleEvent(source string, event string) {\n\tservices.PublishEvent(eventsModel.Event{\n\t\tDate: time.Now(),\n\t\tSource: source,\n\t\tTypeOfMessage: \"download\",\n\t})\n}", "title": "" }, { "docid": "bc4564f3ded71661b2c4def46ba151da", "score": "0.51460373", "text": "func (cs *ChainSubscription) Publish(block *Block) error {\n\tblockBytes, err := json.Marshal(block)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// fmt.Fprintf(f, string(blockBytes))\n\t// cs.self.\n\treturn cs.topic.Publish(cs.ctx, blockBytes)\n}", "title": "" }, { "docid": "d822eb5fb3cc8896d91032e30aafb9f5", "score": "0.51440406", "text": "func Publish(payload interface{}, serviceUrl string) bool {\n\tjsonBytes, err := ConvertStructToJSON(payload)\n\tif err != nil {\n\t\treturn false\n\t}\n\tstatus := publishJson(jsonBytes, serviceUrl, true)\n\tif !status {\n\t\tlog.WithField(\"payload\", string(jsonBytes)).WithField(\"url\", serviceUrl).Warning(\"Unable to publish metrics\")\n\t}\n\treturn status\n}", "title": "" }, { "docid": "afafe97f982b33f9ae85c5065cbe2025", "score": "0.51322097", "text": "func (t *EventService) Publish(request *PublishRequest) (*PublishResponse, error) {\n\trsp := &PublishResponse{}\n\treturn rsp, t.client.Call(\"event\", \"Publish\", request, rsp)\n}", "title": "" }, { "docid": "b433f64de798260edaec9c7647007acf", "score": "0.51291746", "text": "func (j *Journey) Publish(assets map[string]string, awsConfig *aws.Config) error {\n\tsess, err := session.NewSession(awsConfig)\n\tif err != nil {\n\t\tlog.Println(\"Error creating AWS session \", err)\n\t\treturn err\n\t}\n\n\t// check to make sure a directory in S3 does not exist with the Version\n\tif ok, err := j.ValidateVersionNotUsed(sess); !ok {\n\t\treturn err\n\t}\n\tlog.Printf(\"Version %v/%v is NOT being used already\", j.Name, j.Version)\n\n\t// Create an uploader with the session and default options\n\tuploader := s3manager.NewUploader(sess)\n\n\turls := j.BuildJourneyUrls(assets)\n\n\tlog.Printf(\"Getting ready to upload %v files...\", len(assets)+2)\n\tvar wg sync.WaitGroup\n\twg.Add(len(assets) + 3)\n\n\tfor _, v := range assets {\n\t\tgo uploadToS3(j.Bucket, j.GetAssetPath(v), j.GetAssetKey(v), uploader, &wg)\n\t}\n\n\t// make sure to put the journey.json, and asset-manifest.json file into {bucket}/{name}/{version}/\n\tgo uploadToS3(j.Bucket, j.Manifest, j.GetAssetKey(\"asset-manifest.json\"), uploader, &wg)\n\tgo uploadToS3(j.Bucket, j.JourneyPath, j.GetAssetKey(\"journey.json\"), uploader, &wg)\n\tgo urls.Publish(j, uploader, &wg)\n\twg.Wait()\n\n\treturn nil\n}", "title": "" }, { "docid": "37531de7e082d18511f1e847d6b810fa", "score": "0.5123092", "text": "func (p *localPubSub) Publish(publication *Publication, opts ...PubSubOptPublish) error {\n\n\tp.publications <- publication\n\n\treturn nil\n}", "title": "" }, { "docid": "92ddd569a2b0e83b90e93f6c51c48cfa", "score": "0.5116232", "text": "func (mba *Mba) PublishPulsa(req *Request) error {\n\tlog.Printf(\"isi pulsa mba code: %s data: %s publishCode: %s\", mba.Code, mba.Data, req.PublishCode)\n\treturn nil\n}", "title": "" }, { "docid": "c01fd2acd1cf08f52aa325c2a7bd09d8", "score": "0.51146275", "text": "func pushImage() {\n log.Infoln(\"Registering target image...\")\n err := dockerClient.Push(cfg.ImageTag())\n checkErr(err, \"Error registering Docker image\")\n}", "title": "" }, { "docid": "bb8c7f0d8515748d64edb43a4c05fbec", "score": "0.5097836", "text": "func (ps *PubSub) Publish(v interface{}) {\n\tps.up.Lock()\n\tdefer ps.up.Unlock()\n\tif ps.up.src == nil {\n\t\tpanic(\"publish after close\")\n\t}\n\tps.up.src <- v\n}", "title": "" }, { "docid": "c69b8f73562df13be83d3ae8036a769a", "score": "0.50966096", "text": "func (d *driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) { // nolint:gocognit,maintidx\n\t// Check arguments\n\tif req.GetVolumeCapability() == nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume capability must be provided\")\n\t}\n\n\tif req.GetStagingTargetPath() == \"\" {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Staging Target Path must be provided\")\n\t}\n\n\tif len(req.GetVolumeId()) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume ID must be provided\")\n\t}\n\n\tif len(req.GetTargetPath()) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Target path must be provided\")\n\t}\n\n\td.log.Info(\"node publish volume called\", field.Fields{\n\t\t\"volume_id\": req.VolumeId,\n\t\t\"staging_target_path\": req.StagingTargetPath,\n\t\t\"target_path\": req.TargetPath,\n\t\t\"method\": \"node_publish_volume\",\n\t})\n\n\ttargetPath := req.GetTargetPath()\n\n\tif req.GetVolumeCapability().GetBlock() != nil &&\n\t\treq.GetVolumeCapability().GetMount() != nil {\n\n\t\treturn nil, status.Error(codes.InvalidArgument, \"cannot have both block and mount access type\")\n\t}\n\n\tvol, err := getVolumeByID(req.GetVolumeId())\n\tif err != nil {\n\t\treturn nil, status.Error(codes.NotFound, err.Error())\n\t}\n\n\tif req.GetVolumeCapability().GetBlock() != nil { // nolint:nestif\n\t\tif vol.VolAccessType != blockAccess {\n\t\t\treturn nil, status.Error(codes.InvalidArgument, \"cannot publish a non-block volume as block volume\")\n\t\t}\n\n\t\tvolPathHandler := volumepathhandler.VolumePathHandler{}\n\n\t\t// Get loop device from the volume path.\n\t\tloopDevice, err := volPathHandler.GetLoopDevice(vol.VolPath)\n\t\tif err != nil {\n\t\t\treturn nil, status.Error(codes.Internal, fmt.Sprintf(\"failed to get the loop device: %v\", err))\n\t\t}\n\n\t\tmounter := mount.New(\"\")\n\n\t\t// Check if the target path exists. Create if not present.\n\t\t_, err = os.Lstat(targetPath)\n\t\tif os.IsNotExist(err) {\n\t\t\tif err = mounter.Mount(\"\", targetPath, \"nfs\", []string{}); err != nil {\n\t\t\t\treturn nil, status.Error(codes.Internal, fmt.Sprintf(\"failed to create target path: %s: %v\", targetPath, err))\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, status.Errorf(codes.Internal, \"failed to check if the target block file exists: %v\", err)\n\t\t}\n\n\t\t// Check if the target path is already mounted. Prevent remounting.\n\t\tnotMount, err := mounter.IsLikelyNotMountPoint(targetPath)\n\t\tif err != nil {\n\t\t\tif !os.IsNotExist(err) {\n\t\t\t\treturn nil, status.Errorf(codes.Internal, \"error checking path %s for mount: %s\", targetPath, err)\n\t\t\t}\n\t\t\tnotMount = true\n\t\t}\n\t\tif !notMount {\n\t\t\t// It's already mounted.\n\t\t\td.log.InfoWithContext(ctx, fmt.Sprintf(\"Skipping bind-mounting subpath %s: already mounted\", targetPath))\n\t\t\treturn &csi.NodePublishVolumeResponse{}, nil\n\t\t}\n\n\t\toptions := []string{\"bind\"}\n\t\tif err := mount.New(\"\").Mount(loopDevice, targetPath, \"\", options); err != nil {\n\t\t\treturn nil, status.Error(codes.Internal, fmt.Sprintf(\"failed to mount block device: %s at %s: %v\", loopDevice, targetPath, err))\n\t\t}\n\t} else if req.GetVolumeCapability().GetMount() != nil {\n\t\tif vol.VolAccessType != mountAccess {\n\t\t\treturn nil, status.Error(codes.InvalidArgument, \"cannot publish a non-mount volume as mount volume\")\n\t\t}\n\n\t\tnotMnt, err := mount.New(\"\").IsLikelyNotMountPoint(targetPath)\n\t\tif err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\tif err = os.MkdirAll(targetPath, 0o750); err != nil { // nolint:gomnd\n\t\t\t\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t\t\t\t}\n\t\t\t\tnotMnt = true\n\t\t\t} else {\n\t\t\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t\t\t}\n\t\t}\n\n\t\tif !notMnt {\n\t\t\treturn &csi.NodePublishVolumeResponse{}, nil\n\t\t}\n\n\t\tfsType := req.GetVolumeCapability().GetMount().GetFsType()\n\n\t\tdeviceId := \"\"\n\t\tif req.GetPublishContext() != nil {\n\t\t\tdeviceId = req.GetPublishContext()[deviceID]\n\t\t}\n\n\t\treadOnly := req.GetReadonly()\n\t\tvolumeId := req.GetVolumeId()\n\t\tattrib := req.GetVolumeContext()\n\t\tmountFlags := req.GetVolumeCapability().GetMount().GetMountFlags()\n\n\t\td.log.InfoWithContext(ctx, fmt.Sprintf(\"target %v\\nfstype %v\\ndevice %v\\nreadonly %v\\nvolumeId %v\\nattributes %v\\nmountflags %v\\n\",\n\t\t\ttargetPath, fsType, deviceId, readOnly, volumeId, attrib, mountFlags))\n\n\t\toptions := []string{\"bind\"}\n\t\tif readOnly {\n\t\t\toptions = append(options, \"ro\")\n\t\t}\n\t\tmounter := mount.New(\"\")\n\t\tpath := getVolumePath(volumeId)\n\n\t\terr = mounter.Mount(path, targetPath, \"\", options)\n\t\tif err != nil {\n\t\t\tvar errList strings.Builder\n\t\t\terrList.WriteString(err.Error()) // nolint:errcheck\n\n\t\t\treturn nil, status.Error(codes.Internal, fmt.Sprintf(\"failed to mount device: %s at %s: %s\", path, targetPath, errList.String()))\n\t\t}\n\t}\n\n\td.log.Info(\"bind mounting the volume is finished\")\n\n\treturn &csi.NodePublishVolumeResponse{}, nil\n}", "title": "" }, { "docid": "4da708b55b318729de95b0a609cd2304", "score": "0.5096036", "text": "func nsqPublish() {\n\tvar (\n\t\terr error\n\t\tmqWriterVibo *nsq.Producer = nil\n\t)\n\twcfg := nsq.NewConfig()\n\tViboEventTopicServer := \"192.168.100.235:4151\"\n\n\tmqWriterVibo, err = nsq.NewProducer(ViboEventTopicServer, wcfg)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer mqWriterVibo.Stop()\n\tei := \"test\"\n\tbs, err := json.Marshal(ei)\n\tpubTopic := \"vibo_events\"\n\tif mqWriterVibo != nil {\n\t\terr = mqWriterVibo.Publish(pubTopic, bs)\n\t\tfmt.Println(\"err is:\", err)\n\t\tfmt.Println(\"yes\")\n\t}\n}", "title": "" }, { "docid": "24fd7e5e569a96bdf2597686f1c4a4e7", "score": "0.50959605", "text": "func (p *plugin) PublishVolume(ctx context.Context, v *api.Volume, nodeID string) (map[string]string, error) {\n\tif !p.publisher {\n\t\treturn nil, nil\n\t}\n\tcsiNodeID := p.swarmToCSI[nodeID]\n\tif csiNodeID == \"\" {\n\t\tlog.L.Errorf(\"CSI node ID not found for given Swarm node ID. Plugin: %s , Swarm node ID: %s\", p.name, nodeID)\n\t\treturn nil, status.Error(codes.FailedPrecondition, \"CSI node ID not found for given Swarm node ID\")\n\t}\n\n\treq := p.makeControllerPublishVolumeRequest(v, nodeID)\n\tc, err := p.Client(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := c.ControllerPublishVolume(ctx, req)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.PublishContext, nil\n}", "title": "" }, { "docid": "698e2620412d29ddbac1847d60c078a3", "score": "0.5095418", "text": "func (publisher *MqttPublisher) Publish(data []byte, topic string) error {\n\tif token := publisher.client.Publish(topic, 2, false, data); token.Wait() && token.Error() != nil {\n\t\treturn token.Error()\n\t}\n\tfmt.Println(\"Message Published\")\n\treturn nil\n}", "title": "" }, { "docid": "039a905413e5ddf1de602f7b8a34207b", "score": "0.50849694", "text": "func (p *Publisher) Publish(ctx context.Context, payload []byte) (err error) {\n\tevt := &consulapi.UserEvent{\n\t\tID: uuid.NewString(),\n\t\tName: p.config.Topic,\n\t\tPayload: payload,\n\t\tNodeFilter: p.config.NodeFilter,\n\t\tServiceFilter: p.config.ServiceFilter,\n\t\tTagFilter: p.config.TagFilter,\n\t\tVersion: p.config.Version,\n\t}\n\n\tp.logger.Debug(\"publishing event %s to topic %s\", evt.ID, evt.Name)\n\tif _, _, err = p.client.Consul().Event().Fire(evt, &consulapi.WriteOptions{}); err != nil {\n\t\tp.logger.Error(\"failed to publish event %s to topic %s on publisher %s: %s\", evt.ID, evt.Name, p.name, err)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "dcd0a6f1f854d07d293d871125e8d770", "score": "0.5078744", "text": "func (b NopBackend) Publish(ctx context.Context, message []byte) error {\n\treturn nil\n}", "title": "" }, { "docid": "e6628246913fd06c72ca048afc79e1ca", "score": "0.5070707", "text": "func (p *PahoMqttPublisher) Publish(topic string, payload interface{}) {\n\ttokenResp := p.client.Publish(topic, byte(p.Oos), p.Retain, payload)\n\tif tokenResp.Error() != nil {\n\t\tlog.Fatalf(\"%+v\\n\", tokenResp.Error())\n\t}\n}", "title": "" }, { "docid": "d83ac474b559c5a45bd13c0e1de036bc", "score": "0.5062984", "text": "func (c *Client) Publish(ctx context.Context, e EventOpts) error {\n\tc.once.Do(c.init)\n\n\tif err := e.Metadata.validate(); err != nil {\n\t\treturn err\n\t}\n\n\te.OccurredAt = defaultTime(e.OccurredAt)\n\n\tdata, err := c.JSONEncode(e)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, c.Endpoint, bytes.NewBuffer(data))\n\tif err != nil {\n\t\treturn err\n\t}\n\treq = req.WithContext(ctx)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer \"+c.APIKey)\n\treq.Header.Set(\"User-Agent\", \"workos-go/\"+workos.Version)\n\n\tif e.IdempotencyKey != \"\" {\n\t\treq.Header.Set(\"Idempotency-Key\", e.IdempotencyKey)\n\t}\n\n\tres, err := c.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\treturn workos.TryGetHTTPError(res)\n}", "title": "" }, { "docid": "eddb6841fe4b31e95158e8c02683a168", "score": "0.50597024", "text": "func (pool *Pool) Publish(redisURI, redisQueueName string, data []byte) {\n\tchannel := pool.channel()\n\tchannel <- message{redisURI, redisQueueName, data}\n}", "title": "" }, { "docid": "ff61f6f011792a029cf484e4208df519", "score": "0.5045683", "text": "func (p *Publisher) Publish(ctx context.Context, sub string, data interface{}) error {\n\t_, err := p.send(ctx, subject(p.prefix, sub), data)\n\treturn err\n}", "title": "" }, { "docid": "1b97541e1894db6279fe78067738193f", "score": "0.50413615", "text": "func (b *Broker) Publish(channel string, pp *msg.PubPayload) error {\n\tp, err := json.Marshal(pp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trc := b.Pool.Get()\n\tdefer rc.Close()\n\n\t_, err = rc.Do(\"PUBLISH\", channel, p)\n\treturn err\n}", "title": "" }, { "docid": "1586c6ab8cf8bd434535adc66fbc8f0c", "score": "0.5039309", "text": "func (p *TestProducer) Publish(topic string, value string) error {\n\tp.lastTopic = topic\n\tp.lastValue = value\n\treturn nil\n}", "title": "" }, { "docid": "f85c409f44073bc308113b0d540a7aeb", "score": "0.5038481", "text": "func (bpsc *BasicPubSubCollector) Publish(topic string, payload []byte, opts ...PubOpt) (err error) {\n\n\tbpsc.logger.funcCall(\"debug\", \"publish\", map[string]interface{}{\n\t\t\"topic\": topic,\n\t})\n\n\tvar (\n\t\trqID RequestID\n\t\toptions *PubOpts\n\t\ttosend []byte\n\t)\n\t{\n\t\toptions, err = NewPublishOptions(opts)\n\t}\n\tif err == nil {\n\t\tmyself := bpsc.host.ID()\n\t\treq := &Request{\n\t\t\tControl: pb.RequestControl{\n\t\t\t\tRequester: myself,\n\t\t\t\tSender: myself,\n\t\t\t\tSeqno: atomic.AddUint64(&(bpsc.seqno), 1),\n\t\t\t},\n\t\t\tPayload: payload,\n\t\t}\n\t\trqID = bpsc.ridgen(req)\n\n\t\ttosend, err = req.Marshal()\n\t}\n\tif err == nil {\n\t\t// register notif handler\n\t\tbpsc.reqWorkerPool.AddReqItem(options.RequestContext, rqID, &reqItem{\n\t\t\tfinalHandler: options.FinalRespHandle,\n\t\t\ttopic: topic,\n\t\t})\n\n\t\t// publish marshaled request\n\t\terr = bpsc.apsub.Publish(options.RequestContext, topic, tosend)\n\n\t}\n\n\tif err != nil {\n\t\tbpsc.logger.error(err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b71bf50648047802265bdae57bc0836f", "score": "0.50254977", "text": "func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {\n\td.log.WithFields(logrus.Fields{\n\t\t\"request\": req,\n\t\t\"method\": \"node_publish_volume\",\n\t}).Info(\"node publish volume called\")\n\tif req.StagingTargetPath == \"\" {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"NodePublishVolume Staging Target Path must be provided\")\n\t}\n\n\tif req.TargetPath == \"\" {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"NodePublishVolume Target Path must be provided\")\n\t}\n\n\tif len(req.VolumeContext) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"NodePublishVolume Volume attributes are not provided\")\n\t}\n\n\tpodInfo, err := getPodInfo(req.VolumeContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpodInfo.KubeClient = d.kubeClient\n\tpodInfo.AppClient = d.appClient\n\n\tpodInfo.RefNamespace, podInfo.RefName, err = getAppBindingInfo(req.VolumeContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsource := req.StagingTargetPath\n\ttarget := req.TargetPath\n\tfsType := \"tmpfs\"\n\t//mnt := req.VolumeCapability.GetMount()\n\n\tll := d.log.WithFields(logrus.Fields{\n\t\t\"volume_id\": req.VolumeId,\n\t\t\"source\": source,\n\t\t\"target\": target,\n\t\t\"method\": \"node_publish_volume\",\n\t})\n\topts := []string{\"rw\"}\n\tmounted, err := d.mounter.IsMounted(source, target)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !mounted {\n\t\tll.Info(\"mounting the volume\")\n\t\tif err := d.mounter.Mount(\"tmpfs\", target, fsType, opts...); err != nil {\n\t\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t\t}\n\t} else {\n\t\tll.Info(\"volume is already mounted\")\n\t}\n\n\toptions := req.VolumeContext\n\n\t// login with policy token\n\n\tauthClient, err := util.NewVaultClient(podInfo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tengineName, ok := options[SecretEngineKey]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"Empty engine name\")\n\t}\n\n\tnow := time.Now()\n\tsecretData, err := util.FetchSecret(engineName, authClient, options, target)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvaultFetchSecretDurations.Observe(float64(time.Since(now).Nanoseconds() / int64(time.Microsecond)))\n\tvaultFetchSecretTotal.WithLabelValues(req.VolumeId, \"Fetch\").Inc()\n\n\tll.Info(\"mounting the volume with ro\")\n\tif err := d.mounter.Mount(\"tmpfs\", target, fsType, []string{\"remount,ro\"}...); err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tif _, found := d.ch[req.VolumeId]; !found {\n\t\tif secretData.Renewable {\n\t\t\tvaultFetchSecretTotal.WithLabelValues(req.VolumeId, \"Renew\").Inc()\n\t\t\tstart := time.Now()\n\t\t\trenewer, err := util.SetRenewal(authClient, secretData)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\td.ch[req.VolumeId] = renewer\n\n\t\t\tvaultRenewDurations.Observe(float64(time.Since(start).Nanoseconds() / int64(time.Microsecond)))\n\t\t}\n\t}\n\tnodeVolumeTotal.WithLabelValues(req.VolumeId, \"publish\").Inc()\n\n\tll.Info(\"bind mounting the volume is finished\")\n\treturn &csi.NodePublishVolumeResponse{}, nil\n}", "title": "" }, { "docid": "9b9eddaed3fe8bd0e82ae41701bfaa1a", "score": "0.50234634", "text": "func (e *Type) Publish(ctx context.Context, evt *types.Event) {\n\te.logger.Debug(\"publish event\", zap.String(\"event\", evt.Topic.String()))\n\tevt.Time = gutils.Clock.GetUTCNow()\n\tevt.Stack = string(debug.Stack())\n\n\tif e.mq != nil {\n\t\t// put event into mq\n\t\te.taskChan <- &eventRunChanItem{\n\t\t\th: e.put2mq,\n\t\t\thid: handlerIDput2mq,\n\t\t\tevt: evt,\n\t\t}\n\t\treturn\n\t}\n\n\te.triggerHandler(evt)\n}", "title": "" }, { "docid": "08463445b08c15f59ed1e6bcfcaaab95", "score": "0.5018932", "text": "func (bs *BusinessServer) PublishRelease(ctx context.Context, req *pb.PublishReleaseReq) (*pb.PublishReleaseResp, error) {\n\trtime := time.Now()\n\tlogger.V(2).Infof(\"PublishRelease[%d]| input[%+v]\", req.Seq, req)\n\tresponse := &pb.PublishReleaseResp{Seq: req.Seq, ErrCode: pbcommon.ErrCode_E_OK, ErrMsg: \"OK\"}\n\n\tdefer func() {\n\t\tcost := bs.collector.StatRequest(\"PublishRelease\", response.ErrCode, rtime, time.Now())\n\t\tlogger.V(2).Infof(\"PublishRelease[%d]| output[%dms][%+v]\", req.Seq, cost, response)\n\t}()\n\n\taction := releaseaction.NewPublishAction(bs.viper, bs.dataMgrCli, bs.bcsControllerCli, bs.gseControllerCli, req, response)\n\tbs.executor.Execute(action)\n\n\treturn response, nil\n}", "title": "" }, { "docid": "2ce56eead13ee797ea314c7609d11dfc", "score": "0.50097054", "text": "func (s *mysqlPublisher) Publish(contentType string, content []byte, cfg map[string]ctypes.ConfigValue) error {\n\tlogger := log.New()\n\tlogger.Println(\"Publishing started\")\n\tvar metrics []plugin.MetricType\n\n\tswitch contentType {\n\tcase plugin.SnapGOBContentType:\n\t\tdec := gob.NewDecoder(bytes.NewBuffer(content))\n\t\tif err := dec.Decode(&metrics); err != nil {\n\t\t\tlogger.Printf(\"Error decoding: error=%v content=%v\", err, content)\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\tlogger.Printf(\"Error unknown content type '%v'\", contentType)\n\t\treturn errors.New(fmt.Sprintf(\"Unknown content type '%s'\", contentType))\n\t}\n\n\tif err := s.init(cfg); err != nil {\n\t\ts.db.Close()\n\t}\n\n\tfor _, m := range metrics {\n\t\tkey := sliceToString(m.Namespace().Strings())\n\t\tvalue, err := interfaceToString(m.Data())\n\t\tif err != nil {\n\t\t\tlogger.Printf(\"Error: Cannot convert incoming data to string, err=%v\", err)\n\t\t\treturn err\n\t\t}\n\t\t_, err = s.dbInsertStmt.Exec(m.Timestamp(), m.Tags()[core.STD_TAG_PLUGIN_RUNNING_ON], key, value)\n\t\tif err != nil {\n\t\t\tlogger.Printf(\"Error: Cannot publish incoming metric to mysql db, err=%v\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a6ed2f344fa14ccc49fcb9362015c1cc", "score": "0.5009565", "text": "func (m *MeasurementsRunner) OnPublish(c *centrifuge.Client, e centrifuge.PublishEvent) (centrifuge.PublishReply, error) {\n\treturn centrifuge.PublishReply{\n\t\tOptions: centrifuge.PublishOptions{},\n\t}, nil\n}", "title": "" }, { "docid": "d1949c00e529d6ce2930322a3dcf772c", "score": "0.5005398", "text": "func (publisher *EventPublisher) Publish(name string, data interface{}) *EventPublisher {\n\t// JSON encoding the event data\n\tjsonData, err := json.Marshal(data)\n\tpublisher.processError(err)\n\n\t// Publishing the event for all the registered upstream queues\n\tfor _, queue := range publisher.Config.UpstreamQueues {\n\t\tif queue != \"\" {\n\t\t\t// Preparing event data\n\t\t\tevent := &tasks.Signature{RoutingKey: queue, Name: name, Args: []tasks.Arg{{Type: \"string\", Value: string(jsonData)}}}\n\n\t\t\t// Attempting to trigger the event\n\t\t\t_, err = publisher.Server.SendTask(event)\n\t\t\tpublisher.processError(err)\n\t\t}\n\t}\n\n\treturn publisher\n}", "title": "" }, { "docid": "b726751054abe4026b8f31887a933588", "score": "0.49852392", "text": "func (e *eventer) Publish(name string, data interface{}) {\n\tevt := NewEvent(name, data)\n\te.in <- evt\n}", "title": "" }, { "docid": "9845b6f61482569aa4234d358f0390a6", "score": "0.49814475", "text": "func Publish(ctx context.Context, taskURI, messageID, eventType, taskMessage string) {\n\ttopicName := config.Data.MessageBusConf.OdimControlMessageQueue\n\tk, err := dc.Communicator(config.Data.MessageBusConf.MessageBusType, config.Data.MessageBusConf.MessageBusConfigFilePath, topicName)\n\tif err != nil {\n\t\tl.LogWithFields(ctx).Error(\"Unable to connect to \" + config.Data.MessageBusConf.MessageBusType + \" \" + err.Error())\n\t\treturn\n\t}\n\n\tvar eventID = uuid.NewV4().String()\n\tvar event = common.Event{\n\t\tEventID: eventID,\n\t\tMessageID: messageID,\n\t\tEventTimestamp: time.Now().Format(time.RFC3339),\n\t\tEventType: eventType,\n\t\tMessage: taskMessage,\n\t\tOriginOfCondition: &common.Link{\n\t\t\tOid: taskURI,\n\t\t},\n\t\tSeverity: \"OK\",\n\t}\n\tvar events = []common.Event{event}\n\tvar messageData = common.MessageData{\n\t\tName: \"Task Event\",\n\t\tContext: \"/redfish/v1/$metadata#Event.Event\",\n\t\tOdataType: common.EventType,\n\t\tEvents: events,\n\t}\n\tdata, _ := json.Marshal(messageData)\n\tvar mbevent = common.Events{\n\t\tIP: \"TasksCollection\",\n\t\tRequest: data,\n\t}\n\n\tif err := k.Distribute(mbevent); err != nil {\n\t\tl.LogWithFields(ctx).Error(\"TaskURI:\" + taskURI + \", EventID:\" + eventID + \", MessageID:\" + messageID + \" : unable to publish the event to message bus: \" + err.Error())\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "0fd4fc8682dc9c40dbca840c937ec471", "score": "0.49691424", "text": "func (m *serviceManager) devicePublish(dState *deviceState, subtopic string, payload interface{}) {\n\ttopic := dState.topic + \"/\" + subtopic\n\tm.c.Publish(topic, payload)\n}", "title": "" }, { "docid": "059af5c199442204839ea567f64349f5", "score": "0.4965571", "text": "func (ts *TxnStream) Publish(txnToPub node.Txn) error {\n txBytes := txnToPub.MarshalTx()\n fmt.Println(\"publishing txn: \", txnToPub.TxnID)\n\n return ts.topic.Publish(ts.ctx, txBytes);\n}", "title": "" }, { "docid": "6a6bb8e23c3771fc37ef3fde3548b69a", "score": "0.49654433", "text": "func TestPushBusyboxImage(t *testing.T) {\n\tdefer setupRegistry(t)()\n\n\trepoName := fmt.Sprintf(\"%v/dockercli/busybox\", privateRegistryURL)\n\t// tag the image to upload it tot he private registry\n\ttagCmd := exec.Command(dockerBinary, \"tag\", \"busybox\", repoName)\n\tif out, _, err := runCommandWithOutput(tagCmd); err != nil {\n\t\tt.Fatalf(\"image tagging failed: %s, %v\", out, err)\n\t}\n\tdefer deleteImages(repoName)\n\n\tpushCmd := exec.Command(dockerBinary, \"push\", repoName)\n\tif out, _, err := runCommandWithOutput(pushCmd); err != nil {\n\t\tt.Fatalf(\"pushing the image to the private registry has failed: %s, %v\", out, err)\n\t}\n\tlogDone(\"push - busybox to private registry\")\n}", "title": "" }, { "docid": "11cfc7c422853d6abc8a6bf6c024fd6b", "score": "0.4965224", "text": "func (o CustomImagePropertiesFromPlanOutput) Publisher() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CustomImagePropertiesFromPlan) *string { return v.Publisher }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "977b519c5b9b6d84022b9179bd05fdab", "score": "0.49635765", "text": "func (h *DashboardHandler) publish(event dashboardEvent) error {\n\tmsg, err := json.Marshal(event)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = h.Publisher(\"grafinsight/dashboard/uid/\"+event.UID, msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn h.Publisher(\"grafinsight/dashboard/changes\", msg)\n}", "title": "" }, { "docid": "09030e60b919222c8b03a9df8aa04730", "score": "0.49617437", "text": "func (m *MockHost) Publish(ctx context.Context, privateKey crypto.PrivKey, cipherKey []byte, bucket, filename string, blockMap interfaces.BlockMap, mtime time.Time, size int64) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Publish\", ctx, privateKey, cipherKey, bucket, filename, blockMap, mtime, size)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "48caf1fba8071f2bc1e754a5c7365294", "score": "0.4959416", "text": "func Publish(chartName, homeDir string, force bool) {\n\n\tsrc := path.Join(homeDir, WorkspaceChartPath, chartName)\n\tdst := path.Join(homeDir, CacheChartPath, chartName)\n\n\tif _, err := os.Stat(dst); err == nil {\n\t\tif force != true {\n\t\t\tlog.Info(\"chart already exists, use -f to force\")\n\t\t\treturn\n\t\t}\n\t}\n\n\tif err := copyDir(src, dst); err != nil {\n\t\tlog.Die(\"failed to publish directory: %v\", err)\n\t}\n}", "title": "" }, { "docid": "20785d16ef5ad0118c84e5df835f09d0", "score": "0.49587804", "text": "func (n TeamsNotifier) Publish(payload []byte) {\n\tresp, err := http.Post(n.webhookURL, \"application/json\", bytes.NewReader(payload))\n\tif err != nil {\n\t\tfmt.Println(\"Error while publishing to MS Teams: \" + err.Error())\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != 200 {\n\t\tbz, _ := ioutil.ReadAll(resp.Body)\n\t\tfmt.Printf(\"Error while publishing to MS Teams: %d_%s: %s\\n\", resp.StatusCode, resp.Status, string(bz))\n\t}\n}", "title": "" }, { "docid": "9adb8842f464fb3046a3b7386206bc17", "score": "0.49580178", "text": "func (c *Centrifugo) Publish(channel string, payload []byte) (bool, error) {\n\tok, err := c.Client.Publish(channel, payload)\n\treturn ok, err\n}", "title": "" }, { "docid": "47d4ccf1053ac5c7efbd514f30085b9a", "score": "0.4957805", "text": "func runPublish(options *globalOptions, args []string) error {\n\tvar (\n\t\taddress = args[0]\n\t\texchange = args[1]\n\t\troutingKey = args[2]\n\t\tbody = args[3]\n\t)\n\n\tuser, password := getOrReadInCredentials(options)\n\n\tbuneary := buneary{\n\t\tconfig: &AMQPConfig{\n\t\t\tAddress: address,\n\t\t\tUser: user,\n\t\t\tPassword: password,\n\t\t},\n\t}\n\n\tmessage := Message{\n\t\tTarget: Exchange{Name: exchange},\n\t\tRoutingKey: routingKey,\n\t\tBody: []byte(body),\n\t}\n\n\tif err := buneary.PublishMessage(message); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c75f05aa08eedd9687ec03c87762f4a6", "score": "0.49575886", "text": "func (StatMgr *OpenOltStatisticsMgr) publishMetrics(ctx context.Context, statType string, val map[string]float32,\n\tport *voltha.Port, devID string, devType string) {\n\tlogger.Debugw(ctx, \"publish-metrics\",\n\t\tlog.Fields{\n\t\t\t\"port\": port.Label,\n\t\t\t\"metrics\": val})\n\n\tvar metricInfo voltha.MetricInformation\n\tvar ke voltha.KpiEvent2\n\tvar volthaEventSubCatgry voltha.EventSubCategory_Types\n\tmetricsContext := make(map[string]string)\n\tmetricsContext[\"oltid\"] = devID\n\tmetricsContext[\"devicetype\"] = devType\n\tmetricsContext[\"portlabel\"] = port.Label\n\n\tif statType == NNIStats {\n\t\tvolthaEventSubCatgry = voltha.EventSubCategory_NNI\n\t} else if statType == PONStats {\n\t\tvolthaEventSubCatgry = voltha.EventSubCategory_PON\n\t} else if statType == GEMStats || statType == ONUStats {\n\t\tvolthaEventSubCatgry = voltha.EventSubCategory_ONT\n\t}\n\n\traisedTs := time.Now().Unix()\n\tmmd := voltha.MetricMetaData{\n\t\tTitle: statType,\n\t\tTs: float64(raisedTs),\n\t\tContext: metricsContext,\n\t\tDeviceId: devID,\n\t}\n\n\tmetricInfo.Metadata = &mmd\n\tmetricInfo.Metrics = val\n\n\tke.SliceData = []*voltha.MetricInformation{&metricInfo}\n\tke.Type = voltha.KpiEventType_slice\n\tke.Ts = float64(raisedTs)\n\n\tif err := StatMgr.Device.EventProxy.SendKpiEvent(ctx, \"STATS_PUBLISH_EVENT\", &ke, voltha.EventCategory_EQUIPMENT, volthaEventSubCatgry, raisedTs); err != nil {\n\t\tlogger.Errorw(ctx, \"failed-to-send-stats\", log.Fields{\"err\": err})\n\t}\n}", "title": "" }, { "docid": "682f158839f538f8896c307b4b07c07b", "score": "0.49529782", "text": "func (provider *ContainerStorageProvider) PublishVolume(id, hostUUID, accessProtocol string) (*model.PublishInfo, error) {\n\tresponse := &model.PublishInfo{}\n\tvar errorResponse *ErrorsPayload\n\n\tpublishOptions := &model.PublishOptions{\n\t\tHostUUID: hostUUID,\n\t\tAccessProtocol: accessProtocol,\n\t}\n\n\tstatus, err := provider.invoke(\n\t\t&connectivity.Request{\n\t\t\tAction: \"PUT\",\n\t\t\tPath: fmt.Sprintf(\"/containers/v1/volumes/%s/actions/publish\", id),\n\t\t\tPayload: &publishOptions,\n\t\t\tResponse: &response,\n\t\t\tResponseError: &errorResponse,\n\t\t},\n\t)\n\tif errorResponse != nil {\n\t\treturn nil, handleError(status, errorResponse)\n\t}\n\n\treturn response, err\n}", "title": "" }, { "docid": "440ba84aed51a6720792c7890ee0b9a4", "score": "0.4950193", "text": "func publish(msg LogFormat) {\n\t// fill in the common fields\n\thostname, _ := os.Hostname()\n\tmsg.Host = hostname\n\tmsg.Time = time.Now()\n\tmsg.Prefix = _prefix\n\n\t// Determine caller func\n\tpc, _, lineno, ok := runtime.Caller(2)\n\tif ok {\n\t\tmsg.Caller = runtime.FuncForPC(pc).Name()\n\t\tmsg.LineNo = lineno\n\t}\n\n\t// pack message\n\tpack, err := json.Marshal(msg)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\n\t// post to nsqd\n\tresp, err := http.Post(_pub_addr, MIME, bytes.NewReader(pack))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n}", "title": "" }, { "docid": "114595f515f7720a219029236905d886", "score": "0.49472216", "text": "func (s *Service) Publish() error {\n\tsvc := *s3.New(s.session)\n\n\tf, err := fs.GetSite()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuploadRequests, err := getS3Inputs(s.Bucket, f)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, req := range uploadRequests {\n\t\t_, err := svc.PutObject(req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "82dd7da4a1f89a36aa0123784872b400", "score": "0.49455616", "text": "func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {\n\t// check target mount path\n\tsourcePath := req.StagingTargetPath\n\n\tif valid, err := utils.ValidateRequest(req.VolumeContext); !valid {\n\t\tmsg := fmt.Sprintf(\"NodePublishVolume: failed to check request args: %v\", err)\n\t\tlog.Log.Errorf(msg)\n\t\treturn nil, status.Error(codes.InvalidArgument, msg)\n\t}\n\n\t// running in runc/runv mode\n\tif GlobalConfigVar.RunTimeClass == MixRunTimeMode {\n\t\t// if target path mounted already, return\n\t\tif utils.IsMounted(req.TargetPath) {\n\t\t\tlog.Log.Infof(\"NodePublishVolume: TargetPath(%s) is mounted, not need mount again\", req.TargetPath)\n\t\t\treturn &csi.NodePublishVolumeResponse{}, nil\n\t\t}\n\n\t\t// check pod runtime\n\t\tif runtime, err := utils.GetPodRunTime(req, ns.clientSet); err != nil {\n\t\t\treturn nil, status.Errorf(codes.Internal, \"NodePublishVolume: cannot get pod runtime: %v\", err)\n\t\t} else if runtime == RunvRunTimeMode {\n\t\t\tlog.Log.Infof(\"NodePublishVolume:: Kata Disk Volume %s Mount with: %v\", req.VolumeId, req)\n\t\t\t// umount the stage path, which is mounted in Stage (tmpfs)\n\t\t\tif err := ns.unmountStageTarget(sourcePath); err != nil {\n\t\t\t\tlog.Log.Errorf(\"NodePublishVolume(runv): unmountStageTarget %s with error: %s\", sourcePath, err.Error())\n\t\t\t\treturn nil, status.Error(codes.InvalidArgument, \"NodePublishVolume: unmountStageTarget \"+sourcePath+\" with error: \"+err.Error())\n\t\t\t}\n\t\t\tdevicePaths, err := GetDeviceByVolumeID(req.VolumeId)\n\t\t\tdeviceName, _, err := GetRootSubDevicePath(devicePaths)\n\t\t\tif err != nil && len(devicePaths) == 0 {\n\t\t\t\tdeviceName = getVolumeConfig(req.VolumeId)\n\t\t\t}\n\t\t\tif deviceName == \"\" {\n\t\t\t\tlog.Log.Errorf(\"NodePublishVolume(runv): cannot get local deviceName for volume: %s\", req.VolumeId)\n\t\t\t\treturn nil, status.Error(codes.InvalidArgument, \"NodePublishVolume: cannot get local deviceName for volume: \"+req.VolumeId)\n\t\t\t}\n\n\t\t\t// save volume info to local file\n\t\t\tmountFile := filepath.Join(req.GetTargetPath(), utils.CsiPluginRunTimeFlagFile)\n\t\t\tif err := utils.CreateDest(req.GetTargetPath()); err != nil {\n\t\t\t\tlog.Log.Errorf(\"NodePublishVolume(runv): Create Dest %s error: %s\", req.GetTargetPath(), err.Error())\n\t\t\t\treturn nil, status.Error(codes.InvalidArgument, \"NodePublishVolume(runv): Create Dest \"+req.GetTargetPath()+\" with error: \"+err.Error())\n\t\t\t}\n\n\t\t\tqResponse := QueryResponse{}\n\t\t\tqResponse.device = deviceName\n\t\t\tqResponse.identity = req.GetTargetPath()\n\t\t\tqResponse.volumeType = \"block\"\n\t\t\tqResponse.mountfile = mountFile\n\t\t\tqResponse.runtime = RunvRunTimeMode\n\t\t\tif err := utils.WriteJSONFile(qResponse, mountFile); err != nil {\n\t\t\t\tlog.Log.Errorf(\"NodePublishVolume(runv): Write Json File error: %s\", err.Error())\n\t\t\t\treturn nil, status.Error(codes.InvalidArgument, \"NodePublishVolume(runv): Write Json File error: \"+err.Error())\n\t\t\t}\n\t\t\t// save volume status to stage json file\n\t\t\tvolumeStatus := map[string]string{}\n\t\t\tvolumeStatus[\"csi.alibabacloud.com/disk-mounted\"] = \"true\"\n\t\t\tfileName := filepath.Join(filepath.Dir(sourcePath), utils.VolDataFileName)\n\t\t\tif strings.HasSuffix(sourcePath, \"/\") {\n\t\t\t\tfileName = filepath.Join(filepath.Dir(filepath.Dir(sourcePath)), utils.VolDataFileName)\n\t\t\t}\n\t\t\tif err = utils.AppendJSONData(fileName, volumeStatus); err != nil {\n\t\t\t\tlog.Log.Warnf(\"NodePublishVolume: append kata volume attached info to %s with error: %s\", fileName, err.Error())\n\t\t\t}\n\n\t\t\tlog.Log.Infof(\"NodePublishVolume:: Kata Disk Volume %s Mount Successful\", req.VolumeId)\n\t\t\treturn &csi.NodePublishVolumeResponse{}, nil\n\t\t}\n\t}\n\n\tisBlock := req.GetVolumeCapability().GetBlock() != nil\n\tif isBlock {\n\t\tsourcePath = filepath.Join(req.StagingTargetPath, req.VolumeId)\n\t}\n\ttargetPath := req.GetTargetPath()\n\tlog.Log.Infof(\"NodePublishVolume: Starting Mount Volume %s, source %s > target %s\", req.VolumeId, sourcePath, targetPath)\n\tif req.StagingTargetPath == \"\" {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"NodePublishVolume: Staging Target Path must be provided\")\n\t}\n\t// check if block volume\n\tif isBlock {\n\t\tif !utils.IsMounted(targetPath) {\n\t\t\tif err := ns.mounter.EnsureBlock(targetPath); err != nil {\n\t\t\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t\t\t}\n\t\t\toptions := []string{\"bind\"}\n\t\t\tif err := ns.mounter.MountBlock(sourcePath, targetPath, options...); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tlog.Log.Infof(\"NodePublishVolume: Mount Successful Block Volume: %s, from source %s to target %v\", req.VolumeId, sourcePath, targetPath)\n\t\treturn &csi.NodePublishVolumeResponse{}, nil\n\t}\n\n\tif err := ns.mounter.EnsureFolder(targetPath); err != nil {\n\t\tlog.Log.Errorf(\"NodePublishVolume: create volume %s path %s error: %v\", req.VolumeId, targetPath, err)\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\tnotmounted, err := ns.k8smounter.IsLikelyNotMountPoint(targetPath)\n\tif err != nil {\n\t\tlog.Log.Errorf(\"NodePublishVolume: check volume %s target path %s error: %v\", req.VolumeId, targetPath, err)\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\tif !notmounted {\n\t\tlog.Log.Infof(\"NodePublishVolume: VolumeId: %s, Path %s is already mounted\", req.VolumeId, targetPath)\n\t\treturn &csi.NodePublishVolumeResponse{}, nil\n\t}\n\n\tsourceNotMounted, err := ns.k8smounter.IsLikelyNotMountPoint(sourcePath)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\tif sourceNotMounted {\n\t\tdevicePaths, getDeviceErr := GetDeviceByVolumeID(req.GetVolumeId())\n\t\trootDevice, subDevice, chooseDeviceErr := GetRootSubDevicePath(devicePaths)\n\t\tif getDeviceErr == nil && chooseDeviceErr == nil {\n\t\t\tdevice := ChooseDevice(rootDevice, subDevice)\n\t\t\tif err := ns.mountDeviceToGlobal(req.VolumeCapability, req.VolumeContext, device, sourcePath); err != nil {\n\t\t\t\tlog.Log.Errorf(\"NodePublishVolume: VolumeId: %s, remount disk to global %s error: %s\", req.VolumeId, sourcePath, err.Error())\n\t\t\t\treturn nil, status.Error(codes.Internal, \"NodePublishVolume: VolumeId: %s, remount disk error \"+err.Error())\n\t\t\t}\n\t\t\tlog.Log.Infof(\"NodePublishVolume: SourcePath %s not mounted, and mounted again with device %s\", sourcePath, device)\n\t\t} else {\n\t\t\tlog.Log.Errorf(\"NodePublishVolume: VolumeId: %s, sourcePath %s is Not mounted and device cannot found, getDeviceErr: %v, chooseDeviceErr: %v\", req.VolumeId, sourcePath, getDeviceErr, chooseDeviceErr)\n\t\t\treturn nil, status.Error(codes.Internal, \"NodePublishVolume: VolumeId: %s, sourcePath %s is Not mounted \"+sourcePath)\n\t\t}\n\t}\n\n\t// start to mount\n\tmnt := req.VolumeCapability.GetMount()\n\toptions := append(mnt.MountFlags, \"bind\")\n\tlog.Log.Infof(\"NodePublishVolume: VolumeCapability.MountFlags: %+v, req.ReadOnly: %+v\", mnt.MountFlags, req.Readonly)\n\tif req.Readonly {\n\t\toptions = append(options, \"ro\")\n\t}\n\tfsType := \"ext4\"\n\tif mnt.FsType != \"\" {\n\t\tfsType = mnt.FsType\n\t}\n\n\t// check device name available\n\tdevicePaths := GetVolumeDeviceName(req.VolumeId)\n\trootDevice, subDevice, err := GetRootSubDevicePath(devicePaths)\n\texpectName := ChooseDevice(rootDevice, subDevice)\n\trealDevice := GetDeviceByMntPoint(sourcePath)\n\tif realDevice == \"\" {\n\t\topts := append(mnt.MountFlags, \"shared\")\n\t\tif err := ns.k8smounter.Mount(expectName, sourcePath, fsType, opts); err != nil {\n\t\t\tlog.Log.Errorf(\"NodePublishVolume: mount source error: %s, %s, %s\", expectName, sourcePath, err.Error())\n\t\t\treturn nil, status.Error(codes.Internal, \"NodePublishVolume: mount source error: \"+expectName+\", \"+sourcePath+\", \"+err.Error())\n\t\t}\n\t\trealDevice = GetDeviceByMntPoint(sourcePath)\n\t}\n\tif expectName != realDevice || realDevice == \"\" {\n\t\tlog.Log.Errorf(\"NodePublishVolume: Volume: %s, sourcePath: %s real Device: %s not same with expected: %s\", req.VolumeId, sourcePath, realDevice, expectName)\n\t\treturn nil, status.Error(codes.Internal, \"NodePublishVolume: sourcePath: \"+sourcePath+\" real Device: \"+realDevice+\" not same with Saved: \"+expectName)\n\t}\n\n\tlog.Log.Infof(\"NodePublishVolume: Starting mount volume %s with flags %v and fsType %s\", req.VolumeId, options, fsType)\n\tif err = ns.k8smounter.Mount(sourcePath, targetPath, fsType, options); err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tif utils.IsKataInstall() {\n\t\t// save volume data to json file\n\t\tvolumeData := map[string]string{}\n\t\tvolumeData[\"csi.alibabacloud.com/fsType\"] = fsType\n\t\tsaveOptions := req.VolumeCapability.GetMount().MountFlags\n\t\tif len(saveOptions) != 0 {\n\t\t\tvolumeData[\"csi.alibabacloud.com/mountOptions\"] = strings.Join(saveOptions, \",\")\n\t\t}\n\t\tif value, ok := req.VolumeContext[MkfsOptions]; ok {\n\t\t\tvolumeData[\"csi.alibabacloud.com/mkfsOptions\"] = value\n\t\t}\n\t\tvolumeData[\"csi.alibabacloud.com/disk-mounted\"] = \"true\"\n\t\tfileName := filepath.Join(filepath.Dir(targetPath), utils.VolDataFileName)\n\t\tif strings.HasSuffix(targetPath, \"/\") {\n\t\t\tfileName = filepath.Join(filepath.Dir(filepath.Dir(targetPath)), utils.VolDataFileName)\n\t\t}\n\t\tif err = utils.AppendJSONData(fileName, volumeData); err != nil {\n\t\t\tlog.Log.Warnf(\"NodeStageVolume: append volume spec to %s with error: %s\", fileName, err.Error())\n\t\t}\n\t}\n\n\t// Set volume IO Limit\n\terr = utils.SetVolumeIOLimit(realDevice, req)\n\tif err != nil {\n\t\tlog.Log.Errorf(\"NodePublishVolume: Set Disk Volume(%s) IO Limit with Error: %s\", req.VolumeId, err.Error())\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tlog.Log.Infof(\"NodePublishVolume: Mount Successful Volume: %s, from source %s to target %v\", req.VolumeId, sourcePath, targetPath)\n\treturn &csi.NodePublishVolumeResponse{}, nil\n}", "title": "" }, { "docid": "d0d136ec350cf0433d9accf3b44129c6", "score": "0.49402478", "text": "func _TestPublishNetworkError(t *testing.T) {\n\tassert := assert.New(t)\n\n\tcfg := pamConfigCopy()\n\tcfg.Origin = \"foo.bar\"\n\tpn := pubnub.NewPubNub(cfg)\n\n\t_, _, err := pn.Publish().Channel(randomized(\"ch\")).Message(\"hey\").Execute()\n\n\tassert.Contains(err.Error(), fmt.Sprintf(connectionErrorTemplate,\n\t\t\"Failed to execute request\"))\n\n\tassert.Contains(err.Error(), \"no such host\")\n\n\tassert.Contains(err.(*pnerr.ConnectionError).OrigError.Error(),\n\t\t\"dial tcp: lookup\")\n}", "title": "" }, { "docid": "7456fc5247e904d5c1d8b7235ddec104", "score": "0.49398458", "text": "func TestPublishSuccess(t *testing.T) {\n\tclient, err := mqtt.NewClient(mqtt.ClientOptions{\n\t\tServers: []string{\n\t\t\tbroker,\n\t\t},\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"creating client should not have failed: %v\", err)\n\t}\n\terr = client.Connect(ctx())\n\tdefer client.DisconnectImmediately()\n\tif err != nil {\n\t\tt.Fatalf(\"connect should not have failed: %v\", err)\n\t}\n\n\terr = client.Publish(ctx(), testUUID+\"/TestPublishSuccess\", []byte(\"hello\"), mqtt.AtLeastOnce)\n\tif err != nil {\n\t\tt.Fatalf(\"publish should not have failed: %v\", err)\n\t}\n}", "title": "" }, { "docid": "62a6a5836862bc5c4ebf0bdc6439a293", "score": "0.49384874", "text": "func (g *DashboardHandler) publish(event dashboardEvent) error {\n\tmsg, err := json.Marshal(event)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn g.Publisher(\"grafana/dashboard/\"+event.UID, msg)\n}", "title": "" }, { "docid": "6b33551ea6f3bbaac0a9b956c09b6a00", "score": "0.49374306", "text": "func (q *QuotesGroup) publish(data interface{}, dataType string, err error) {\n\tq.bus.outChannel <- schemas.ResultChannel{\n\t\tDataType: dataType,\n\t\tData: data,\n\t\tError: err,\n\t}\n}", "title": "" }, { "docid": "f186fd7d1c46eb7077250e76f9ce085b", "score": "0.49372077", "text": "func Publish(topic string, args ...interface{}) {\n\tbus.Publish(topic, args...)\n}", "title": "" }, { "docid": "d2c65f5fadcbbf87d1cbf693b4b82012", "score": "0.49343118", "text": "func (s *EventSender) Publish(ctx context.Context, e *event.MetricReading) error {\n\tdata, _ := json.Marshal(e)\n\n\treq, err := http.NewRequest(http.MethodPost, s.url, bytes.NewBuffer(data))\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error creating post request: %s\", s.url)\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error executing post request: %s\", s.url)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn errors.Wrapf(err, \"invalid response code to %s: %d (%s)\",\n\t\t\ts.url, resp.StatusCode, resp.Status)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c2fa8f75ff3ad23ab2cb63d9c928e3e2", "score": "0.4929292", "text": "func Publish(registry metrics.Registry, namespace string, configs ...func(*Publisher)) {\n\tpublisher := newPublisher(registry, namespace, configs...)\n\tpublisher.pollMetrics()\n}", "title": "" }, { "docid": "3a0705ecd3d0089c951741bd80944c9d", "score": "0.4926298", "text": "func (s *fakeServiceBus) Publish(channel bus.ChannelName, messages ...interface{}) {\n}", "title": "" }, { "docid": "26c09419221590e283e16951aca9e52f", "score": "0.4923451", "text": "func Publish(evt Event) {\n\tlocalEvent := local(evt)\n\tlocalEvent = localEvent.withCaller()\n\tDefaultPubSub.Publish(localEvent)\n}", "title": "" }, { "docid": "2064f256bdcb3cd42919e33b38aa140a", "score": "0.4923103", "text": "func publish(input interface{}) error {\n\ti := input.(pubInput)\n\t// create the connection configuration\n\tcfg := &ClientConf{\n\t\tBaseURI: i.uri,\n\t\tUsername: i.user,\n\t\tPassword: i.pwd,\n\t\tInsecureSkipVerify: true,\n\t\tTimeout: 60 * time.Second,\n\t}\n\tclient, err := NewClient(cfg)\n\tif err != nil {\n\t\t// client configuration error therefore it does not retry\n\t\treturn StopRetry{fmt.Errorf(\"failed to create http client: %s\\n\", err)}\n\t}\n\t// create a request processor with the http credentials\n\tp := &processor{cfg: cfg}\n\t// post payload to receiver\n\tresp, err := client.Post(i.uri, i.payload, p.addToken)\n\tif err != nil {\n\t\t// server did not return an error but the operation failed therefore it keeps retrying\n\t\treturn fmt.Errorf(\"failed to post events to receiver '%s': %s\\n\", i.uri, err)\n\t}\n\tif resp.StatusCode > 299 {\n\t\t// server returned error therefore it does not retry\n\t\treturn StopRetry{fmt.Errorf(\"failed to post events to receiver '%s': '%s'\\n\", i.uri, resp.Status)}\n\t}\n\t// no error so it does not retry\n\treturn nil\n}", "title": "" }, { "docid": "6cb24ac9860ac7476be12548285d80b4", "score": "0.49197307", "text": "func Publish(conn *Conn, channel string, message interface{}) error {\n\t_, err := NewCommand(\"PUBLISH\", channel, message).Run(conn)\n\treturn err\n}", "title": "" }, { "docid": "54a71444e6abcd2ec949e3a5e26c95fe", "score": "0.4919381", "text": "func (s *SignalFx) Publish(mts []plugin.Metric, cfg plugin.Config) error {\n\tif len(mts) > 0 {\n\t\ts.init(cfg)\n\t}\n\n\t// Iterate over the supplied metrics\n\tfor _, m := range mts {\n\t\tvar buffer bytes.Buffer\n\n\t\t// Convert the namespace to dot notation\n\t\tfmt.Fprintf(&buffer, \"snap.%s\", strings.Join(m.Namespace.Strings(), \".\"))\n\t\ts.namespace = buffer.String()\n\n\t\t// Do some type conversion and send the data\n\t\tswitch v := m.Data.(type) {\n\t\tcase uint:\n\t\t\ts.sendIntValue(int64(v))\n\t\tcase uint32:\n\t\t\ts.sendIntValue(int64(v))\n\t\tcase uint64:\n\t\t\ts.sendIntValue(int64(v))\n\t\tcase int:\n\t\t\ts.sendIntValue(int64(v))\n\t\tcase int32:\n\t\t\ts.sendIntValue(int64(v))\n\t\tcase int64:\n\t\t\ts.sendIntValue(int64(v))\n\t\tcase float32:\n\t\t\ts.sendFloatValue(float64(v))\n\t\tcase float64:\n\t\t\ts.sendFloatValue(float64(v))\n\t\tdefault:\n\t\t\tlog.Printf(\"Ignoring %T: %v\\n\", v, v)\n\t\t\tlog.Printf(\"Contact the plugin author if you think this is an error\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "17fe1b018f5ca7074f3e780d734b7194", "score": "0.49176022", "text": "func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {\n\tlog := *zerolog.Ctx(ctx)\n\tif err := validateNodePublishVolumeRequest(req); err != nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, fmt.Errorf(\"failed to validate NodePublishVolumeRequest: %w\", err).Error())\n\t}\n\n\t// Configuration\n\n\ttargetPath := req.GetTargetPath()\n\tvolId := volumeID(req.GetVolumeId())\n\tlog = log.With().Str(\"volumeid\", string(volId)).Str(\"targetpath\", targetPath).Logger()\n\n\tif err := mkdir(targetPath); err != nil {\n\t\treturn nil, status.Error(codes.Internal, fmt.Errorf(\"failed to create mount point for volume: %w\", err).Error())\n\t}\n\n\t// Check if the volume is already mounted\n\n\tisMnt, err := folderIsMounted(targetPath)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, fmt.Errorf(\"stat failed: %w\", err).Error())\n\t}\n\n\tif isMnt {\n\t\tlog.Info().Msg(\"volume is already bind-mounted\")\n\t\treturn &csi.NodePublishVolumeResponse{}, nil\n\t}\n\n\t// It's not, bind-mount now\n\n\tif err = bindMount(req.GetStagingTargetPath(), targetPath); err != nil {\n\t\treturn nil, status.Error(codes.Internal, fmt.Errorf(\"failed to bind-mount volume: %w\", err).Error())\n\t}\n\n\tlog.Info().Msg(\"bind-mounted volume\")\n\n\treturn &csi.NodePublishVolumeResponse{}, nil\n}", "title": "" }, { "docid": "2652a7e66d5bb6681a3e91493b0764bf", "score": "0.49102482", "text": "func (m *MockPubSub) Publish(req *pubsub.PublishRequest) error {\n\targs := m.Called(req)\n\treturn args.Error(0)\n}", "title": "" }, { "docid": "35eec3027cf03f8699733d267ef682b3", "score": "0.4886962", "text": "func (s *service) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) {\n\treturn nil, status.Error(codes.Unimplemented, \"\")\n}", "title": "" }, { "docid": "2b7996fccdff1bcbeda975c0b4ea1fc0", "score": "0.4881419", "text": "func performPublish(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"performPublish() called\")\n\n\tvar commandBody publishCommand\n\terr := json.NewDecoder(r.Body).Decode(&commandBody)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tjson.NewEncoder(w).Encode(appResponse{\n\t\t\tMessage: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tlog.Printf(\" commandBody.ContentType=%s\", commandBody.ContentType)\n\tlog.Printf(\" commandBody.Topic=%s\", commandBody.Topic)\n\tlog.Printf(\" commandBody.Data=%v\", commandBody.Data)\n\tlog.Printf(\" commandBody.Protocol=%s\", commandBody.Protocol)\n\tlog.Printf(\" commandBody.Metadata=%s\", commandBody.Metadata)\n\n\t// based on commandBody.Topic, send to the appropriate topic\n\tresp := appResponse{Message: fmt.Sprintf(\"%s is not supported\", commandBody.Topic)}\n\n\tstartTime := epoch()\n\n\tjsonValue, err := json.Marshal(commandBody.Data)\n\tif err != nil {\n\t\tlog.Printf(\"Error Marshaling\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tjson.NewEncoder(w).Encode(appResponse{\n\t\t\tMessage: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tcontentType := commandBody.ContentType\n\tif contentType == \"\" {\n\t\tcontentType = \"application/json\"\n\t}\n\n\t// publish to dapr\n\tvar status int\n\tif commandBody.Protocol == \"grpc\" {\n\t\tstatus, err = performPublishGRPC(commandBody.Topic, jsonValue, contentType, commandBody.Metadata)\n\t} else {\n\t\tstatus, err = performPublishHTTP(commandBody.Topic, jsonValue, contentType, commandBody.Metadata)\n\t}\n\n\tif err != nil {\n\t\tlog.Printf(\"Publish failed with error=%s, StatusCode=%d\", err.Error(), status)\n\n\t\tw.WriteHeader(status)\n\t\tjson.NewEncoder(w).Encode(appResponse{\n\t\t\tMessage: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\t// pass on status code to the calling application\n\tw.WriteHeader(status)\n\n\tif status == http.StatusOK || status == http.StatusNoContent {\n\t\tlog.Printf(\"Publish succeeded\")\n\t\tresp = appResponse{Message: \"Success\"}\n\t} else {\n\t\tlog.Printf(\"Publish failed\")\n\t\tresp = appResponse{Message: \"Failed\"}\n\t}\n\tresp.StartTime = startTime\n\tresp.EndTime = epoch()\n\n\tjson.NewEncoder(w).Encode(resp)\n}", "title": "" }, { "docid": "05948c07d4ba9b430b33ec84ad448a85", "score": "0.4878326", "text": "func (p *AWSServiceProvider) PublishEvent(subject string, region string, eventData interface{}) {\n\tif _, valid := eventData.(string); !valid {\n\t\tlog.Println(\"Event Data error\")\n\t\treturn\n\t}\n\n\tinput := &sns.PublishInput{\n\t\t//Type assertion for interface value to concrete value\n\t\tMessage: aws.String(eventData.(string)),\n\t\tTopicArn: aws.String(\"arn:aws:sns:\" + region + \":\" + p.AWSId + \":\" + subject),\n\t}\n\tresult, err := p.AWSSNSClient.Publish(input)\n\tif err != nil {\n\t\tlog.Println(\"Publish error:\", err)\n\t\treturn\n\t}\n\tlog.Println(\"Message:\", result)\n}", "title": "" }, { "docid": "902406cb2a0cfcfdc98e546a54764f1f", "score": "0.48756567", "text": "func (session *SessionLease) WriteUnit(unit DesiredSystemdUnit, out io.Writer) []error {\n\terrs := make([]error, 0)\n\n\tt, err := getTemplate(unit.Type)\n\tif err != nil {\n\t\terrs = append(errs, err)\n\t}\n\n\tr, rErrs := resolveDesiredUnit(unit, session)\n\tif len(rErrs) > 0 {\n\t\terrs = append(errs, rErrs...)\n\t}\n\n\tif len(errs) > 0 {\n\t\treturn errs\n\t}\n\n\tif err = t.Execute(out, r); err != nil {\n\t\terrs = append(errs, err)\n\t}\n\n\treturn errs\n}", "title": "" }, { "docid": "6664d80e9991cbc3ec5e0ba4d59f6792", "score": "0.4875206", "text": "func (svc *Service) Publish(data any, contentType string) error {\n\terr := svc.PublishWithTopic(svc.config.Trigger.PublishTopic, data, contentType)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf99a3e6f21ad27da6f80e4d07bad1b1", "score": "0.48751053", "text": "func PublishRoundFinished(roundFinished RoundFinished) {\n\tmoves := make(map[string]model.Move, len(roundFinished.Moves))\n\tfor player, move := range roundFinished.Moves {\n\t\tmoves[player] = model.Move{Value: move.(string)}\n\t}\n\tfor _, playerResult := range roundFinished.PlayerResults {\n\t\tpublish(playerResult.Subscriber, model.Event{\n\t\t\tType: \"roundFinished\",\n\t\t\tBody: model.RoundFinished{\n\t\t\t\tGameID: roundFinished.GameID.String(),\n\t\t\t\tCurrentRound: roundFinished.CurrentRound,\n\t\t\t\tNextRound: roundFinished.NextRound,\n\t\t\t\tScore: playerResult.Score,\n\t\t\t\tRoundResult: model.Result{\n\t\t\t\t\tWinner: roundFinished.Winner,\n\t\t\t\t\tStatus: playerResult.Status,\n\t\t\t\t\tMoves: moves,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n}", "title": "" }, { "docid": "fa7d7cc85813b405a88b6026b5818453", "score": "0.48716903", "text": "func (h *Executor) Publish(_ context.Context, cmd *PublishRequest) *PublishResponse {\n\tdefer observe(time.Now(), h.protocol, \"publish\")\n\n\tch := cmd.Channel\n\tdata := cmd.Data\n\n\tresp := &PublishResponse{}\n\n\tif ch == \"\" {\n\t\th.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelError, \"channel required for publish\", nil))\n\t\tresp.Error = ErrorBadRequest\n\t\treturn resp\n\t}\n\n\tif len(data) == 0 {\n\t\th.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelError, \"data required for publish\", nil))\n\t\tresp.Error = ErrorBadRequest\n\t\treturn resp\n\t}\n\n\t_, found, err := h.ruleContainer.NamespacedChannelOptions(ch)\n\tif err != nil {\n\t\tresp.Error = ErrorInternal\n\t\treturn resp\n\t}\n\tif !found {\n\t\tresp.Error = ErrorNamespaceNotFound\n\t\treturn resp\n\t}\n\n\t_, err = h.node.Publish(cmd.Channel, cmd.Data)\n\tif err != nil {\n\t\th.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelError, \"error publishing message in engine\", map[string]interface{}{\"error\": err.Error(), \"channel\": cmd.Channel}))\n\t\tresp.Error = ErrorInternal\n\t\treturn resp\n\t}\n\treturn resp\n}", "title": "" }, { "docid": "6a5773858905a42edc61f2d720d761cf", "score": "0.48654282", "text": "func (b Broker) Publish(t string, payload string) (*http.Response, error) {\n\tm := PublishModel{Topic: t, ClientID: \"test_client_id\", Payload: payload, QOS: 1, Retain: false}\n\n\tpe := fmt.Sprintf(\"%s%s\", viper.GetString(\"emq.base\"), pulishEndpoint)\n\tbytesRepresentation, err := json.Marshal(m)\n\tlogger.Debug(string(bytesRepresentation))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"EMQ:PUBLISH => error while parsing publish model: %v\", err)\n\t}\n\treq, _ := http.NewRequest(\"POST\", pe, bytes.NewBuffer(bytesRepresentation))\n\treq.SetBasicAuth(viper.GetString(\"emq.auth.username\"), viper.GetString(\"emq.auth.password\"))\n\tres, e := b.Client.Do(req)\n\tif e != nil {\n\t\tlogger.Error(fmt.Errorf(\"error while calling EMQx: %v\", e))\n\t\treturn nil, e\n\t}\n\tlogger.Debug(fmt.Sprintf(\"STATUS : %v\", res.Status))\n\treturn res, nil\n}", "title": "" }, { "docid": "4c9f54eff143a3e7ca1f704915930dce", "score": "0.4860339", "text": "func (ns *node) NodePublishVolume(\n\tctx context.Context,\n\treq *csi.NodePublishVolumeRequest,\n) (*csi.NodePublishVolumeResponse, error) {\n\n\tvar (\n\t\terr error\n\t\treVerified bool\n\t\tdevicePath string\n\t)\n\n\tif req.GetVolumeCapability() == nil {\n\t\treturn nil, status.Error(codes.InvalidArgument,\n\t\t\t\"Volume capability missing in request\")\n\t}\n\n\tif len(req.GetVolumeId()) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument,\n\t\t\t\"Volume ID missing in request\")\n\t}\n\n\tmountPath := req.GetTargetPath()\n\tvolumeID := req.GetVolumeId()\n\tmountOptions := req.GetVolumeCapability().GetMount().GetMountFlags()\n\n\t//TODO get this info from our own CRs\n\tvol, err := utils.GetVolumeDetails(volumeID, mountPath, req.Readonly, mountOptions)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\t//Check if volume is ready to serve IOs,\n\t//info is fetched from the cstorvolume CR\n\tif err := utils.WaitForVolumeToBeReady(volumeID); err != nil {\n\t\treturn nil,\n\t\t\tstatus.Error(codes.Internal, err.Error())\n\t}\n\n\t// A temporary TCP connection is made to the volume to check if its\n\t// reachable\n\tif err := utils.WaitForVolumeToBeReachable(vol.Spec.ISCSI.TargetPortal); err != nil {\n\t\treturn nil,\n\t\t\tstatus.Error(codes.Internal, err.Error())\n\t}\n\n\t// TODO put this tag in a function and defer to unlock in this function\nverifyPublish:\n\tutils.VolumesListLock.Lock()\n\t// Check if the volume has already been published(mounted) or if the mount\n\t// is in progress\n\tif info, ok := utils.Volumes[volumeID]; ok {\n\t\t// The volume appears to be present in the inmomory list of volumes\n\t\t// which implies that either the mount operation is complete\n\t\t// or under progress.\n\t\t// Lets verify if the mount is already completed\n\t\tif info.Spec.Volume.DevicePath != \"\" {\n\t\t\t// Once the devicePath is set implies the volume mount has been\n\t\t\t// completed, a success response can be sent back\n\t\t\tutils.VolumesListLock.Unlock()\n\t\t\treturn &csi.NodePublishVolumeResponse{}, nil\n\t\t}\n\t\t// The mount appears to be under progress lets wait for 13 seconds and\n\t\t// reverify. 13s was decided based on the kubernetes timeout values\n\t\t// which is 15s. Lets reply to kubernetes before it reattempts a\n\t\t// duplicate request\n\t\tutils.VolumesListLock.Unlock()\n\t\tif !reVerified {\n\t\t\ttime.Sleep(utils.VolumeWaitRetryCount * utils.VolumeWaitTimeout * time.Second)\n\t\t\treVerified = true\n\t\t\tgoto verifyPublish\n\t\t}\n\t\t// It appears that the mount will still take some more time,\n\t\t// lets convey the same to kubernetes. The message responded will be\n\t\t// added to the app description which has requested this volume\n\n\t\treturn nil, status.Error(codes.Internal, \"Mount under progress\")\n\t}\n\n\t// This helps in cases when the node on which the volume was originally\n\t// mounted is down. When that node is down, kubelet would not have been able\n\t// to trigger an unpublish event on that node due to which when it comes up\n\t// it starts remounting that volume. If the node's CSIVolume CR is marked\n\t// for deletion that node will not reattempt to mount this volume again.\n\tif err = utils.DeleteOldCSIVolumeCR(vol, ns.driver.config.NodeID); err != nil {\n\t\tutils.VolumesListLock.Unlock()\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\t// This CR creation will help iSCSI target(istgt) identify\n\t// the current owner node of the volume and accordingly the target will\n\t// allow only that node to login to the volume\n\terr = utils.CreateCSIVolumeCR(vol, ns.driver.config.NodeID, mountPath)\n\tif err != nil {\n\t\tutils.VolumesListLock.Unlock()\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\tutils.Volumes[volumeID] = vol\n\tutils.VolumesListLock.Unlock()\n\n\t// Permission is changed for the local directory before the volume is\n\t// mounted on the node. This helps to resolve cases when the CSI driver\n\t// Unmounts the volume to remount again in required mount mode(ro/rw),\n\t// the app starts writing directly in the local directory.\n\t// As soon as the volume is mounted the permissions of this directory are\n\t// automatically changed to allow Reads and writes.\n\t// And as soon as it is unmounted permissions change\n\t// back to what we are setting over here.\n\tif err = utils.ChmodMountPath(vol.Spec.Volume.MountPath); err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\t// Login to the volume and attempt mount operation on the requested path\n\tif devicePath, err = iscsi.AttachAndMountDisk(vol); err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\t// Setting the devicePath in the volume spec is an indication that the mount\n\t// operation for the volume has been completed for the first time. This\n\t// helps in 2 ways:\n\t// 1) Duplicate nodePublish requests from kubernetes are responded with\n\t// success response if this path is set\n\t// 2) The volumeMonitoring thread doesn't attemp remount unless this path is\n\t// set\n\tutils.VolumesListLock.Lock()\n\t// TODO set this state in etcd also\n\tvol.Spec.Volume.DevicePath = devicePath\n\tutils.VolumesListLock.Unlock()\n\n\treturn &csi.NodePublishVolumeResponse{}, nil\n}", "title": "" }, { "docid": "cd456f32e4f3cf5222464103090b6901", "score": "0.485718", "text": "func (s *server) Publish(ctx context.Context, in *Request) (*Reply, error) {\n\t_ = s.publisher.Publish(uuid.New().String(), in.GetMessage())\n\n\treturn &Reply{Message: \" \" + in.GetMessage()}, nil\n}", "title": "" } ]
b13e8a7976f057bd0045488509f2d5e0
TypeFor returns Type for the given string ignores errors
[ { "docid": "df66680dc27e890fbf0e5230f16764d5", "score": "0.690499", "text": "func TypeFor(s string) MessageType {\n\tt, _ := TypeForE(s)\n\treturn t\n}", "title": "" } ]
[ { "docid": "67de6508e1e8ce4d46cb774db291bd1d", "score": "0.71587753", "text": "func TypeFromString(s string) (Type, error) {\n\tswitch s {\n\tcase \"Remote\":\n\t\treturn Remote, nil\n\tcase \"InPerson\":\n\t\treturn InPerson, nil\n\tdefault:\n\t\treturn \"\", InvalidType{s}\n\t}\n}", "title": "" }, { "docid": "990ffa34e221a06a5dc60cd3579c138e", "score": "0.70587516", "text": "func getType(s string) string {\n\tt, ok := types[s]\n\tif !ok {\n\t\tlog.Fatalf(\"Could not find type for %v\", s)\n\t}\n\treturn t\n}", "title": "" }, { "docid": "03963a156ea006f252f8d9f3e615fbe4", "score": "0.7030532", "text": "func TypeFromString(t string) Type {\n\tgot, ok := map[string]Type{\n\t\t\"any\": Any,\n\t\t\"string\": String,\n\t\t\"integer\": Integer,\n\t\t\"float\": Float,\n\t\t\"boolean\": Boolean,\n\t\t\"date\": Date,\n\t\t\"url\": URL,\n\t\t\"json\": JSON,\n\t}[t]\n\tif !ok {\n\t\treturn Unknown\n\t}\n\n\treturn got\n}", "title": "" }, { "docid": "972f470271b7dbf35d9a67642b8d8fd9", "score": "0.69620717", "text": "func TypeForE(s string) (MessageType, error) {\n\tif val, ok := typeForString[s]; ok {\n\t\treturn val, nil\n\t}\n\n\treturn MessageType(0), fmt.Errorf(\"no known type for %s\", s)\n}", "title": "" }, { "docid": "f5c70bda98e4e60af195150f9c88b14c", "score": "0.66226405", "text": "func GetTypeByString(typeName string) (ServiceType, error) {\n\tswitch ServiceType(typeName) {\n\tcase HTTP:\n\t\treturn HTTP, nil\n\tcase HTTPS:\n\t\treturn HTTPS, nil\n\tcase TCP:\n\t\treturn TCP, nil\n\tcase UDP:\n\t\treturn UDP, nil\n\tcase Custom:\n\t\treturn Custom, nil\n\tdefault:\n\t\treturn ServiceType(typeName), ErrServiceTypeNotFound\n\t}\n}", "title": "" }, { "docid": "209bfd870dbcca6d8518ff76d5aed5b5", "score": "0.656934", "text": "func StringToType(str string) Type {\n\tswitch str {\n\tcase TYPEINT.String():\n\t\treturn TYPEINT\n\tcase TYPEFLOAT.String():\n\t\treturn TYPEFLOAT\n\tcase TYPECHAR.String():\n\t\treturn TYPECHAR\n\tcase TYPEBOOL.String():\n\t\treturn TYPEBOOL\n\tcase ADDR.String():\n\t\treturn ADDR\n\tcase VOID.String():\n\t\treturn VOID\n\tdefault:\n\t\treturn ERR\n\t}\n}", "title": "" }, { "docid": "3234176e4fbeb421301afe4d6fc42cc6", "score": "0.6492584", "text": "func TypeFromString(raw string, t interface{}) error {\n\treturn json.Unmarshal([]byte(raw), &t)\n}", "title": "" }, { "docid": "bc70c8d95d3caa84323b4139c3c0c488", "score": "0.6463453", "text": "func TypeFromString(t string) value.ValueType {\n\tswitch strings.ToLower(t) {\n\tcase \"integer\":\n\t\t// This isn't necessarily true, as integer could be bool\n\t\treturn value.IntType\n\tcase \"real\":\n\t\treturn value.NumberType\n\tdefault:\n\t\treturn value.StringType\n\t}\n}", "title": "" }, { "docid": "5a3c793fed36a44a9ae5f1765e1fa83b", "score": "0.6455387", "text": "func ToType(s string) Type {\n\tfor _, t := range AllTypes {\n\t\tif string(t) == s {\n\t\t\treturn t\n\t\t}\n\t}\n\treturn UnknownType\n}", "title": "" }, { "docid": "05d17e94e5695e51ae3c3b1e5a2d20eb", "score": "0.64415896", "text": "func TypeFromString(str string) (_ Type, err error) {\n\tswitch str {\n\tcase \"ask\", \"sell\":\n\t\treturn Ask, nil\n\tcase \"bid\", \"buy\":\n\t\treturn Bid, nil\n\t}\n\terr = fmt.Errorf(\"invalid order type %q\", str)\n\treturn\n}", "title": "" }, { "docid": "563563e44e50ca3d9896c4e143cf4156", "score": "0.631105", "text": "func FromString(s string) (Type, error) {\n\tswitch strings.ToLower(s) {\n\tcase \"notpm\":\n\t\treturn TypeNoTPM, nil\n\tcase \"tpm12\":\n\t\treturn TypeTPM12, nil\n\tcase \"tpm20\":\n\t\treturn TypeTPM20, nil\n\t}\n\treturn TypeNoTPM, fmt.Errorf(\"unsupported %s as tpm type\", s)\n}", "title": "" }, { "docid": "ae061f9a214a6ca62cc5e62ba2058a54", "score": "0.62988895", "text": "func (s *String) Type() string { return STRING }", "title": "" }, { "docid": "0334ce72477e520e06bb309fab5f08a4", "score": "0.62810063", "text": "func (pkg PackageDeclaration) TypeFor(typeName string) (TypeDeclaration, bool) {\n\tfor _, typed := range pkg.Types {\n\t\tif typed.Object.Name.Name == typeName {\n\t\t\treturn typed, true\n\t\t}\n\t}\n\n\treturn TypeDeclaration{}, false\n}", "title": "" }, { "docid": "1a5680728016a4da36626f2acbbb9083", "score": "0.62694", "text": "func (tr *TypeRegistry) Type(typeName string) reflect.Type {\n\tif typ, ok := tr.Types[typeName]; ok {\n\t\treturn typ\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "318eef88636ad0649c14611735c783a8", "score": "0.6246486", "text": "func (r *FeatureRegistry) GetTypeFromName(name string) int {\n\tif t, ok := r.nameToType[name]; ok {\n\t\treturn t\n\t}\n\tif t, ok := r.nameToType[\"?\"+name]; ok {\n\t\treturn t\n\t}\n\treturn Type_None\n}", "title": "" }, { "docid": "d02bc73355c7791db73726bce8cd6e83", "score": "0.62343705", "text": "func FromString(el string) ReportType {\n\tval := sort.SearchStrings(types, el)\n\tif val == len(el) {\n\t\treturn CUSTOM\n\t}\n\trt := ReportType(val)\n\tif goscrappy.Debug {\n\t\tfmt.Printf(\"Info(FromString): Got %v report type from %s string\\n\",\n\t\t\trt, el)\n\t}\n\treturn rt\n}", "title": "" }, { "docid": "96680f3fd8e0e9920a753ca06eda8e39", "score": "0.6189708", "text": "func NewTypeFromString(str string) (Type, bool) {\n\tswitch str {\n\tcase TypeString.String():\n\t\treturn TypeString, true\n\tcase TypeBytes.String():\n\t\treturn TypeBytes, true\n\tcase TypeBytes32.String():\n\t\treturn TypeBytes32, true\n\tcase TypeBytes65.String():\n\t\treturn TypeBytes65, true\n\n\tcase TypeBool.String():\n\t\treturn TypeBool, true\n\tcase TypeU8.String():\n\t\treturn TypeU8, true\n\tcase TypeU16.String():\n\t\treturn TypeU16, true\n\tcase TypeU32.String():\n\t\treturn TypeU32, true\n\tcase TypeU64.String():\n\t\treturn TypeU64, true\n\tcase TypeU128.String():\n\t\treturn TypeU128, true\n\tcase TypeU256.String():\n\t\treturn TypeU256, true\n\n\tcase TypeMaybe.String():\n\t\treturn TypeMaybe, true\n\tcase TypeList.String():\n\t\treturn TypeList, true\n\tcase TypeRecord.String():\n\t\treturn TypeRecord, true\n\n\tdefault:\n\t\treturn TypeNil, false\n\t}\n}", "title": "" }, { "docid": "c76b4ae2025f4ad2a655b66d6190e689", "score": "0.6145006", "text": "func dbusTypeFor(sig string) (t reflect.Type, rem string, err error) {\n\tif len(sig) == 0 {\n\t\terr = fmt.Errorf(\"%q - bad signature: empty\", sig)\n\t\treturn\n\t}\n\n\tswitch sig[0] {\n\tcase 'y':\n\t\tt = reflect.TypeOf(byte(0))\n\t\trem = sig[1:]\n\tcase 'b':\n\t\tt = reflect.TypeOf(false)\n\t\trem = sig[1:]\n\tcase 'n':\n\t\tt = reflect.TypeOf(int16(0))\n\t\trem = sig[1:]\n\tcase 'q':\n\t\tt = reflect.TypeOf(uint16(0))\n\t\trem = sig[1:]\n\tcase 'i':\n\t\tt = reflect.TypeOf(int32(0))\n\t\trem = sig[1:]\n\tcase 'u':\n\t\tt = reflect.TypeOf(uint32(0))\n\t\trem = sig[1:]\n\tcase 'x':\n\t\tt = reflect.TypeOf(int64(0))\n\t\trem = sig[1:]\n\tcase 't':\n\t\tt = reflect.TypeOf(uint64(0))\n\t\trem = sig[1:]\n\tcase 'd':\n\t\tt = reflect.TypeOf(float64(0.0))\n\t\trem = sig[1:]\n\tcase 's':\n\t\tt = reflect.TypeOf(\"\")\n\t\trem = sig[1:]\n\tcase 'g':\n\t\tt = reflect.TypeOf(dbus.Signature{})\n\t\trem = sig[1:]\n\tcase 'o':\n\t\tt = reflect.TypeOf(dbus.ObjectPath(\"\"))\n\t\trem = sig[1:]\n\tcase 'v':\n\t\tt = reflect.TypeOf(dbus.Variant{})\n\t\trem = sig[1:]\n\tcase 'h':\n\t\tt = reflect.TypeOf(dbus.UnixFD(0))\n\t\trem = sig[1:]\n\n\t// array or map\n\tcase 'a':\n\t\tif len(sig) > 1 && sig[1] == '{' { // map\n\t\t\tif i := match(sig, '{', '}'); i > 0 {\n\t\t\t\trem = sig[i+1:]\n\t\t\t\tsig = sig[2:i] // omit a{ }\n\t\t\t\tif len(sig) <= 1 {\n\t\t\t\t\terr = fmt.Errorf(\"%q - bad signature: too short for dicts\", sig)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tksig := sig[0:1] // key signature\n\t\t\t\tvsig := sig[1:] // value signature\n\n\t\t\t\t// key type\n\t\t\t\tkt, _, e := dbusTypeFor(ksig)\n\t\t\t\tif e != nil {\n\t\t\t\t\terr = fmt.Errorf(\"%q - bad dict's key signature: %s\", ksig, e)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// TODO: check key type is valid key type: integer or string\n\n\t\t\t\t// value type\n\t\t\t\tvt, _, e := dbusTypeFor(vsig)\n\t\t\t\tif e != nil {\n\t\t\t\t\terr = fmt.Errorf(\"%q - bad dict's value signature: %s\", vsig, e)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tt = reflect.MapOf(kt, vt)\n\t\t\t} else {\n\t\t\t\terr = fmt.Errorf(\"%q - bad signature: unmatched '}'\", sig)\n\t\t\t}\n\t\t} else { // array\n\t\t\tt, rem, err = dbusTypeFor(sig[1:])\n\t\t\tif err == nil {\n\t\t\t\tt = reflect.SliceOf(t)\n\t\t\t} else {\n\t\t\t\tt = nil\n\t\t\t}\n\t\t}\n\n\t// structure\n\tcase '(':\n\t\tif i := match(sig, '(', ')'); i > 0 {\n\t\t\trem = sig[i+1:]\n\t\t\tsig = sig[1:i] // omit ( )\n\t\t\tif len(sig) != 0 {\n\t\t\t\t// extract fields\n\t\t\t\tvar types []reflect.Type\n\t\t\t\tfor len(sig) != 0 {\n\t\t\t\t\tt, sig, err = dbusTypeFor(sig)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tt = nil\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\ttypes = append(types, t)\n\t\t\t\t}\n\n\t\t\t\t// there is no way in Go to build type dynamically\n\t\t\t\t// so return corresponding anonymous structure\n\t\t\t\tswitch len(types) {\n\t\t\t\t// case 0: // impossible\n\t\t\t\tcase 1:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 2:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 3:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 4:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c, d interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 5:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c, d, e interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 6:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c, d, e, f interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 7:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c, d, e, f, g interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 8:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c, d, e, f, g, h interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 9:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c, d, e, f, g, h, i interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 10:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c, d, e, f, g, h, i, j interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 11:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c, d, e, f, g, h, i, j, k interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 12:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c, d, e, f, g, h, i, j, k, l interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 13:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c, d, e, f, g, h, i, j, k, l, m interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 14:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c, d, e, f, g, h, i, j, k, l, m, n interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 15:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c, d, e, f, g, h, i, j, k, l, m, n, o interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\tcase 16:\n\t\t\t\t\ts := struct {\n\t\t\t\t\t\ta, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p interface{}\n\t\t\t\t\t}{}\n\t\t\t\t\tt = reflect.TypeOf(s)\n\t\t\t\t// TODO: more fields!?\n\t\t\t\tdefault:\n\t\t\t\t\terr = fmt.Errorf(\"%q - bad signature: structure has too many fields\", sig)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = fmt.Errorf(\"%q - bad signature: empty structure\", sig)\n\t\t\t}\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"%q - bad signature: unmatched ')'\", sig)\n\t\t}\n\n\tdefault:\n\t\terr = fmt.Errorf(\"%q - bad signature: unknown type character\", sig)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "4cb02d1d51485a5fae10cffadc36e436", "score": "0.60986334", "text": "func TypeOf(pathName string) reflect.Type {\n\tif typ, ok := types[pathName]; ok {\n\t\treturn typ\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ce96f0059ba2cd1d91c9c82ce53484ff", "score": "0.6091898", "text": "func TypeFor(t string, null bool) SQLType {\n\tif null {\n\t\treturn nullTypeMap[t]\n\t}\n\n\treturn typeMap[t]\n}", "title": "" }, { "docid": "2831983f3dbda3f651dd0b555aa435c0", "score": "0.607171", "text": "func TypeString(typ types.Type, qf types.Qualifier,) string", "title": "" }, { "docid": "b3baa9fad7cdec1009cfaf3da7aa5d5f", "score": "0.60674906", "text": "func (s *tsString) GetType() string {\n\treturn \"string\"\n}", "title": "" }, { "docid": "1f7d9c2e6bb6c20c4e4342a1d0d4eeb5", "score": "0.6064656", "text": "func ResultTypeFromString(s string) ResultType {\n\tswitch s {\n\tcase \"totals\":\n\t\treturn TotalsResult\n\tcase \"events\":\n\t\treturn EventSummaryResult\n\tcase \"fields\":\n\t\treturn FieldSummaryResult\n\tdefault:\n\t\treturn ArrayResult\n\t}\n}", "title": "" }, { "docid": "080d5ba61f4e0e99cdfe5e60eb10ed88", "score": "0.6036946", "text": "func (pkg Package) TypeFor(importPath string, typeName string) (TypeDeclaration, bool) {\n\tfor _, declr := range pkg.Declarations(importPath) {\n\t\tfor _, elem := range declr.Types {\n\t\t\tif elem.Object.Name.Name == typeName {\n\t\t\t\treturn elem, true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn TypeDeclaration{}, false\n}", "title": "" }, { "docid": "f86af80b5e39b48e9e923878543f854e", "score": "0.60218894", "text": "func (b *builder) findType(name string) interface{} {\n\tname = stripNamespace(name)\n\tif t, ok := b.complTypes[name]; ok {\n\t\t//println(\"has ComplexType with name \", name)\n\t\treturn t\n\t}\n\tif t, ok := b.simplTypes[name]; ok {\n\t\t//println(\"has SimpleType with name \", name)\n\t\t// fmt.Printf(\"%v#\\n\", t)\n\t\treturn t\n\t}\n\n\tswitch name {\n\tcase \"boolean\":\n\t\treturn \"bool\"\n\tcase \"language\", \"Name\", \"token\", \"duration\", \"anyURI\":\n\t\treturn \"string\"\n\tcase \"long\", \"short\", \"integer\", \"int\":\n\t\treturn \"int64\"\n\tcase \"unsignedShort\":\n\t\treturn \"uint16\"\n\tcase \"decimal\", \"double\":\n\t\treturn \"float64\"\n\tcase \"dateTime\":\n\t\treturn \"time.Time\"\n\tcase \"date\":\n\t\treturn \"xsd.Date\"\n\tcase \"base64Binary\":\n\t\treturn \"[]byte\"\n\tcase \"positiveInteger\":\n\t\treturn \"uint64\"\n\tdefault:\n\t\treturn name\n\t}\n}", "title": "" }, { "docid": "04ae44be8afaf27a072a7b048fac3978", "score": "0.60089827", "text": "func PkgNameType(obj *types.PkgName,) types.Type", "title": "" }, { "docid": "b414d8b48af649ccaaa6d0b04054e12d", "score": "0.59803236", "text": "func (*String) Type() Type { return StringType }", "title": "" }, { "docid": "41ad86993b625ef5632b97d45fe12fb4", "score": "0.59664214", "text": "func (s *String) Type() ObjectType { return STRING_OBJ }", "title": "" }, { "docid": "3e5cbeeaefe4f9bb023c9aad8adb7d2f", "score": "0.594581", "text": "func (f *Factory) Type() configmodels.Type {\n\treturn configmodels.Type(typeStr)\n}", "title": "" }, { "docid": "1751b6a38ff889519125219bb978e297", "score": "0.59456915", "text": "func CertTypeFromString(s string) (CertType, error) {\n\tswitch strings.ToLower(s) {\n\tcase userString:\n\t\treturn UserCert, nil\n\tcase hostString:\n\t\treturn HostCert, nil\n\tdefault:\n\t\treturn 0, errors.Errorf(\"unknown certificate type '%s'\", s)\n\t}\n}", "title": "" }, { "docid": "9748b953085d52e33865c39eb30429e4", "score": "0.59377724", "text": "func FromStringToApplicationType(str string) (value ApplicationType) {\n\tvar ok bool\n\tvalue, ok = application_type_reverse_map[strings.Title(strings.TrimSpace(str))]\n\tif !ok {\n\t\tvalue = ApplicationTypeNone\n\t}\n\treturn\n}", "title": "" }, { "docid": "bbee5d05b2bbc2525a57a4ddd137c1ac", "score": "0.59063816", "text": "func fromString(t string) (Type, error) {\n\tt = strings.ToLower(t)\n\tparts := strings.Split(t, \"/\")\n\tif len(parts) != 2 {\n\t\treturn Type{}, fmt.Errorf(\"cannot parse %q as a media type\", t)\n\t}\n\tmainType := parts[0]\n\tsubParts := strings.Split(parts[1], \"+\")\n\n\tsubType := strings.Split(subParts[0], \";\")[0]\n\n\tvar suffix string\n\n\tif len(subParts) > 1 {\n\t\tsuffix = subParts[1]\n\t}\n\n\treturn Type{MainType: mainType, SubType: subType, mimeSuffix: suffix}, nil\n}", "title": "" }, { "docid": "40350375f52611d4e8f8c74f6723bdb2", "score": "0.5894265", "text": "func ParseType(s string) (*idl.Type, error) {\n\tvar err error\n\tvar t idl.Type\n\tvar m []string\n\tif m = mapRE.FindStringSubmatch(s); m != nil {\n\t\ti := findSplit(m[1])\n\t\tif i < 0 {\n\t\t\treturn nil, errors.New(\"Unable to break key/value: \" + s)\n\t\t}\n\t\tt.Name = \"map\"\n\t\tt.KeyType, err = ParseType(m[1][:i])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif !t.KeyType.IsPrimitive() {\n\t\t\treturn nil, errors.New(\"Key type must be a primitive type: \" + s)\n\t\t}\n\t\tt.ValueType, err = ParseType(m[1][i+1:])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else if m = listRE.FindStringSubmatch(s); m != nil {\n\t\tt.Name = \"list\"\n\t\tt.ValueType, err = ParseType(m[1])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else if m = basicRE.FindStringSubmatch(s); m != nil {\n\t\tt.Name = m[1]\n\t} else {\n\t\treturn nil, errors.New(\"Uanble to parse type: \" + s)\n\t}\n\treturn &t, nil\n}", "title": "" }, { "docid": "6f2ab3c2ba47a0394b8685344441fba5", "score": "0.58844584", "text": "func ServiceTypeFromString(s string) ServiceType {\n\tswitch strings.ToLower(s) {\n\tcase \"router\":\n\t\treturn Router\n\tcase \"control\", \"cs\":\n\t\treturn Control\n\tcase \"colibri\":\n\t\treturn Colibri\n\tcase \"discovery\":\n\t\treturn Discovery\n\tcase \"gateway\":\n\t\treturn Gateway\n\tcase \"hiddensegmentlookup\":\n\t\treturn HiddenSegmentLookup\n\tcase \"hiddensegmentregistration\":\n\t\treturn HiddenSegmentRegistration\n\tdefault:\n\t\treturn Unknown\n\t}\n}", "title": "" }, { "docid": "1ff0920b40fdea8153ed188c94bb4048", "score": "0.5874889", "text": "func (s *SymbolTable) TypeOf(name string) (string, error) {\n\tvar type_ string\n\tsubroutineTable := *s.table[KIND_ARG]\n\tclassTable := *s.table[KIND_STATIC]\n\n\t// Check subroutine scope first\n\ttype_ = subroutineTable[name].Type\n\tif type_ != \"\" {\n\t\treturn type_, nil\n\t}\n\n\t// If nothing was found, check class scope\n\ttype_ = classTable[name].Type\n\tif type_ != \"\" {\n\t\treturn type_, nil\n\t}\n\n\treturn \"\", fmt.Errorf(\"identifier %v was not found in any scope\", name)\n}", "title": "" }, { "docid": "730e388b1d5f54eb545d579a0d9e9836", "score": "0.585568", "text": "func (f *FileSetInfo) Type(name string) *TypeInfo {\n\tif pointerIndex := strings.LastIndex(name, \"*\"); pointerIndex != -1 {\n\t\tname = name[pointerIndex+1:]\n\t}\n\tfor _, v := range f.files {\n\t\tif v.HasType(name) {\n\t\t\treturn v.Type(name)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ae228086badd1b7ac6b672f990a605f3", "score": "0.58476007", "text": "func (v String) Type() Type {\n\treturn TypeString\n}", "title": "" }, { "docid": "88a40f33c54240b697dfeaa553cb6bd7", "score": "0.5812339", "text": "func (r *Registry) NameForType(i interface{}) (string, bool) {\n\tname, present := r.reverse[reflect.TypeOf(i)]\n\treturn name, present\n}", "title": "" }, { "docid": "f678d53d4a0120a37b33ea3f03f85621", "score": "0.581037", "text": "func TypeNameString(obj *types.TypeName,) string", "title": "" }, { "docid": "a3d5c87cef7c200640a8b7eadbe4b464", "score": "0.5806106", "text": "func TypeString(typ dgo.Type) string {\n\treturn TypeStringWithAliasMap(typ, internal.DefaultAliases())\n}", "title": "" }, { "docid": "79d3c3b7e1635b534e2deadc9d860533", "score": "0.5796559", "text": "func TypeByName(name string) (reflect.Type, bool) {\n\tt, ok := typeByName[name]\n\treturn t, ok\n}", "title": "" }, { "docid": "5a7c744e6062329ccbd4206dc974e428", "score": "0.5792003", "text": "func TypeNameType(obj *types.TypeName,) types.Type", "title": "" }, { "docid": "e858befdc8c8286d198449c06027b19b", "score": "0.5779608", "text": "func ParseType(s string) (Type, error) {\n\tvar t Type\nFields:\n\tfor _, f := range strings.Split(s, \"|\") {\n\t\tfor _, b := range typeBits {\n\t\t\tif b.s == f {\n\t\t\t\tt |= b.t\n\t\t\t\tcontinue Fields\n\t\t\t}\n\t\t}\n\t\tif strings.HasPrefix(f, \"Type(\") && strings.HasSuffix(f, \")\") {\n\t\t\tif n, err := strconv.ParseUint(f[5:len(f)-1], 0, 0); err == nil {\n\t\t\t\tt |= Type(n)\n\t\t\t\tcontinue Fields\n\t\t\t}\n\t\t}\n\t\tif f == \"\" {\n\t\t\treturn 0, fmt.Errorf(\"parsing %q: malformed Type\", s)\n\t\t}\n\t\treturn 0, fmt.Errorf(\"parsing %q: unknown Type %q\", s, f)\n\t}\n\treturn t, nil\n}", "title": "" }, { "docid": "a09505d7f7d9d0255ebbe090e77fdeca", "score": "0.5775157", "text": "func New(str string) Type {\n\ttyp, _, err := Eval(str, nil, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn typ\n}", "title": "" }, { "docid": "752405227f7c12768ea10bde5e9e53b9", "score": "0.5748553", "text": "func Type(target any, key string) (string, bool) {\n\ttt := reflect.TypeOf(target)\n\tif tt.Kind() != reflect.Ptr {\n\t\treturn \"\", false\n\t}\n\n\titem, err := FieldWithKey(target, key)\n\tif err != nil {\n\t\treturn \"\", false\n\t}\n\n\tfield := reflect.ValueOf(target).Elem().FieldByName(item)\n\tif tag, ok := Tag(target, item, \"type\"); ok {\n\t\treturn tag, true\n\t}\n\n\tswitch field.Kind() {\n\tcase reflect.Slice:\n\t\treturn \"strings\", true\n\n\tcase reflect.Int:\n\t\treturn \"integer\", true\n\n\tcase reflect.Int64:\n\t\treturn \"int64\", true\n\n\tcase reflect.String:\n\t\treturn \"string\", true\n\n\tcase reflect.Bool:\n\t\treturn \"boolean\", true\n\n\tdefault:\n\t\treturn \"\", false\n\t}\n}", "title": "" }, { "docid": "fe3ee28deeb8ee5e6f94c26e176247e2", "score": "0.5730921", "text": "func getType(str string) string {\n\tu, err := url.Parse(str)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif (strings.Contains(u.Path, \"/html/\")) {\n\t\treturn \"html\"\n\t} else if (strings.Contains(u.Path, \"/pdf/\")) {\n\t\treturn \"pdf\"\n\t} else if (strings.Contains(u.Path, \"/xml/\")) {\n\t\treturn \"xml\"\n\t} else {\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "d7c01f1e81cd0dd752e5a6964fe24f5e", "score": "0.5724172", "text": "func NewType(in string) (Type, error) {\n\tswitch in {\n\tcase customTypeString:\n\t\treturn Custom, nil\n\tcase managedTypeString:\n\t\treturn ChefManaged, nil\n\tcase systemTypeString:\n\t\treturn System, nil\n\tdefault:\n\t\treturn Custom, fmt.Errorf(\"policy type must be one of %q, you passed %q\", strValues, in)\n\t}\n}", "title": "" }, { "docid": "636f397465bc2b0e8e093346232238b9", "score": "0.57133025", "text": "func indexStringToType(indexTypeString string) (IndexType, error) {\n\tswitch indexTypeString {\n\tcase string(FullTextIndex):\n\t\treturn FullTextIndex, nil\n\tcase string(HashIndex):\n\t\treturn HashIndex, nil\n\tcase string(SkipListIndex):\n\t\treturn SkipListIndex, nil\n\tcase string(PrimaryIndex):\n\t\treturn PrimaryIndex, nil\n\tcase string(PersistentIndex):\n\t\treturn PersistentIndex, nil\n\tcase string(GeoIndex), \"geo1\", \"geo2\":\n\t\treturn GeoIndex, nil\n\tcase string(EdgeIndex):\n\t\treturn EdgeIndex, nil\n\tcase string(TTLIndex):\n\t\treturn TTLIndex, nil\n\tcase string(ZKDIndex):\n\t\treturn ZKDIndex, nil\n\tcase string(InvertedIndex):\n\t\treturn InvertedIndex, nil\n\tdefault:\n\t\treturn \"\", WithStack(InvalidArgumentError{Message: \"unknown index type\"})\n\t}\n}", "title": "" }, { "docid": "2045c7510265d762c4119a2a3693b2f7", "score": "0.56947577", "text": "func StrToProjectType(s string) ProjectType {\n\tswitch s {\n\tcase \"binary\":\n\t\treturn Binary\n\tcase \"library\":\n\t\treturn Library\n\t}\n\treturn Library\n}", "title": "" }, { "docid": "4dc8302c88a3947287d5fa4f63384339", "score": "0.5691488", "text": "func ValueTypeFromString(val string) ValueType {\n\tif _, err := strconv.ParseInt(val, 10, 64); err == nil {\n\t\treturn IntType\n\t} else if _, err := strconv.ParseBool(val); err == nil {\n\t\treturn IntType\n\t} else if _, err := strconv.ParseFloat(val, 64); err == nil {\n\t\treturn NumberType\n\t} else if _, err := dateparse.ParseAny(val); err == nil {\n\t\treturn TimeType\n\t}\n\treturn StringType\n}", "title": "" }, { "docid": "aa0e9260daaf2009a3f7210e898d7105", "score": "0.56902236", "text": "func strToOpType(opStr string) OpType {\n\tfor opType, strVal := range opTypeStrs {\n\t\tif opStr == strVal {\n\t\t\treturn OpType(opType)\n\t\t}\n\t}\n\treturn InvalidOp\n}", "title": "" }, { "docid": "b10795cb149f4e7b4d7ef826915d45b2", "score": "0.5636293", "text": "func (p *Parser) Type(name string) ParseableType {\r\n\treturn ParseableType{\r\n\t\tSchema: &p.Schema,\r\n\t\tTypeRef: schema.TypeRef{NamedType: &name},\r\n\t}\r\n}", "title": "" }, { "docid": "441c92f761a7bef5124fb3f07c5d5ba9", "score": "0.5628955", "text": "func ParseRUNNER_TYPEFromString(str string) (RUNNER_TYPE, error) {\n\tkey := strings.Trim(string(str), `\"`)\n\tv, ok := RUNNER_TYPE_value[strings.ToUpper(key)]\n\tif !ok {\n\t\treturn 0, fmt.Errorf(\"unknown RUNNER_TYPE: %s\", str)\n\t}\n\n\treturn RUNNER_TYPE(v), nil\n}", "title": "" }, { "docid": "d448a9c44f734d8ff52ac6b97c237cf8", "score": "0.5593064", "text": "func TypeOf(s string) ArgumentType {\n\tif strings.HasPrefix(s, \"--\") && s != \"--\" {\n\t\treturn LongType\n\t}\n\tif strings.HasPrefix(s, \"-\") && s != \"-\" {\n\t\treturn ShortType\n\t}\n\treturn ValueType\n}", "title": "" }, { "docid": "8e962534f34633d1a3c2accaec0fedba", "score": "0.55770284", "text": "func (this *RegexpReplace) Type() value.Type { return value.STRING }", "title": "" }, { "docid": "f827dda055621218ca1c25cd1787124c", "score": "0.55734897", "text": "func NameForType(i interface{}) (string, bool) {\n\treturn registry.NameForType(i)\n}", "title": "" }, { "docid": "9990231299262a521fc6a80dcf137ec8", "score": "0.55689704", "text": "func (dt InternalDataType) Type() string {\n\tif 0 <= dt && dt < InternalDataType(len(types)) {\n\t\treturn types[dt]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "747573d813d05ad22392696ba7cb0b6b", "score": "0.55651927", "text": "func progType(prog *loader.Program, t reflect.Type) (*types.TypeName, error) {\n\tif t.Kind() == reflect.Ptr {\n\t\tt = t.Elem()\n\t}\n\ttypeName := t.Name()\n\tif typeName == \"\" {\n\t\treturn nil, errgo.Newf(\"type %s is not named\", t)\n\t}\n\tpkgPath := t.PkgPath()\n\tif pkgPath == \"\" {\n\t\t// TODO could return types.Basic type here if we needed to.\n\t\treturn nil, errgo.Newf(\"type %s not declared in package\", t)\n\t}\n\tpkgInfo := prog.Package(pkgPath)\n\tif pkgInfo == nil {\n\t\treturn nil, errgo.Newf(\"cannot find %q in imported code\", pkgPath)\n\t}\n\tpkg := pkgInfo.Pkg\n\tobj := pkg.Scope().Lookup(typeName)\n\tif obj == nil {\n\t\treturn nil, errgo.Newf(\"type %s not found in %s\", typeName, pkgPath)\n\t}\n\tobjTypeName, ok := obj.(*types.TypeName)\n\tif !ok {\n\t\treturn nil, errgo.Newf(\"%s is not a type\", typeName)\n\t}\n\treturn objTypeName, nil\n}", "title": "" }, { "docid": "78367adb324d9963f9fb997d9431160d", "score": "0.5550557", "text": "func (m MimeType) Type() string {\n\treturn strings.SplitN(m.Name, \"/\", 2)[0]\n}", "title": "" }, { "docid": "adb0bf2986ca21dc28a8f6360104972b", "score": "0.55445105", "text": "func (t *StringToken) Type() TokenType {\n\treturn STRING\n}", "title": "" }, { "docid": "50ce2a444c724ec275d525ab72c04820", "score": "0.55433565", "text": "func TypeByFile(filename string) (string, error) {\n\treturn \"\", nil\n}", "title": "" }, { "docid": "0d6185365448c216b854f26519f1aeec", "score": "0.5541285", "text": "func MapType(rawtype string) (string, bool) {\n\tres, ok := typesMap[rawtype]\n\treturn res, ok\n}", "title": "" }, { "docid": "5ebadad2a56546715db4c93c1574a161", "score": "0.5522841", "text": "func dnsQueryStringToType(stringType string) uint16 {\n\tswitch stringType {\n\tcase \"A\":\n\t\treturn dns.TypeA\n\tcase \"AAAA\":\n\t\treturn dns.TypeAAAA\n\tcase \"CAA\":\n\t\treturn dns.TypeCAA\n\tcase \"CNAME\":\n\t\treturn dns.TypeCNAME\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "269e6d86db358d4255a557b578ce0d7f", "score": "0.5516521", "text": "func xiaomiDeviceTypeString(s string) (xiaomiDeviceType, error) {\n\tif val, ok := _xiaomiDeviceTypeNameToValueMap[s]; ok {\n\t\treturn val, nil\n\t}\n\treturn 0, fmt.Errorf(\"%s does not belong to xiaomiDeviceType values\", s)\n}", "title": "" }, { "docid": "032d6bac5cf2f0711bf2640e0d433c1f", "score": "0.55091256", "text": "func (reg *typeRegistry) IsStringTypeName(tn TypeRef) bool {\n\tt := reg.FindType(tn)\n\tif t == nil {\n\t\treturn false\n\t}\n\treturn reg.IsStringType(t)\n}", "title": "" }, { "docid": "1bf95b55f521752f2cc8093157b341cb", "score": "0.55090064", "text": "func (t Tag) TypeForKey(key string) string {\n\tif _, start, end, _ := t.findTypeForKey(key); end != start {\n\t\ts := t.str[start:end]\n\t\tif p := strings.IndexByte(s, '-'); p >= 0 {\n\t\t\ts = s[:p]\n\t\t}\n\t\treturn s\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ac2c1544dcb666400390a16effa34916", "score": "0.5508558", "text": "func (d *Magic) TypeByFile(filename string) (string, error) {\n\treturn \"\", ErrNotImplement\n}", "title": "" }, { "docid": "2b0e2e5ce4901a821908baa13dae4dc3", "score": "0.5494397", "text": "func dnsQueryStringToType(stringType string) uint16 {\n\tt, ok := dns.StringToType[strings.ToUpper(stringType)]\n\tif !ok {\n\t\tlog.Fatalf(\"unknown query type: \\\"%v\\\"\", stringType)\n\t}\n\treturn t\n}", "title": "" }, { "docid": "63e48871d571ec7bbfe88d1093bbede6", "score": "0.54907304", "text": "func ParseType(cTypeName string) (t Type) {\n\ts := cTypeName\n\tif s == \"void\" {\n\t\treturn TypeVoid\n\t}\n\n\tconst const0 = \"const \"\n\tconst const1 = \"__const \"\n\tisConst := false\n\tif strings.HasPrefix(s, const0) {\n\t\tisConst, s = true, trimLeading(s[len(const0):])\n\t} else if strings.HasPrefix(s, const1) {\n\t\tisConst, s = true, trimLeading(s[len(const1):])\n\t}\n\n\tisPointer := false\n\tif strings.HasSuffix(s, \"*\") {\n\t\tisPointer, s = true, trimTrailing(s[:len(s)-1])\n\t}\n\n\tif s == \"int\" {\n\t\tswitch {\n\t\tcase !isConst && !isPointer:\n\t\t\treturn TypeInt32 | TypeBits2_ScaRegMutbl\n\t\tcase isConst && !isPointer:\n\t\t\treturn TypeInt32 | TypeBits2_ScaRegConst\n\t\tcase !isConst && isPointer:\n\t\t\treturn TypeInt32 | TypeBits2_ScaPtrMutbl\n\t\tcase isConst && isPointer:\n\t\t\treturn TypeInt32 | TypeBits2_ScaPtrConst\n\t\t}\n\n\t} else if strings.HasSuffix(s, \"_t\") {\n\t\ts = s[:len(s)-2]\n\n\t\tfor i := 0; ; i++ {\n\t\t\tif i >= len(typeBits0Strings) {\n\t\t\t\treturn TypeInvalid\n\t\t\t} else if prefix := typeBits0Strings[i]; strings.HasPrefix(s, prefix) {\n\t\t\t\ts = s[len(prefix):]\n\t\t\t\tt |= Type(i) << 4\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif s == \"\" {\n\t\t\tswitch {\n\t\t\tcase !isConst && !isPointer:\n\t\t\t\treturn t | TypeBits1__Scalar | TypeBits2_ScaRegMutbl\n\t\t\tcase isConst && !isPointer:\n\t\t\t\treturn t | TypeBits1__Scalar | TypeBits2_ScaRegConst\n\t\t\tcase !isConst && isPointer:\n\t\t\t\treturn t | TypeBits1__Scalar | TypeBits2_ScaPtrMutbl\n\t\t\tcase isConst && isPointer:\n\t\t\t\treturn t | TypeBits1__Scalar | TypeBits2_ScaPtrConst\n\t\t\t}\n\t\t}\n\n\t\tif isConst || isPointer {\n\t\t\treturn TypeInvalid\n\t\t}\n\n\t\tif baseSize := typeBits0BaseSizes[t>>4]; baseSize <= baseSize__64Bits {\n\t\t\tif dv := dVectorStrings[baseSize]; strings.HasPrefix(s, dv) {\n\t\t\t\ts = s[len(dv):]\n\t\t\t\tt |= TypeBits1_DVector\n\t\t\t} else if qv := qVectorStrings[baseSize]; strings.HasPrefix(s, qv) {\n\t\t\t\ts = s[len(qv):]\n\t\t\t\tt |= TypeBits1_QVector\n\t\t\t} else {\n\t\t\t\treturn TypeInvalid\n\t\t\t}\n\t\t\tfor i, xn := range vectorXNStrings {\n\t\t\t\tif s == xn {\n\t\t\t\t\treturn t | Type(i)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn TypeInvalid\n}", "title": "" }, { "docid": "f9393cec4d10535a0870a2c57972dd2d", "score": "0.54808843", "text": "func ToGo(typeStr string) (string, error) {\n\tswitch typeStr {\n\tcase \"smallint\":\n\t\treturn \"int8\", nil\n\tcase \"integer\":\n\t\treturn \"int\", nil\n\tcase \"bigint\":\n\t\treturn \"int64\", nil\n\tcase \"decimal\", \"numeric\", \"double\", \"double precision\":\n\t\treturn \"float64\", nil\n\tcase \"real\":\n\t\treturn \"float32\", nil\n\tcase \"smallserial\":\n\t\treturn \"uint8\", nil\n\tcase \"serial\":\n\t\treturn \"uint32\", nil\n\tcase \"bigserial\":\n\t\treturn \"uint64\", nil\n\tcase \"boolean\":\n\t\treturn \"bool\", nil\n\tcase \"jsonb\":\n\t\treturn \"pgsql.JSONStr\", nil\n\t}\n\n\tvar strTypeRegex = regexp.MustCompile(\"character varying(\\\\d+)|varchar(\\\\d+)|character(\\\\d+)|char(\\\\d+)|text\")\n\tvar timeTypeRegex = regexp.MustCompile(\"((timestamp|time)( \\\\([0..6]\\\\))? (with|without) time zone)|date\")\n\n\tswitch {\n\tcase strTypeRegex.MatchString(typeStr):\n\t\treturn \"string\", nil\n\tcase timeTypeRegex.MatchString(typeStr):\n\t\treturn \"time.Time\", nil\n\t}\n\n\treturn \"\", errors.New(\"Unknown type\")\n}", "title": "" }, { "docid": "896198c387a3ff9708952d423efab32d", "score": "0.54587907", "text": "func getFileType(file, baseWithPrefix string) (string, error) {\n\ttypeRegex := map[string]string{\n\t\t\"file\": \"^\" + baseWithPrefix + \"[0-9]{4}/[0-9]{2}/[0-9]{2}/[0-9]{2}/.+$\",\n\t\t\"hour\": \"^\" + baseWithPrefix + \"[0-9]{4}/[0-9]{2}/[0-9]{2}/[0-9]{2}/$\",\n\t\t\"day\": \"^\" + baseWithPrefix + \"[0-9]{4}/[0-9]{2}/[0-9]{2}/$\",\n\t\t\"month\": \"^\" + baseWithPrefix + \"[0-9]{4}/[0-9]{2}/$\",\n\t\t\"year\": \"^\" + baseWithPrefix + \"[0-9]{4}/$\",\n\t\t\"base\": \"^\" + baseWithPrefix + \"$\",\n\t}\n\n\tfor t, regex := range typeRegex {\n\t\tmatch, err := regexp.MatchString(regex, file)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tif match {\n\t\t\treturn t, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"Type not found for %s\", file)\n}", "title": "" }, { "docid": "4f792e8ac095c06a8b57ef757a6f9f6b", "score": "0.5448492", "text": "func reflectTypeName(sample interface{}) string {\n\treturn reflect.TypeOf(sample).String()\n}", "title": "" }, { "docid": "372a01b8c5327041eb4df90c99447d42", "score": "0.5437335", "text": "func isDataType(input string) bool {\n\t_, found := dataTypes[input]\n\treturn found\n}", "title": "" }, { "docid": "6cd985483153c327fe84bc9371f0f9e4", "score": "0.5436996", "text": "func convertString(str string, typeValue string) interface{} {\n\tswitch typeValue {\n\tcase boolType:\n\t\t{\n\t\t\tvalue, _ := strconv.ParseBool(str)\n\t\t\treturn value\n\t\t}\n\tcase float64Type:\n\t\t{\n\t\t\tvalue, _ := strconv.ParseFloat(str, 64)\n\t\t\treturn value\n\t\t}\n\tcase intType:\n\t\t{\n\t\t\tvalue, _ := strconv.ParseInt(str, 10, 32)\n\t\t\treturn int(value)\n\t\t}\n\tcase int64Type:\n\t\t{\n\t\t\tvalue, _ := strconv.ParseInt(str, 10, 64)\n\t\t\treturn value\n\t\t}\n\tcase stringType:\n\t\t{\n\t\t\treturn str\n\t\t}\n\tcase uintType:\n\t\t{\n\t\t\tvalue, _ := strconv.ParseUint(str, 10, 32)\n\t\t\treturn uint(value)\n\t\t}\n\tcase uint64Type:\n\t\t{\n\t\t\tvalue, _ := strconv.ParseUint(str, 10, 64)\n\t\t\treturn value\n\t\t}\n\tcase databaseType:\n\t\t{\n\t\t\tvalue := database.Database{}\n\t\t\t_ = json.Unmarshal([]byte(str), &value)\n\t\t\treturn value\n\t\t}\n\t}\n\n\treturn str\n}", "title": "" }, { "docid": "7b1e6a322fd8b2a53b08313542f599da", "score": "0.5433845", "text": "func (m Type) Type() string {\n\t// Examples are\n\t// image/svg+xml\n\t// text/css\n\tif m.mimeSuffix != \"\" {\n\t\treturn m.MainType + \"/\" + m.SubType + \"+\" + m.mimeSuffix\n\t}\n\treturn m.MainType + \"/\" + m.SubType\n}", "title": "" }, { "docid": "f1b9f91e01626765753b93b4c9c0bab7", "score": "0.54249156", "text": "func (_ChallengeFactory *ChallengeFactoryCaller) INVALIDTYPESTR(opts *bind.CallOpts) (string, error) {\n\tvar out []interface{}\n\terr := _ChallengeFactory.contract.Call(opts, &out, \"INVALID_TYPE_STR\")\n\n\tif err != nil {\n\t\treturn *new(string), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(string)).(*string)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "7aac36044e3f2a5581b31bd8c115fa0d", "score": "0.5422869", "text": "func (o SecureStringOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SecureString) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e342e152da33c857a3ab5a9112bfa660", "score": "0.54216355", "text": "func typeof(v interface{}) string {\n\treturn reflect.TypeOf(v).String()\n}", "title": "" }, { "docid": "ee87404f0faa286ee011a581380c101b", "score": "0.54105073", "text": "func (r *Registry) GetType(name string) (reflect.Type, error) {\n\tr.mu.Lock()\n\tdefer r.mu.Unlock()\n\tt, ok := r.entries[name]\n\tif !ok {\n\t\treturn nil, ErrNotFound.WrapArgs(name)\n\t}\n\treturn t, nil\n}", "title": "" }, { "docid": "4b40eeff29159e079ccd97f5ff4471fc", "score": "0.54101396", "text": "func TypeName(t Type) string {\n\ts, ok := TypeNameMap[t]\n\tif ok == false {\n\t\tpanic(fmt.Sprintf(\"Unknown type: %d\", t))\n\t}\n\treturn s\n}", "title": "" }, { "docid": "2018b4daac680648605d01c8e08476f8", "score": "0.5409742", "text": "func (sf *StringsFlag) Type() string {\n\treturn \"string\"\n}", "title": "" }, { "docid": "d48db70a5d00ca30199ad693a3b60c5e", "score": "0.54089975", "text": "func (o KibanaSpecHttpServiceSpecOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v KibanaSpecHttpServiceSpec) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "98787cfd31991a3a19dfc27c542e1528", "score": "0.5408205", "text": "func (o SecureStringPtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SecureString) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "907651b06213e29ee58ab5826442da7d", "score": "0.5402832", "text": "func QTypeFromString(strQType string) QueryType {\n\tswitch strQType {\n\tcase \"is_auth\":\n\t\treturn IsAuth\n\tcase \"get_seed\":\n\t\treturn GetSeed\n\t}\n\n\treturn UNDEFINED\n}", "title": "" }, { "docid": "23166df70d84394f1ad2b568578572a8", "score": "0.53947407", "text": "func (c *Client) Type(key string) (string, error) {\n\tresp, err := c.exec(\"TYPE\", key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn c.stringResp(resp)\n}", "title": "" }, { "docid": "2fc7daf831c5304d62e98a4d701010a4", "score": "0.53915703", "text": "func (t Types) GetByType(tp string) (Type, bool) {\n\tfor _, tt := range t {\n\t\tif strings.EqualFold(tt.Type(), tp) {\n\t\t\treturn tt, true\n\t\t}\n\t}\n\n\tif !strings.Contains(tp, \"+\") {\n\t\t// Try with the main and sub type\n\t\tparts := strings.Split(tp, \"/\")\n\t\tif len(parts) == 2 {\n\t\t\treturn t.GetByMainSubType(parts[0], parts[1])\n\t\t}\n\t}\n\n\treturn Type{}, false\n}", "title": "" }, { "docid": "424031f31889592eb10a64cc90b914d7", "score": "0.5389347", "text": "func (o ServiceSpecPtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceSpec) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "29785469f8bc12854389fd9dcab5336f", "score": "0.53861773", "text": "func (o ServiceSpecOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceSpec) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "87db40e124251614c08430ad226d495f", "score": "0.5386079", "text": "func (o TextFormatOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v TextFormat) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "822f08edca9a6f3e867039465fd078f9", "score": "0.53793055", "text": "func StringToEffectType(s string) EffectType {\n\tswitch strings.ToLower(s) {\n\tcase \"static\":\n\t\treturn EffectStatic\n\tcase \"reactive\":\n\t\treturn EffectReactive\n\tcase \"spectrum\":\n\t\treturn EffectSpectrum\n\tcase \"breath\":\n\t\treturn EffectBreath\n\tcase \"breathdual\":\n\t\treturn EffectBreathDual\n\tcase \"breathrandom\":\n\t\treturn EffectBreathRandom\n\tcase \"starlight\":\n\t\treturn EffectStarlight\n\tcase \"starlightdual\":\n\t\treturn EffectStarlightDual\n\tcase \"starlightrandom\":\n\t\treturn EffectStarlightRandom\n\tcase \"ripple\":\n\t\treturn EffectRipple\n\tcase \"ripplerandom\":\n\t\treturn EffectRippleRandom\n\tcase \"wave\":\n\t\treturn EffectWave\n\t}\n\n\treturn EffectNone\n}", "title": "" }, { "docid": "436fd47ac23b0082c689df9929145f8d", "score": "0.5361563", "text": "func RunTypeEnumFromValue(value string) RunTypeEnum {\r\n switch value {\r\n case \"kRegular\":\r\n return RunType_KREGULAR\r\n case \"kFull\":\r\n return RunType_KFULL\r\n case \"kLog\":\r\n return RunType_KLOG\r\n case \"kSystem\":\r\n return RunType_KSYSTEM\r\n default:\r\n return RunType_KREGULAR\r\n }\r\n}", "title": "" }, { "docid": "9bd221427da5f9e1265a47ad445f8d04", "score": "0.5359373", "text": "func (tf TypeField) GetType() reflect.Type {\n\treturn typeMap[tf.TypeStr]\n}", "title": "" }, { "docid": "83268af308fa49549eecb5aac4815c60", "score": "0.5341472", "text": "func (o GetPolicyDefintionBuiltInResultOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetPolicyDefintionBuiltInResult) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9e5d8a44ba2fc7268c258cdfcfa4cd25", "score": "0.53398776", "text": "func (f *FileInfo) Type(name string) *TypeInfo {\n\treturn f.types[name]\n}", "title": "" }, { "docid": "9dc50ae37b7f427dd334a550990b1143", "score": "0.5336768", "text": "func (o LookupProcessorResultOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupProcessorResult) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "82ca25d911323c0599ac7c133e7b0196", "score": "0.5329644", "text": "func AnimalTypeString(s string) (AnimalType, error) {\n\tif val, ok := _AnimalTypeNameToValueMap[s]; ok {\n\t\treturn val, nil\n\t}\n\treturn 0, fmt.Errorf(\"%s does not belong to AnimalType values\", s)\n}", "title": "" }, { "docid": "c26f2877109f00e93166ae19ee2c7fad", "score": "0.5328932", "text": "func TestExpectType(t *testing.T) {\n\tt.Run(\"success\", func(t *testing.T) {\n\t\tr := bufio.NewReader(bytes.NewBufferString(TEST_STRING))\n\t\terr := expectType(r, '+')\n\t\trequire.NoError(t, err)\n\t})\n\tt.Run(\"redis error\", func(t *testing.T) {\n\t\tr := bufio.NewReader(bytes.NewBufferString(TEST_ERROR))\n\t\terr := expectType(r, '+')\n\t\trequire.Error(t, err)\n\t\trequire.EqualError(t, err, \"Redis error: error\")\n\t})\n\tt.Run(\"one value failure\", func(t *testing.T) {\n\t\tr := bufio.NewReader(bytes.NewBufferString(TEST_STRING))\n\t\terr := expectType(r, ':')\n\t\trequire.Error(t, err)\n\t\trequire.Equal(t, ErrWrongToken(':', '+'), err)\n\t})\n\tt.Run(\"read failure\", func(t *testing.T) {\n\t\tr := bufio.NewReader(bytes.NewBufferString(\"\"))\n\t\terr := expectType(r, ':')\n\t\trequire.Error(t, err)\n\t\trequire.Equal(t, io.EOF, err)\n\t})\n}", "title": "" }, { "docid": "753cf101e1b01b7022616b6cd08f5e1e", "score": "0.5322898", "text": "func (o PodFailurePolicyOnPodConditionsPatternOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v PodFailurePolicyOnPodConditionsPattern) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "02129d299fa3524073e9de5cb1e7cde0", "score": "0.5315179", "text": "func TypeOf(i interface{}) Type {\n\treturn ValueOf(i).Type()\n}", "title": "" }, { "docid": "03ffda3f191d88a27c9bf103bb5479e3", "score": "0.53121275", "text": "func (o KibanaSpecHttpServiceSpecPtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *KibanaSpecHttpServiceSpec) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" } ]
a904d88f584da4195fb158f7bab5cb8e
Int16sUint16sF creates a new slice with the results of calling the provided function on every element in the given array. If the given function returns an error, the element will be ignored.
[ { "docid": "531c01d0003621677283e5be1a4ead3d", "score": "0.7651073", "text": "func Int16sUint16sF(s []int16, f func(s int16) (uint16, error)) uint16s.Uint16s {\n\tm := uint16s.Uint16s(make([]uint16, 0, len(s)))\n\tvar (\n\t\tx uint16\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" } ]
[ { "docid": "7b9c1cc57cfb432e4ee0931be658e1a8", "score": "0.73045254", "text": "func Int16sUintsF(s []int16, f func(s int16) (uint, error)) uints.Uints {\n\tm := uints.Uints(make([]uint, 0, len(s)))\n\tvar (\n\t\tx uint\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "55e4b1ab6bf6eb0715238b06475dfd50", "score": "0.70925826", "text": "func Int16sUint32sF(s []int16, f func(s int16) (uint32, error)) uint32s.Uint32s {\n\tm := uint32s.Uint32s(make([]uint32, 0, len(s)))\n\tvar (\n\t\tx uint32\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "b2ed970dcf281e71b597bc4d0affd5f5", "score": "0.7067762", "text": "func Int16sUint8sF(s []int16, f func(s int16) (uint8, error)) uint8s.Uint8s {\n\tm := uint8s.Uint8s(make([]uint8, 0, len(s)))\n\tvar (\n\t\tx uint8\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "5ad89582df08a04a96cade82904be43b", "score": "0.7041414", "text": "func Int16sIntsF(s []int16, f func(s int16) (int, error)) ints.Ints {\n\tm := ints.Ints(make([]int, 0, len(s)))\n\tvar (\n\t\tx int\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "0ffa5edba9cbde710e434eae0cfe4c9b", "score": "0.6972683", "text": "func Int16sInt8sF(s []int16, f func(s int16) (int8, error)) int8s.Int8s {\n\tm := int8s.Int8s(make([]int8, 0, len(s)))\n\tvar (\n\t\tx int8\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "f3b40d7cdd397fbd06ae7513a5a6c58e", "score": "0.6920529", "text": "func Int16sUint64sF(s []int16, f func(s int16) (uint64, error)) uint64s.Uint64s {\n\tm := uint64s.Uint64s(make([]uint64, 0, len(s)))\n\tvar (\n\t\tx uint64\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "8407ece00972d12da4be51198a35d981", "score": "0.68818414", "text": "func Int16sUint16s(s []int16, f func(s int16) uint16) uint16s.Uint16s {\n\tm := uint16s.Uint16s(make([]uint16, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "5aa97445237e9dc951813c49b7d7b693", "score": "0.683405", "text": "func Int16sUintptrsF(s []int16, f func(s int16) (uintptr, error)) uintptrs.Uintptrs {\n\tm := uintptrs.Uintptrs(make([]uintptr, 0, len(s)))\n\tvar (\n\t\tx uintptr\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "832038ec97bb2d116315c23b340c26eb", "score": "0.68166196", "text": "func Int16sInterfacesF(s []int16, f func(s int16) (interface{}, error)) interfaces.Interfaces {\n\tm := interfaces.Interfaces(make([]interface{}, 0, len(s)))\n\tvar (\n\t\tx interface{}\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "ed7e2c6fd4b6ca0160bf151847f42f66", "score": "0.67875534", "text": "func cGetInt16s(fn func() *C.OBX_int16_array) (items []int16, err error) {\n\truntime.LockOSThread()\n\n\tvar cArray = fn()\n\tif cArray == nil {\n\t\terr = createError()\n\t} else {\n\t\titems = cInt16sArrayToGo(cArray)\n\t\tC.obx_int16_array_free(cArray)\n\t}\n\n\truntime.UnlockOSThread()\n\treturn items, err\n}", "title": "" }, { "docid": "68ddb96ee21013d02b1ef2d55e8b0062", "score": "0.6764874", "text": "func cGetUint16s(fn func() *C.OBX_int16_array) (items []uint16, err error) {\n\truntime.LockOSThread()\n\n\tvar cArray = fn()\n\tif cArray == nil {\n\t\terr = createError()\n\t} else {\n\t\titems = cUint16sArrayToGo(cArray)\n\t\tC.obx_int16_array_free(cArray)\n\t}\n\n\truntime.UnlockOSThread()\n\treturn items, err\n}", "title": "" }, { "docid": "bd082ff0a8451ce3945f103c4287b948", "score": "0.67375505", "text": "func Int16sBytesF(s []int16, f func(s int16) (byte, error)) bytes.Bytes {\n\tm := bytes.Bytes(make([]byte, 0, len(s)))\n\tvar (\n\t\tx byte\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "243e8b414f038e839b4ee22521d4db55", "score": "0.66900456", "text": "func Int16sInt32sF(s []int16, f func(s int16) (int32, error)) int32s.Int32s {\n\tm := int32s.Int32s(make([]int32, 0, len(s)))\n\tvar (\n\t\tx int32\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "ef8dab7b5f0b9dac9df2b0a3093c66b6", "score": "0.6687477", "text": "func Int16sUints(s []int16, f func(s int16) uint) uints.Uints {\n\tm := uints.Uints(make([]uint, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "e1883e5ec6d3a6358dd776afa0efec78", "score": "0.6659942", "text": "func Int16sInts(s []int16, f func(s int16) int) ints.Ints {\n\tm := ints.Ints(make([]int, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "4e411c0edd1c77bad348892e168697d6", "score": "0.660618", "text": "func Int16sBoolsF(s []int16, f func(s int16) (bool, error)) bools.Bools {\n\tm := bools.Bools(make([]bool, 0, len(s)))\n\tvar (\n\t\tx bool\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "95a58a5ed61f37ff69604bf5a5c0d4ad", "score": "0.6585658", "text": "func ForEachInt16(arr []int16, f func(int16)) {\n\tfor i := range arr {\n\t\tf(arr[i])\n\t}\n}", "title": "" }, { "docid": "32f7b033eeabb178868f1ca050c2b351", "score": "0.65811753", "text": "func Int16sInt64sF(s []int16, f func(s int16) (int64, error)) int64s.Int64s {\n\tm := int64s.Int64s(make([]int64, 0, len(s)))\n\tvar (\n\t\tx int64\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "8a058db942175ca036a593a429b2ae8c", "score": "0.6496188", "text": "func Int16sUint16sE(s []int16, f func(s int16) (uint16, error)) (uint16s.Uint16s, error) {\n\tm := uint16s.Uint16s(make([]uint16, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "2d7a8a4f5c1babb0d156a6d677e97fff", "score": "0.6493529", "text": "func Int16s(p []int16) {\n\tFlip(Int16Slice(p))\n}", "title": "" }, { "docid": "5b4b7664da33b54fe603e52dcd16f077", "score": "0.6420315", "text": "func Int16sInt8s(s []int16, f func(s int16) int8) int8s.Int8s {\n\tm := int8s.Int8s(make([]int8, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "c5e66e9d2d8ffdac150b9c80c922553d", "score": "0.64129794", "text": "func Int16sFloat64sF(s []int16, f func(s int16) (float64, error)) float64s.Float64s {\n\tm := float64s.Float64s(make([]float64, 0, len(s)))\n\tvar (\n\t\tx float64\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "8e6fd960940cf668249ff31cc5a143f5", "score": "0.6412305", "text": "func Int16(slice []int16) {\n\tdispatchInt16(slice)\n}", "title": "" }, { "docid": "fe5da404ba8856ac16ca85c2fe90a06e", "score": "0.640125", "text": "func Int16sRunesF(s []int16, f func(s int16) (rune, error)) runes.Runes {\n\tm := runes.Runes(make([]rune, 0, len(s)))\n\tvar (\n\t\tx rune\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "901a1cf5b7d1bf4c0d1eb2aaee823870", "score": "0.6379837", "text": "func ForEachUint16(arr []uint16, f func(uint16)) {\n\tfor i := range arr {\n\t\tf(arr[i])\n\t}\n}", "title": "" }, { "docid": "7e1fda8c7aab591a90c1c9015bde2ae4", "score": "0.6363648", "text": "func Int16sStringsF(s []int16, f func(s int16) (string, error)) strings.Strings {\n\tm := strings.Strings(make([]string, 0, len(s)))\n\tvar (\n\t\tx string\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "3dbb28aac32e7c4cba2a58fabbbe0408", "score": "0.63494", "text": "func Int16sUint32s(s []int16, f func(s int16) uint32) uint32s.Uint32s {\n\tm := uint32s.Uint32s(make([]uint32, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "9fa5715b7f77b342730890535e535f33", "score": "0.633893", "text": "func Int16sComplex128sF(s []int16, f func(s int16) (complex128, error)) complex128s.Complex128s {\n\tm := complex128s.Complex128s(make([]complex128, 0, len(s)))\n\tvar (\n\t\tx complex128\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "5c75c20f8f0406802205b33d2bada252", "score": "0.63252497", "text": "func Int16sComplex64sF(s []int16, f func(s int16) (complex64, error)) complex64s.Complex64s {\n\tm := complex64s.Complex64s(make([]complex64, 0, len(s)))\n\tvar (\n\t\tx complex64\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "3548b8aa03ba26338e4a12e57a97c957", "score": "0.6321868", "text": "func Int16sInterfaces(s []int16, f func(s int16) interface{}) interfaces.Interfaces {\n\tm := interfaces.Interfaces(make([]interface{}, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "e4e7ee8ce3f0976c7674415a63ca5e1c", "score": "0.63152766", "text": "func Int16sUint8s(s []int16, f func(s int16) uint8) uint8s.Uint8s {\n\tm := uint8s.Uint8s(make([]uint8, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "673b9a9c5dd4c428a438aae0df886d72", "score": "0.62551814", "text": "func Int16sBytes(s []int16, f func(s int16) byte) bytes.Bytes {\n\tm := bytes.Bytes(make([]byte, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "a33e35205037d3db342c10c455266c2f", "score": "0.6253343", "text": "func Int16sFloat32sF(s []int16, f func(s int16) (float32, error)) float32s.Float32s {\n\tm := float32s.Float32s(make([]float32, 0, len(s)))\n\tvar (\n\t\tx float32\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "5d3b8bda2a59d350f1e5c62e28f71251", "score": "0.62099177", "text": "func Int16sUint64s(s []int16, f func(s int16) uint64) uint64s.Uint64s {\n\tm := uint64s.Uint64s(make([]uint64, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "9cd05abb7db157b4dd0a7b103009370c", "score": "0.6190648", "text": "func (_Tester *TesterCaller) TestInt16Array(opts *bind.CallOpts, arg1 []int16) ([]int16, error) {\n\tvar out []interface{}\n\terr := _Tester.contract.Call(opts, &out, \"testInt16Array\", arg1)\n\n\tif err != nil {\n\t\treturn *new([]int16), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new([]int16)).(*[]int16)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "82327439ea4a166f77b09ac7da4a9480", "score": "0.61524004", "text": "func Int16sUintsE(s []int16, f func(s int16) (uint, error)) (uints.Uints, error) {\n\tm := uints.Uints(make([]uint, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "0a5838a5d48706900cc982dce53fbba2", "score": "0.61481297", "text": "func Int16s(key string, value []int16) Field {\n\treturn Field{\n\t\tkey: key,\n\t\ttyp: TypeInt16s,\n\t\txval: value,\n\t}\n}", "title": "" }, { "docid": "04b02e3b0f34722ea40111715d351b4f", "score": "0.614588", "text": "func (_Tester *TesterCaller) TestUint16Array(opts *bind.CallOpts, arg1 []uint16) ([]uint16, error) {\n\tvar out []interface{}\n\terr := _Tester.contract.Call(opts, &out, \"testUint16Array\", arg1)\n\n\tif err != nil {\n\t\treturn *new([]uint16), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new([]uint16)).(*[]uint16)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "a8a27040eddd3b94428ac024b41f6ddb", "score": "0.61334777", "text": "func Int16sUintptrs(s []int16, f func(s int16) uintptr) uintptrs.Uintptrs {\n\tm := uintptrs.Uintptrs(make([]uintptr, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "92015c862083c11b16b88e5d2d33bbb8", "score": "0.6115989", "text": "func Int16sFloat64s(s []int16, f func(s int16) float64) float64s.Float64s {\n\tm := float64s.Float64s(make([]float64, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "baac5a1ebf7ca91bc3a8302cd14739df", "score": "0.6084354", "text": "func MapInt16Err(f func(int16) (int16, error), list []int16) ([]int16, error) {\n\tif f == nil {\n\t\treturn []int16{}, nil\n\t}\n\tnewList := make([]int16, len(list))\n\tfor i, v := range list {\n\t\tvar err error\n\t\tnewList[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "dd861756abd5a9514a7eef0141e663a7", "score": "0.60653216", "text": "func Int16Array(name string, values []int16) FieldOpt {\n\treturn func(em *eventMetadata, ed *eventData) {\n\t\tem.writeArray(name, inTypeInt16, outTypeDefault, 0)\n\t\ted.writeUint16(uint16(len(values)))\n\t\tfor _, v := range values {\n\t\t\ted.writeInt16(v)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "456e56839ebc4751a75f5c5290346e72", "score": "0.60578394", "text": "func Int16sInt32s(s []int16, f func(s int16) int32) int32s.Int32s {\n\tm := int32s.Int32s(make([]int32, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "fc7e7c92962a67bf46c9856449da1d86", "score": "0.603674", "text": "func Uint16s(p []uint16) {\n\tFlip(Uint16Slice(p))\n}", "title": "" }, { "docid": "0c2ffcaf44379e387b456896c5cce3e5", "score": "0.60327584", "text": "func (_Tester *TesterSession) TestInt16Array(arg1 []int16) ([]int16, error) {\n\treturn _Tester.Contract.TestInt16Array(&_Tester.CallOpts, arg1)\n}", "title": "" }, { "docid": "581a95383f5d21dada48ca4e179e354b", "score": "0.60269696", "text": "func (_Tester *TesterCallerSession) TestInt16Array(arg1 []int16) ([]int16, error) {\n\treturn _Tester.Contract.TestInt16Array(&_Tester.CallOpts, arg1)\n}", "title": "" }, { "docid": "5030b7d413d6903c2f6dfef85a0263ae", "score": "0.60160434", "text": "func Int16sIntsE(s []int16, f func(s int16) (int, error)) (ints.Ints, error) {\n\tm := ints.Ints(make([]int, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "3bf316053d604e44af24910b8d096cc5", "score": "0.60120267", "text": "func Int16sInt64s(s []int16, f func(s int16) int64) int64s.Int64s {\n\tm := int64s.Int64s(make([]int64, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "4cb716bea406c76d344bd72219249771", "score": "0.5978057", "text": "func Int16sStrings(s []int16, f func(s int16) string) strings.Strings {\n\tm := strings.Strings(make([]string, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "1cea12847b7771882c9f48c4a5956b21", "score": "0.5957885", "text": "func (_Tester *TesterCallerSession) TestUint16Array(arg1 []uint16) ([]uint16, error) {\n\treturn _Tester.Contract.TestUint16Array(&_Tester.CallOpts, arg1)\n}", "title": "" }, { "docid": "addb754374c2d6acee91164ad09e88be", "score": "0.5949999", "text": "func AllInt16(f func(int16, int) bool, input []int16) (output bool) {\n\toutput = true\n\tfor idx, data := range input {\n\t\toutput = output && f(data, idx)\n\t\tif !output {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d8a69f70e9a385b456d15c837859fecd", "score": "0.5945978", "text": "func Int16sUint8sE(s []int16, f func(s int16) (uint8, error)) (uint8s.Uint8s, error) {\n\tm := uint8s.Uint8s(make([]uint8, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "a66859f2653cbca8642d7c6f77204d0d", "score": "0.59311074", "text": "func Int16sInt8sE(s []int16, f func(s int16) (int8, error)) (int8s.Int8s, error) {\n\tm := int8s.Int8s(make([]int8, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "d341e3c08af887eedeb8c7c1c122a778", "score": "0.5925196", "text": "func AllUint16(f func(uint16, int) bool, input []uint16) (output bool) {\n\toutput = true\n\tfor idx, data := range input {\n\t\toutput = output && f(data, idx)\n\t\tif !output {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "88c4614a805ad9796535c9c613500df9", "score": "0.5901394", "text": "func Uint16(slice []uint16) {\n\tdispatchUint16(slice)\n}", "title": "" }, { "docid": "3bb81147aecd34b4a810c6a81246799e", "score": "0.58995974", "text": "func Int16sUint32sE(s []int16, f func(s int16) (uint32, error)) (uint32s.Uint32s, error) {\n\tm := uint32s.Uint32s(make([]uint32, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "3aaa6759e07195c2e9909cf21ff8605d", "score": "0.5879187", "text": "func Int16sBools(s []int16, f func(s int16) bool) bools.Bools {\n\tm := bools.Bools(make([]bool, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "03c4e8f64a10593fbbacafeb775dcba6", "score": "0.5848094", "text": "func Int16sFloat32s(s []int16, f func(s int16) float32) float32s.Float32s {\n\tm := float32s.Float32s(make([]float32, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "3b5d5fb2ce0d9581ffa4d64d100baeb8", "score": "0.5836171", "text": "func (_Tester *TesterSession) TestUint16Array(arg1 []uint16) ([]uint16, error) {\n\treturn _Tester.Contract.TestUint16Array(&_Tester.CallOpts, arg1)\n}", "title": "" }, { "docid": "cf4c594960e5fed3e7e1c1842194f1c2", "score": "0.5820229", "text": "func (f *FlagSet) sliceInt16(name string, value sliceInt16Value, usage string, required, isset bool) *sliceInt16Value {\n\tp := new(sliceInt16Value)\n\tf.sliceInt16Var(p, name, value, usage, required, isset)\n\treturn p\n}", "title": "" }, { "docid": "c30975253c742666d3372d4a84064812", "score": "0.581947", "text": "func sliceInt16(name string, value sliceInt16Value, usage string, required, isset bool) *sliceInt16Value {\n\treturn CommandLine.sliceInt16(name, value, usage, required, isset)\n}", "title": "" }, { "docid": "f6a7ee7f722f67abc455726a811dedff", "score": "0.5798207", "text": "func Int16sRunes(s []int16, f func(s int16) rune) runes.Runes {\n\tm := runes.Runes(make([]rune, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "c883e76654c458e223edbf5d49bc613b", "score": "0.57697135", "text": "func Int16ToUint16Func(b *testing.B, supplier func() int16, toUint16Func func(int16) uint16) {\n\tif !isInt16SupplierCalibrated(supplier) {\n\t\tpanic(\"supplier function not calibrated\")\n\t}\n\tif !isInt16ToUint16FuncCalibrated(supplier) {\n\t\tpanic(\"Int16ToUint16Func not calibrated with this supplier\")\n\t}\n\tfor i, count := 0, b.N; i < count; i++ {\n\t\ttoUint16Func(supplier())\n\t}\n}", "title": "" }, { "docid": "4faf2874f5b3efd9bd9543c4f8ab6a73", "score": "0.57601154", "text": "func (e Encoder) AppendUints16(dst []byte, vals []uint16) []byte {\n\tmajor := majorTypeArray\n\tl := len(vals)\n\tif l == 0 {\n\t\treturn e.AppendArrayEnd(e.AppendArrayStart(dst))\n\t}\n\tif l <= additionalMax {\n\t\tlb := byte(l)\n\t\tdst = append(dst, major|lb)\n\t} else {\n\t\tdst = appendCborTypePrefix(dst, major, uint64(l))\n\t}\n\tfor _, v := range vals {\n\t\tdst = e.AppendUint16(dst, v)\n\t}\n\treturn dst\n}", "title": "" }, { "docid": "6395645185a77a9b91df9e3b27c3c938", "score": "0.573309", "text": "func MapUint16Err(f func(uint16) (uint16, error), list []uint16) ([]uint16, error) {\n\tif f == nil {\n\t\treturn []uint16{}, nil\n\t}\n\tnewList := make([]uint16, len(list))\n\tfor i, v := range list {\n\t\tvar err error\n\t\tnewList[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "ed8b3cdbc195684b4085a1c06a9a20ed", "score": "0.5728528", "text": "func FilterMapInt16Uint(fFilter func(int16) bool, fMap func(int16) uint, list []int16) []uint {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint{}\n\t}\n\tvar newList []uint\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "4fbc868dee3c3da82d59ef6cc0ab4d04", "score": "0.56979746", "text": "func FilterMapInt16Uint16(fFilter func(int16) bool, fMap func(int16) uint16, list []int16) []uint16 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint16{}\n\t}\n\tvar newList []uint16\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "a40c3fb076f612e7948ac76b8d509ac2", "score": "0.56978154", "text": "func SliceInt16(ok bool, truthy, falsey []int16) []int16 {\n\tif ok {\n\t\treturn truthy\n\t}\n\treturn falsey\n}", "title": "" }, { "docid": "6f0f43aeffffe7a17125b3bd245bb916", "score": "0.5691245", "text": "func Int16sUint64sE(s []int16, f func(s int16) (uint64, error)) (uint64s.Uint64s, error) {\n\tm := uint64s.Uint64s(make([]uint64, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "c995cc7e080ce4ac92fc2e36e0b60b80", "score": "0.56847334", "text": "func FilterMapUint16Int16(fFilter func(uint16) bool, fMap func(uint16) int16, list []uint16) []int16 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int16{}\n\t}\n\tvar newList []int16\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "b6cb602784486576374a7f3e5bf5c9e0", "score": "0.5667007", "text": "func Int16sComplex128s(s []int16, f func(s int16) complex128) complex128s.Complex128s {\n\tm := complex128s.Complex128s(make([]complex128, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "1d759b73e2141078bf5432fe6b86ba13", "score": "0.56661725", "text": "func ArrayInt16(ok bool, truthy, falsey []int16) []int16 {\n\tif ok {\n\t\treturn truthy\n\t}\n\treturn falsey\n}", "title": "" }, { "docid": "b36b934de9bd4693e6af0e7d2daf23a3", "score": "0.5656896", "text": "func sliceUint16(name string, value sliceUint16Value, usage string, required, isset bool) *sliceUint16Value {\n\treturn CommandLine.sliceUint16(name, value, usage, required, isset)\n}", "title": "" }, { "docid": "9761c2fa2599dd2a4769d9ecc926bc8c", "score": "0.5632346", "text": "func FilterMapIntUint16(fFilter func(int) bool, fMap func(int) uint16, list []int) []uint16 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint16{}\n\t}\n\tvar newList []uint16\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "4d7d1055a8058aa658b1e3ca46b22b3e", "score": "0.5631018", "text": "func FilterMapUintInt16(fFilter func(uint) bool, fMap func(uint) int16, list []uint) []int16 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int16{}\n\t}\n\tvar newList []int16\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "b6fd6f460769925cac9554b445d89768", "score": "0.5621425", "text": "func Uint16s(s []uint16) int {\n\treturn Slice(s, func(i int, j int) bool {\n\t\treturn s[i] < s[j]\n\t})\n}", "title": "" }, { "docid": "4e6d4316b1b85aa975e9651e62e1947e", "score": "0.56130993", "text": "func (f *FlagSet) sliceUint16(name string, value sliceUint16Value, usage string, required, isset bool) *sliceUint16Value {\n\tp := new(sliceUint16Value)\n\tf.sliceUint16Var(p, name, value, usage, required, isset)\n\treturn p\n}", "title": "" }, { "docid": "7e54a8d0af100f4255bcc34bf788717a", "score": "0.5603828", "text": "func SliceUint16List(tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]uint16, error) {\n\tquery, args := sliceSql(tbl, sqlname, wh, qc)\n\trows, err := Query(tbl, query, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tvar v uint16\n\tlist := make([]uint16, 0, 10)\n\n\tfor rows.Next() {\n\t\terr := rows.Scan(&v)\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn list, tbl.Logger().LogIfError(tbl.Ctx(), require.ErrorIfQueryNotSatisfiedBy(req, int64(len(list))))\n\t\t} else {\n\t\t\tlist = append(list, v)\n\t\t}\n\t}\n\n\treturn list, tbl.Logger().LogIfError(tbl.Ctx(), require.ChainErrorIfQueryNotSatisfiedBy(rows.Err(), req, int64(len(list))))\n}", "title": "" }, { "docid": "ced6db2669f97b1feb707f24bd9ae02e", "score": "0.55996156", "text": "func MapInt16Ptr(f func(*int16) *int16, list []*int16) []*int16 {\n\tif f == nil {\n\t\treturn []*int16{}\n\t}\n\tnewList := make([]*int16, len(list))\n\tfor i, v := range list {\n\t\tnewList[i] = f(v)\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "4538a4d7ad70d52989cd95292fcf54a7", "score": "0.55953175", "text": "func Int16sInterfacesE(s []int16, f func(s int16) (interface{}, error)) (interfaces.Interfaces, error) {\n\tm := interfaces.Interfaces(make([]interface{}, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "15b7890a1440a2b95eb8fac3c773d78a", "score": "0.5594131", "text": "func (e Encoder) AppendInts16(dst []byte, vals []int16) []byte {\n\tmajor := majorTypeArray\n\tl := len(vals)\n\tif l == 0 {\n\t\treturn e.AppendArrayEnd(e.AppendArrayStart(dst))\n\t}\n\tif l <= additionalMax {\n\t\tlb := byte(l)\n\t\tdst = append(dst, major|lb)\n\t} else {\n\t\tdst = appendCborTypePrefix(dst, major, uint64(l))\n\t}\n\tfor _, v := range vals {\n\t\tdst = e.AppendInt(dst, int(v))\n\t}\n\treturn dst\n}", "title": "" }, { "docid": "c333a3e6571cec21bffada4025b373b4", "score": "0.5593841", "text": "func Int16s(s []int16) int {\n\treturn Slice(s, func(i int, j int) bool {\n\t\treturn s[i] < s[j]\n\t})\n}", "title": "" }, { "docid": "7ea8ffcbe7af97b10bbd88e8b0417a83", "score": "0.55900127", "text": "func NewInt16Array(ab js.Value) TypedArray {\n\treturn TypedArray{js.Global().Get(\"Int16Array\").New(ab)}\n}", "title": "" }, { "docid": "d94d67ae2467c32dbc8f21a766df58c0", "score": "0.55818087", "text": "func ToInt16SliceE(i interface{}) ([]int16, error) {\n\tif i == nil {\n\t\treturn []int16{}, fmt.Errorf(\"unable to cast %#v of type %T to []int16\", i, i)\n\t}\n\n\tswitch v := i.(type) {\n\tcase []int16:\n\t\treturn v, nil\n\t}\n\n\tkind := reflect.TypeOf(i).Kind()\n\tswitch kind {\n\tcase reflect.Slice, reflect.Array:\n\t\ts := reflect.ValueOf(i)\n\t\ta := make([]int16, s.Len())\n\t\tfor j := 0; j < s.Len(); j++ {\n\t\t\tval, err := ToInt16E(s.Index(j).Interface())\n\t\t\tif err != nil {\n\t\t\t\treturn []int16{}, fmt.Errorf(\"unable to cast %#v of type %T to []int16\", i, i)\n\t\t\t}\n\t\t\ta[j] = val\n\t\t}\n\t\treturn a, nil\n\tdefault:\n\t\treturn []int16{}, fmt.Errorf(\"unable to cast %#v of type %T to []int16\", i, i)\n\t}\n}", "title": "" }, { "docid": "e79b99f58cae3138b7f07d64132ac3af", "score": "0.5580948", "text": "func Uint16s(key string, value []uint16) Field {\n\treturn Field{\n\t\tkey: key,\n\t\ttyp: TypeUint16s,\n\t\txval: value,\n\t}\n}", "title": "" }, { "docid": "edf1e596efec7d5895de1dc91c8813ec", "score": "0.5554833", "text": "func (b Buffer) ReadInts16(ints []int16) {\n\tif b == nil {\n\t\treturn\n\t}\n\tintsLen := len(ints)\n\tnumChannels := int(b.NumChannels())\n\tfor i := range b {\n\t\tb[i] = make([]float64, 0, intsLen)\n\t\tfor j := i; j < intsLen; j = j + numChannels {\n\t\t\tb[i] = append(b[i], float64(ints[j])/0x8000)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "37fcd8518e4ffdadb78ac5bda9a34c21", "score": "0.5553388", "text": "func SliceInt16List(tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]int16, error) {\n\tquery, args := sliceSql(tbl, sqlname, wh, qc)\n\trows, err := Query(tbl, query, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tvar v int16\n\tlist := make([]int16, 0, 10)\n\n\tfor rows.Next() {\n\t\terr := rows.Scan(&v)\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn list, tbl.Logger().LogIfError(tbl.Ctx(), require.ErrorIfQueryNotSatisfiedBy(req, int64(len(list))))\n\t\t} else {\n\t\t\tlist = append(list, v)\n\t\t}\n\t}\n\n\treturn list, tbl.Logger().LogIfError(tbl.Ctx(), require.ChainErrorIfQueryNotSatisfiedBy(rows.Err(), req, int64(len(list))))\n}", "title": "" }, { "docid": "3e1fb6f591b0f6ee266ab9edd3ef0bb3", "score": "0.55509156", "text": "func call16(typ, fn, arg unsafe.Pointer, n, retoffset uint32)", "title": "" }, { "docid": "794399be208b0764c435cd2bbf9d9f00", "score": "0.5550774", "text": "func ArrayUint16(ok bool, truthy, falsey []uint16) []uint16 {\n\tif ok {\n\t\treturn truthy\n\t}\n\treturn falsey\n}", "title": "" }, { "docid": "f66703e1971a662e911eb3a6d19a477c", "score": "0.55354553", "text": "func Int16sInt32sE(s []int16, f func(s int16) (int32, error)) (int32s.Int32s, error) {\n\tm := int32s.Int32s(make([]int32, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "28acb608e0ef86fa99afdbcaaecbc1a9", "score": "0.55108917", "text": "func FilterMapInt16Uint8(fFilter func(int16) bool, fMap func(int16) uint8, list []int16) []uint8 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint8{}\n\t}\n\tvar newList []uint8\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "59e9d027bf534bf34109f10e63599888", "score": "0.55089885", "text": "func Int16ToUint8Func(b *testing.B, supplier func() int16, toUint8Func func(int16) uint8) {\n\tif !isInt16SupplierCalibrated(supplier) {\n\t\tpanic(\"supplier function not calibrated\")\n\t}\n\tif !isInt16ToUint8FuncCalibrated(supplier) {\n\t\tpanic(\"Int16ToUint8Func not calibrated with this supplier\")\n\t}\n\tfor i, count := 0, b.N; i < count; i++ {\n\t\ttoUint8Func(supplier())\n\t}\n}", "title": "" }, { "docid": "3e0a548e37f9f37319651f986803c2ee", "score": "0.55076087", "text": "func Int16sComplex64s(s []int16, f func(s int16) complex64) complex64s.Complex64s {\n\tm := complex64s.Complex64s(make([]complex64, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "0c1d4120be1bf3a91de7b4c113288f90", "score": "0.550321", "text": "func IntToUint16Func(b *testing.B, supplier func() int, toUint16Func func(int) uint16) {\n\tif !isIntSupplierCalibrated(supplier) {\n\t\tpanic(\"supplier function not calibrated\")\n\t}\n\tif !isIntToUint16FuncCalibrated(supplier) {\n\t\tpanic(\"IntToUint16Func not calibrated with this supplier\")\n\t}\n\tfor i, count := 0, b.N; i < count; i++ {\n\t\ttoUint16Func(supplier())\n\t}\n}", "title": "" }, { "docid": "9d26a6e7cfc722cbd448172871f22de0", "score": "0.54906034", "text": "func Int16sBytesE(s []int16, f func(s int16) (byte, error)) (bytes.Bytes, error) {\n\tm := bytes.Bytes(make([]byte, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "c869ddc84b975f4d4a14b4ee098da2e5", "score": "0.54872715", "text": "func Uint16ToUint16Func(b *testing.B, supplier func() uint16, toUint16Func func(uint16) uint16) {\n\tif !isUint16SupplierCalibrated(supplier) {\n\t\tpanic(\"supplier function not calibrated\")\n\t}\n\tif !isUint16ToUint16FuncCalibrated(supplier) {\n\t\tpanic(\"Uint16ToUint16Func not calibrated with this supplier\")\n\t}\n\tfor i, count := 0, b.N; i < count; i++ {\n\t\ttoUint16Func(supplier())\n\t}\n}", "title": "" }, { "docid": "a758ec1f8a7664368ea4adf64103841c", "score": "0.5484499", "text": "func SliceUint16(ok bool, truthy, falsey []uint16) []uint16 {\n\tif ok {\n\t\treturn truthy\n\t}\n\treturn falsey\n}", "title": "" }, { "docid": "eee1ba09301fc9245196e277ef9eb0b7", "score": "0.54733795", "text": "func FilterMapUint16Int(fFilter func(uint16) bool, fMap func(uint16) int, list []uint16) []int {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int{}\n\t}\n\tvar newList []int\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "a6028c9274b003d0d0893b5954f21408", "score": "0.5460736", "text": "func Int16sFloat64sE(s []int16, f func(s int16) (float64, error)) (float64s.Float64s, error) {\n\tm := float64s.Float64s(make([]float64, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "e72393464b3b76fabf07935b265dfed0", "score": "0.5433377", "text": "func Int16sStringsE(s []int16, f func(s int16) (string, error)) (strings.Strings, error) {\n\tm := strings.Strings(make([]string, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" } ]
10f03e1b17be31c36a01c24ca4769181
IsSuccess returns true when this list bookmarked projects o k response has a 2xx status code
[ { "docid": "c14b8c6d710b6e1d46790904a4daa019", "score": "0.7363934", "text": "func (o *ListBookmarkedProjectsOK) IsSuccess() bool {\n\treturn true\n}", "title": "" } ]
[ { "docid": "a8fe5bc1a376c411aecad564b9e96c27", "score": "0.7322558", "text": "func (o *ListBookmarkedProjectsDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "7d95ab2443108b9184a7b7343a41da81", "score": "0.71712667", "text": "func (o *ListBookmarkedProjectsNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "1a5bec5fa9767b469af79b6b81511f00", "score": "0.71079844", "text": "func (o *ListBookmarkedProjectsNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "cd985aacf3663c7d87abfe93b614dc09", "score": "0.6929446", "text": "func (o *ListBookmarkedProjectsForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "d41e7ae952818c8ab06d40e43d05ef03", "score": "0.6542092", "text": "func (o *GetProjectUsingGETNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "ea8c60776e217c2cffa19ada90367a0a", "score": "0.6516363", "text": "func (o *GetProjectUsingGETForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "bc78ef0f24ee07cfd23c27d9f3d05d28", "score": "0.6341788", "text": "func (o *GetProjectActivitiesOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "9a334dcfaee1d0c54f48cb16034c972b", "score": "0.6325834", "text": "func (o *GetProjectActivitiesDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "6c9df27fda28319e4c9c1fa19ceb446e", "score": "0.63090026", "text": "func (o *GetProjectOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "a89a9881dd7cc793145314703e30e791", "score": "0.62856746", "text": "func (o *GetProjectActivitiesNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "bcf4b6431a60bdfe752ecda7753a5c21", "score": "0.6252253", "text": "func (o *GetProjectUsingGETOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "97b8b420c309c3da40bbf43fb5e91ed8", "score": "0.6234187", "text": "func (o *GetProjectForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "c9f09fd79638dfe61c92be7c1874a25c", "score": "0.6207474", "text": "func (o *GetProjectNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "ac19e25a323bb729699be0b753432561", "score": "0.61827207", "text": "func (o *GetProjectActivitiesNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "1c33a9bb8836ec06cc3b058d856d29a2", "score": "0.60981166", "text": "func (o *CreateProjectBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "053f60c961f34619883f626218224f27", "score": "0.6086137", "text": "func (o *SearchAndDownloadAssetsBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "40152397c0cf7427efa78265dd300f9e", "score": "0.6072442", "text": "func (o *ListUsingGET3OK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "de2d348db29a1075f132b7d1fbab6def", "score": "0.60629684", "text": "func (o *DisableProjectCINoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "89237445cb3954b5c9ad69912b5d5b59", "score": "0.60589856", "text": "func (o *GetProjectActivitiesForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "9c11a28f39aae3532c310dadcf05a468", "score": "0.6038989", "text": "func (o *DisableProjectCIDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "3d7fde8be6bf1b778d0b12e0ac1a6749", "score": "0.60092455", "text": "func (o *DisableProjectCIOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "c6616cc0045a8d69af240fe277a921b8", "score": "0.59963155", "text": "func IsSuccessful(code int) bool {\n\treturn code >= 200 && code < 300\n}", "title": "" }, { "docid": "c25e4dc88c7f52a47dcd8eb120865416", "score": "0.59887975", "text": "func (o *CreateProjectForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "c10c552d2a8c877478a89ee60d23ee7a", "score": "0.59886163", "text": "func (o *DisableProjectCINotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "be0ac1a92629bfd2d51be728c62b2415", "score": "0.59863085", "text": "func (o *GetDeploymentsOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "b7baa52c843e58d3e5e8d5577c43ed4f", "score": "0.5946713", "text": "func (o *SearchAndDownloadAssetsNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "a3c6e9c0033519845ba740f5c5b26ccf", "score": "0.59068364", "text": "func (o *GetRunsArtifactsLineageDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "20ab0b075fd5c679d3546beba16ab31e", "score": "0.59015524", "text": "func (o *AuditCollectionGetOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "dc4d21c578d253faa6ae41c97de94fad", "score": "0.58918", "text": "func (o *CreateAWSAccountMultiStatus) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "dec7d4b5a7fad14975db0830583b2a16", "score": "0.5887659", "text": "func (o *CreateProjectCreated) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "00bd7ac666a767cb954db27b40aa237e", "score": "0.58796996", "text": "func (o *PcloudCloudinstancesStockimagesGetOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "034b04d7bfd3901adac197d788ab3106", "score": "0.58786505", "text": "func (o *GetRepository4OK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "0d632575621c1933a42bc7616b3202ec", "score": "0.58694935", "text": "func (o *PcloudCloudinstancesStockimagesGetBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "0ec259ae0d942d48d9dcd12c277a8fd9", "score": "0.58631974", "text": "func (o *PcloudPvminstancesGetallOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "c17b1914dd56bc72c6c1d97e96880986", "score": "0.58540905", "text": "func (o *PcloudPvminstancesGetallBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "04c96c32fd048c587be08a8950cc9d2b", "score": "0.5850972", "text": "func HandleListProjectsSuccessfully(t *testing.T) {\n\tth.Mux.HandleFunc(\"/projects\", func(w http.ResponseWriter, r *http.Request) {\n\t\tth.TestMethod(t, r, \"GET\")\n\t\tth.TestHeader(t, r, \"Accept\", \"application/json\")\n\t\tth.TestHeader(t, r, \"X-Auth-Token\", client.TokenID)\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tfmt.Fprintf(w, ListOutput)\n\t})\n}", "title": "" }, { "docid": "8b5f8bb0f411f4a03a420aa136bf84e7", "score": "0.58471066", "text": "func (o *UpdateRepository23NoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "c596c154aea61d689bd15c1e2bbf1381", "score": "0.5822013", "text": "func (o *ListBookmarkedProjectsOK) Code() int {\n\treturn 200\n}", "title": "" }, { "docid": "8db2dfbbe49176c8d0c97dbc8ec62421", "score": "0.5816236", "text": "func (o *DisableProjectCIForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "8a673b13213a720764f764114667e3af", "score": "0.57950866", "text": "func (o *UpdateRepository10NoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "4d04eaa0d81bb92677d44da13a88f379", "score": "0.5789068", "text": "func (o *UpdateRepository9NoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "b5a7983331d710cb6c2d5f1c23f175eb", "score": "0.57833356", "text": "func (o *GetRepository7OK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "3ff653874c0d3159b8ae1bb1e03db8c1", "score": "0.57804114", "text": "func (o *CreateRepository20Created) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "8586203bdb4b98436dbe1c90420782f7", "score": "0.5779785", "text": "func (o *PcloudPvminstancesGetBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "8970ef35405bc0195195b7e258bdabdc", "score": "0.5778213", "text": "func (o *GetRunsArtifactsLineageNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "f96e6f09b2496030d9f2efb63c09dab7", "score": "0.5776667", "text": "func (o *GetApplicationsInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "15686a508b321bc6c90e457c627490de", "score": "0.57736194", "text": "func (o *GetRunArtifactLineageDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "6dcfe51005087b208b2e2eec75062883", "score": "0.5769686", "text": "func (o *AuditCollectionGetDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "7216dc0f0bb42c8158b5d8ccd97d6138", "score": "0.5769399", "text": "func (o *PcloudPvminstancesGetOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "79ec3fb66b615ee413fee7402d038ca2", "score": "0.57642686", "text": "func HandleListAvailableProjectsSuccessfully(t *testing.T) {\n\tth.Mux.HandleFunc(\"/auth/projects\", func(w http.ResponseWriter, r *http.Request) {\n\t\tth.TestMethod(t, r, \"GET\")\n\t\tth.TestHeader(t, r, \"Accept\", \"application/json\")\n\t\tth.TestHeader(t, r, \"X-Auth-Token\", client.TokenID)\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tfmt.Fprintf(w, ListAvailableOutput)\n\t})\n}", "title": "" }, { "docid": "5adabbde193c422a164168bf99f716d5", "score": "0.57640386", "text": "func (o *DeleteOrganizationRunsDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "ea2d6f82911d85e6a0a516fd3fb08528", "score": "0.5758308", "text": "func (o *ListOrganizationQueuesDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "21e572605f371b0a3ae35d8d2de6150c", "score": "0.57541865", "text": "func (o *ListBookmarkedProjectsOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "dae172f36281f0983dd3ed68033d5e02", "score": "0.57533056", "text": "func (o *DeleteOrganizationRunsOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "7c2a4bd13262a2ebe66a5a0e8d6ee282", "score": "0.5751681", "text": "func (o *PcloudCloudinstancesStockimagesGetNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "f80ecdc5da54a67e2bd14f1c2bee5e16", "score": "0.57464683", "text": "func (o *ListUsingGET3Forbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "e7b3338068d5fa4735dbafcafe1d1cc6", "score": "0.5746276", "text": "func (o *CreateRepository20Unauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "f1c1fa84a7900477a5da0e3761d57df7", "score": "0.5733636", "text": "func (o *GetAboutUsingGETUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "8b08ee4f2a1290bf94caa46d8a74fe20", "score": "0.5733534", "text": "func (o *PcloudPvminstancesGetallInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "404e1b059da9bc06ae202f27c5b6f9ca", "score": "0.57268894", "text": "func (o *GetRunsArtifactsLineageOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "0f2efc3dc7b8566c643f36ca6a24e0a4", "score": "0.57131237", "text": "func (o *GetAllDockerRegistryWebhooksUsingGETInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "926ca2881d8faeaf4d2321ea15f72754", "score": "0.5705008", "text": "func (o *DeleteOrganizationDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "5755cd5c269174252cac2a402fec2d7b", "score": "0.5702157", "text": "func (o *PcloudCloudinstancesStockimagesGetUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "1a5b5333d1ab21e4839c9fb9eb7721f9", "score": "0.56992346", "text": "func (o *UpdateRepository16NoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "074479b7ee7c8a31863dfc8c2d6e3636", "score": "0.5696657", "text": "func (o *AzureKeyVaultCollectionGetOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "d58119ae75973bc209e42603afb5c6fb", "score": "0.5696036", "text": "func (o *SecurityAuditLogCollectionGetOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "1e6fb395e17b2e37d9344ce219f76d96", "score": "0.569541", "text": "func (o *ListOrganizationQueuesNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "bc43b0096c8f10b488de9d96bb044b51", "score": "0.5689102", "text": "func (o *PcloudCloudinstancesStockimagesGetInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "33f5a9ee8397661bb919b5a6d5ac05a7", "score": "0.5686327", "text": "func (o *CreateRepository29Unauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "83c5f5162ff1f3dcd6e2cb29cface14f", "score": "0.5685961", "text": "func (o *GetProjectOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "305dff3bd5b56dc5dea08e7bcd729e01", "score": "0.5683026", "text": "func checkprojectStatus(c context.Context, projectID string, apiName string) (int, string, bool, string) {\n\tprojectStatus, err := getprojectStatusContextCached(c, projectID)\n\t// projectStatus, err := getprojectStatusCached(c, projectID)\n\n\tif err != nil || projectStatus.Deleted == \"D\" {\n\t\t//Not found\n\t\treturn 404, \"404 Page not found, check if projectID is correct\", true, \"\"\n\t}\n\n\tvar needAuth bool\n\tif apiName == \"AuthPulse\" && projectStatus.AuthPulse == \"T\" {\n\t\tneedAuth = true\n\t}\n\tif apiName == \"AuthPredict\" && projectStatus.AuthPredict == \"T\" {\n\t\tneedAuth = true\n\t}\n\tif apiName == \"AuthAction\" && projectStatus.AuthAction == \"T\" {\n\t\tneedAuth = true\n\t}\n\n\treturn 200, \"OK\", needAuth, projectStatus.SsnConf\n}", "title": "" }, { "docid": "c58760d406709adbc2f6eabb67927fc1", "score": "0.5682864", "text": "func (o *GetRunArtifactsTreeDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "933118d2478abeba3fdbd98ec4d35f79", "score": "0.56825393", "text": "func (o *CreateRepository20Forbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "f5d1d891b74618ef946fdd8d42781378", "score": "0.5672701", "text": "func (o *CreateRepository29Created) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "498138bde79064ecb27110cb1bd723c8", "score": "0.567099", "text": "func IsSuccess(actual int) bool {\n\treturn CheckStatusCode(actual, http.StatusNoContent, http.StatusOK, http.StatusAccepted, http.StatusCreated)\n}", "title": "" }, { "docid": "dda61f1e8765fe6f853bde127a13fcc2", "score": "0.5669856", "text": "func (o *DeleteRunArtifactLineageDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "96f8950ff16d28db40d9ec335d08a351", "score": "0.56696635", "text": "func (o *GetApplicationsBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "b68127ef19f9aae378ad0f9344ef36d1", "score": "0.56660306", "text": "func (o *CreateRepository18Forbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "efa67e13d8dd1320117c9ea57e6b5646", "score": "0.56645095", "text": "func (o *AzureKeyVaultRekeyInternalDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "877d5cc3880a50d21513c40891be8a3a", "score": "0.5657457", "text": "func (o *CreateRepository2Created) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "c6111861459967dc22c3c34f9640db6a", "score": "0.5654572", "text": "func (o *SnaplockRetentionOperationGetOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "df13e8740950f67c3d52ff815bd8eac6", "score": "0.5653722", "text": "func (o *GetApplicationsOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "de1744ae280c62aa212d51f58dc718b6", "score": "0.5653362", "text": "func (o *DeleteOrganizationOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "91964c85c9a3dde1ef35bd2c4fd52d71", "score": "0.56494915", "text": "func (o *JobModifyDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "0e2ece4de5fcfc6df5df0ec2811b9185", "score": "0.5647376", "text": "func (o *GetCSPMAzureAccountMultiStatus) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "988ed6972cd32f9f60121e46fa4ea3c4", "score": "0.5644896", "text": "func (o *UpdateRepository10Unauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "850f0926bda6c5f0197a8d033251e290", "score": "0.5644767", "text": "func (o *PatchServiceAccountDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "3f733af38d4cee101b4bc0987467bd0a", "score": "0.56433856", "text": "func (o *CreateRepository18Unauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "1a5706e598a6c397bd9e2723677268ec", "score": "0.5641804", "text": "func (o *CreateAWSAccountBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "32796ad4c42b7df04431c7648e8cf89c", "score": "0.56412596", "text": "func (o *CreateRepository29Forbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "e05ec818688c03563be8cea09b7e4b0e", "score": "0.56412333", "text": "func (o *CreateRepository18Created) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "b0952b454fc3f4b2210e45ac97b9d927", "score": "0.56392473", "text": "func (o *BatchObjectsDeleteOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "3ac827fb801053d7bb8d179b1d248b93", "score": "0.56378585", "text": "func (o *GetDeploymentsForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "c1c86f87359d7d1ab9304c9470735e03", "score": "0.5636381", "text": "func (o *SecurityAuditLogCollectionGetDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "a1e4baa11513ed954a7cac65bb2cd116", "score": "0.5634696", "text": "func (o *GetDeploymentFiltersUsingGET2OK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "0b78e435ccc56f3fe96669359293af17", "score": "0.56321144", "text": "func (o *ObjectsClassHeadNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "4e1767ac1d746b51644159e12f1e19dd", "score": "0.56317", "text": "func (o *DeleteOrganizationRunsNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "7e7e32dfd74eec2bed3359f55e6407cf", "score": "0.56252706", "text": "func (o *InspectRunDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "bc13b890adaa7799e83d2758e7513d79", "score": "0.56251675", "text": "func (o *GetCatalogItemsUsingGET5OK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "7b65a2479c7ddb047a8d5c550bb1f586", "score": "0.56250167", "text": "func (o *GetAboutUsingGETNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" } ]
0d9668ba8696874dc0391c4e28ccea1d
GetSentAt returns last sent timestamp
[ { "docid": "9f1243ebb831b4604b0a7f1af3997f56", "score": "0.7553667", "text": "func (c *ConfigurationItem) GetSentAt() time.Time {\n\treturn c.SentAt\n}", "title": "" } ]
[ { "docid": "4af2a9380927357e98824fcc4c7eb31a", "score": "0.7957887", "text": "func (o *ESMELogs) GetSentAt() time.Time {\n\treturn o.SentAt\n}", "title": "" }, { "docid": "73f82b279258da703e1112c20f4a9082", "score": "0.7751696", "text": "func (i *Input) SentAt() time.Time {\n\treturn i.timestamp.Time\n}", "title": "" }, { "docid": "144185eaf53d20a13e7b4aa4b3cbec58", "score": "0.731689", "text": "func (ai *AbortInput) SentAt() time.Time {\n\treturn ai.sentAt\n}", "title": "" }, { "docid": "55467291896459d6b89cea8c1e8ba135", "score": "0.70978576", "text": "func (hi *HelpInput) SentAt() time.Time {\n\treturn hi.sentAt\n}", "title": "" }, { "docid": "c75c3f8fa838de6de1a22af105793db6", "score": "0.6357947", "text": "func (o *ESMELogs) SetSentAt(v time.Time) {\n\to.SentAt = v\n}", "title": "" }, { "docid": "4a45905b4bce99a52e146d948fd6fbce", "score": "0.6181304", "text": "func (c *ConfigurationItem) SetSentAt(timestamp time.Time) {\n\tc.SentAt = timestamp\n}", "title": "" }, { "docid": "2967c191fe169cc8df4ca157293f204e", "score": "0.6179652", "text": "func (m *UserMutation) OtpSentAt() (r time.Time, exists bool) {\n\tv := m.otp_sent_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "ed2c57fdceb04b7e1bac290ab30d57b9", "score": "0.61280435", "text": "func (t *NetworkInstance_Protocol_Igmp_Interface_Counters_Queries) GetSent() *NetworkInstance_Protocol_Igmp_Interface_Counters_Queries_Sent {\n\tif t != nil && t.Sent != nil {\n\t\treturn t.Sent\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "04320650aeb872376cc471f26539758f", "score": "0.6090722", "text": "func (t *Trace) GetSent() bool {\n\treturn t.Sent\n}", "title": "" }, { "docid": "2b8d9862e1a140a0651e4629ebe7719b", "score": "0.6066493", "text": "func (m *UserMutation) RecoverySentAt() (r time.Time, exists bool) {\n\tv := m.recovery_sent_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "472c26d445e58a28efdaacc81f853c88", "score": "0.60624266", "text": "func (m *UserMutation) OldOtpSentAt(ctx context.Context) (v *time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldOtpSentAt is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldOtpSentAt requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldOtpSentAt: %w\", err)\n\t}\n\treturn oldValue.OtpSentAt, nil\n}", "title": "" }, { "docid": "abb8bc5d1662b902e7cef276cc422020", "score": "0.6006327", "text": "func (t *Bgp_Neighbor_Messages) GetSent() *Bgp_Neighbor_Messages_Sent {\n\tif t != nil && t.Sent != nil {\n\t\treturn t.Sent\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d6bcd40ee41c171a28ee4e29bd3d5870", "score": "0.5926654", "text": "func (t *NetworkInstance_Protocol_Bgp_Neighbor_Messages) GetSent() *NetworkInstance_Protocol_Bgp_Neighbor_Messages_Sent {\n\tif t != nil && t.Sent != nil {\n\t\treturn t.Sent\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca83b6b3c27e74bb4d07bfdf038f2403", "score": "0.5847284", "text": "func (t *NetworkInstance_Protocol_Igmp_Interface_Counters_Queries) GetOrCreateSent() *NetworkInstance_Protocol_Igmp_Interface_Counters_Queries_Sent {\n\tif t.Sent != nil {\n\t\treturn t.Sent\n\t}\n\tt.Sent = &NetworkInstance_Protocol_Igmp_Interface_Counters_Queries_Sent{}\n\treturn t.Sent\n}", "title": "" }, { "docid": "e72117a19e6420a8866a9979e0c75d06", "score": "0.58341014", "text": "func (t *NetworkInstance_Protocol_Bgp_Neighbor_Messages) GetOrCreateSent() *NetworkInstance_Protocol_Bgp_Neighbor_Messages_Sent {\n\tif t.Sent != nil {\n\t\treturn t.Sent\n\t}\n\tt.Sent = &NetworkInstance_Protocol_Bgp_Neighbor_Messages_Sent{}\n\treturn t.Sent\n}", "title": "" }, { "docid": "140dc0a1785c8ab1d6fe16c5e3bfb7d8", "score": "0.58261746", "text": "func (t *Bgp_Neighbor_Messages) GetOrCreateSent() *Bgp_Neighbor_Messages_Sent {\n\tif t.Sent != nil {\n\t\treturn t.Sent\n\t}\n\tt.Sent = &Bgp_Neighbor_Messages_Sent{}\n\treturn t.Sent\n}", "title": "" }, { "docid": "91b6498a5344fa29411632bd3bd42b72", "score": "0.58031523", "text": "func (m *UserMutation) EmailChangeSentAt() (r time.Time, exists bool) {\n\tv := m.email_change_sent_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "b58207e954616cb4d3211cd112f15b0b", "score": "0.57984823", "text": "func (t *NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Lsp) GetSent() uint32 {\n\tif t == nil || t.Sent == nil {\n\t\treturn 0\n\t}\n\treturn *t.Sent\n}", "title": "" }, { "docid": "b706b571ac9722db83ff46f444d59199", "score": "0.57800984", "text": "func (t *NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Esh) GetSent() uint32 {\n\tif t == nil || t.Sent == nil {\n\t\treturn 0\n\t}\n\treturn *t.Sent\n}", "title": "" }, { "docid": "af097c8c88668e0a4ca9ee1ca47f8edc", "score": "0.575004", "text": "func (m fakeMetric) LastPointReceivedAt() time.Time {\n\treturn time.Time{}\n}", "title": "" }, { "docid": "b4b354339a21f2fef3ce9abecd773aed", "score": "0.57088304", "text": "func (n *NetworkStatisticsEntryCall) GetSentBytes() (value int64) {\n\tif n == nil {\n\t\treturn\n\t}\n\treturn n.SentBytes\n}", "title": "" }, { "docid": "cf0ed76b631c52602b6c79ec0ff33106", "score": "0.56818074", "text": "func (m *UserMutation) OldConfirmationSentAt(ctx context.Context) (v *time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldConfirmationSentAt is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldConfirmationSentAt requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldConfirmationSentAt: %w\", err)\n\t}\n\treturn oldValue.ConfirmationSentAt, nil\n}", "title": "" }, { "docid": "7da9a16554840d48e65b917fa587fefd", "score": "0.56618136", "text": "func (n *NetworkStatisticsEntryFile) GetSentBytes() (value int64) {\n\tif n == nil {\n\t\treturn\n\t}\n\treturn n.SentBytes\n}", "title": "" }, { "docid": "937bf8c495ca63cebb23c62d102f8cf7", "score": "0.5635322", "text": "func (t *NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Csnp) GetSent() uint32 {\n\tif t == nil || t.Sent == nil {\n\t\treturn 0\n\t}\n\treturn *t.Sent\n}", "title": "" }, { "docid": "bd6a1e1279bf409fabc17975a522e8ef", "score": "0.5615428", "text": "func (t *NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Psnp) GetSent() uint32 {\n\tif t == nil || t.Sent == nil {\n\t\treturn 0\n\t}\n\treturn *t.Sent\n}", "title": "" }, { "docid": "f2ca38a72d10b8d8a401d7e3360ae75d", "score": "0.5600729", "text": "func (monitor *monitor) getSendTime(hBeat HBeatMessage) (sendTime time.Time, err error) {\n\tmonitor.mut.Lock()\n\tdefer monitor.mut.Unlock()\n\n\tif sendTime, ok := monitor.hBeatSendTimes[hBeat]; ok {\n\t\treturn sendTime, nil\n\t}\n\n\t// Return the \"Zero-time\" and an error.\n\treturn time.Time{}, hBeatNotFound(hBeat)\n}", "title": "" }, { "docid": "a72f2d7473b55b3b2df11c326ce9707a", "score": "0.5598623", "text": "func (m *UserMutation) ConfirmationSentAt() (r time.Time, exists bool) {\n\tv := m.confirmation_sent_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "cb4d24f07104921fa55d9c1a16a0d462", "score": "0.5595428", "text": "func (t *NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Unknown) GetSent() uint32 {\n\tif t == nil || t.Sent == nil {\n\t\treturn 0\n\t}\n\treturn *t.Sent\n}", "title": "" }, { "docid": "48ea6d2ecbec26e0d139f6bcbc046956", "score": "0.55857635", "text": "func (t *Bgp_Neighbor_AfiSafi_Prefixes) GetSent() uint32 {\n\tif t == nil || t.Sent == nil {\n\t\treturn 0\n\t}\n\treturn *t.Sent\n}", "title": "" }, { "docid": "bf1153dc09a3afae24e109f06f88d125", "score": "0.5584148", "text": "func (t *NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Ish) GetSent() uint32 {\n\tif t == nil || t.Sent == nil {\n\t\treturn 0\n\t}\n\treturn *t.Sent\n}", "title": "" }, { "docid": "0cbca0bd8df4ae6aa87b7e8ae5db8dec", "score": "0.5534119", "text": "func (m *UserMutation) OldRecoverySentAt(ctx context.Context) (v *time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldRecoverySentAt is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldRecoverySentAt requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldRecoverySentAt: %w\", err)\n\t}\n\treturn oldValue.RecoverySentAt, nil\n}", "title": "" }, { "docid": "f4d54aaf2004aff7c0749b2c8e708f45", "score": "0.55285656", "text": "func (p *Proxy) GetLastSentVersion(typeURI TypeURI) uint64 {\n\treturn p.lastSentVersion[typeURI]\n}", "title": "" }, { "docid": "7e81c317d1941d8ba94ca8e5dd728707", "score": "0.55265", "text": "func (t *Stp_Vlan_Interface_Counters) GetBpduSent() uint64 {\n\tif t == nil || t.BpduSent == nil {\n\t\treturn 0\n\t}\n\treturn *t.BpduSent\n}", "title": "" }, { "docid": "8201f291e5aec0312f7884a62d9940ae", "score": "0.5472903", "text": "func (o *WebAccel) GetGibSentInLastWeek() int64 {\n\treturn o.GibSentInLastWeek\n}", "title": "" }, { "docid": "b774394dbc8656ebb34b9705b7f337a7", "score": "0.54404426", "text": "func (t *Stp_Mstp_MstInstance_Interface_Counters) GetBpduSent() uint64 {\n\tif t == nil || t.BpduSent == nil {\n\t\treturn 0\n\t}\n\treturn *t.BpduSent\n}", "title": "" }, { "docid": "b69da121f04964c319e22d03abaf24cd", "score": "0.54355294", "text": "func (t *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes) GetSent() uint32 {\n\tif t == nil || t.Sent == nil {\n\t\treturn 0\n\t}\n\treturn *t.Sent\n}", "title": "" }, { "docid": "1dc98c5886f5606e3bc57d0d6aa2fc14", "score": "0.5422961", "text": "func (t *NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Iih) GetSent() uint32 {\n\tif t == nil || t.Sent == nil {\n\t\treturn 0\n\t}\n\treturn *t.Sent\n}", "title": "" }, { "docid": "25aaad73610fcb50802e348fc8779a76", "score": "0.541814", "text": "func (msg *Message) GetTimestamp() int64 {\n\treturn msg.Header.Timestamp\n}", "title": "" }, { "docid": "200fa1066c3ba518805053abb5412770", "score": "0.54087734", "text": "func (o *IntegrationInstanceStat) GetTimestamp() time.Time {\n\treturn time.Now().UTC()\n}", "title": "" }, { "docid": "ef770695db7fe8b9e764a68f7796eb28", "score": "0.54041886", "text": "func (device *Device) GetTimestamp() time.Time {\n return time.Unix(\n device.Timestamp/1000,\n (device.Timestamp%1000)*1000000,\n )\n}", "title": "" }, { "docid": "d30214d27103ec4c2d8b1fdff016eeef", "score": "0.53819513", "text": "func (o *ExportComplete) GetTimestamp() time.Time {\n\treturn time.Now().UTC()\n}", "title": "" }, { "docid": "9311af9128cbdacd45492a9bbc1def82", "score": "0.53507125", "text": "func (m *UserMutation) OldEmailChangeSentAt(ctx context.Context) (v *time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldEmailChangeSentAt is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldEmailChangeSentAt requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldEmailChangeSentAt: %w\", err)\n\t}\n\treturn oldValue.EmailChangeSentAt, nil\n}", "title": "" }, { "docid": "2fd3ab8d9c707bd174a2251a02e7f438", "score": "0.5348325", "text": "func (t *Stp_Rstp_Interface_Counters) GetBpduSent() uint64 {\n\tif t == nil || t.BpduSent == nil {\n\t\treturn 0\n\t}\n\treturn *t.BpduSent\n}", "title": "" }, { "docid": "a8c7c71d1e76e5f6dfe4fca0c20d21d1", "score": "0.5344763", "text": "func (msg *QueryRequestMessage) GetTimestamp() int64 {\n\treturn msg.HeaderGetTimestamp()\n}", "title": "" }, { "docid": "bb51401c0e3affc203aa80f88a6d8c2c", "score": "0.5344423", "text": "func (m *Message) Timestamp() time.Time {\n\treturn m.timestamp\n}", "title": "" }, { "docid": "a6cdadbc0520d1f9d6466bd15325b0c0", "score": "0.53412503", "text": "func (o *MutationResponse) GetTimestamp() time.Time {\n\treturn time.Now().UTC()\n}", "title": "" }, { "docid": "beeeeb715c60f6a167d46c063216a42b", "score": "0.53172654", "text": "func getTimestamp() int64 {\n\treturn time.Now().UnixNano() / int64(time.Millisecond)\n}", "title": "" }, { "docid": "f520fc2af12f12ea2b8db0f3ccee3916", "score": "0.5313338", "text": "func (_StateCommitmentChain *StateCommitmentChainCaller) GetLastSequencerTimestamp(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _StateCommitmentChain.contract.Call(opts, &out, \"getLastSequencerTimestamp\")\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": "f6a9a13a8d058eb0a97532061767d052", "score": "0.53027534", "text": "func (this *MailThread) GetTime() (t time.Time) {\n\tif this.Client != nil {\n\t\tt = this.Client.At\n\t}\n\treturn t\n}", "title": "" }, { "docid": "b253ce4c0a9418c7084ee97544b0930a", "score": "0.52756053", "text": "func (s *Story) GetIsBeingSent() (value bool) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.IsBeingSent\n}", "title": "" }, { "docid": "e12a89c1a8f2a41178fea7a0ff017e23", "score": "0.52671844", "text": "func (t *NetworkInstance_Protocol_Bgp_Neighbor_Messages_Sent) GetLastNotificationTime() uint64 {\n\tif t == nil || t.LastNotificationTime == nil {\n\t\treturn 0\n\t}\n\treturn *t.LastNotificationTime\n}", "title": "" }, { "docid": "4933e8d9e5f5c6bc46b9a90ff3b5ee35", "score": "0.52480984", "text": "func (tl *miniTrafficLogger) Sent(message []byte) {\n\ttl.LogEntry.LogDetail(logger.TrafficLevel, string(message), \"Sent\")\n}", "title": "" }, { "docid": "0d1a521925d27a9f9d07a2a3604cad73", "score": "0.5238178", "text": "func (dao *StampDAO) MarkSent(id uuid.UUID, txhash common.Hash) error {\n\treturn updateStampState(dao.db, id, txhash, \"sent\")\n}", "title": "" }, { "docid": "ece3d7d8f98d73dfdf9941d7f582e522", "score": "0.5219635", "text": "func (v *Message) GetTimestamp() uint64 {\n\tc := C.messageTimestamp(unsafe.Pointer(v.native()))\n\treturn uint64(c)\n}", "title": "" }, { "docid": "3972e52ef2e1aca37aafd49a926b7865", "score": "0.52191794", "text": "func (gs *GuildStore) GetTimestamp(guild Guild) int64 {\n\tgs.mutex.Lock()\n\tdefer gs.mutex.Unlock()\n\n\tfor _, gsGuild := range gs.Guilds {\n\t\tif gsGuild.GuildId == guild.GuildId {\n\t\t\t// found guild, now returning Timestamp\n\t\t\treturn gsGuild.Timestamp\n\t\t}\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "fe150e9c8fcf844d91ccf873ec9d2402", "score": "0.5199698", "text": "func (g *CommunicationMock) GetSentMessages(messageType protocol.MessageType) []*interfaces.ConsensusRawMessage {\n\tg.statsSentMessagesMutex.RLock()\n\tdefer g.statsSentMessagesMutex.RUnlock()\n\n\tvar res []*interfaces.ConsensusRawMessage\n\tfor _, msg := range g.statsSentMessages {\n\t\tif interfaces.ToConsensusMessage(msg).MessageType() == messageType {\n\t\t\tres = append(res, msg)\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "1a63192d7d1157e1e18fce2727e12f1a", "score": "0.519684", "text": "func (o *Hook) GetTimestamp() time.Time {\n\treturn time.Now().UTC()\n}", "title": "" }, { "docid": "b2d9d6112bf60303c6e4b85e75ee5e5d", "score": "0.51723504", "text": "func GetLastSyncTime(c *gin.Context) {\n\t// c.JSON(http.StatusOK,\n\t// \tgin.H{\"status\": 0, \"result\": tag})\n}", "title": "" }, { "docid": "317299f2050fd65a292024b1648bfcf4", "score": "0.5168665", "text": "func (mg *Graph) GetTimestamp() string {\n\treturn mg.ts.Get(mg.graph)\n}", "title": "" }, { "docid": "317299f2050fd65a292024b1648bfcf4", "score": "0.5168665", "text": "func (mg *Graph) GetTimestamp() string {\n\treturn mg.ts.Get(mg.graph)\n}", "title": "" }, { "docid": "0c664ed480ec734a49ca51309c0faecd", "score": "0.51614803", "text": "func getTimestamp() int64 {\n\treturn time.Now().Round(time.Millisecond).UnixNano() / (int64(time.Millisecond) / int64(time.Nanosecond))\n}", "title": "" }, { "docid": "a2d2f27064176e88346840855cdbe2cc", "score": "0.5149967", "text": "func (r *Report) GetTimestamp() time.Time {\r\n\treturn time.UnixMilli(r.ID.Time())\r\n}", "title": "" }, { "docid": "a123909f0816b7387450429e416bb360", "score": "0.5147565", "text": "func (p *LeveledPayload) Timestamp() time.Time { return p.timestamp }", "title": "" }, { "docid": "5520d6a80b21258104c56daaab3ff7f4", "score": "0.5145938", "text": "func (o *MessagesAllOf) GetTimestamp() interface{} {\n\tif o == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.Timestamp\n}", "title": "" }, { "docid": "72f5353daf332ebe4545382768776677", "score": "0.514478", "text": "func (g *Generator) LastTimestamp() int64 {\n\treturn int64(g.lastTimestamp)\n}", "title": "" }, { "docid": "68539206b9d671210719a49f0ae591e2", "score": "0.51413274", "text": "func (_AggregatorInterface *AggregatorInterfaceCaller) GetTimestamp(opts *bind.CallOpts, roundId *big.Int) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _AggregatorInterface.contract.Call(opts, &out, \"getTimestamp\", 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": "b17690d2b43dc1d70bfccb4d838bb7fc", "score": "0.510428", "text": "func (t *System_Aaa_ServerGroup_Server) GetMessagesSent() uint64 {\n\tif t == nil || t.MessagesSent == nil {\n\t\treturn 0\n\t}\n\treturn *t.MessagesSent\n}", "title": "" }, { "docid": "41c58d287d11f05f5c2de9d8fa0da3ba", "score": "0.51000977", "text": "func (_mr *MockFlowControlManagerMockRecorder) GetBytesSent(arg0 interface{}) *gomock.Call {\n\treturn _mr.mock.ctrl.RecordCall(_mr.mock, \"GetBytesSent\", arg0)\n}", "title": "" }, { "docid": "70d2041d40d9b2448e6c4d86d279ece4", "score": "0.5097108", "text": "func (o *Event) UpdatedAt() time.Time {\n\tif o != nil && o.bitmap_&32768 != 0 {\n\t\treturn o.updatedAt\n\t}\n\treturn time.Time{}\n}", "title": "" }, { "docid": "4d5a164a4f20cad927ded37bc5edab16", "score": "0.50893927", "text": "func (a *Answer) GetTimeStamp() time.Time {\n\treturn a.timestamp\n}", "title": "" }, { "docid": "5e55dbf87f5f2f0d3d5988d03bc038c3", "score": "0.5084864", "text": "func (o *Deployment) GetTimestamp() time.Time {\n\treturn time.Now().UTC()\n}", "title": "" }, { "docid": "da28a31debea219123812bb97bcb6e50", "score": "0.50724244", "text": "func (_AggregatorInterface *AggregatorInterfaceCallerSession) GetTimestamp(roundId *big.Int) (*big.Int, error) {\n\treturn _AggregatorInterface.Contract.GetTimestamp(&_AggregatorInterface.CallOpts, roundId)\n}", "title": "" }, { "docid": "16bd9fffc3f3b874569c9437336ffebb", "score": "0.50614107", "text": "func (m *_ResponseHeader) GetTimestamp() int64 {\n\treturn m.Timestamp\n}", "title": "" }, { "docid": "e339571d517a48a25596c64b4653a283", "score": "0.50521576", "text": "func (e *ElasticV2) GetLastTs() int64 {\n\tif val := e.GetSetting(\"last_ts\"); val != nil {\n\t\treturn val.(int64)\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "bf0a8b309d8c1aa03df8fd38907bf63c", "score": "0.5045834", "text": "func (msg *AbstractProtocolMessage) GetTimestamp() int64 {\n\treturn msg.HeaderGetTimestamp()\n}", "title": "" }, { "docid": "896d4d9807d7a3e453f37aaa7583c33b", "score": "0.50456643", "text": "func (t *Timer) LastAt() time.Time { return t.lastAt }", "title": "" }, { "docid": "520dabe59ee2070a5919df254b747d46", "score": "0.50239146", "text": "func (t *RelayAgent_Dhcp_Interface_Counters) GetBootrequestSent() uint64 {\n\tif t == nil || t.BootrequestSent == nil {\n\t\treturn 0\n\t}\n\treturn *t.BootrequestSent\n}", "title": "" }, { "docid": "3a218b14e2ade23822569bf008dbee5d", "score": "0.5021598", "text": "func (t *RelayAgent_Dhcpv6_Interface_Counters) GetDhcpv6RelayForwSent() uint64 {\n\tif t == nil || t.Dhcpv6RelayForwSent == nil {\n\t\treturn 0\n\t}\n\treturn *t.Dhcpv6RelayForwSent\n}", "title": "" }, { "docid": "2234de896ccdc5b40973a1b17dca7001", "score": "0.50209796", "text": "func GetCurrTs() int64 {\r\n\treturn time.Now().Unix()\r\n}", "title": "" }, { "docid": "ba3cba7f8d6cd59ce655c92173d2dd20", "score": "0.50138396", "text": "func (t *RelayAgent_Dhcp_Interface_Counters) GetDhcpOfferSent() uint64 {\n\tif t == nil || t.DhcpOfferSent == nil {\n\t\treturn 0\n\t}\n\treturn *t.DhcpOfferSent\n}", "title": "" }, { "docid": "d1c0092e158f10e9626c8b47e659a1bd", "score": "0.5001007", "text": "func (p *Proxy) GetLastSentNonce(typeURI TypeURI) string {\n\tnonce, ok := p.lastNonce[typeURI]\n\tif !ok {\n\t\tp.lastNonce[typeURI] = \"\"\n\t\treturn \"\"\n\t}\n\treturn nonce\n}", "title": "" }, { "docid": "342e877182f865f8cc8f2ef32b282c59", "score": "0.4991661", "text": "func (o *ManagedService) UpdatedAt() time.Time {\n\tif o != nil && o.bitmap_&2048 != 0 {\n\t\treturn o.updatedAt\n\t}\n\treturn time.Time{}\n}", "title": "" }, { "docid": "e0ce30f7718755fbb1f275a7a89bd144", "score": "0.4984654", "text": "func (o *SIM) GetModifiedAt() time.Time {\n\treturn o.ModifiedAt\n}", "title": "" }, { "docid": "a2519414d3e34d43b734e2a956a05a6c", "score": "0.4972457", "text": "func (client DatetimeClient) GetUtcMinDateTimeSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "f3583b0ce58ff78da0c96a7cbd48444c", "score": "0.49694163", "text": "func GetCurrentTimestamp() int64 {\n\treturn time.Now().Unix()\n}", "title": "" }, { "docid": "c1ed5f11c2ed77be8f54fdf09d5e4e0f", "score": "0.49663898", "text": "func (o *MonitorInterfaceValue) GetSend() float64 {\n\treturn o.Send\n}", "title": "" }, { "docid": "eb80af400e6fe9e903a5dc691f52d36f", "score": "0.49612835", "text": "func (b Block) GetTimeStamp() string {\n\treturn b.Timestamp\n}", "title": "" }, { "docid": "12c5cabc2d2b6aa3510cbf049cd262dd", "score": "0.49581313", "text": "func TimestampNow() func(msg proto.Message) error {\n\treturn Timestamp(time.Now().UnixNano())\n}", "title": "" }, { "docid": "ceed6631dfc7e89f86549127ea4a0c68", "score": "0.4957799", "text": "func (p *Counter) MovedAt() *time.Ticket {\n\treturn p.movedAt\n}", "title": "" }, { "docid": "fff808f293cda58e88bb49f54a05b023", "score": "0.49532592", "text": "func (sr StreamRecord) TimestampMillis() int64 {\n\treturn sr.ts\n}", "title": "" }, { "docid": "0eed295890910639abcb45dbce33c2cf", "score": "0.49455371", "text": "func (e event) Timestamp() time.Time {\n\treturn e.evtJSON.Timestamp\n}", "title": "" }, { "docid": "43f9ea232ff2675b8ccde2ec26319824", "score": "0.49414384", "text": "func (m *MoveInfo) Timestamp() time.Time {\n\treturn m.timestamp\n}", "title": "" }, { "docid": "62f9c198e34aafbbd5a6b43634b8f082", "score": "0.49393207", "text": "func (o *HttpEvent) GetTs() time.Time {\n\tif o == nil || o.Ts == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.Ts\n}", "title": "" }, { "docid": "832d02d25a2c02acce345400c56b8b3a", "score": "0.49324584", "text": "func (this *IBlockData) GetLastSendData() []byte {\n\t//data := make([]byte, 8)\n\t//binary.LittleEndian.PutUint32(data[0:4], this.BlockToken)\n\t//var start, end int\n\t//var more uint8 = 0\n\t//\n\t//for {\n\t//\tif this.DataLen < this.SendStep {\n\t//\t\tstart = 0\n\t//\t\tend = this.DataLen\n\t//\t\tmore = 0\n\t//\t\tbreak\n\t//\t}\n\t//\n\t//\tstart = int((this.SendSeq - 1)) * this.SendStep\n\t//\n\t//\tif int(this.SendSeq)*this.SendStep >= this.DataLen {\n\t//\t\t// the last block\n\t//\t\tend = this.DataLen\n\t//\t\tmore = 0\n\t//\t} else {\n\t//\t\tend = start + this.SendStep\n\t//\t\tmore = 1\n\t//\t}\n\t//\n\t//\tbreak\n\t//}\n\t//binary.LittleEndian.PutUint32(data[4:8], this.SendSeq)\n\t//data = append(data, more)\n\t//data = append(data, this.RawData[start:end]...)\n\tdata := this.lastData\n\tthis.SendTime = time.Now().Unix()\n\treturn data\n}", "title": "" }, { "docid": "9a612fca69f8075d0df6fab727fc00b4", "score": "0.49314162", "text": "func (bwc *BandwidthCounter) LogSentMessage(size int64) {\n\tbwc.totalOut.Mark(uint64(size))\n}", "title": "" }, { "docid": "fb26092f74deacb8b6997bbcb267e143", "score": "0.49303642", "text": "func (m *UserMutation) OtpSentAtCleared() bool {\n\t_, ok := m.clearedFields[user.FieldOtpSentAt]\n\treturn ok\n}", "title": "" }, { "docid": "006d05d8dd4c874c3bb79ff940f2a7e5", "score": "0.49301112", "text": "func (t *food_supplychain) GetTxTimestampChannel(APIstub shim.ChaincodeStubInterface) (string, error) {\n\ttxTimeAsPtr, err := APIstub.GetTxTimestamp()\n\tif err != nil {\n\t\tfmt.Printf(\"Returning error in TimeStamp \\n\")\n\t\treturn \"Error\", err\n\t}\n\tfmt.Printf(\"\\t returned value from APIstub: %v\\n\", txTimeAsPtr)\n\ttimeStr := time.Unix(txTimeAsPtr.Seconds, int64(txTimeAsPtr.Nanos)).String()\n\n\treturn timeStr, nil\n}", "title": "" }, { "docid": "7a8ea36765fef08ab42d43398278bc92", "score": "0.49196875", "text": "func (s *SyslogMsg) TimeStamp() string { return s.timestamp }", "title": "" }, { "docid": "73cf8bd056bf4de5fe80c3980bcd47d5", "score": "0.4918226", "text": "func (r *Request) getTimestamp() (time.Time, error) {\n\ti, err := strconv.ParseInt(r.Timestamp, 10, 64)\n\tif err != nil {\n\t\tlog.Errorf(\"cannot parse timestamp %s: %v\", r.Timestamp, err)\n\t\treturn time.Time{}, err\n\t}\n\tloc, err := tz.LoadLocation(r.Area)\n\tif err != nil {\n\t\tlog.Errorf(\"cannot find location: %s\", r.Area)\n\t\treturn time.Time{}, err\n\t}\n\n\treturn time.Unix(i, 0).In(loc), nil\n}", "title": "" }, { "docid": "b8cb944800e8100300c3cdddfe316b1b", "score": "0.49168864", "text": "func (h *Hit) TimestampPacket() *irp.Packet {\n\treturn BuildBadgeUploadHitRecordTimestamp(h.Timestamp)\n}", "title": "" } ]
32155dbf1abbce57a78db1c598f92855
Must be a value receiver to ensure it is marshaled correctly from it's parent struct
[ { "docid": "638087a64835b21018542134ccdfc6c0", "score": "0.0", "text": "func (t TransliterationMethodCode) MarshalJSON() ([]byte, error) {\n\tdata := strings.TrimPrefix(t.String(), transliterationMethodCodePrefix)\n\treturn json.Marshal(data)\n}", "title": "" } ]
[ { "docid": "ff613e9f80d3edbe18c560db7657a50c", "score": "0.5739005", "text": "func (this *Value) Value() interface{} {\n return this.value\n}", "title": "" }, { "docid": "527eeb8da44cf6fb853fe66dc9de8f50", "score": "0.5622565", "text": "func (this *Value) MarshalJSON() ([]byte, error) {\n return json.Marshal(this.value)\n}", "title": "" }, { "docid": "4270e33d22f63055b2b0fe9042e900a9", "score": "0.55252725", "text": "func (*TestMarshaller) Marshal(v interface{}) ([]byte, error) { return json.Marshal(v) }", "title": "" }, { "docid": "b7d319588e8941175049259ea0e9841b", "score": "0.5515188", "text": "func (js *JsonStruct) Marshal() ([]byte, error) {\n return json.Marshal(&js.raw)\n}", "title": "" }, { "docid": "7e75f1bb8d08c21efe3578efd13df3f0", "score": "0.54600924", "text": "func (v*Value) Marshal() ([]byte,error) {\n\treturn json.Marshal(v.data)\n}", "title": "" }, { "docid": "1273087fd0d9d3aa0404b94d773243bb", "score": "0.5373013", "text": "func (m *JsonMarshaler) marshalValue(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error {\n\tvar err error\n\tv = reflect.Indirect(v)\n\n\t// Handle nil pointer\n\tif v.Kind() == reflect.Invalid {\n\t\tout.write(\"null\")\n\t\treturn out.err\n\t}\n\n\t// Handle repeated elements.\n\tif v.Kind() == reflect.Slice && v.Type().Elem().Kind() != reflect.Uint8 {\n\t\tout.write(\"[\")\n\t\tcomma := \"\"\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tsliceVal := v.Index(i)\n\t\t\tout.write(comma)\n\t\t\tif m.Indent != \"\" {\n\t\t\t\tout.write(\"\\n\")\n\t\t\t\tout.write(indent)\n\t\t\t\tout.write(m.Indent)\n\t\t\t\tout.write(m.Indent)\n\t\t\t}\n\t\t\tif err := m.marshalValue(out, prop, sliceVal, indent+m.Indent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcomma = \",\"\n\t\t}\n\t\tif m.Indent != \"\" {\n\t\t\tout.write(\"\\n\")\n\t\t\tout.write(indent)\n\t\t\tout.write(m.Indent)\n\t\t}\n\t\tout.write(\"]\")\n\t\treturn out.err\n\t}\n\n\t// Handle well-known types.\n\t// Most are handled up in marshalObject (because 99% are messages).\n\tif wkt, ok := v.Interface().(wkt); ok {\n\t\tswitch wkt.XXX_WellKnownType() {\n\t\tcase \"NullValue\":\n\t\t\tout.write(\"null\")\n\t\t\treturn out.err\n\t\t}\n\t}\n\n\t// Handle enumerations.\n\tif !m.EnumsAsInts && prop.Enum != \"\" {\n\t\t// Unknown enum values will are stringified by the proto library as their\n\t\t// value. Such values should _not_ be quoted or they will be interpreted\n\t\t// as an enum string instead of their value.\n\t\tenumStr := v.Interface().(fmt.Stringer).String()\n\t\tvar valStr string\n\t\tif v.Kind() == reflect.Ptr {\n\t\t\tvalStr = strconv.Itoa(int(v.Elem().Int()))\n\t\t} else {\n\t\t\tvalStr = strconv.Itoa(int(v.Int()))\n\t\t}\n\t\tisKnownEnum := enumStr != valStr\n\t\tif isKnownEnum {\n\t\t\tout.write(`\"`)\n\t\t}\n\t\tout.write(enumStr)\n\t\tif isKnownEnum {\n\t\t\tout.write(`\"`)\n\t\t}\n\t\treturn out.err\n\t}\n\n\t// Handle nested messages.\n\tif v.Kind() == reflect.Struct {\n\t\treturn m.marshalObject(out, v.Addr().Interface().(proto.Message), indent+m.Indent)\n\t}\n\n\t// Handle maps.\n\t// Since Go randomizes map iteration, we sort keys for stable output.\n\tif v.Kind() == reflect.Map {\n\t\tout.write(`{`)\n\t\tkeys := v.MapKeys()\n\t\tsort.Sort(mapKeys(keys))\n\t\tfor i, k := range keys {\n\t\t\tif i > 0 {\n\t\t\t\tout.write(`,`)\n\t\t\t}\n\t\t\tif m.Indent != \"\" {\n\t\t\t\tout.write(\"\\n\")\n\t\t\t\tout.write(indent)\n\t\t\t\tout.write(m.Indent)\n\t\t\t\tout.write(m.Indent)\n\t\t\t}\n\n\t\t\t// TODO handle map key prop properly\n\t\t\tb, err := json.Marshal(k.Interface())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ts := string(b)\n\n\t\t\t// If the JSON is not a string value, encode it again to make it one.\n\t\t\tif !strings.HasPrefix(s, `\"`) {\n\t\t\t\tb, err := json.Marshal(s)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ts = string(b)\n\t\t\t}\n\n\t\t\tout.write(s)\n\t\t\tout.write(`:`)\n\t\t\tif m.Indent != \"\" {\n\t\t\t\tout.write(` `)\n\t\t\t}\n\n\t\t\tvprop := prop\n\t\t\tif prop != nil && prop.MapValProp != nil {\n\t\t\t\tvprop = prop.MapValProp\n\t\t\t}\n\t\t\tif err := m.marshalValue(out, vprop, v.MapIndex(k), indent+m.Indent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif m.Indent != \"\" {\n\t\t\tout.write(\"\\n\")\n\t\t\tout.write(indent)\n\t\t\tout.write(m.Indent)\n\t\t}\n\t\tout.write(`}`)\n\t\treturn out.err\n\t}\n\n\t// Handle non-finite floats, e.g. NaN, Infinity and -Infinity.\n\tif v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 {\n\t\tf := v.Float()\n\t\tvar sval string\n\t\tswitch {\n\t\tcase math.IsInf(f, 1):\n\t\t\tsval = `\"Infinity\"`\n\t\tcase math.IsInf(f, -1):\n\t\t\tsval = `\"-Infinity\"`\n\t\tcase math.IsNaN(f):\n\t\t\tsval = `\"NaN\"`\n\t\t}\n\t\tif sval != \"\" {\n\t\t\tout.write(sval)\n\t\t\treturn out.err\n\t\t}\n\t}\n\n\t// Default handling defers to the encoding/json library.\n\tb, err := json.Marshal(v.Interface())\n\tif err != nil {\n\t\treturn err\n\t}\n\t//needToQuote := string(b[0]) != `\"` && (v.Kind() == reflect.Int64 || v.Kind() == reflect.Uint64)\n\t//if needToQuote {\n\t//\tout.write(`\"`)\n\t//}\n\tout.write(string(b))\n\t//if needToQuote {\n\t//\tout.write(`\"`)\n\t//}\n\treturn out.err\n}", "title": "" }, { "docid": "9af0b23e9309aff17fe49004e1afb053", "score": "0.5304043", "text": "func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) ObjectStorageValue() (value []byte) {\n\treturn nil\n}", "title": "" }, { "docid": "2bb3967036c2251f3a72cc09713db756", "score": "0.5297947", "text": "func (this *Value) Parent() Element {\n return this.parent\n}", "title": "" }, { "docid": "9a613782926465814969230d8dee9cd9", "score": "0.52789384", "text": "func marshal (v Any) (b []byte,err error) {\n\n\ts:=structs.New(v)\n\tvar tmp_v []byte\n\n\tf,ok:= s.FieldOk(\"Type\")\t// mast contains Type Field to convert to object\n\tif !ok{\n\t\treturn\n\t}\n\n//encode TypeName\n\tb=append(b,'M')\n\tb=append(b,'t')\n\n\n\ttypeName:=f.Tag(\"key\")\n\tvar s_buf = *bytes.NewBufferString(typeName)\n\ttypeNameLen:=utf8.RuneCount(s_buf.Bytes())\n\tif tmp_v, err = util.PackUint16(uint16(typeNameLen));tmp_v!= nil {\n \t\tb = append(b, tmp_v...)\n\t}\n//encode typeName Using utf8 \n\n\tfor i := 0; i < typeNameLen; i++ {\n \t\tif r, s, err := s_buf.ReadRune(); s > 0 && err == nil {\n \t\t b = append(b, []byte(string(r))...)\n \t}\n\t}\n\t\n//encode the Fields\n for _,f:=range s.Fields(){\n\tif f.Name()==\"Type\"{\n\t\tcontinue //jump type Field\n\t}else{\n\t\ttag:=f.Tag(\"key\")\t\t//mast has a key tag value is the object properties\"\n\t\ttmp_v,err=encode_string(tag)\n\t\tif err==nil && v!=nil{\n\t\t\tb=append(b,tmp_v...)\n\t\t}else{\n\t\t\treturn nil,err\n\t\t}\n\t\t\n\t\ttmp_v,err=Encode(f.Value())\n\t\tif err==nil && v!=nil{\n\t\t\tb=append(b,tmp_v...)\n\t\t}else {\n\t\t\treturn nil,err\n\t\t}\n\n\t}//end of else\n\n\t}//end of for \n\tb=append(b,'z')\n\treturn \n}", "title": "" }, { "docid": "e51f793553aaf601b64b7c9632b9e982", "score": "0.5253184", "text": "func (e *Event) ValueStruct() (interface{}, error) {\n\tbytes, err := json.Marshal(e.Value)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar value interface{}\n\tswitch e.Type {\n\tcase \"minter/RewardEvent\":\n\t\tvalue = &RewardEventValue{}\n\tcase \"minter/SlashEvent\":\n\t\tvalue = &SlashEventValue{}\n\tcase \"minter/UnbondEvent\":\n\t\tvalue = &UnbondEventValue{}\n\tdefault:\n\t\treturn nil, errors.New(\"unknown event type\")\n\t}\n\n\terr = json.Unmarshal(bytes, value)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn value, nil\n}", "title": "" }, { "docid": "551f3b4cb79af4f0259903bc593c1227", "score": "0.5225124", "text": "func Marshal(val interface{}) ([]byte, error) {\n return encoder.Encode(val, 0)\n}", "title": "" }, { "docid": "3ea88ea1321aa4f007910280fc3bc336", "score": "0.5216716", "text": "func (j *JSONPb) marshal(v interface{}) ([]byte, error) {\n\t// NB: we use proto.Message here because grpc-gateway passes us protos that\n\t// we don't control and thus don't implement protoutil.Message.\n\tif pb, ok := v.(proto.Message); ok {\n\t\tvar buf bytes.Buffer\n\t\tmarshalFn := (*jsonpb.Marshaler)(j).Marshal\n\t\tif err := marshalFn(&buf, pb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn buf.Bytes(), nil\n\t}\n\treturn j.marshalNonProtoField(v)\n}", "title": "" }, { "docid": "dcb7deda9d708ec3afe7ccbb741e9ac4", "score": "0.5170883", "text": "func Marshall(v interface{}) ([]byte, error) {\n\tif v == nil {\n\t\treturn nil, ErrPayloadIsNil\n\t}\n\n\t// target value should implement payload interface\n\to, ok := v.(PayloadEncoder)\n\tif !ok {\n\t\treturn nil, ErrReceiverInvalid\n\t}\n\n\treturn o.Marshall()\n}", "title": "" }, { "docid": "f303d76f52c0114ebf58ea638bbeda61", "score": "0.5165915", "text": "func (a *attributeValue) refer() {\n\tswitch a.valueTag {\n\tcase TAG_STRING: // octetString with an unspecified format\n\t\ta.Marshal = (func() ([]byte, error) { b := a.value.(octetString); return b.MarshalIPP() })\n\t\ta.Length = (func() uint16 { b := a.value.(octetString); return b.len()})\n\tcase TAG_DATE: // dateTime\n\t\ta.Marshal = (func() ([]byte, error) { b := a.value.(dateTime); return b.MarshalIPP() })\n\t\ta.Length = (func() uint16 { return uint16(9)})\n\tcase TAG_RESOLUTION: // resolution\n\t\ta.Marshal = (func() ([]byte, error) { b := a.value.(resolution); return b.MarshalIPP() })\n\t\ta.Length = (func() uint16 { return uint16(11)})\n\tcase TAG_RANGE: // rangeOfInteger\n\t\ta.Marshal = (func() ([]byte, error) { b := a.value.(rangeOfInteger); return b.MarshalIPP() })\n\t\ta.Length = (func() uint16 { return uint16(8) })\n\t// case TAG_BEGIN_COLLECTION: \t// reserved for definition in a future IETF standards track document\n\t//\ta.Marshal = (func() ([]byte, error) {b := a.value.(); return b.MarshalIPP()})\n\tcase TAG_TEXTLANG: // textWithLanguage\n\t\ta.Marshal = (func() ([]byte, error) { b := a.value.(textWithLanguage); return b.MarshalIPP() })\n\t\ta.Length = (func() uint16 { b := a.value.(textWithLanguage); return b.length() })\n\tcase TAG_LANGUAGE: // textWithLanguage\n\t\ta.Marshal = (func() ([]byte, error) { b := a.value.(naturalLanguage); return b.MarshalIPP() })\n\t\ta.Length = (func() uint16 { b := a.value.(naturalLanguage); return uint16(b.len()) })\n\tcase TAG_KEYWORD: // textWithLanguage\n\t\ta.Marshal = (func() ([]byte, error) { b := a.value.(keyword); return b.MarshalIPP() })\n\t\ta.Length = (func() uint16 { b := a.value.(keyword); return uint16(b.len()) })\n\tcase TAG_NAMELANG: // nameWithLanguage\n\t\ta.Marshal = (func() ([]byte, error) { b := a.value.(nameWithLanguage); return b.MarshalIPP() })\n\t\ta.Length = (func() uint16 { b := a.value.(nameWithLanguage); return b.length() })\n\tcase TAG_INTEGER: // integer\n\t\ta.Marshal = (func() ([]byte, error) { b := a.value.(integer); return b.MarshalIPP() })\n\t\ta.Length = (func() uint16 { return uint16(4) })\n\tcase TAG_BOOLEAN: // boolean\n\t\ta.Marshal = (func() ([]byte, error) { b := a.value.(ippBoolean); return b.MarshalIPP() })\n\t\ta.Length = (func() uint16 {return uint16(1)})\n\tcase TAG_ENUM:\n\t\ta.Marshal = (func() ([]byte, error) { b := a.value.(enum); return b.MarshalIPP() })\n\t\ta.Length = (func() uint16 { return uint16(4) })\n\tcase TAG_CHARSET:\n\t\ta.Marshal = (func() ([]byte, error) { b := a.value.(charset); return b.bytes(), nil })\n\t\ta.Length = (func() uint16 { b := a.value.(charset); return uint16(b.len()) })\n\tcase TAG_URI:\n\t\ta.Marshal = (func() ([]byte, error) { b := a.value.(uri); return b.bytes(), nil })\n\t\ta.Length = (func() uint16 { b := a.value.(uri); return uint16(b.len())})\n\t}\n}", "title": "" }, { "docid": "7979cf54f7a4784a860bbd5404ce6efc", "score": "0.5154147", "text": "func marshal(dst []byte, v interface{}) ([]byte, error) {\n\tstate := marshalState{dst}\n\tif err := state.marshalValue(reflect.ValueOf(v)); err != nil {\n\t\treturn nil, err\n\t}\n\treturn state.data, nil\n}", "title": "" }, { "docid": "9ca59c93b1c6cb0237fa2615a7b6e18e", "score": "0.51521486", "text": "func (d Data) Marshal(v interface{}) error {\n\td.Clear()\n\treturn amqp.MarshalUnsafe(v, d.CPtr())\n}", "title": "" }, { "docid": "77196005d3f50d39836501ad096c69ec", "score": "0.51302356", "text": "func (self *DeviceButton) Parent() interface{}{\n return self.Object.Get(\"parent\")\n}", "title": "" }, { "docid": "3e0c942e24e280f10333cc455e8323c9", "score": "0.5123616", "text": "func (f Valuer) Value() (driver.Value, error) {\n\t// Return early if the value is nil. Ideally we would do a `i == nil` comparison here, but\n\t// unfortunately for us, `nil` is typed and that would always return false. This has to be\n\t// before `.Interface()` as that method panics otherwise.\n\tswitch f.value.Kind() {\n\t// IsNil panics if the value isn't one of these kinds.\n\tcase reflect.Chan, reflect.Map, reflect.Func,\n\t\treflect.Ptr, reflect.Interface, reflect.Slice:\n\t\tif f.value.IsNil() {\n\t\t\treturn nil, nil\n\t\t}\n\tcase reflect.Invalid:\n\t\treturn nil, nil\n\t}\n\n\ti := f.value.Interface()\n\n\t// If our interface supports driver.Valuer we can immediately short-circuit as this is what the\n\t// MySQL driver would do.\n\tif valuer, ok := i.(driver.Valuer); ok {\n\t\treturn valuer.Value()\n\t}\n\n\t// Override serialization behavior with tags (these take precedence over how a type would\n\t// usually be serialized).\n\t// Example:\n\t// struct {\n\t// Blob proto.Blob `sql:\",binary\"` // ensures that Marshal or MarshalBinary is used.\n\t// IP IP `sql:\",string\"` // ensures that its MarshalText method\n\t//\t // is used for serialization.\n\t// JSON map[string]string `sql:\",json\"` // ensures that json.Marshal is used on the value.\n\t// }\n\tswitch {\n\tcase f.Tags.Contains(\"binary\"):\n\t\tif v, ok := nonPointerMarshal(f.Descriptor, f.value); ok {\n\t\t\treturn v.Interface().(marshaler).Marshal()\n\t\t}\n\t\tif iface, ok := i.(marshaler); ok {\n\t\t\treturn iface.Marshal()\n\t\t}\n\t\tif iface, ok := i.(encoding.BinaryMarshaler); ok {\n\t\t\treturn iface.MarshalBinary()\n\t\t}\n\t\tif v, ok := nonPointerProtoMessage(f.Descriptor, f.value); ok {\n\t\t\treturn proto.Marshal(v.Interface().(proto.Message))\n\t\t}\n\t\tif iface, ok := i.(proto.Message); ok {\n\t\t\treturn proto.Marshal(iface)\n\t\t}\n\tcase f.Tags.Contains(\"string\"):\n\t\tif iface, ok := i.(encoding.TextMarshaler); ok {\n\t\t\treturn iface.MarshalText()\n\t\t}\n\tcase f.Tags.Contains(\"json\"):\n\t\tif iface, ok := i.(json.Marshaler); ok {\n\t\t\treturn iface.MarshalJSON()\n\t\t}\n\t\treturn json.Marshal(i)\n\tcase f.Tags.Contains(\"implicitnull\"):\n\t\tif isZero(f.value) {\n\t\t\treturn nil, nil\n\t\t}\n\t}\n\n\t// At this point we have already handled `nil` above, so we can assume that all\n\t// other values can be coerced into dereferenced types of bool/int/float/string.\n\tif f.value.Kind() == reflect.Ptr {\n\t\tf.value = f.value.Elem()\n\t}\n\n\t// Coerce our value into a valid sql/driver.Value (see sql/driver.IsValue).\n\t// This not only converts base types into their sql counterparts (like int32 -> int64) but also\n\t// handles custom types (like `type customString string` -> string).\n\tswitch f.value.Kind() {\n\tcase reflect.Bool:\n\t\treturn f.value.Bool(), nil\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn f.value.Int(), nil\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\treturn int64(f.value.Uint()), nil\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn f.value.Float(), nil\n\tcase reflect.String:\n\t\treturn f.value.String(), nil\n\t}\n\n\t// If we can't figure out what the type is supposed to be, we pass it straight through to SQL,\n\t// which will return an error if it can't handle it.\n\t// This means we don't have to handle []byte or time.Time specially, since they'll just pass on\n\t// through.\n\treturn f.value.Interface(), nil\n}", "title": "" }, { "docid": "11f24cc91be4f143dd1b5bdb3f6eb179", "score": "0.51225275", "text": "func mustMarshal(val interface{}) []byte {\n b, err := asn1.Marshal(val)\n if err != nil {\n panic(err)\n }\n return b\n}", "title": "" }, { "docid": "f28b237aba3c5ec86bfad3bcd639caf5", "score": "0.511825", "text": "func (*Component_Subcomponent) IsYANGGoStruct() {}", "title": "" }, { "docid": "f28b237aba3c5ec86bfad3bcd639caf5", "score": "0.511825", "text": "func (*Component_Subcomponent) IsYANGGoStruct() {}", "title": "" }, { "docid": "f28b237aba3c5ec86bfad3bcd639caf5", "score": "0.511825", "text": "func (*Component_Subcomponent) IsYANGGoStruct() {}", "title": "" }, { "docid": "f28b237aba3c5ec86bfad3bcd639caf5", "score": "0.5116852", "text": "func (*Component_Subcomponent) IsYANGGoStruct() {}", "title": "" }, { "docid": "41ed451602cb5af89169ed935b09a7f5", "score": "0.5109991", "text": "func (m *JsonMarshaler) marshalObject(out *errWriter, v proto.Message, indent string) error {\n\ts := reflect.ValueOf(v).Elem()\n\n\t// Handle well-known types.\n\tif wkt, ok := v.(wkt); ok {\n\t\tswitch wkt.XXX_WellKnownType() {\n\t\tcase \"DoubleValue\", \"FloatValue\", \"Int64Value\", \"UInt64Value\",\n\t\t\t\"Int32Value\", \"UInt32Value\", \"BoolValue\", \"StringValue\", \"BytesValue\":\n\t\t\t// \"Wrappers use the same representation in JSON\n\t\t\t// as the wrapped primitive type, ...\"\n\t\t\tsprop := proto.GetProperties(s.Type())\n\t\t\treturn m.marshalValue(out, sprop.Prop[0], s.Field(0), indent)\n\t\tcase \"Duration\":\n\t\t\ts, ns := s.Field(0).Int(), s.Field(1).Int()\n\t\t\tif s < -maxSecondsInDuration || s > maxSecondsInDuration {\n\t\t\t\treturn fmt.Errorf(\"seconds out of range %v\", s)\n\t\t\t}\n\t\t\tif ns <= -secondInNanos || ns >= secondInNanos {\n\t\t\t\treturn fmt.Errorf(\"ns out of range (%v, %v)\", -secondInNanos, secondInNanos)\n\t\t\t}\n\t\t\tif (s > 0 && ns < 0) || (s < 0 && ns > 0) {\n\t\t\t\treturn errors.New(\"signs of seconds and nanos do not match\")\n\t\t\t}\n\t\t\t// Generated output always contains 0, 3, 6, or 9 fractional digits,\n\t\t\t// depending on required precision, followed by the suffix \"s\".\n\t\t\tf := \"%d.%09d\"\n\t\t\tif ns < 0 {\n\t\t\t\tns = -ns\n\t\t\t\tif s == 0 {\n\t\t\t\t\tf = \"-%d.%09d\"\n\t\t\t\t}\n\t\t\t}\n\t\t\tx := fmt.Sprintf(f, s, ns)\n\t\t\tx = strings.TrimSuffix(x, \"000\")\n\t\t\tx = strings.TrimSuffix(x, \"000\")\n\t\t\tx = strings.TrimSuffix(x, \".000\")\n\t\t\tout.write(`\"`)\n\t\t\tout.write(x)\n\t\t\tout.write(`s\"`)\n\t\t\treturn out.err\n\t\tcase \"Struct\", \"ListValue\":\n\t\t\t// Let marshalValue handle the `Struct.fields` map or the `ListValue.values` slice.\n\t\t\t// TODO: pass the correct Properties if needed.\n\t\t\treturn m.marshalValue(out, &proto.Properties{}, s.Field(0), indent)\n\t\tcase \"Timestamp\":\n\t\t\t// \"RFC 3339, where generated output will always be Z-normalized\n\t\t\t// and uses 0, 3, 6 or 9 fractional digits.\"\n\t\t\ts, ns := s.Field(0).Int(), s.Field(1).Int()\n\t\t\tif ns < 0 || ns >= secondInNanos {\n\t\t\t\treturn fmt.Errorf(\"ns out of range [0, %v)\", secondInNanos)\n\t\t\t}\n\t\t\tt := time.Unix(s, ns).UTC()\n\t\t\t// time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits).\n\t\t\tx := t.Format(\"2006-01-02T15:04:05.000000000\")\n\t\t\tx = strings.TrimSuffix(x, \"000\")\n\t\t\tx = strings.TrimSuffix(x, \"000\")\n\t\t\tx = strings.TrimSuffix(x, \".000\")\n\t\t\tout.write(`\"`)\n\t\t\tout.write(x)\n\t\t\tout.write(`Z\"`)\n\t\t\treturn out.err\n\t\tcase \"Value\":\n\t\t\t// Value has a single oneof.\n\t\t\tkind := s.Field(0)\n\t\t\tif kind.IsNil() {\n\t\t\t\t// \"absence of any variant indicates an error\"\n\t\t\t\treturn errors.New(\"nil Value\")\n\t\t\t}\n\t\t\t// oneof -> *T -> T -> T.F\n\t\t\tx := kind.Elem().Elem().Field(0)\n\t\t\t// TODO: pass the correct Properties if needed.\n\t\t\treturn m.marshalValue(out, &proto.Properties{}, x, indent)\n\t\t}\n\t}\n\n\tout.write(\"{\")\n\tif m.Indent != \"\" {\n\t\tout.write(\"\\n\")\n\t}\n\n\tfirstField := true\n\n\tfor i := 0; i < s.NumField(); i++ {\n\t\tvalue := s.Field(i)\n\t\tvalueField := s.Type().Field(i)\n\t\tif strings.HasPrefix(valueField.Name, \"XXX_\") {\n\t\t\tcontinue\n\t\t}\n\n\t\t// IsNil will panic on most value kinds.\n\t\tswitch value.Kind() {\n\t\tcase reflect.Chan, reflect.Func, reflect.Interface:\n\t\t\tif value.IsNil() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif !m.EmitDefaults {\n\t\t\tswitch value.Kind() {\n\t\t\tcase reflect.Bool:\n\t\t\t\tif !value.Bool() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase reflect.Int32, reflect.Int64:\n\t\t\t\tif value.Int() == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase reflect.Uint32, reflect.Uint64:\n\t\t\t\tif value.Uint() == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase reflect.Float32, reflect.Float64:\n\t\t\t\tif value.Float() == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase reflect.String:\n\t\t\t\tif value.Len() == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase reflect.Map, reflect.Ptr, reflect.Slice:\n\t\t\t\tif value.IsNil() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Oneof fields need special handling.\n\t\tif valueField.Tag.Get(\"protobuf_oneof\") != \"\" {\n\t\t\t// value is an interface containing &T{real_value}.\n\t\t\tsv := value.Elem().Elem() // interface -> *T -> T\n\t\t\tvalue = sv.Field(0)\n\t\t\tvalueField = sv.Type().Field(0)\n\t\t}\n\t\tprop := jsonProperties(valueField, m.OrigName)\n\t\tif !firstField {\n\t\t\tm.writeSep(out)\n\t\t}\n\t\tif err := m.marshalField(out, prop, value, indent); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfirstField = false\n\t}\n\n\t// Handle proto2 extensions.\n\tif ep, ok := v.(proto.Message); ok {\n\t\textensions := proto.RegisteredExtensions(v)\n\t\t// Sort extensions for stable output.\n\t\tids := make([]int32, 0, len(extensions))\n\t\tfor id, desc := range extensions {\n\t\t\tif !proto.HasExtension(ep, desc) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tids = append(ids, id)\n\t\t}\n\t\tsort.Sort(int32Slice(ids))\n\t\tfor _, id := range ids {\n\t\t\tdesc := extensions[id]\n\t\t\tif desc == nil {\n\t\t\t\t// unknown extension\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\text, extErr := proto.GetExtension(ep, desc)\n\t\t\tif extErr != nil {\n\t\t\t\treturn extErr\n\t\t\t}\n\t\t\tvalue := reflect.ValueOf(ext)\n\t\t\tvar prop proto.Properties\n\t\t\tprop.Parse(desc.Tag)\n\t\t\tprop.JSONName = fmt.Sprintf(\"[%s]\", desc.Name)\n\t\t\tif !firstField {\n\t\t\t\tm.writeSep(out)\n\t\t\t}\n\t\t\tif err := m.marshalField(out, &prop, value, indent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfirstField = false\n\t\t}\n\n\t}\n\n\tif m.Indent != \"\" {\n\t\tout.write(\"\\n\")\n\t\tout.write(indent)\n\t}\n\tout.write(\"}\")\n\treturn out.err\n}", "title": "" }, { "docid": "7af102c7057ba01b538c06e0c9f8177f", "score": "0.51092905", "text": "func MethodsValueReceiverCannotChangetheOriginalVal() {\r\n\tkey := \"key.1\"\r\n\td := data1{1, &key, make(map[string]bool)}\r\n\r\n\tfmt.Printf(\"num=%v key=%v items=%v\\n\", d.num, *d.key, d.items)\r\n\t//prints num=1 key=key.1 items=map[]\r\n\r\n\td.pmethod()\r\n\tfmt.Printf(\"num=%v key=%v items=%v\\n\", d.num, *d.key, d.items)\r\n\t//prints num=7 key=key.1 items=map[]\r\n\r\n\td.vmethod()\r\n\tfmt.Printf(\"num=%v key=%v items=%v\\n\", d.num, *d.key, d.items)\r\n\t//prints num=7 key=v.key items=map[vmethod:true]\r\n}", "title": "" }, { "docid": "1fc4956b2ccd67e4f29ac10f9e65bd62", "score": "0.5107701", "text": "func (this *Value) SetParent(parent Element) {\n this.parent = parent\n}", "title": "" }, { "docid": "fd91a023300d64872623fd7833425b5e", "score": "0.51011896", "text": "func Marshal(val interface{}) ([]byte, error) {\n\treturn MarshalWithParams(val, \"\")\n}", "title": "" }, { "docid": "c1862dc68c298c7e58d01e55ab516377", "score": "0.50994515", "text": "func (obj Resource) Value_() interface{} { return GetValue(obj) }", "title": "" }, { "docid": "315b49cf2151f7948b305eb8f386c6c7", "score": "0.50861657", "text": "func EnsureRawValue(in interface{}) reflect.Value {\n\tif v, ok := in.(reflect.Value); ok {\n\t\tif v.IsValid() {\n\t\t\tif r, ok := v.Interface().(*_refHolder); ok {\n\t\t\t\treturn r.value\n\t\t\t}\n\t\t}\n\t\treturn v\n\t}\n\tif v, ok := in.(*_refHolder); ok {\n\t\tin = v.value\n\t}\n\treturn reflect.ValueOf(in)\n}", "title": "" }, { "docid": "09ba9180fe5d47dafa25dc86a07a869a", "score": "0.50837725", "text": "func (m *GogoMarshaler) marshalValue(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error {\n\n\tv = reflect.Indirect(v)\n\n\t// Handle nil pointer\n\tif v.Kind() == reflect.Invalid {\n\t\tout.write(\"null\")\n\t\treturn out.err\n\t}\n\n\t// Handle repeated elements.\n\tif v.Kind() == reflect.Slice && v.Type().Elem().Kind() != reflect.Uint8 {\n\t\tout.write(\"[\")\n\t\tcomma := \"\"\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tsliceVal := v.Index(i)\n\t\t\tout.write(comma)\n\t\t\tif m.Indent != \"\" {\n\t\t\t\tout.write(\"\\n\")\n\t\t\t\tout.write(indent)\n\t\t\t\tout.write(m.Indent)\n\t\t\t\tout.write(m.Indent)\n\t\t\t}\n\t\t\tif err := m.marshalValue(out, prop, sliceVal, indent+m.Indent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcomma = \",\"\n\t\t}\n\t\tif m.Indent != \"\" {\n\t\t\tout.write(\"\\n\")\n\t\t\tout.write(indent)\n\t\t\tout.write(m.Indent)\n\t\t}\n\t\tout.write(\"]\")\n\t\treturn out.err\n\t}\n\n\t// Handle well-known types.\n\t// Most are handled up in marshalObject (because 99% are messages).\n\tif wkt, ok := v.Interface().(isWkt); ok {\n\t\tswitch wkt.XXX_WellKnownType() {\n\t\tcase \"NullValue\":\n\t\t\tout.write(\"null\")\n\t\t\treturn out.err\n\t\t}\n\t}\n\n\tif t, ok := v.Interface().(time.Time); ok {\n\t\tts, err := types.TimestampProto(t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn m.marshalValue(out, prop, reflect.ValueOf(ts), indent)\n\t}\n\n\tif d, ok := v.Interface().(time.Duration); ok {\n\t\tdur := types.DurationProto(d)\n\t\treturn m.marshalValue(out, prop, reflect.ValueOf(dur), indent)\n\t}\n\n\t// Handle enumerations.\n\tif !m.EnumsAsInts && prop.Enum != \"\" {\n\t\t// Unknown enum values will are stringified by the proto library as their\n\t\t// value. Such values should _not_ be quoted or they will be interpreted\n\t\t// as an enum string instead of their value.\n\t\tenumStr := v.Interface().(fmt.Stringer).String()\n\t\tvar valStr string\n\t\tif v.Kind() == reflect.Ptr {\n\t\t\tvalStr = strconv.Itoa(int(v.Elem().Int()))\n\t\t} else {\n\t\t\tvalStr = strconv.Itoa(int(v.Int()))\n\t\t}\n\n\t\tif m, ok := v.Interface().(interface {\n\t\t\tMarshalJSON() ([]byte, error)\n\t\t}); ok {\n\t\t\tdata, err := m.MarshalJSON()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tenumStr = string(data)\n\t\t\tenumStr, err = strconv.Unquote(enumStr)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tisKnownEnum := enumStr != valStr\n\n\t\tif isKnownEnum {\n\t\t\tout.write(`\"`)\n\t\t}\n\t\tout.write(enumStr)\n\t\tif isKnownEnum {\n\t\t\tout.write(`\"`)\n\t\t}\n\t\treturn out.err\n\t}\n\n\t// Handle nested messages.\n\tif v.Kind() == reflect.Struct {\n\t\ti := v\n\t\tif v.CanAddr() {\n\t\t\ti = v.Addr()\n\t\t} else {\n\t\t\ti = reflect.New(v.Type())\n\t\t\ti.Elem().Set(v)\n\t\t}\n\t\tiface := i.Interface()\n\t\tif iface == nil {\n\t\t\tout.write(`null`)\n\t\t\treturn out.err\n\t\t}\n\n\t\tif m, ok := v.Interface().(interface {\n\t\t\tMarshalJSON() ([]byte, error)\n\t\t}); ok {\n\t\t\tdata, err := m.MarshalJSON()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tout.write(string(data))\n\t\t\treturn nil\n\t\t}\n\n\t\tpm, ok := iface.(proto.Message)\n\t\tif !ok {\n\t\t\tif prop.CustomType == \"\" {\n\t\t\t\treturn fmt.Errorf(\"%v does not implement proto.Message\", v.Type())\n\t\t\t}\n\t\t\tt := proto.MessageType(prop.CustomType)\n\t\t\tif t == nil || !i.Type().ConvertibleTo(t) {\n\t\t\t\treturn fmt.Errorf(\"%v declared custom type %s but it is not convertible to %v\", v.Type(), prop.CustomType, t)\n\t\t\t}\n\t\t\tpm = i.Convert(t).Interface().(proto.Message)\n\t\t}\n\t\treturn m.marshalObject(out, pm, indent+m.Indent, \"\")\n\t}\n\n\t// Handle maps.\n\t// Since Go randomizes map iteration, we sort keys for stable output.\n\tif v.Kind() == reflect.Map {\n\t\tout.write(`{`)\n\t\tkeys := v.MapKeys()\n\t\tsort.Sort(mapKeys(keys))\n\t\tfor i, k := range keys {\n\t\t\tif i > 0 {\n\t\t\t\tout.write(`,`)\n\t\t\t}\n\t\t\tif m.Indent != \"\" {\n\t\t\t\tout.write(\"\\n\")\n\t\t\t\tout.write(indent)\n\t\t\t\tout.write(m.Indent)\n\t\t\t\tout.write(m.Indent)\n\t\t\t}\n\n\t\t\tb, err := m.jsonMarshal(k.Interface())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ts := string(b)\n\n\t\t\t// If the JSON is not a string value, encode it again to make it one.\n\t\t\tif !strings.HasPrefix(s, `\"`) {\n\t\t\t\tb, err := m.jsonMarshal(s)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ts = string(b)\n\t\t\t}\n\n\t\t\tout.write(s)\n\t\t\tout.write(`:`)\n\t\t\tif m.Indent != \"\" {\n\t\t\t\tout.write(` `)\n\t\t\t}\n\n\t\t\tif err := m.marshalValue(out, prop, v.MapIndex(k), indent+m.Indent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif m.Indent != \"\" {\n\t\t\tout.write(\"\\n\")\n\t\t\tout.write(indent)\n\t\t\tout.write(m.Indent)\n\t\t}\n\t\tout.write(`}`)\n\t\treturn out.err\n\t}\n\n\t// Handle non-finite floats, e.g. NaN, Infinity and -Infinity.\n\tif v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 {\n\t\tf := v.Float()\n\t\tvar sval string\n\t\tswitch {\n\t\tcase math.IsInf(f, 1):\n\t\t\tsval = `\"Infinity\"`\n\t\tcase math.IsInf(f, -1):\n\t\t\tsval = `\"-Infinity\"`\n\t\tcase math.IsNaN(f):\n\t\t\tsval = `\"NaN\"`\n\t\t}\n\t\tif sval != \"\" {\n\t\t\tout.write(sval)\n\t\t\treturn out.err\n\t\t}\n\t}\n\n\t// Default handling defers to the encoding/json library.\n\tb, err := m.jsonMarshal(v.Interface())\n\tif err != nil {\n\t\treturn err\n\t}\n\tneedToQuote := string(b[0]) != `\"` && (v.Kind() == reflect.Int64 || v.Kind() == reflect.Uint64)\n\tif needToQuote {\n\t\tout.write(`\"`)\n\t}\n\tout.write(string(b))\n\tif needToQuote {\n\t\tout.write(`\"`)\n\t}\n\treturn out.err\n}", "title": "" }, { "docid": "77860600b3f2f6e67e0168312e9cf902", "score": "0.5066731", "text": "func TestCustomMarshaller_Issue96(t *testing.T) {\n\ttype Vote struct {\n\t\tWhat YesNo\n\t}\n\ttestJsonFromStruct(t, Vote{}, `{\n \"swagger.Vote\": {\n \"id\": \"swagger.Vote\",\n \"required\": [\n \"What\"\n ],\n \"properties\": {\n \"What\": {\n \"type\": \"string\"\n }\n }\n }\n }`)\n}", "title": "" }, { "docid": "09016530a95b71622fc977fd69adf208", "score": "0.5040394", "text": "func (v *Value) MarshalTo(dst []byte) []byte {\n\tswitch v.t {\n\tcase typeRawString:\n\t\tdst = append(dst, '\"')\n\t\tdst = append(dst, v.s...)\n\t\tdst = append(dst, '\"')\n\t\treturn dst\n\tcase TypeObject:\n\t\treturn v.o.MarshalTo(dst)\n\tcase TypeArray:\n\t\tdst = append(dst, '[')\n\t\tfor i, vv := range v.a {\n\t\t\tdst = vv.MarshalTo(dst)\n\t\t\tif i != len(v.a)-1 {\n\t\t\t\tdst = append(dst, ',', ' ')\n\t\t\t}\n\t\t}\n\t\tdst = append(dst, ']')\n\t\treturn dst\n\tcase TypeString:\n\t\treturn escapeString(dst, v.s)\n\tcase TypeDate:\n\t\treturn escapeString(dst, v.MarshalDate())\n\tcase TypeDateTime:\n\t\treturn escapeString(dst, v.MarshalDateTime())\n\tcase TypeTime:\n\t\treturn escapeString(dst, v.MarshalTime())\n\tcase TypeBlob, TypeBit:\n\t\tconst prefix = \"base64:type15:\"\n\n\t\tsize := 2 + len(prefix) + base64.StdEncoding.EncodedLen(len(v.s))\n\t\tdst := make([]byte, size)\n\t\tdst[0] = '\"'\n\t\tcopy(dst[1:], prefix)\n\t\tbase64.StdEncoding.Encode(dst[len(prefix)+1:], []byte(v.s))\n\t\tdst[size-1] = '\"'\n\t\treturn dst\n\tcase TypeNumber:\n\t\tif v.NumberType() == NumberTypeFloat {\n\t\t\treturn v.marshalFloat(dst)\n\t\t}\n\t\treturn append(dst, v.s...)\n\tcase TypeBoolean:\n\t\tif v == ValueTrue {\n\t\t\treturn append(dst, \"true\"...)\n\t\t}\n\t\treturn append(dst, \"false\"...)\n\tcase TypeNull:\n\t\treturn append(dst, \"null\"...)\n\tdefault:\n\t\tpanic(fmt.Errorf(\"BUG: unexpected Value type: %d\", v.t))\n\t}\n}", "title": "" }, { "docid": "b0740d0dbed4d38cc9764062bd808d6f", "score": "0.50400937", "text": "func (iv *IndexedValue) Marshal() (*tpb.MapLeaf, error) {\n\tif iv == nil {\n\t\treturn nil, errors.New(\"entry: nil receiver\")\n\t}\n\t// Convert to MapLeaf\n\tleafValue, err := ToLeafValue(iv.Value.GetMutation())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"entry: ToLeafValue(): %v\", err)\n\t}\n\textraData, err := proto.Marshal(iv.Value.GetCommitted())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"entry: proto.Marshal(): %v\", err)\n\t}\n\treturn &tpb.MapLeaf{Index: iv.Index, LeafValue: leafValue, ExtraData: extraData}, nil\n}", "title": "" }, { "docid": "994f2fdf1afd96cbfdb20a5796db5b3b", "score": "0.5026542", "text": "func (e *encodeState) reflectValueQuoted(v reflect.Value, quoted bool) {\n\tif !v.IsValid() {\n\t\te.WriteString(\"null\")\n\t\treturn\n\t}\n\n\tm, ok := v.Interface().(Marshaler)\n\tif !ok {\n\t\t// T doesn't match the interface. Check against *T too.\n\t\tif v.Kind() != reflect.Ptr && v.CanAddr() {\n\t\t\tm, ok = v.Addr().Interface().(Marshaler)\n\t\t\tif ok {\n\t\t\t\tv = v.Addr()\n\t\t\t}\n\t\t}\n\t}\n\tif ok && (v.Kind() != reflect.Ptr || !v.IsNil()) {\n\t\tb, err := m.MarshalJSON()\n\t\tif err != nil {\n\t\t\te.error(&MarshalerError{v.Type(), err})\n\t\t}\n\n\t\t// canonicalize the json if it's an object\n\t\tb = bytes.TrimSpace(b)\n\t\tif len(b) > 0 && b[0] == '{' {\n\t\t\tvar temp interface{}\n\t\t\terr = json.Unmarshal(b, &temp)\n\t\t\tif err != nil {\n\t\t\t\te.error(&MarshalerError{v.Type(), err})\n\t\t\t}\n\t\t\tb, err = Marshal(temp)\n\t\t\tif err != nil {\n\t\t\t\te.error(&MarshalerError{v.Type(), err})\n\t\t\t}\n\t\t}\n\t\te.Buffer.Write(b)\n\t\treturn\n\t}\n\n\twriteString := (*encodeState).WriteString\n\tif quoted {\n\t\twriteString = (*encodeState).string\n\t}\n\n\tswitch v.Kind() {\n\tcase reflect.Bool:\n\t\tx := v.Bool()\n\t\tif x {\n\t\t\twriteString(e, \"true\")\n\t\t} else {\n\t\t\twriteString(e, \"false\")\n\t\t}\n\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tb := strconv.AppendInt(e.scratch[:0], v.Int(), 10)\n\t\tif quoted {\n\t\t\twriteString(e, string(b))\n\t\t} else {\n\t\t\te.Write(b)\n\t\t}\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\tb := strconv.AppendUint(e.scratch[:0], v.Uint(), 10)\n\t\tif quoted {\n\t\t\twriteString(e, string(b))\n\t\t} else {\n\t\t\te.Write(b)\n\t\t}\n\tcase reflect.Float32, reflect.Float64:\n\t\tf := v.Float()\n\t\tif math.IsInf(f, 0) || math.IsNaN(f) || math.Floor(f) != f {\n\t\t\te.error(&UnsupportedValueError{v, \"floating point number\"})\n\t\t}\n\t\tb := strconv.AppendInt(e.scratch[:0], int64(f), 10)\n\t\tif quoted {\n\t\t\twriteString(e, string(b))\n\t\t} else {\n\t\t\te.Write(b)\n\t\t}\n\tcase reflect.String:\n\t\tif v.Type() == numberType {\n\t\t\tnumStr := v.String()\n\t\t\tif numStr == \"\" {\n\t\t\t\tnumStr = \"0\" // Number's zero-val\n\t\t\t}\n\t\t\te.WriteString(numStr)\n\t\t\tbreak\n\t\t}\n\t\tif quoted {\n\t\t\tsb, err := Marshal(v.String())\n\t\t\tif err != nil {\n\t\t\t\te.error(err)\n\t\t\t}\n\t\t\te.string(string(sb))\n\t\t} else {\n\t\t\te.string(v.String())\n\t\t}\n\n\tcase reflect.Struct:\n\t\te.WriteByte('{')\n\t\tfirst := true\n\t\tfor _, f := range cachedTypeFields(v.Type()) {\n\t\t\tfv := fieldByIndex(v, f.index)\n\t\t\tif !fv.IsValid() || f.omitEmpty && isEmptyValue(fv) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif first {\n\t\t\t\tfirst = false\n\t\t\t} else {\n\t\t\t\te.WriteByte(',')\n\t\t\t}\n\t\t\te.string(f.name)\n\t\t\te.WriteByte(':')\n\t\t\te.reflectValueQuoted(fv, f.quoted)\n\t\t}\n\t\te.WriteByte('}')\n\n\tcase reflect.Map:\n\t\tif v.Type().Key().Kind() != reflect.String {\n\t\t\te.error(&UnsupportedTypeError{v.Type()})\n\t\t}\n\t\tif v.IsNil() {\n\t\t\te.WriteString(\"null\")\n\t\t\tbreak\n\t\t}\n\t\te.WriteByte('{')\n\t\tvar sv stringValues = v.MapKeys()\n\t\tsort.Sort(sv)\n\t\tfor i, k := range sv {\n\t\t\tif i > 0 {\n\t\t\t\te.WriteByte(',')\n\t\t\t}\n\t\t\te.string(k.String())\n\t\t\te.WriteByte(':')\n\t\t\te.reflectValue(v.MapIndex(k))\n\t\t}\n\t\te.WriteByte('}')\n\n\tcase reflect.Slice:\n\t\tif v.IsNil() {\n\t\t\te.WriteString(\"null\")\n\t\t\tbreak\n\t\t}\n\t\tif v.Type().Elem().Kind() == reflect.Uint8 {\n\t\t\t// Byte slices get special treatment; arrays don't.\n\t\t\ts := v.Bytes()\n\t\t\te.WriteByte('\"')\n\t\t\tif len(s) < 1024 {\n\t\t\t\t// for small buffers, using Encode directly is much faster.\n\t\t\t\tdst := make([]byte, base64.StdEncoding.EncodedLen(len(s)))\n\t\t\t\tbase64.StdEncoding.Encode(dst, s)\n\t\t\t\te.Write(dst)\n\t\t\t} else {\n\t\t\t\t// for large buffers, avoid unnecessary extra temporary\n\t\t\t\t// buffer space.\n\t\t\t\tenc := base64.NewEncoder(base64.StdEncoding, e)\n\t\t\t\tenc.Write(s)\n\t\t\t\tenc.Close()\n\t\t\t}\n\t\t\te.WriteByte('\"')\n\t\t\tbreak\n\t\t}\n\t\t// Slices can be marshalled as nil, but otherwise are handled\n\t\t// as arrays.\n\t\tfallthrough\n\tcase reflect.Array:\n\t\te.WriteByte('[')\n\t\tn := v.Len()\n\t\tfor i := 0; i < n; i++ {\n\t\t\tif i > 0 {\n\t\t\t\te.WriteByte(',')\n\t\t\t}\n\t\t\te.reflectValue(v.Index(i))\n\t\t}\n\t\te.WriteByte(']')\n\n\tcase reflect.Interface, reflect.Ptr:\n\t\tif v.IsNil() {\n\t\t\te.WriteString(\"null\")\n\t\t\treturn\n\t\t}\n\t\te.reflectValue(v.Elem())\n\n\tdefault:\n\t\te.error(&UnsupportedTypeError{v.Type()})\n\t}\n\treturn\n}", "title": "" }, { "docid": "4e7f8ce9779e303a2eda47f7d0ec0529", "score": "0.50251776", "text": "func (v Value) MarshalJSON() ([]byte, error) {\n\tjsonOnce.Do(initJSON)\n\tif jsonStringify == undefined {\n\t\treturn nil, errors.New(\"json encoding is not supported\")\n\t}\n\tif v.Ref == undefined {\n\t\treturn []byte(\"null\"), nil\n\t}\n\ts := jsonStringify.Invoke(v.Ref).String()\n\treturn []byte(s), nil\n}", "title": "" }, { "docid": "60783f3317728a5a10592edc8ea75211", "score": "0.50232476", "text": "func (f monoFormatter) value(s interface{}) string {\n\tout, err := json.Marshal(s)\n\tif err != nil {\n\t\t// It shouldn't be possible to be given a value we can't marshal\n\t\tpanic(fmt.Sprintf(\"failed to marshal value: %#v\", s))\n\t}\n\treturn string(out)\n}", "title": "" }, { "docid": "672785900f9863cf2bc0fbe2984908ab", "score": "0.5018993", "text": "func (self Object) Value() Value {\n\treturn self.value\n}", "title": "" }, { "docid": "b08c39a46c0127670b82b2a0d6be95d6", "score": "0.5018639", "text": "func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) {\n\trv := reflect.ValueOf(v)\n\tfor rv.Kind() == reflect.Ptr {\n\t\tif rv.IsNil() {\n\t\t\treturn []byte(\"null\"), nil\n\t\t}\n\t\trv = rv.Elem()\n\t}\n\n\tif rv.Kind() == reflect.Map {\n\t\tm := make(map[string]*json.RawMessage)\n\t\tfor _, k := range rv.MapKeys() {\n\t\t\tbuf, err := j.marshal(rv.MapIndex(k).Interface())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tm[fmt.Sprintf(\"%v\", k.Interface())] = (*json.RawMessage)(&buf)\n\t\t}\n\t\tif j.Indent != \"\" {\n\t\t\treturn json.MarshalIndent(m, \"\", j.Indent)\n\t\t}\n\t\treturn json.Marshal(m)\n\t}\n\tif enum, ok := rv.Interface().(protoEnum); ok && !j.EnumsAsInts {\n\t\treturn json.Marshal(enum.String())\n\t}\n\treturn json.Marshal(rv.Interface())\n}", "title": "" }, { "docid": "c3ce645c6d1d7be8a3ff75367ff417c9", "score": "0.50154674", "text": "func (d *decoder) storeValue() (stateFn, error) {\n\tgoName := d.translator.goName(d.key)\n\tif goName == \"\" {\n\t\tgoName = d.key\n\t}\n\n\t// We don't have the field in the struct, so it goes in AdditionalFields.\n\tf := d.value.FieldByName(goName)\n\tif f.Kind() == reflect.Invalid {\n\t\treturn d.storeAdditional, nil\n\t}\n\n\t// Indicates that this type has a custom Unmarshaler.\n\tif hasUnmarshalJSON(f) {\n\t\terr := d.dec.Decode(f.Addr().Interface())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn d.next, nil\n\t}\n\n\tt, isPtr, err := fieldBaseType(d.value, goName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"type(%s) had field(%s) %w\", d.value.Type().Name(), goName, err)\n\t}\n\n\tswitch t.Kind() {\n\t// We need to recursively call ourselves on any *struct or struct.\n\tcase reflect.Struct:\n\t\tif isPtr {\n\t\t\tif f.IsNil() {\n\t\t\t\tf.Set(reflect.New(t))\n\t\t\t}\n\t\t} else {\n\t\t\tf = f.Addr()\n\t\t}\n\t\tif err := unmarshalStruct(d.dec, f.Interface()); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn d.next, nil\n\tcase reflect.Map:\n\t\tv := reflect.MakeMap(f.Type())\n\t\tptr := newValue(f.Type())\n\t\tptr.Elem().Set(v)\n\t\tif err := unmarshalMap(d.dec, ptr); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tf.Set(ptr.Elem())\n\t\treturn d.next, nil\n\tcase reflect.Slice:\n\t\tv := reflect.MakeSlice(f.Type(), 0, 0)\n\t\tptr := newValue(f.Type())\n\t\tptr.Elem().Set(v)\n\t\tif err := unmarshalSlice(d.dec, ptr); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tf.Set(ptr.Elem())\n\t\treturn d.next, nil\n\t}\n\n\tif !isPtr {\n\t\tf = f.Addr()\n\t}\n\n\t// For values that are pointers, we need them to be non-nil in order\n\t// to decode into them.\n\tif f.IsNil() {\n\t\tf.Set(reflect.New(t))\n\t}\n\n\tif err := d.dec.Decode(f.Interface()); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn d.next, nil\n}", "title": "" }, { "docid": "96bf2e480c1ee31d9ac460775a00d73b", "score": "0.4970235", "text": "func fieldValue(data interface{}) interface{} {\n\tif baseObject, ok := data.(runtime.Storable); ok {\n\t\treturn runtime.KeyForStorable(baseObject)\n\t}\n\treturn data\n}", "title": "" }, { "docid": "865364b58ba04ed9e6e7585c18ba967d", "score": "0.4965802", "text": "func (k *Key) marshal(b *bytes.Buffer) {\n\tif k.Parent != nil {\n\t\tk.Parent.marshal(b)\n\t}\n\tb.WriteByte('/')\n\tb.WriteString(k.Kind)\n\tb.WriteByte(',')\n\tif k.Name != \"\" {\n\t\tb.WriteString(k.Name)\n\t} else {\n\t\tb.WriteString(strconv.FormatInt(k.ID, 10))\n\t}\n\tif k.Namespace != \"\" {\n\t\tb.WriteByte(',')\n\t\tb.WriteString(k.Namespace)\n\t}\n}", "title": "" }, { "docid": "e54bfd14d47b2afbc4415085368ec51b", "score": "0.4965053", "text": "func EnsurePackValue(in interface{}) reflect.Value {\n\tif v, ok := in.(reflect.Value); ok {\n\t\treturn v\n\t}\n\treturn reflect.ValueOf(in)\n}", "title": "" }, { "docid": "ebe41716d82225c2f4348cc766d8a8fc", "score": "0.49530113", "text": "func (v BinaryValue) IsAttachable() {\n}", "title": "" }, { "docid": "d40f8d84c90d5653882ece392f08430f", "score": "0.49492198", "text": "func (this *Value) ChildrenLen() int {\n return 0\n}", "title": "" }, { "docid": "7c96259f7103534677c9b79b134c6ef7", "score": "0.49433324", "text": "func (g *Manager) Value(key interface{}) interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "b2ccc0a45e0b12a5475e3a80fcacd5e3", "score": "0.4942621", "text": "func (sc *Contract) Marshal() ([]byte, error) {\n\treturn json.Marshal(sc)\n}", "title": "" }, { "docid": "9b18c5bb239353c48ddd10de32f86579", "score": "0.4932005", "text": "func (value TPM2B[T, P]) marshal(buf *bytes.Buffer) {\n\tb := value.Bytes()\n\tbinary.Write(buf, binary.BigEndian, uint16(len(b)))\n\tbuf.Write(b)\n}", "title": "" }, { "docid": "c1e2e3bf6ffad4a7b6af5f031202007f", "score": "0.49304312", "text": "func (*Component_Property) IsYANGGoStruct() {}", "title": "" }, { "docid": "c1e2e3bf6ffad4a7b6af5f031202007f", "score": "0.49304312", "text": "func (*Component_Property) IsYANGGoStruct() {}", "title": "" }, { "docid": "c1e2e3bf6ffad4a7b6af5f031202007f", "score": "0.49304312", "text": "func (*Component_Property) IsYANGGoStruct() {}", "title": "" }, { "docid": "2ccd289d15ca660f6b5bdff5e917fb71", "score": "0.49296954", "text": "func (this *node) getValue() interface{} { return this.val }", "title": "" }, { "docid": "c1e2e3bf6ffad4a7b6af5f031202007f", "score": "0.4929", "text": "func (*Component_Property) IsYANGGoStruct() {}", "title": "" }, { "docid": "3b228792a814c12e310bc3c07626f16f", "score": "0.4925827", "text": "func TestStoreJSONMarshal(t *testing.T) {\n\ts := &Store{Uri: \"http://127.0.0.1\"}\n\tb, _ := json.Marshal(s)\n\tassert.Equal(t, `{\"uri\":\"http://127.0.0.1\"}`, string(b))\n\n\ts = &Store{Uri: \"http://127.0.0.1\", Value: []string{\"one\", \"two\"}}\n\tb, _ = json.Marshal(s)\n\tassert.Equal(t, `{\"uri\":\"http://127.0.0.1\",\"value\":[\"one\",\"two\"]}`, string(b))\n\n\ts = &Store{Uri: \"http://127.0.0.1\", Value: map[string]int{\"one\": 1, \"two\": 2}}\n\tb, _ = json.Marshal(s)\n\tassert.Equal(t, `{\"uri\":\"http://127.0.0.1\",\"value\":{\"one\":1,\"two\":2}}`, string(b))\n\n\ts = &Store{Uri: \"http://127.0.0.1\", Extra: map[string]interface{}{\"one\": 1, \"two\": 2}}\n\tb, _ = json.Marshal(s)\n\tassert.Equal(t, `{\"one\":1,\"two\":2,\"uri\":\"http://127.0.0.1\"}`, string(b))\n}", "title": "" }, { "docid": "c70aa14da6c294691a336dcd48b84c5f", "score": "0.49239185", "text": "func (o *ObjectValue) Value() interface{} {\n\treturn o\n}", "title": "" }, { "docid": "66f9fde5c35fbfddaf8d44580dc6e814", "score": "0.492212", "text": "func (tv TypeAndValue) Addressable() bool {}", "title": "" }, { "docid": "9d6f58db0b8990679a9344f6ceae55dc", "score": "0.4919389", "text": "func (v value) MarshalJSON() ([]byte, error) {\n\tif v.isList {\n\t\tvar a []atom\n\n\t\ta = make([]atom, len(v.values))\n\t\tfor i := range v.values {\n\t\t\ta[i].Value = v.values[i]\n\t\t}\n\t\treturn json.Marshal(a)\n\t}\n\treturn json.Marshal(atom{Value: v.values[0]})\n}", "title": "" }, { "docid": "4bfd90ad42a146ad3f6521e2638f68d9", "score": "0.49187252", "text": "func (jsonMarshalerUnmarshaler) Marshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "45005a27367fe4ce799027ccf9c808a5", "score": "0.4918542", "text": "func Marshal(v interface{}) ([]byte, error) {\n\te := &encodeState{}\n\terr := e.marshal(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn e.Bytes(), nil\n}", "title": "" }, { "docid": "4fe7771576c8db9e9a1e1f813c340a74", "score": "0.49168575", "text": "func selfJSONMarshaler(t reflect.Type) bool {\n\tjm := reflect.TypeOf((*json.Marshaler)(nil)).Elem()\n\tju := reflect.TypeOf((*json.Unmarshaler)(nil)).Elem()\n\tif !t.Implements(jm) && !reflect.PtrTo(t).Implements(jm) {\n\t\treturn false\n\t}\n\treturn t.Implements(ju) || reflect.PtrTo(t).Implements(ju)\n}", "title": "" }, { "docid": "e48e4fcef25627fe40e8044a0da5ebe6", "score": "0.490282", "text": "func (cb *PayloadCodec) Marshal(v interface{}) ([]byte, error) {\n\tp, ok := v.(*Payload)\n\tif !ok {\n\t\tlog.Fatalf(\"Invalid type of struct: %+v\", v)\n\t}\n\treturn p.Data, nil\n}", "title": "" }, { "docid": "2df04f7d898bbf28d23e909123f909a9", "score": "0.48936898", "text": "func (m JsonWrapper) Value() (driver.Value, error) {\n\tvar jsonRaw json.RawMessage\n\terr := m.Unmarshal(&jsonRaw)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\treturn []byte(m), nil\n}", "title": "" }, { "docid": "ae809ffcf6aad7d4279f802529891c61", "score": "0.48924854", "text": "func TestMarshalCorners(t *testing.T) {\n\t// Ensure encode of an invalid reflect value returns the expected\n\t// error.\n\ttestName := \"Encode invalid reflect value\"\n\texpectedN := 0\n\texpectedErr := error(&MarshalError{ErrorCode: ErrUnsupportedType})\n\texpectedVal := []byte{}\n\tdata := newFixedWriter(expectedN)\n\tn, err := TstEncode(data)(reflect.Value{})\n\ttestExpectedMRet(t, testName, n, expectedN, err, expectedErr)\n\tif !reflect.DeepEqual(data.Bytes(), expectedVal) {\n\t\tt.Errorf(\"%s: unexpected result - got: %x want: %x\\n\",\n\t\t\ttestName, data.Bytes(), expectedVal)\n\t}\n\n\t// Ensure marshal of a struct with both exported and unexported fields\n\t// skips the unexported fields but still marshals to the exported\n\t// fields.\n\ttype unexportedStruct struct {\n\t\tunexported int\n\t\tExported int\n\t}\n\ttestName = \"Marshal struct with exported and unexported fields\"\n\ttstruct := unexportedStruct{0, 1}\n\texpectedN = 4\n\texpectedErr = nil\n\texpectedVal = []byte{0x00, 0x00, 0x00, 0x01}\n\tdata = newFixedWriter(expectedN)\n\tn, err = Marshal(data, tstruct)\n\ttestExpectedMRet(t, testName, n, expectedN, err, expectedErr)\n\tif !reflect.DeepEqual(data.Bytes(), expectedVal) {\n\t\tt.Errorf(\"%s: unexpected result - got: %x want: %x\\n\",\n\t\t\ttestName, data.Bytes(), expectedVal)\n\t}\n\n}", "title": "" }, { "docid": "c03924fd19437b0965630f57daae2e8b", "score": "0.4891254", "text": "func (v LazyValue) MarshalJSON() ([]byte, error) {\n\tif v.doc != nil {\n\t\treturn v.doc, nil\n\t}\n\treturn json.Marshal(v.Value)\n}", "title": "" }, { "docid": "7e4c3fff211f28999e1a0df6a3a7a18e", "score": "0.48901206", "text": "func (enc *Encoder) Encode(e interface{}) os.Error {\n\tif enc.state.b.Len() > 0 || enc.countState.b.Len() > 0 {\n\t\tpanicln(\"Encoder: buffer not empty\")\n\t}\n\trt, _ := indirect(reflect.Typeof(e));\n\n\t// Make sure we're single-threaded through here.\n\tenc.mutex.Lock();\n\tdefer enc.mutex.Unlock();\n\n\t// Make sure the type is known to the other side.\n\t// First, have we already sent this type?\n\tif _, alreadySent := enc.sent[rt]; !alreadySent {\n\t\t// No, so send it.\n\t\tenc.sendType(rt, true);\n\t\tif enc.state.err != nil {\n\t\t\tenc.state.b.Reset();\n\t\t\tenc.countState.b.Reset();\n\t\t\treturn enc.state.err;\n\t\t}\n\t}\n\n\t// Identify the type of this top-level value.\n\tencodeInt(enc.state, int64(enc.sent[rt]));\n\n\t// Encode the object.\n\tencode(enc.state.b, e);\n\tenc.send();\n\n\treturn enc.state.err;\n}", "title": "" }, { "docid": "14e19e3d37940770cd90deeb8e0b3b94", "score": "0.48895654", "text": "func (gobMarshalerUnmarshaler) Marshal(v interface{}) ([]byte, error) {\n\tvar buff bytes.Buffer\n\tenc := gob.NewEncoder(&buff)\n\tif err := enc.Encode(v); err != nil {\n\t\treturn buff.Bytes(), err\n\t}\n\treturn buff.Bytes(), nil\n}", "title": "" }, { "docid": "14e19e3d37940770cd90deeb8e0b3b94", "score": "0.48895654", "text": "func (gobMarshalerUnmarshaler) Marshal(v interface{}) ([]byte, error) {\n\tvar buff bytes.Buffer\n\tenc := gob.NewEncoder(&buff)\n\tif err := enc.Encode(v); err != nil {\n\t\treturn buff.Bytes(), err\n\t}\n\treturn buff.Bytes(), nil\n}", "title": "" }, { "docid": "d369c89c1976a3cb0c88d70e2db83413", "score": "0.48888397", "text": "func Unmarshal(rawVal interface{}) error { return v.Unmarshal(rawVal) }", "title": "" }, { "docid": "bae97381c89ed1ec06deaa4d650c6f11", "score": "0.48857397", "text": "func (c *JSONCodec) Marshal(buf []byte, v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "9938b95a26f08812c7fd0cefa6887861", "score": "0.48831242", "text": "func (this missingValue) MarshalJSON() ([]byte, error) {\n\treturn _NULL_BYTES, nil\n}", "title": "" }, { "docid": "9e08ab57b58cb56f119b581286992622", "score": "0.48824996", "text": "func (u *UpdateTypeInstanceInput) MarshalJSON() ([]byte, error) {\n\tif u.Attributes != nil {\n\t\treturn json.Marshal(NativeUpdateTypeInstanceInput(*u))\n\t}\n\n\t// we do not want to take into account `attributes = nil`\n\t// cause Hub doesn't handle \"null\" properties\n\ta := struct {\n\t\t// The value property is optional. If not provided, previous value is used.\n\t\tValue interface{} `json:\"value,omitempty\"`\n\t}{\n\t\tValue: u.Value,\n\t}\n\treturn json.Marshal(a)\n}", "title": "" }, { "docid": "7c8091e9df46fdf2963436160055d5c4", "score": "0.48738873", "text": "func (p *EventParamsUpdated) Marshal() ([]byte, error) {\n\treturn json.Marshal(p)\n}", "title": "" }, { "docid": "31a02819471fc8885f05f8c50c0994f3", "score": "0.48687783", "text": "func (b BookAttrs) Value() (driver.Value, error) {\n\treturn json.Marshal(b)\n}", "title": "" }, { "docid": "a26db862b7f755905afa9c15397938c7", "score": "0.48588195", "text": "func (v Value) MarshalJSON() ([]byte, error) {\n\tvar jsonVal struct {\n\t\tType string\n\t\tValue interface{}\n\t}\n\tjsonVal.Type = v.Type().String()\n\tjsonVal.Value = v.AsInterface()\n\treturn json.Marshal(jsonVal)\n}", "title": "" }, { "docid": "2e523cc755c2d6393eb11e536c034aca", "score": "0.48443377", "text": "func (r *Instance) marshal(c *Client) ([]byte, error) {\n\tm, err := expandInstance(c, r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshalling Instance: %w\", err)\n\t}\n\tm = EncodeInstanceCreateRequest(m)\n\n\treturn json.Marshal(m)\n}", "title": "" }, { "docid": "db53b1e16e631652f7f6af25b579490f", "score": "0.4839065", "text": "func (*noncacheableTestObject) Marshal() ([]byte, error) {\n\treturn []byte(\"\\\"proto-result\\\"\"), nil\n}", "title": "" }, { "docid": "d07de0ce4fc2425290cdee457d4c1b65", "score": "0.48378658", "text": "func (v *Value) Encode() ([]byte, error) { return Encode(v) }", "title": "" }, { "docid": "c8529988ed524f31ae6d6ab9347ea447", "score": "0.4837346", "text": "func Value(obj interface{}) Receipt {\n\taux, err := encoding.Encode(obj)\n\tif err != nil {\n\t\treturn Receipt{ExitCode: exitcode.EncodingError}\n\t}\n\n\treturn Receipt{\n\t\tExitCode: 0,\n\t\tReturnValue: aux,\n\t\tGasUsed: gas.Zero,\n\t}\n}", "title": "" }, { "docid": "8a19b78ce83a31b9820f3cf45a62cbd9", "score": "0.48346344", "text": "func (v Value) MarshalJSON() ([]byte, error) {\n\tif v.RawMessage == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn v.RawMessage, nil\n}", "title": "" }, { "docid": "3272edcdfd68470bf620a6bddc5155f5", "score": "0.48340312", "text": "func (*MockCacheableObject) Marshal() ([]byte, error) {\n\treturn []byte(\"\\\"proto-result\\\"\"), nil\n}", "title": "" }, { "docid": "1ce505fc53b94a7ab5634ff9beaf0915", "score": "0.48300985", "text": "func (iv ItemValue) MarshalJSON() ([]byte, error) {\n\tswitch iv.Type {\n\tcase String:\n\t\treturn json.Marshal(iv.StrVal)\n\tcase Bool:\n\t\treturn json.Marshal(iv.BoolVal)\n\tcase Number:\n\t\treturn json.Marshal(iv.NumVal)\n\tcase Map:\n\t\treturn json.Marshal(iv.MapVal)\n\tdefault:\n\t\treturn []byte{}, fmt.Errorf(\"impossible ItemValue.Type\")\n\t}\n}", "title": "" }, { "docid": "edf2bb467130ef5912c46c0ed16365b0", "score": "0.48300558", "text": "func validateEncode(v interface{}) (reflect.Value, error) {\n\tif v == nil || (reflect.ValueOf(v).Kind() == reflect.Ptr && reflect.ValueOf(v).IsNil()) {\n\t\treturn reflect.ValueOf(v), fmt.Errorf(\"null pointer %v\", v)\n\t}\n\tval := reflect.ValueOf(v)\n\tfor val.Kind() == reflect.Ptr || val.Kind() == reflect.Interface {\n\t\tval = val.Elem()\n\t}\n\tif val.Kind() == reflect.Slice {\n\t\treturn val, fmt.Errorf(\"not support for slice %v\", val)\n\t}\n\tif val.Type().Kind() != reflect.Struct {\n\t\treturn val, fmt.Errorf(\"not support for not struct type %v\", val)\n\t}\n\treturn val, nil\n}", "title": "" }, { "docid": "e1c9ebfb38f0d1676db9c4152d872bde", "score": "0.48281297", "text": "func (e *encodeState) reflectValueQuoted(v reflect.Value, quoted bool) {\n\tif !v.IsValid() {\n\t\te.WriteString(\"null\")\n\t\treturn\n\t}\n\n\tm, ok := v.Interface().(Marshaler)\n\tif !ok {\n\t\t// T doesn't match the interface. Check against *T too.\n\t\tif v.Kind() != reflect.Ptr && v.CanAddr() {\n\t\t\tm, ok = v.Addr().Interface().(Marshaler)\n\t\t\tif ok {\n\t\t\t\tv = v.Addr()\n\t\t\t}\n\t\t}\n\t}\n\tif ok && (v.Kind() != reflect.Ptr || !v.IsNil()) {\n\t\tb, err := m.MarshalJSON()\n\t\tif err == nil {\n\t\t\t// copy JSON into buffer, checking validity.\n\t\t\terr = compact(&e.Buffer, b, true)\n\t\t}\n\t\tif err != nil {\n\t\t\te.error(&MarshalerError{v.Type(), err})\n\t\t}\n\t\treturn\n\t}\n\n\twriteString := (*encodeState).WriteString\n\tif quoted {\n\t\twriteString = (*encodeState).string\n\t}\n\n\tswitch v.Kind() {\n\tcase reflect.Bool:\n\t\tx := v.Bool()\n\t\tif x {\n\t\t\twriteString(e, \"true\")\n\t\t} else {\n\t\t\twriteString(e, \"false\")\n\t\t}\n\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tb := strconv.AppendInt(e.scratch[:0], v.Int(), 10)\n\t\tif quoted {\n\t\t\twriteString(e, string(b))\n\t\t} else {\n\t\t\te.Write(b)\n\t\t}\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\tb := strconv.AppendUint(e.scratch[:0], v.Uint(), 10)\n\t\tif quoted {\n\t\t\twriteString(e, string(b))\n\t\t} else {\n\t\t\te.Write(b)\n\t\t}\n\tcase reflect.Float32, reflect.Float64:\n\t\tf := v.Float()\n\t\tif math.IsInf(f, 0) || math.IsNaN(f) {\n\t\t\te.error(&UnsupportedValueError{v, strconv.FormatFloat(f, 'g', -1, v.Type().Bits())})\n\t\t}\n\t\tb := strconv.AppendFloat(e.scratch[:0], f, 'g', -1, v.Type().Bits())\n\t\tif quoted {\n\t\t\twriteString(e, string(b))\n\t\t} else {\n\t\t\te.Write(b)\n\t\t}\n\tcase reflect.String:\n\t\tif quoted {\n\t\t\tsb, err := Marshal(v.String())\n\t\t\tif err != nil {\n\t\t\t\te.error(err)\n\t\t\t}\n\t\t\te.string(string(sb))\n\t\t} else {\n\t\t\te.string(v.String())\n\t\t}\n\n\tcase reflect.Struct:\n\t\te.WriteByte('{')\n\t\tfirst := true\n\t\tvar writeFields func(v reflect.Value)\n\t\twriteFields = func(v reflect.Value) {\n\t\t\tfor _, ef := range encodeFields(v.Type()) {\n\t\t\t\tfieldValue := v.Field(ef.i)\n\t\t\t\t// check if it's an anonymous field\n\t\t\t\tif ef.tag == \"\" {\n\t\t\t\t\twriteFields(fieldValue)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif ef.omitEmpty && isEmptyValue(fieldValue) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif first {\n\t\t\t\t\tfirst = false\n\t\t\t\t} else {\n\t\t\t\t\te.WriteByte(',')\n\t\t\t\t}\n\t\t\t\te.string(ef.tag)\n\t\t\t\te.WriteByte(':')\n\t\t\t\te.reflectValueQuoted(fieldValue, ef.quoted)\n\t\t\t}\n\t\t}\n\t\twriteFields(v)\n\t\te.WriteByte('}')\n\n\tcase reflect.Map:\n\t\tif v.Type().Key().Kind() != reflect.String {\n\t\t\te.error(&UnsupportedTypeError{v.Type()})\n\t\t}\n\t\tif v.IsNil() {\n\t\t\te.WriteString(\"null\")\n\t\t\tbreak\n\t\t}\n\t\te.WriteByte('{')\n\t\tvar sv stringValues = v.MapKeys()\n\t\tsort.Sort(sv)\n\t\tfor i, k := range sv {\n\t\t\tif i > 0 {\n\t\t\t\te.WriteByte(',')\n\t\t\t}\n\t\t\te.string(k.String())\n\t\t\te.WriteByte(':')\n\t\t\te.reflectValue(v.MapIndex(k))\n\t\t}\n\t\te.WriteByte('}')\n\n\tcase reflect.Slice:\n\t\tif v.IsNil() {\n\t\t\te.WriteString(\"null\")\n\t\t\tbreak\n\t\t}\n\t\tif v.Type().Elem().Kind() == reflect.Uint8 {\n\t\t\t// Byte slices get special treatment; arrays don't.\n\t\t\ts := v.Bytes()\n\t\t\te.WriteByte('\"')\n\t\t\tif len(s) < 1024 {\n\t\t\t\t// for small buffers, using Encode directly is much faster.\n\t\t\t\tdst := make([]byte, base64.StdEncoding.EncodedLen(len(s)))\n\t\t\t\tbase64.StdEncoding.Encode(dst, s)\n\t\t\t\te.Write(dst)\n\t\t\t} else {\n\t\t\t\t// for large buffers, avoid unnecessary extra temporary\n\t\t\t\t// buffer space.\n\t\t\t\tenc := base64.NewEncoder(base64.StdEncoding, e)\n\t\t\t\tenc.Write(s)\n\t\t\t\tenc.Close()\n\t\t\t}\n\t\t\te.WriteByte('\"')\n\t\t\tbreak\n\t\t}\n\t\t// Slices can be marshalled as nil, but otherwise are handled\n\t\t// as arrays.\n\t\tfallthrough\n\tcase reflect.Array:\n\t\te.WriteByte('[')\n\t\tn := v.Len()\n\t\tfor i := 0; i < n; i++ {\n\t\t\tif i > 0 {\n\t\t\t\te.WriteByte(',')\n\t\t\t}\n\t\t\te.reflectValue(v.Index(i))\n\t\t}\n\t\te.WriteByte(']')\n\n\tcase reflect.Interface, reflect.Ptr:\n\t\tif v.IsNil() {\n\t\t\te.WriteString(\"null\")\n\t\t\treturn\n\t\t}\n\t\te.reflectValue(v.Elem())\n\n\tdefault:\n\t\te.error(&UnsupportedTypeError{v.Type()})\n\t}\n\treturn\n}", "title": "" }, { "docid": "5cea328bb612cd1bb758d9dcacfd98fe", "score": "0.4822428", "text": "func (o *InnerRecord) Marshal() ([]byte, error) {\n\treturn avro.Marshal(o.Schema(), o)\n}", "title": "" }, { "docid": "856eab60cbac03519d725cd4c6564ad7", "score": "0.48217177", "text": "func value(msg proto.Message) (driver.Value, error) {\n\tvalue, err := Marshal(msg)\n\treturn value, valueError.Wrap(err)\n}", "title": "" }, { "docid": "39dc3daaa53048889fcf43570a04830d", "score": "0.48208162", "text": "func (m *_ComplexNumberType) InitializeParent(parent ExtensionObjectDefinition) {}", "title": "" }, { "docid": "567560c7182cfb595dd0e68894fc3bed", "score": "0.48204002", "text": "func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) Bytes() (bytes []byte, err error) {\n\touterInstance := new(OuterModelType)\n\t(OuterModelPtrType)(outerInstance).New(s.sourceID, s.targetID)\n\n\treturn serix.DefaultAPI.Encode(context.Background(), outerInstance, serix.WithValidation())\n}", "title": "" }, { "docid": "ed8794ed25f2b780bec57d7098ad5b24", "score": "0.48163003", "text": "func (k *Key) Value() interface{} {\n\tv, err := k.Object()\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"error loading payload for %q: %w\", k.Name(), err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "1fd4b748e3faf170ab83c5d73c08f0da", "score": "0.4813542", "text": "func MustMarshal(v interface{}) []byte {\n\td, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "title": "" }, { "docid": "b419871d51063b0d4085dcf5843c53d0", "score": "0.48134255", "text": "func castOrUnmarshal(dataInter interface{}, v interface{}, flags ...bool) (err error) {\n\tvar silent bool\n\tif len(flags) >= 1 && flags[0] {\n\t\tsilent = true\n\t}\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tif !silent {\n\t\t\t\tlogging.WithField(\"recover\", r).WithField(\"stack\", string(debug.Stack())).Debug(\"could not cast in castOrUnmarshal\")\n\t\t\t}\n\t\t\terr = errors.New(\"could not cast in castOrUnmarshal\")\n\t\t}\n\t}()\n\tdata, ok := dataInter.(EventBusBytes)\n\tif ok {\n\t\terr = bijson.Unmarshal(data, v)\n\t\tif err != nil {\n\t\t\tlogging.WithField(\"data\", data).WithError(err).Debug(\"could not unmarshal in castOrUnmarshal\")\n\t\t}\n\t} else {\n\t\tif reflect.ValueOf(dataInter).Kind() == reflect.Ptr {\n\t\t\treflect.ValueOf(v).Elem().Set(reflect.ValueOf(dataInter).Elem())\n\t\t} else {\n\t\t\treflect.ValueOf(v).Elem().Set(reflect.ValueOf(dataInter))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c7679de2de0bb9fc6d55b72c38659119", "score": "0.4804425", "text": "func (j *JsonbField) RawValue() interface{} {\n\treturn (*orm.JsonbField)(j).RawValue()\n}", "title": "" }, { "docid": "7eded41821d420c7203b62813dd229e5", "score": "0.4804142", "text": "func (j *JSON) Marshal(target interface{}) ([]byte, error) {\n\treturn json.Marshal(target)\n}", "title": "" }, { "docid": "d5999847518fab2ae1a5a04ef6d0c6c2", "score": "0.480046", "text": "func callMarshalJSON(v reflect.Value) ([]byte, error) {\n\tif method := v.MethodByName(marshalJSON); method.Kind() != reflect.Invalid {\n\t\tmarsh := v.Interface().(json.Marshaler)\n\t\treturn marsh.MarshalJSON()\n\t}\n\n\tif v.Kind() == reflect.Ptr {\n\t\tv = v.Elem()\n\t} else {\n\t\tif v.CanAddr() {\n\t\t\tv = v.Addr()\n\t\t}\n\t}\n\n\tif method := v.MethodByName(unmarshalJSON); method.Kind() != reflect.Invalid {\n\t\tmarsh := v.Interface().(json.Marshaler)\n\t\treturn marsh.MarshalJSON()\n\t}\n\n\tpanic(fmt.Sprintf(\"callMarshalJSON called on type %T that does not have MarshalJSON defined\", v.Interface()))\n}", "title": "" }, { "docid": "27ff6eaa8f8477eeda2ec967d395222b", "score": "0.479729", "text": "func (val *Value) JSON(dest interface{}) error {\n\treturn errors.Trace(json.Unmarshal(val.Bytes(), dest))\n}", "title": "" }, { "docid": "7c71f00b7d5097eba011ecb20c7607d5", "score": "0.4795674", "text": "func MustMarshal(v interface{}) []byte {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "cdfbddd297fe68d3dfc706c2cddef383", "score": "0.47927535", "text": "func (g WSJSONMessage) Marshal() []byte {\n\tif g.Obj == nil {\n\t\tb, _ := json.Marshal(g.value)\n\t\traw := json.RawMessage(b)\n\t\tg.Obj = &raw\n\t}\n\n\tj, _ := json.Marshal(g)\n\treturn j\n}", "title": "" }, { "docid": "6ad73eefb1d6dc64fa283430f9c8f689", "score": "0.47917053", "text": "func (j *Serializer) Marshal(d interface{}) ([]byte, error) {\n\treturn json.Marshal(d)\n}", "title": "" }, { "docid": "ea6084a02ab112b02ed8a76701f0d9d2", "score": "0.477779", "text": "func (binding *BoundReference) MarshalJSON() ([]byte, error) {\n\tif binding == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\tvar buf bytes.Buffer\n\tbidLen := len(binding.Exp.Id) +\n\t\tlen(binding.Exp.OutputId) +\n\t\tbinding.Type.TypeId().jsonSizeEstimate()\n\tbuf.Grow(bidLen + len(`{\"ref\":\".\",\"type\":}`))\n\terr := binding.encodeJSON(&buf)\n\treturn buf.Bytes(), err\n}", "title": "" }, { "docid": "17a2a8ee1d1e391f700b70e28f3eb78c", "score": "0.47771862", "text": "func (valueData *ValueData) Marshal() string {\n\tmsgp, err := valueData.MarshalMsg(nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn base64.StdEncoding.EncodeToString(msgp)\n}", "title": "" }, { "docid": "d619535ab6d84d6c9eace7aef01d3c8c", "score": "0.47741172", "text": "func (this *Min) Type() value.Type { return value.JSON }", "title": "" }, { "docid": "0957390c4c4cf746e7a91aae74d457b8", "score": "0.47680703", "text": "func (valueData *TxValueData) Marshal() string {\n\tm, err := valueData.MarshalMsg(nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn base64.StdEncoding.EncodeToString(m)\n}", "title": "" }, { "docid": "f862203ece84f7789c70977e411ec28d", "score": "0.47667953", "text": "func main() {\n\tc := Constructor()\n\tr := &TreeNode{11, &TreeNode{2, nil, nil}, &TreeNode{3, &TreeNode{4, nil, nil}, &TreeNode{5, nil, nil}}}\n\t//r := &TreeNode{1, &TreeNode{2, nil, nil}, nil}\n\tret := c.serialize(r)\n\tfmt.Println(ret)\n\tfmt.Println(c.deserialize(ret))\n}", "title": "" } ]
7b5161fae64ee1d004527240077205d8
Timeout configures how long evaluation should run before it is killed.
[ { "docid": "74fa0158f95447f6bd7ae85055d691be", "score": "0.61994255", "text": "func Timeout(t time.Duration) option {\n\treturn func(c *Context) error {\n\t\tc.timeout = t\n\t\treturn nil\n\t}\n}", "title": "" } ]
[ { "docid": "03f563c31fa93230ee7d69e07827e0db", "score": "0.6511441", "text": "func (o *CreateRecommendationForWorkspaceByEnvCrnParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "dcdea2131053f6b55289d22365d627ac", "score": "0.6296636", "text": "func (t *TestSuite) Timeout(timeout time.Duration) {\n\tt.timeout = time.After(timeout)\n}", "title": "" }, { "docid": "a9313e41caaaf8b95cce2635f0041f0d", "score": "0.6276171", "text": "func Timeout(timeout time.Duration) Option {\n\treturn func(ctx *context.Context, ce *CommandExecutor) error {\n\t\tif timeout <= 0 {\n\t\t\treturn ErrInvalidTimeout\n\t\t}\n\t\tnewContext, cancel := context.WithTimeout(*ctx, timeout)\n\t\t*ctx = newContext\n\t\tce.Cancel = cancel\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "b01054b6429e93095907d425be054dd4", "score": "0.6257995", "text": "func Timeout(timeout time.Duration) Configuration {\n\treturn func(options *Options) {\n\t\toptions.Timeout = timeout\n\t}\n}", "title": "" }, { "docid": "b36417f6d3b3ca536243c118ee8dfe69", "score": "0.6246999", "text": "func Timeout(timeout time.Duration) Option {\n\treturn func(c *config) { c.timeout = timeout }\n}", "title": "" }, { "docid": "92fd9d140a27f824aac03b0da576ebe4", "score": "0.62354785", "text": "func (o *CreateEscalationPolicyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e58a9e92a912d0a7ee737f29644b3d2e", "score": "0.6201094", "text": "func (o *CreateRuntimeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bf66062652769fe103f13a1a0884f443", "score": "0.6190676", "text": "func Timeout(timeout time.Duration) Option {\n\treturn func(c *Config) {\n\t\tc.timeout = timeout\n\t}\n}", "title": "" }, { "docid": "ca26481b6b1053b95e1bbe38f3631e3f", "score": "0.6177042", "text": "func (c *Configuration) ExecTimeout(dur time.Duration) *Configuration {\n\tc.ExecTimeoutSecs = int(dur.Seconds())\n\treturn c\n}", "title": "" }, { "docid": "510fc7143dd7b6ec4ffcce2a38433327", "score": "0.61556304", "text": "func TestREPLTimeout(t *testing.T) {\n\tt.Skip(\"dependency broke this test\")\n\n\tr := New(\"test >\", time.Second*5)\n\ttime.Sleep(time.Second * 6)\n\tselect {\n\tcase <-r.stopChan:\n\tdefault:\n\t\tt.Fatal(\"repl was still running after timeout elapsed\")\n\t}\n\n\tr = New(\"test >\", time.Second*5)\n\tr.AddCommand(Command{\n\t\tName: \"testcmd\",\n\t\tAction: func(args []string) (string, error) {\n\t\t\treturn \"success\", nil\n\t\t},\n\t\tUsage: \"\",\n\t})\n\n\ttime.Sleep(time.Second * 4)\n\t_, err := r.eval(\"testcmd\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\ttime.Sleep(time.Second * 4)\n\tselect {\n\tcase <-r.stopChan:\n\t\tt.Fatal(\"repl stopped prematurely\")\n\tdefault:\n\t}\n\n\tr = New(\"test >\", time.Second*5)\n\ttime.Sleep(time.Second * 4)\n\t_, err = r.eval(\"\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\ttime.Sleep(time.Second * 4)\n\tselect {\n\tcase <-r.stopChan:\n\t\tt.Fatal(\"repl stopped prematurely\")\n\tdefault:\n\t}\n}", "title": "" }, { "docid": "973c35adb6c7d29aa0b5a4974d7ec584", "score": "0.6138023", "text": "func (e *Executor) SetTimeout(t time.Duration) {\n\te.timeout = t\n}", "title": "" }, { "docid": "b17eb4e7bf20a17d0a0184d64b5c624f", "score": "0.61053836", "text": "func (o *RunLookmlTestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8b117b7df788333fcb18d815f2d4df46", "score": "0.6068931", "text": "func SetTimeout(ttl int) {\n\ttimeout = ttl\n}", "title": "" }, { "docid": "e8c4d8b03b44c81572f6eb91fe37dba2", "score": "0.5979495", "text": "func (o *PostLolGameflowV1SessionGameConfigurationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1ce738d75b55345f3ba66cbedcc66852", "score": "0.593542", "text": "func (o *CreateMachinePolicyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "fe8145ebc2ca5e389dc5b0f9a6d63bb0", "score": "0.5928879", "text": "func (o *CreateSiteBuildHookParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ffe60b9a808891483a6f33ca064897cc", "score": "0.5911026", "text": "func (o *CreateGlobalRegistryParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "809193158cbceb755eeb4acdf0952e77", "score": "0.5883344", "text": "func Timeout(timeout time.Duration) OptionFunc {\n\treturn func(tp *TracedPublisher) error {\n\t\tif timeout <= 0 {\n\t\t\treturn errors.New(\"timeout must be positive\")\n\t\t}\n\t\ttp.cfg = amqp.Config{\n\t\t\tDial: func(network, addr string) (net.Conn, error) {\n\t\t\t\treturn net.DialTimeout(network, addr, timeout)\n\t\t\t},\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "ae65f595c511ad64afe949e278d40029", "score": "0.58680296", "text": "func (o *GetFreeIpaFlowLogsProgressByEnvironmentCrnParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4b331320150109fe3b30b9b4af970a8f", "score": "0.58577037", "text": "func (sq *sequenceGenerator) SetTimeout(d time.Duration) *sequenceGenerator {\n\tsq.timeout = d\n\treturn sq\n}", "title": "" }, { "docid": "8a4ad3baa60c58f957da97392455b123", "score": "0.58492833", "text": "func (o *DeleteCustomRuleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "873621097cefa04affc053bd0245e1be", "score": "0.5831319", "text": "func (c *Config) Timeout() time.Duration { return c.MockTimeout }", "title": "" }, { "docid": "1ca1392e8f46af76736480fcd707b113", "score": "0.5824908", "text": "func (a *Agent) Timeout(timeout time.Duration) *Agent {\n\ta.timeout = timeout\n\n\treturn a\n}", "title": "" }, { "docid": "fcb08ca0801b0d0ade25d568ad31c1eb", "score": "0.5822382", "text": "func (o *CreateAddonParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0e048619fb0e0c91ea8ed5e0499a6563", "score": "0.5820704", "text": "func (o *EmailDeliveryReceiptAutomationPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7a1eb131678118989c63855186d3a69e", "score": "0.58156365", "text": "func (r *Runner) SetTimeout(timeout time.Duration) *Runner {\n\tif timeout > 0 {\n\t\tr.waitTimeout = timeout\n\t}\n\treturn r\n}", "title": "" }, { "docid": "b134a87ef161497453906171fcf20ff3", "score": "0.58106303", "text": "func (o *EmployeeNextOfKinPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "30aab01cf7eccd95b6f968ae00bbdaf0", "score": "0.58082604", "text": "func (o *StorageKmipServer) SetTimeout(v int64) {\n\to.Timeout = &v\n}", "title": "" }, { "docid": "fd69d91a6ecbe91491e14a0c2a757d52", "score": "0.5799173", "text": "func (o *ResizeMachineParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7eee5d753e7915b2e85d9434f8ab94d0", "score": "0.5783514", "text": "func (o *GetApplicationDetectionRuleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "783e766755b82445540d83421c4fcd54", "score": "0.5779528", "text": "func (o *GetSolutionRecipeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ba9a6d57a6006e88ba722a550a295507", "score": "0.57779735", "text": "func (o *GetLeagueEntriesExpParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3c1ab67e753e5d26d56ac2a351b84baa", "score": "0.57765704", "text": "func (o *CleanupParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "800d2fdb8227feb15c716c62b8b20c57", "score": "0.5771986", "text": "func (o *RecommendConfigParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8bdc213953ba213a3eb93e06cfb6f359", "score": "0.5771069", "text": "func (c *PooledActuator) setTimeout(timeout *time.Duration) {\n\tc.timeout = timeout\n}", "title": "" }, { "docid": "8c7b9dfd0b70cd99ef873e28766fca46", "score": "0.5770729", "text": "func (o *PostProjectsProjectIDWebhookPoliciesTestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8c7b9dfd0b70cd99ef873e28766fca46", "score": "0.5770729", "text": "func (o *PostProjectsProjectIDWebhookPoliciesTestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9a9600355650c3ad1a93f31732c65064", "score": "0.5763986", "text": "func (c *ProjectsLocationsModelsEvaluationsOperationsWaitCall) Timeout(timeout string) *ProjectsLocationsModelsEvaluationsOperationsWaitCall {\n\tc.urlParams_.Set(\"timeout\", timeout)\n\treturn c\n}", "title": "" }, { "docid": "0978e1e500c17663fd477affcab46ae7", "score": "0.5763641", "text": "func (s *StartResourceEvaluationInput) SetEvaluationTimeout(v int64) *StartResourceEvaluationInput {\n\ts.EvaluationTimeout = &v\n\treturn s\n}", "title": "" }, { "docid": "e51dad1637358223445c3d603ebddf62", "score": "0.5760174", "text": "func (o *DeleteNetworksNetworkIDPrometheusAlertConfigParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b53faceb26c8daf931a5a42d0fe3b938", "score": "0.5755498", "text": "func (be *BExp) Timeout() time.Duration {\n\treturn -1\n}", "title": "" }, { "docid": "bf7cd38c73dce24869604f53841a960e", "score": "0.5753114", "text": "func (o *GetImageFromDefaultWithRuntimeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bc6a5ca70e3cb417b7fead10fb0dd129", "score": "0.5744258", "text": "func (ewt ExecerWithTimeout) ApplyToExecerOptions(target *ExecerOptions) {\n\ttarget.Timeout = time.Duration(ewt)\n}", "title": "" }, { "docid": "73954e90bb06febc6367f0a9f3f85a6b", "score": "0.5738664", "text": "func (o *ListExperimentsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ec5d911a85b15c673e148febc583e431", "score": "0.57376647", "text": "func WithTimeout(duration time.Duration) Option {\n\treturn wrappedOption{otlpconfig.WithTimeout(duration)}\n}", "title": "" }, { "docid": "7b956150c820c8d5e61d59541afa60f1", "score": "0.5736527", "text": "func (o *CreateAppParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "900ad2870a386b4c2273be271a258485", "score": "0.5734491", "text": "func Timeout(t time.Duration) Option {\n\treturn func(o *Options) {\n\t\to.Timeout = t\n\t}\n}", "title": "" }, { "docid": "9410c1a47814f636b6b965e052dc8e5c", "score": "0.5724753", "text": "func (o *ResolveRecipesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "01c513ad7edcaf7dc12e26f207d0f9cd", "score": "0.5722869", "text": "func (o *DeleteStoragepoolTiersParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "083285e80fc0ddb4ae4529445746cba5", "score": "0.5711196", "text": "func (c *ProjectsLocationsTensorboardsExperimentsRunsOperationsWaitCall) Timeout(timeout string) *ProjectsLocationsTensorboardsExperimentsRunsOperationsWaitCall {\n\tc.urlParams_.Set(\"timeout\", timeout)\n\treturn c\n}", "title": "" }, { "docid": "b4f847b067cfb140881a428b3d523970", "score": "0.5702889", "text": "func (o *Options) QuitTimeout() time.Duration {\n\treturn time.Duration((o.Timeout.Seconds() * quitTimeoutFactor)) * time.Second\n}", "title": "" }, { "docid": "f9872ed287c891f66e5929b96ff2be39", "score": "0.5701611", "text": "func (o *GetImagePolicyCheckParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "26936c7d0847a8e5c66f3d8e84cb8a0b", "score": "0.5699955", "text": "func (o *GetNutritionTipsForNutrientParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1049fb2cad6869e47e42f449f0390276", "score": "0.56937414", "text": "func (o *CreateMeteringAssignmentStrategyUsingPOST2Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8b558e4f3d83930db7e95394a34a6943", "score": "0.5686224", "text": "func (o *CreateWorkflowParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "59e8dd43cf05915424b42fe0298ded7f", "score": "0.56861067", "text": "func (o *DefaultThemeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d874dd15225ac005066ea58c1a6ddb37", "score": "0.5673253", "text": "func (o *GetRunbookRunPreviewForRunbookParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "193a4e0fd2c353befc97c7a180d08332", "score": "0.5662151", "text": "func (c *ProjectsLocationsTensorboardsExperimentsOperationsWaitCall) Timeout(timeout string) *ProjectsLocationsTensorboardsExperimentsOperationsWaitCall {\n\tc.urlParams_.Set(\"timeout\", timeout)\n\treturn c\n}", "title": "" }, { "docid": "96cb6f849102896dbdec978c9b191c16", "score": "0.56592447", "text": "func (o *CreateLibraryVariableSetSpacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e19171bed5c51e974435e86cd17528ea", "score": "0.5656883", "text": "func (cs *State) scheduleTimeout(duration time.Duration, height int64, round int32, step cstypes.RoundStepType) {\n\tcs.timeoutTicker.ScheduleTimeout(timeoutInfo{duration, height, round, step})\n}", "title": "" }, { "docid": "66bd2ba465eb63f4128459bbf348f544", "score": "0.5656048", "text": "func (o *SetMemoRequiredParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "58a1c763d22631e78b93dfaa85ac04f5", "score": "0.565331", "text": "func (bt *BExpT) Timeout() time.Duration {\n\treturn time.Duration(bt.T) * time.Second\n}", "title": "" }, { "docid": "3d9c94956e74681957790ae23ed9473e", "score": "0.56481487", "text": "func (o *PostWorkflowTaskDefinitionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "cc521d166abf25bf61760aadc7c75398", "score": "0.5648061", "text": "func (o *GetPrinterDiagnosticsTemperatureFlowSampleCountParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1df0201102a19d425ecd9cb8fb4373b1", "score": "0.56468946", "text": "func (s *Store) Timeout(t time.Duration) *Store {\n\ts.expiration = t\n\ts.newExpiration <- struct{}{}\n\treturn s\n}", "title": "" }, { "docid": "a5ff903343ec631a64194b21d4a2bfb9", "score": "0.5645957", "text": "func Timeout(step Step, duration string) *TimeoutStep {\n\treturn &TimeoutStep{\n\t\tstep: step,\n\t\tduration: duration,\n\t\ttimedOut: false,\n\t}\n}", "title": "" }, { "docid": "9394e0ef2e6e60c6061ce62df7048a61", "score": "0.5641065", "text": "func (o *CreateCustomImageParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4ebd08734b172719aa02cc8c395238bd", "score": "0.5636032", "text": "func (o *ListRecurringRunsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "94c197d7ff9e574e0d4b7904ff2e0ea7", "score": "0.5632656", "text": "func (c *Fake) SetTimeout(d time.Duration) {\n}", "title": "" }, { "docid": "8f8434de46992ba189efa17d9001a93e", "score": "0.56307673", "text": "func (p *Process) SetTimeout(t time.Duration) {\r\n\tp.Details.Timeout = t\r\n}", "title": "" }, { "docid": "2e50b4f0189c09b3c30bf9b0597088d9", "score": "0.56231064", "text": "func (o *PostNetworksNetworkIDMetricsPushParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "38737003cb2f92d0fd44e4f73dd9a96c", "score": "0.56229776", "text": "func (c *ProjectsLocationsTensorboardsExperimentsRunsTimeSeriesOperationsWaitCall) Timeout(timeout string) *ProjectsLocationsTensorboardsExperimentsRunsTimeSeriesOperationsWaitCall {\n\tc.urlParams_.Set(\"timeout\", timeout)\n\treturn c\n}", "title": "" }, { "docid": "45cb08110e3af2b40ea004a82920cacf", "score": "0.56225955", "text": "func (o *PostAssumedStrainSimulationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7439fa8fb13f02498bccbb4a60a0f50d", "score": "0.5620357", "text": "func (o *GetEntryGateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "04c9bfe80504d74e07c2b989f827b460", "score": "0.5617996", "text": "func (o *HealthCheck) SetTimeout(v int32) {\n\to.Timeout = v\n}", "title": "" }, { "docid": "9dc8aec0379c42372bb16dfe46dfbe69", "score": "0.56151265", "text": "func Timeout(timeout time.Duration) Option {\n\treturn func(o *Options) {\n\t\to.Timeout = timeout\n\t}\n}", "title": "" }, { "docid": "b05f096fc4b26736e13bfafaa63403d3", "score": "0.5614856", "text": "func defaultExecutionTimeout(ctl task.Controller) time.Duration {\n\t// TODO(vadimsh): Do something smarter, e.g. look at next expected invocation\n\t// time.\n\treturn time.Hour\n}", "title": "" }, { "docid": "61c56aecf542a6218f8161971c37a625", "score": "0.56086296", "text": "func (o *CloneTestPlanParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "313b8532826e6dfc25b99aa4116b404b", "score": "0.5606663", "text": "func (o *GetBootPrecisionPoliciesMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7db07a89ac04fcf0014ad408dcbdd6b7", "score": "0.5606525", "text": "func (o *ProcessPaymentByExternalKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "a97354ed463003a5f29f720de890729a", "score": "0.560238", "text": "func (o *GetJobRecentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f198b07f33379cd27eeaf66c86a127c6", "score": "0.5599176", "text": "func (o *DeleteHyperflexLocalCredentialPoliciesMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "71e3a51013de1c31435878e481f0ed4a", "score": "0.559491", "text": "func (o *CreateJobPolicyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5c5a350110597bea197781a94cc4d339", "score": "0.5577787", "text": "func TimedOut() {\n\ts := \"execution took too long\"\n\tlog.Println(\"FATAL:\", s)\n\tmonitor(monitorCritical, s)\n}", "title": "" }, { "docid": "ff2e0d6e8d1d1b30f9e91ab81895a239", "score": "0.55758595", "text": "func (r *JobDefinition) Timeout() pulumi.Output {\n\treturn r.s.State[\"timeout\"]\n}", "title": "" }, { "docid": "3cd42fbdde56973d58873f15df9515be", "score": "0.5573899", "text": "func (o *RenewDistroXCertificateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9e9915c1c0e287c392c4981c62e65109", "score": "0.5571335", "text": "func (o *GetConfigurationDetectionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "065d5a025f12df1576596e40c1f5ec29", "score": "0.55698603", "text": "func (o *RestoreDatalakeStatusParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "449626685ba2d795b01be3e0fd3f2445", "score": "0.55678475", "text": "func (r *Health) Timeout(v string) *Health {\n\tr.values.Set(\"timeout\", v)\n\n\treturn r\n}", "title": "" }, { "docid": "8ff17312b9ce1eb2d08bcc5188b70ca4", "score": "0.55677354", "text": "func SetTimeout(duration int) {\n\ts.SetTimeout(time.Duration(duration) * time.Second)\n}", "title": "" }, { "docid": "2db84dd04b989a72fd715430479b0e69", "score": "0.5563249", "text": "func (s *AwsEcsTaskDefinitionContainerDefinitionsHealthCheckDetails) SetTimeout(v int64) *AwsEcsTaskDefinitionContainerDefinitionsHealthCheckDetails {\n\ts.Timeout = &v\n\treturn s\n}", "title": "" }, { "docid": "fd5683ec21786ec966143b2833617f33", "score": "0.55627483", "text": "func (o *UpdateNotificationRuleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "cf1d70e712b6d60cdb02595ed6a44328", "score": "0.55619866", "text": "func Timeout(timeout time.Duration) stop_dispatcher.Callback {\n\treturn stop_dispatcher.NewPrioritizeCallback(1000, func(ctx context.Context) error {\n\t\ttime.AfterFunc(timeout, func() {\n\t\t\tlog.Printf(\"Shutdown timeout exceeded %s\", timeout)\n\t\t\tosExit(1)\n\t\t})\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "fa9a391221d1992a3501c6b104381f89", "score": "0.5558712", "text": "func (o *CreateCloudJobParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b435955a37dd5b61fd8b68010dfdbadb", "score": "0.55584955", "text": "func (o *UpdateEnvironmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "47da04488e1638f388fedf233e165341", "score": "0.55569506", "text": "func (o *EmsFilterRuleModifyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bc1ceedae58a086331e71f5ede9d396b", "score": "0.55560285", "text": "func (o *PostSolPoliciesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "55f3ebe90b02c3bcf58777bfc70710ab", "score": "0.55537724", "text": "func (o *AddBuildFlagParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "537b339696249679df1d3d3242f2a3cc", "score": "0.55530494", "text": "func (c *Check) SetTimeout(timeout time.Duration) {\n\tc.timeout = timeout\n\tlog.Debug().\n\t\tFloat64(\"timeout\", c.timeout.Seconds()).\n\t\tMsg(\"set new timeout\")\n}", "title": "" } ]
c63338da4e9168a34955c83ec9b03f95
WithBody adds the body to the create channel handler params
[ { "docid": "e7668f681427616ce747446366f03696", "score": "0.7760061", "text": "func (o *CreateChannelHandlerParams) WithBody(body *matchmakingclientmodels.ModelsChannelRequest) *CreateChannelHandlerParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" } ]
[ { "docid": "577fb551f5db1361efba4e61151c738e", "score": "0.66751266", "text": "func (o *CreateChannelHandlerParams) SetBody(body *matchmakingclientmodels.ModelsChannelRequest) {\n\to.Body = body\n}", "title": "" }, { "docid": "80f41a703be620d7056276dc8881877f", "score": "0.60424495", "text": "func (api *Api) createChannel(w http.ResponseWriter, r *http.Request) {\n\tvar ch model.Channel\n\t// Gets JSON object from request body.\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&ch); err != nil {\n\t\tutils.RespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\n\t\treturn\n\t}\n\n\tdefer r.Body.Close()\n\n\tif err := ch.CreateChannel(d.Database); err != nil {\n\t\tutils.RespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\t// Respond with newly created channel.\n\tutils.RespondWithJSON(w, http.StatusCreated, ch)\n}", "title": "" }, { "docid": "424151e1f31fcc0195336aa2ed5c1fd6", "score": "0.5620567", "text": "func (o *AddEventLoopParams) WithBody(body *vproxy_client_model.EventLoopCreate) *AddEventLoopParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "7617268d4a95fafbec0b098b64a76272", "score": "0.55816835", "text": "func (o *AddEventLoopParams) SetBody(body *vproxy_client_model.EventLoopCreate) {\n\to.Body = body\n}", "title": "" }, { "docid": "403e519ad41b7d8f1d4c44d7c7b0d976", "score": "0.53368294", "text": "func (o *AddEventLoopGroupParams) SetBody(body *vproxy_client_model.EventLoopGroupCreate) {\n\to.Body = body\n}", "title": "" }, { "docid": "67130861b8c5e990a88ca9c9efc8d8c3", "score": "0.5304365", "text": "func (client *Client) ChannelCreate(ctx context.Context, draft *ChannelDraft, opts ...RequestOption) (result *Channel, err error) {\n\tparams := url.Values{}\n\tfor _, opt := range opts {\n\t\topt(&params)\n\t}\n\n\tendpoint := \"channels\"\n\terr = client.create(ctx, endpoint, params, draft, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "01817c41a78f33aa859f42d1a42ec64f", "score": "0.5220979", "text": "func (s *Fb2) CreateBody() *Body {\n\ts.body = &Body{}\n\treturn s.body\n}", "title": "" }, { "docid": "f3364012fdd7216e8473167a62f358f0", "score": "0.5216361", "text": "func (client *Client) ChannelCreate(draft *ChannelDraft) (result *Channel, err error) {\n\terr = client.Create(ChannelURLPath, nil, draft, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "cfd65a550c1bf819a3ac7fab99cda27c", "score": "0.51986355", "text": "func WithBody(body io.Reader) BodyOption {\n\treturn func(bo *bodyOption) {\n\t\tbo.body = body\n\t}\n}", "title": "" }, { "docid": "f16345a0359092444169aee75f5e9fdd", "score": "0.5191904", "text": "func (r ApiApiUserApiKeyPostRequest) Body(body RequestsCreateUserAPIKeyRequest) ApiApiUserApiKeyPostRequest {\n\tr.body = &body\n\treturn r\n}", "title": "" }, { "docid": "237c13abc00056a2662bfaa4139e00d3", "score": "0.51734143", "text": "func (o *CreateChannelHandlerParams) WithContext(ctx context.Context) *CreateChannelHandlerParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "6df56bb7663112dc14f28f617ffc9632", "score": "0.51202303", "text": "func CreateOrUpdateChannel(client fab.FabricClient, ordererUser ca.User, orgUser ca.User, channel fab.Channel, channelConfig string) error {\n\tlogger.Debugf(\"***** Creating or updating channel: %s *****\\n\", channel.Name())\n\n\tcurrentUser := client.UserContext()\n\tdefer client.SetUserContext(currentUser)\n\n\tclient.SetUserContext(orgUser)\n\n\tconfigTx, err := ioutil.ReadFile(channelConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error reading config file: %v\", err)\n\t}\n\n\tconfig, err := client.ExtractChannelConfig(configTx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error extracting channel config: %v\", err)\n\t}\n\n\tconfigSignature, err := client.SignChannelConfig(config)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error signing configuration: %v\", err)\n\t}\n\n\tvar configSignatures []*common.ConfigSignature\n\tconfigSignatures = append(configSignatures, configSignature)\n\n\trequest := fab.CreateChannelRequest{\n\t\tName: channel.Name(),\n\t\tOrderer: channel.Orderers()[0],\n\t\tConfig: config,\n\t\tSignatures: configSignatures,\n\t}\n\n\tclient.SetUserContext(ordererUser)\n\t_, err = client.CreateChannel(request)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"CreateChannel returned error: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7192a2ed20a619bfa8f914c979fe5918", "score": "0.5111855", "text": "func (o *CreateUserDistributionReceiverParams) SetBody(body *platformclientmodels.DistributionReceiverCreate) {\n\to.Body = body\n}", "title": "" }, { "docid": "d61a0f0669bf2893fa10d8f1d410b2f6", "score": "0.5051929", "text": "func NewCreateChannelHandlerParams() *CreateChannelHandlerParams {\n\tvar ()\n\treturn &CreateChannelHandlerParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "d3166028b5df03c7e26305f029b678f4", "score": "0.501829", "text": "func (o *CreateCurrentUserRepoParams) SetBody(body *models.CreateRepoOption) {\n\to.Body = body\n}", "title": "" }, { "docid": "e5a48071502f5d16fa3e2c37879b879a", "score": "0.49858755", "text": "func (o *CreateDeploymentParams) SetBody(body *models.DeploymentCreateRequest) {\n\to.Body = body\n}", "title": "" }, { "docid": "98c583b1cc90e9f10d847cf0bfa77551", "score": "0.49711248", "text": "func (wsClient *websocketData) createSlackPost(msg string, channel string) {\n\tpayload := slackRtmEvent{\n\t\tId: 1,\n\t\tType: \"message\",\n\t\tChannel: channel,\n\t\tText: msg,\n\t}\n\tjPayload, err := json.Marshal(payload)\n\tif err != nil {\n\t\tlog.Fatal(fmt.Sprintf(\"Error encoding slackRtmEvent payload: %s\", err))\n\t}\n\twsClient.writeSocket(jPayload)\n}", "title": "" }, { "docid": "81a8ac1561fb10d45d84c1528b8e1550", "score": "0.49668238", "text": "func (o *CreateSoftwareVersionParams) WithBody(body *models.CreateSoftwareVersion) *CreateSoftwareVersionParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "5fc84a3737b1cfd74ab172e15d9abdec", "score": "0.4961308", "text": "func (o *NewCallParams) WithBody(body *models.NewCallRequest) *NewCallParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "afc76bb10dbdb798a0955e8796129a2a", "score": "0.49607548", "text": "func NewCreateChannelHandlerParamsWithHTTPClient(client *http.Client) *CreateChannelHandlerParams {\n\tvar ()\n\treturn &CreateChannelHandlerParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "2ee8da7ce39ea5808ad0a4e3cbb08976", "score": "0.49579173", "text": "func Body(msg string) api.RequestOption {\n\treturn api.RequestOptionFunc(func(opts *api.RequestOpts) {\n\t\topts.GiveRequest.Body = bytes.NewBufferString(msg)\n\t})\n}", "title": "" }, { "docid": "e6bf61703b81c98cb089812781102b4e", "score": "0.4957172", "text": "func (o *CreateChannelHandlerParams) WithHTTPClient(client *http.Client) *CreateChannelHandlerParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "17c6db73072c0aff1c77d8e969f2f8aa", "score": "0.49490988", "text": "func (a *PublishSubscribeApiService) CreateChannel(Ctx _context.Context) ApiCreateChannelRequest {\n\treturn ApiCreateChannelRequest{\n\t\tApiService: a,\n\t\tCtx: Ctx,\n\t}\n}", "title": "" }, { "docid": "0612012b12a4fce14ae99cb51197717c", "score": "0.49220446", "text": "func Create(orderOrgName, orderOrgUser, orderURL, orgName, orgUser, channelID, channelConfigPath string, configBytes []byte,\n\tsdkOpts ...fabsdk.Option) (txID string, err error) {\n\t// Resource management client is responsible for managing channels (create/update channel)\n\t// Supply user that has privileges to create channel (in this case orderer admin)\n\tresMgmtClient, sdk, err := resMgmtOrdererClient(orderOrgName, orderOrgUser, configBytes, sdkOpts...)\n\tif err != nil {\n\t\tgnomon.Log().Error(\"Create\", gnomon.Log().Err(err))\n\t\treturn \"\", err\n\t}\n\tdefer sdk.Close()\n\treturn createChannel(orderURL, orgName, orgUser, channelID, channelConfigPath, sdk, resMgmtClient)\n}", "title": "" }, { "docid": "892336d29d1a68892eb3dbe817a14fe6", "score": "0.4919507", "text": "func (o *CreateChannelHandlerParams) WithTimeout(timeout time.Duration) *CreateChannelHandlerParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "fa97a4130e9d1a2f3cb0ca34b7007f1a", "score": "0.48783046", "text": "func (o *ExchangeAddParams) SetBody(body *models.ExchangeAddRequest) {\n\to.Body = body\n}", "title": "" }, { "docid": "e98472a05a8f66d9c15926739698eb14", "score": "0.4869863", "text": "func (r *builder) WithBody(body io.Reader) Builder {\n\tr.body = body\n\treturn r\n}", "title": "" }, { "docid": "4bb6cef0ce259491e2c43cf9f10c32ae", "score": "0.4847734", "text": "func (o *CreateSoftwareVersionParams) SetBody(body *models.CreateSoftwareVersion) {\n\to.Body = body\n}", "title": "" }, { "docid": "0f20fa51f5761a9c2a7ac23b3b6371b6", "score": "0.48399112", "text": "func (c *Resource) createOrUpdateChannel(request fab.CreateChannelRequest, haveEnvelope bool) error {\n\t// Validate request\n\tif request.Config == nil && !haveEnvelope {\n\t\treturn errors.New(\"missing envelope request parameter containing the configuration of the new channel\")\n\t}\n\n\tif request.Signatures == nil && !haveEnvelope {\n\t\treturn errors.New(\"missing signatures request parameter for the new channel\")\n\t}\n\n\tif request.TxnID.ID == \"\" && !haveEnvelope {\n\t\treturn errors.New(\"txId required\")\n\t}\n\n\tif request.TxnID.Nonce == nil && !haveEnvelope {\n\t\treturn errors.New(\"nonce required\")\n\t}\n\n\tif request.Orderer == nil {\n\t\treturn errors.New(\"missing orderer request parameter for the initialize channel\")\n\t}\n\n\tif request.Name == \"\" {\n\t\treturn errors.New(\"missing name request parameter for the new channel\")\n\t}\n\n\t// channel = null;\n\tvar signature []byte\n\tvar payloadBytes []byte\n\n\tif haveEnvelope {\n\t\tlogger.Debug(\"createOrUpdateChannel - have envelope\")\n\t\tenvelope := &common.Envelope{}\n\t\terr := proto.Unmarshal(request.Envelope, envelope)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"unmarshal request envelope failed\")\n\t\t}\n\t\tsignature = envelope.Signature\n\t\tpayloadBytes = envelope.Payload\n\t} else {\n\t\tlogger.Debug(\"createOrUpdateChannel - have config_update\")\n\t\tconfigUpdateEnvelope := &common.ConfigUpdateEnvelope{\n\t\t\tConfigUpdate: request.Config,\n\t\t\tSignatures: request.Signatures,\n\t\t}\n\n\t\t// TODO: Move\n\t\tchannelHeaderOpts := txn.ChannelHeaderOpts{\n\t\t\tChannelID: request.Name,\n\t\t\tTxnID: request.TxnID,\n\t\t\tTLSCertHash: ccomm.TLSCertHash(c.clientContext.Config()),\n\t\t}\n\t\tchannelHeader, err := txn.CreateChannelHeader(common.HeaderType_CONFIG_UPDATE, channelHeaderOpts)\n\t\tif err != nil {\n\t\t\treturn errors.WithMessage(err, \"BuildChannelHeader failed\")\n\t\t}\n\n\t\theader, err := txn.CreateHeader(c.clientContext, channelHeader, request.TxnID)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"BuildHeader failed\")\n\t\t}\n\t\tconfigUpdateEnvelopeBytes, err := proto.Marshal(configUpdateEnvelope)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"marshal configUpdateEnvelope failed\")\n\t\t}\n\t\tpayload := &common.Payload{\n\t\t\tHeader: header,\n\t\t\tData: configUpdateEnvelopeBytes,\n\t\t}\n\t\tpayloadBytes, err = proto.Marshal(payload)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"marshal payload failed\")\n\t\t}\n\n\t\tsigningMgr := c.clientContext.SigningManager()\n\t\tif signingMgr == nil {\n\t\t\treturn errors.New(\"signing manager is nil\")\n\t\t}\n\n\t\tsignature, err = signingMgr.Sign(payloadBytes, c.clientContext.PrivateKey())\n\t\tif err != nil {\n\t\t\treturn errors.WithMessage(err, \"signing payload failed\")\n\t\t}\n\t}\n\n\t// Send request\n\t_, err := request.Orderer.SendBroadcast(&fab.SignedEnvelope{\n\t\tSignature: signature,\n\t\tPayload: payloadBytes,\n\t})\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"failed broadcast to orderer\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9ad2f0c932760bd3e0f27e0016d29d38", "score": "0.4833967", "text": "func (o *CreateanewPeeringRuleParams) SetBody(body *models.CreateanewPeeringRuleRequest) {\n\to.Body = body\n}", "title": "" }, { "docid": "da0e9e78454d1f64da964b0e18e734db", "score": "0.48309353", "text": "func (r *CreateEmailMessageRequest) Body(body string) *CreateEmailMessageRequest {\n\tr.request.Add(\"body\", body)\n\treturn r\n}", "title": "" }, { "docid": "cfd4c69dd0597ef6c36765904af1a2fc", "score": "0.48180717", "text": "func (setups OrgSetupArray) CreateChannel(w http.ResponseWriter, r *http.Request) {\n\tif err := r.ParseForm(); err != nil {\n\t\tfmt.Fprintf(w, \"ParseForm() err: %v\", err)\n\t\treturn\n\t}\n\torgName := r.FormValue(\"orgname\")\n\tchannelID := r.FormValue(\"channelid\")\n\tchannelConfigPath := r.FormValue(\"configpath\")\n\tcurrentSetup := sdkconnector.LoadSetup(orgName, setups)\n\tif currentSetup == nil {\n\t\thttp.Error(w, \"Organization '\"+orgName+\"' does not exist!\", 500)\n\t}\n\terr := sdkconnector.CreateChannel(currentSetup, channelID, channelConfigPath)\n\tif err != nil {\n\t\tfmt.Fprintf(w, err.Error())\n\t\treturn\n\t}\n\tfmt.Fprintf(w, \"Successfully created channel '%s'\", channelID)\n}", "title": "" }, { "docid": "9840e3a7b0b7cc9e5098d751bf2af89a", "score": "0.4814224", "text": "func (o *AddEventLoopGroupParams) WithBody(body *vproxy_client_model.EventLoopGroupCreate) *AddEventLoopGroupParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "ae71a28dcc6494525e2b558c9cf8b69d", "score": "0.48105457", "text": "func (o *CreateCurrentUserRepoParams) WithBody(body *models.CreateRepoOption) *CreateCurrentUserRepoParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "21fba3640a0faf368bb1a6e13ae27032", "score": "0.4807383", "text": "func (c *Resource) CreateChannel(request fab.CreateChannelRequest) (fab.TransactionID, error) {\n\thaveEnvelope := false\n\tif request.Envelope != nil {\n\t\tlogger.Debug(\"createChannel - have envelope\")\n\t\thaveEnvelope = true\n\t}\n\n\tif !haveEnvelope && request.TxnID.ID == \"\" {\n\t\ttxnID, err := txn.NewID(c.clientContext)\n\t\tif err != nil {\n\t\t\treturn txnID, err\n\t\t}\n\t\trequest.TxnID = txnID\n\t}\n\n\treturn request.TxnID, c.createOrUpdateChannel(request, haveEnvelope)\n}", "title": "" }, { "docid": "9a3bb041df0347095d02d80938e014fc", "score": "0.4785156", "text": "func (o *CreateUserDistributionReceiverParams) WithBody(body *platformclientmodels.DistributionReceiverCreate) *CreateUserDistributionReceiverParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "5f6e79c513ccb4ec8107316fa2b8e169", "score": "0.4776522", "text": "func (o *IssueCreateIssueParams) SetBody(body *models.CreateIssueOption) {\n\to.Body = body\n}", "title": "" }, { "docid": "93f6595951784cac7da0170396aed935", "score": "0.47509667", "text": "func (g guildQueryBuilder) CreateChannel(name string, params *CreateGuildChannelParams) (*Channel, error) {\n\tif name == \"\" && (params == nil || params.Name == \"\") {\n\t\treturn nil, errors.New(\"channel name is required\")\n\t}\n\tif l := len(name); !(2 <= l && l <= 100) {\n\t\treturn nil, errors.New(\"channel name must be 2 or more characters and no more than 100 characters\")\n\t}\n\n\tif params == nil {\n\t\tparams = &CreateGuildChannelParams{}\n\t}\n\tif name != \"\" && params.Name == \"\" {\n\t\tparams.Name = name\n\t}\n\n\tr := g.client.newRESTRequest(&httd.Request{\n\t\tMethod: http.MethodPost,\n\t\tCtx: g.ctx,\n\t\tEndpoint: endpoint.GuildChannels(g.gid),\n\t\tBody: params,\n\t\tContentType: httd.ContentTypeJSON,\n\t\tReason: params.Reason,\n\t}, g.flags)\n\tr.factory = func() interface{} {\n\t\treturn &Channel{}\n\t}\n\n\treturn getChannel(r.Execute)\n}", "title": "" }, { "docid": "b36bd2e6c2b8e9adab8eb8a758042ca0", "score": "0.47296095", "text": "func NewCreateChannelHandlerParamsWithTimeout(timeout time.Duration) *CreateChannelHandlerParams {\n\tvar ()\n\treturn &CreateChannelHandlerParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "b7570db530a69583153ab8b52eb6d5fb", "score": "0.47150636", "text": "func (bfc *BinaryFileCreate) SetBody(b []byte) *BinaryFileCreate {\n\tbfc.mutation.SetBody(b)\n\treturn bfc\n}", "title": "" }, { "docid": "b13cf700955793e0110258d09ae90be8", "score": "0.46868733", "text": "func (o *CreateUserParams) SetBody(body *model.User) {\n\to.Body = body\n}", "title": "" }, { "docid": "efd833ba645350b726d968a45028fb6a", "score": "0.46783656", "text": "func PublishBody(body []byte) PublishOption {\n\treturn func(pub *amqp.Publishing) {\n\t\tpub.Body = body\n\t}\n}", "title": "" }, { "docid": "29979f9afc6455686a4eec124c291c0b", "score": "0.46770236", "text": "func (o *PublicCloudEventdrivenharvestConsumerProducersAddByOrganizationidPostParams) SetBody(body *models.AddProducerRequest) {\n\to.Body = body\n}", "title": "" }, { "docid": "0d5f7dfa95d2bdc0d14e00692e6dbbbc", "score": "0.46557826", "text": "func generateChannel(channelType string, guildID primitive.ObjectID) interface{} {\n\tvar channelVals channel\n\n\tif channelType == \"post\" {\n\t\tchannelVals.Name = \"主频道\"\n\t\tchannelVals.Type = \"post\"\n\t\tchannelVals.GuildID = guildID\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tchannelCollection := ConnectDB(\"channel\")\n\n\tchannelRes, err := channelCollection.InsertOne(ctx, channelVals)\n\thandleError(err)\n\n\treturn channelRes.InsertedID\n}", "title": "" }, { "docid": "43dc255d7a29b0fee0355ec0ac437df8", "score": "0.46481535", "text": "func (d *dispatcherChans) ChannelCreate() <-chan *ChannelCreate {\n\treturn d.channelCreateChan\n}", "title": "" }, { "docid": "bb27bfdc9b099e11b01e5c4bc5fc3521", "score": "0.4635582", "text": "func (o *SignerSignHostKeyParams) SetBody(body *models.V1alpha1SignHostKeyRequest) {\n\to.Body = body\n}", "title": "" }, { "docid": "0c5e12b5258f8b88c7a6a5485159856a", "score": "0.46318874", "text": "func AddChannel(c *gin.Context) {\n\tc.HTML(http.StatusOK, \"channel.html\", gin.H{\n\t\t\"title\": \"new channel\",\n\t})\n}", "title": "" }, { "docid": "4e86bf79dd34221b60f3f6b55b49b4b7", "score": "0.46136165", "text": "func (q *QueueDetails) Create(channel *amqp.Channel) error {\n\t_, err := channel.QueueDeclare(\n\t\tq.Name,\n\t\tq.Durable,\n\t\tq.AutoDelete,\n\t\tq.Exclusive,\n\t\tq.NoWait,\n\t\tq.Args,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, b := range q.Bindings {\n\t\terr := channel.QueueBind(\n\t\t\tb.Name,\n\t\t\tb.Key,\n\t\t\tb.Exchange,\n\t\t\tb.NoWait,\n\t\t\tb.Args,\n\t\t)\n\t\tif err != nil {\n\t\t\tchannel.QueueDelete(\n\t\t\t\tq.Name,\n\t\t\t\tfalse,\n\t\t\t\tfalse,\n\t\t\t\ttrue,\n\t\t\t)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "33bfa85c1ba50429fb35c920957f1c2f", "score": "0.46108812", "text": "func (bucket Bucket) CreateLiveChannel(channelName string, config LiveChannelConfiguration) (CreateLiveChannelResult, error) {\n\tvar out CreateLiveChannelResult\n\n\tbs, err := xml.Marshal(config)\n\tif err != nil {\n\t\treturn out, err\n\t}\n\n\tbuffer := new(bytes.Buffer)\n\tbuffer.Write(bs)\n\n\tparams := map[string]interface{}{}\n\tparams[\"live\"] = nil\n\tresp, err := bucket.do(\"PUT\", channelName, params, nil, buffer, nil)\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tdefer resp.Body.Close()\n\n\terr = xmlUnmarshal(resp.Body, &out)\n\treturn out, err\n}", "title": "" }, { "docid": "19dba0f0b433c1f729be1a46e9d19a9b", "score": "0.45963326", "text": "func addChannel(client *Client, data interface{}) {\n\tvar channel Channel\n\terr := mapstructure.Decode(data, &channel)\n\tif err != nil {\n\t\tclient.send <- Message{\"error\", err.Error()}\n\t\treturn\n\t}\n\tgo func() {\n\t\terr = r.Table(\"channel\").\n\t\t\tInsert(channel).\n\t\t\tExec(client.session)\n\t\tif err != nil {\n\t\t\tclient.send <- Message{\"error\", err.Error()}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "22945f4c78995353b4ee0234a94c6f58", "score": "0.457406", "text": "func (o *PostChannelsChannelIDCurrencyAssignmentsParams) SetBody(body PostChannelsChannelIDCurrencyAssignmentsBody) {\n\to.Body = body\n}", "title": "" }, { "docid": "b6bad99dbfba0e83d71ea71e42a72008", "score": "0.4567985", "text": "func (o *IssueCreateIssueParams) WithBody(body *models.CreateIssueOption) *IssueCreateIssueParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "e2d3488b91488a4803451130c0f1e362", "score": "0.45548669", "text": "func (s *SmartContract) CreateChannel(ctx contractapi.TransactionContextInterface, channelID string, channelType string, mspIDs []string) error {\n\n\texists, err := s.ChannelExists(ctx, channelID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif exists {\n\t\treturn fmt.Errorf(\"the channel %s already exists\", channelID)\n\t}\n\n\tif channelType == \"\" {\n\t\tchannelType = ApplicationChannelType\n\t}\n\tif channelType != SystemChannelType && channelType != OpsChannelType && channelType != ApplicationChannelType {\n\t\treturn fmt.Errorf(\"invalid channel type - expecting %s, %s or %s\", SystemChannelType, OpsChannelType, ApplicationChannelType)\n\t}\n\n\tchannel := &Channel{\n\t\tObjectType: ChannelObjectType,\n\t\tID: channelID,\n\t\tChannelType: channelType,\n\t}\n\n\tif mspIDs != nil {\n\t\tchannel.Organizations = make(map[string]string)\n\n\t\tfor _, mspID := range mspIDs {\n\t\t\tchannel.Organizations[mspID] = \"\"\n\t\t}\n\t}\n\treturn s.putChannel(ctx, channel)\n}", "title": "" }, { "docid": "ea80abdcf2c0fa1fefde508755254ed9", "score": "0.45500833", "text": "func addChannelMessage(client *Client, data interface{}) {\n\tvar channelMessage ChannelMessage\n\terr := mapstructure.Decode(data, &channelMessage)\n\tif err != nil {\n\t\tclient.send <- Message{\"error\", err.Error()}\n\t}\n\tgo func() {\n\t\tchannelMessage.CreatedAt = time.Now()\n\t\tchannelMessage.Author = client.userName\n\t\terr = r.Table(\"messages\").\n\t\t\tInsert(channelMessage).\n\t\t\tExec(client.session)\n\t\tif err != nil {\n\t\t\tclient.send <- Message{\"error\", err.Error()}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "d9a88a958d577046af3a6718eaacd65d", "score": "0.45264423", "text": "func (o *NewCallParams) SetBody(body *models.NewCallRequest) {\n\to.Body = body\n}", "title": "" }, { "docid": "ad911e4edc8705e59ed263bfad2f87f6", "score": "0.45253018", "text": "func NewPostChannelCreateOK() *PostChannelCreateOK {\n\treturn &PostChannelCreateOK{}\n}", "title": "" }, { "docid": "967ae1f3905075a540985b196b80091b", "score": "0.45252752", "text": "func (o *CreateInputPortParams) WithBody(body *models.PortEntity) *CreateInputPortParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "3ab39a0884bb62a60a1534a97d3648ef", "score": "0.45094684", "text": "func (o *CreateanewPeeringRuleParams) WithBody(body *models.CreateanewPeeringRuleRequest) *CreateanewPeeringRuleParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "a7ef485154ea49ef08c9a93909a948ef", "score": "0.4502269", "text": "func (a MsgVpnApi) CreateMsgVpnBridge(msgVpnName string, body MsgVpnBridge, select_ []string) (*MsgVpnBridgeResponse, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Post\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/msgVpns/{msgVpnName}/bridges\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"msgVpnName\"+\"}\", fmt.Sprintf(\"%v\", msgVpnName), -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 '(basicAuth)' required\n\t// http basic authentication required\n\tif a.Configuration.Username != \"\" || a.Configuration.Password != \"\"{\n\t\tlocalVarHeaderParams[\"Authorization\"] = \"Basic \" + a.Configuration.GetBasicAuthEncodedString()\n\t}\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\tvar select_CollectionFormat = \"csv\"\n\tlocalVarQueryParams.Add(\"select\", a.Configuration.APIClient.ParameterToString(select_, select_CollectionFormat))\n\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 = &body\n\tvar successPayload = new(MsgVpnBridgeResponse)\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: \"CreateMsgVpnBridge\", 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": "14e1db5e014924a2ba80f73a71712861", "score": "0.44929603", "text": "func (client *EventChannelsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, eventChannelInfo EventChannel, options *EventChannelsClientCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}\"\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 partnerNamespaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter partnerNamespaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{partnerNamespaceName}\", url.PathEscape(partnerNamespaceName))\n\tif eventChannelName == \"\" {\n\t\treturn nil, errors.New(\"parameter eventChannelName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{eventChannelName}\", url.PathEscape(eventChannelName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-10-15-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, eventChannelInfo)\n}", "title": "" }, { "docid": "aa07c4c44ad9629ac66857bcd661c22d", "score": "0.448814", "text": "func newBody() log {\n\treturn body{}\n}", "title": "" }, { "docid": "e631f35194e564bf92330e4398f9f773", "score": "0.44877276", "text": "func (o *CreateInputPortParams) SetBody(body *models.PortEntity) {\n\to.Body = body\n}", "title": "" }, { "docid": "7c9bda1a3da318e55a0dd0c59c1af17e", "score": "0.44858652", "text": "func Create(msgType string, channel string, header Header, payload string) *Message {\n\treturn &Message{\n\t\tmsgType,\n\t\tchannel,\n\t\theader,\n\t\tpayload,\n\t\tfalse,\n\t}\n}", "title": "" }, { "docid": "bc9df9a929300cb44b195ae96b25c977", "score": "0.44849774", "text": "func (o *ProvisionAWSAccountsParams) SetBody(body *models.ModelsCreateAWSAccountsV1) {\n\to.Body = body\n}", "title": "" }, { "docid": "9424768da10670ba0a4f05957395b42f", "score": "0.44700137", "text": "func NewCreateThingRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/things\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = operationPath[1:]\n\t}\n\toperationURL := url.URL{\n\t\tPath: operationPath,\n\t}\n\n\tqueryURL := serverURL.ResolveReference(&operationURL)\n\n\treq, err := http.NewRequest(\"POST\", queryURL.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "39dd430dc17a8d5c344ed90880650a1f", "score": "0.44664836", "text": "func NewCreateRequestBody(p *group.CreatePayload) *CreateRequestBody {\n\tbody := &CreateRequestBody{\n\t\tName: p.Name,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "295444a4e8ebda10a74e863aaee8ab92", "score": "0.44601113", "text": "func ChannelHandle(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method Not Allowed\", 405)\n\t\treturn\n\t}\n\n\tparams := r.URL.Query()\n\tkey := params.Get(\"key\")\n\ttoken := params.Get(\"token\")\n\tif key == \"\" || token == \"\" {\n\t\tif err := retWrite(w, \"param error\", retParamErr); err != nil {\n\t\t\tLog.Printf(\"retWrite failed (%s)\", err.Error())\n\t\t}\n\n\t\treturn\n\t}\n\n\tLog.Printf(\"device %s: add channel, token = %s\", key, token)\n\tc, err := channel.New(key)\n\tif err != nil {\n\t\tLog.Printf(\"device %s: can't create channle\", key)\n\t\tif err = retWrite(w, \"create channel failed\", retCreateChannel); err != nil {\n\t\t\tLog.Printf(\"retWrite failed (%s)\", err.Error())\n\t\t}\n\n\t\treturn\n\t}\n\n\tif err = c.AddToken(token, key); err != nil {\n\t\tLog.Printf(\"device %s: can't add token %s\", key, token)\n\t\tif err = retWrite(w, \"add token failed\", retAddToken); err != nil {\n\t\t\tLog.Printf(\"retWrite failed (%s)\", err.Error())\n\t\t\treturn\n\t\t}\n\t}\n\n\tif err = retWrite(w, \"ok\", retOK); err != nil {\n\t\tLog.Printf(\"retWrite() failed (%s)\", err.Error())\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "f353d58c511a9c59096863c1fae6c4c3", "score": "0.44488642", "text": "func WriteBody(db xordb.Writer, hash common.Hash, number uint64, body *types.Body) {\n\tdata, err := json.Marshal(body)\n\tif err != nil {\n\t\tfmt.Println(\"error while encoding\", err)\n\t}\n\tWriteBodyData(db, hash, number, data)\n}", "title": "" }, { "docid": "14ede7a195fe3a607fed84f8495bb35f", "score": "0.44464728", "text": "func (o *ListChannelListingsParams) SetBody(body ListChannelListingsBody) {\n\to.Body = body\n}", "title": "" }, { "docid": "9970fa96f66c20e0083089af032815a2", "score": "0.44435498", "text": "func (o *CreatePolicyVersion1Params) SetBody(body *legalclientmodels.CreatePolicyVersionRequest) {\n\to.Body = body\n}", "title": "" }, { "docid": "35e5b71fa59b6179d63f6589fc9cc707", "score": "0.44383234", "text": "func (*ChannelsCreateChannelRequest) TypeName() string {\n\treturn \"channels.createChannel\"\n}", "title": "" }, { "docid": "8b4954267c66bd640ce6779073426230", "score": "0.44362408", "text": "func (r CreateChannelRequest) Send(ctx context.Context) (*CreateChannelResponse, 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 := &CreateChannelResponse{\n\t\tCreateChannelOutput: r.Request.Data.(*CreateChannelOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "c400c21394ab0c6ff1b2a4f7862a00a4", "score": "0.44280946", "text": "func (o *PatchComponentHubSettingsParams) SetBody(body *service_model.V1ComponentHubSettings) {\n\to.Body = body\n}", "title": "" }, { "docid": "f75bd9ac07df691641b9c3ef81fc82ff", "score": "0.44241375", "text": "func (o *UpdateOidcConfigParams) SetBody(body *models.OIDCConfig) {\n\to.Body = body\n}", "title": "" }, { "docid": "3ef10a09afc2350338cfd326c8405786", "score": "0.44111267", "text": "func (a *PublishSubscribeApiService) CreateChannelExecute(r ApiCreateChannelRequest) (SingleChannel, *_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 SingleChannel\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.Ctx, \"PublishSubscribeApiService.CreateChannel\")\n\tif localBasePath == \"/\" {\n\t localBasePath = \"\"\n\t}\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/v2/channels\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.P_channelProposal == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"channelProposal is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = r.P_channelProposal\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\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": "312895b163286f2d2e773b9036099ae5", "score": "0.4407767", "text": "func (a MsgVpnApi) CreateMsgVpnJndiConnectionFactory(msgVpnName string, body MsgVpnJndiConnectionFactory, select_ []string) (*MsgVpnJndiConnectionFactoryResponse, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Post\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/msgVpns/{msgVpnName}/jndiConnectionFactories\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"msgVpnName\"+\"}\", fmt.Sprintf(\"%v\", msgVpnName), -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 '(basicAuth)' required\n\t// http basic authentication required\n\tif a.Configuration.Username != \"\" || a.Configuration.Password != \"\"{\n\t\tlocalVarHeaderParams[\"Authorization\"] = \"Basic \" + a.Configuration.GetBasicAuthEncodedString()\n\t}\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\tvar select_CollectionFormat = \"csv\"\n\tlocalVarQueryParams.Add(\"select\", a.Configuration.APIClient.ParameterToString(select_, select_CollectionFormat))\n\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 = &body\n\tvar successPayload = new(MsgVpnJndiConnectionFactoryResponse)\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: \"CreateMsgVpnJndiConnectionFactory\", 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": "6fb15115b34e6d60780092d5085af8d4", "score": "0.4403939", "text": "func (a *Client) PostRemoteAPISocialChannelCreate(params *PostRemoteAPISocialChannelCreateParams) (*PostRemoteAPISocialChannelCreateOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostRemoteAPISocialChannelCreateParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostRemoteAPISocialChannelCreate\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/remote.api/SocialChannel.create\",\n\t\tProducesMediaTypes: []string{\"\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &PostRemoteAPISocialChannelCreateReader{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.(*PostRemoteAPISocialChannelCreateOK), nil\n\n}", "title": "" }, { "docid": "412c1b528c7df9b2f3e95577898eea7e", "score": "0.43992496", "text": "func (client *Client) PostNew(authorname, title, body string, opt *PCOptionsNew) (*OperResp, error) {\n\tpermlink := \"\"\n\tptag := \"\"\n\ttag := []string{}\n\n\tif opt != nil && opt.Permlink != \"\" {\n\t\tpermlink = translit.EncodeTitle(opt.Permlink)\n\t} else {\n\t\tpermlink = translit.EncodeTitle(title)\n\t}\n\n\tif opt != nil && opt.Tags != nil {\n\t\ttag = translit.EncodeTags(opt.Tags)\n\t}\n\n\tif opt != nil && opt.Ptag != \"\" {\n\t\tptag = translit.EncodeTag(opt.Ptag)\n\t} else {\n\t\tptag = translit.EncodeTag(opt.Tags[0])\n\t}\n\n\tjsonMeta := &types.ContentMetadata{\n\t\t\"tags\": tag,\n\t\t\"image\": []string{opt.PostImage},\n\t\t\"lib\": \"golos-go\",\n\t}\n\n\tvar trx []types.Operation\n\ttxp := &types.CommentOperation{\n\t\tParentAuthor: \"\",\n\t\tParentPermlink: ptag,\n\t\tAuthor: authorname,\n\t\tPermlink: permlink,\n\t\tTitle: title,\n\t\tBody: body,\n\t\tJSONMetadata: jsonMeta,\n\t}\n\ttrx = append(trx, txp)\n\n\tif opt.CommentOption != nil {\n\t\ttrx = append(trx, GetCommentOptionsOperationNew(authorname, permlink, *opt.CommentOption))\n\t}\n\n\tresp, err := client.SendTrx(authorname, trx)\n\treturn &OperResp{NameOper: \"Post\", PermLink: permlink, Bresp: resp}, err\n}", "title": "" }, { "docid": "d38c4a04995343294dabc47e666ac15b", "score": "0.43986163", "text": "func (cr ChangelogRequest) deleteBody() error {\n\tclient, err := GetInstallationClient(cr.User, cr.Repo)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Installation client\")\n\t}\n\n\trel, _, err := client.Repositories.GetReleaseByTag(Ctx, cr.User, cr.Repo, cr.Tag)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Getting release\")\n\t}\n\n\tif b := rel.GetBody(); b != \"\" && b != WIPMessage {\n\t\treturn ErrCustomBody\n\t}\n\n\trel.Body = github.String(\"\")\n\t_, _, err = client.Repositories.EditRelease(Ctx, cr.User, cr.Repo, rel.GetID(), rel)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Edit release\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "38311001270169a1627743f4499a8fa1", "score": "0.43912876", "text": "func (o *CreateTestResultAttachmentParams) SetBody(body *models.TestAttachmentRequestModel) {\n\to.Body = body\n}", "title": "" }, { "docid": "1d1648d71e0fad15e1fd793008fda50a", "score": "0.43881574", "text": "func newChannel(c *Client, id, name string) *channel {\n\tch := &channel{ID: id, ChannelName: name}\n\tinitChannel(c, ch)\n\treturn ch\n}", "title": "" }, { "docid": "77104b69a6962fbb09e9e5f5715493b7", "score": "0.43855393", "text": "func (c *client) Post(text, channel string) error {\n\tuv := url.Values{}\n\tuv.Add(\"username\", c.userName)\n\tuv.Add(\"token\", c.tokenStr)\n\tif nil != c.iconEmoji {\n\t\tuv.Add(\"icon_emoji\", *c.iconEmoji)\n\t}\n\tuv.Add(\"channel\", channel)\n\tuv.Add(\"text\", text)\n\n\treturn c.postMessage(uv)\n}", "title": "" }, { "docid": "8a191fc13d0f477ad05a1b8d3cc5d011", "score": "0.43799332", "text": "func (s *Server) CreateChannel(ctx context.Context, req *pb.CreateChannelRequest) (*pb.ChannelInfo, error) {\n\ttx, err := req.GetTx().ToCore()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !tx.Verify() {\n\t\treturn nil, errors.New(\"The tx is not a valid tx\")\n\t}\n\tif tx.GetReceiver().String() != core.CreateChannelContractAddress.String() {\n\t\treturn nil, errors.New(\"The receiver of the tx is not the valid contract address\")\n\t}\n\t_, err = s.cc.CreateChannel(tx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pb.ChannelInfo{}, nil\n}", "title": "" }, { "docid": "5cee0d655b075e01ffc143fe30ca81b4", "score": "0.43789634", "text": "func newEncodedBody(body interface{}) (io.Reader, error) {\n\tbuf := &bytes.Buffer{}\n\tenc := json.NewEncoder(buf)\n\tenc.SetEscapeHTML(false)\n\terr := enc.Encode(body)\n\treturn buf, err\n}", "title": "" }, { "docid": "19f9f5fc9c89902247b98e0e321ba33a", "score": "0.43704557", "text": "func (o *ChangeOrderParams) SetBody(body models.ChangeOrderRequestDefinition) {\n\to.Body = body\n}", "title": "" }, { "docid": "b60be7fe67d3ddef3233e345388dc0aa", "score": "0.43631", "text": "func (o *CreateSeasonParams) SetBody(body *seasonpassclientmodels.SeasonCreate) {\n\to.Body = body\n}", "title": "" }, { "docid": "acec8fecff8b63c8b7f72aca81aab328", "score": "0.43627638", "text": "func (o *ValidateCreateApplicationsWebParams) SetBody(body *dynatrace.WebApplicationConfig) {\n\to.Body = body\n}", "title": "" }, { "docid": "6c9067043b02ed5cf9c38f79553bdc4e", "score": "0.4360515", "text": "func (s *Session) GuildChannelCreate(guildID int64, name string, ctype ChannelType, options ...RequestOption) (st *Channel, err error) {\n\n\tdata := struct {\n\t\tName string `json:\"name\"`\n\t\tType ChannelType `json:\"type\"`\n\t}{name, ctype}\n\n\tbody, err := s.RequestWithBucketID(\"POST\", EndpointGuildChannels(guildID), data, nil, EndpointGuildChannels(guildID), options...)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = unmarshal(body, &st)\n\treturn\n}", "title": "" }, { "docid": "7f1246a0fe0f59746cfe70bb102ee750", "score": "0.43531406", "text": "func (h *humioClient) encodeBody(body interface{}) (io.Reader, error) {\n\tb, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif h.cfg.DisableCompression {\n\t\treturn bytes.NewReader(b), nil\n\t}\n\treturn h.compressBody(b)\n}", "title": "" }, { "docid": "c69da972d887e60c4c2676069a382200", "score": "0.4351104", "text": "func (o *PatchCatalogsByIDCategoriesByIDCategoryLinksByIDByIDByIDParams) SetBody(body *models.CategoryLink) {\n\to.Body = body\n}", "title": "" }, { "docid": "3fa1fb88ee7cd3a7616b43ea5f5cef92", "score": "0.43492416", "text": "func (o *SubmitAppVersionParams) SetBody(body *models.OpenpitrixSubmitAppVersionRequest) {\n\to.Body = body\n}", "title": "" }, { "docid": "aba862a5d5ff18e03a8f288d277e92f6", "score": "0.43484366", "text": "func main() {\n\n\t// Create a ModalViewRequest with a header and two inputs\n\ttitleText := slack.NewTextBlockObject(slack.PlainTextType, \"Create channel demo\", false, false)\n\tcloseText := slack.NewTextBlockObject(slack.PlainTextType, \"Close\", false, false)\n\tsubmitText := slack.NewTextBlockObject(slack.PlainTextType, \"Submit\", false, false)\n\n\tcontextText := slack.NewTextBlockObject(slack.MarkdownType, \"This app demonstrates the use of different fields\", false, false)\n\tcontextBlock := slack.NewContextBlock(\"context\", contextText)\n\n\t// Only the inputs in input blocks will be included in view_submission’s view.state.values: https://slack.dev/java-slack-sdk/guides/modals\n\t// This means the inputs will not be interactive either because they do not trigger block_actions messages: https://api.slack.com/surfaces/modals/using#interactions\n\tchannelNameText := slack.NewTextBlockObject(slack.PlainTextType, \"Channel Name\", false, false)\n\tchannelNameHint := slack.NewTextBlockObject(slack.PlainTextType, \"Channel names may only contain lowercase letters, numbers, hyphens, and underscores, and must be 80 characters or less\", false, false)\n\tchannelPlaceholder := slack.NewTextBlockObject(slack.PlainTextType, \"New channel name\", false, false)\n\tchannelNameElement := slack.NewPlainTextInputBlockElement(channelPlaceholder, \"channel_name\")\n\t// Slack channel names can be maximum 80 characters: https://api.slack.com/methods/conversations.create\n\tchannelNameElement.MaxLength = 80\n\tchannelNameBlock := slack.NewInputBlock(\"channel_name\", channelNameText, channelNameHint, channelNameElement)\n\n\t// Provide a static list of users to choose from, those provided now are just made up user IDs\n\t// Get user IDs by right clicking on them in Slack, select \"Copy link\", and inspect the last part of the link\n\t// The user ID should start with \"U\" followed by 8 random characters\n\tmemberOptions := createOptionBlockObjects([]string{\"U9911MMAA\", \"U2233KKNN\", \"U00112233\"}, true)\n\tinviteeText := slack.NewTextBlockObject(slack.PlainTextType, \"Invitee from static list\", false, false)\n\tinviteeOption := slack.NewOptionsSelectBlockElement(slack.OptTypeStatic, nil, \"invitee\", memberOptions...)\n\tinviteeBlock := slack.NewInputBlock(\"invitee\", inviteeText, nil, inviteeOption)\n\n\t// Section with users select - this input will not be included in the view_submission's view.state.values,\n\t// but instead be sent as a \"block_actions\" request\n\tadditionalInviteeText := slack.NewTextBlockObject(slack.PlainTextType, \"Invitee from complete list of users\", false, false)\n\tadditionalInviteeHintText := slack.NewTextBlockObject(slack.PlainTextType, \"\", false, false)\n\tadditionalInviteeOption := slack.NewOptionsSelectBlockElement(slack.OptTypeUser, additionalInviteeText, \"user\")\n\tadditionalInviteeSection := slack.NewSectionBlock(additionalInviteeText, nil, slack.NewAccessory(additionalInviteeOption))\n\n\t// Input with users select - this input will be included in the view_submission's view.state.values\n\t// It can be fetched as for example \"payload.View.State.Values[\"user\"][\"user\"].SelectedUser\"\n\tadditionalInviteeBlock := slack.NewInputBlock(\"user\", additionalInviteeText, additionalInviteeHintText, additionalInviteeOption)\n\n\tcheckboxTxt := slack.NewTextBlockObject(slack.PlainTextType, \"Checkbox\", false, false)\n\tcheckboxOptions := createOptionBlockObjects([]string{\"option 1\", \"option 2\", \"option 3\"}, false)\n\tcheckboxOptionsBlock := slack.NewCheckboxGroupsBlockElement(\"chkbox\", checkboxOptions...)\n\tcheckboxBlock := slack.NewInputBlock(\"chkbox\", checkboxTxt, nil, checkboxOptionsBlock)\n\n\tsummaryText := slack.NewTextBlockObject(slack.PlainTextType, \"Summary\", false, false)\n\tsummaryHint := slack.NewTextBlockObject(slack.PlainTextType, \"Summary Hint\", false, false)\n\tsummaryPlaceholder := slack.NewTextBlockObject(slack.PlainTextType, \"Summary of reason for creating channel\", false, false)\n\tsummaryElement := slack.NewPlainTextInputBlockElement(summaryPlaceholder, \"summary\")\n\t// Just set an arbitrary max length to avoid too prose summary\n\tsummaryElement.MaxLength = 200\n\tsummaryElement.Multiline = true\n\tsummaryBlock := slack.NewInputBlock(\"summary\", summaryText, summaryHint, summaryElement)\n\n\tblocks := slack.Blocks{\n\t\tBlockSet: []slack.Block{\n\t\t\tcontextBlock,\n\t\t\tchannelNameBlock,\n\t\t\tinviteeBlock,\n\t\t\tadditionalInviteeSection,\n\t\t\tadditionalInviteeBlock,\n\t\t\tcheckboxBlock,\n\t\t\tsummaryBlock,\n\t\t},\n\t}\n\n\tvar modalRequest slack.ModalViewRequest\n\tmodalRequest.Type = slack.ViewType(\"modal\")\n\tmodalRequest.Title = titleText\n\tmodalRequest.Close = closeText\n\tmodalRequest.Submit = submitText\n\tmodalRequest.Blocks = blocks\n\tmodalRequest.CallbackID = \"create_channel\"\n\n\tapi := slack.New(\"YOUR_BOT_TOKEN_HERE\")\n\n\t// Using a trigger ID you can open a modal\n\t// The trigger ID is provided through certain events and interactions\n\t// More information can be found here: https://api.slack.com/interactivity/handling#modal_responses\n\t_, err := api.OpenView(\"YOUR_TRIGGERID_HERE\", modalRequest)\n\tif err != nil {\n\t\tfmt.Printf(\"Error opening view: %s\", err)\n\t}\n}", "title": "" }, { "docid": "9c17b0be432c0712ca6c3eb4f6ce9618", "score": "0.4343407", "text": "func (a *Alerts) CreateChannel(channel Channel) (*Channel, error) {\n\treturn a.CreateChannelWithContext(context.Background(), channel)\n}", "title": "" }, { "docid": "34aedf1b0053f4728a51401167174e36", "score": "0.4342993", "text": "func (c *Client) CreateWebhook(\n\tchannelID discord.Snowflake,\n\tname string, avatar discord.Hash) (*discord.Webhook, error) {\n\n\tvar param struct {\n\t\tName string `json:\"name\"`\n\t\tAvatar discord.Hash `json:\"avatar\"`\n\t}\n\n\tparam.Name = name\n\tparam.Avatar = avatar\n\n\tvar w *discord.Webhook\n\treturn w, c.RequestJSON(\n\t\t&w, \"POST\",\n\t\tEndpointChannels+channelID.String()+\"/webhooks\",\n\t\thttputil.WithJSONBody(c, param),\n\t)\n}", "title": "" }, { "docid": "e86172d3e6e620713a1b4f2981a83c45", "score": "0.43420437", "text": "func (pr *postRequest) Body(body string) PostRequestBuilder {\n\tpr.body = strings.NewReader(body)\n\treturn pr\n}", "title": "" }, { "docid": "fc6ddb94bef8d0b29d35f82416152801", "score": "0.43410155", "text": "func NewChannelAddedEventMessageDetail()(*ChannelAddedEventMessageDetail) {\n m := &ChannelAddedEventMessageDetail{\n EventMessageDetail: *NewEventMessageDetail(),\n }\n odataTypeValue := \"#microsoft.graph.channelAddedEventMessageDetail\";\n m.SetOdataType(&odataTypeValue);\n return m\n}", "title": "" }, { "docid": "997b566396dccdfa012ef9b8467c1c05", "score": "0.43337172", "text": "func (svc *ChannelService) CreateChannel(request *CreateChannelRequest) (*Channel, error) {\n\tnextid_request := &NextIDRequest{nil, \"channelids\"}\n\tid, err := svc.SG.IDService.NextID(nextid_request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = InsertRow(svc.DB, CHANNELS_TABLE,\n\t\t\"Id\", id,\n\t\t\"TeamId\", request.Channel.Team.Id,\n\t\t\"UserId\", request.Channel.Creator.Id,\n\t\t\"Name\", request.Channel.Name,\n\t\t\"Public\", request.Channel.Public,\n\t\t\"Status\", request.Channel.Status)\n\tif err == nil {\n\t\trequest.Channel.Id = id\n\t}\n\treturn request.Channel, err\n}", "title": "" }, { "docid": "6aea53da369a245f88aeb1d6e846b59a", "score": "0.43332675", "text": "func (o *CreateOrUpdateServiceParams) SetBody(body *models.Service) {\n\to.Body = body\n}", "title": "" }, { "docid": "a499fb747f776a38bf561ac341a2d772", "score": "0.43241176", "text": "func (o *CreateTestResultAttachmentParams) WithBody(body *models.TestAttachmentRequestModel) *CreateTestResultAttachmentParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "8de017e839b46e985219c80153141113", "score": "0.43228754", "text": "func (o *PostCustomDomainsParams) SetBody(body *models.PostCustomDomainsBody) {\n\to.Body = body\n}", "title": "" } ]
c18a39520812f95895db702a80a28e8f
AsClusterUpgradeCompleteEvent is the BasicFabricEvent implementation for ApplicationUpgradeRollbackCompleteEvent.
[ { "docid": "1d8e2d0f86f6f47b3a8fd2411e924f53", "score": "0.8431988", "text": "func (aurce ApplicationUpgradeRollbackCompleteEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" } ]
[ { "docid": "8b0bbf6dbac3863430c6fb5216de48ae", "score": "0.8508207", "text": "func (ae ApplicationEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ae28ee08c66f90b7ae2331e8c969fd47", "score": "0.84744483", "text": "func (fe FabricEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0a646a7eb5adf9ce0b253ae846d11d0d", "score": "0.8426534", "text": "func (aurse ApplicationUpgradeRollbackStartEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "08400a6260fb5037a1b063d407d1095c", "score": "0.84042287", "text": "func (ae ApplicationEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "af53a69e331a22f337a3c233af931014", "score": "0.835005", "text": "func (auce ApplicationUpgradeCompleteEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6998e25a4661590373f3c355fa76b1cf", "score": "0.83294034", "text": "func (ause ApplicationUpgradeStartEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "180258a1260ad9b4f8e1061181452772", "score": "0.8323122", "text": "func (auce ApplicationUpgradeCompleteEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "bdbede4201bdb0fc93a26cddba5f9d35", "score": "0.8318617", "text": "func (ce ClusterEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a0bfb72c0997a52a83e5ce315dd78f14", "score": "0.8297372", "text": "func (ause ApplicationUpgradeStartEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "75b1fa349d4169f316280b6ef76766e8", "score": "0.8285115", "text": "func (ace ApplicationCreatedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "02d7c3f4919f4cadb320314a13802ca9", "score": "0.8275435", "text": "func (fe FabricEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5f47d983894e828842f6c62fe159e77f", "score": "0.82730854", "text": "func (ace ApplicationCreatedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "bf97065198075474340dd20762e04890", "score": "0.82662654", "text": "func (ahrce ApplicationHealthReportCreatedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3265f49a1af87e90b725e2aeb7352752", "score": "0.8262862", "text": "func (ce ClusterEvent) AsApplicationUpgradeCompleteEvent() (*ApplicationUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "75f583e95302c9c714730df59020e5e4", "score": "0.82299525", "text": "func (cse ChaosStartedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b052f526e9b0c03930d77ac8d8661233", "score": "0.8227766", "text": "func (ce ClusterEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8bce9cc49499258975d2a63cfb74288c", "score": "0.8223105", "text": "func (audce ApplicationUpgradeDomainCompleteEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1d068eab7fb92205f185f18f40744bc3", "score": "0.82221407", "text": "func (curce ClusterUpgradeRollbackCompleteEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "317840b33af2e3bda47c1d0f29afc141", "score": "0.82195705", "text": "func (cse ChaosStoppedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "33af6c71e2d6e3a3e3564d21b5de6f79", "score": "0.82121134", "text": "func (ce ClusterEvent) AsApplicationUpgradeRollbackCompleteEvent() (*ApplicationUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "892beccd4bfff9b313a5dd4d938ce4e3", "score": "0.81991947", "text": "func (crcpfce ChaosRestartCodePackageFaultCompletedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6072ec0620215536dd56118c9c06d544", "score": "0.81967634", "text": "func (curse ClusterUpgradeRollbackStartEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8ec2987e06675ec01d9845db01259f43", "score": "0.8194586", "text": "func (audce ApplicationUpgradeDomainCompleteEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a3f44cd38f9526f8a978dc03058080b6", "score": "0.8194083", "text": "func (cie ContainerInstanceEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1a58ad88afd1e93ac56ac55abe3610ba", "score": "0.81848687", "text": "func (ahrce ApplicationHealthReportCreatedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "275bbdb7654b65c4a7577d2f6de7a211", "score": "0.8184278", "text": "func (cse ChaosStoppedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1828cd74ae9018026baa3b488404a009", "score": "0.818185", "text": "func (dahrce DeployedApplicationHealthReportCreatedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "95d424e92b2513dc89e8d225b8e75816", "score": "0.8173908", "text": "func (cse ChaosStartedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8f4ce44aa035bc1d876c6be66bf250a8", "score": "0.81664973", "text": "func (se ServiceEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1e11209e689bb83d2419a4ca3539ff84", "score": "0.81520855", "text": "func (ade ApplicationDeletedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ef9e1b99541d1a5cf5b10db3b37e7711", "score": "0.81478226", "text": "func (cie ContainerInstanceEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e34ca053876db55e16d4cf7c5b4e3f45", "score": "0.8143365", "text": "func (crrfce ChaosRemoveReplicaFaultCompletedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "89e044dd758d950f2d995ecda633fb7e", "score": "0.8137386", "text": "func (dahrce DeployedApplicationHealthReportCreatedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "513f989afedc721dae8a0ae4286b5018", "score": "0.8124125", "text": "func (re ReplicaEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f246a1d4c3017ce67c647947f73d854e", "score": "0.81185484", "text": "func (aurce ApplicationUpgradeRollbackCompleteEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6f6fb058b7e9c0f9aaa94f74f7f5ae78", "score": "0.8105975", "text": "func (ade ApplicationDeletedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5debadac666c2881ce533c652eb2da36", "score": "0.8097751", "text": "func (se ServiceEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "11396c9d40c1ef0342960d9cd5fd1c08", "score": "0.809367", "text": "func (prce PartitionReconfigurationCompletedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9acb24d2c20265a838fff5c3904923b8", "score": "0.80923986", "text": "func (aurse ApplicationUpgradeRollbackStartEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9a805d66bdd6561642fe2cf2770e7fe4", "score": "0.80912936", "text": "func (crrfse ChaosRestartReplicaFaultScheduledEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b48ddafac12fd49a3853cd7c6bfe106c", "score": "0.8084932", "text": "func (crcpfse ChaosRestartCodePackageFaultScheduledEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c8b3bc2ded299575b7760c08981ecef7", "score": "0.8073127", "text": "func (crnfce ChaosRestartNodeFaultCompletedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "332ac974b29220549197ab0d36227042", "score": "0.8072984", "text": "func (ahree ApplicationHealthReportExpiredEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f7301258013b0fbec15219070fb05bad", "score": "0.8067608", "text": "func (cde ContainerDeactivatedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "039bbde9565bedfb044faa4386671441", "score": "0.80669343", "text": "func (crrfse ChaosRemoveReplicaFaultScheduledEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9f69c9d44ceb24dc17b529c59b95048d", "score": "0.8059601", "text": "func (cde ContainerDeactivatedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8a1904cf9a1095760eb29f157fbdb7e0", "score": "0.80532306", "text": "func (ahree ApplicationHealthReportExpiredEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8271f651f93210457a076989bbccc537", "score": "0.8048014", "text": "func (chrce ClusterHealthReportCreatedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b3bd8edcee1a01e86737141d470b26de", "score": "0.80450076", "text": "func (dahree DeployedApplicationHealthReportExpiredEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "101ebd145f1941d0f23b6f9b31c05c18", "score": "0.8043286", "text": "func (shrce ServiceHealthReportCreatedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "dae158f10f678f6b6ff0b8ca5740d5ac", "score": "0.804255", "text": "func (cuce ClusterUpgradeCompleteEvent) AsApplicationUpgradeRollbackCompleteEvent() (*ApplicationUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "67c9095aae643e7c294eb82eb5cad709", "score": "0.8036566", "text": "func (cuce ClusterUpgradeCompleteEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2aabd09e010427fe9e81c93428402a6c", "score": "0.8033984", "text": "func (crcpfce ChaosRestartCodePackageFaultCompletedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c9a53bae540890d7b496a1b63863f14b", "score": "0.8029248", "text": "func (dahree DeployedApplicationHealthReportExpiredEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "45d8a4c5c1bc5e48b8af1e1e681e02e0", "score": "0.8019834", "text": "func (cuse ClusterUpgradeStartEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7e864ec82480368d6cb08716abc4928a", "score": "0.80149484", "text": "func (curce ClusterUpgradeRollbackCompleteEvent) AsApplicationUpgradeCompleteEvent() (*ApplicationUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b65f9e3ee661564b1ec732e09cb1b382", "score": "0.80084", "text": "func (crrfce ChaosRemoveReplicaFaultCompletedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "131903d36899599973972f735327a696", "score": "0.7999471", "text": "func (re ReplicaEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "dc20534c7b56e793c956939d06921fa4", "score": "0.79929686", "text": "func (cuce ClusterUpgradeCompleteEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn &cuce, true\n}", "title": "" }, { "docid": "72667b7411f9ab9ecb2b50567eb0554e", "score": "0.79895276", "text": "func (curse ClusterUpgradeRollbackStartEvent) AsApplicationUpgradeCompleteEvent() (*ApplicationUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8582e42ea886f40abc421daf8f667d03", "score": "0.7983324", "text": "func (cuce ClusterUpgradeCompleteEvent) AsApplicationUpgradeCompleteEvent() (*ApplicationUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "10b12598dc03509d971b0d9b315400bc", "score": "0.79808277", "text": "func (fe FabricEvent) AsClusterUpgradeDomainCompleteEvent() (*ClusterUpgradeDomainCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "dcfe8063248199468d3b3b8d60fa90ac", "score": "0.7977649", "text": "func (shrce ServiceHealthReportCreatedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2de99ac58ed47e16d6f2ec93b3860b06", "score": "0.79629225", "text": "func (ne NodeEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "90a7e0458f18d1ed47e654683b2dacf5", "score": "0.7961869", "text": "func (crnfse ChaosRestartNodeFaultScheduledEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4cab03aee3a2c3dff91a8b90155b281d", "score": "0.7958289", "text": "func (sce ServiceCreatedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8cab24872f41c5e060932a1c64c04789", "score": "0.7956961", "text": "func (crrfse ChaosRestartReplicaFaultScheduledEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "625b8a64b0324443bda8d034b99297a4", "score": "0.79484385", "text": "func (ae ApplicationEvent) AsClusterUpgradeDomainCompleteEvent() (*ClusterUpgradeDomainCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e1fb5b1a72f718ae1215a9486446ee99", "score": "0.7947535", "text": "func (crnfce ChaosRestartNodeFaultCompletedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "69a8d7ec43ec3df01c4b745ccab5f265", "score": "0.7946617", "text": "func (crrfse ChaosRemoveReplicaFaultScheduledEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5f218c4df593239b8dcab83cc9a8e451", "score": "0.7945341", "text": "func (ne NodeEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "429353f3373c5ce0672a3873a8376867", "score": "0.79394877", "text": "func (chrce ClusterHealthReportCreatedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e2219727015c3e8b33c3d8cf92579565", "score": "0.7939365", "text": "func (crcpfse ChaosRestartCodePackageFaultScheduledEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2d960457e6d8f58f1e538ec97a3a8100", "score": "0.7934074", "text": "func (nae NodeAbortingEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "22b9e5b42c0f572e0cc44218944d27ed", "score": "0.79309386", "text": "func (sce ServiceCreatedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2e9c23e36e77248f0f6dd57ec167df31", "score": "0.79300195", "text": "func (srhree StatefulReplicaHealthReportExpiredEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2ba65c13af715ea4d300ec6f03d417d8", "score": "0.7928106", "text": "func (pae PartitionAnalysisEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "127635837e9a374f531b5107824a7657", "score": "0.7926928", "text": "func (cuse ClusterUpgradeStartEvent) AsApplicationUpgradeCompleteEvent() (*ApplicationUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ef69f8f90cf0d541159884aed840d3ef", "score": "0.79258704", "text": "func (srhrce StatefulReplicaHealthReportCreatedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "62ce6515ac9243e4bfcf3cb94c2ebc19", "score": "0.79170936", "text": "func (cuse ClusterUpgradeStartEvent) AsApplicationUpgradeRollbackCompleteEvent() (*ApplicationUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5ff8a83b110b6ee8799ff37bf16ee8c2", "score": "0.7914702", "text": "func (aurse ApplicationUpgradeRollbackStartEvent) AsClusterUpgradeDomainCompleteEvent() (*ClusterUpgradeDomainCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ba71e0e90846f6eb9b365c489ce680a9", "score": "0.7910692", "text": "func (cuse ClusterUpgradeStartEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "465c463bab8f3e831da6ea55e3b45939", "score": "0.7907792", "text": "func (cudce ClusterUpgradeDomainCompleteEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7ea4681dc27a388fc7ac8117d1e90a6b", "score": "0.78993434", "text": "func (chree ClusterHealthReportExpiredEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a23a28708565f8eaf34b54ea9d1cdbf8", "score": "0.7889993", "text": "func (chree ClusterHealthReportExpiredEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b0a99ea8ae8253e60701d7a4f04525a6", "score": "0.78801805", "text": "func (nhrce NodeHealthReportCreatedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6ca7268d60cfdddf0d29eeb2e713a91c", "score": "0.7879373", "text": "func (phrce PartitionHealthReportCreatedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "66ad0fe905dfdc2340124cd61ca6a733", "score": "0.78788924", "text": "func (dshrce DeployedServiceHealthReportCreatedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ca06690b18a65c454d9f5aafd80c064c", "score": "0.78771996", "text": "func (cmsfse ChaosMoveSecondaryFaultScheduledEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "51e7b554498e0ae57532a35be3dadf45", "score": "0.7875703", "text": "func (srhree StatelessReplicaHealthReportExpiredEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7177779bd5d7d732e2ac83461f1fe67c", "score": "0.78750813", "text": "func (chrce ClusterHealthReportCreatedEvent) AsApplicationUpgradeCompleteEvent() (*ApplicationUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "08982c0265ddffb46fef59c13153100a", "score": "0.78733504", "text": "func (crnfse ChaosRestartNodeFaultScheduledEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "94361c0fd1eac96e4a203cf861e538dd", "score": "0.7871931", "text": "func (ndce NodeDeactivateCompleteEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6831982446222199911217b69f329b16", "score": "0.7869956", "text": "func (nhrce NodeHealthReportCreatedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0cca10a654d8dd2a92f2383f36acce78", "score": "0.7867048", "text": "func (shree ServiceHealthReportExpiredEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7d068a57712211722ffd552cf36d77c9", "score": "0.78656805", "text": "func (cudce ClusterUpgradeDomainCompleteEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7faedfd70b6f4eb9fd2e477c7cd3cfbe", "score": "0.7865135", "text": "func (aurce ApplicationUpgradeRollbackCompleteEvent) AsClusterUpgradeDomainCompleteEvent() (*ClusterUpgradeDomainCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3d9dfec09bba4d4f62dcdd41399b827e", "score": "0.7863836", "text": "func (dshrce DeployedServiceHealthReportCreatedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "72f164252796bd27dcabd104df8d92d1", "score": "0.786248", "text": "func (nae NodeAbortedEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "778cbe07500561b2eb55aaa8d6ed3023", "score": "0.7857112", "text": "func (ace ApplicationCreatedEvent) AsClusterUpgradeDomainCompleteEvent() (*ClusterUpgradeDomainCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" } ]
e6392b9543703fff5786945623483256
IsAvailable checks if a peer is still alive
[ { "docid": "e48a660402a7e494544abedbeab5ad96", "score": "0.6231686", "text": "func (detectors *Detectors) IsAvailable(id int) bool {\n\tdetector := detectors.GetDetector(id)\n\n\tif detector != nil {\n\t\treturn detector.IsAvailable()\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "47cd2355e473e5332037b429bb49e8d1", "score": "0.7620798", "text": "func (p *Proxy) IsAvailable() bool {\n\treturn p.health.IsAvailable()\n}", "title": "" }, { "docid": "54687c5dd6eeef3852a38f51c6020b01", "score": "0.71994203", "text": "func Available() bool {\n\tconn, err := listenPacket(\"ip4:icmp\", \"0.0.0.0\")\n\tif err == nil && conn != nil {\n\t\tconn.Close()\n\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0fc95b373048ce62c0d31b223280c3e8", "score": "0.70916754", "text": "func (client *Client)IsAvailable() bool {\n\tclient.mu.Lock()\n\tdefer client.mu.Unlock()\n\n\treturn !client.closing && !client.shutdown\n}", "title": "" }, { "docid": "e1e6299a76a24c9b697d385e0547d57b", "score": "0.69323236", "text": "func IsAvailable(domain string) bool {\n\t_, err := net.LookupHost(domain)\n\treturn err != nil\n}", "title": "" }, { "docid": "c0c68d4b799013ee3de0acc8d30d9eb7", "score": "0.6921927", "text": "func (r *RPC) Available() bool {\n\t_, err := r.Stats()\n\treturn err == nil\n}", "title": "" }, { "docid": "0b18c8ff9ad1015f7f03456575775cee", "score": "0.6695088", "text": "func (s *Slave) Available() bool {\n\treturn !strings.Contains(s.Flags, \"disconnected\") && !strings.Contains(s.Flags, \"s_down\")\n}", "title": "" }, { "docid": "e9a2857819a6ed8d712f3d1f5e4529f3", "score": "0.6667641", "text": "func (r *Record) IsAvailable() bool {\n\treturn r.Channel != nil && (r.RecSec > 0 || r.Indefinite) && r.Destination != nil\n}", "title": "" }, { "docid": "3c62459d8587a8899b5451d8b6881d83", "score": "0.65887666", "text": "func (t *Torrent) GetAvailable() (Available, error) {\n\tch := make(chan []uint16)\n\tselect {\n\tcase t.Event <- peer.TorGetAvailable{ch}:\n\t\tselect {\n\t\tcase v := <-ch:\n\t\t\treturn v, nil\n\t\tcase <-t.Done:\n\t\t\treturn nil, ErrTorrentDead\n\t\t}\n\tcase <-t.Done:\n\t\treturn nil, ErrTorrentDead\n\t}\n}", "title": "" }, { "docid": "b64e96bdbcd429c2c3c1e742e4ca74fb", "score": "0.6480122", "text": "func (o *StatusResponse) GetAvailable() bool {\n\tif o == nil || o.Available == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.Available\n}", "title": "" }, { "docid": "91b1d144b444b250d6bdccf8f962ce65", "score": "0.6479757", "text": "func (p *plumbService) Available() bool {\n\treturn p.ready\n}", "title": "" }, { "docid": "591d56039ca6b06f1173fc0ddc0a1587", "score": "0.64575243", "text": "func (t *TripleClient) IsAvailable() bool {\n\treturn t.h2Controller.IsAvailable()\n}", "title": "" }, { "docid": "7a2636d409afad5c10ffbe943af54a47", "score": "0.64215785", "text": "func (m *Machine) IsAvailable() bool {\n\tif m == nil {\n\t\treturn false\n\t}\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\treturn m.description.MaintenanceMode == \"\" && !m.description.IsQuarantined && m.description.Recovering == \"\"\n}", "title": "" }, { "docid": "2dbae5c8a41f8444f63a47e194f576e0", "score": "0.64134014", "text": "func ConnectivityCheckAvailable() (bool, error) {\n\tnm, err := System()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn nm.ConnectivityCheckAvailable()\n}", "title": "" }, { "docid": "08da0b8e89afb64d3f94d79fbf33f1b2", "score": "0.6368231", "text": "func (monitor NetworkMonitor) GetNetworkAvailable() bool {\n\tret0 := C.g_network_monitor_get_network_available(monitor.native())\n\treturn util.Int2Bool(int(ret0)) /*go:.util*/\n}", "title": "" }, { "docid": "c9cf02bd4327b160128f706f05e39540", "score": "0.63678926", "text": "func (o *StatusResponse) HasAvailable() bool {\n\tif o != nil && o.Available != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3c8e8ae8d82783233fbc0baac8133938", "score": "0.6346162", "text": "func Available() bool {\n\treturn available\n}", "title": "" }, { "docid": "17f41375ed07815d5da87cab0e508d46", "score": "0.6336573", "text": "func (nr *nacosRegistry) IsAvailable() bool {\n\t// TODO\n\treturn true\n}", "title": "" }, { "docid": "76d3521e44e20d8b49eeee8df7b8dd0f", "score": "0.62716943", "text": "func IsAvailable() bool {\n\tcmd := exec.Command(\"ffprobe\", \"-version\")\n\treturn cmd.Run() == nil\n}", "title": "" }, { "docid": "8e4db0fda40a3f2e836bd4781b66c2e2", "score": "0.6252708", "text": "func (s *Storage) IsAvailable() error {\n\tif err := s.db.Ping(); err != nil {\n\t\treturn err\n\t}\n\n\t// This is necessary because once a database connection is initiallly\n\t// established subsequent calls to the Ping method return success even if the\n\t// database goes down.\n\t//\n\t// https://github.com/lib/pq/issues/533\n\tif _, err := s.db.Exec(\"SELECT 1\"); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0990abe57888d2c3ec53387e41a4a5ef", "score": "0.622142", "text": "func IsPortAvailable(port int, username, host string) (bool, error) {\n\n\toutput, err := remoteNetstatCmd(username, host)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tusedPorts := parseNetstatPorts(output)\n\n\tfor _, u := range usedPorts {\n\n\t\tif u == port {\n\n\t\t\treturn false, nil\n\t\t}\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "912a8f92192b87722b68e3ad5422f0ee", "score": "0.6196299", "text": "func IsPortAvailable(p int) bool {\n\tln, err := _net.Listen(\"tcp\", fmt.Sprintf(\":%v\", p))\n\tif err != nil {\n\t\treturn false\n\t}\n\tln.Close()\n\treturn true\n}", "title": "" }, { "docid": "05dccc89100bee10169ca3dabc195cfe", "score": "0.6170716", "text": "func (r *BaseResolver) Available() (bool, error) {\n\tif r.IsStopped() {\n\t\tmsg := fmt.Sprintf(\"DNS: Resolver %s has been stopped\", r.String())\n\n\t\treturn false, &ResolveError{Err: msg}\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "23b1321e36482a6157c8975bd3bdb2ed", "score": "0.6166911", "text": "func (j JPNSoftware) GetAvailable() bool {\n\treturn time.Now().After(j.ReleaseDate)\n}", "title": "" }, { "docid": "a072ffaca571e8942c4067fb51eaeb30", "score": "0.61506766", "text": "func CheckSocketAvailable(path string, timeout time.Duration) (bool, bool) {\n\tif !checkSocketExists(path) {\n\t\treturn false, false\n\t}\n\n\tconn, err := winio.DialPipe(path, &timeout)\n\tif err != nil {\n\t\treturn true, false\n\t}\n\n\tif conn != nil {\n\t\tconn.Close()\n\t}\n\n\treturn true, true\n}", "title": "" }, { "docid": "0fb03a26bd11a67678354783819e4214", "score": "0.61389786", "text": "func (f *azureMySQLFlexServerFetcher) isAvailable(server *armmysqlflexibleservers.Server, log logrus.FieldLogger) bool {\n\tstate := armmysqlflexibleservers.ServerState(azure.StringVal(server.Properties.State))\n\tswitch state {\n\tcase armmysqlflexibleservers.ServerStateReady, armmysqlflexibleservers.ServerStateUpdating:\n\t\treturn true\n\tcase armmysqlflexibleservers.ServerStateDisabled,\n\t\tarmmysqlflexibleservers.ServerStateDropping,\n\t\tarmmysqlflexibleservers.ServerStateStarting,\n\t\tarmmysqlflexibleservers.ServerStateStopped,\n\t\tarmmysqlflexibleservers.ServerStateStopping:\n\t\t// server state is known and it's not available.\n\t\treturn false\n\t}\n\tlog.Warnf(\"Unknown status type: %q. Assuming Azure MySQL Flexible server %q is available.\",\n\t\tstate,\n\t\tazure.StringVal(server.Name))\n\treturn true\n}", "title": "" }, { "docid": "4da48595e0533c0202a7649943e660db", "score": "0.6129289", "text": "func isAvailable(url string) {\n\n\thttpClient := &http.Client{\n\t\tTimeout: time.Duration(1) * time.Second,\n\t}\n\n\tfor {\n\t\tresponse, err := httpClient.Get(url)\n\t\tvar m runtime.MemStats\n\n\t\tLogger.Debug(\"request:%s\", url)\n\n\t\tif err != nil {\n\t\t\tLogger.Error(\"request %v error\", err.Error())\n\t\t\tMailErr <- err\n\t\t\ttime.Sleep(time.Duration(5) * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\tstatusCode := response.StatusCode\n\n\t\tif statusCode != 200 {\n\t\t\tLogger.Warn(\"request response is not 200, status code is %d\", statusCode)\n\t\t\tMailErr <- err\n\t\t}\n\n\t\tresponse.Body.Close()\n\n\t\truntime.ReadMemStats(&m)\n\n\t\ttime.Sleep(time.Duration(10) * time.Second)\n\n\t\tLogger.Debug(\"heapAlloc:%dM\", m.HeapAlloc/1024/1024)\n\t}\n}", "title": "" }, { "docid": "666419e38c1e698244ae3c3b413ce4df", "score": "0.61264193", "text": "func listenerAvailable(ip string) (bool, error) {\n\tlog := logging.For(\"network/listeneravailable\")\n\tconfig, err := getConfig()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tfor iface, addrs := range config {\n\t\tfor _, addr := range addrs.Ipv4 {\n\t\t\tif addr.IP == ip {\n\t\t\t\tlog.WithField(\"interface\", iface).WithField(\"ip\", addr.IP).Debug(\"IPV4 found on interface\")\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "00733e733554ec0269d3e5ad4bee1b85", "score": "0.60938466", "text": "func (core *Core) IsOfflineAvailable() (bool, error) {\n\t_, err := os.Stat(path.Join(core.Path, \"online\"))\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "16468353bab0e967901198bd8cc2f7a5", "score": "0.6077028", "text": "func IsAvailable() (bool, error) {\n\terr := modadvapi32.Load()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "de9646ed39f5c13b05afb97190f8e720", "score": "0.6064216", "text": "func (n *NodeManager) CheckPortAvailable(protocol string, ports ...uint32) bool {\n\tif protocol == \"\" {\n\t\tprotocol = \"tcp\"\n\t}\n\ttimeout := time.Second * 3\n\tfor _, port := range ports {\n\t\tc, _ := net.DialTimeout(protocol, fmt.Sprintf(\"0.0.0.0:%d\", port), timeout)\n\t\tif c != nil {\n\t\t\tlogrus.Errorf(\"Gateway must need listen port %d, but it has been uesd.\", port)\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "5ac1bf772bc622cec8f218f0da9e4bf0", "score": "0.60492986", "text": "func (a *AnimeEpisode) Available() bool {\n\treturn len(a.Links) > 0\n}", "title": "" }, { "docid": "00cba501e418682ac3fd0e1473227cc9", "score": "0.60450673", "text": "func TestPortAvailable(t *testing.T) {\n\tn := Network{}\n\tretval, err := n.CheckPort(\"localhost\", 22, 2*time.Second)\n\tif !retval {\n\t\tt.Error(\"Expected true, got false\")\n\t}\n\tif err != nil {\n\t\tt.Errorf(\"Expected nil, got %v\", err)\n\t}\n\n}", "title": "" }, { "docid": "c83ef40c2bee6bbc8016afb907ed2a2d", "score": "0.60447264", "text": "func (sc *ShowCalendarEpisode) IsAvailable() bool {\n\t// No info on aired, let's say it's available, it might actually be true\n\tif sc.AiredDate == nil {\n\t\treturn true\n\t}\n\n\treturn sc.AiredDate.Before(time.Now())\n}", "title": "" }, { "docid": "fc5218dbd158cba46d9ba29b00afec2c", "score": "0.59987974", "text": "func (c *Client) IsAlive(ctx context.Context) (bool, error) {\n\t_, err := c.ShimInfo(ctx, empty)\n\tif err != nil {\n\t\t// TODO(stevvooe): There are some error conditions that need to be\n\t\t// handle with unix sockets existence to give the right answer here.\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "26eed3901b75fbb7983929e9546172d8", "score": "0.59972304", "text": "func (dc *DBRepo) IsSlotAvailable() bool {\n\tavailableRows := dc.GormDB.Debug().Where(`is_occupied != ?`, true).Find(&model.Slot{}).RowsAffected\n\n\treturn availableRows > 0\n}", "title": "" }, { "docid": "c25e0a915c1c4ae336d200fd9521a060", "score": "0.5996868", "text": "func (cp *ConnectionPool) Available() int64 {\n\tp := cp.pool()\n\tif p == nil {\n\t\treturn 0\n\t}\n\treturn p.Available()\n}", "title": "" }, { "docid": "c25e0a915c1c4ae336d200fd9521a060", "score": "0.5996868", "text": "func (cp *ConnectionPool) Available() int64 {\n\tp := cp.pool()\n\tif p == nil {\n\t\treturn 0\n\t}\n\treturn p.Available()\n}", "title": "" }, { "docid": "a81181855ab251ce54eaa8c4f7dbd561", "score": "0.5992015", "text": "func (w *WebsocketTransport) IsAlive() bool {\n\treturn w.c != nil\n}", "title": "" }, { "docid": "b93721d7d30ebd53103e4265c9ffb642", "score": "0.59740496", "text": "func (dir *BaseDirectory) IsAvailable() bool {\n\treturn !dir.destroyed.Load()\n}", "title": "" }, { "docid": "7467535ad899206b6a36c89b61f80081", "score": "0.5973435", "text": "func (s *esService) isServerAvailable() bool {\n\tresp, err := http.Get(fmt.Sprintf(\"http://localhost:%d/_cluster/health?wait_for_status=yellow&timeout=%ds\", s.port, elasticSearchAvailableDelay))\n\tif err != nil {\n\t\treturn false\n\t}\n\tdefer resp.Body.Close()\n\tbytes, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn false\n\t}\n\tvar v map[string]interface{}\n\terr = json.Unmarshal(bytes, &v)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn !v[\"timed_out\"].(bool)\n}", "title": "" }, { "docid": "b33108772103e819fa392c9137f2550e", "score": "0.59718305", "text": "func (o *TCP_Server) IsConnectionAvailable() gdnative.Bool {\n\t//log.Println(\"Calling TCP_Server.IsConnectionAvailable()\")\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(\"TCP_Server\", \"is_connection_available\")\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": "3782338ad5bb71d26fd0d56be08e28e3", "score": "0.5969412", "text": "func (ws *WebServer) IsPeerPortReachable() bool {\n\treturn ws.peerPortReachable\n}", "title": "" }, { "docid": "52c55312e715abec8271c52c8e4d30b9", "score": "0.59615993", "text": "func (info *BaseEndpointInfo) IsReady() bool {\n\treturn info.Ready\n}", "title": "" }, { "docid": "55ebc05b85a92600a6d18eb1b0541a3d", "score": "0.5952936", "text": "func (h *Hub) nameAvailable(name string, fnc func()) bool {\n\tkey := toNameKey(name)\n\th.peers.RLock()\n\t_, sameName1 := h.peers.reserved[key]\n\t_, sameName2 := h.peers.byName[key]\n\tif fnc != nil {\n\t\tfnc()\n\t}\n\th.peers.RUnlock()\n\treturn !sameName1 && !sameName2\n}", "title": "" }, { "docid": "bf5aa6fd7e6dbf7655d81f2047bb61d7", "score": "0.5936701", "text": "func IsNodeAvailable(node *corev1.Node, minReadySeconds int32, now metav1.Time) bool {\n\tif !IsNodeReady(node) {\n\t\treturn false\n\t}\n\n\tif minReadySeconds == 0 {\n\t\treturn true\n\t}\n\n\tminReadySecondsDuration := time.Duration(minReadySeconds) * time.Second\n\treadyCondition := GetReadyCondition(&node.Status)\n\n\tif !readyCondition.LastTransitionTime.IsZero() &&\n\t\treadyCondition.LastTransitionTime.Add(minReadySecondsDuration).Before(now.Time) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "080bf5398b341ce87b49618531b20489", "score": "0.59228367", "text": "func IsReachable(addr string) error {\n\treturn DefaultClient.IsReachable(addr)\n}", "title": "" }, { "docid": "cf99822fff1715c5d87431fd59a0b70c", "score": "0.59141064", "text": "func (l Lattice) IsAvailable() bool {\n\tif l.l.lattice == nil {\n\t\treturn false\n\t}\n\tavailable := C.mecab_lattice_is_available(l.l.lattice) != 0\n\truntime.KeepAlive(l.l)\n\treturn available\n}", "title": "" }, { "docid": "f561b083f09782401bd1d0993f90fbf0", "score": "0.5909662", "text": "func (g *Gateway) Online() bool {\n\tif build.Release == \"dev\" || build.Release == \"testing\" {\n\t\treturn true\n\t}\n\n\tg.mu.RLock()\n\tdefer g.mu.RUnlock()\n\tfor _, p := range g.peers {\n\t\tif !p.Local {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0645fecd8f0f2557395e3ab6382f527a", "score": "0.59074503", "text": "func (b bindAddresses) isAvailable(addr types.Address) bool {\n\tif addr == anyIPAddress {\n\t\treturn len(b) == 0\n\t}\n\n\t// If all addresses for this portDescriptor are already bound, no\n\t// address is available\n\tif _, ok := b[anyIPAddress]; ok {\n\t\treturn false\n\t}\n\n\tif _, ok := b[addr]; ok {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "a0841b418f9bd36da205cd3e38bcdfc4", "score": "0.59035456", "text": "func (a *Client) GetAvailable(params *GetAvailableParams, authInfo runtime.ClientAuthInfoWriter) (*GetAvailableOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAvailableParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetAvailable\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/available\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetAvailableReader{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.(*GetAvailableOK), nil\n\n}", "title": "" }, { "docid": "b5f40d9740af3fb20f46fb1535dc0894", "score": "0.59022963", "text": "func IsReachable(url, result string, connectionTimeout int) (bool, error) {\n\tlogrus.Debugf(\"is %v Reachable\", url)\n\n\ttimeout := time.Duration(connectionTimeout) * time.Millisecond\n\tclient := http.Client{\n\t\tTimeout: timeout,\n\t}\n\n\tresp, err := client.Get(url)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tlogrus.Debugf(\"resp: %+v\", resp)\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn false, fmt.Errorf(\"got StatusCode: %v\", resp.StatusCode)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif string(body) != result {\n\t\treturn false, fmt.Errorf(\"response from peer: %v didn't match expected: %v\", string(body), result)\n\t}\n\n\tresp.Body.Close()\n\treturn true, nil\n}", "title": "" }, { "docid": "28f504c9d4fef0c7f45d361adf1b4aaa", "score": "0.58826673", "text": "func (node *Node) Available() {\n\tnode.isAvailable = true\n}", "title": "" }, { "docid": "e4a4b0882310eccf9038301ed2aeca73", "score": "0.5880466", "text": "func (n *netImpl) IsAlive() bool {\n\treturn true // This node is alive.\n}", "title": "" }, { "docid": "959e108bd863a9c86ac1a0e439d128d2", "score": "0.5868576", "text": "func (srv *Server) IsHealthy() bool { return true }", "title": "" }, { "docid": "8525243582d3a01cb6a7fae5b6d11478", "score": "0.5857539", "text": "func isUp() bool {\n\tconn, err := net.Dial(\"tcp\", *ip+\":\"+*port)\n\tif err != nil {\n\t\treturn false\n\t}\n\tconn.Close()\n\treturn true\n}", "title": "" }, { "docid": "873306ff348c8f4203d80965bd028096", "score": "0.5854343", "text": "func (p *Peer) IsActive() bool {\n\treturn p.Status == PEER_ACTIVE\n}", "title": "" }, { "docid": "f0524fa02748a270e856fb0e8ba73709", "score": "0.58298856", "text": "func (p *PeerTracker) IsIdle() bool {\n\tp.activelk.Lock()\n\tdefer p.activelk.Unlock()\n\treturn p.numTasks == 0 && p.active == 0\n}", "title": "" }, { "docid": "d9013657fc58aa33686d39665c53fb82", "score": "0.5805178", "text": "func (p *P2PClient) Alive() bool {\n\treturn p.conn.GetState() != connectivity.Shutdown\n}", "title": "" }, { "docid": "07d323f410657f5d38562446e49f0f11", "score": "0.57994735", "text": "func probeIsReady(ctx context.Context) (bool, error) {\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, \"http://127.0.0.1:29090/readyz\", http.NoBody)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"constructing http request: %w\", err)\n\t}\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif resp != nil {\n\t\tdefer resp.Body.Close()\n\t}\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn resp.StatusCode >= 200 && resp.StatusCode < 400, nil\n}", "title": "" }, { "docid": "6846855c6ee62d6f6ecbe57d8c089d7a", "score": "0.5795552", "text": "func (c *Client) IsReachable(addr string) error {\n\tip, port, err := net.SplitHostPort(addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tt, err := newTestServer(net.JoinHostPort(\"0.0.0.0\", port))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer t.Close()\n\n\tfor i := 0; i < c.MaxRetries; i++ {\n\t\tif err = c.isReachable(ip, port); err == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\tif !c.ShouldRetry(err) {\n\t\t\treturn err\n\t\t}\n\n\t\ttime.Sleep(c.Backoff(i))\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "55bf77e5186afc52d210398f541ecb44", "score": "0.57885134", "text": "func IsReachable(unit provision.Unit) (bool, error) {\n\turl := fmt.Sprintf(\"http://%s\", unit.Ip)\n\tresponse, err := http.Get(url)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif response.StatusCode == http.StatusBadGateway {\n\t\treturn false, nil\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "2a25ad80a4223ced01646f7d5b924e91", "score": "0.57877594", "text": "func isPortAlive(host, port string) bool {\n\tconn, err := net.DialTimeout(\"tcp\", net.JoinHostPort(host, port), 100*time.Millisecond)\n\tif err != nil {\n\t\treturn false\n\t}\n\tdefer conn.Close()\n\treturn true\n}", "title": "" }, { "docid": "6b3478b241017214f3fb30606bfa1d3a", "score": "0.57741374", "text": "func (sb *SpokeBound) IsReady() bool {\n\treturn time.Now().After(sb.start)\n}", "title": "" }, { "docid": "668860b10450382217f5285a294ce2ad", "score": "0.57544607", "text": "func (o *StatusResponse) GetAvailableOk() (*bool, bool) {\n\tif o == nil || o.Available == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Available, true\n}", "title": "" }, { "docid": "17dc91e3948c8da083594b5d1422e997", "score": "0.5746288", "text": "func (kvclient *MockKVClient) IsConnectionUp(ctx context.Context) bool {\n\t// timeout in second\n\tt, _ := ctx.Deadline()\n\treturn t.Second()-time.Now().Second() >= 1\n}", "title": "" }, { "docid": "9d5f8e7e3936cb55dd9ea39d6b2937cf", "score": "0.57134736", "text": "func (g *Github) IsAvailable(username string, cli client.HTTPClient) (available bool, err error) {\n\treq, err := http.NewRequest(\"GET\", \"https://github.com/\"+username, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\tres, err := (cli).Do(req)\n\tif err != nil {\n\t\t// Need a pointer because it's the pointer that satisfies the interface (pointer receptor)\n\t\terr = &client.ErrNetworkFailure{Cause: err}\n\t\treturn\n\t}\n\tdefer res.Body.Close()\n\tavailable = (res.StatusCode == http.StatusNotFound)\n\treturn\n}", "title": "" }, { "docid": "f562d866955d661e509ff80b87093609", "score": "0.57054806", "text": "func (self *worker) isAlive() bool {\n\tself.lock.Lock()\n\tdefer self.lock.Unlock()\n\n\tif self.state != ALIVE {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "f40893db589a3333aa14affabc1de8f3", "score": "0.5670684", "text": "func (u *User) Available() bool {\n\tif u.Username != \"\" {\n\t\treturn helper.RedisClient().Exists(u.keyName()).Val()\n\t} else if u.UUID != \"\" {\n\t\treturn helper.RedisClient().Exists(u.keyID()).Val()\n\t}\n\treturn false\n}", "title": "" }, { "docid": "680f2e13034c8306dcd37e28e6d7d4e2", "score": "0.56657714", "text": "func (md *MDServerMemory) CheckReachability(ctx context.Context) {}", "title": "" }, { "docid": "53c9bccf3fe05355c4b2a796485a643d", "score": "0.5659599", "text": "func (db *DB) CheckAvail(cp *ClusterParams) (bool, int64) {\n\t// getting query string ready\n\tconditions := generateAND(cp.generateParamsConditions(QueryZone(), QueryNodes(), QueryNodeType()))\n\tqueryString := fmt.Sprintf(\"SELECT * FROM Cluster WHERE Status = 'Ready' AND %v\", conditions)\n\t// check whether available cluster exists\n\trow := db.QueryRow(queryString)\n\tc, err := populateCluster(row)\n\t// no available cluster is found\n\tif err != nil {\n\t\treturn false, -1\n\t}\n\treturn true, c.ClusterID\n\n}", "title": "" }, { "docid": "18b69b2eced8e9cfcdcd86768dba8b58", "score": "0.5657102", "text": "func (player *Player) IsAlive() bool {\n\treturn player.Finished == false\n}", "title": "" }, { "docid": "ef3a5abd7ded24be7f763aaba25a4e82", "score": "0.56504965", "text": "func (l *List) PeerBecameUnavailable(jid string) bool {\n\tif p, exist := l.Get(jid); exist {\n\t\tp.Online = false\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "453d0352bd4cce296a91b33b8e7038c8", "score": "0.5644055", "text": "func (n *Node) isAlive() bool {\n n.aliveMux.RLock()\n defer n.aliveMux.RUnlock()\n return n.alive\n}", "title": "" }, { "docid": "f5e3cdce1efe145c3436b2b4ae0f40d8", "score": "0.5640323", "text": "func (pge *PgEngine) IsAlive() bool {\n\treturn pge.ConfigDb != nil && pge.ConfigDb.Ping(context.Background()) == nil\n}", "title": "" }, { "docid": "8c37c8ad15902ad179c8f003e0c05e36", "score": "0.5627062", "text": "func (h Hash) Available() bool {\n\treturn h < maxHash && hashes[h] != nil\n}", "title": "" }, { "docid": "26233e52c68407e3dfa8c02640d5d4cc", "score": "0.5622504", "text": "func (p AmazonFRParser) IsAvailable() (bool, error) {\n\tdocument, err := p.getPage(p.URL)\n\n if err != nil {\n return false, err\n\t}\n\n\taddToCart := document.Find(\"#add-to-cart-button\")\n\n\tif addToCart.Length() == 0 {\n\t\treturn false, nil\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "f63fb5c8946db133e62fb507d46ab749", "score": "0.5621989", "text": "func (p *Peer) Interested() bool {\n\treturn p.PeerInterested\n}", "title": "" }, { "docid": "1e50262bdb1609c0d324e60457ff3310", "score": "0.56112725", "text": "func (r *PromscaleBgwriterRecommender) IsAvailable() bool {\n\treturn true\n}", "title": "" }, { "docid": "b0eb2be6afaee2b955560eda837c2a93", "score": "0.56038654", "text": "func (o *StatusResponse) SetAvailable(v bool) {\n\to.Available = &v\n}", "title": "" }, { "docid": "2cd9369ab04acf3e6ea2efbdf79d4ba5", "score": "0.5599213", "text": "func AvailableAddr() string {\n\t// Randomly generate an available port.\n\taddr, err := net.ResolveTCPAddr(\"tcp\", \"localhost:0\")\n\tif err != nil {\n\t\tcannotOpenPort()\n\t}\n\n\t// Connect to the port to check whether this port is truly available.\n\ttemp, err := net.ListenTCP(\"tcp\", addr)\n\tif err != nil {\n\t\tcannotOpenPort()\n\t}\n\n\t// Close connection to make place for the util connection.\n\t// if something wrong and cannot close connection,\n\t// it will then exit the program.\n\tdefer func(temp *net.TCPListener) {\n\t\terr := temp.Close()\n\t\tif err != nil {\n\t\t\tcannotOpenPort()\n\t\t}\n\t}(temp)\n\n\treturn temp.Addr().String()\n}", "title": "" }, { "docid": "ede8ac959bf50f8a9f625835ff2a0bdc", "score": "0.5597144", "text": "func (c *Client) IsReachable() error {\n\tclient, err := c.getKubeClient()\n\tif err == genericclioptions.ErrEmptyConfig {\n\t\t// re-replace kubernetes ErrEmptyConfig error with a friendy error\n\t\t// moar workarounds for Kubernetes API breaking.\n\t\treturn errors.New(\"Kubernetes cluster unreachable\")\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Kubernetes cluster unreachable\")\n\t}\n\tif _, err := client.ServerVersion(); err != nil {\n\t\treturn errors.Wrap(err, \"Kubernetes cluster unreachable\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c470977614dbac373b8717c9defec71", "score": "0.55923516", "text": "func (h Hash) Available() bool {\n\treturn hashes[h] != nil\n}", "title": "" }, { "docid": "50cf037a4b42e6cde8c6beb2fc47039f", "score": "0.55827", "text": "func (c *Client) IsReachable() error {\n\tclient, err := c.Factory.KubernetesClientSet()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Kubernetes cluster unreachable\")\n\t}\n\tif _, err := client.ServerVersion(); err != nil {\n\t\treturn errors.Wrap(err, \"Kubernetes cluster unreachable\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "de630d1787f41be1ae898ea4f83a78d4", "score": "0.5579181", "text": "func IsOnline(url string) (bool, error) {\n\tcheckCmd := exec.Command(\n\t\t\"streamlink\",\n\t\t\"--twitch-disable-hosting\",\n\t\turl,\n\t)\n\n\tcheckCmd.Start()\n\tstate, err := checkCmd.Process.Wait()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\twaitStatus := state.Sys().(syscall.WaitStatus)\n\treturn waitStatus.ExitStatus() == 0, nil\n}", "title": "" }, { "docid": "d653d67c52b1b38a953af7852fd5bb4d", "score": "0.5570063", "text": "func (dir *RegistryDirectory) IsAvailable() bool {\n\tif !dir.BaseDirectory.IsAvailable() {\n\t\treturn dir.BaseDirectory.IsAvailable()\n\t}\n\n\tfor _, ivk := range dir.cacheInvokers {\n\t\tif ivk.IsAvailable() {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f3caaf0936015b3a38f6d8f48ccb8b47", "score": "0.5561391", "text": "func checkAlive(ip string) bool {\n\tlog.Printf(\"Verificando si el nodo %s está disponible...\", ip)\n\n\tvar opts []grpc.DialOption\n\n\t//Crear la conexión\n\topts = append(opts, grpc.WithInsecure())\n\tconn, err := grpc.Dial(fmt.Sprintf(\"%s:%d\", ip, *datanodePort), opts...)\n\tif err != nil {\n\t\tlog.Fatalf(\"fail to dial: %v\", err)\n\t}\n\tdefer conn.Close()\n\n\t// Enviar solicitud al servidor\n\tclient := dataNode.NewDataNodeServiceClient(conn)\n\tctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n\tdefer cancel()\n\taliveReq := &dataNode.AliveRequest{}\n\t_, aliveErr := client.Alive(ctx, aliveReq)\n\tif aliveErr != nil {\n\t\tlog.Printf(\"%v.Alive(%s) = _, %v: \", client, ip, err)\n\t\tlog.Printf(\"El nodo %s no está disponible.\", ip)\n\t\treturn false\n\t}\n\tlog.Printf(\"El nodo %s si está disponible.\", ip)\n\treturn true\n}", "title": "" }, { "docid": "237ba9956a7e4da18b543f581fa366a7", "score": "0.55612737", "text": "func (b *Bot) IsAlive() bool {\n\treturn b.alive\n}", "title": "" }, { "docid": "fde67305414e4e586dd0284a2b5ca2c5", "score": "0.5558864", "text": "func (s *LeaderServer) isReady() bool {\n\ts.state.mutex.Lock()\n\tdefer s.state.mutex.Unlock()\n\n\treturn s.state.ready\n}", "title": "" }, { "docid": "d378f11356ee58086247e1274eec17f5", "score": "0.5557458", "text": "func (n *Node) CheckPeerIsKnown(host string, id *hash.Peer) {\n\tselect {\n\tcase n.discovery.tasks <- discoveryTask{\n\t\thost: host,\n\t\tunknown: id,\n\t}:\n\tdefault:\n\t\tn.Warn(\"discovery.tasks queue is full, so skipped\")\n\t}\n}", "title": "" }, { "docid": "78ef8b80fbbea92ef5dbdbe8094bead9", "score": "0.55552566", "text": "func (pool *WorkerPool) IsAlive(name string) bool {\n\tif pool.states == nil {\n\t\treturn false\n\t}\n\n\tstate := pool.states[name]\n\treturn state == WorkerRun\n}", "title": "" }, { "docid": "94b457d5f98d3096a4e6aa1cad256e46", "score": "0.552027", "text": "func IsAvailable(ctx context.Context) (string, error) {\n\trelease, err := util.GetLatestVersion(ctx)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to check for kbrew updates\")\n\t}\n\tif version.Version != *release.TagName {\n\t\treturn *release.TagName, nil\n\t}\n\treturn \"\", nil\n}", "title": "" }, { "docid": "6e3b993c626b028f880c26f8ab596235", "score": "0.55158645", "text": "func IsPrometheusAvailable(client *client.Client) bool {\n\treturn client.HasServerGroup(prometheusServerGroup)\n}", "title": "" }, { "docid": "3b07391ed5f7145cbb741dffb6e5cea5", "score": "0.55112493", "text": "func (l *Limiter) Ready(addr string) (time.Duration, bool) {\n\tl.addrsMu.Lock()\n\tdefer l.addrsMu.Unlock()\n\n\treturn l.ready(addr)\n}", "title": "" }, { "docid": "9ca93e6c51e8fc94427388205e186bcf", "score": "0.55098677", "text": "func IsEngineAvailable(engine EngineKind) bool {\n\treturn bool(C.wasmer_is_engine_available(uint32(C.wasmer_engine_t(engine))))\n}", "title": "" }, { "docid": "2ac9ff21a44bc2d249c195422b42eaa0", "score": "0.5509785", "text": "func IsPortFree(port int, localAddress string) bool {\n\tif localAddress == \"\" {\n\t\tlocalAddress = \"127.0.0.1\"\n\t}\n\taddress := fmt.Sprintf(\"%s:%d\", localAddress, port)\n\tlistener, err := net.Listen(\"tcp\", address)\n\tif err != nil {\n\t\treturn false\n\t}\n\terr = listener.Close()\n\treturn err == nil\n}", "title": "" }, { "docid": "8557b5117793749f9d4677854f8de773", "score": "0.5498439", "text": "func (b *LockedBuffer) IsAlive() bool {\n\treturn b.Buffer.Alive()\n}", "title": "" }, { "docid": "a8b1573199fba0c26d428f51850315eb", "score": "0.54914814", "text": "func (rc *RequestCounter) IsMetricAvailable() bool {\n\trc.Lock()\n\tdefer rc.Unlock()\n\t// We set healthy threshold is 8 here, i.e. 8 min\n\treturn rc.unavailableCount < 8\n}", "title": "" }, { "docid": "b2bd7c47e63fdfcf1995e15bf5b397fe", "score": "0.5487555", "text": "func hasInternet() bool {\n\tnotify := func(err error, duration time.Duration) {\n\t\tglobals.Logger.Warn(\n\t\t\t\"Encountered error checking for internet connection\",\n\t\t\tzap.Int64(\"duration\", duration.Nanoseconds()/int64(time.Millisecond)),\n\t\t\tzap.Error(err),\n\t\t)\n\t}\n\n\toperation := func() error {\n\t\tresponse, err := http.Get(InternetCheckURL)\n\n\t\tif err != nil {\n\t\t\t// Pass this error back, the notify handler will log it for us\n\t\t\treturn err\n\t\t}\n\n\t\tdefer response.Body.Close()\n\t\tio.Copy(ioutil.Discard, response.Body)\n\n\t\tif response.StatusCode < http.StatusOK || response.StatusCode >= http.StatusMultipleChoices {\n\t\t\t// Pass this error back, the notify handler will log it for us\n\t\t\treturn errors.New(\"Returned status code was not acceptable\")\n\t\t}\n\t\treturn err\n\t}\n\n\terr := backoff.RetryNotify(operation, backoff.NewExponentialBackOff(), notify)\n\treturn err == nil\n}", "title": "" }, { "docid": "8bc6aa5639d48ff3f2dd670c6aea39c5", "score": "0.54868716", "text": "func IsAPIAvailable() bool {\n\treturn isAPIAvailable\n}", "title": "" }, { "docid": "c44bc7c9f086f6edf644bc2e24fa8dea", "score": "0.5486435", "text": "func (s *Store) Ready() bool {\n\tl, err := s.LeaderAddr()\n\tif err != nil || l == \"\" {\n\t\treturn false\n\t}\n\n\treturn func() bool {\n\t\ts.readyChansMu.Lock()\n\t\tdefer s.readyChansMu.Unlock()\n\t\tif s.numClosedReadyChannels != len(s.readyChans) {\n\t\t\treturn false\n\t\t}\n\t\ts.readyChans = nil\n\t\ts.numClosedReadyChannels = 0\n\t\treturn true\n\t}()\n}", "title": "" } ]
610a48f4562ab56ac46b9986c48f3925
Deprecated: Use PartitionId.ProtoReflect.Descriptor instead.
[ { "docid": "401d3c87d6868ab5d4dc12d05fcc8f5e", "score": "0.7199994", "text": "func (*PartitionId) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_storage_proto_rawDescGZIP(), []int{5}\n}", "title": "" } ]
[ { "docid": "5c1010c03f52feadf2edf52c74aff2b4", "score": "0.63852584", "text": "func (*PartnerId) Descriptor() ([]byte, []int) {\n\treturn file_prodpb_partner_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "6ab1c9c61f06fb26eada75ca26c958ce", "score": "0.63781697", "text": "func (*GetTopicByIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_protobufs_topic_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b350fd29446d8f5f8b1846cab2c5d3c3", "score": "0.63185143", "text": "func (*UpdateGroupParticipantDeleted) Descriptor() ([]byte, []int) {\n\treturn file_updates_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "452969be5135cd69c3b70a706ad4721e", "score": "0.62867516", "text": "func (*FieldId) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_storage_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "8b1f6fcbb30dc6bfe0e5464660c5baa6", "score": "0.6280092", "text": "func (*DeletedKeys) Descriptor() ([]byte, []int) {\n\treturn file_OmClientProtocol_proto_rawDescGZIP(), []int{77}\n}", "title": "" }, { "docid": "b2e3644a31168052ca978687301380a9", "score": "0.6263965", "text": "func (*Partition) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_visionai_v1_warehouse_proto_rawDescGZIP(), []int{67}\n}", "title": "" }, { "docid": "07e55170c802e17aa35ae87558e47167", "score": "0.617648", "text": "func (*EntityId) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_storage_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "08a797e7673d71e89ee12fadbdd343d9", "score": "0.6175998", "text": "func (*GetTopicByIdResponse) Descriptor() ([]byte, []int) {\n\treturn file_internal_protobufs_topic_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "c93ad1bc76a7e8ff0206ad224304f2f8", "score": "0.6156941", "text": "func (*Message2463) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "cb7abea61e91dfd100cdad01b5621469", "score": "0.615521", "text": "func (*UpdateMessagesDeleted) Descriptor() ([]byte, []int) {\n\treturn file_updates_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "768b87ac89638e17a4fd3057a6f8d6f7", "score": "0.6144989", "text": "func (*ExternalId) Descriptor() ([]byte, []int) {\n\treturn file_cpaper_asservice_cpaper_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "dd440b8d86dbd6bebe8eb008acefd3d8", "score": "0.61355454", "text": "func (*DeprecatedMessage) Descriptor() ([]byte, []int) {\n\treturn file_cmd_protoc_gen_go_testdata_comments_deprecated_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "4198fa4c394174456b3d1f4452d9eeec", "score": "0.6124706", "text": "func (*Message12685) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "a89c82476a6ca08265a1822353999c3b", "score": "0.61156875", "text": "func (*Message3922) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{32}\n}", "title": "" }, { "docid": "841c47c3ef373c2a8bb6e08b0305460b", "score": "0.61128145", "text": "func (*ID) Descriptor() ([]byte, []int) {\n\treturn file_proto_subscription_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "1080c35c9213141f1b91359648e98fdf", "score": "0.6112721", "text": "func (*Message12797) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "9817c1649ef24d71804630941fbaebaa", "score": "0.6107608", "text": "func (*Message2462) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "de19e6b8c229eec6f9329e1709fd9dce", "score": "0.60986376", "text": "func (*Message12776) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "8055b133e64c32ed7217aba41bd3d61b", "score": "0.60924816", "text": "func (*StreamTracesMessage_Identifier) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_trace_v2_trace_service_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "a15031077541511ad52d9cc6e32887a2", "score": "0.6090053", "text": "func (*ExternalIds) Descriptor() ([]byte, []int) {\n\treturn file_jwtsearchservice_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "92d2a11771696b691d7a6174818f76ad", "score": "0.60813755", "text": "func (desc *immutable) DescriptorProto() *descpb.Descriptor {\n\treturn &descpb.Descriptor{\n\t\tUnion: &descpb.Descriptor_Type{\n\t\t\tType: &desc.TypeDescriptor,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "fc3be3285dca5e8d166a69a2c876691b", "score": "0.6076595", "text": "func (*Message7843) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{35}\n}", "title": "" }, { "docid": "22f7b4344203f07f1a130fb345c0e510", "score": "0.6064021", "text": "func (*DeleteClusterMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_cluster_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "fb1f4ca3c62245a7c936df6012888694", "score": "0.60421705", "text": "func (*DeleteCloudMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_resourcemanager_v1_cloud_service_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "c0b2db1830c5afc6292cefc9bfc5aaf5", "score": "0.6039652", "text": "func (*DeletePolicyMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_backup_v1_policy_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "f384ea318669d2eb9d8cfce72ecfc653", "score": "0.60354084", "text": "func (*Message12798) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "b9bc4808470237b9a2829695ff4b24ed", "score": "0.6031546", "text": "func (*Message6109) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "059d90cc90c5978386e9e190c2636e92", "score": "0.60300773", "text": "func (*Details) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_provenance_api_spikepb_ids_inspect_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "16ae9b782e721da615793c7c2aa0fdc7", "score": "0.6022949", "text": "func (*Message3886_Message3887) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{30, 0}\n}", "title": "" }, { "docid": "08fb1d05a2fb39f0211befdef9f5c002", "score": "0.6022028", "text": "func (*DeleteSubclusterMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_dataproc_v1_subcluster_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "3f09d6edb908f11ed50789a35d4994a6", "score": "0.60201263", "text": "func (*Message3886) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{30}\n}", "title": "" }, { "docid": "53811166261571b8190f87740b338976", "score": "0.60190815", "text": "func (*UpdateLabelDeleted) Descriptor() ([]byte, []int) {\n\treturn file_updates_proto_rawDescGZIP(), []int{33}\n}", "title": "" }, { "docid": "ca9ba48b4fbdfa82710afbbee7885466", "score": "0.6017177", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_task_service_interface_proto_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "d03fffe7d3d6a26122105b16db7cf633", "score": "0.6012527", "text": "func (*Message7864) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{31}\n}", "title": "" }, { "docid": "6fb0c6d3bb7ae76de194adeab2ded8a0", "score": "0.60068864", "text": "func (*Message7929) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "133d3ab48469176d5f3a8816d30a9630", "score": "0.6006468", "text": "func (*Message11947) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "1ce8e298f18ecd03e4c90946f8d3e440", "score": "0.60019195", "text": "func (*Message6643) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "7e6cf5daca0bc75bba25b29257447b36", "score": "0.6000271", "text": "func (*TypedClusterObjectRef) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_skv2_api_core_v1_core_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "0689f51341fdf6ca2fa1b8a1f9666563", "score": "0.5997198", "text": "func (*InterfaceMessageId) Descriptor() ([]byte, []int) {\n\treturn file_e2sm_rsm_v1_e2sm_v2_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "0d28a30a7e121f27c52ada06bef1a90c", "score": "0.5996247", "text": "func (*Message3046) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "930c3f07cbafcb01e10415d4d0ae8620", "score": "0.5982294", "text": "func (*RemoveTopic) Descriptor() ([]byte, []int) {\n\treturn file_p2pnext_proto_rawDescGZIP(), []int{41}\n}", "title": "" }, { "docid": "8f54f44d28a00424f5153c7701ba8218", "score": "0.5978384", "text": "func (*Delete) Descriptor() ([]byte, []int) {\n\treturn file_tck_valueentity_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "1215646cd903c3d05c732552ea6cb490", "score": "0.59674734", "text": "func (*Message3041) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "aa0268aa63335583897c827b6bd92943", "score": "0.5958664", "text": "func (*Partner) Descriptor() ([]byte, []int) {\n\treturn file_prodpb_partner_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a11db6511317e7e3c15dd59f05246cdb", "score": "0.59582514", "text": "func (*Message3052) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{33}\n}", "title": "" }, { "docid": "ad85cb8487299d7ff602e1d109f4662d", "score": "0.5958171", "text": "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_OmClientProtocol_proto_rawDescGZIP(), []int{112}\n}", "title": "" }, { "docid": "60418df37eafcd2b4cc0ecb3dbb1802f", "score": "0.5957513", "text": "func (*Message1374) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "80b5922d420ac3b8407ad1d6152650f4", "score": "0.5956169", "text": "func (*Message12949) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "26f60d6d0ecc41ae077448668754924f", "score": "0.59538865", "text": "func (*DelPartnerResponse) Descriptor() ([]byte, []int) {\n\treturn file_prodpb_partner_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "88ad9758f8ac4435211773d4da65e54d", "score": "0.5951902", "text": "func (*Message10320) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "3669ea3693388c271429f483d5e70357", "score": "0.59421736", "text": "func (*Message3061_Message3066) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{5, 4}\n}", "title": "" }, { "docid": "6622ec177187dc669d0bca91b8c9c569", "score": "0.5939346", "text": "func (*MessageId) Descriptor() ([]byte, []int) {\n\treturn file_proto_logistics_message_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "a66eff145490877c405710d7c8a6a4ee", "score": "0.5939207", "text": "func (*Message11975) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "ba015c5033d884c001d6e819a7c79d9e", "score": "0.5936351", "text": "func (*LocalObjectReferenceSecret) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_pod_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "98cc0b0672865b090771bc2ca8e6cce9", "score": "0.5933322", "text": "func (*RevokeMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_backup_v1_policy_service_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "873730a0c533555d808494b1a6a8eec9", "score": "0.5930846", "text": "func (*Message8774) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "daf97cda0d2283487aadf67109335c8d", "score": "0.5928285", "text": "func (*SubTopic) Descriptor() ([]byte, []int) {\n\treturn file_p2pnext_proto_rawDescGZIP(), []int{34}\n}", "title": "" }, { "docid": "00e65c3497cf15c06cb9aa36ce7aa3ac", "score": "0.5928103", "text": "func (*TopicDescriptor) Descriptor() ([]byte, []int) {\n\treturn file_jnx_dds_types_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "824c655207fc7dee9bb0bad3759434ad", "score": "0.5927378", "text": "func (*VirtualDisks) Descriptor() ([]byte, []int) {\n\treturn file_proto_redfish_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "d460a700329fab2cf8fe5e97f35fa51d", "score": "0.5925881", "text": "func (*RecordKey) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_storage_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "db06219d41b4a4dc28cc0d5a44aa84b0", "score": "0.5925113", "text": "func (*PeerID) Descriptor() ([]byte, []int) {\n\treturn file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "7a62a58d877bf5f1cb99c592f0df6491", "score": "0.5917309", "text": "func (*Message3061_Message3063) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{5, 1}\n}", "title": "" }, { "docid": "8e9f73da191aa4d0b0f3e99a472da498", "score": "0.5914188", "text": "func (*Message7287) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "f2815080b86160198322110f9fd780d5", "score": "0.5909857", "text": "func (*Message8575) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{34}\n}", "title": "" }, { "docid": "d4364e5ac86dbf95026529eea2118eaf", "score": "0.5909496", "text": "func (*DeleteProcessorVersionMetadata) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1beta3_document_processor_service_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "0d73c4026ecc6f132e5cb7bf7f851200", "score": "0.59078753", "text": "func (x *fastReflection_MsgCreateGroupPolicy) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgCreateGroupPolicy\n}", "title": "" }, { "docid": "e10eec492d2e8fffa81e7dd4515b50b7", "score": "0.5904545", "text": "func (*Message12825) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "8d86d15f229ae98675dc4682a623d84d", "score": "0.5900593", "text": "func (*Message12686) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "8f2d91a52cbd38b3dd506ef972ea618d", "score": "0.5900572", "text": "func (*StoredType) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_storage_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "31f412b455b6a5f2f208c2c6849cc729", "score": "0.5894128", "text": "func (*PartitionDiskRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_kubernetes_csi_csi_proxy_client_api_disk_v1beta3_api_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "9b0ff3a6cef227f946e04a7a7ea9b757", "score": "0.5894108", "text": "func (*SecretId) Descriptor() ([]byte, []int) {\n\treturn file_external_data_feed_data_feed_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "643f24bb91f8cf3ee0c5fa5d2763a372", "score": "0.589253", "text": "func (*Message11949) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "6ca7f8a4e2b91fadda3527752c8ff2eb", "score": "0.5891442", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_invites_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "3373c9d3eb85442ddfcefd3ac8fa0957", "score": "0.58909845", "text": "func (*DeletePredecessorReplicaKeyReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_chord_proto_rawDescGZIP(), []int{29}\n}", "title": "" }, { "docid": "8f5b9efbcd611ef646646480f99da681", "score": "0.5888643", "text": "func (*IdSeguimiento) Descriptor() ([]byte, []int) {\n\treturn file_chatCliente_chatCliente_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "0f07ebb00ec71bd8ad71a75ee100e697", "score": "0.58796614", "text": "func (*Partners) Descriptor() ([]byte, []int) {\n\treturn file_prodpb_partner_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "ac84f8d317f9dd7bb59e5c65d32b405e", "score": "0.58788407", "text": "func (*Partition_TemporalPartition) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_visionai_v1_warehouse_proto_rawDescGZIP(), []int{67, 0}\n}", "title": "" }, { "docid": "d0fac1709effe963a36ffd832f39e979", "score": "0.5876107", "text": "func (*DeletePredecessorReplicaKeyResp) Descriptor() ([]byte, []int) {\n\treturn file_proto_chord_proto_rawDescGZIP(), []int{30}\n}", "title": "" }, { "docid": "f9adb2641dc52bef84574aa5f705216f", "score": "0.5875303", "text": "func (*DatasetListProto) Descriptor() ([]byte, []int) {\n\treturn file_metadata_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "9d7fffa7fdd7ad0c3a53e09a19a955a8", "score": "0.5874691", "text": "func (*Message8572) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "82bbd8ef6424a07455d1b86e6255839c", "score": "0.5871057", "text": "func (*DelGroupNotice) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{44}\n}", "title": "" }, { "docid": "4bbb853c05360f2eea2da4b3b88a5bf1", "score": "0.58600795", "text": "func (*SqlTranslationWarning) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_bigquery_migration_v2alpha_translation_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "937b4f3cd6cc722632aaa0619d023ed5", "score": "0.58537376", "text": "func (*PartKeyInfo) Descriptor() ([]byte, []int) {\n\treturn file_OmClientProtocol_proto_rawDescGZIP(), []int{98}\n}", "title": "" }, { "docid": "5e9e085c2e9166c1934ae56f4c41edae", "score": "0.5845611", "text": "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_task_service_interface_proto_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "051933634a81c1529323c1d33100a68a", "score": "0.5845429", "text": "func (*DeleteOptions) Descriptor() ([]byte, []int) {\n\treturn file_runtime_runtime_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "2143c1df053e1c9671a50d0d226fcab1", "score": "0.5845388", "text": "func (*AlgorithmId) Descriptor() ([]byte, []int) {\n\treturn file_supervisor_proto_supervisor_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "7d3505e4d0b0a5b7b615219fafcbcecd", "score": "0.5845383", "text": "func (*GetPartnerRequest) Descriptor() ([]byte, []int) {\n\treturn file_prodpb_partner_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "487ad56812833c5182a1c0dcc4dda093", "score": "0.58446085", "text": "func (*UpdateSubclusterMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_dataproc_v1_subcluster_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "cd5e1317b99b68044860cc1f00cdee60", "score": "0.58409536", "text": "func (*Id) Descriptor() ([]byte, []int) {\n\treturn file_user_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "afa4aba12c1498e2393f15c033d6af60", "score": "0.5840704", "text": "func (*Message6133) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "d1afbefb225d156603999d7aa1d3abb6", "score": "0.5839657", "text": "func (*PruneRequest) Descriptor() ([]byte, []int) {\n\treturn file_com_daml_ledger_api_v1_admin_participant_pruning_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "bfa9483afe5565f679587700f849c751", "score": "0.5839529", "text": "func (*Message8587) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "f0622bbf47c1f859dc34b3d7a2d6f2ef", "score": "0.5832152", "text": "func (*MetricDescriptorChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_monitoring_proto_v3_metric_descriptor_change_proto_rawDescGZIP(), []int{0, 3}\n}", "title": "" }, { "docid": "9b3755acf8b32f4bb19c6a1b4d9a8cab", "score": "0.5830216", "text": "func (*DeletePortMsg) Descriptor() ([]byte, []int) {\n\treturn file_ports_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "79249839eec2f26d5249aacf5b8e085c", "score": "0.5827728", "text": "func (*UpdateCloudMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_resourcemanager_v1_cloud_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "d7cb0cb04ae051fcdb2125ec226c970d", "score": "0.58228445", "text": "func (x *fastReflection_MsgDeposit) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgDeposit\n}", "title": "" }, { "docid": "a50bc14bee3caf1009c427479277f0ee", "score": "0.58228326", "text": "func (*DeviceID) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_cloud_go_services_device_protos_device_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "cb920097c80bc42f24290e7076cd5f77", "score": "0.58206785", "text": "func (*Message8590) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "1a7a669568bb18307b7dd181a8275e12", "score": "0.5820071", "text": "func (*DeletedGroupColumnNamesInfo) Descriptor() ([]byte, []int) {\n\treturn file_gdb_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "0451e705c61bb86bc0a468872cdaff44", "score": "0.5817733", "text": "func (*Message3061) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{5}\n}", "title": "" } ]
1e4568aa1203a33cdb7a7b4d6641e996
PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. freq: the time to wait between intervals in absence of a RetryAfter header. Allowed minimum is one second. A good starting value is 30 seconds. Note that some resources might benefit from a different value.
[ { "docid": "097f669b2e7a004c553ea1f2e38ab819", "score": "0.0", "text": "func (l DatabaseAccountsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabaseAccountsUpdateResponse, error) {\n\trespType := DatabaseAccountsUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DatabaseAccountGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" } ]
[ { "docid": "5b57531cadd7c4263a1d1c0baac4b8bb", "score": "0.6163341", "text": "func (l CassandraResourcesUpdateCassandraKeyspaceThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesUpdateCassandraKeyspaceThroughputResponse, error) {\n\trespType := CassandraResourcesUpdateCassandraKeyspaceThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "6a0cc21c7b4048211171678bedd27ab6", "score": "0.61524844", "text": "func (l CloudServicesStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesStartResponse, error) {\n\trespType := CloudServicesStartResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "0111baa2271f8ab14430277a8524b325", "score": "0.6018962", "text": "func (l CloudServicesPowerOffPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesPowerOffResponse, error) {\n\trespType := CloudServicesPowerOffResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "7a8253ce7f773af712bcf1c773b36cca", "score": "0.60126585", "text": "func (l CassandraResourcesUpdateCassandraTableThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesUpdateCassandraTableThroughputResponse, error) {\n\trespType := CassandraResourcesUpdateCassandraTableThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "052dbcd95910ab5074590c6599cc3b35", "score": "0.6000789", "text": "func (l TableResourcesUpdateTableThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TableResourcesUpdateTableThroughputResponse, error) {\n\trespType := TableResourcesUpdateTableThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "5b74211b9aec1b2469ea148bafedc373", "score": "0.5962847", "text": "func (l LogAnalyticsExportRequestRateByIntervalPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LogAnalyticsExportRequestRateByIntervalResponse, error) {\n\trespType := LogAnalyticsExportRequestRateByIntervalResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LogAnalyticsOperationResult)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "027a5ff8256460abe7164992c5d2f3e0", "score": "0.5957875", "text": "func (l CloudServicesRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesRestartResponse, error) {\n\trespType := CloudServicesRestartResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "d23874d7302a53e73b50d7f827490d31", "score": "0.5943672", "text": "func (l CloudServicesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesDeleteResponse, error) {\n\trespType := CloudServicesDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "accc2b19b810ae7098944dab05dbc298", "score": "0.59311163", "text": "func (l DiskPoolsClientStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskPoolsClientStartResponse, error) {\n\trespType := DiskPoolsClientStartResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "4951c44fa82c0f7d4122239b8a013fcf", "score": "0.5901436", "text": "func (l OutboundFirewallRulesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OutboundFirewallRulesClientDeleteResponse, error) {\n\trespType := OutboundFirewallRulesClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "1728e34f6ec8dbaf6cfad63b6e628bcf", "score": "0.58688045", "text": "func (l SolutionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SolutionsDeleteResponse, error) {\n\trespType := SolutionsDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "6ef16bb563d38b44f035921983f44f41", "score": "0.5851899", "text": "func (l GremlinResourcesUpdateGremlinGraphThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesUpdateGremlinGraphThroughputResponse, error) {\n\trespType := GremlinResourcesUpdateGremlinGraphThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "aeed9238ea9c471bb8b6527283c73b7d", "score": "0.58320385", "text": "func (l LogAnalyticsExportThrottledRequestsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LogAnalyticsExportThrottledRequestsResponse, error) {\n\trespType := LogAnalyticsExportThrottledRequestsResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LogAnalyticsOperationResult)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "60844c878f472618fb21ce478027650d", "score": "0.5828567", "text": "func (l CloudServicesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesUpdateResponse, error) {\n\trespType := CloudServicesUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CloudService)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "9c0c40e59236460add3082370246160b", "score": "0.5821969", "text": "func (l CloudServicesRebuildPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesRebuildResponse, error) {\n\trespType := CloudServicesRebuildResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "bcca39a8d7bf03c7ee940cb07f215d5d", "score": "0.5815619", "text": "func (l SQLResourcesUpdateSQLDatabaseThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesUpdateSQLDatabaseThroughputResponse, error) {\n\trespType := SQLResourcesUpdateSQLDatabaseThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "2853957e78cecf8c21292f85a9634e03", "score": "0.58077645", "text": "func (l DatabaseVulnerabilityAssessmentScansClientInitiateScanPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabaseVulnerabilityAssessmentScansClientInitiateScanResponse, error) {\n\trespType := DatabaseVulnerabilityAssessmentScansClientInitiateScanResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "c64400ef10aa6b56d1caded79b29b420", "score": "0.5804268", "text": "func (l SQLResourcesUpdateSQLContainerThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesUpdateSQLContainerThroughputResponse, error) {\n\trespType := SQLResourcesUpdateSQLContainerThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "545baa3ab743b4c6cccd542325c6d006", "score": "0.5799942", "text": "func (l LinkedServicesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LinkedServicesDeleteResponse, error) {\n\trespType := LinkedServicesDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LinkedService)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "db4c6b24fb4c3b235d7d1ee0a17e1f2d", "score": "0.5756958", "text": "func (l CassandraResourcesMigrateCassandraKeyspaceToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesMigrateCassandraKeyspaceToManualThroughputResponse, error) {\n\trespType := CassandraResourcesMigrateCassandraKeyspaceToManualThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "15b2761112e1cc1be11ac3b2d37f7653", "score": "0.57432497", "text": "func (l GremlinResourcesUpdateGremlinDatabaseThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesUpdateGremlinDatabaseThroughputResponse, error) {\n\trespType := GremlinResourcesUpdateGremlinDatabaseThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "ccd46c883a6a3feaf91ff8a00ffd2e92", "score": "0.5740669", "text": "func (l SQLResourcesDeleteSQLUserDefinedFunctionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesDeleteSQLUserDefinedFunctionResponse, error) {\n\trespType := SQLResourcesDeleteSQLUserDefinedFunctionResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "bd18616251d453638ad46cab5cd37e17", "score": "0.57400167", "text": "func (l AccountsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsClientDeleteResponse, error) {\n\trespType := AccountsClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "669566537b8f3597d8fd3f27e2c55411", "score": "0.57073635", "text": "func (l MongoDBResourcesUpdateMongoDBDatabaseThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesUpdateMongoDBDatabaseThroughputResponse, error) {\n\trespType := MongoDBResourcesUpdateMongoDBDatabaseThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "06cf7b433fd1357d82b31489061bc6cf", "score": "0.57062167", "text": "func (l MongoDBResourcesUpdateMongoDBCollectionThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesUpdateMongoDBCollectionThroughputResponse, error) {\n\trespType := MongoDBResourcesUpdateMongoDBCollectionThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "02c9ad92543fa01083b0bf8bdfd6c236", "score": "0.5693787", "text": "func (l OutboundFirewallRulesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OutboundFirewallRulesClientCreateOrUpdateResponse, error) {\n\trespType := OutboundFirewallRulesClientCreateOrUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OutboundFirewallRule)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "cc5010435a899b300bc67c448093ee49", "score": "0.5669773", "text": "func (l ManagedDatabaseVulnerabilityAssessmentScansClientInitiateScanPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedDatabaseVulnerabilityAssessmentScansClientInitiateScanResponse, error) {\n\trespType := ManagedDatabaseVulnerabilityAssessmentScansClientInitiateScanResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "b0747a81bf863371e62d0bd08faa540a", "score": "0.56548685", "text": "func (l CloudServicesReimagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesReimageResponse, error) {\n\trespType := CloudServicesReimageResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "39b7662b856798acbebb4193f87c7a7a", "score": "0.56512827", "text": "func (l VirtualMachinesStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesStartResponse, error) {\n\trespType := VirtualMachinesStartResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "93547daf2590ae21e51797da8ac0597a", "score": "0.56483454", "text": "func (l GremlinResourcesMigrateGremlinGraphToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesMigrateGremlinGraphToManualThroughputResponse, error) {\n\trespType := GremlinResourcesMigrateGremlinGraphToManualThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "05e94637a987bb2d46043f3984714bf2", "score": "0.5636525", "text": "func (l CassandraResourcesDeleteCassandraKeyspacePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesDeleteCassandraKeyspaceResponse, error) {\n\trespType := CassandraResourcesDeleteCassandraKeyspaceResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "ab87c18c94f461855fd5d74009331f47", "score": "0.56358343", "text": "func (l VirtualNetworkRulesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkRulesClientDeleteResponse, error) {\n\trespType := VirtualNetworkRulesClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "610c7333f4abdbdde411935c05410901", "score": "0.56341106", "text": "func (l DeletedServersClientRecoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeletedServersClientRecoverResponse, error) {\n\trespType := DeletedServersClientRecoverResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeletedServer)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "11f2e802143c90dd217f266198ed2c03", "score": "0.56315166", "text": "func (l TableResourcesDeleteTablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TableResourcesDeleteTableResponse, error) {\n\trespType := TableResourcesDeleteTableResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "aa6493d923df8ffba586bfe3b340e2c7", "score": "0.56276304", "text": "func (l IscsiTargetsClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IscsiTargetsClientUpdateResponse, error) {\n\trespType := IscsiTargetsClientUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.IscsiTarget)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "75c8a912a54ae240f19490fcb7e8b520", "score": "0.5622229", "text": "func (l LinkedServicesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LinkedServicesCreateOrUpdateResponse, error) {\n\trespType := LinkedServicesCreateOrUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LinkedService)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "bbafb4ae7c66fd1781813f72d2f1d12a", "score": "0.5621961", "text": "func (l TableResourcesMigrateTableToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TableResourcesMigrateTableToManualThroughputResponse, error) {\n\trespType := TableResourcesMigrateTableToManualThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "d2494b58bde3f2457a182c01b7e9eaba", "score": "0.5614627", "text": "func (l VirtualMachinesRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesRestartResponse, error) {\n\trespType := VirtualMachinesRestartResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "0c78ee1a44d08314eb910a1d19843c19", "score": "0.5613139", "text": "func (l CertificateClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CertificateClientDeleteResponse, error) {\n\trespType := CertificateClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "6add3b34f8589ea637968c71035f8490", "score": "0.5600868", "text": "func (l CloudServicesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesCreateOrUpdateResponse, error) {\n\trespType := CloudServicesCreateOrUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CloudService)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "3e33f89e6a27dc0a7a77b53d7aba18fe", "score": "0.5595594", "text": "func (l AccountsClientFailoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsClientFailoverResponse, error) {\n\trespType := AccountsClientFailoverResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "9cd9982c0f06f6799986531b9f5a0b91", "score": "0.55915755", "text": "func (l SQLResourcesCreateUpdateSQLUserDefinedFunctionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesCreateUpdateSQLUserDefinedFunctionResponse, error) {\n\trespType := SQLResourcesCreateUpdateSQLUserDefinedFunctionResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SQLUserDefinedFunctionGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "1c598014a0f68e7c204446afc129609f", "score": "0.55880654", "text": "func (l SolutionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SolutionsUpdateResponse, error) {\n\trespType := SolutionsUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Solution)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "91de96cd54040d2beb2d518e38158ee2", "score": "0.5584694", "text": "func (l DatabaseAccountsRegenerateKeyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabaseAccountsRegenerateKeyResponse, error) {\n\trespType := DatabaseAccountsRegenerateKeyResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "6df8195511f4a99cfafe4effa4e6d7f0", "score": "0.5578447", "text": "func (l ServersClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersClientDeleteResponse, error) {\n\trespType := ServersClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "195eba444bc3f7964c7ff842451dee0d", "score": "0.55754966", "text": "func (l ServerKeysClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerKeysClientDeleteResponse, error) {\n\trespType := ServerKeysClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "e2b89458f617c7eff9b2a7295928aa10", "score": "0.55739", "text": "func (l CassandraResourcesCreateUpdateCassandraKeyspacePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesCreateUpdateCassandraKeyspaceResponse, error) {\n\trespType := CassandraResourcesCreateUpdateCassandraKeyspaceResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CassandraKeyspaceGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "6f0f9628a21eca7e19c50403f9f88afc", "score": "0.5573231", "text": "func (l DiskPoolsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskPoolsClientDeleteResponse, error) {\n\trespType := DiskPoolsClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "6b9fff8a2a4cf7ff013a6d979ba48870", "score": "0.55731064", "text": "func (l CassandraResourcesMigrateCassandraTableToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesMigrateCassandraTableToManualThroughputResponse, error) {\n\trespType := CassandraResourcesMigrateCassandraTableToManualThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "f230d93f1471477e9c011914750928b1", "score": "0.5571393", "text": "func (l SQLResourcesDeleteSQLStoredProcedurePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesDeleteSQLStoredProcedureResponse, error) {\n\trespType := SQLResourcesDeleteSQLStoredProcedureResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "5c3aadd36a438b9331638b62d2673c73", "score": "0.55670005", "text": "func (l VirtualMachinesPerformMaintenancePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesPerformMaintenanceResponse, error) {\n\trespType := VirtualMachinesPerformMaintenanceResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "246c6e78fb69e44fb2a0da0748f36c29", "score": "0.55586517", "text": "func (l AccountClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountClientDeleteResponse, error) {\n\trespType := AccountClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "c3816f85733641f7440974db13228a46", "score": "0.5555459", "text": "func (l ServersClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersClientUpdateResponse, error) {\n\trespType := ServersClientUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Server)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "649a1c3741ac72a58ea08c397a82fc38", "score": "0.55514824", "text": "func (l VirtualMachinesReapplyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesReapplyResponse, error) {\n\trespType := VirtualMachinesReapplyResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "a2445f825e85d7d44daf8f165df4965e", "score": "0.5551206", "text": "func (l NamespacesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamespacesClientDeleteResponse, error) {\n\trespType := NamespacesClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "5840d7d3751aee9d394201909f3e8717", "score": "0.5548662", "text": "func (l SQLResourcesMigrateSQLContainerToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesMigrateSQLContainerToManualThroughputResponse, error) {\n\trespType := SQLResourcesMigrateSQLContainerToManualThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "38cd331b0be5c765a86d0a60139ed61b", "score": "0.5548058", "text": "func (l TicketsClientCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TicketsClientCreateResponse, error) {\n\trespType := TicketsClientCreateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.TicketDetails)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "9b2e03a1e1c3487e8c9895c3325d4a72", "score": "0.55424774", "text": "func (l SQLResourcesMigrateSQLDatabaseToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesMigrateSQLDatabaseToManualThroughputResponse, error) {\n\trespType := SQLResourcesMigrateSQLDatabaseToManualThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "a5403780723df5c2dc79ffa250148295", "score": "0.55387974", "text": "func (l IscsiTargetsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IscsiTargetsClientDeleteResponse, error) {\n\trespType := IscsiTargetsClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "a7a5da2bafd8134814e953ebd3852b84", "score": "0.553603", "text": "func (l NotebookWorkspacesStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NotebookWorkspacesStartResponse, error) {\n\trespType := NotebookWorkspacesStartResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "53aec489afd7936f993b33b479719f4e", "score": "0.55307376", "text": "func (l CassandraResourcesDeleteCassandraTablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesDeleteCassandraTableResponse, error) {\n\trespType := CassandraResourcesDeleteCassandraTableResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "2730fa34505e22a27467fe145ddd8530", "score": "0.5530504", "text": "func (l DatabasesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesClientDeleteResponse, error) {\n\trespType := DatabasesClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "fc1cb0819474b15ad772d30d3910b141", "score": "0.55290115", "text": "func (l DiskPoolsClientDeallocatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskPoolsClientDeallocateResponse, error) {\n\trespType := DiskPoolsClientDeallocateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "50519a6f0e98158a2ad722eca34056f5", "score": "0.5527774", "text": "func (l VirtualMachineScaleSetVMsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsStartResponse, error) {\n\trespType := VirtualMachineScaleSetVMsStartResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "f812b847e08db1a74c5b97861d658e89", "score": "0.5521594", "text": "func (l ElasticPoolsClientFailoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ElasticPoolsClientFailoverResponse, error) {\n\trespType := ElasticPoolsClientFailoverResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "a76b01214cc70ce90b5d7020341fa8ab", "score": "0.55200577", "text": "func (l DiskPoolsClientUpgradePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskPoolsClientUpgradeResponse, error) {\n\trespType := DiskPoolsClientUpgradeResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "e06518bf78b54be8f57c416e543c6710", "score": "0.5519337", "text": "func (l VirtualMachineScaleSetVMsPerformMaintenancePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsPerformMaintenanceResponse, error) {\n\trespType := VirtualMachineScaleSetVMsPerformMaintenanceResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "098a2308954937319f9a42cbdf5a94ac", "score": "0.55053055", "text": "func (l TdeCertificatesClientCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TdeCertificatesClientCreateResponse, error) {\n\trespType := TdeCertificatesClientCreateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "d61348ad29b9e90b28a1cc8b9eb8cd4b", "score": "0.5502312", "text": "func (l CassandraClustersStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraClustersStartResponse, error) {\n\trespType := CassandraClustersStartResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "9b8466fb5e0dc2e8bb5725561a905059", "score": "0.5500795", "text": "func (l VirtualMachineScaleSetVMsRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsRestartResponse, error) {\n\trespType := VirtualMachineScaleSetVMsRestartResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "d6f6b2332e83ea67d0cf866af8d414a2", "score": "0.5485521", "text": "func (l NotebookWorkspacesRegenerateAuthTokenPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NotebookWorkspacesRegenerateAuthTokenResponse, error) {\n\trespType := NotebookWorkspacesRegenerateAuthTokenResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "bc07d1d55efad78d0089e4b14c0dfcb5", "score": "0.5474008", "text": "func (l VirtualMachineScaleSetRollingUpgradesCancelPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetRollingUpgradesCancelResponse, error) {\n\trespType := VirtualMachineScaleSetRollingUpgradesCancelResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "0d5f55f52e2f8a02f6379e4c472cba62", "score": "0.5473669", "text": "func (l GremlinResourcesMigrateGremlinDatabaseToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesMigrateGremlinDatabaseToManualThroughputResponse, error) {\n\trespType := GremlinResourcesMigrateGremlinDatabaseToManualThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "ab39d5666a87c2c4d510b84d42c97e03", "score": "0.54714036", "text": "func (l EncryptionProtectorsClientRevalidatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EncryptionProtectorsClientRevalidateResponse, error) {\n\trespType := EncryptionProtectorsClientRevalidateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "36b3123e7193ec5498be265c9e1451b7", "score": "0.54686683", "text": "func (l SQLResourcesCreateUpdateSQLStoredProcedurePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesCreateUpdateSQLStoredProcedureResponse, error) {\n\trespType := SQLResourcesCreateUpdateSQLStoredProcedureResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SQLStoredProcedureGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "cdb223bb02923d6bd23bed8152628227", "score": "0.5464317", "text": "func (l ActionGroupsClientPostTestNotificationsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ActionGroupsClientPostTestNotificationsResponse, error) {\n\trespType := ActionGroupsClientPostTestNotificationsResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.TestNotificationResponse)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "706266ac05e3177ddd9f72ed24ac4837", "score": "0.54590005", "text": "func (l DatabaseAccountsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabaseAccountsDeleteResponse, error) {\n\trespType := DatabaseAccountsDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "3c1d1d375f1d6e17c2d65a23d9f5165c", "score": "0.5457405", "text": "func (l DiskPoolsClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskPoolsClientUpdateResponse, error) {\n\trespType := DiskPoolsClientUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DiskPool)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "3316047ee69606bf6d1fcb9ef306b171", "score": "0.54449195", "text": "func (l PoolClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PoolClientDeleteResponse, error) {\n\trespType := PoolClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "5abdb89c45a6b40ca8aafa9451245c0b", "score": "0.5442173", "text": "func (l SyncAgentsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SyncAgentsClientDeleteResponse, error) {\n\trespType := SyncAgentsClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "db30753bc9a447a8e352ba01f4a9abe7", "score": "0.54407275", "text": "func (l ElasticPoolsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ElasticPoolsClientDeleteResponse, error) {\n\trespType := ElasticPoolsClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "43067fe347537663a91d818859033c23", "score": "0.54391706", "text": "func (l CloudServicesUpdateDomainWalkUpdateDomainPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesUpdateDomainWalkUpdateDomainResponse, error) {\n\trespType := CloudServicesUpdateDomainWalkUpdateDomainResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "2a3a92bea1898dc848df5b1038e5619b", "score": "0.54389524", "text": "func (l SQLResourcesDeleteSQLTriggerPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesDeleteSQLTriggerResponse, error) {\n\trespType := SQLResourcesDeleteSQLTriggerResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "6befed57016c31ec371edaf8bce8e3ab", "score": "0.54372925", "text": "func (l AccountsClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsClientUpdateResponse, error) {\n\trespType := AccountsClientUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Account)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "73a8c6d650a017fb297d8fe923224640", "score": "0.5434733", "text": "func (l VirtualMachinesPowerOffPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesPowerOffResponse, error) {\n\trespType := VirtualMachinesPowerOffResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "54b77ebd62e01ae2efa59f5d0afc8948", "score": "0.543244", "text": "func (l ReplicationLinksClientFailoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ReplicationLinksClientFailoverResponse, error) {\n\trespType := ReplicationLinksClientFailoverResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "188364184871534dc0c2596065cfde2d", "score": "0.54318434", "text": "func (l WorkspacesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesDeleteResponse, error) {\n\trespType := WorkspacesDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "f0ab6d913f1712bd3306ff86ebd5e702", "score": "0.5428464", "text": "func (l JobAgentsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (JobAgentsClientDeleteResponse, error) {\n\trespType := JobAgentsClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "e4afb7504f0c2e6a3d33eac9abfdab5c", "score": "0.54176086", "text": "func (l VirtualMachinesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesDeleteResponse, error) {\n\trespType := VirtualMachinesDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "63c372f44c9e76b7033501ced53ddb50", "score": "0.54135996", "text": "func (l VirtualNetworkRulesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkRulesClientCreateOrUpdateResponse, error) {\n\trespType := VirtualNetworkRulesClientCreateOrUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkRule)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "18bae0f50fc6fe47a4b4702e436e9ad2", "score": "0.5411019", "text": "func (l CassandraDataCentersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraDataCentersDeleteResponse, error) {\n\trespType := CassandraDataCentersDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "63cacb22a3d78d9a6c9246baa2c002f3", "score": "0.5410753", "text": "func (l DiskAccessesDeleteAPrivateEndpointConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskAccessesDeleteAPrivateEndpointConnectionResponse, error) {\n\trespType := DiskAccessesDeleteAPrivateEndpointConnectionResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "ccdf8deea8030d0ca3480a9ca204d3ad", "score": "0.5409266", "text": "func (l MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputResponse, error) {\n\trespType := MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "e8df435347e580d00e2ac5a46ec59d9c", "score": "0.54091996", "text": "func (l NamespacesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamespacesDeleteResponse, error) {\n\trespType := NamespacesDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "39af9b1119b8fb3b68ac63705e8a4737", "score": "0.54084545", "text": "func (l LongTermRetentionBackupsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LongTermRetentionBackupsClientDeleteResponse, error) {\n\trespType := LongTermRetentionBackupsClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "6c11d0fbbbda516b01ac8fac1b3eea04", "score": "0.54066926", "text": "func (l VirtualClustersClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualClustersClientDeleteResponse, error) {\n\trespType := VirtualClustersClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "11a08b35ce1560311d43d178ac803d75", "score": "0.54063183", "text": "func (l ServerDNSAliasesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerDNSAliasesClientDeleteResponse, error) {\n\trespType := ServerDNSAliasesClientDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "42ed567c1afb9d3689c007346c6c1ef3", "score": "0.5405965", "text": "func (l DatabasesClientPausePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesClientPauseResponse, error) {\n\trespType := DatabasesClientPauseResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Database)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "99c209a646bb130ad589edc7c37a79af", "score": "0.54034704", "text": "func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) {\n\trespType := PrivateEndpointConnectionsDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "99c209a646bb130ad589edc7c37a79af", "score": "0.54034704", "text": "func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) {\n\trespType := PrivateEndpointConnectionsDeleteResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "ffeae64c097958ba3dd0ca5b1539c16a", "score": "0.5401468", "text": "func (l DisksUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DisksUpdateResponse, error) {\n\trespType := DisksUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Disk)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" } ]
71e8c8f9177bd680a671b2a688cd2861
NewHaltDroneDefault creates HaltDroneDefault with default headers values
[ { "docid": "4465621978ded5a77f6d89a28f7b4f92", "score": "0.75067246", "text": "func NewHaltDroneDefault(code int) *HaltDroneDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &HaltDroneDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" } ]
[ { "docid": "029bc65582a62b0af262edef93934769", "score": "0.6005113", "text": "func (o *HaltDroneDefault) WithPayload(payload *models.ErrorModel) *HaltDroneDefault {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "a7623d2ad6e0909ac4ea8fab79acd442", "score": "0.5858998", "text": "func NewHaltDroneNoContent() *HaltDroneNoContent {\n\n\treturn &HaltDroneNoContent{}\n}", "title": "" }, { "docid": "0186eccf4449100a3efcaf4dbbb5d048", "score": "0.5441264", "text": "func (o *HaltDroneDefault) WithStatusCode(code int) *HaltDroneDefault {\n\to._statusCode = code\n\treturn o\n}", "title": "" }, { "docid": "e874fc3b4e4473c46dffa8914f9cfa16", "score": "0.54307866", "text": "func NewNetDefaultGWTest() testutils.Test {\n\treturn testutils.TestFunc(func(t *testing.T) {\n\t\tctx := testutils.NewRktRunCtx()\n\t\tdefer ctx.Cleanup()\n\n\t\t_, ntFlannel, err := mockFlannelNetwork(t, ctx)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Can't mock flannel network: %v\", err)\n\t\t}\n\n\t\tdefer os.Remove(ntFlannel.SubnetFile)\n\n\t\ttestImageArgs := []string{\"--exec=/inspect --print-defaultgwv4\"}\n\t\ttestImage := patchTestACI(\"rkt-inspect-networking.aci\", testImageArgs...)\n\t\tdefer os.Remove(testImage)\n\n\t\tcmd := fmt.Sprintf(\"%s --debug --insecure-options=image run --net=%s --mds-register=false %s\", ctx.Cmd(), ntFlannel.Name, testImage)\n\t\tchild := spawnOrFail(t, cmd)\n\t\tdefer waitOrFail(t, child, 0)\n\n\t\texpectedRegex := `DefaultGWv4: (\\d+\\.\\d+\\.\\d+\\.\\d+)`\n\t\tif _, out, err := expectRegexTimeoutWithOutput(child, expectedRegex, time.Minute); err != nil {\n\t\t\tt.Fatalf(\"No default gateway!\\nError: %v\\nOutput: %v\", err, out)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "541cb643929c131efaa4d9675f51996f", "score": "0.54182994", "text": "func NewZebraWithDefaults() *Zebra {\n this := Zebra{}\n return &this\n}", "title": "" }, { "docid": "22557c858e5a6d2e51e4634f124ea9f3", "score": "0.53867036", "text": "func DefaultHeaders() http.Header {\n\thdrs := http.Header{}\n\thdrs.Set(\"host\", \"v3api.spacemarket.com\")\n\thdrs.Set(\"Content-Type\", \"application/json\")\n\thdrs.Set(\"Accept\", \"*/*\")\n\thdrs.Set(\"X-Sm-Ios-App-Version\", \"4.2.1\")\n\thdrs.Set(\"Accept-Timezone\", \"Asia/Tokyo\")\n\thdrs.Set(\"X-Api-Key\", apiKey)\n\thdrs.Set(\"Accept-Language\", \"en_JP\")\n\thdrs.Set(\"Accept-Encoding\", \"br, gzip, deflate\")\n\thdrs.Set(\"User-Agent\", userAgent)\n\thdrs.Set(\"Spacemarket-Version\", \"2018-11-05\")\n\treturn hdrs\n}", "title": "" }, { "docid": "2cdf901a30518485c2209c6ff86d6b68", "score": "0.52640957", "text": "func InitDefault() (Transport, error) {\n\tt, err := getDefault()\n\tDefault = t\n\treturn t, err\n}", "title": "" }, { "docid": "0ff7504384b32ec5576c21c349e70b89", "score": "0.52622426", "text": "func DefaultHeader() *Header {\n\theader := Header{\n\t\tUserAgent: \"Walle\",\n\t}\n\n\treturn &header\n}", "title": "" }, { "docid": "72f1743e2f584f557d267d6d6d7d4b58", "score": "0.5254429", "text": "func (hz *Healthz) WithDefaultHeader(key, value string) *Healthz {\n\thz.defaultHeaders[key] = value\n\treturn hz\n}", "title": "" }, { "docid": "6b2fb4f9d9f4cf40a2b2a5a01d119b25", "score": "0.52374566", "text": "func Defaults(h host.Host) Parameters {\n\treturn Parameters{\n\t\tHost: h,\n\t\tTopic: \"pnyxdb\",\n\t\tChannelsBuffer: 1024,\n\t\tRecoveryQuorum: 3,\n\t\tCtx: context.Background(),\n\t}\n}", "title": "" }, { "docid": "33a9c7692cd5c7e70eeef0d3d3b7239c", "score": "0.5214206", "text": "func New(opts ...Option) (*DHTClient, error) {\n\tvar err error\n\tdhtClient := &DHTClient{}\n\n\tfor _, opt := range opts {\n\t\tif err := opt(dhtClient); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tdhtClient.closing = make(chan struct{})\n\n\t/* check correct configuration */\n\n\t// private key\n\tif dhtClient.key == nil {\n\t\treturn nil, errors.New(\"private key must be provided\")\n\t}\n\n\t// agent address is mandatory\n\tif dhtClient.myAgentAddress == \"\" {\n\t\treturn nil, errors.New(\"missing agent address\")\n\t}\n\n\t// agent record is mandatory\n\tif dhtClient.myAgentRecord == nil {\n\t\treturn nil, errors.New(\"missing agent record\")\n\t}\n\n\t// check if the PoR is delivered for my public key\n\tmyPublicKey, err := utils.FetchAIPublicKeyFromPubKey(dhtClient.publicKey)\n\tstatus, errPoR := dhtnode.IsValidProofOfRepresentation(\n\t\tdhtClient.myAgentRecord,\n\t\tdhtClient.myAgentRecord.Address,\n\t\tmyPublicKey,\n\t)\n\tif err != nil || errPoR != nil || status.Code != dhtnode.Status_SUCCESS {\n\t\tmsg := \"Invalid AgentRecord\"\n\t\tif err != nil {\n\t\t\tmsg += \" - \" + err.Error()\n\t\t}\n\t\tif errPoR != nil {\n\t\t\tmsg += \" - \" + errPoR.Error()\n\t\t}\n\t\treturn nil, errors.New(msg)\n\t}\n\n\t// bootsrap peers\n\tif len(dhtClient.bootstrapPeers) < 1 {\n\t\treturn nil, errors.New(\"at least one boostrap peer should be provided\")\n\t}\n\n\t// select a relay node randomly from entry peers\n\trand.Seed(time.Now().Unix())\n\tindex := rand.Intn(len(dhtClient.bootstrapPeers))\n\tdhtClient.relayPeer = dhtClient.bootstrapPeers[index].ID\n\n\tdhtClient.setupLogger()\n\t_, _, linfo, ldebug := dhtClient.getLoggers()\n\tlinfo().Msg(\"INFO Using as relay\")\n\n\t/* setup libp2p node */\n\tctx := context.Background()\n\n\t// libp2p options\n\tlibp2pOpts := []libp2p.Option{\n\t\tlibp2p.ListenAddrs(),\n\t\tlibp2p.Identity(dhtClient.key),\n\t\tlibp2p.DefaultTransports,\n\t\tlibp2p.DefaultMuxers,\n\t\tlibp2p.DefaultSecurity,\n\t\tlibp2p.NATPortMap(),\n\t\tlibp2p.EnableNATService(),\n\t\tlibp2p.EnableRelay(),\n\t}\n\n\t// create a basic host\n\tbasicHost, err := libp2p.New(ctx, libp2pOpts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// create the dht\n\tdhtClient.dht, err = kaddht.New(ctx, basicHost, kaddht.Mode(kaddht.ModeClient))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// make the routed host\n\tdhtClient.routedHost = routedhost.Wrap(basicHost, dhtClient.dht)\n\tdhtClient.setupLogger()\n\n\t// connect to the booststrap nodes\n\terr = dhtClient.bootstrapLoopUntilTimeout()\n\tif err != nil {\n\t\tdhtClient.Close()\n\t\treturn nil, err\n\t}\n\n\t// bootstrap the host\n\terr = dhtClient.dht.Bootstrap(ctx)\n\tif err != nil {\n\t\tdhtClient.Close()\n\t\treturn nil, err\n\t}\n\n\t// register my address to relay peer\n\terr = dhtClient.registerAgentAddress()\n\tif err != nil {\n\t\tdhtClient.Close()\n\t\treturn nil, err\n\t}\n\n\tdhtClient.routedHost.Network().Notify(&Notifee{\n\t\tmyRelayPeer: dhtClient.bootstrapPeers[index],\n\t\tmyHost: dhtClient.routedHost,\n\t\tlogger: dhtClient.logger,\n\t\tclosing: dhtClient.closing,\n\t})\n\n\t/* setup DHTClient message handlers */\n\n\t// aea address lookup\n\tldebug().Msg(\"DEBUG Setting /aea-address/0.1.0 stream...\")\n\tdhtClient.routedHost.SetStreamHandler(dhtnode.AeaAddressStream,\n\t\tdhtClient.handleAeaAddressStream)\n\n\t// incoming envelopes stream\n\tldebug().Msg(\"DEBUG Setting /aea/0.1.0 stream...\")\n\tdhtClient.routedHost.SetStreamHandler(dhtnode.AeaEnvelopeStream,\n\t\tdhtClient.handleAeaEnvelopeStream)\n\n\treturn dhtClient, nil\n}", "title": "" }, { "docid": "6493bf81b65c5dd5dea1432bfacddb6c", "score": "0.5203681", "text": "func CreateDefaultGateway(r model.Route) {\n\targs := []string{\"route\", \"add\", \"default\", \"via\", r.InterfaceIP}\n\tcmdOut := ExecuteIPCommand(args)\n\tlog.Infof(cmdOut)\n\n}", "title": "" }, { "docid": "0bc6ac1d5bcb602f4c02211518cf0a4e", "score": "0.5183869", "text": "func NewDefault() *Config {\n\treturn New(Config{Agreed: true})\n}", "title": "" }, { "docid": "72fcabef151d8e948aadf4ec23fd9ee8", "score": "0.5178268", "text": "func createDefaultConfig() component.Config {\n\treturn &Config{\n\t\tHTTPClientSettings: confighttp.HTTPClientSettings{Endpoint: \"localhost:8126\"},\n\t}\n}", "title": "" }, { "docid": "d482dd348c5f01b17481a2694151f4f3", "score": "0.5176335", "text": "func Default(\n\tclient announceclient.Client,\n\tevents Events,\n\tclk clock.Clock,\n\tlogger *zap.SugaredLogger) *Announcer {\n\treturn New(Config{}, client, events, clk, logger)\n}", "title": "" }, { "docid": "a2645500c78caa90fbeb6c3700faa632", "score": "0.5170727", "text": "func NewDefaultHOTP() *HOTP {\n\treturn NewHOTP(GenerateSecret(), 6, nil)\n}", "title": "" }, { "docid": "8f27670a27745cfd6e338b13321d28c1", "score": "0.51570123", "text": "func createDefaultConfig() component.Config {\n\treturn &Config{\n\t\tHTTPServerSettings: confighttp.HTTPServerSettings{\n\t\t\tEndpoint: defaultEndpoint,\n\t\t},\n\t\tAccessTokenPassthroughConfig: splunk.AccessTokenPassthroughConfig{},\n\t\tHecToOtelAttrs: splunk.HecToOtelAttrs{\n\t\t\tSource: splunk.DefaultSourceLabel,\n\t\t\tSourceType: splunk.DefaultSourceTypeLabel,\n\t\t\tIndex: splunk.DefaultIndexLabel,\n\t\t\tHost: conventions.AttributeHostName,\n\t\t},\n\t\tRawPath: splunk.DefaultRawPath,\n\t\tHealthPath: splunk.DefaultHealthPath,\n\t}\n}", "title": "" }, { "docid": "628bee3d2e257cb72111f7b05a6732e0", "score": "0.51471895", "text": "func (h *Client) DefaultHeader(key, val string) *Client {\n\th.headerMap[key] = val\n\treturn h\n}", "title": "" }, { "docid": "e9ec3156c5a508378581bde281a8befe", "score": "0.5129558", "text": "func (r *Test) Default() {\n\ttestlog.Info(\"default\", \"name\", r.Name)\n\n\tif r.Spec.Replicas == nil {\n\t\tr.Spec.Replicas = new(int32)\n\t\t*r.Spec.Replicas = 1\n\t}\n\n\tif r.Spec.Image == \"\" {\n\t\tr.Spec.Image = \"jpangms/stress-ng:latest\"\n\t}\n\n\tif r.Spec.JobFile == \"\" {\n\t\tr.Spec.JobFile = defaultJobFile\n\t}\n}", "title": "" }, { "docid": "45671e0e74bd42a2d8b6e26db5a9ab7e", "score": "0.5106308", "text": "func NewDefault(handler Handler) *logger {\n\treturn NewLogger(handler,\"\",LEVEL_SILENT,log.LstdFlags)\n}", "title": "" }, { "docid": "2d36b0788da002f29ce4d5cc396f751e", "score": "0.5106272", "text": "func newDefaultServer() server {\n\t// TODO: fix by only ever creating server in one place\n\thost, _ := os.Hostname()\n\n\treturn server{\n\t\tScmClass: scmDCPM,\n\t\tBdevClass: bdNVMe,\n\t\tHostname: host,\n\t\tNrXsHelpers: 2,\n\t}\n}", "title": "" }, { "docid": "27ccbe8c15d53baafb258cb277e542a1", "score": "0.51010233", "text": "func (r *Head) Default() {\n\theadlog.Info(\"default\", \"name\", r.Name)\n\n\tvar current Head\n\terr := c.Get(context.TODO(), types.NamespacedName{\n\t\tNamespace: r.Namespace,\n\t\tName: r.Name,\n\t}, &current)\n\n\tif err == nil {\n\t\theadlog.Info(\"webhook: Head is found. Trace id will be kept\")\n\t} else if errors.IsNotFound(err) {\n\t\theadlog.Info(\"webhook: Head is not found. Trace id will be injected\")\n\n\t\ttracer := opentracing.GlobalTracer()\n\t\tspan := tracer.StartSpan(\"get-head\")\n\t\ttextCarrier := opentracing.TextMapCarrier{}\n\t\terr := span.Tracer().Inject(span.Context(), opentracing.TextMap, textCarrier)\n\t\tif err != nil {\n\t\t\theadlog.Info(\"webhook: Error in context injecting\", \"error\", err)\n\t\t\treturn\n\t\t}\n\n\t\theadlog.Info(\"Injecting trace id\", \"uber-trace-id\", textCarrier[\"uber-trace-id\"])\n\t\tr.Annotations = map[string]string{\"uber-trace-id\": textCarrier[\"uber-trace-id\"]}\n\t} else {\n\t\theadlog.Info(\"webhook: Error while fetching current head\")\n\t}\n}", "title": "" }, { "docid": "05020be1c7037e9a8b7918293f82f4b0", "score": "0.50851184", "text": "func (obj *Response) Default() {\n\tobj.Application = os.Getenv(\"application_name\")\n\tobj.Version = os.Getenv(\"application_version\")\n}", "title": "" }, { "docid": "624413264debe4c2dc9d7a8842053834", "score": "0.50713927", "text": "func (h *Header) New(host string) (Header, error) {\n\t// Create a url on which we can perform a http-request\n\turl := fmt.Sprintf(\"https://%s\", host)\n\n\t// Set e timeout of 5 seconds, otherwise if the response is to slow we will\n\t// never get the response.\n\ttimeout := time.Duration(5 * time.Second)\n\t// Setup http client for performing the get-request.\n\tclient := http.Client{\n\t\tTimeout: timeout,\n\t}\n\n\t// Make the request and store the returned data in resp.\n\tresp, err := client.Get(url)\n\t// Handle the error\n\tif err != nil {\n\t\t// return the header-object (empty) and a error containing the host and the\n\t\t// error that hopefully gives some usefull information about the error.\n\t\treturn *h, fmt.Errorf(\"%s - %s\", host, err.Error())\n\t}\n\t// Already tell program to close when no longer in use.\n\tdefer resp.Body.Close()\n\n\t// From the response get the X-Frame-Options header\n\t// get := resp.Header.Get(\"X-Frame-Options\")\n\t// Ask the Xframe object to perform function set() which performs it's algorithm\n\t// and fills the Xframe struct\n\th.Xframe = h.Xframe.set(resp.Header.Get(\"X-Frame-Options\")) // -> Follow the code\n\t// to headers/xframe.go line 25\n\n\t// Now return the filled header-structure with all it's new changes.\n\treturn *h, nil\n}", "title": "" }, { "docid": "636a101ebe9ba42d33c0ff22373eebc6", "score": "0.50685173", "text": "func (hz *Healthz) DefaultHeaders() map[string]string {\n\treturn hz.defaultHeaders\n}", "title": "" }, { "docid": "b932af5af25af3586d41224136a56ec5", "score": "0.5023831", "text": "func NewDefault(keys ...string) *Keygrip {\n\n\treturn &Keygrip{\n\t\tKeys: keys,\n\t\thashFunc: sha1.New,\n\t\tencoding: BASE64,\n\t}\n}", "title": "" }, { "docid": "883a322030a30d56362e3545f3298d2d", "score": "0.50040096", "text": "func NewRightFlipDroneDefault(code int) *RightFlipDroneDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &RightFlipDroneDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "16ba519682a63cdb6e7df31dc74305d9", "score": "0.4991959", "text": "func (me XsdGoPkgHasElem_Heading) HeadingDefault() Tangle360Type {\n\tvar x = new(Tangle360Type)\n\tx.Set(\"0.0\")\n\treturn *x\n}", "title": "" }, { "docid": "36459c36c42b3b406853cafefa3b6fc9", "score": "0.49803907", "text": "func (c *Core) Default(res http.ResponseWriter, req *http.Request) {\n\tres.Write([]byte(\"Welcome to the Solar Racing Telemetry API!\"))\n}", "title": "" }, { "docid": "9077570484b701fd91774aff5ae7d0ce", "score": "0.49793127", "text": "func newDefaultClient() *client {\n\tc := new(client)\n\tc.setDefaults()\n\treturn c\n}", "title": "" }, { "docid": "942fc50b963643b26565d790b91a2111", "score": "0.4965969", "text": "func NewDefault() *Shell {\n\tswitch runtime.GOOS {\n\tcase \"windows\":\n\t\treturn New(\"cmd.exe\", []string{\"/C\"})\n\tcase \"darwin\":\n\t\treturn New(\"osascript\", []string{\"-s h\", \"-e\"})\n\tdefault:\n\t\treturn New(\"sh\", []string{\"-c\"})\n\t}\n}", "title": "" }, { "docid": "3afba6bfebf92c5b1ac8043776bb3cdc", "score": "0.4964578", "text": "func (me XsdGoPkgHasElems_Heading) HeadingDefault() Tangle360Type {\n\tvar x = new(Tangle360Type)\n\tx.Set(\"0.0\")\n\treturn *x\n}", "title": "" }, { "docid": "e5bd1bc7531a34bc013767f45c1a8e19", "score": "0.49620223", "text": "func New(opts ...Opt) *DHT {\n\tret := &DHT{\n\t\trpc: rpc.New(),\n\t\ttokenServer: token.NewDefault(nil),\n\t\tpeerStore: NewTSPeerStore(),\n\t\tbep05TokenStore: token.NewTSStore(),\n\t\tbep44TokenStore: token.NewTSStore(),\n\t\tbep44ValueStore: NewTSValueStore(),\n\t}\n\tfor _, opt := range opts {\n\t\topt(ret)\n\t}\n\tret.rpc.GetPeersStats().OnPeerTimeout(\"dht.dht\", ret.RmNodeFromStores)\n\treturn ret\n}", "title": "" }, { "docid": "701b36545ed305e93746125e3594a34e", "score": "0.49581105", "text": "func NewDHT(pinName string, temperatureUnit TemperatureUnit, sensorType string) (*DHT, error) {\n\tdht := &DHT{temperatureUnit: temperatureUnit}\n\n\t// set sensorType\n\tsensorType = strings.ToLower(sensorType)\n\tif sensorType == \"dht11\" {\n\t\tdht.sensorType = \"dht11\"\n\t}\n\n\t// set lastRead a second before to give the pin a second to warm up\n\tdht.lastRead = time.Now().Add(-1 * time.Second)\n\n\treturn dht, nil\n}", "title": "" }, { "docid": "24621997e4c605a2bd50cacbd978a437", "score": "0.49567828", "text": "func newDefaultStorage(id string) *storage {\n\treturn &storage{\n\t\tID: id,\n\t\tStatus: \"PENDING\",\n\t\tResultStatusName: \"\",\n\t\tResultStatusType: \"\",\n\t\tInputs: []*ioData{},\n\t\tOutputs: []*ioData{},\n\t}\n}", "title": "" }, { "docid": "12b1d519e5926445a57bd442bb955381", "score": "0.49511337", "text": "func New(host string) *Thermostat {\n\tclient := &http.Client{\n\t\tTimeout: defaultTimeout,\n\t}\n\treturn &Thermostat{\n\t\tclient: client,\n\t\tbaseURL: url.URL{Scheme: \"http\", Host: host},\n\t}\n}", "title": "" }, { "docid": "d4f2c0f1ce968a77c4137ea2e272471f", "score": "0.49460626", "text": "func createDefaultUpdaterStub() *Updater {\n\treturn createUpdaterStubs(&stubControl{})\n}", "title": "" }, { "docid": "3f1170d3b67b0a34f47f257d69ed3299", "score": "0.49379024", "text": "func InitDefault() {\n\tconf := zap.Config{\n\t\tEncoding: \"json\",\n\t\tLevel: zap.NewAtomicLevelAt(zapcore.InfoLevel),\n\t\tSampling: &zap.SamplingConfig{\n\t\t\tInitial: 100,\n\t\t\tThereafter: 100,\n\t\t},\n\t\tEncoderConfig: zapcore.EncoderConfig{\n\t\t\tLevelKey: \"level\",\n\t\t\tTimeKey: \"time\",\n\t\t\tCallerKey: \"file\",\n\t\t\tMessageKey: \"msg\",\n\t\t\tEncodeLevel: zapcore.LowercaseLevelEncoder,\n\t\t\tEncodeTime: zapcore.ISO8601TimeEncoder,\n\t\t\tEncodeCaller: zapcore.ShortCallerEncoder,\n\t\t},\n\t\tOutputPaths: []string{\"stdout\"},\n\t\tErrorOutputPaths: []string{\"stderr\"},\n\t\tDisableCaller: true,\n\t}\n\tlog, _ = conf.Build()\n\tsugar = log.Sugar()\n}", "title": "" }, { "docid": "42bf970f497cbf31c4d1f172e62df7c8", "score": "0.49339622", "text": "func New(transport runtime.ClientTransport, formats strfmt.Registry) *HAProxyDataPlane {\n\t// ensure nullable parameters have default\n\tif formats == nil {\n\t\tformats = strfmt.Default\n\t}\n\n\tcli := new(HAProxyDataPlane)\n\tcli.Transport = transport\n\tcli.ACL = acl.New(transport, formats)\n\tcli.Backend = backend.New(transport, formats)\n\tcli.BackendSwitchingRule = backend_switching_rule.New(transport, formats)\n\tcli.Bind = bind.New(transport, formats)\n\tcli.Cluster = cluster.New(transport, formats)\n\tcli.Configuration = configuration.New(transport, formats)\n\tcli.Defaults = defaults.New(transport, formats)\n\tcli.Discovery = discovery.New(transport, formats)\n\tcli.Filter = filter.New(transport, formats)\n\tcli.Frontend = frontend.New(transport, formats)\n\tcli.Global = global.New(transport, formats)\n\tcli.HTTPRequestRule = http_request_rule.New(transport, formats)\n\tcli.HTTPResponseRule = http_response_rule.New(transport, formats)\n\tcli.Information = information.New(transport, formats)\n\tcli.LogTarget = log_target.New(transport, formats)\n\tcli.Maps = maps.New(transport, formats)\n\tcli.Nameserver = nameserver.New(transport, formats)\n\tcli.Peer = peer.New(transport, formats)\n\tcli.PeerEntry = peer_entry.New(transport, formats)\n\tcli.Reloads = reloads.New(transport, formats)\n\tcli.Resolver = resolver.New(transport, formats)\n\tcli.Server = server.New(transport, formats)\n\tcli.ServerSwitchingRule = server_switching_rule.New(transport, formats)\n\tcli.ServiceDiscovery = service_discovery.New(transport, formats)\n\tcli.Sites = sites.New(transport, formats)\n\tcli.Specification = specification.New(transport, formats)\n\tcli.SpecificationOpenapiv3 = specification_openapiv3.New(transport, formats)\n\tcli.Stats = stats.New(transport, formats)\n\tcli.StickRule = stick_rule.New(transport, formats)\n\tcli.StickTable = stick_table.New(transport, formats)\n\tcli.TCPRequestRule = tcp_request_rule.New(transport, formats)\n\tcli.TCPResponseRule = tcp_response_rule.New(transport, formats)\n\tcli.Transactions = transactions.New(transport, formats)\n\treturn cli\n}", "title": "" }, { "docid": "ca099f88e3f98999247f70af3a14f7be", "score": "0.4929941", "text": "func CreateDefaultZapLogger() (*zap.Logger, error) {\n\tc, err := CreateDefaultZapLoggerConfig().Build()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.Named(\"etcd-client\"), nil\n}", "title": "" }, { "docid": "f3cd45537fb495dcb68a9579c6dfa2d9", "score": "0.49268475", "text": "func NewDefaultView(templatesDir string, watch bool) (*DefaultView, error) {\n\tconfig := &hot.Config{\n\t\tWatch: watch,\n\t\tBaseName: \"hero\",\n\t\tDir: templatesDir,\n\t\tFuncs: viewFuncs,\n\t\tFilesExtension: []string{\".tpl\", \".html\", \".tmpl\"},\n\t}\n\ttpl, err := hot.New(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DefaultView{tpl: tpl}, nil\n\n}", "title": "" }, { "docid": "230fe7e511be5d3dee6737169bfe82c9", "score": "0.49252796", "text": "func NewHostWithDefaults() *Host {\n\tthis := Host{}\n\treturn &this\n}", "title": "" }, { "docid": "5a0739ac2bcd6620910bb9e6fab3cb0f", "score": "0.4925163", "text": "func NewDefaultClient() Client {\n\tc := NewClient()\n\tc.WithURL(defaultFiatURL)\n\n\treturn c\n}", "title": "" }, { "docid": "514a2d883cd2caf33820ca0beb0d7cac", "score": "0.49182695", "text": "func NewDefaultClient() *Client {\n\tc := &Client{\n\t\tclient: http.DefaultClient,\n\t\tconfig: &Config{\n\t\t\tToken: os.Getenv(\"DRIBBBLE_TOKEN\"),\n\t\t\tEndpoint: assist.DefaultAPIEndpoint,\n\t\t},\n\t}\n\treturn configure(c, defaultLogger)\n}", "title": "" }, { "docid": "7701132eca7c3becd7207d6b61df0aed", "score": "0.49170202", "text": "func NewDefaults() *Client {\n\treturn &Client{\n\t\tsigkil: make(chan os.Signal, 1),\n\t\tsighup: make(chan os.Signal, 1),\n\t\tmenu: make(map[string]ui.MenuItem),\n\t\tplex: &logs.Cooler{},\n\t\talert: &logs.Cooler{},\n\t\tLogger: logs.New(),\n\t\tConfig: &Config{\n\t\t\tApps: &apps.Apps{\n\t\t\t\tURLBase: \"/\",\n\t\t\t},\n\t\t\tServices: &services.Config{},\n\t\t\tBindAddr: DefaultBindAddr,\n\t\t\tSnapshot: &snapshot.Config{},\n\t\t\tLogs: &logs.Logs{\n\t\t\t\tLogFiles: DefaultLogFiles,\n\t\t\t\tLogFileMb: DefaultLogFileMb,\n\t\t\t},\n\t\t\tTimeout: cnfg.Duration{Duration: DefaultTimeout},\n\t\t}, Flags: &Flags{\n\t\t\tFlagSet: flag.NewFlagSet(DefaultName, flag.ExitOnError),\n\t\t\tConfigFile: os.Getenv(DefaultEnvPrefix + \"_CONFIG_FILE\"),\n\t\t\tEnvPrefix: DefaultEnvPrefix,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "91902ce77a3a4ded8be516bfbd1d1864", "score": "0.4915122", "text": "func newDefaultConfig() *Config {\n\treturn &Config{\n\t\tLabels: map[string]string{\n\t\t\t\"fakefeature1\": \"true\",\n\t\t\t\"fakefeature2\": \"true\",\n\t\t\t\"fakefeature3\": \"true\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "85897ad3dc74818b931dac7bd5702e92", "score": "0.4912769", "text": "func CreateDefaultLogger(level zerolog.Level) zerolog.Logger {\n\twr := diode.NewWriter(os.Stdout, 1000, 10*time.Millisecond, func(missed int) {\n\t\t_, _ = fmt.Printf(\"Logger Dropped %d messages\", missed)\n\t})\n\treturn zerolog.New(zerolog.ConsoleWriter{Out: wr}).Level(level).With().Timestamp().Logger()\n}", "title": "" }, { "docid": "d989ec6485d7d6c5f465c3e6b2f7ff2b", "score": "0.49111867", "text": "func New(auth *Auth) *HBone {\n\t// Need to set this to allow timeout on the read header\n\th1 := &http.Transport{\n\t\tExpectContinueTimeout: 3 * time.Second,\n\t}\n\th2, _ := http2.ConfigureTransports(h1)\n\th2.ReadIdleTimeout = 10 * time.Minute // TODO: much larger to support long-lived connections\n\th2.AllowHTTP = true\n\th2.StrictMaxConcurrentStreams = false\n\thb := &HBone{\n\t\tAuth: auth,\n\t\tEndpoints: map[string]*Endpoint{},\n\t\tH2R: map[string]http.RoundTripper{},\n\t\tH2RConn: map[*http2.ClientConn]string{},\n\t\tTcpAddr: \"127.0.0.1:8080\",\n\t\th2t: h2,\n\t\tPorts: \t\t map[string]string{},\n\t\t//&http2.Transport{\n\t\t//\tReadIdleTimeout: 10000 * time.Second,\n\t\t//\tStrictMaxConcurrentStreams: false,\n\t\t//\tAllowHTTP: true,\n\t\t//},\n\n\t\tHTTPClientSystem: http.DefaultClient,\n\t}\n\thb.h2t.ConnPool = hb\n\thb.h2Server = &http2.Server{}\n\n\tu, _ := url.Parse(\"http://127.0.0.1:8080\")\n\thb.rp = httputil.NewSingleHostReverseProxy(u)\n\n\treturn hb\n}", "title": "" }, { "docid": "1d753ee0b6cd3f6f2d798797e69894e3", "score": "0.49091244", "text": "func NewDefaultClient(conf OneConfig) *Client {\n\treturn &Client{\n\t\turl: conf.Endpoint,\n\t\ttoken: conf.Token,\n\t\thttpClient: cleanhttp.DefaultPooledClient(),\n\t}\n}", "title": "" }, { "docid": "1abb6cb6a2c4830de40aac76d41005b3", "score": "0.49057522", "text": "func (r *EKSConfigTemplate) Default() {\n}", "title": "" }, { "docid": "2eb057eea60713b375d8d79228d0dc9a", "score": "0.49006143", "text": "func createDefaultLightServerWithKey(privkey *koblitz.PrivateKey, whitelist []*koblitz.PublicKey, authrpc bool) (rpcListener *cxrpc.OpencxRPCCaller, err error) {\n\treturn createLightSettleServer([]*coinparam.Params{&coinparam.RegressionNetParams, newVTC, &coinparam.LiteRegNetParams}, whitelist, \"localhost\", uint16(12347), privkey, authrpc)\n}", "title": "" }, { "docid": "73b90661367cf59fcfb04c98f988f925", "score": "0.48930535", "text": "func CreateDefault() *Config {\n\treturn &Config{\n\t\tInput: \"\",\n\t\tOutput: \"\",\n\t\tNumber: 100,\n\t\tMode: 0,\n\t\tRep: 0,\n\t\tNth: 1,\n\t\tInSize: 256,\n\t\tOutSize: 1024,\n\t\tAlpha: 0,\n\t\tBackground: \"avg\",\n\t\tWorkers: 0,\n\t\tVerbose: \"off\",\n\t\tVeryVerbose: \"off\",\n\t}\n}", "title": "" }, { "docid": "a78e99af8fe4985c4aadf2f298acad70", "score": "0.48928544", "text": "func Default() *Calvados {\n\n\tmapping := bleve.NewIndexMapping()\n\tindex, _ := bleve.NewMemOnly(mapping)\n\t// TODO: handle error\n\n\treturn &Calvados{\n\t\tredirections: make(map[string]string),\n\t\ttemplateDirs: make([]string, 0),\n\t\tpreprocFuncs: make([]PreprocFunc, 0),\n\t\tconfig: NewConfig(\"en\", \"Default Title\", false),\n\t\tsearchIndex: index,\n\t\tcustomRoutes: []CustomRoute{},\n\t}\n}", "title": "" }, { "docid": "467cb46207008feb8ae373d077652412", "score": "0.48895156", "text": "func (a *Forj) SetDefault(action string) {\n\tif od := a.GetUniqDriverName(\"upstream\"); od != \"\" {\n\t\ta.o.Defaults[\"instance\"] = od\n\t}\n\n\t// Set Defaults for repositories.\n\tif v, found, _, _ := a.cli.GetStringValue(infra, \"\", flow); found && v != \"\" {\n\t\ta.o.Defaults[flow] = v\n\t}\n}", "title": "" }, { "docid": "f040a245c0ca9263d8e5e505c4479f2b", "score": "0.4868057", "text": "func (r *AstarteVoyagerIngress) Default() {\n\tavilog.Info(\"default\", \"name\", r.Name)\n\n\t// TODO(user): fill in your defaulting logic.\n}", "title": "" }, { "docid": "3bbfca003b191dadeaa4c584b1066688", "score": "0.48636764", "text": "func DefaultChronos() *Chronos {\n\turl, _ := url.Parse(\"http://127.0.0.1:4400\")\n\treturn &Chronos{\n\t\tURL: url,\n\t\tDebug: false,\n\t\tRequestTimeout: 5,\n\t\tAPIPrefix: \"\",\n\t}\n}", "title": "" }, { "docid": "491320c8c64a6d8e3178ad54d6eaeddb", "score": "0.48571518", "text": "func (o *Parameters) Default() {\n\n\t// sizes\n\to.Nova = 1\n\to.Noor = 0\n\to.Nsol = 40\n\to.Ncpu = 4\n\n\t// time\n\to.Tf = 100\n\to.DtExc = -1\n\to.DtOut = -1\n\n\t// options\n\to.Pll = true\n\to.Seed = 0\n\to.LatinDup = 2\n\to.EpsMinProb = 0.1\n\to.Verbose = true\n\to.Problem = 1\n\to.GenAll = false\n\to.Ntrials = 10\n\to.BinInt = 0\n\to.ClearFlt = false\n\to.ExcTour = true\n\to.ExcOne = false\n\to.ConvDova0 = 0.1\n\n\t// differential evolution\n\to.DiffEvolC = 1.0\n\to.DiffEvolF = 1.0\n\to.DiffEvolPm = 1.0\n\to.DiffEvolUseCmult = true\n\to.DiffEvolUseFmult = true\n\n\t// crossover and mutation\n\to.DebEtam = 1\n\to.PmFlt = 0.0\n\to.PmInt = 0.1\n\to.PcInt = 0.8\n}", "title": "" }, { "docid": "bff67ea701a46304fd5cb08af0d6ace0", "score": "0.48560563", "text": "func NewWithoutDefaults(host string) BaseClient {\n\treturn BaseClient{\n\t\tClient: autorest.NewClientWithUserAgent(UserAgent()),\n\t\tHost: host,\n\t}\n}", "title": "" }, { "docid": "6e8f4aa98c4f002650843d884ba58e54", "score": "0.48541978", "text": "func (*HostName) Default() interface{} {\n\treturn \"kyoh86.dev\"\n}", "title": "" }, { "docid": "581263164a860fe3e1b62e597bacd027", "score": "0.48482326", "text": "func (r *Ray) Default() {\n\tlog.V(1).Info(\"default\", \"name\", r.Name)\n\tif r.Spec.Head == nil {\n\t\tr.Spec.Head = &ReplicaSpec{}\n\t}\n\tdefaultHead(r.Spec.Head)\n}", "title": "" }, { "docid": "2ff0fc62e1916feca197bac8232c7756", "score": "0.48406702", "text": "func NewDefault() *Spout {\n\treturn &Spout{close: make(chan struct{})}\n}", "title": "" }, { "docid": "434929a7194620d3281eef2d49552217", "score": "0.48267522", "text": "func buildDefaultHTTPRoute(clusterName string) *route.Route {\n\treturn &route.Route{\n\t\tMatch: route.RouteMatch{PathSpecifier: &route.RouteMatch_Prefix{Prefix: \"/\"}},\n\t\tDecorator: &route.Decorator{\n\t\t\tOperation: DefaultOperation,\n\t\t},\n\t\tAction: &route.Route_Route{\n\t\t\tRoute: &route.RouteAction{\n\t\t\t\tClusterSpecifier: &route.RouteAction_Cluster{Cluster: clusterName},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6c71a0204046f2c839e02d5fea20f277", "score": "0.48265287", "text": "func NewDefaultView(templatesDir string) (*DefaultView, error) {\n\ttpl := &DefaultView{\n\t\ttpl: template.New(\"hero\"),\n\t}\n\tif err := tpl.load(templatesDir); err != nil {\n\t\treturn nil, err\n\t}\n\treturn tpl, nil\n\n}", "title": "" }, { "docid": "8af632fb984fc961044f47ad2dc5bf6b", "score": "0.4819665", "text": "func createDefaultConfig() config.Exporter {\n\treturn &dtconfig.Config{\n\t\tExporterSettings: config.NewExporterSettings(config.NewComponentID(typeStr)),\n\t\tRetrySettings: exporterhelper.NewDefaultRetrySettings(),\n\t\tQueueSettings: exporterhelper.NewDefaultQueueSettings(),\n\t\tResourceToTelemetrySettings: resourcetotelemetry.Settings{\n\t\t\tEnabled: false,\n\t\t},\n\n\t\tAPIToken: \"\",\n\t\tHTTPClientSettings: confighttp.HTTPClientSettings{Endpoint: \"\"},\n\n\t\tTags: []string{},\n\t\tDefaultDimensions: make(map[string]string),\n\t}\n}", "title": "" }, { "docid": "837b7ed1cb82b13d7c630be679596ba6", "score": "0.48126277", "text": "func newDefaultLogger() *zap.Logger {\n\tencoderConfig := zap.NewProductionEncoderConfig()\n\tencoderConfig.EncodeTime = SimpleTimeEncoder\n\tencoderConfig.EncodeLevel = SimpleLevelEncoder\n\tcore := zapcore.NewCore(\n\t\tzapcore.NewConsoleEncoder(encoderConfig),\n\t\tos.Stdout,\n\t\tRunningAtomicLevel)\n\treturn zap.New(core, zap.AddCaller(), zap.AddCallerSkip(2))\n}", "title": "" }, { "docid": "73c5c33c7dd80c2ae08140c49f2bdc0e", "score": "0.47975317", "text": "func NewHelo(opts *HeloOpts) *Helo {\n\th := Helo{MessageType: MSGTYPE_HELO}\n\tif opts == nil {\n\t\th.Options = &HeloOpts{\n\t\t\tKeepalive: true,\n\t\t}\n\t} else {\n\t\th.Options = opts\n\t}\n\treturn &h\n}", "title": "" }, { "docid": "eeb88ed5355f3c6ef66892e459c220e6", "score": "0.47859547", "text": "func configDefault(config ...Config) Config {\n\tif len(config) < 1 {\n\t\treturn DefaultConfig\n\t}\n\tcfg := config[0]\n\tif cfg.HeaderName == \"\" {\n\t\tcfg.HeaderName = DefaultHeaderName\n\t}\n\tif cfg.HeaderValue == \"\" {\n\t\tcfg.HeaderValue = DefaultHeaderValue\n\t}\n\tif cfg.ResponseCode == 0 {\n\t\tcfg.ResponseCode = DefaultResponseCode\n\t}\n\tif cfg.ResponseText == \"\" {\n\t\tcfg.ResponseText = DefaultResponseText\n\t}\n\treturn cfg\n}", "title": "" }, { "docid": "70423b5285ae1e14d3c07d26f5ed7538", "score": "0.47798455", "text": "func NewDefault(redisHost string, redisPort int, redisPassword string, redisDB int, logger zap.Logger) *Worker {\n\treturn New(\n\t\t\"webhook\",\n\t\tredisHost, redisPort, redisPassword, redisDB,\n\t\t15, logger, false, 5*time.Second, \"\", 5000,\n\t\t&RealClock{},\n\t)\n}", "title": "" }, { "docid": "a759e79f7e2589e939102c32998f0814", "score": "0.47795966", "text": "func NewDefault() *State {\n\ts := New()\n\ts.background = &subState{noire.NewHSV(0, 0, 0), 0}\n\ts.sstates = make([]*subState, defaultSubStateCount)\n\n\thue := 20.0\n\tfor n := range s.sstates {\n\t\ts.sstates[n] = &subState{noire.NewHSV(hue, 80, 100), hue}\n\t\thue += 30\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "149bdf5050e3592f01bbcb5d1ead88bb", "score": "0.47785264", "text": "func (b *Bot) Default(h Handler) {\n\t// Add h as default.\n\tb.defaultHandler = h\n}", "title": "" }, { "docid": "1492c2fbd28f65273b8c8c245c7611f2", "score": "0.4775566", "text": "func NewDefaultCommand() *cobra.Command {\n\t// Parent command to which all subcommands are added.\n\tcmds := &cobra.Command{\n\t\tUse: \"l2\",\n\t\tShort: \"l2\",\n\t\tLong: `l2 providers vxlan bridges`,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tcmd.Help()\n\t\t},\n\t}\n\n\tcmds.AddCommand(NewServeCmd())\n\tcmds.AddCommand(NewWatchCmd())\n\n\tcmds.PersistentFlags().StringP(\"vtepdev\", \"i\", \"eth0\", \"Device for VTEP endpoint\")\n\tviper.BindPFlag(\"vtepdev\", cmds.PersistentFlags().Lookup(\"vtepdev\"))\n\n\treturn cmds\n}", "title": "" }, { "docid": "4495e7765ee0715e12d7fddad86b72e2", "score": "0.4773786", "text": "func (ppl *Pipeline) Default() {\n\twebhLog.Info(\"calling defaulter for \", \"pipeline\", ppl.Name)\n\n\tppl.SetDefaults()\n}", "title": "" }, { "docid": "9f7f60645643f33f1ac7f8ab0c80b207", "score": "0.4772136", "text": "func (webtest *Webtest) Default() {\n\twebtest.defaultImpl()\n\tvar temp any = webtest\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "e0a72068418013d69098e5d44a17e46c", "score": "0.4770263", "text": "func NewGetHealthzDefault(code int) *GetHealthzDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetHealthzDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "4ab2e3da9eedf6eeccbd2c78ecf2cda9", "score": "0.4768649", "text": "func setDefault(header *http.Header, key, value string) {\n\tif header.Get(key) == \"\" {\n\t\theader.Set(key, value)\n\t}\n}", "title": "" }, { "docid": "755e8d6b2f85e1c90a036defbfa7f082", "score": "0.47544837", "text": "func New() *Zoho {\n\tz := Zoho{\n\t\tclient: &http.Client{\n\t\t\tTimeout: time.Second * 10,\n\t\t\tTransport: &http.Transport{\n\t\t\t\tDial: (&net.Dialer{\n\t\t\t\t\tTimeout: 5 * time.Second,\n\t\t\t\t}).Dial,\n\t\t\t\tTLSHandshakeTimeout: 5 * time.Second,\n\t\t\t},\n\t\t},\n\t\ttokensFile: \"./.tokens.zoho\",\n\t}\n\n\treturn &z\n}", "title": "" }, { "docid": "71ef38a722c2255ad583bbb146c04ada", "score": "0.4753432", "text": "func NewDefaultMeta(host string, port string) veldt.MetaCtor {\n\treturn func() (veldt.Meta, error) {\n\t\treturn &DefaultMeta{\n\t\t\tHost: host,\n\t\t\tPort: port,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "21d8616fa7f7400623cf0dbbd0c41559", "score": "0.47430116", "text": "func newDefaultConfiguration(ext External) configuration {\n\treturn configuration{\n\t\tSystemName: \"daos_server\",\n\t\tSocketDir: \"/var/run/daos_server\",\n\t\tAccessPoints: []string{\"localhost\"},\n\t\tPort: 10000,\n\t\tTransportConfig: security.DefaultServerTransportConfig(),\n\t\tScmMountPath: \"/mnt/daos\",\n\t\tHyperthreads: false,\n\t\tNrHugepages: 1024,\n\t\tPath: \"etc/daos_server.yml\",\n\t\tNvmeShmID: 0,\n\t\tControlLogMask: cLogDebug,\n\t\text: ext,\n\t}\n}", "title": "" }, { "docid": "c629c4ae0b5b636868a3036948ea86c3", "score": "0.4741831", "text": "func Default(request *slacker.Request, response slacker.ResponseWriter) {\n\tresponse.Typing()\n\tresponse.Reply(messages.Get(\"command-not-found\"))\n}", "title": "" }, { "docid": "fb67e1090b3343c75f89a3ca5cbdefce", "score": "0.47411197", "text": "func NewDeleteThermalSimulationDefault(code int) *DeleteThermalSimulationDefault {\n\treturn &DeleteThermalSimulationDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "567edfcf8f3722b36d78674bb0375bac", "score": "0.47359285", "text": "func OverrideDefault(newhost string) {\n\thostnameOverride = newhost\n}", "title": "" }, { "docid": "f23857026e6c84ee6d2bc9b9049c6e20", "score": "0.47255632", "text": "func NewDefaultTransport(dialer *net.Dialer) *http.Transport {\n\ttransport := &http.Transport{\n\t\tProxy: http.ProxyFromEnvironment,\n\t\tDial: dialer.Dial,\n\t\tTLSHandshakeTimeout: TLSHandshakeTimeout,\n\t}\n\treturn transport\n}", "title": "" }, { "docid": "4ebd32c7e4298bc91638894bb3397dfd", "score": "0.4725223", "text": "func GenerateDefaults(config *RunTimeConfig) {\n\n\t/* Set reasonable defaults */\n\tif config.SSHPort == 0 {\n\t\tconfig.SSHPort = 22\n\t}\n\n\tif config.ReadTimeout == 0 {\n\t\tconfig.ReadTimeout = time.Second * 5\n\t}\n\n\t/* Generate a SSH configuration profile */\n\tsshClientConfig := &ssh.ClientConfig{User: config.Username, Auth: []ssh.AuthMethod{ssh.Password(config.Password)}}\n\t/* Add default ciphers */\n\tsshClientConfig.SetDefaults()\n\t/* Add old ciphers for older Ironware switches */\n\tsshClientConfig.Ciphers = append(sshClientConfig.Ciphers, \"aes128-cbc\", \"aes256-cbc\", \"3des-cbc\")\n\n\tsshClientConfig.HostKeyCallback = ssh.InsecureIgnoreHostKey()\n\n\t/* Use our private key if given on command-line */\n\t/* Allow authentication with ssh dsa or rsa key */\n\tif config.KeyFile != \"\" {\n\t\tif file, err := os.Open(config.KeyFile); err != nil {\n\t\t\tif config.Debug {\n\t\t\t\tfmt.Fprintf(config.W, \"Cant load private key for ssh auth :(%s)\\n\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tif privateKey, err := libssh.LoadPrivateKey(file); err != nil {\n\t\t\t\tif config.Debug {\n\t\t\t\t\tfmt.Fprintf(config.W, \"Cant load private key for ssh auth :(%s)\\n\", err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsshClientConfig.Auth = append(sshClientConfig.Auth, privateKey)\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Copy to config object */\n\tconfig.SSHClientConfig = sshClientConfig\n\n\t/* build connectionAddr */\n\tif config.SSHIP != \"\" {\n\t\tconfig.ConnectionAddr = fmt.Sprintf(\"%s:%d\", config.SSHIP, config.SSHPort)\n\t} else {\n\t\tconfig.ConnectionAddr = fmt.Sprintf(\"%s:%d\", config.Hostname, config.SSHPort)\n\t}\n}", "title": "" }, { "docid": "3567aa24d5a58ba579cbee6e16bb5a1f", "score": "0.47232825", "text": "func CreateDefaultController() *Controller {\n\tcontroller, err := LoadData(\"\", \"\")\n\tif err != nil {\n\t\tpanic(err) // should never happen\n\t}\n\treturn controller\n}", "title": "" }, { "docid": "c07938cc36dc88f842e6b47ceb7190c2", "score": "0.47171202", "text": "func NewDefaultFresh() elton.Handler {\n\treturn NewFresh(FreshConfig{})\n}", "title": "" }, { "docid": "211c1241ab556d5dc2b10fcb1c9acdc2", "score": "0.46979624", "text": "func NewDefaultConfig() Config {\n\treturn Config{\n\t\tLevel: encoding.LogLevel{Level: zap.InfoLevel},\n\t\tTokenExpiry: encoding.Duration{Duration: tokenExpiry},\n\t\tNodes: NodesConfig{\n\t\t\tHosts: []string{\n\t\t\t\t\"n01.testnet.vega.xyz:3002\",\n\t\t\t\t\"n02.testnet.vega.xyz:3002\",\n\t\t\t\t\"n03.testnet.vega.xyz:3002\",\n\t\t\t\t\"n04.testnet.vega.xyz:3002\",\n\t\t\t\t\"n05.testnet.vega.xyz:3002\",\n\t\t\t\t\"n06.testnet.vega.xyz:3002\",\n\t\t\t\t\"n07.testnet.vega.xyz:3002\",\n\t\t\t\t\"n08.testnet.vega.xyz:3002\",\n\t\t\t\t\"n09.testnet.vega.xyz:3002\",\n\t\t\t\t\"n10.testnet.vega.xyz:3002\",\n\t\t\t\t\"n11.testnet.vega.xyz:3002\",\n\t\t\t\t\"n12.testnet.vega.xyz:3002\",\n\t\t\t\t\"n13.testnet.vega.xyz:3002\",\n\t\t\t\t\"n14.testnet.vega.xyz:3002\",\n\t\t\t\t\"n15.testnet.vega.xyz:3002\",\n\t\t\t\t\"n16.testnet.vega.xyz:3002\",\n\t\t\t\t\"n17.testnet.vega.xyz:3002\",\n\t\t\t\t\"n18.testnet.vega.xyz:3002\",\n\t\t\t\t\"n19.testnet.vega.xyz:3002\",\n\t\t\t\t\"n20.testnet.vega.xyz:3002\",\n\t\t\t},\n\t\t\tRetries: 5,\n\t\t},\n\t\tHost: \"127.0.0.1\",\n\t\tPort: 1789,\n\t\tConsole: ConsoleConfig{\n\t\t\tURL: \"console.fairground.wtf\",\n\t\t\tLocalPort: 1847,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "ce74634d6e4cc1c7ea0cd7d07569cec3", "score": "0.46927628", "text": "func NewGetHardwareTapesDefault(code int) *GetHardwareTapesDefault {\n\treturn &GetHardwareTapesDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "8482bd02e7e67c97d417a67c8c756e05", "score": "0.46884552", "text": "func Default() zerolog.Logger {\n\tf := map[string]interface{}{\n\t\t\"app\": config.APP_NAME,\n\t\t\"env\": config.Environment(),\n\t\t\"version\": config.Version(),\n\t\t\"commit\": config.Commit(),\n\t}\n\treturn zerolog.New(config.LogWriter()).\n\t\tWith().\n\t\tTimestamp().\n\t\tFields(f).\n\t\tLogger()\n}", "title": "" }, { "docid": "898c4dd00080096a744c3435102b1378", "score": "0.46802568", "text": "func (s *SQLiteSuite) newDefaultTimeline() (*Timeline, error) {\n\tconfig := Config{\n\t\tDBPath: TestDBPath,\n\t\tRetentionDuration: time.Hour,\n\t\tClock: s.clock,\n\t}\n\treturn s.newTimeline(config)\n}", "title": "" }, { "docid": "5f9b6bceb55b20033c04fdb5f55b527d", "score": "0.46750632", "text": "func NewDefaultTransport(skipVerify bool) http.RoundTripper {\n\treturn &http.Transport{\n\t\tProxy: http.ProxyFromEnvironment,\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: skipVerify},\n\t}\n}", "title": "" }, { "docid": "3b62a71cabb3aaf3a12125ee5ad77cd2", "score": "0.46750018", "text": "func NewDefaultClient() *Client {\n\treturn NewClient(ClientConfig{BaseURL: \"https://worldtimeapi.org/api\"})\n}", "title": "" }, { "docid": "6a78cfe213b08f5fcef03be87ba844e4", "score": "0.4674777", "text": "func NewDefaultTable(title string) *DefaultTable {\n\tg := &DefaultTable{\n\t\tTable: tview.NewTable(),\n\t}\n\tg.SetTitle(title).\n\t\tSetBorder(true)\n\tg.SetBorders(false)\n\treturn g\n}", "title": "" }, { "docid": "bf67322a5aa51d105a9bca91e398e6ce", "score": "0.4672341", "text": "func getDefaultHostConfig(t *testing.T, cli *client.Client) *container.HostConfig {\n\thostConfig := container.HostConfig{\n\t\tBinds: []string{\n\t\t\tcoverageBind(t),\n\t\t},\n\t\tPortBindings: nat.PortMap{},\n\t\tCapDrop: []string{\n\t\t\t\"ALL\",\n\t\t},\n\t\tPrivileged: false,\n\t}\n\tif devImage(t, cli) {\n\t\t// Only needed for a RHEL-based image\n\t\tif baseImage(t, cli) != \"ubuntu\" {\n\t\t\thostConfig.CapAdd = append(hostConfig.CapAdd, \"DAC_OVERRIDE\")\n\t\t}\n\t} else {\n\t\tt.Logf(\"Detected MQ Advanced image - dropping all capabilities\")\n\t}\n\treturn &hostConfig\n}", "title": "" }, { "docid": "e73267722f63012785e10efbb251b7ce", "score": "0.46718004", "text": "func NewLunDeleteDefault(code int) *LunDeleteDefault {\n\treturn &LunDeleteDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "913ac279dee2f43102ebb2184a4ba6a3", "score": "0.4670406", "text": "func NewCreateTableDefault(code int) *CreateTableDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &CreateTableDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "c3de0bd8c1bc90ee0d6bd6d5dae375d1", "score": "0.46700928", "text": "func DefaultServer() *ImmuGwServer {\n\tl := logger.NewSimpleLogger(\"immugw \", os.Stderr)\n\treturn &ImmuGwServer{\n\t\tLogger: l,\n\t\tOptions: DefaultOptions(),\n\t\tquit: make(chan struct{}),\n\t\tauditorDone: make(chan struct{}),\n\t\tMetricServer: newMetricsServer(DefaultOptions().MetricsBind(), l, func() float64 { return time.Since(startedAt).Hours() }),\n\t}\n}", "title": "" }, { "docid": "c506b8a606082b97058538cbc83cd622", "score": "0.46690434", "text": "func NewDefaultRP(\n\tscheduler Scheduler,\n\tfittingMethod SoftConstraint,\n\tprovisioner *actor.Ref,\n\tprovisionerSlotsPerInstance int,\n) actor.Actor {\n\td := &DefaultRP{\n\t\tscheduler: scheduler,\n\t\tfittingMethod: fittingMethod,\n\t\tagents: make(map[*actor.Ref]*agentState),\n\t\tgroups: make(map[*actor.Ref]*group),\n\n\t\ttaskList: newTaskList(),\n\n\t\tprovisioner: provisioner,\n\t\tprovisionerView: newProvisionerView(provisionerSlotsPerInstance),\n\n\t\treschedule: false,\n\t}\n\treturn d\n}", "title": "" }, { "docid": "1d8df1bbdb5087e43149308c5b9ef89b", "score": "0.46674004", "text": "func Default() *Config {\n\tzone := make(map[string][]string, 1)\n\tzone[\"sh003\"] = []string{\"127.0.0.1:7171\"}\n\tzone[\"sh004\"] = []string{\"127.0.0.1:7171\"}\n\tdst := make(map[string]int, 1)\n\tdst[\"sz01\"] = 3\n\n\tschedulers := make(map[string]*model.Scheduler, 1)\n\tschedulers[\"discovery-dev\"] = &model.Scheduler{\n\t\tAppID: \"discovery\",\n\t\tEnv: \"dev\",\n\t\tRemark: \"test\",\n\t\tZones: []model.Zone{\n\t\t\t{\n\t\t\t\tSrc: \"gd\",\n\t\t\t\tDst: dst,\n\t\t\t},\n\t\t},\n\t}\n\n\tscheduler := []byte(`[{\"app_id\":\"test.service1\",\"env\":\"uat\",\"zones\":[{\"src\":\"sh001\",\"dst\":{\"sh0001\":3,\"sh0002\":1}},{\"src\":\"sh002\",\"dst\":{\"hs0001\":1,\"sh0002\":3,\"sh0003\":4}}],\"remark\":\"te22st\"},{\"app_id\":\"test.service2\",\"env\":\"uat\",\"zones\":[{\"src\":\"sh001\",\"dst\":{\"sh0001\":3,\"sh0002\":1}},{\"src\":\"sh002\",\"dst\":{\"hs0001\":1,\"sh0002\":3,\"sh0003\":4}}],\"remark\":\"te22st\"}]`)\n\n\tcfg := &Config{\n\t\tNodes: []string{\"127.0.0.1:7171\"},\n\t\tHTTPServer: &ServerConfig{\n\t\t\tAddr: \"127.0.0.1:7171\",\n\t\t},\n\t\tZones: zone,\n\n\t\tHTTPClient: &xhttp.ClientConfig{\n\t\t\tDial: time.Duration(3 * time.Second),\n\t\t\tKeepAlive: time.Duration(120 * time.Second),\n\t\t},\n\t\tEnv: &Env{\n\t\t\tRegion: \"china\",\n\t\t\tZone: \"gd\",\n\t\t\tDeployEnv: \"dev\",\n\t\t\tHost: \"discovery\",\n\t\t},\n\t\tSchedulers: schedulers,\n\t\tScheduler: scheduler,\n\t}\n\n\treturn cfg\n}", "title": "" }, { "docid": "d0a5d04fb449399f45da1fb4b01a6fcb", "score": "0.46672273", "text": "func NewHandleDefault() (*Handle, error) {\n\treturn NewHandle(nil, nil)\n}", "title": "" }, { "docid": "59beab9123e8150898d4f9d86a477f59", "score": "0.46612382", "text": "func DefaultNewNode(config *cfg.Config, logger log.Logger) (*Node, error) {\n\tnodeKey, err := p2p.LoadOrGenNodeKey(config.NodeKeyFile())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load or gen node key %s: %w\", config.NodeKeyFile(), err)\n\t}\n\n\treturn NewNode(config,\n\t\tprivval.LoadOrGenFilePV(config.PrivValidatorKeyFile(), config.PrivValidatorStateFile()),\n\t\tnodeKey,\n\t\tproxy.DefaultClientCreator(config.ProxyApp, config.ABCI, config.DBDir()),\n\t\tDefaultGenesisDocProviderFunc(config),\n\t\tcfg.DefaultDBProvider,\n\t\tDefaultMetricsProvider(config.Instrumentation),\n\t\tlogger,\n\t)\n}", "title": "" } ]
4428136a2bc791b2dc1071e2b9b5b2d3
QuorumCallEmpty2 for testing imported message type.
[ { "docid": "c712498f38a0d286da1c8a2bd3d8c5aa", "score": "0.6813191", "text": "func (c *Configuration) QuorumCallEmpty2(ctx context.Context, in *Request) (resp *emptypb.Empty, err error) {\n\tcd := gorums.QuorumCallData{\n\t\tMessage: in,\n\t\tMethod: \"dev.ZorumsService.QuorumCallEmpty2\",\n\t}\n\tcd.QuorumFunction = func(req protoreflect.ProtoMessage, replies map[uint32]protoreflect.ProtoMessage) (protoreflect.ProtoMessage, bool) {\n\t\tr := make(map[uint32]*emptypb.Empty, len(replies))\n\t\tfor k, v := range replies {\n\t\t\tr[k] = v.(*emptypb.Empty)\n\t\t}\n\t\treturn c.qspec.QuorumCallEmpty2QF(req.(*Request), r)\n\t}\n\n\tres, err := c.RawConfiguration.QuorumCall(ctx, cd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.(*emptypb.Empty), err\n}", "title": "" } ]
[ { "docid": "57f53106a686a706e2aa7fc76851e02a", "score": "0.6380635", "text": "func (c *Configuration) QuorumCallEmpty(ctx context.Context, in *emptypb.Empty) (resp *Response, err error) {\n\tcd := gorums.QuorumCallData{\n\t\tMessage: in,\n\t\tMethod: \"dev.ZorumsService.QuorumCallEmpty\",\n\t}\n\tcd.QuorumFunction = func(req protoreflect.ProtoMessage, replies map[uint32]protoreflect.ProtoMessage) (protoreflect.ProtoMessage, bool) {\n\t\tr := make(map[uint32]*Response, len(replies))\n\t\tfor k, v := range replies {\n\t\t\tr[k] = v.(*Response)\n\t\t}\n\t\treturn c.qspec.QuorumCallEmptyQF(req.(*emptypb.Empty), r)\n\t}\n\n\tres, err := c.RawConfiguration.QuorumCall(ctx, cd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.(*Response), err\n}", "title": "" }, { "docid": "8965ab2a1a28544a4441a8ee2891d796", "score": "0.6020844", "text": "func BenchmarkEmptyMessage(b *testing.B) {\n\tb.Run(\"Wire/Marshal\", func(b *testing.B) {\n\t\tb.RunParallel(func(pb *testing.PB) {\n\t\t\tm := &emptypb.Empty{}\n\t\t\tfor pb.Next() {\n\t\t\t\tif _, err := proto.Marshal(m); err != nil {\n\t\t\t\t\tb.Fatal(err)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t})\n\tb.Run(\"Wire/Unmarshal\", func(b *testing.B) {\n\t\topts := proto.UnmarshalOptions{\n\t\t\tMerge: true,\n\t\t}\n\t\tb.RunParallel(func(pb *testing.PB) {\n\t\t\tm := &emptypb.Empty{}\n\t\t\tfor pb.Next() {\n\t\t\t\tif err := opts.Unmarshal([]byte{}, m); err != nil {\n\t\t\t\t\tb.Fatal(err)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t})\n\tb.Run(\"Wire/Validate\", func(b *testing.B) {\n\t\tb.RunParallel(func(pb *testing.PB) {\n\t\t\tmt := (&emptypb.Empty{}).ProtoReflect().Type()\n\t\t\tfor pb.Next() {\n\t\t\t\t_, got := impl.Validate(mt, protoiface.UnmarshalInput{})\n\t\t\t\twant := impl.ValidationValid\n\t\t\t\tif got != want {\n\t\t\t\t\tb.Fatalf(\"Validate = %v, want %v\", got, want)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t})\n\tb.Run(\"Clone\", func(b *testing.B) {\n\t\tb.RunParallel(func(pb *testing.PB) {\n\t\t\tm := &emptypb.Empty{}\n\t\t\tfor pb.Next() {\n\t\t\t\tproto.Clone(m)\n\t\t\t}\n\t\t})\n\t})\n\tb.Run(\"New\", func(b *testing.B) {\n\t\tmt := (&emptypb.Empty{}).ProtoReflect().Type()\n\t\tb.RunParallel(func(pb *testing.PB) {\n\t\t\tfor pb.Next() {\n\t\t\t\tmt.New()\n\t\t\t}\n\t\t})\n\t})\n}", "title": "" }, { "docid": "a5db79e1bf62c6a2bb5f2293db1b9298", "score": "0.5856401", "text": "func (client *Client) TestCallEmpty() (*Ok, error) {\n\tresult, err := client.Send(Request{\n\t\tmeta: meta{\n\t\t\tType: \"testCallEmpty\",\n\t\t},\n\t\tData: map[string]interface{}{},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif result.Type == \"error\" {\n\t\treturn nil, buildResponseError(result.Data)\n\t}\n\n\treturn UnmarshalOk(result.Data)\n}", "title": "" }, { "docid": "17d3dbbf3e182d5a6a9e621c099065d4", "score": "0.54005474", "text": "func TestMarquiseOneMessage(t *testing.T) {\n\tsock, err := zmq.NewSocket(zmq.ROUTER)\n\tif err != nil {\n\t\tt.Errorf(\"%v\", err)\n\t}\n\terr = sock.Bind(\"ipc:///tmp/gomarquise_full_stack_test\")\n\tif err != nil {\n\t\tt.Errorf(\"%v\", err)\n\t}\n\tgo sendTestMessage(t, 42)\n\t_, err = sock.RecvMessageBytes(0)\n\tif err != nil {\n\t\tt.Errorf(\"%v\", err)\n\t}\n}", "title": "" }, { "docid": "520fab12f473080437770ff45e5015cd", "score": "0.5371362", "text": "func TestRpcClient_Call(t *testing.T) {\n\tRegisterTestingT(t)\n\trpcClient := NewClient(httpServer.URL)\n\n\tperson := Person{\n\t\tName: \"Alex\",\n\t\tAge: 35,\n\t\tCountry: \"Germany\",\n\t}\n\n\tdrink := Drink{\n\t\tName: \"Cuba Libre\",\n\t\tIngredients: []string{\"rum\", \"cola\"},\n\t}\n\n\trpcClient.Call(context.Background(), \"missingParam\")\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"missingParam\",\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"nullParam\", nil)\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"nullParam\",\"params\":[null],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"nullParams\", nil, nil)\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"nullParams\",\"params\":[null,null],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"emptyParams\", []interface{}{})\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"emptyParams\",\"params\":[],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"emptyAnyParams\", []string{})\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"emptyAnyParams\",\"params\":[],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"emptyObject\", struct{}{})\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"emptyObject\",\"params\":{},\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"emptyObjectList\", []struct{}{{}, {}})\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"emptyObjectList\",\"params\":[{},{}],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"boolParam\", true)\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"boolParam\",\"params\":[true],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"boolParams\", true, false, true)\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"boolParams\",\"params\":[true,false,true],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"stringParam\", \"Alex\")\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"stringParam\",\"params\":[\"Alex\"],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"stringParams\", \"JSON\", \"RPC\")\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"stringParams\",\"params\":[\"JSON\",\"RPC\"],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"numberParam\", 123)\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"numberParam\",\"params\":[123],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"numberParams\", 123, 321)\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"numberParams\",\"params\":[123,321],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"floatParam\", 1.23)\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"floatParam\",\"params\":[1.23],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"floatParams\", 1.23, 3.21)\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"floatParams\",\"params\":[1.23,3.21],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"manyParams\", \"Alex\", 35, true, nil, 2.34)\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"manyParams\",\"params\":[\"Alex\",35,true,null,2.34],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"emptyMissingPublicFieldObject\", struct{ name string }{name: \"Alex\"})\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"emptyMissingPublicFieldObject\",\"params\":{},\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"singleStruct\", person)\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"singleStruct\",\"params\":{\"name\":\"Alex\",\"age\":35,\"country\":\"Germany\"},\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"singlePointerToStruct\", &person)\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"singlePointerToStruct\",\"params\":{\"name\":\"Alex\",\"age\":35,\"country\":\"Germany\"},\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\tpp := &person\n\trpcClient.Call(context.Background(), \"doublePointerStruct\", &pp)\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"doublePointerStruct\",\"params\":{\"name\":\"Alex\",\"age\":35,\"country\":\"Germany\"},\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"multipleStructs\", person, &drink)\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"multipleStructs\",\"params\":[{\"name\":\"Alex\",\"age\":35,\"country\":\"Germany\"},{\"name\":\"Cuba Libre\",\"ingredients\":[\"rum\",\"cola\"]}],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"singleStructInArray\", []interface{}{person})\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"singleStructInArray\",\"params\":[{\"name\":\"Alex\",\"age\":35,\"country\":\"Germany\"}],\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"namedParameters\", map[string]interface{}{\n\t\t\"name\": \"Alex\",\n\t\t\"age\": 35,\n\t})\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"namedParameters\",\"params\":{\"age\":35,\"name\":\"Alex\"},\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"anonymousStructNoTags\", struct {\n\t\tName string\n\t\tAge int\n\t}{\"Alex\", 33})\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"anonymousStructNoTags\",\"params\":{\"Name\":\"Alex\",\"Age\":33},\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"anonymousStructWithTags\", struct {\n\t\tName string `json:\"name\"`\n\t\tAge int `json:\"age\"`\n\t}{\"Alex\", 33})\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"anonymousStructWithTags\",\"params\":{\"name\":\"Alex\",\"age\":33},\"id\":0,\"jsonrpc\":\"2.0\"}`))\n\n\trpcClient.Call(context.Background(), \"structWithNullField\", struct {\n\t\tName string `json:\"name\"`\n\t\tAddress *string `json:\"address\"`\n\t}{\"Alex\", nil})\n\tExpect((<-requestChan).body).To(Equal(`{\"method\":\"structWithNullField\",\"params\":{\"name\":\"Alex\",\"address\":null},\"id\":0,\"jsonrpc\":\"2.0\"}`))\n}", "title": "" }, { "docid": "9bd5d361888e20d0b45948a367c903a0", "score": "0.5325135", "text": "func (c *Client) Noop() error {}", "title": "" }, { "docid": "321d62bb6fedb4ce8036c74b0b925b84", "score": "0.52992165", "text": "func TestAmqp_BasicNack(t *testing.T) {\n\tlogp.TestingSetup(logp.WithSelectors(\"amqp\", \"amqpdetailed\"))\n\n\t_, amqp := amqpModForTests()\n\n\tdata1, err := hex.DecodeString(\"0100010000000d003c0078000000000000000102ce\")\n\tassert.Nil(t, err)\n\n\tstream := &amqpStream{data: data1, message: new(amqpMessage)}\n\tok, complete := amqp.amqpMessageParser(stream)\n\tm := stream.message\n\n\tif !ok {\n\t\tt.Errorf(\"Parsing returned error\")\n\t}\n\tif !complete {\n\t\tt.Errorf(\"Message should be complete\")\n\t}\n\tassert.Equal(t, \"basic.nack\", m.method)\n\tassert.Equal(t, false, m.fields[\"multiple\"])\n\tassert.Equal(t, true, m.fields[\"requeue\"])\n}", "title": "" }, { "docid": "378f298b0444a9908c6232c45922a98e", "score": "0.5184077", "text": "func messageRPCTest(t *testing.T) {\n\tconn, err := net.Dial(\"tcp\", \"127.0.0.1:6001\")\n\tassert.NoError(t, err)\n\tclient := netRpc.NewClientWithCodec(goridgeRpc.NewClientCodec(conn))\n\n\tvar returned Payload\n\tinput := Payload{Message: \"test result\"}\n\terr = client.Call(\"plugin.Message\", input, &returned)\n\tassert.NoError(t, err)\n\tassert.Equal(t, input, returned)\n}", "title": "" }, { "docid": "b4548d0a14ceb50bb8f86a296e71a4f3", "score": "0.5110282", "text": "func TestHeavyMessageunicast(t *testing.T) {\n\tsendersidestring := strings.Repeat(\"I am in go\", 1024*100*64)\n\ts[0].Outbox() <- &cluster.Envelope{Pid: 101, Msg: sendersidestring}\n\n\tif (<-s[1].Inbox()).Msg != sendersidestring {\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "02a08c81a1b3f6fc51f0115679051223", "score": "0.51027966", "text": "func (suite *clientSuite) TestEmpty() {\n\tcl := NewClient()\n\tsuite.Require().Empty(cl.Execute().Errors())\n}", "title": "" }, { "docid": "fbd4971a260bd284e4f61457866716f0", "score": "0.50777245", "text": "func TestBasicV2(t *testing.T) {\n\topts := nsqdNs.NewOptions()\n\topts.Logger = newTestLogger(t)\n\topts = adjustDefaultOptsForTest(opts)\n\ttcpAddr, _, nsqd, nsqdServer := mustStartNSQD(opts)\n\tdefer os.RemoveAll(opts.DataPath)\n\tdefer nsqdServer.Exit()\n\n\ttopicName := \"test_v2\" + strconv.Itoa(int(time.Now().Unix()))\n\ttopic := nsqd.GetTopicIgnPart(topicName)\n\ttopic.GetChannel(\"ch\")\n\tmsg := nsqdNs.NewMessage(0, []byte(\"test body\"))\n\ttopic.PutMessage(msg)\n\n\tconn, err := mustConnectNSQD(tcpAddr)\n\ttest.Equal(t, err, nil)\n\tdefer conn.Close()\n\n\tidentify(t, conn, nil, frameTypeResponse)\n\tsub(t, conn, topicName, \"ch\")\n\n\t_, err = nsq.Ready(1).WriteTo(conn)\n\ttest.Equal(t, err, nil)\n\n\tmsgOut := recvNextMsgAndCheck(t, conn, len(msg.Body), msg.TraceID, true)\n\ttest.NotNil(t, msgOut)\n}", "title": "" }, { "docid": "90b449b6b10c6f84ccae60488a87ae90", "score": "0.5058181", "text": "func TestRoundTrip(t *testing.T) {\n\tmsgs := []TestMsg{\n\t\t{\n\t\t\tF1: \"abasdfasdf312123\",\n\t\t\tF2: 109,\n\t\t\tF3: ^uint64(0),\n\t\t\tF4: []byte{0, 12, 44},\n\t\t\tF5: 505.5,\n\t\t}, {\n\t\t\tF1: \"\",\n\t\t\tF4: nil,\n\t\t}, {\n\t\t\tF3: 99,\n\t\t}, {},\n\t\t{\n\t\t\tF2: 0,\n\t\t},\n\t}\n\n\tvar buf bytes.Buffer\n\tfor i := range msgs {\n\t\tif err := WriteDelimitedTo(&buf, &msgs[i]); err != nil {\n\t\t\tt.Fatalf(\"unable to write %d: %v\", i, err)\n\t\t}\n\t}\n\n\treadMsgs := make([]TestMsg, len(msgs))\n\tfor i := range msgs {\n\t\tif err := ReadDelimitedFrom(&buf, &readMsgs[i]); err != nil {\n\t\t\tt.Fatalf(\"unable to read %d: %v\", i, err)\n\t\t}\n\t}\n\n\tif err := ReadDelimitedFrom(&buf, &TestMsg{}); err != io.EOF {\n\t\tt.Errorf(\"want EOF after reading all data, got %v\", err)\n\t}\n\n\tfor i := range msgs {\n\t\tif !reflect.DeepEqual(&msgs[i], &readMsgs[i]) {\n\t\t\tt.Errorf(\"case %d: written and read messages differ\", i)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "529289fee3f7b8b155060dca54f5d8bf", "score": "0.50264925", "text": "func TestEmptyPopWithRingBuffer(t *testing.T) {\n testEmptyPopWithBPQ(BPQWithCapacity(maxRingBufferSize), t)\n}", "title": "" }, { "docid": "b90c4c6e065fbf6e1f60600c92b392b6", "score": "0.5025297", "text": "func (*EmptyMessage) Descriptor() ([]byte, []int) {\n\treturn file_test_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "325b6190152ef7491d73381930f0d189", "score": "0.5018792", "text": "func zeroAction(service.Messenger) error { return nil }", "title": "" }, { "docid": "342cfafee52f030a9ff6ea9e89550d8a", "score": "0.5014213", "text": "func (*EmptyResponse) Descriptor() ([]byte, []int) {\n\treturn file_testdata_gentest_unary_type_test_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "55bdf262e79bc9f45392972aa1cb7b4e", "score": "0.5007147", "text": "func (_Bridge *BridgeCaller) Quorum(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Bridge.contract.Call(opts, &out, \"quorum\")\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": "7dffe4f82a739dfdeb422facf09a52f3", "score": "0.50007904", "text": "func TestWorkerIgnoreMsgs(t *testing.T) {\n\tt.Parallel()\n\n\tctx, err := startWorker()\n\tif err != nil {\n\t\tt.Fatalf(\"unable to start worker: %v\", err)\n\t}\n\n\t// Create a new task and give it to the worker.\n\ttask := makeJob()\n\n\tselect {\n\tcase ctx.nextJob <- task:\n\tcase <-time.After(1 * time.Second):\n\t\tt.Fatalf(\"did not pick up job\")\n\t}\n\n\t// The request should be sent to the peer.\n\tselect {\n\tcase <-ctx.peer.requests:\n\tcase <-time.After(time.Second):\n\t\tt.Fatalf(\"request not sent\")\n\t}\n\n\t// First give the worker a few random responses. These will all be\n\t// ignored.\n\tfor i := 0; i < 5; i++ {\n\t\tselect {\n\t\tcase ctx.peer.responses <- &wire.MsgTx{}:\n\t\tcase <-time.After(time.Second):\n\t\t\tt.Fatalf(\"resp not received\")\n\t\t}\n\t}\n\n\t// Answer the query with the correct response.\n\tselect {\n\tcase ctx.peer.responses <- finalResp:\n\tcase <-time.After(time.Second):\n\t\tt.Fatalf(\"resp not received\")\n\t}\n\n\t// The worker should respond with a job finished.\n\tvar result *jobResult\n\tselect {\n\tcase result = <-ctx.jobResults:\n\tcase <-time.After(time.Second):\n\t\tt.Fatalf(\"response not received\")\n\t}\n\n\tif result.err != nil {\n\t\tt.Fatalf(\"response error: %v\", result.err)\n\t}\n\n\t// Make sure the result was given for the intended job.\n\tif result.job != task {\n\t\tt.Fatalf(\"got result for unexpected job\")\n\t}\n\n\t// And the correct peer.\n\tif result.peer != ctx.peer {\n\t\tt.Fatalf(\"expected peer to be %v, was %v\",\n\t\t\tctx.peer.Addr(), result.peer)\n\t}\n}", "title": "" }, { "docid": "60908488da98507e7a3b2c64994b7925", "score": "0.49716258", "text": "func (asserter Asserter) Empty(obj interface{}, msg ...interface{}) {\n\tok, l := getLen(obj)\n\tif !ok {\n\t\tpanic(\"cannot get length\")\n\t}\n\n\tif l != 0 {\n\t\tdefMsg := fmt.Sprintf(\"got %d, want == 0\", l)\n\t\tasserter.reportAssertionFault(defMsg, msg...)\n\t}\n}", "title": "" }, { "docid": "e4cbb2fa099d662e6d6ad806d91f0970", "score": "0.49525455", "text": "func (*PhoneCallEmpty) TypeName() string {\n\treturn \"phoneCallEmpty\"\n}", "title": "" }, { "docid": "95655d4fd3850b9803fc1a7642d35066", "score": "0.49506852", "text": "func msgIsEmpty(msg P2pMessage) bool {\n\treturn !msg.Populated\n}", "title": "" }, { "docid": "120e8f45046fa7f56b92ec0a286fa1a2", "score": "0.49492887", "text": "func Test_Receiver_Run_02(t *testing.T) {\n\trc := newRunnableReceiver()\n\trc.Config.Cipher = nil\n\terr := rc.Run()\n\tif !matchError(err, \"nil Configuration.Cipher\") {\n\t\tt.Error(\"0xE4F1AF\", \"wrong error:\", err)\n\t}\n}", "title": "" }, { "docid": "66bb102e8c0c77476a56c5f4e0ff0451", "score": "0.49481127", "text": "func (*EmptyRequest) Descriptor() ([]byte, []int) {\n\treturn file_testdata_gentest_unary_type_test_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "3711b6f3c17903a5968cb7804805a801", "score": "0.49321455", "text": "func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) {\n\n\tmainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{\n\t\tCounter{cRestSubReqFromXapp, 1},\n\t\tCounter{cRestSubRespToXapp, 1},\n\t\tCounter{cSubReqToE2, 1},\n\t\tCounter{cSubRespFromE2, 1},\n\t\tCounter{cRestSubNotifToXapp, 1},\n\t\tCounter{cRestSubDelReqFromXapp, 1},\n\t\tCounter{cRestSubDelRespToXapp, 1},\n\t\tCounter{cSubDelReqToE2, 1},\n\t\tCounter{cSubDelReqTimerExpiry, 2},\n\t\tCounter{cSubDelReReqToE2, 1},\n\t\tCounter{cSubDelRespFromE2, 1},\n\t\tCounter{cSubDelFailFromE2, 1},\n\t})\n\n\t// Req\n\tvar params *teststube2ap.RESTSubsReqParams = nil\n\trestSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)\n\n\t// Del\n\txappConn1.SendRESTSubsDelReq(t, &restSubId)\n\n\t// E2t: Receive 1st SubsDelReq\n\tdelreq, delmsg := e2termConn1.RecvSubsDelReq(t)\n\n\tmainCtrl.MakeTransactionNil(t, e2SubsId)\n\n\t// No transaction exist for this response which will result resending original request\n\te2termConn1.SendSubsDelResp(t, delreq, delmsg)\n\n\t// E2t: Receive 2nd SubsDelReq\n\tdelreq, delmsg = e2termConn1.RecvSubsDelReq(t)\n\n\t// Subscription does not exist in in E2 Node.\n\te2termConn1.SendSubsDelFail(t, delreq, delmsg)\n\n\t// Wait that subs is cleaned\n\tmainCtrl.wait_subs_clean(t, e2SubsId, 10)\n\n\txappConn1.TestMsgChanEmpty(t)\n\te2termConn1.TestMsgChanEmpty(t)\n\tmainCtrl.wait_registry_empty(t, 10)\n\tmainCtrl.VerifyAllClean(t)\n\tmainCtrl.VerifyCounterValues(t)\n}", "title": "" }, { "docid": "68c2ee04108c35f3cdddca487d53c44c", "score": "0.49274418", "text": "func (c RawConfiguration) QuorumCall(ctx context.Context, d QuorumCallData) (resp protoreflect.ProtoMessage, err error) {\n\texpectedReplies := len(c)\n\tmd := &ordering.Metadata{MessageID: c.getMsgID(), Method: d.Method}\n\n\treplyChan := make(chan response, expectedReplies)\n\tfor _, n := range c {\n\t\tmsg := d.Message\n\t\tif d.PerNodeArgFn != nil {\n\t\t\tmsg = d.PerNodeArgFn(d.Message, n.id)\n\t\t\tif !msg.ProtoReflect().IsValid() {\n\t\t\t\texpectedReplies--\n\t\t\t\tcontinue // don't send if no msg\n\t\t\t}\n\t\t}\n\t\tn.channel.enqueue(request{ctx: ctx, msg: &Message{Metadata: md, Message: msg}}, replyChan, false)\n\t}\n\n\tvar (\n\t\terrs []Error\n\t\tquorum bool\n\t\treplies = make(map[uint32]protoreflect.ProtoMessage)\n\t)\n\n\tfor {\n\t\tselect {\n\t\tcase r := <-replyChan:\n\t\t\tif r.err != nil {\n\t\t\t\terrs = append(errs, Error{r.nid, r.err})\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treplies[r.nid] = r.msg\n\t\t\tif resp, quorum = d.QuorumFunction(d.Message, replies); quorum {\n\t\t\t\treturn resp, nil\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\treturn resp, QuorumCallError{ctx.Err().Error(), len(replies), errs}\n\t\t}\n\t\tif len(errs)+len(replies) == expectedReplies {\n\t\t\treturn resp, QuorumCallError{\"incomplete call\", len(replies), errs}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "183369734e4d0ceb2578f268f6f02864", "score": "0.49138883", "text": "func TestGetDupSuppressProto(t *testing.T) {\n\tonce.Do(testSetup)\n\t// Start two getters. The first should block (waiting reading\n\t// from stringc) and the second should latch on to the first\n\t// one.\n\tresc := make(chan *testpb.TestMessage, 2)\n\tfor i := 0; i < 2; i++ {\n\t\tgo func() {\n\t\t\ttm := new(testpb.TestMessage)\n\t\t\tif err := protoGroup.Get(dummyCtx, fromChan, ProtoSink(tm)); err != nil {\n\t\t\t\ttm.Name = proto.String(\"ERROR:\" + err.Error())\n\t\t\t}\n\t\t\tresc <- tm\n\t\t}()\n\t}\n\n\t// Wait a bit so both goroutines get merged together via\n\t// singleflight.\n\t// TODO(bradfitz): decide whether there are any non-offensive\n\t// debug/test hooks that could be added to singleflight to\n\t// make a sleep here unnecessary.\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Unblock the first getter, which should unblock the second\n\t// as well.\n\tstringc <- \"Fluffy\"\n\twant := &testpb.TestMessage{\n\t\tName: proto.String(\"ECHO:Fluffy\"),\n\t\tCity: proto.String(\"SOME-CITY\"),\n\t}\n\tfor i := 0; i < 2; i++ {\n\t\tselect {\n\t\tcase v := <-resc:\n\t\t\tif !reflect.DeepEqual(v, want) {\n\t\t\t\tt.Errorf(\" Got: %v\\nWant: %v\", proto.CompactTextString(v), proto.CompactTextString(want))\n\t\t\t}\n\t\tcase <-time.After(5 * time.Second):\n\t\t\tt.Errorf(\"timeout waiting on getter #%d of 2\", i+1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "485a23555f02dcef1143d05b0ca15ddf", "score": "0.4894487", "text": "func (c *BinClient) Empty(in *BinRequestsEmpty) (*BinResponsesEmpty, error) {\n\treturn c.EmptyWithContext(context.Background(), in)\n}", "title": "" }, { "docid": "930f91b2598ee6fc0fae32b3c2111380", "score": "0.48936975", "text": "func TestEmptyBox(t *testing.T) {\n\tvar msg = []byte{}\n\n\tbox, ok := Seal(msg, testGoodKey)\n\tif !ok {\n\t\tt.Fatal(\"secretbox: failed to seal message\")\n\t}\n\n\tout, ok := Open(box, testGoodKey)\n\tif !ok {\n\t\tt.Fatal(\"secretbox: failed to open message\")\n\t} else if !bytes.Equal(out, msg) {\n\t\tt.Fatal(\"secretbox: output message doesn't match original\")\n\t}\n}", "title": "" }, { "docid": "d786710bb3c97cf674c79f266799b013", "score": "0.48819956", "text": "func ExampleEmpty() {\n\tvar subscriber cesium.Subscriber\n\n\tmono.Empty().Subscribe(subscriber)\n}", "title": "" }, { "docid": "1e3950053d6106b48d6fce507fa3d7c4", "score": "0.48776257", "text": "func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) {\n\n\tmainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{\n\t\tCounter{cRestSubReqFromXapp, 1},\n\t\tCounter{cRestSubRespToXapp, 1},\n\t\tCounter{cSubReqToE2, 1},\n\t\tCounter{cSubRespFromE2, 1},\n\t\tCounter{cRestSubNotifToXapp, 1},\n\t\tCounter{cRestSubDelReqFromXapp, 1},\n\t\tCounter{cRestSubDelRespToXapp, 1},\n\t\tCounter{cSubDelReqToE2, 1},\n\t\tCounter{cSubDelReqTimerExpiry, 1},\n\t\tCounter{cSubDelReReqToE2, 1},\n\t\tCounter{cSubDelFailFromE2, 2},\n\t})\n\n\t// Req\n\tvar params *teststube2ap.RESTSubsReqParams = nil\n\trestSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)\n\n\t// Del\n\txappConn1.SendRESTSubsDelReq(t, &restSubId)\n\n\t// E2t: Receive 1st SubsDelReq\n\tdelreq, delmsg := e2termConn1.RecvSubsDelReq(t)\n\n\t// Unknown instanceId 0 in this response which will result resending original request\n\tdelreq.RequestId.InstanceId = 0\n\te2termConn1.SendSubsDelFail(t, delreq, delmsg)\n\n\t// E2t: Receive 2nd SubsDelReq\n\tdelreq, delmsg = e2termConn1.RecvSubsDelReq(t)\n\n\t// Subscription does not exist in in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0\n\te2termConn1.SendSubsDelFail(t, delreq, delmsg)\n\n\t// Wait that subs is cleaned\n\tmainCtrl.wait_subs_clean(t, e2SubsId, 10)\n\n\txappConn1.TestMsgChanEmpty(t)\n\te2termConn1.TestMsgChanEmpty(t)\n\tmainCtrl.wait_registry_empty(t, 10)\n\tmainCtrl.VerifyAllClean(t)\n\tmainCtrl.VerifyCounterValues(t)\n}", "title": "" }, { "docid": "0d611d0f311f74ca239ecc35da4c9b1f", "score": "0.4875405", "text": "func (x *fastReflection_MsgSendResponse) Clear(fd protoreflect.FieldDescriptor) {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.nft.v1beta1.MsgSendResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.nft.v1beta1.MsgSendResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "9720d9038224296fafacdff747b45cda", "score": "0.48658055", "text": "func testBatchACKReceivingCompanyName(t testing.TB) {\n\tmockBatch := mockBatchACK(t)\n\t// modify the Individual name / receiving company to nothing\n\tmockBatch.GetEntries()[0].SetReceivingCompany(\"\")\n\terr := mockBatch.Validate()\n\tif !base.Match(err, ErrConstructor) {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}", "title": "" }, { "docid": "76f92be7d8541ea501c1774971a9c588", "score": "0.48407117", "text": "func (p *ExecutePacket) Zeroize() {\n}", "title": "" }, { "docid": "e8b396ea475f359cf1c98d3868dc0548", "score": "0.48373", "text": "func TestEmptyProgram(t *testing.T) {\n\t_ = newCheckerTestUtilWithRawInput(t, ``, false)\n}", "title": "" }, { "docid": "2c5679eb89523d54321add760a2481dc", "score": "0.4835989", "text": "func TestEmpty(t *testing.T) {\n\tt.Parallel()\n\n\tm := inmemchunkstore.New()\n\tp := builder.NewPipelineBuilder(context.Background(), m, false)\n\n\tdata := []byte{}\n\t_, err := p.Write(data)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tsum, err := p.Sum()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\texp := swarm.MustParseHexAddress(\"b34ca8c22b9e982354f9c7f50b470d66db428d880c8a904d5fe4ec9713171526\")\n\tif !bytes.Equal(exp.Bytes(), sum) {\n\t\tt.Fatalf(\"expected %s got %s\", exp.String(), hex.EncodeToString(sum))\n\t}\n}", "title": "" }, { "docid": "a9a15f31de8860222875e4b5fbb6266a", "score": "0.48317948", "text": "func t_ack(c *Client, param string) {}", "title": "" }, { "docid": "a9930eab7dbac0a32fc65875cf373493", "score": "0.4830191", "text": "func Test_Receiver_Run_04(t *testing.T) {\n\trc := newRunnableReceiver()\n\trc.CryptoKey = nil\n\terr := rc.Run()\n\tif !matchError(err, \"Receiver.CryptoKey\") {\n\t\tt.Error(\"0xE57F1E\", \"wrong error:\", err)\n\t}\n}", "title": "" }, { "docid": "e60ca0e1f199e519868380d71751c223", "score": "0.48295364", "text": "func (f *Base) Undefined(*messages.Pickle, *messages.PickleStep, *formatters.StepDefinition) {\n}", "title": "" }, { "docid": "560c359a48bf0aad881e60121ae12714", "score": "0.4819587", "text": "func emptyMessage() *Message {\n\treturn &Message{\n\t\tId: ID,\n\t\tRts: time.Now(),\n\t\tcoordinator: COORDINATOR,\n\t}\n}", "title": "" }, { "docid": "675af82f66386c283631424e06b2d3e2", "score": "0.48178548", "text": "func IgnoredTestP2PServiceRunAddPeer(t *testing.T) {\n\tvar sampleBlockHash, _ = hex.DecodeString(\"4f461d85e869ade8a0544f8313987c33a9c06534e50c4ad941498299579bd7ac\")\n\tvar sampleBlockHeight uint64 = 100215\n\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tmockActor := p2pmock.NewMockActorService(ctrl)\n\tdummyBlock := types.Block{Hash: sampleBlockHash, Header: &types.BlockHeader{BlockNo: sampleBlockHeight}}\n\tmockActor.EXPECT().CallRequest(gomock.Any(), gomock.Any(), gomock.Any()).Return(message.GetBlockRsp{Block: &dummyBlock}, nil)\n\t//mockMF := new(MockMoFactory)\n\ttarget := &networkTransport{conf: config.NewServerContext(\"\", \"\").GetDefaultConfig().(*config.Config).P2P,\n\t\tlogger: log.NewLogger(\"test.p2p\")}\n\n\t//target.Host = &mockHost{peerstore.NewPeerstore(pstoremem.NewKeyBook(), pstoremem.NewAddrBook(), pstoremem.NewPeerMetadata())}\n\ttarget.Host = p2pmock.NewMockHost(ctrl)\n\ttarget.selfMeta.ID = types.PeerID(\"gwegw\")\n\n\tsampleAddr1 := p2pcommon.NewMetaWith1Addr(types.RandomPeerID(), \"192.168.0.1\", 33888, \"v2.0.0\")\n\tsampleAddr2 := p2pcommon.NewMetaWith1Addr(types.RandomPeerID(), \"192.168.0.2\", 33888, \"v2.0.0\")\n\ttarget.GetOrCreateStream(sampleAddr1, p2pcommon.P2PSubAddr)\n\ttarget.GetOrCreateStream(sampleAddr1, p2pcommon.P2PSubAddr)\n\ttime.Sleep(time.Second)\n\tif len(target.Peerstore().Peers()) != 1 {\n\t\tt.Errorf(\"Peer count : Expected %d, Actually %d\", 1, len(target.Peerstore().Peers()))\n\t}\n\ttarget.GetOrCreateStream(sampleAddr2, p2pcommon.P2PSubAddr)\n\ttime.Sleep(time.Second * 1)\n\tif len(target.Peerstore().Peers()) != 2 {\n\t\tt.Errorf(\"Peer count : Expected %d, Actually %d\", 2, len(target.Peerstore().Peers()))\n\t}\n}", "title": "" }, { "docid": "f4f0c7bb7ecdd7de05f9bc78b4b404aa", "score": "0.48173696", "text": "func makeEmptyMessage(msgType MessageType) (Message, error) {\n\tvar msg Message\n\n\tswitch msgType {\n\tcase WatchNewChannelMsg:\n\t\tmsg = &WatchNewChannelMessage{}\n\tcase AddRevocationDataMsg:\n\t\tmsg = &AddRevocationDataMessage{}\n\tcase PingMsg:\n\t\tmsg = &PingMessage{}\n\tcase PongMsg:\n\t\tmsg = &PongMessage{}\n\tcase InitMsg:\n\t\tmsg = &InitMessage{}\n\tcase StatesMsg:\n\t\tmsg = &StatesMessage{}\n\tdefault:\n\t\treturn nil, &UnknownMessage{msgType}\n\t}\n\n\treturn msg, nil\n}", "title": "" }, { "docid": "58b0eaf0549eb9eb3db07d694427ff8b", "score": "0.48114276", "text": "func TestExecutor_Execute_Empty_Difference(t *testing.T) {\n\tc := test.MustRunCluster(t, 1)\n\tdefer c.Close()\n\thldr := test.Holder{Holder: c[0].Server.Holder()}\n\thldr.SetBit(\"i\", \"general\", 10, 1)\n\n\tif res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: \"i\", Query: `Difference()`}); err == nil {\n\t\tt.Fatalf(\"Empty Difference query should give error, but got %v\", res)\n\t}\n}", "title": "" }, { "docid": "0a9a0646802f0dc8285a87300ea3bb9a", "score": "0.47996265", "text": "func TestZero(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tmaster string\n\t\textKey string\n\t\tnet *chaincfg.Params\n\t}{\n\t\t// Test vector 1\n\t\t{\n\t\t\tname: \"test vector 1 chain m\",\n\t\t\tmaster: \"000102030405060708090a0b0c0d0e0f\",\n\t\t\textKey: \"xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi\",\n\t\t\tnet: &chaincfg.MainNetParams,\n\t\t},\n\n\t\t// Test vector 2\n\t\t{\n\t\t\tname: \"test vector 2 chain m\",\n\t\t\tmaster: \"fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542\",\n\t\t\textKey: \"xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U\",\n\t\t\tnet: &chaincfg.MainNetParams,\n\t\t},\n\t}\n\n\t// Use a closure to test that a key is zeroed since the tests create\n\t// keys in different ways and need to test the same things multiple\n\t// times.\n\ttestZeroed := func(i int, testName string, key *ExtendedKey) bool {\n\t\t// Zeroing a key should result in it no longer being private\n\t\tif key.IsPrivate() {\n\t\t\tt.Errorf(\"IsPrivate #%d (%s): mismatched key type -- \"+\n\t\t\t\t\"want private %v, got private %v\", i, testName,\n\t\t\t\tfalse, key.IsPrivate())\n\t\t\treturn false\n\t\t}\n\n\t\tparentFP := key.ParentFingerprint()\n\t\tif parentFP != 0 {\n\t\t\tt.Errorf(\"ParentFingerprint #%d (%s): mismatched \"+\n\t\t\t\t\"parent fingerprint -- want %d, got %d\", i,\n\t\t\t\ttestName, 0, parentFP)\n\t\t\treturn false\n\t\t}\n\n\t\twantKey := \"zeroed extended key\"\n\t\tserializedKey := key.String()\n\t\tif serializedKey != wantKey {\n\t\t\tt.Errorf(\"String #%d (%s): mismatched serialized key \"+\n\t\t\t\t\"-- want %s, got %s\", i, testName, wantKey,\n\t\t\t\tserializedKey)\n\t\t\treturn false\n\t\t}\n\n\t\twantErr := ErrNotPrivExtKey\n\t\t_, err := key.ECPrivKey()\n\t\tif !reflect.DeepEqual(err, wantErr) {\n\t\t\tt.Errorf(\"ECPrivKey #%d (%s): mismatched error: want \"+\n\t\t\t\t\"%v, got %v\", i, testName, wantErr, err)\n\t\t\treturn false\n\t\t}\n\n\t\twantErr = secp_ecdsa.ErrPubKeyInvalidLen\n\t\t_, err = key.ECPubKey()\n\t\tif !errors.Is(err, wantErr) {\n\t\t\tt.Errorf(\"ECPubKey #%d (%s): mismatched error: want \"+\n\t\t\t\t\"%v, got %v\", i, testName, wantErr, err)\n\t\t\treturn false\n\t\t}\n\n\t\twantAddr := \"1HT7xU2Ngenf7D4yocz2SAcnNLW7rK8d4E\"\n\t\taddr, err := key.Address(&chaincfg.MainNetParams)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Address #%d (%s): unexpected error: %v\", i,\n\t\t\t\ttestName, err)\n\t\t\treturn false\n\t\t}\n\t\tif addr.EncodeAddress() != wantAddr {\n\t\t\tt.Errorf(\"Address #%d (%s): mismatched address -- want \"+\n\t\t\t\t\"%s, got %s\", i, testName, wantAddr,\n\t\t\t\taddr.EncodeAddress())\n\t\t\treturn false\n\t\t}\n\n\t\treturn true\n\t}\n\n\tfor i, test := range tests {\n\t\t// Create new key from seed and get the neutered version.\n\t\tmasterSeed, err := hex.DecodeString(test.master)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"DecodeString #%d (%s): unexpected error: %v\",\n\t\t\t\ti, test.name, err)\n\t\t\tcontinue\n\t\t}\n\t\tkey, err := NewMaster(masterSeed, test.net)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"NewMaster #%d (%s): unexpected error when \"+\n\t\t\t\t\"creating new master key: %v\", i, test.name,\n\t\t\t\terr)\n\t\t\tcontinue\n\t\t}\n\t\tneuteredKey, err := key.Neuter()\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Neuter #%d (%s): unexpected error: %v\", i,\n\t\t\t\ttest.name, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Ensure both non-neutered and neutered keys are zeroed\n\t\t// properly.\n\t\tkey.Zero()\n\t\tif !testZeroed(i, test.name+\" from seed not neutered\", key) {\n\t\t\tcontinue\n\t\t}\n\t\tneuteredKey.Zero()\n\t\tif !testZeroed(i, test.name+\" from seed neutered\", key) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Deserialize key and get the neutered version.\n\t\tkey, err = NewKeyFromString(test.extKey)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"NewKeyFromString #%d (%s): unexpected \"+\n\t\t\t\t\"error: %v\", i, test.name, err)\n\t\t\tcontinue\n\t\t}\n\t\tneuteredKey, err = key.Neuter()\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Neuter #%d (%s): unexpected error: %v\", i,\n\t\t\t\ttest.name, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Ensure both non-neutered and neutered keys are zeroed\n\t\t// properly.\n\t\tkey.Zero()\n\t\tif !testZeroed(i, test.name+\" deserialized not neutered\", key) {\n\t\t\tcontinue\n\t\t}\n\t\tneuteredKey.Zero()\n\t\tif !testZeroed(i, test.name+\" deserialized neutered\", key) {\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d8c9275db9cdcb621b9b1e236e6831b6", "score": "0.4796749", "text": "func testUnsetTxThreadPoolSize(t *testing.T) {\n\t// 1. Instantiate K2hash class\n\tf, err := k2hash.NewK2hash(\"/tmp/test.k2h\")\n\tif f == nil {\n\t\tdefer f.Close()\n\t\tt.Errorf(\"k2hash.NewK2hash(/tmp/test.k2h) = (nil, error), want not nil\")\n\t}\n\tif err != nil {\n\t\tt.Errorf(\"k2hash.NewK2hash(/tmp/test.k2h) error %v\", err)\n\t}\n\n\t// 2. print\n\tf.UnsetTxThreadPoolSize()\n}", "title": "" }, { "docid": "ad8a02c6b596b472f7b67edf27e665a5", "score": "0.4789635", "text": "func TestP2PModuleCommunication() error {\n\tconn, err := grpc.Dial(\"127.0.0.1:11883\", grpc.WithInsecure())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tclient0 := pb.NewP2PRPCClient(conn)\n\n\tconn1, err := grpc.Dial(\"127.0.0.1:11783\", grpc.WithInsecure())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tclient1 := pb.NewP2PRPCClient(conn1)\n\n\tpeers0, err := client0.GetPeers(context.Background(), &empty.Empty{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Print(\"Peer 0 Peers: \")\n\tfor _, p := range peers0.Peers {\n\t\tfmt.Printf(\"%s, \", p.Address)\n\t}\n\tfmt.Println()\n\tpeers1, err := client1.GetPeers(context.Background(), &empty.Empty{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Print(\"Peer 1 Peers: \")\n\tfor _, p := range peers1.Peers {\n\t\tfmt.Printf(\"%s, \", p.Address)\n\t}\n\tfmt.Println()\n\n\ts0, err := client0.Subscribe(context.Background(), &pb.SubscriptionRequest{Topic: \"cows\"})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t_, err = client0.Subscribe(context.Background(), &pb.SubscriptionRequest{Topic: \"not-cows\"})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tstream, err := client0.ListenForMessages(context.Background(), s0)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdoneChan := make(chan error)\n\n\tgo func() {\n\t\tmsg, err := stream.Recv()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif !bytes.Equal(msg.Data, []byte(\"I'm a cow\")) {\n\t\t\tdoneChan <- errors.New(\"received incorrect message\")\n\t\t}\n\n\t\tdoneChan <- nil\n\t}()\n\n\tfmt.Println(\"peer 1 sending message to topic cow: I'm a cow\")\n\n\t_, err = client1.Broadcast(context.Background(), &pb.MessageAndTopic{Data: []byte(\"I'm not a cow\"), Topic: \"not-cows\"})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = client1.Broadcast(context.Background(), &pb.MessageAndTopic{Data: []byte(\"I'm a cow\"), Topic: \"cows\"})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn <-doneChan\n}", "title": "" }, { "docid": "b03023b74c601dd29735f60b4d2d23ce", "score": "0.4783749", "text": "func TestPairEmptyDeserialize(t *testing.T) {\n\tvar err error\n\tsPair := new(Pair)\n\tif err = sPair.Deserialize(emptyExpectedBuf[:]); err != nil {\n\t\tt.Errorf(\"Error deserializing empty buffer %8x for pair\", emptyExpectedBuf)\n\t\treturn\n\t}\n\n\tif *sPair != *emptyPair {\n\t\tt.Errorf(\"The empty pair did not deserialize correctly\")\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "42a878b179d4f0e270980482f1f00deb", "score": "0.47833017", "text": "func TestDeleteAllQuestions(t *testing.T) {\n err := qa_client.DeleteAllQuestions()\n if err != nil {\n t.Error(err) \n }\n qas, err := qa_client.ReadAllQuestions()\n if err != nil {\n t.Error(err) \n }\n if len(qas) != 0 {\n t.Errorf(\"Some questions were not deleted.\")\n }\n}", "title": "" }, { "docid": "79e76ce0529dbada7bffa62e9d45e41f", "score": "0.47824195", "text": "func (*EmptyReply) Descriptor() ([]byte, []int) {\n\treturn file_base_types_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "6b7c4dcb29721202d419429183980b35", "score": "0.47731858", "text": "func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) {\n\n\tmainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{\n\t\tCounter{cRestSubReqFromXapp, 1},\n\t\tCounter{cRestSubRespToXapp, 1},\n\t\tCounter{cSubReqToE2, 1},\n\t\tCounter{cSubRespFromE2, 1},\n\t\tCounter{cRestSubNotifToXapp, 1},\n\t\tCounter{cRestSubDelReqFromXapp, 1},\n\t\tCounter{cRestSubDelRespToXapp, 1},\n\t\tCounter{cSubDelReqToE2, 1},\n\t\tCounter{cSubDelReqTimerExpiry, 2},\n\t\tCounter{cSubDelReReqToE2, 1},\n\t\tCounter{cSubDelFailFromE2, 2},\n\t})\n\n\t// Req\n\tvar params *teststube2ap.RESTSubsReqParams = nil\n\trestSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)\n\n\t// Del\n\txappConn1.SendRESTSubsDelReq(t, &restSubId)\n\n\t// E2t: Receive 1st SubsDelReq\n\tdelreq, delmsg := e2termConn1.RecvSubsDelReq(t)\n\n\tmainCtrl.MakeTransactionNil(t, e2SubsId)\n\n\t// No transaction exist for this response which will result resending original request\n\te2termConn1.SendSubsDelFail(t, delreq, delmsg)\n\n\t// E2t: Receive 2nd SubsDelReq\n\tdelreq, delmsg = e2termConn1.RecvSubsDelReq(t)\n\n\t// Subscription does not exist in in E2 Node.\n\te2termConn1.SendSubsDelFail(t, delreq, delmsg)\n\n\t// Wait that subs is cleaned\n\tmainCtrl.wait_subs_clean(t, e2SubsId, 10)\n\n\txappConn1.TestMsgChanEmpty(t)\n\te2termConn1.TestMsgChanEmpty(t)\n\tmainCtrl.wait_registry_empty(t, 10)\n\tmainCtrl.VerifyAllClean(t)\n\tmainCtrl.VerifyCounterValues(t)\n}", "title": "" }, { "docid": "ad6bb858873a299b6d71e012a5efbddf", "score": "0.47700864", "text": "func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) {\n\n\tmainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{\n\t\tCounter{cRestSubReqFromXapp, 1},\n\t\tCounter{cRestSubRespToXapp, 1},\n\t\tCounter{cSubReqToE2, 1},\n\t\tCounter{cSubRespFromE2, 1},\n\t\tCounter{cRestSubNotifToXapp, 1},\n\t\tCounter{cRestSubDelReqFromXapp, 1},\n\t\tCounter{cRestSubDelRespToXapp, 1},\n\t\tCounter{cSubDelReqToE2, 1},\n\t\tCounter{cSubDelReqTimerExpiry, 1},\n\t\tCounter{cSubDelReReqToE2, 1},\n\t\tCounter{cSubDelRespFromE2, 1},\n\t\tCounter{cSubDelFailFromE2, 1},\n\t})\n\n\t// Req\n\tvar params *teststube2ap.RESTSubsReqParams = nil\n\trestSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)\n\n\t// Del\n\txappConn1.SendRESTSubsDelReq(t, &restSubId)\n\n\t// E2t: Receive 1st SubsDelReq\n\tdelreq, delmsg := e2termConn1.RecvSubsDelReq(t)\n\n\t// Unknown instanceId in this response which will result resending original request\n\tdelreq.RequestId.InstanceId = 0\n\te2termConn1.SendSubsDelResp(t, delreq, delmsg)\n\n\t// E2t: Receive 2nd SubsDelReq\n\tdelreq, delmsg = e2termConn1.RecvSubsDelReq(t)\n\n\t// Subscription does not exist in in E2 Node.\n\te2termConn1.SendSubsDelFail(t, delreq, delmsg)\n\n\t// Wait that subs is cleaned\n\tmainCtrl.wait_subs_clean(t, e2SubsId, 10)\n\n\txappConn1.TestMsgChanEmpty(t)\n\te2termConn1.TestMsgChanEmpty(t)\n\tmainCtrl.wait_registry_empty(t, 10)\n\tmainCtrl.VerifyAllClean(t)\n\tmainCtrl.VerifyCounterValues(t)\n}", "title": "" }, { "docid": "391586c0fa454c8244ae6f938778aa87", "score": "0.4769059", "text": "func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) {\n\n\tmainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{\n\t\tCounter{cRestSubReqFromXapp, 1},\n\t\tCounter{cRestSubRespToXapp, 1},\n\t\tCounter{cSubReqToE2, 1},\n\t\tCounter{cSubReqTimerExpiry, 2},\n\t\tCounter{cSubReReqToE2, 1},\n\t\tCounter{cSubRespFromE2, 1},\n\t\tCounter{cSubFailFromE2, 1},\n\t\tCounter{cRestSubFailNotifToXapp, 1},\n\t\tCounter{cRestSubDelReqFromXapp, 1},\n\t\tCounter{cRestSubDelRespToXapp, 1},\n\t\tCounter{cSubDelReqToE2, 1},\n\t\tCounter{cSubDelReqTimerExpiry, 2},\n\t\tCounter{cSubDelReReqToE2, 1},\n\t\tCounter{cSubDelRespFromE2, 2},\n\t})\n\n\tconst subReqCount int = 1\n\n\t// Req\n\tparams := xappConn1.GetRESTSubsReqReportParams(subReqCount)\n\trestSubId := xappConn1.SendRESTSubsReq(t, params)\n\n\tcrereq, cremsg := e2termConn1.RecvSubsReq(t)\n\n\tmainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId)\n\t// No transaction exist for this response which will result resending original request\n\te2termConn1.SendSubsResp(t, crereq, cremsg)\n\n\t_, cremsg = e2termConn1.RecvSubsReq(t)\n\n\txappConn1.ExpectRESTNotificationNok(t, restSubId, \"allFail\")\n\n\t// Subscription already created in E2 Node.\n\tfparams := &teststube2ap.E2StubSubsFailParams{}\n\tfparams.Set(crereq)\n\tfparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action\n\te2termConn1.SendSubsFail(t, fparams, cremsg)\n\n\tdelreq, delmsg := e2termConn1.RecvSubsDelReq(t)\n\te2termConn1.SendSubsDelResp(t, delreq, delmsg)\n\n\t// Resending happens because there no transaction\n\tdelreq, delmsg = e2termConn1.RecvSubsDelReq(t)\n\te2termConn1.SendSubsDelResp(t, delreq, delmsg)\n\n\tinstanceId := xappConn1.WaitRESTNotification(t, restSubId)\n\txapp.Logger.Debug(\"TEST: REST notification received e2SubsId=%v\", instanceId)\n\n\txappConn1.SendRESTSubsDelReq(t, &restSubId)\n\n\t// Wait that subs is cleaned\n\tmainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10)\n\n\txappConn1.TestMsgChanEmpty(t)\n\te2termConn1.TestMsgChanEmpty(t)\n\tmainCtrl.wait_registry_empty(t, 10)\n\tmainCtrl.VerifyAllClean(t)\n\tmainCtrl.VerifyCounterValues(t)\n}", "title": "" }, { "docid": "c1d0a055b2ee609f645c051e7f3e9568", "score": "0.47628784", "text": "func TestPublicationNonExisting(t *testing.T) {\n\targs, _ := setupTest(t)\n\n\tstreamName := \"test-stream\"\n\tmessageText := \"test message text\"\n\n\targs = append(args,\n\t\tpublishCommand.Name,\n\t\t\"--\"+streamFlag.Name, streamName,\n\t\t\"--\"+messageFlag.Name, messageText,\n\t)\n\n\terr := Run(args)\n\trequire.Error(t, err)\n\trequire.True(t, strings.HasSuffix(err.Error(), lift.ErrNoSuchPartition.Error()))\n}", "title": "" }, { "docid": "22346d2041adb4a8038845b898333ecc", "score": "0.47563842", "text": "func TestPresence(t *testing.T) {\n customUuid := \"customuuid\"\n testName := \"Presence\"\n pubnubInstance := pubnubMessaging.PubnubInit(\"demo\", \"demo\", \"\", \"\", false, customUuid) \n channel := \"testForPresenceChannel\"\n returnPresenceChannel := make(chan []byte)\n go SubscribeToPresence(channel, pubnubInstance, t, testName, customUuid, returnPresenceChannel)\n time.Sleep(500*time.Millisecond)\n go SubscribeRoutine(channel, pubnubInstance)\n\n _endPresenceTestAsSuccess = false\n _endPresenceTestAsFailure = false\n \n for {\n if(_endPresenceTestAsSuccess){\n \tfmt.Println(\"Test '\" + testName + \"': passed.\");\n break\n } else if (_endPresenceTestAsFailure) {\n t.Error(\"Test '\" + testName + \"': failed.\");\n \tbreak\n }\n time.Sleep(500*time.Millisecond) \n }\n}", "title": "" }, { "docid": "14133589754fa38a40ae00eb6f4ff6aa", "score": "0.47546518", "text": "func NewEmptyMessage() *Message {\n\treturn &Message{\n\t\tResponseType: \"ephemeral\",\n\t\tText: \"No Results Found\",\n\t}\n}", "title": "" }, { "docid": "8d9102dd553b52cefc3207a5e16f9b9d", "score": "0.47389254", "text": "func (m MessageEmpty) construct() MessageClass { return &m }", "title": "" }, { "docid": "01b3aedcefc6b8362da03bb5528db09c", "score": "0.47211555", "text": "func (s *ErrplaneAggregatorApiSuite) TestDoesNotSendEmptyPoints(c *C) {\n\tep := newTestClient(\"app4you2love\", \"staging\", \"some_key\")\n\tep.SetUdpAddr(udpListener.LocalAddr().(*net.UDPAddr).String())\n\tc.Assert(ep, NotNil)\n\n\terr := ep.ReportUDP(\"some_metric\", 123.4, \"doesn't send empty points\", Dimensions{\n\t\t\"foo\": \"bar\",\n\t})\n\tc.Assert(err, IsNil)\n\tep.Close()\n\n\ttime.Sleep(200 * time.Millisecond)\n\n\tc.Assert(udpRecorder.requests, HasLen, 1)\n\texpected := fmt.Sprintf(`{\"d\":\"app4you2lovestaging\",\"a\":\"some_key\",\"o\":\"r\",\"w\":[{\"n\":\"some_metric\",\"p\":[{\"v\":123.4,\"c\":\"doesn't send empty points\",\"d\":{\"foo\":\"bar\"}}]}]}`)\n\tc.Assert(udpRecorder.requests, Contains, expected)\n}", "title": "" }, { "docid": "375e92e885995835e20343a23b892637", "score": "0.47193873", "text": "func Nop() {}", "title": "" }, { "docid": "3a0d6a5177c6323c928669f6cf849b82", "score": "0.47179905", "text": "func TestRPC_ClientOp(t *testing.T) {\n\trng := pkgtest.Prng(t)\n\tenclave := optest.NewMockedEnclave()\n\top := optest.NewRPROperator(enclave)\n\top.Run()\n\tosc := operator.OpServerConfig{\n\t\tHost: \"\",\n\t\tPort: opRPCPort,\n\t\tClientConfig: config.OpClientConfig{},\n\t}\n\trpcServer := operator.NewRPC(op, osc)\n\tgo func() {\n\t\tif err := rpcServer.Serve(); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\ttime.Sleep(shortWait)\n\trpcClient, err := client.NewRPC(\"0.0.0.0\", opRPCPort)\n\tmyErr := errors.New(\"Should fail\")\n\trequire.NoError(t, err)\n\tctx, cancel := context.WithTimeout(context.Background(), longWait)\n\tdefer cancel()\n\n\tt.Run(\"SendTx-error\", func(t *testing.T) {\n\t\ttx := ttest.RandomTx(t, rng)\n\t\tenclave.SetProcessTXsError(myErr)\n\t\terr = rpcClient.SendTx(ctx, *tx)\n\t\tassert.Error(t, err)\n\t\tenclave.SetProcessTXsError(nil)\n\t})\n\n\tt.Run(\"SendTx-ok\", func(t *testing.T) {\n\t\ttx := ttest.RandomTx(t, rng)\n\t\terr = rpcClient.SendTx(ctx, *tx)\n\t\trequire.NoError(t, err)\n\t\ttx2 := <-enclave.Transactions()\n\t\tassert.Equal(t, tx, tx2)\n\t})\n\n\tdp := ttest.RandomDP(rng)\n\tbp := ttest.RandomBP(rng)\n\tuser1 := dp.Balance.Account\n\tbp.Balance.Account = user1\n\tvar sub *client.Subscription\n\n\tfor i := int64(0); i < 5; i++ {\n\t\t// Push in proofs for our client.\n\t\tdp.Balance.Value = (*tee.Amount)(big.NewInt(i))\n\t\tbp.Balance.Value = (*tee.Amount)(big.NewInt(i))\n\t\tenclave.PushDepositProof(dp)\n\t\tenclave.PushBalanceProof(bp)\n\t\t// Push in proofs for other clients.\n\t\tenclave.PushBalanceProof(ttest.RandomBP(rng))\n\t\tenclave.PushDepositProof(ttest.RandomDP(rng))\n\t}\n\n\tt.Run(\"Subscribe-error\", func(t *testing.T) {\n\t\top.SetSubscribeProofsError(myErr)\n\t\t_, err := rpcClient.Subscribe(ctx, user1)\n\t\tassert.Error(t, err)\n\t\top.SetSubscribeProofsError(nil)\n\t})\n\n\t// Wait for the OP to process the enclave's proofs.\n\ttime.Sleep(shortWait)\n\tt.Run(\"Subscribe-ok\", func(t *testing.T) {\n\t\tsub, err = rpcClient.Subscribe(ctx, user1)\n\t\tassert.NoError(t, err)\n\t\trequire.NotNil(t, sub)\n\t})\n\n\t// Test that the client receives the latest buffered proofs.\n\tt.Run(\"Subscription-DP-buffer-latest\", func(t *testing.T) {\n\t\tproof, err := sub.DepositProof(ctx)\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, *dp, proof)\n\t})\n\n\tt.Run(\"Subscription-BP-buffer-latest\", func(t *testing.T) {\n\t\tproof, err := sub.BalanceProof(ctx)\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, *bp, proof)\n\t})\n\n\t// Test that the client receives the latest unbuffered proofs.\n\tt.Run(\"Subscription-BP-latest\", func(t *testing.T) {\n\t\tbp.Balance.Epoch = 1234\n\t\tenclave.PushBalanceProof(bp)\n\t\ttime.Sleep(shortWait) // Wait for OP.\n\t\tproof, err := sub.BalanceProof(ctx)\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, *bp, proof)\n\t})\n\n\tt.Run(\"Subscription-DP-latest\", func(t *testing.T) {\n\t\tdp.Balance.Epoch = 1234\n\t\tenclave.PushDepositProof(dp)\n\t\ttime.Sleep(shortWait) // Wait for OP.\n\t\tproof, err := sub.DepositProof(ctx)\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, *dp, proof)\n\t})\n\n\tassert.NoError(t, rpcClient.Close())\n\tassert.NoError(t, rpcServer.Close())\n}", "title": "" }, { "docid": "9ea4e939f873b130dc0e983f13253d75", "score": "0.47083792", "text": "func (*EmptyMessage) Descriptor() ([]byte, []int) {\n\treturn file_namenode_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "75eca48a346d6a56ca8f4c3f07266389", "score": "0.47009307", "text": "func TestMemberFromProtoNils(t *testing.T) {\n\t// Spec is nil\n\tmember := ToMemberProto(newAccessListMember(t, \"access-list-member\"))\n\tmember.Spec = nil\n\n\t_, err := FromMemberProto(member)\n\trequire.Error(t, err)\n\n\t// AccessList is empty\n\tmember = ToMemberProto(newAccessListMember(t, \"access-list-member\"))\n\tmember.Spec.AccessList = \"\"\n\n\t_, err = FromMemberProto(member)\n\trequire.Error(t, err)\n\n\t// Name is empty\n\tmember = ToMemberProto(newAccessListMember(t, \"access-list-member\"))\n\tmember.Spec.Name = \"\"\n\n\t_, err = FromMemberProto(member)\n\trequire.Error(t, err)\n\n\t// Joined is nil\n\tmember = ToMemberProto(newAccessListMember(t, \"access-list-member\"))\n\tmember.Spec.Joined = nil\n\n\t_, err = FromMemberProto(member)\n\trequire.Error(t, err)\n\n\t// Expires is nil\n\tmember = ToMemberProto(newAccessListMember(t, \"access-list-member\"))\n\tmember.Spec.Expires = nil\n\n\t_, err = FromMemberProto(member)\n\trequire.NoError(t, err)\n\n\t// Reason is empty\n\tmember = ToMemberProto(newAccessListMember(t, \"access-list-member\"))\n\tmember.Spec.Reason = \"\"\n\n\t_, err = FromMemberProto(member)\n\trequire.NoError(t, err)\n\n\t// AddedBy is empty\n\tmember = ToMemberProto(newAccessListMember(t, \"access-list-member\"))\n\tmember.Spec.AddedBy = \"\"\n\n\t_, err = FromMemberProto(member)\n\trequire.Error(t, err)\n}", "title": "" }, { "docid": "c60b860c949d15ee2b92269cf8003d3f", "score": "0.46939436", "text": "func TestQueryReadEmpty(t *testing.T) {\n\t// Create configuration\n\tconfig, err := NewConfig()\n\tassert.Nil(t, err)\n\n\t// Test context with config\n\tcontext, err := NewContext(config)\n\tassert.Nil(t, err)\n\n\t// Test create dimension\n\tdimension, err := NewDimension(context, \"dim1\", []int8{1, 10}, int8(5))\n\tassert.Nil(t, err)\n\tassert.NotNil(t, dimension)\n\n\t// Test creating domain\n\tdomain, err := NewDomain(context)\n\tassert.Nil(t, err)\n\tassert.NotNil(t, domain)\n\n\t// Add dimension\n\terr = domain.AddDimensions(dimension)\n\tassert.Nil(t, err)\n\n\t// Create array schema\n\tarraySchema, err := NewArraySchema(context, TILEDB_DENSE)\n\tassert.Nil(t, err)\n\tassert.NotNil(t, arraySchema)\n\n\t// Create attribute to add to schema\n\tattribute, err := NewAttribute(context, \"a1\", TILEDB_INT32)\n\tassert.Nil(t, err)\n\tassert.NotNil(t, attribute)\n\n\t// Create attribute to add to schema\n\tattribute2, err := NewAttribute(context, \"a2\", TILEDB_STRING_ASCII)\n\tassert.Nil(t, err)\n\tassert.NotNil(t, attribute2)\n\n\t// Create attribute to add to schema\n\tattribute3, err := NewAttribute(context, \"a3\", TILEDB_FLOAT32)\n\tassert.Nil(t, err)\n\tassert.NotNil(t, attribute3)\n\n\t// Crete attribute to add to schema\n\tattribute4, err := NewAttribute(context, \"a4\", TILEDB_STRING_UTF8)\n\tassert.Nil(t, err)\n\tassert.NotNil(t, attribute4)\n\n\t// Set a3 to be variable length\n\terr = attribute3.SetCellValNum(TILEDB_VAR_NUM)\n\tassert.Nil(t, err)\n\n\t// Set a4 to be variable length\n\terr = attribute4.SetCellValNum(TILEDB_VAR_NUM)\n\tassert.Nil(t, err)\n\n\t// Add Attribute\n\terr = arraySchema.AddAttributes(attribute, attribute2, attribute3, attribute4)\n\tassert.Nil(t, err)\n\n\t// Set Domain\n\terr = arraySchema.SetDomain(domain)\n\tassert.Nil(t, err)\n\n\t// create temp group name\n\ttmpArrayPath := os.TempDir() + string(os.PathSeparator) + \"tiledb_test_array\"\n\t// Cleanup group when test ends\n\tdefer os.RemoveAll(tmpArrayPath)\n\tif _, err = os.Stat(tmpArrayPath); err == nil {\n\t\tos.RemoveAll(tmpArrayPath)\n\t}\n\t// Create new array struct\n\tarray, err := NewArray(context, tmpArrayPath)\n\tassert.Nil(t, err)\n\tassert.NotNil(t, array)\n\n\t// Create array on disk\n\terr = array.Create(arraySchema)\n\tassert.Nil(t, err)\n\n\t// Open array for reading\n\terr = array.Open(TILEDB_READ)\n\tassert.Nil(t, err)\n\n\t// Create Query\n\tquery, err := NewQuery(context, array)\n\tassert.Nil(t, err)\n\tassert.NotNil(t, query)\n\n\t// Limit reading to subArray\n\terr = query.SetSubArray([]int8{2, 4})\n\tassert.Nil(t, err)\n\n\t// Set buffer to incorrect type, should err\n\tbufferA1Bad := make([]int8, 2)\n\t_, err = query.SetBuffer(\"a1\", bufferA1Bad)\n\tassert.NotNil(t, err)\n\n\t// Create read buffers\n\tbufferA1 := make([]int32, 2)\n\t_, err = query.SetBuffer(\"a1\", bufferA1)\n\tassert.Nil(t, err)\n\n\tbufferA2 := make([]byte, 2)\n\t_, err = query.SetBuffer(\"a2\", bufferA2)\n\tassert.Nil(t, err)\n\n\tbufferA3 := make([]float32, 5)\n\toffsetBufferA3 := make([]uint64, 3)\n\t_, _, err = query.SetBufferVar(\"a3\", offsetBufferA3, bufferA3)\n\tassert.Nil(t, err)\n\n\tbufferA4 := make([]byte, 4)\n\toffsetBufferA4 := make([]uint64, 4)\n\t_, _, err = query.SetBufferVar(\"a4\", offsetBufferA4, bufferA4)\n\tassert.Nil(t, err)\n\n\t// Set read layout\n\tassert.Nil(t, query.SetLayout(TILEDB_ROW_MAJOR))\n\n\t// Submit query\n\tassert.Nil(t, query.Submit())\n\n\t// Validate status, since query was used this is should be complete\n\tstatus, err := query.Status()\n\tassert.Nil(t, err)\n\tassert.Equal(t, TILEDB_COMPLETED, status)\n\n\t// Validate query type\n\tqueryType, err := query.Type()\n\tassert.Nil(t, err)\n\tassert.Equal(t, TILEDB_READ, queryType)\n\n\t// No results because query it empty\n\thasResults, err := query.HasResults()\n\tassert.Nil(t, err)\n\tassert.Equal(t, false, hasResults)\n\n}", "title": "" }, { "docid": "05c52baa6107df3f23d32d92c13b6dec", "score": "0.46849096", "text": "func TestParseFilledFile2(t *testing.T) {\n\ttestdata := protoParseTestInit(t)\n\tbuf, err := ioutil.ReadFile(testdata[\"FileWith4Chunks\"])\n\tif err != nil {\n\t\tt.Fatalf(\"input file not available\")\n\t}\n\tif _, err := os.Stat(\"protoTesting2Files\"); err == nil {\n\t\tos.Remove(\"protoTesting2Files\")\n\t}\n\ttestfile, _ := os.OpenFile(\"protoTesting2Files\", os.O_WRONLY|os.O_CREATE, 0666)\n\ttestfile.Write(buf)\n\ttestfile.Write(buf)\n\ttestfile.Close()\n\n\tmessageChan := make(chan []byte, 1000)\n\tprotoParser := NewProtoParser(\"protoTesting2Files\", messageChan)\n\n\t// now on 'ParseFile'\n\tprotoParser.ParseFile()\n\n\tbuf, ok := <-messageChan\n\tif !ok {\n\t\tt.Fatal(\"No message was parsed\")\n\t}\n\n\tf := new(traceProto.File)\n\tif err := proto.Unmarshal(buf, f); err != nil {\n\t\tt.Fatalf(\"Couldn't unmarshal test protobuf: %v\", err)\n\t}\n\n\tif f.GetFilename() != \"filename A\" {\n\t\tt.Fatalf(\"Wrong filename: got %v\", f.GetFilename())\n\t} else if f.GetFsize() != 42 {\n\t\tt.Fatalf(\"Wrong siae: got %v\", f.GetFsize())\n\t} else if f.GetLabel() != \"label A\" {\n\t\tt.Fatalf(\"Wrong label: got %v\", f.GetLabel())\n\t} else if f.GetType() != \"type A\" {\n\t\tt.Fatalf(\"Wrong type: got %v\", f.GetType())\n\t} else if f.GetChunkCount() != 4 {\n\t\tt.Fatalf(\"Wrong chunkCount: got %v\", f.GetChunkCount())\n\t}\n\n\tfor i := 0; i < 4; i++ {\n\t\tchunk := new(traceProto.Chunk)\n\t\tif buf, ok := <-messageChan; !ok {\n\t\t\tt.Fatal(\"No message was parsed\")\n\t\t} else if err := proto.Unmarshal(buf, chunk); err != nil {\n\t\t\tt.Fatalf(\"Couldn't unmarshal test protobuf: %v\", err)\n\t\t}\n\n\t\tif chunk.GetFp()[0] != byte(i) {\n\t\t\tt.Fatalf(\"Chunk %v has wrong fp, got: %x\", i, chunk.GetFp())\n\t\t} else if chunk.GetCsize() != uint32(i) {\n\t\t\tt.Fatalf(\"Chunk %v has wrong size, got: %v\", i, chunk.GetCsize())\n\t\t}\n\t}\n\n\t// second round(file)\n\n\tbuf, ok = <-messageChan\n\tif !ok {\n\t\tt.Fatal(\"No message was parsed\")\n\t}\n\n\tf = new(traceProto.File)\n\tif err := proto.Unmarshal(buf, f); err != nil {\n\t\tt.Fatalf(\"Couldn't unmarshal test protobuf: %v\", err)\n\t}\n\n\tif f.GetFilename() != \"filename A\" {\n\t\tt.Fatalf(\"Wrong filename: got %v\", f.GetFilename())\n\t} else if f.GetFsize() != 42 {\n\t\tt.Fatalf(\"Wrong siae: got %v\", f.GetFsize())\n\t} else if f.GetLabel() != \"label A\" {\n\t\tt.Fatalf(\"Wrong label: got %v\", f.GetLabel())\n\t} else if f.GetType() != \"type A\" {\n\t\tt.Fatalf(\"Wrong type: got %v\", f.GetType())\n\t} else if f.GetChunkCount() != 4 {\n\t\tt.Fatalf(\"Wrong chunkCount: got %v\", f.GetChunkCount())\n\t}\n\n\tfor i := 0; i < 4; i++ {\n\t\tchunk := new(traceProto.Chunk)\n\t\tif buf, ok := <-messageChan; !ok {\n\t\t\tt.Fatal(\"No message was parsed\")\n\t\t} else if err := proto.Unmarshal(buf, chunk); err != nil {\n\t\t\tt.Fatalf(\"Couldn't unmarshal test protobuf: %v\", err)\n\t\t}\n\n\t\tif chunk.GetFp()[0] != byte(i) {\n\t\t\tt.Fatalf(\"Chunk %v has wrong fp, got: %x\", i, chunk.GetFp())\n\t\t} else if chunk.GetCsize() != uint32(i) {\n\t\t\tt.Fatalf(\"Chunk %v has wrong size, got: %v\", i, chunk.GetCsize())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5467026023453a71cf8583d2abdb7738", "score": "0.46828443", "text": "func (suite *FIFOTestSuite) TestNoElementsAtInitialization() {\n\tlen := suite.fifo.GetLen()\n\tsuite.Equalf(0, len, \"No elements expected at initialization, currently: %v\", len)\n}", "title": "" }, { "docid": "bb613f5c49ab0df25676d93bd6ea5c16", "score": "0.46809378", "text": "func testMessageReuseFalsePositiveModern() {\n\tquery := &query.Query{}\n\tquery.Description = getUntrustedString()\n\tquery.Description = \"clean\"\n\n\tserialized, _ := proto.Marshal(query)\n\n\tsinkBytes(serialized) // $ SPURIOUS: hasTaintFlow=\"serialized\"\n}", "title": "" }, { "docid": "051313198ad66dfa7841f2799e207ea8", "score": "0.46762937", "text": "func TestEmptyGoRun(t *testing.T) {\n\tintegration.ProgramTest(t, &integration.ProgramTestOptions{\n\t\tDir: filepath.Join(\"empty\", \"gorun\"),\n\t\tDependencies: []string{\n\t\t\t\"github.com/pulumi/pulumi/sdk/v2\",\n\t\t},\n\t\tQuick: true,\n\t})\n}", "title": "" }, { "docid": "0fcf4aee6660f1d59c1bacca63a60c70", "score": "0.46659863", "text": "func (asserter Asserter) NotEmpty(obj interface{}, msg ...interface{}) {\n\tok, l := getLen(obj)\n\tif !ok {\n\t\tpanic(\"cannot get length\")\n\t}\n\n\tif l == 0 {\n\t\tdefMsg := fmt.Sprintf(\"got %d, want > 0\", l)\n\t\tasserter.reportAssertionFault(defMsg, msg...)\n\t}\n}", "title": "" }, { "docid": "bf504feb0bdbe1704c33257ddff93e54", "score": "0.4662553", "text": "func Test_Receiver_Run_09(t *testing.T) {\n\trc := newRunnableReceiver()\n\trc.Receive = nil\n\terr := rc.Run()\n\tif !matchError(err, \"nil Receiver.Receive\") {\n\t\tt.Error(\"0xE7C0AC\", \"wrong error:\", err)\n\t}\n}", "title": "" }, { "docid": "0c2073405d22c9448cc054fe1a399539", "score": "0.46586764", "text": "func testQueuePush(t *testing.T) {\n\t// 1. define test data.\n\ttestData := []qdata{\n\t\t// 1. default\n\t\t{\n\t\t\tp: []byte(\"push_prefix_2\"),\n\t\t\tv: []byte(\"push_prefix_2_val\"),\n\t\t\tk: nil,\n\t\t\tf: true,\n\t\t\tc: true,\n\t\t\tw: \"\",\n\t\t\te: 0,\n\t\t\ts: false,\n\t\t},\n\t\t// 2. default + key\n\t\t{\n\t\t\tp: []byte(\"push_prefix_2\"),\n\t\t\tv: []byte(\"push_prefix_2_val\"),\n\t\t\tk: []byte(\"push_prefix_2_key\"),\n\t\t\tf: true,\n\t\t\tc: true,\n\t\t\tw: \"\",\n\t\t\te: 0,\n\t\t\ts: false,\n\t\t},\n\t}\n\tk, err := k2hash.NewK2hash(\"/tmp/test.k2h\")\n\tif err != nil {\n\t\tt.Errorf(\"k2hash.NewK2hash(/tmp/test.k2h) return err %v\", err)\n\t}\n\tdefer k.Close()\n\n\tfor _, d := range testData {\n\t\tif ok, err := clearIfExists(\"/tmp/test.k2h\", string(d.k)); !ok {\n\t\t\tt.Errorf(\"clearIfExists(%v, %v = (%v, %v)\", \"/tmp/test.k2h\", string(d.k), ok, err)\n\t\t}\n\t\ttestQPushArgs(d, t)\n\t}\n}", "title": "" }, { "docid": "60dd90d548ffa37c0afcbcebebbb08a4", "score": "0.46524063", "text": "func (q *Quorum) Reset() {\n\tq.size = 0\n\tq.acks = make(map[ID]bool)\n\tq.zones = make(map[int]int)\n\tq.nacks = make(map[ID]bool)\n}", "title": "" }, { "docid": "1755e861aa7527357dd23b0f1892efa2", "score": "0.464414", "text": "func expectBroadcastDataEmpty(qsc tabletserver.Controller) error {\n\tc := qsc.(*tabletservermock.Controller).BroadcastData\n\tclose(c)\n\tbd, ok := <-c\n\tif ok {\n\t\treturn fmt.Errorf(\"BroadcastData channel should have been consumed, but was not: %v\", bd)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9efdde8eda540ec715abc1adb18a2e84", "score": "0.4642122", "text": "func TestUnitServerRPC(t *testing.T) {\n numClients := 10\n port := 1111\n otherPort := 1112\n\n serverPorts := []int{port, otherPort}\n clientPorts := make([]int, numClients)\n for i := 0; i < numClients; i++ {\n clientPorts[i] = port\n }\n clientPorts[1] = otherPort\n\n servers, clients := createNetwork(\"test_rpc\", serverPorts, clientPorts)\n defer cleanupRPCClients(clients)\n\n server := servers[0]\n otherServer := servers[1]\n defer server.Kill()\n\n // Test a single RPC\n pingArgs := &PingArgs{2}\n var pingReply PingReply\n err := clients[server.id].Call(\"BayouServer.Ping\", pingArgs, &pingReply)\n ensureNoError(t, err, \"Single Ping RPC failed: \")\n assert(t, pingReply.Alive, \"Single Ping RPC failed.\")\n\n var wg sync.WaitGroup\n wg.Add(numClients)\n\n argArr := make([]PingArgs, numClients)\n replyArr := make([]PingReply, numClients)\n\n // Test several RPC calls at once\n for i := 0; i < numClients; i++ {\n go func(id int) {\n // debugf(\"Client #%d sending ping!\", id)\n argArr[id].SenderID = id\n newErr := clients[id].Call(\"BayouServer.Ping\",\n &argArr[id], &replyArr[id])\n ensureNoError(t, newErr, \"Concurrent Ping RPC Failed: \")\n assert(t, replyArr[id].Alive, \"Concurrent Ping RPC failed.\")\n wg.Done()\n } (i)\n }\n wg.Wait()\n\n // Test inter-server RPC\n success := server.SendPing(otherServer.id)\n assert(t, success, \"Inter-server Ping RPC failed.\")\n success = otherServer.SendPing(server.id)\n assert(t, success, \"Inter-server Ping RPC failed.\")\n\n // Ensure RPC to Killed server fails\n otherServer.Kill()\n success = server.SendPing(otherServer.id)\n assert(t, !success, \"Ping to Killed server suceeded.\")\n}", "title": "" }, { "docid": "cd9a94d7ec14e1823b641c6ec51bd9dd", "score": "0.4634238", "text": "func TestNoTimeout1(t *testing.T) {\n\tr := commonTestlibExampleReplica()\n\ttime.Sleep(2 * r.TimeoutInterval)\n\tgo r.checkTimeout()\n\tselect {\n\tcase <-r.MessageChan:\n\t\tt.Fatal(\"shouldn't get a timeout message\")\n\tdefault:\n\t}\n}", "title": "" }, { "docid": "e1f52de5d67edabdd4c9b5f28ddcb4a5", "score": "0.46300152", "text": "func TestIntegrationBroadcastRelayHeader(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\t// Setup consensus sets.\n\tcst1, err := blankConsensusSetTester(t.Name()+\"1\", modules.ProdDependencies)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer cst1.Close()\n\tcst2, err := blankConsensusSetTester(t.Name()+\"2\", modules.ProdDependencies)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer cst2.Close()\n\t// Setup mock gateway.\n\tmg := &mockGatewayDoesBroadcast{\n\t\tGateway: cst2.cs.gateway,\n\t\tbroadcastCalled: make(chan struct{}),\n\t}\n\tcst2.cs.gateway = mg\n\terr = cst1.cs.gateway.Connect(cst2.cs.gateway.Address())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Give time for on connect RPCs to finish.\n\ttime.Sleep(500 * time.Millisecond)\n\n\t// Test that broadcasting an invalid block header over RelayHeader on cst1.cs\n\t// does not result in cst2.cs.gateway receiving a broadcast.\n\tcst1.cs.gateway.Broadcast(\"RelayHeader\", types.BlockHeader{}, cst1.cs.gateway.Peers())\n\tselect {\n\tcase <-mg.broadcastCalled:\n\t\tt.Fatal(\"RelayHeader broadcasted an invalid block header\")\n\tcase <-time.After(500 * time.Millisecond):\n\t}\n\n\t// Test that broadcasting a valid block header over RelayHeader on cst1.cs\n\t// causes cst2.cs.gateway to receive a broadcast.\n\tvalidBlock, err := cst1.miner.FindBlock()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = cst1.cs.managedAcceptBlocks([]types.Block{validBlock})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tph, _ := cst1.cs.processedBlockHeaders[validBlock.ID()]\n\tcst1.cs.gateway.Broadcast(\"RelayHeader\", *ph.ForSend(), cst1.cs.gateway.Peers())\n\tselect {\n\tcase <-mg.broadcastCalled:\n\tcase <-time.After(1500 * time.Millisecond):\n\t\tt.Fatal(\"RelayHeader didn't broadcast a valid block header\")\n\t}\n}", "title": "" }, { "docid": "65227f188258534ed07fe1ce1c242696", "score": "0.4628633", "text": "func testMempoolBasic(t *testing.T, n, f int, reliable bool) {\n\tt.Parallel()\n\tte := newEnv(t, n, f, reliable)\n\tdefer te.close()\n\n\tt.Log(\"ServerNodesUpdated\")\n\ttangleTime := time.Now()\n\tfor _, node := range te.mempools {\n\t\tnode.ServerNodesUpdated(te.peerPubKeys, te.peerPubKeys)\n\t\tnode.TangleTimeUpdated(tangleTime)\n\t}\n\tawaitTrackHeadChannels := make([]<-chan bool, len(te.mempools))\n\t// deposit some funds so off-ledger requests can go through\n\tt.Log(\"TrackNewChainHead\")\n\tfor i, node := range te.mempools {\n\t\tawaitTrackHeadChannels[i] = node.TrackNewChainHead(te.stateForAO(i, te.originAO), nil, te.originAO, []state.Block{}, []state.Block{})\n\t}\n\tfor i := range te.mempools {\n\t\t<-awaitTrackHeadChannels[i]\n\t}\n\n\toutput := transaction.BasicOutputFromPostData(\n\t\tte.governor.Address(),\n\t\tisc.HnameNil,\n\t\tisc.RequestParameters{\n\t\t\tTargetAddress: te.chainID.AsAddress(),\n\t\t\tAssets: isc.NewAssetsBaseTokens(10 * isc.Million),\n\t\t},\n\t)\n\tonLedgerReq, err := isc.OnLedgerFromUTXO(output, tpkg.RandOutputID(uint16(0)))\n\trequire.NoError(t, err)\n\tfor _, node := range te.mempools {\n\t\tnode.ReceiveOnLedgerRequest(onLedgerReq)\n\t}\n\tcurrentAO := blockFn(te, []isc.Request{onLedgerReq}, te.originAO, tangleTime)\n\n\t//\n\toffLedgerReq := isc.NewOffLedgerRequest(\n\t\tisc.RandomChainID(),\n\t\tisc.Hn(\"foo\"),\n\t\tisc.Hn(\"bar\"),\n\t\tdict.New(),\n\t\t0,\n\t\tgas.LimitsDefault.MaxGasPerRequest,\n\t).Sign(te.governor)\n\tt.Log(\"Sending off-ledger request\")\n\tchosenMempool := rand.Intn(len(te.mempools))\n\trequire.Nil(t, te.mempools[chosenMempool].ReceiveOffLedgerRequest(offLedgerReq))\n\tte.mempools[chosenMempool].ReceiveOffLedgerRequest(offLedgerReq) // Check for duplicate receives.\n\n\tt.Log(\"Ask for proposals\")\n\tproposals := make([]<-chan []*isc.RequestRef, len(te.mempools))\n\tfor i, node := range te.mempools {\n\t\tproposals[i] = node.ConsensusProposalAsync(te.ctx, currentAO)\n\t}\n\tt.Log(\"Wait for proposals and ask for decided requests\")\n\tdecided := make([]<-chan []isc.Request, len(te.mempools))\n\tfor i, node := range te.mempools {\n\t\tproposal := <-proposals[i]\n\t\trequire.True(t, len(proposal) == 1 || len(proposal) == 2)\n\t\tdecided[i] = node.ConsensusRequestsAsync(te.ctx, isc.RequestRefsFromRequests([]isc.Request{offLedgerReq}))\n\t}\n\tt.Log(\"Wait for decided requests\")\n\tfor i := range te.mempools {\n\t\tnodeDecidedReqs := <-decided[i]\n\t\trequire.Len(t, nodeDecidedReqs, 1)\n\t}\n\t//\n\t// Make a block consuming those 2 requests.\n\tcurrentAO = blockFn(te, []isc.Request{offLedgerReq}, currentAO, tangleTime)\n\n\t//\n\t// Ask proposals for the next\n\tproposals = make([]<-chan []*isc.RequestRef, len(te.mempools))\n\tfor i := range te.mempools {\n\t\tproposals[i] = te.mempools[i].ConsensusProposalAsync(te.ctx, currentAO) // Intentionally invalid order (vs TrackNewChainHead).\n\t}\n\t//\n\t// We should not get any requests, because old requests are consumed\n\t// and the new ones are not arrived yet.\n\tfor i := range te.mempools {\n\t\tselect {\n\t\tcase refs := <-proposals[i]:\n\t\t\tt.Fatalf(\"should not get a value here, Got %+v\", refs)\n\t\tdefault:\n\t\t\t// OK\n\t\t}\n\t}\n\t//\n\t// Add a message, we should get it now.\n\toffLedgerReq2 := isc.NewOffLedgerRequest(\n\t\tisc.RandomChainID(),\n\t\tisc.Hn(\"foo\"),\n\t\tisc.Hn(\"bar\"),\n\t\tdict.New(),\n\t\t1,\n\t\tgas.LimitsDefault.MaxGasPerRequest,\n\t).Sign(te.governor)\n\toffLedgerRef2 := isc.RequestRefFromRequest(offLedgerReq2)\n\tfor i := range te.mempools {\n\t\tte.mempools[i].ReceiveOffLedgerRequest(offLedgerReq2)\n\t}\n\tfor i := range te.mempools {\n\t\tprop := <-proposals[i]\n\t\trequire.Len(t, prop, 1)\n\t\trequire.Contains(t, prop, offLedgerRef2)\n\t}\n}", "title": "" }, { "docid": "c59549fb74dd758db79a1c964a425ded", "score": "0.46264356", "text": "func TestEmptyHashArray(t *testing.T) {\n\temptyHashes := []string{}\n\n\ttorrentList, err := GetTorrentsInfos(emptyHashes)\n\tif torrentList != nil {\n\t\tt.Errorf(\"Shouldn't get a torrent list\")\n\t}\n\tif err != ErrEmptyHashes {\n\t\tt.Errorf(\"Should get an ErrEmptyHashes\")\n\t}\n}", "title": "" }, { "docid": "e5bdc53311c4d036431106cd82d9691f", "score": "0.46260315", "text": "func BenchmarkParseMessageNoDeps(b *testing.B) {\n\traw := []byte(\"A|B|\\n\")\n\tfor i := 0; i < b.N; i++ {\n\t\tparseMessage(raw)\n\t}\n}", "title": "" }, { "docid": "935191b7100f8c6951802deedcbcf2ff", "score": "0.46239987", "text": "func TestNewAggregator_NoPairs(t *testing.T) {\n\tpairs := []string{}\n\tconfig := model.Config{\n\t\tTradePairs: pairs,\n\t\tSocketAddress: \"test\",\n\t\tClearConsole: false,\n\t\tWindow: 200,\n\t}\n\tresult := NewAggregator(config)\n\tif result == nil {\n\t\tt.Error(\"aggregator is nil\")\n\t}\n\tif len(result.Utils) != 0 {\n\t\tt.Errorf(\"created wrong number of utils: %d\", len(result.Utils))\n\t}\n}", "title": "" }, { "docid": "8bf7299ec4b777486820e331543ff8c3", "score": "0.4609706", "text": "func (this *P2PServer) Xmit(message interface{}) error {\n\tlog.Debug(\"[p2p] Xmit Start...\")\n\tvar msg common.Message\n\tisConsensus := false\n\tswitch message.(type) {\n\tcase *types.Transaction: //\n\t\tlog.Debug(\"[p2p]TX transaction message ••••••••••••••••\")\n\t\ttxn := message.(*types.Transaction)\n\t\tmsg = msgpack.NewTxn(txn, nil, comm.Address{}, common.SYNC_DATA_MAIN)\n\n\n\tcase *common.OrgTx: //\n\t\tlog.Debug(\"[p2p]TX transaction message\")\n\t\torgtx := message.(*common.OrgTx)\n\t\ttxn := orgtx.Tx\n\t\tmsg = msgpack.NewTxn(nil, txn, comm.Address{}, common.SYNC_DATA_ORG)\n\n\tcase *types.Block: // sync bblock //\n\t\tlog.Debug(\"[p2p]TX block message\")\n\t\tblock := message.(*types.Block)\n\t\tmsg = msgpack.NewBlock(block, nil, comm.Address{}, common.SYNC_DATA_MAIN)\n\tcase *common.ConsensusPayload:\n\t\tlog.Debug(\"[p2p]TX consensus message\")\n\t\tconsensusPayload := message.(*common.ConsensusPayload)\n\t\tmsg = msgpack.NewConsensus(consensusPayload)\n\t\tisConsensus = true\n\n\tcase *common.NotifyBlk:\n\t\t//return nil\n\t\tblkntf := message.(*common.NotifyBlk)\n\t\t//time.Sleep(time.Millisecond*500)\n\n\t\tlog.Info(\"[p2p]TX block hash message unique\", \"hash\", blkntf)\n\n\t\t// construct inv message\n\t\tinvPayload := msgpack.NewInvPayload(comm.BLOCK, []comm.Hash{blkntf.BlkHash}, []uint64{blkntf.BlkHeight})\n\n\t\tmsg = msgpack.NewInv(invPayload)\n\tcase *common.EarthNotifyBlk:\n\t\tntf := message.(*common.EarthNotifyBlk)\n\n\t\tmsg = msgpack.NewEarthNotifyHash(ntf)\n\tcase *comm.NodeLH:\n\t\tfmt.Println(\"🌐 📩 p2p receive nodeLH\")\n\t\tnodeLH := message.(*comm.NodeLH)\n\t\tmsg = msgpack.NewNodeLHMsg(nodeLH)\n\tcase *common.ExtDataRequest:\n\t\tfmt.Println(\"🌐 📩 p2p extData requtst\")\n\t\textData := message.(*common.ExtDataRequest)\n\t\tmsg = msgpack.NewExtDataRequestMsg(extData)\n\tdefault:\n\t\tlog.Info(\"[p2p]Unknown Xmit \", \"message\", message, \"type\", reflect.TypeOf(message))\n\t\treturn errors.New(\"[p2p]Unknown Xmit message type\")\n\t}\n\tthis.network.Xmit(msg, isConsensus)\n\treturn nil\n}", "title": "" }, { "docid": "7ff233206d1b129676d12c7661ac5e6d", "score": "0.46088", "text": "func (*EmptyMessage) Descriptor() ([]byte, []int) {\n\treturn file_idl_demo_demo_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "c253342d80eccfd0eb90bce586d76a86", "score": "0.46057948", "text": "func TestDataMessageBasic(t *testing.T) {\n\tf := CONNECT\n\th := Headers{\"keya\", \"valuea\"}\n\ts := \"The Message Body\"\n\tm := &Message{Command: f, Headers: h, Body: []byte(s)}\n\t//\n\tif f != m.Command {\n\t\tt.Errorf(\"Command, expected: [%v], got [%v]\\n\", f, m.Command)\n\t}\n\tif !h.Compare(m.Headers) {\n\t\tt.Errorf(\"Headers, expected: [true], got [false]\\n\", h, m.Headers)\n\t}\n\tif s != m.BodyString() {\n\t\tt.Errorf(\"Body string, expected: [%v], got [%v]\\n\", s, m.BodyString())\n\t}\n}", "title": "" }, { "docid": "1ff58edcbf5ebdadcc84fa68756c3ad7", "score": "0.46044502", "text": "func Test_AddToEmptyChain(t *testing.T) {\n\tblockchain := blockchain.NewBlockChain()\n\tnonce := transactions.GetNonce()\n\tprev := transactions.GetNonce()\n\tfileName1 := \"Bjorn\"\n\tfileName2 := \"Bjorninn\"\n\tfileName3 := \"Bjorninn2\"\n\tfileName4 := \"Caehun\"\n\tfileName5 := \"Lefteris\"\n\tfile1 := transactions.NewFile(fileName1, 0, nil)\n\tfile2 := transactions.NewFile(fileName2, 0, nil)\n\tfile3 := transactions.NewFile(fileName3, 0, nil)\n\tfile4 := transactions.NewFile(fileName4, 0, nil)\n\tfile5 := transactions.NewFile(fileName5, 0, nil)\n\ttx1 := transactions.NewTransaction(file1, 10)\n\ttx2 := transactions.NewTransaction(file2, 10)\n\ttx3 := transactions.NewTransaction(file3, 10)\n\ttx4 := transactions.NewTransaction(file4, 10)\n\ttx5 := transactions.NewTransaction(file5, 10)\n\t//This is a completely random block\n\tblock1 := transactions.NewBlock(prev, nonce, []transactions.TxPublish{tx1})\n\thashBlock1 := block1.Hash()\n\tblock2 := transactions.NewBlock(hashBlock1, nonce, []transactions.TxPublish{tx2})\n\thashBlock2 := block2.Hash()\n\thxBlock2 := hex.EncodeToString(hashBlock2[:])\n\tblock3 := transactions.NewBlock(hashBlock2, nonce, []transactions.TxPublish{tx3})\n\thashBlock3 := block3.Hash()\n\n\t//I'll use this to get a fork and create a new longest chain\n\tblock4 := transactions.NewBlock(hashBlock1, nonce, []transactions.TxPublish{tx4})\n\thashBlock4 := block4.Hash()\n\t//hxBlock4 := hex.EncodeToString(hashBlock4[:])\n\tblock5 := transactions.NewBlock(hashBlock4, nonce, []transactions.TxPublish{tx5})\n\thashBlock5 := block5.Hash()\n\thxBlock5 := hex.EncodeToString(hashBlock5[:])\n\n\t//hxBlock3 := hex.EncodeToString(hashBlock3[:])\n\thxBlock1 := hex.EncodeToString(hashBlock1[:])\n\t//Adding the first block\n\tblockchain.AddBlock(hashBlock1, prev, block1)\n\thxHead := hex.EncodeToString(blockchain.LongestHash[:])\n\trequire.Equal(t, blockchain.LongestIndex, uint64(1))\n\trequire.Equal(t, hxHead, hxBlock1)\n\trequire.True(t, blockchain.HasBlock(block1), \"Making sure that block 1 was added\")\n\t//Adding a block not in the blockchain and is not the first block\n\tblockchain.AddBlock(hashBlock3, prev, block3)\n\thasBlock := blockchain.HasBlock(block3)\n\trequire.True(t, hasBlock, \"Block 3 should not have been added\")\n\t//Extending the blockchain\n\tblockchain.AddBlock(hashBlock2, hashBlock1, block2)\n\trequire.True(t, blockchain.HasBlock(block2), \"Making sure block 2 was added\")\n\thxHead = hex.EncodeToString(blockchain.LongestHash[:])\n\trequire.Equal(t, hxHead, hxBlock2, \"making sure that the head was updated to block 2\")\n\t//Forking the blockchain\n\tblockchain.AddBlock(hashBlock4, hashBlock1, block4)\n\trequire.True(t, blockchain.HasBlock(block4), \"Making sure that block 4 was added but to a fork\")\n\trequire.Equal(t, hxHead, hxBlock2, \"Require that the head has not changed from block 2\")\n\t//Creating a new longest chain\n\t_, _, oldHead, commonBlock := blockchain.AddBlock(hashBlock5, hashBlock4, block5)\n\thxHead = hex.EncodeToString(blockchain.LongestHash[:])\n\trequire.Equal(t, blockchain.LongestIndex, uint64(3), \"Making sure the the length of the longest chain has been updated\")\n\trequire.Equal(t, hxHead, hxBlock5, \"Making sure that the longest chain has been updated\")\n\trequire.NotEqual(t, hxHead, hxBlock2)\n\toldTransActions := blockchain.GetTransactionsToCommonBlock(oldHead, commonBlock)\n\trequire.Equal(t, len(oldTransActions), 1, \"Testing the length of the oldTransactions\")\n\n}", "title": "" }, { "docid": "f43ba7b7b8bcbdfac513f1bfc64d6115", "score": "0.46040046", "text": "func (*NullResponse) Descriptor() ([]byte, []int) {\n\treturn file_testdata_gentest_unary_type_test_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "24bb90c0ef5469fff383159ff72859e3", "score": "0.46015927", "text": "func (*EmptyReply) Descriptor() ([]byte, []int) {\n\treturn file_users_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "d2f1f9192f117a4c5dc893cc93c5a049", "score": "0.45978612", "text": "func TestCoreCommand(t *testing.T) {\n\tcall := Calls.Get(\"core/command\")\n\n\ttest := func(command string, returnType string, wantOutput string, fail bool) {\n\t\tvar rec = httptest.NewRecorder()\n\t\tvar w http.ResponseWriter = rec\n\n\t\tin := Params{\n\t\t\t\"command\": command,\n\t\t\t\"opt\": map[string]string{},\n\t\t\t\"arg\": []string{},\n\t\t\t\"_response\": w,\n\t\t}\n\t\tif returnType != \"\" {\n\t\t\tin[\"returnType\"] = returnType\n\t\t} else {\n\t\t\treturnType = \"COMBINED_OUTPUT\"\n\t\t}\n\t\tstream := strings.HasPrefix(returnType, \"STREAM\")\n\t\tgot, err := call.Fn(context.Background(), in)\n\t\tif stream && fail {\n\t\t\tassert.Error(t, err)\n\t\t} else {\n\t\t\tassert.NoError(t, err)\n\t\t}\n\n\t\tif !stream {\n\t\t\tassert.Equal(t, wantOutput, got[\"result\"])\n\t\t\tassert.Equal(t, fail, got[\"error\"])\n\t\t} else {\n\t\t\tassert.Equal(t, wantOutput, rec.Body.String())\n\t\t}\n\t\tassert.Equal(t, http.StatusOK, rec.Result().StatusCode)\n\t}\n\n\tversion := fmt.Sprintf(\"rclone %s\\n\", fs.Version)\n\terrorString := \"Unknown command\\n\"\n\tt.Run(\"OK\", func(t *testing.T) {\n\t\ttest(\"version\", \"\", version, false)\n\t})\n\tt.Run(\"Fail\", func(t *testing.T) {\n\t\ttest(\"unknown_command\", \"\", version+errorString, true)\n\t})\n\tt.Run(\"Combined\", func(t *testing.T) {\n\t\ttest(\"unknown_command\", \"COMBINED_OUTPUT\", version+errorString, true)\n\t})\n\tt.Run(\"Stderr\", func(t *testing.T) {\n\t\ttest(\"unknown_command\", \"STREAM_ONLY_STDERR\", errorString, true)\n\t})\n\tt.Run(\"Stdout\", func(t *testing.T) {\n\t\ttest(\"unknown_command\", \"STREAM_ONLY_STDOUT\", version, true)\n\t})\n\tt.Run(\"Stream\", func(t *testing.T) {\n\t\ttest(\"unknown_command\", \"STREAM\", version+errorString, true)\n\t})\n}", "title": "" }, { "docid": "68367ab68b8d7210652c4d86e0778982", "score": "0.45936748", "text": "func TestPresenceStart(t *testing.T){\n PrintTestMessage(\"==========Presence tests start==========\")\n}", "title": "" }, { "docid": "97bfb8e614055d97ee62f3170d46a254", "score": "0.45933893", "text": "func TestBootstrapEmpty(t *testing.T) {\n\tutils.SetDebug(true)\n\n\t// This creates the genesis node as well as\n\t// creating one other node in the network.\n\tgenNd := NewGenNd()\n\tnode2 := pkg.New(pkg.DefaultConfig(GetFreePort()))\n\tgenNd.Start()\n\tnode2.Start()\n\n\t// Node connects to the network\n\tgenNd.ConnectToPeer(node2.Addr)\n\n\n\t// Sleep to give time for both nodes to connect\n\ttime.Sleep(1 * time.Second)\n\n\t// Bootstrap Node 2. There should be nothing to\n\t// bootstrap\n\terr := node2.Bootstrap()\n\tif err != nil {\n\t\tt.Errorf(\"Test errored when attempting to\" +\n\t\t\t\"bootstrap.\\n\")\n\t}\n\n\t// Sleep to give enough time for the bootstrapping\n\t// requests and responses to take place.\n\ttime.Sleep(time.Second * 2)\n\n\t// Checks to see that both miners main chains are\n\t// the same and that they only have the genesis\n\t// block\n\tChkMnChnLen(t, genNd, 1)\n\tChkMnChnLen(t, genNd, 1)\n\tChkMnChnCons(t, []*pkg.Node{genNd, node2})\n}", "title": "" }, { "docid": "dab338452c073aa3cfaf558e1251225b", "score": "0.45914543", "text": "func (*EmptyResponse) Descriptor() ([]byte, []int) {\n\treturn file_testdata_tests_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "f298978a133d7c6ca0e8fd83bf542580", "score": "0.45901352", "text": "func TestIntegrate1(t *testing.T) {\n\tfmt.Println(\"TestIntegrate1: started\")\n\tu := FACTORY.User()\n\tu.Generate().SetNick(\"nick\").Save()\n\tdefer u.Delete()\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tgo func() {\n\t\tmsgs := u.WaitRecvMessage(time.After(5 * time.Second))\n\t\tif msgs == nil {\n\t\t\tt.Error(\"msgs == null\")\n\t\t}\n\n\t\tif len(msgs) != 1 {\n\t\t\tt.Error(\"len(msgs) != 1, :\" + strconv.Itoa(len(msgs)))\n\t\t}\n\t\twg.Done()\n\t}()\n\n\tmsg := FACTORY.Message()\n\tmsg.SetAuthorId(u.Id()).SetText(\"text\").Save()\n\tdefer msg.Delete()\n\tu.WakeRecvPending(msg)\n\n\twg.Wait()\n\n}", "title": "" }, { "docid": "775cc155b00ed988707dd2c81899b2ba", "score": "0.45895845", "text": "func (s *SimplifiedSuite) TestEmpty(c *check.C) {\n\tmetas := map[string]*WorkSpecMeta{}\n\t_, err := SimplifiedScheduler(metas, time.Now(), 1)\n\tc.Check(err, check.Equals, ErrNoWork)\n}", "title": "" }, { "docid": "dbb55752032c7a6e68f1e9758c121659", "score": "0.45872468", "text": "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{44}\n}", "title": "" }, { "docid": "9415939077a8b278ba7eb09e4a43a3e1", "score": "0.45860565", "text": "func (*NilResponse) Descriptor() ([]byte, []int) {\n\treturn file_testdata_gentest_unary_type_test_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "ff6e518538cd81d78ad38b192a679e65", "score": "0.4583893", "text": "func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) {\n\n\tmainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{\n\t\tCounter{cRestSubReqFromXapp, 1},\n\t\tCounter{cRestSubRespToXapp, 1},\n\t\tCounter{cSubReqToE2, 1},\n\t\tCounter{cSubReqTimerExpiry, 2},\n\t\tCounter{cSubReReqToE2, 1},\n\t\tCounter{cSubRespFromE2, 1},\n\t\tCounter{cSubFailFromE2, 1},\n\t\tCounter{cRestSubFailNotifToXapp, 1},\n\t\tCounter{cRestSubDelReqFromXapp, 1},\n\t\tCounter{cRestSubDelRespToXapp, 1},\n\t\tCounter{cSubDelReqToE2, 1},\n\t\tCounter{cSubDelRespFromE2, 1},\n\t})\n\n\tconst subReqCount int = 1\n\n\t// Req\n\tparams := xappConn1.GetRESTSubsReqReportParams(subReqCount)\n\trestSubId := xappConn1.SendRESTSubsReq(t, params)\n\n\tcrereq, cremsg := e2termConn1.RecvSubsReq(t)\n\n\t// Unknown instanceId 0 in this response which will result resending original request\n\torgInstanceId := crereq.RequestId.InstanceId\n\tcrereq.RequestId.InstanceId = 0\n\te2termConn1.SendSubsResp(t, crereq, cremsg)\n\n\t_, cremsg = e2termConn1.RecvSubsReq(t)\n\n\txappConn1.ExpectRESTNotificationNok(t, restSubId, \"allFail\")\n\n\t// Subscription already created in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0\n\tfparams := &teststube2ap.E2StubSubsFailParams{}\n\tfparams.Set(crereq)\n\tfparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action\n\te2termConn1.SendSubsFail(t, fparams, cremsg)\n\n\tdelreq, delmsg := e2termConn1.RecvSubsDelReq(t)\n\te2termConn1.SendSubsDelResp(t, delreq, delmsg)\n\n\tinstanceId := xappConn1.WaitRESTNotification(t, restSubId)\n\txapp.Logger.Debug(\"TEST: REST notification received e2SubsId=%v\", instanceId)\n\n\txappConn1.SendRESTSubsDelReq(t, &restSubId)\n\n\t// Wait that subs is cleaned\n\tmainCtrl.wait_subs_clean(t, orgInstanceId, 10)\n\n\txappConn1.TestMsgChanEmpty(t)\n\te2termConn1.TestMsgChanEmpty(t)\n\tmainCtrl.wait_registry_empty(t, 10)\n\tmainCtrl.VerifyAllClean(t)\n\tmainCtrl.VerifyCounterValues(t)\n}", "title": "" }, { "docid": "07c49e9d8b8238b16ef1c7b458282a97", "score": "0.45823756", "text": "func TestInits(t *testing.T) {\n\ttestClient, err := client.NewInMemoryClient(\n\t\t[]*osv.Entry{\n\t\t\t{\n\t\t\t\tID: \"A\", Affected: []osv.Affected{{Module: osv.Module{Path: \"golang.org/amod\"}, Ranges: []osv.Range{{Type: osv.RangeTypeSemver}},\n\t\t\t\t\tEcosystemSpecific: osv.EcosystemSpecific{Packages: []osv.Package{{\n\t\t\t\t\t\tPath: \"golang.org/amod/avuln\", Symbols: []string{\"A\"}},\n\t\t\t\t\t}},\n\t\t\t\t}},\n\t\t\t},\n\t\t\t{\n\t\t\t\tID: \"C\", Affected: []osv.Affected{{Module: osv.Module{Path: \"golang.org/cmod\"}, Ranges: []osv.Range{{Type: osv.RangeTypeSemver}},\n\t\t\t\t\tEcosystemSpecific: osv.EcosystemSpecific{Packages: []osv.Package{{\n\t\t\t\t\t\tPath: \"golang.org/cmod/cvuln\", Symbols: []string{\"C\"}},\n\t\t\t\t\t}},\n\t\t\t\t}},\n\t\t\t},\n\t\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\te := packagestest.Export(t, packagestest.Modules, []packagestest.Module{\n\t\t{\n\t\t\tName: \"golang.org/entry\",\n\t\t\tFiles: map[string]interface{}{\n\t\t\t\t\"x/x.go\": `\n\t\t\tpackage x\n\n\t\t\timport (\n\t\t\t\t_ \"golang.org/amod/avuln\"\n\t\t\t\t_ \"golang.org/bmod/b\"\n\t\t\t)\n\t\t\t`,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"golang.org/amod@v0.5.0\",\n\t\t\tFiles: map[string]interface{}{\"avuln/avuln.go\": `\n\t\t\tpackage avuln\n\n\t\t\tfunc init() {\n\t\t\t\tA()\n\t\t\t}\n\n\t\t\tfunc A() {}\n\t\t\t`},\n\t\t},\n\t\t{\n\t\t\tName: \"golang.org/bmod@v0.5.0\",\n\t\t\tFiles: map[string]interface{}{\"b/b.go\": `\n\t\t\tpackage b\n\n\t\t\timport _ \"golang.org/cmod/cvuln\"\n\t\t\t`},\n\t\t},\n\t\t{\n\t\t\tName: \"golang.org/cmod@v0.5.0\",\n\t\t\tFiles: map[string]interface{}{\"cvuln/cvuln.go\": `\n\t\t\tpackage cvuln\n\n\t\t\tvar x int = C()\n\n\t\t\tfunc C() int {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\t`},\n\t\t},\n\t})\n\tdefer e.Cleanup()\n\n\t// Load x as entry package.\n\tgraph := NewPackageGraph(\"go1.18\")\n\tpkgs, err := graph.LoadPackages(e.Config, nil, []string{path.Join(e.Temp(), \"entry/x\")})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(pkgs) != 1 {\n\t\tt.Fatal(\"failed to load x test package\")\n\t}\n\tcfg := &govulncheck.Config{ScanLevel: \"symbol\"}\n\tresult, err := Source(context.Background(), pkgs, cfg, testClient, graph)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tcs := CallStacks(result)\n\twant := map[string][]string{\n\t\t\"A\": {\n\t\t\t// Entry init's position is the package statement.\n\t\t\t// It calls avuln.init at avuln import statement.\n\t\t\t\"N:golang.org/entry/x.init\tF:x.go:2:4\tC:x.go:5:5\",\n\t\t\t// implicit avuln.init is calls explicit init at the avuln\n\t\t\t// package statement.\n\t\t\t\"N:golang.org/amod/avuln.init\tF:avuln.go:2:4\tC:avuln.go:2:4\",\n\t\t\t\"N:golang.org/amod/avuln.init#1\tF:avuln.go:4:9\tC:avuln.go:5:6\",\n\t\t\t\"N:golang.org/amod/avuln.A\tF:avuln.go:8:9\tC:\",\n\t\t},\n\t\t\"C\": {\n\t\t\t\"N:golang.org/entry/x.init\tF:x.go:2:4\tC:x.go:6:5\",\n\t\t\t\"N:golang.org/bmod/b.init\tF:b.go:2:4\tC:b.go:4:11\",\n\t\t\t\"N:golang.org/cmod/cvuln.init\tF:cvuln.go:2:4\tC:cvuln.go:4:17\",\n\t\t\t\"N:golang.org/cmod/cvuln.C\tF:cvuln.go:6:9\tC:\",\n\t\t},\n\t}\n\tif diff := cmp.Diff(want, fullStacksToString(cs)); diff != \"\" {\n\t\tt.Errorf(\"modules mismatch (-want, +got):\\n%s\", diff)\n\t}\n}", "title": "" }, { "docid": "ab72cefc9dcdf78edc74ab2bfc7fd03c", "score": "0.45733133", "text": "func TestEmptyReader(t *testing.T) {\n\t_, _, _, err := BuildReaderProof(new(bytes.Reader), sha256.New(), 64, 5)\n\tif err == nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "a4d624a90594977abd86e3b4a44b6a5c", "score": "0.4573101", "text": "func (x *fastReflection_MsgSend) Clear(fd protoreflect.FieldDescriptor) {\n\tswitch fd.FullName() {\n\tcase \"cosmos.nft.v1beta1.MsgSend.class_id\":\n\t\tx.ClassId = \"\"\n\tcase \"cosmos.nft.v1beta1.MsgSend.id\":\n\t\tx.Id = \"\"\n\tcase \"cosmos.nft.v1beta1.MsgSend.sender\":\n\t\tx.Sender = \"\"\n\tcase \"cosmos.nft.v1beta1.MsgSend.receiver\":\n\t\tx.Receiver = \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.nft.v1beta1.MsgSend\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.nft.v1beta1.MsgSend does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "5126cb0004b8ea7b5ca9fec4f1b7dc39", "score": "0.45675573", "text": "func TestHandleMsg(t *testing.T) {\n\tN := uint64(4)\n\tF := uint64(1)\n\tsys := NewTestSystemWithBackend(N, F)\n\n\tcloser := sys.Run(true)\n\tdefer closer()\n\n\tv0 := sys.backends[0]\n\tr0 := v0.engine\n\n\tm, _ := ibfttypes.Encode(&istanbul.Subject{\n\t\tView: &istanbul.View{\n\t\t\tSequence: big.NewInt(0),\n\t\t\tRound: big.NewInt(0),\n\t\t},\n\t\tDigest: common.StringToHash(\"1234567890\"),\n\t})\n\t// with a matched payload. msgPreprepare should match with *istanbul.Preprepare in normal case.\n\tmsg := &ibfttypes.Message{\n\t\tCode: ibfttypes.MsgPreprepare,\n\t\tMsg: m,\n\t\tAddress: v0.Address(),\n\t\tSignature: []byte{},\n\t\tCommittedSeal: []byte{},\n\t}\n\n\t_, val := v0.Validators(nil).GetByAddress(v0.Address())\n\tif err := r0.handleCheckedMsg(msg, val); err != istanbulcommon.ErrFailedDecodePreprepare {\n\t\tt.Errorf(\"error mismatch: have %v, want %v\", err, istanbulcommon.ErrFailedDecodePreprepare)\n\t}\n\n\tm, _ = ibfttypes.Encode(&istanbul.Preprepare{\n\t\tView: &istanbul.View{\n\t\t\tSequence: big.NewInt(0),\n\t\t\tRound: big.NewInt(0),\n\t\t},\n\t\tProposal: makeBlock(1),\n\t})\n\t// with a unmatched payload. msgPrepare should match with *istanbul.Subject in normal case.\n\tmsg = &ibfttypes.Message{\n\t\tCode: ibfttypes.MsgPrepare,\n\t\tMsg: m,\n\t\tAddress: v0.Address(),\n\t\tSignature: []byte{},\n\t\tCommittedSeal: []byte{},\n\t}\n\n\t_, val = v0.Validators(nil).GetByAddress(v0.Address())\n\tif err := r0.handleCheckedMsg(msg, val); err != istanbulcommon.ErrFailedDecodePrepare {\n\t\tt.Errorf(\"error mismatch: have %v, want %v\", err, istanbulcommon.ErrFailedDecodePreprepare)\n\t}\n\n\tm, _ = ibfttypes.Encode(&istanbul.Preprepare{\n\t\tView: &istanbul.View{\n\t\t\tSequence: big.NewInt(0),\n\t\t\tRound: big.NewInt(0),\n\t\t},\n\t\tProposal: makeBlock(2),\n\t})\n\t// with a unmatched payload. istanbul.MsgCommit should match with *istanbul.Subject in normal case.\n\tmsg = &ibfttypes.Message{\n\t\tCode: ibfttypes.MsgCommit,\n\t\tMsg: m,\n\t\tAddress: v0.Address(),\n\t\tSignature: []byte{},\n\t\tCommittedSeal: []byte{},\n\t}\n\n\t_, val = v0.Validators(nil).GetByAddress(v0.Address())\n\tif err := r0.handleCheckedMsg(msg, val); err != istanbulcommon.ErrFailedDecodeCommit {\n\t\tt.Errorf(\"error mismatch: have %v, want %v\", err, istanbulcommon.ErrFailedDecodeCommit)\n\t}\n\n\tm, _ = ibfttypes.Encode(&istanbul.Preprepare{\n\t\tView: &istanbul.View{\n\t\t\tSequence: big.NewInt(0),\n\t\t\tRound: big.NewInt(0),\n\t\t},\n\t\tProposal: makeBlock(3),\n\t})\n\t// invalid message code. message code is not exists in list\n\tmsg = &ibfttypes.Message{\n\t\tCode: uint64(99),\n\t\tMsg: m,\n\t\tAddress: v0.Address(),\n\t\tSignature: []byte{},\n\t\tCommittedSeal: []byte{},\n\t}\n\n\t_, val = v0.Validators(nil).GetByAddress(v0.Address())\n\tif err := r0.handleCheckedMsg(msg, val); err == nil {\n\t\tt.Errorf(\"error mismatch: have %v, want nil\", err)\n\t}\n\n\t// with malicious payload\n\tif err := r0.handleMsg([]byte{1}); err == nil {\n\t\tt.Errorf(\"error mismatch: have %v, want nil\", err)\n\t}\n}", "title": "" }, { "docid": "280b3a33f1f4407d66aff89fce6426a8", "score": "0.45670462", "text": "func Nothing() {}", "title": "" }, { "docid": "2698a7667a11595d5586e04cabc6f6d7", "score": "0.45660788", "text": "func TestMqMsgStream_AsProducer(t *testing.T) {\n\tclient, _ := createRmqClient()\n\tdefer client.Close()\n\n\tfactory := &msgstream.ProtoUDFactory{}\n\tm, err := msgstream.NewMqMsgStream(context.Background(), 100, 100, client, factory.NewUnmarshalDispatcher())\n\tassert.NoError(t, err)\n\n\t// empty channel name\n\tm.AsProducer([]string{\"\"})\n}", "title": "" }, { "docid": "52aee4866d546aa03a7b6f9380786eed", "score": "0.45632696", "text": "func TestSimplePushPopWithRingBuffer(t *testing.T) {\n testSimplePushPopWithQueue(BPQWithCapacity(maxRingBufferSize), t)\n}", "title": "" }, { "docid": "fd748e08c8b34eb78c0ab53f9f5efbb6", "score": "0.45616242", "text": "func createTestSpec() *Spec {\n\tspec := &Spec{\n\t\tName: \"test\",\n\t\tVersion: 42,\n\t\tMaxMsgSize: 10 * 1024,\n\t\tMessages: []interface{}{\n\t\t\t&perBytesMsgReceiverPays{},\n\t\t\t&perBytesMsgSenderPays{},\n\t\t\t&perUnitMsgReceiverPays{},\n\t\t\t&perUnitMsgSenderPays{},\n\t\t\t&zeroPriceMsg{},\n\t\t\t&nilPriceMsg{},\n\t\t},\n\t}\n\treturn spec\n}", "title": "" } ]
fa8dac18dd439b79c4f09b9cd8c154d2
IsEvent marks the message as an event.
[ { "docid": "26f14209ce8a1a9daf08dd6081971ccb", "score": "0.61169076", "text": "func (*TransferStarted) IsEvent() {}", "title": "" } ]
[ { "docid": "9f7364b155001585afdcf2b8ac11d4e5", "score": "0.7536203", "text": "func IsEvent(jsonmsg *map[string]interface{}) bool {\n\tif tags, ok := (*jsonmsg)[\"tags\"]; ok {\n\t\treturn strInterfaceIncluded(tags.([]interface{}), \"EVENT\")\n\t}\n\treturn false\n}", "title": "" }, { "docid": "98f1bd60bcc8184bdc809e792704556a", "score": "0.74934083", "text": "func IsEvent(m *eventsapi.Message, v interface{}) bool {\n\treturn typeurl.Is(m.Data, v)\n}", "title": "" }, { "docid": "50b6e5d4b78aa9b070f32acdc0a22204", "score": "0.688153", "text": "func (c *ChatMsgEvent) IsMessage() bool {\n\treturn c.EntryType == EChatEntryType_ChatMsg\n}", "title": "" }, { "docid": "ac98d402367b6a100cd382ee2819b606", "score": "0.68788975", "text": "func (c *ChatMsgEvent) IsMessage() bool {\n\treturn c.Type == EChatEntryType_ChatMsg\n}", "title": "" }, { "docid": "4259060c61125d58a5e446e95e3bfa34", "score": "0.66072744", "text": "func (p *RSSPlugin) Event(kind string, message msg.Message) bool {\n\treturn false\n}", "title": "" }, { "docid": "86e2280e3b283418c0e82f7e5c53286c", "score": "0.660646", "text": "func (s StateAtEvent) IsStateEvent() bool {\n\treturn s.EventStateKeyNID != 0\n}", "title": "" }, { "docid": "bcfcd43cd6529b7b51ca1e028d8cc1a1", "score": "0.63586533", "text": "func (o *Team) IsEvented() bool {\n\treturn false\n}", "title": "" }, { "docid": "5822619d74543b7d1dcc592818a5c6cc", "score": "0.6316569", "text": "func (o *PullRequestComment) IsEvented() bool {\n\treturn false\n}", "title": "" }, { "docid": "1399def1ddf15dba1dd7b510c647edd7", "score": "0.6189449", "text": "func (p *CounterPlugin) Event(kind string, message bot.Message) bool {\n\treturn false\n}", "title": "" }, { "docid": "45b237ea8ab45011957fe8eeb2185337", "score": "0.6135441", "text": "func (o *Mutation) IsEvented() bool {\n\treturn false\n}", "title": "" }, { "docid": "79f587d18f3f313cbdb7dfcb8d542023", "score": "0.60172063", "text": "func IsPublishEvent(model interface{}) (ok bool) {\n\tif model != nil {\n\t\t_, ok = reflect.New(utils.ModelType(model)).Interface().(PublishEventInterface)\n\t}\n\treturn\n}", "title": "" }, { "docid": "97ad86273114a1924321ca37a1846fb0", "score": "0.5977569", "text": "func (e TestEvent) PackageEvent() bool {\n\treturn e.Test == \"\"\n}", "title": "" }, { "docid": "aaee5d7bc11b7f633b40554362596b83", "score": "0.5895134", "text": "func (Event) message() {}", "title": "" }, { "docid": "cb3040ce97dab9de06e62d7a498034f5", "score": "0.58445734", "text": "func (m StructMessage) Event() (e ce.Event, err error) {\n\terr = format.Unmarshal(m.Format, m.Bytes, &e)\n\treturn e, err\n}", "title": "" }, { "docid": "2f4716a577741230bb56ac3ced5d1537", "score": "0.57593286", "text": "func (w *WebhookConfig) HasEvent(e ExtractStatus) bool {\n\tfor _, h := range w.Events {\n\t\tif (h == WAITING && len(w.Events) == 1) || h == e {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a6bae620a117907d8bb236195074862b", "score": "0.57063603", "text": "func IsEventFinished(event *api.Event) bool {\n\tstatus := event.PipelineRecord.Status\n\tif status == api.Success ||\n\t\tstatus == api.Failed ||\n\t\tstatus == api.Aborted {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "99cd25f86a5e30fdd228c0ac9566577a", "score": "0.56988996", "text": "func IsTransferEvent(topic common.Hash) bool {\n\treturn topic == transferEventSig\n}", "title": "" }, { "docid": "eb3f1f101e6045faf75058c34114d5ad", "score": "0.5687111", "text": "func (field Field) IsMessage() bool {\n\treturn field.desc.IsMessage()\n}", "title": "" }, { "docid": "b52d22bbc6a4efea8dec629e5b6727fe", "score": "0.56318533", "text": "func (m messageType) Event(ctx context.Context, id int, message interface{}) {\n\tspan := trace.SpanFromContext(ctx)\n\tif p, ok := message.(proto.Message); ok {\n\t\tspan.AddEvent(\"message\", trace.WithAttributes(\n\t\t\tattribute.KeyValue(m),\n\t\t\tRPCMessageIDKey.Int(id),\n\t\t\tRPCMessageUncompressedSizeKey.Int(proto.Size(p)),\n\t\t))\n\t} else {\n\t\tspan.AddEvent(\"message\", trace.WithAttributes(\n\t\t\tattribute.KeyValue(m),\n\t\t\tRPCMessageIDKey.Int(id),\n\t\t))\n\t}\n}", "title": "" }, { "docid": "959ac21e85721ba01775cdbdb767299c", "score": "0.55832845", "text": "func IsDepositEvent(topic common.Hash) bool {\n\treturn topic == lendingPoolContractDepositEventSig\n}", "title": "" }, { "docid": "baa8c4d5ecb8910f610cace06cef34d1", "score": "0.5570732", "text": "func HasEvent(type_ uint32) bool {\n\treturn C.SDL_HasEvent(C.Uint32(type_)) != 0\n}", "title": "" }, { "docid": "e053384db2f81eed4f7fa35dd329167f", "score": "0.5556838", "text": "func (o *EventLog) HasEvent() bool {\n\tif o != nil && o.Event != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "af69d219164844faa31f79e2553a6603", "score": "0.55303067", "text": "func (*TransferCompleted) IsEvent() {}", "title": "" }, { "docid": "042202a3b1785e1e18d2ad6d4f68dd0b", "score": "0.5527034", "text": "func (v *Transition) IsSetEvents() bool {\n\treturn v != nil && v.Events != nil\n}", "title": "" }, { "docid": "950f2b62fd9b0bdd3ed3ed1a5ab8c370", "score": "0.55078703", "text": "func (v *TextTag) Event(eventObject *glib.Object, event *gdk.Event, iter *TextIter) bool {\n\tok := C.gtk_text_tag_event(v.native(),\n\t\tC.toGObject(unsafe.Pointer(eventObject.Native())),\n\t\t(*C.GdkEvent)(unsafe.Pointer(event.Native())),\n\t\titer.native(),\n\t)\n\treturn gobool(ok)\n}", "title": "" }, { "docid": "7ef5b6b83b25aeb3c00f608cd0f0bd97", "score": "0.549936", "text": "func (v *Widget) Event(event *gdk.Event) bool {\n\tc := C.gtk_widget_event(v.native(),\n\t\t(*C.GdkEvent)(unsafe.Pointer(event.Native())))\n\treturn gobool(c)\n}", "title": "" }, { "docid": "71ba1fe4374adefbd1fe1d4051fa8fc9", "score": "0.54526794", "text": "func (f *fakeEventRecorder) Event(object runtime.Object, eventtype, reason, message string) {}", "title": "" }, { "docid": "7a54a03a246041bcfbbac66c9a71479f", "score": "0.54413664", "text": "func (e *Event) IsCreate() bool {\n\treturn e.Type == EventTypePut && e.Kv.CreateRevision == e.Kv.ModRevision\n}", "title": "" }, { "docid": "abb8244fcc3534f9182a9a9d2a90cecd", "score": "0.53821844", "text": "func (o *KubernetesPodEvent) HasMessage() bool {\n\tif o != nil && o.Message != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6b6345bdebfd5b824ed72cc46b565010", "score": "0.5358331", "text": "func (o *NewAttribute) HasEventType() bool {\n\tif o != nil && o.EventType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dc17799d368321a8d810a1ed1691d1a2", "score": "0.5351773", "text": "func TestEventEmission(t *testing.T) {\n\tbus := CreateBus(true)\n\teventName := \"test-event\"\n\tl := Listener{\n\t\tOn: func(e *Event, data ...interface{}) {\n\t\t\tprintln(e.Name)\n\t\t\t// We can assert the type since we know what it is.\n\t\t\tprintln(data[0].(string))\n\t\t\tif e.Name != eventName {\n\t\t\t\tt.Error(\"event names do not match!\")\n\t\t\t}\n\t\t},\n\t}\n\te := Event{\n\t\tName: eventName,\n\t\tId: 1,\n\t}\n\tbus.AddListener(l)\n\tbus.CallEvent(e, \"hi\")\n}", "title": "" }, { "docid": "1b31c1004773b196543ea5930a216141", "score": "0.53494066", "text": "func (e *EventConsumer) Send(msg string) bool {\n\tvar event struct {\n\t\tOrigin string `json:\"origin\"`\n\t\tIndex uint `json:\"index\"`\n\t\tTopics pq.StringArray `json:\"topics\"`\n\t\tData string `json:\"data\"`\n\t\tTransactionHash string `json:\"txHash\"`\n\t\tBlockHash string `json:\"blockHash\"`\n\t}\n\n\t_msg := []byte(msg)\n\n\terr := json.Unmarshal(_msg, &event)\n\tif err != nil {\n\t\tlog.Printf(\"[!] Failed to decode published event data to JSON : %s\\n\", err.Error())\n\t\treturn true\n\t}\n\n\tdata := make([]byte, 0)\n\terr = nil\n\n\tif len(event.Data) != 0 {\n\t\tdata, err = hex.DecodeString(event.Data[2:])\n\t}\n\n\tif err != nil {\n\t\tlog.Printf(\"[!] Failed to decode data field of event : %s\\n\", err.Error())\n\t\treturn true\n\t}\n\n\t// If doesn't match with specified criteria, simply ignoring received data\n\tif !e.Request.DoesMatchWithPublishedEventData(&Event{\n\t\tOrigin: event.Origin,\n\t\tIndex: event.Index,\n\t\tTopics: event.Topics,\n\t\tData: data,\n\t\tTransactionHash: event.TransactionHash,\n\t\tBlockHash: event.BlockHash,\n\t}) {\n\t\treturn true\n\t}\n\n\treturn e.SendData(&event)\n}", "title": "" }, { "docid": "a0a3ccba1a526fd7c137fdfccd28afa0", "score": "0.53248805", "text": "func (m *AmqpMessage) EventData() (common.Event, error) {\n\tvar event common.Event\n\tdata := m.OriginalMessage.GetData()\n\terr := json.Unmarshal(data, &event)\n\tif err != nil {\n\t\tlog.WithError(err).WithField(\"value\", m.OriginalMessage.Data).Fatal(\"Unmarshal failed\")\n\t\treturn event, err\n\t}\n\treturn event, nil\n}", "title": "" }, { "docid": "b72ce5077c8294d6005e234e3371c8cb", "score": "0.52918905", "text": "func IsWETHDepositEvent(topic common.Hash) bool {\n\treturn topic == wethDepositEventSit\n}", "title": "" }, { "docid": "b188dd0ff4b4981b2c3963f3a5123204", "score": "0.5278324", "text": "func IsTimeRecordEvent(strInputFileName string) bool {\n\tvar timeRecordEvent bool\n\thdrData := GetHeader(strInputFileName)\n\tfor _, data := range hdrData {\n\t\tif strings.EqualFold(data, \"timeRecordEvent\") {\n\t\t\ttimeRecordEvent = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn timeRecordEvent\n}", "title": "" }, { "docid": "d3e045da63f495b5f2645e0c84e9ecc8", "score": "0.526361", "text": "func IsTimeEventInput(strInputFileName string) bool {\n\tvar timeEvent bool\n\thdrData := GetHeader(strInputFileName)\n\tfor _, data := range hdrData {\n\t\tif strings.EqualFold(data, \"timeEvents\") {\n\t\t\ttimeEvent = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn timeEvent\n}", "title": "" }, { "docid": "6bbbd5039c4cdb6eb73a6d266ead7bbd", "score": "0.5250218", "text": "func isEventNew(event *v1.Event, oldestEventTime time.Time) bool {\n\tif event.LastTimestamp.Time.After(oldestEventTime) {\n\t\treturn true\n\t\t// if LastTimestamp is zero then try to check the event series\n\t} else if event.LastTimestamp.IsZero() {\n\t\tif event.Series != nil {\n\t\t\tif event.Series.LastObservedTime.Time.After(oldestEventTime) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "9dea14389039c03ceefd2e3122abe1a4", "score": "0.5170644", "text": "func (e BaseEvent) IsProcessed() bool {\n\treturn e.processed\n}", "title": "" }, { "docid": "39bf04030fad757b6412b2955822308b", "score": "0.5163733", "text": "func (s *Strategy) Event() (DataEvent, bool) {\n\tif s.event == nil {\n\t\treturn nil, false\n\t}\n\n\treturn s.event, true\n}", "title": "" }, { "docid": "43d7d8a3cdd3c4bd6327212a92ee0120", "score": "0.51544815", "text": "func (o *MicrosoftGraphReminder) HasEventId() bool {\n\tif o != nil && o.EventId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b726f50dbe6d00612c162162d52455c0", "score": "0.51472497", "text": "func (s *Serf) handleUserEvent(eventMsg *messageUserEvent) bool {\n\t// Witness a potentially newer time\n\ts.eventClock.Witness(eventMsg.LTime)\n\n\ts.eventLock.Lock()\n\tdefer s.eventLock.Unlock()\n\n\t// Ignore if it is before our minimum event time\n\tif eventMsg.LTime < s.eventMinTime {\n\t\treturn false\n\t}\n\n\t// Check if this message is too old\n\tcurTime := s.eventClock.Time()\n\tif curTime > LamportTime(len(s.eventBuffer)) &&\n\t\teventMsg.LTime < curTime-LamportTime(len(s.eventBuffer)) {\n\t\ts.logger.Printf(\n\t\t\t\"[WARN] serf: received old event %s from time %d (current: %d)\",\n\t\t\teventMsg.Name,\n\t\t\teventMsg.LTime,\n\t\t\ts.eventClock.Time())\n\t\treturn false\n\t}\n\n\t// Check if we've already seen this\n\tidx := eventMsg.LTime % LamportTime(len(s.eventBuffer))\n\tseen := s.eventBuffer[idx]\n\tuserEvent := userEvent{Name: eventMsg.Name, Payload: eventMsg.Payload}\n\tif seen != nil && seen.LTime == eventMsg.LTime {\n\t\tfor _, previous := range seen.Events {\n\t\t\tif previous.Equals(&userEvent) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t} else {\n\t\tseen = &userEvents{LTime: eventMsg.LTime}\n\t\ts.eventBuffer[idx] = seen\n\t}\n\n\t// Add to recent events\n\tseen.Events = append(seen.Events, userEvent)\n\n\t// Update some metrics\n\tmetrics.IncrCounter([]string{\"serf\", \"events\"}, 1)\n\tmetrics.IncrCounter([]string{\"serf\", \"events\", eventMsg.Name}, 1)\n\n\tif s.config.EventCh != nil {\n\t\ts.config.EventCh <- UserEvent{\n\t\t\tLTime: eventMsg.LTime,\n\t\t\tName: eventMsg.Name,\n\t\t\tPayload: eventMsg.Payload,\n\t\t\tCoalesce: eventMsg.CC,\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "cbaec15c063549be7e37b74505582181", "score": "0.51406753", "text": "func (o *EventLog) GetEventOk() (*string, bool) {\n\tif o == nil || o.Event == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Event, true\n}", "title": "" }, { "docid": "ee7ffcf2a19769339191c201c9e62417", "score": "0.513129", "text": "func (il InterfaceList) HasEventNamed(input bool, s string) bool {\n\tif input {\n\t\tfor i := 0; i < len(il.EventInputs); i++ {\n\t\t\tif il.EventInputs[i].Name == s {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\tfor i := 0; i < len(il.EventOutputs); i++ {\n\t\tif il.EventOutputs[i].Name == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "984572101d31cd36a6d4719f05039782", "score": "0.51225734", "text": "func IsWebhookEvent(r *http.Request) (ok bool, whtype WebhookEventType) {\n\tfor k, v := range r.Header {\n\t\tswitch k {\n\t\tcase \"User-Agent\":\n\t\t\tif !strings.HasPrefix(v[0], \"Sonatype_CLM_Server\") {\n\t\t\t\tbreak\n\t\t\t}\n\t\tcase \"X-Nexus-Webhook-Id\":\n\t\t\treturn true, WebhookEventType(v[0])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "53db584e740e1a7ad3c73b3acc8b36a3", "score": "0.51003265", "text": "func (s *Slackscot) processMessageEvent(driver chatDriver, msgEvent *slack.MessageEvent) {\n\t// reply_to is an field set to 1 sent by slack when a sent message has been acknowledged and should be considered\n\t// officially sent to others. Therefore, we ignore all of those since it's mostly for clients/UI to show status\n\tisReply := msgEvent.ReplyTo > 0\n\n\ts.log.Debugf(\"Processing event: %v\", msgEvent)\n\n\tif !isReply && msgEvent.Type == \"message\" {\n\t\tif msgEvent.SubType == \"message_deleted\" {\n\t\t\ts.processDeletedMessage(driver, msgEvent)\n\t\t} else {\n\t\t\tif msgEvent.SubType == \"message_changed\" {\n\t\t\t\ts.processUpdatedMessage(driver, msgEvent)\n\t\t\t} else if msgEvent.SubType != \"message_replied\" {\n\t\t\t\ts.processNewMessage(driver, msgEvent)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aac5fc2cb04340deb8bfaa205b6c417f", "score": "0.5097976", "text": "func (e *Event) HasData() bool {\n\treturn e.Bytes > 0\n}", "title": "" }, { "docid": "0945d8592edfa5db1135b6b312a9ab76", "score": "0.5084509", "text": "func IsEventSender(cliCtx client.Context, validatorID uint64) bool {\n\tvar validator types2.QueryValidatorResponse\n\n\tresult, err := helper.FetchFromAPI(helper.GetHeimdallServerEndpoint(fmt.Sprintf(ValidatorURL, strconv.FormatUint(validatorID, 10))))\n\tif err != nil {\n\t\tlogger.Error(\"Error fetching proposers\", \"error\", err)\n\t\treturn false\n\t}\n\n\terr = jsonpb.UnmarshalString(string(result), &validator)\n\tif err != nil {\n\t\tlogger.Error(\"error unmarshalling proposer slice\", \"error\", err)\n\t\treturn false\n\t}\n\tlogger.Debug(\"Current event sender received\", \"validator\", validator.String())\n\n\treturn bytes.Equal(validator.Validator.GetSigner(), helper.GetAddress())\n}", "title": "" }, { "docid": "998d20e51508432b77a68eb7863f80aa", "score": "0.5078652", "text": "func (n *DBREventReceiver) Event(eventName string) {\n\tif !n.Debug {\n\t\treturn\n\t}\n\tfmt.Printf(\"\\x1b[31m%v\\x1b[0m\\n\", eventName)\n}", "title": "" }, { "docid": "2ffac905d58e8b35801513501d8b249f", "score": "0.50777555", "text": "func (m *Module) Event() <-chan string {\n\treturn nil\n}", "title": "" }, { "docid": "954949efcd2eadde4a9468ac9b1b1411", "score": "0.50774956", "text": "func (s *ExternalAgent) IsSubscribed(e Event) bool {\n\ts.ManagedThread.Lock()\n\tdefer s.ManagedThread.Unlock()\n\t_, found := s.events[e]\n\treturn found\n}", "title": "" }, { "docid": "2662776b553b29f3c599380835d06355", "score": "0.50647205", "text": "func (m *GossipMessage) IsDataMsg() bool {\n\treturn m.GetDataMsg() != nil\n}", "title": "" }, { "docid": "e4a4350f31e2ef8c41b0576fe7bca1b1", "score": "0.5061046", "text": "func (m *ServerMutation) EventCleared() bool {\n\treturn m.clearedevent\n}", "title": "" }, { "docid": "56dbe119631dac4eecd4d30b36d5c1a8", "score": "0.50596726", "text": "func (d *segmentationDescriptor) IsEventCanceled() bool {\n\treturn d.eventCancelIndicator\n}", "title": "" }, { "docid": "43238863c267c069cca5f056a221fd8d", "score": "0.5050801", "text": "func ValidateEvent(event *Event) (isValid bool, err error) {\n\tif event == nil {\n\t\terr = errors.Errorf(\"event must not be nil\")\n\t\treturn\n\t}\n\n\tif event.Type != \"i\" && event.Type != \"o\" {\n\t\terr = errors.Errorf(\"type must either be `o` or `i`\")\n\t\treturn\n\t}\n\n\tisValid = true\n\treturn\n}", "title": "" }, { "docid": "1681bb34115e12c465ede4203d898fa1", "score": "0.504689", "text": "func (b *imgBatch) Event() <-chan bool {\n\treturn b.e\n}", "title": "" }, { "docid": "b6557885b6644f8b4d70bf201ec24532", "score": "0.5045816", "text": "func (e *Event) Type() idtype.Type { return idtype.ActivityEvent }", "title": "" }, { "docid": "3c3a39147183c5ca66d300e3a02d1c19", "score": "0.50419533", "text": "func PushEvent(event Event) (filtered bool, err error) {\n\t_event := (*C.SDL_Event)(unsafe.Pointer(cEvent(event)))\n\tif ok := int(C.SDL_PushEvent(_event)); ok < 0 {\n\t\tfiltered, err = false, GetError()\n\t} else if ok == 0 {\n\t\tfiltered, err = true, nil\n\t}\n\treturn\n}", "title": "" }, { "docid": "dafc2e410800ade358aab263be820444", "score": "0.50394195", "text": "func (md *Message) IsMessageSet() bool {\n\treturn md.L1.IsMessageSet\n}", "title": "" }, { "docid": "43cf81ee7c0490bbd7e597d6a06b9c9b", "score": "0.5036232", "text": "func (e *Event) Command() bool {\n\treturn e.command\n}", "title": "" }, { "docid": "21a9dde365311e67d8882f11c72ad3af", "score": "0.5029805", "text": "func (p *Plugin) HandlesEvent(event controller.Event) bool {\n\tif event.Method() != controller.Update {\n\t\treturn true\n\t}\n\tif ksChange, isKSChange := event.(*controller.KubeStateChange); isKSChange {\n\t\tswitch ksChange.Resource {\n\t\tcase sfcmodel.Keyword:\n\t\t\treturn true\n\t\tcase podmodel.PodKeyword:\n\t\t\treturn true\n\t\tcase extifmodel.Keyword:\n\t\t\treturn true\n\t\tdefault:\n\t\t\t// unhandled Kubernetes state change\n\t\t\treturn false\n\t\t}\n\t}\n\tif _, isPodCustomIfUpdate := event.(*ipnet.PodCustomIfUpdate); isPodCustomIfUpdate {\n\t\treturn true\n\t}\n\t// unhandled event\n\treturn false\n}", "title": "" }, { "docid": "4adc58695b145170d002fa0c77526dd9", "score": "0.5020932", "text": "func isNoopEvent(e *reflex.Event) bool {\n\treturn isNoop(e.ForeignID, e.Type)\n}", "title": "" }, { "docid": "ac302841dcb89bf888abc24f71990879", "score": "0.5016735", "text": "func NewEvent(t string, m string, p string) Event {\n\te := Event{}\n\te.time, _ = time.Parse(time.RFC3339, t)\n\te.message = m\n\n\tswitch m {\n\tcase \"Email Sent\":\n\tcase \"Clicked Link\":\n\t\tfallthrough\n\tcase \"Email Opened\":\n\t\tvar result map[string]interface{}\n\t\tjson.Unmarshal([]byte(p), &result)\n\t\te.address = result[\"browser\"].(map[string]interface{})[\"address\"].(string)\n\t\te.userAgent = result[\"browser\"].(map[string]interface{})[\"user-agent\"].(string)\n\t\te.rid = result[\"payload\"].(map[string]interface{})[\"rid\"].([]interface{})[0].(string)\n\tcase \"Submitted Data\":\n\t\tvar result map[string]interface{}\n\t\tjson.Unmarshal([]byte(p), &result)\n\t\te.address = result[\"browser\"].(map[string]interface{})[\"address\"].(string)\n\t\te.userAgent = result[\"browser\"].(map[string]interface{})[\"user-agent\"].(string)\n\t\te.rid = result[\"payload\"].(map[string]interface{})[\"rid\"].([]interface{})[0].(string)\n\t\te.login = result[\"payload\"].(map[string]interface{})[\"login\"].([]interface{})[0].(string)\n\t\te.password = result[\"payload\"].(map[string]interface{})[\"password\"].([]interface{})[0].(string)\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "c70d4bea07b443fd68bf105a9991f159", "score": "0.50027776", "text": "func (e *EmoticonData) GetEventName() string {\n\treturn \"EmoticonData\"\n}", "title": "" }, { "docid": "c70d4bea07b443fd68bf105a9991f159", "score": "0.50027776", "text": "func (e *EmoticonData) GetEventName() string {\n\treturn \"EmoticonData\"\n}", "title": "" }, { "docid": "7f00d229efef279b75adae09826ab375", "score": "0.5002586", "text": "func (v *Event) IsSetTime() bool {\n\treturn v != nil && v.Time != nil\n}", "title": "" }, { "docid": "a3e96e21a5c1ce7cb0f15be2c2104647", "score": "0.49944237", "text": "func (m *GossipMessage) IsStateInfoMsg() bool {\n\treturn m.GetStateInfo() != nil\n}", "title": "" }, { "docid": "b239cee1b84a74d9b17c46ab86c45c26", "score": "0.49813125", "text": "func (o *MonitorType) HasMessage() bool {\n\treturn o != nil && o.Message != nil\n}", "title": "" }, { "docid": "609b19d383e5b9c2721fee596c4171d5", "score": "0.49750876", "text": "func (o *OprsDeploymentAllOf) HasEvent() bool {\n\tif o != nil && o.Event != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dc69ab323fb8120eacc7521cb379eee6", "score": "0.4960464", "text": "func (i pluginEvent) IsApluginEvent() bool {\n\tfor _, v := range _pluginEventValues {\n\t\tif i == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "cc68efe032d11b22043c5ac54d60f9fe", "score": "0.4957314", "text": "func (f *FakeRecorder) Event(obj runtime.Object, eventtype, reason, message string) {\n\tf.generateEvent(obj, metav1.Now(), eventtype, reason, message)\n}", "title": "" }, { "docid": "161a6d3318613347d23733d19f3d1138", "score": "0.49572542", "text": "func (r *botContext) Event() *slack.MessageEvent {\n\treturn r.event\n}", "title": "" }, { "docid": "673b53ab045408763e49de183a0ae4eb", "score": "0.4953472", "text": "func (ev *Event) IsModify() bool {\n\tif ev.isModify == true {\n\t\tev.isModify = false\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "689b2c1645e10e2601f1443333d9e8ba", "score": "0.49491155", "text": "func (o *Group) HasEvents() bool {\n\tif o != nil && o.Events != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1ca2b07b6beb3ea549975e4d8cb0452e", "score": "0.4948059", "text": "func (s *Stamp) Event() {\n\toldE := s.event.Clone()\n\tnewE := s.fill()\n\tif newE.Equals(oldE) {\n\t\ts.event, _ = s.grow()\n\t} else {\n\t\ts.event = newE\n\t}\n}", "title": "" }, { "docid": "5752f8ba161c4401b511ac07c42ba640", "score": "0.4946265", "text": "func (wm *WsMessage) IsControl() bool {\n\tif wm.MessageType == websocket.TextMessage ||\n\t\twm.MessageType == websocket.BinaryMessage {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "063e1c13edc2e9399dc6c45f8795c663", "score": "0.49392012", "text": "func (p EventTagP) Call(ev cap.Event) bool {\n\treturn ev.GetTag() == p.tag\n}", "title": "" }, { "docid": "093fef0ddb5d1b8a19e51fa2430139aa", "score": "0.49338427", "text": "func NewMessageEvent(name string, line ircmsg.IrcMessage, tme time.Time) *MessageEvent {\n\treturn &MessageEvent{\n\t\tNewRawEvent(name, line, tme),\n\t\tline.Command == \"NOTICE\",\n\t\tircutils.ParseUserhost(line.Prefix),\n\t\tutil.IdxOrEmpty(line.Params, 0),\n\t\tutil.IdxOrEmpty(line.Params, 1),\n\t}\n}", "title": "" }, { "docid": "5cdea125b7a1eb5127b507561cdce633", "score": "0.49307153", "text": "func (m *gitEvent) Message() string {\n\treturn m.messageField\n}", "title": "" }, { "docid": "55c4be10aaf51c4a984e2f4451d64eba", "score": "0.49227655", "text": "func (m *Payload) SetIsCurrentEvent(value *bool)() {\n err := m.GetBackingStore().Set(\"isCurrentEvent\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "97cf8683cc52256b032b17d39f982f70", "score": "0.4917733", "text": "func (processor *AbiProcessor) GetEvent(id common.Hash) (EventData, bool) {\n\tvar (\n\t\tevent EventData\n\t\tok bool\n\t)\n\tevent, ok = processor.events[id]\n\treturn event, ok\n}", "title": "" }, { "docid": "a3710f2779afd675301467536cf5b63e", "score": "0.491455", "text": "func (e *FantasyLeagueDraftStatus) GetEventName() string {\n\treturn \"FantasyLeagueDraftStatus\"\n}", "title": "" }, { "docid": "55cb634ac35c736a50d20cf17a1a5648", "score": "0.49127945", "text": "func (s *span) IsRecordingEvents() bool {\n\tif s == nil {\n\t\treturn false\n\t}\n\treturn s.data != nil\n}", "title": "" }, { "docid": "d352d20f4bafb22bcb4bae3a8c22b795", "score": "0.4894903", "text": "func (m *GossipMessage) IsDigestMsg() bool {\n\treturn m.GetDataDig() != nil\n}", "title": "" }, { "docid": "a1787f1e2e17f8e63f3d0922bf5d5dee", "score": "0.4888593", "text": "func (c *Client) HandleMessage(e *irc.Event) {\n\tfmt.Println(e)\n}", "title": "" }, { "docid": "25e8af4e5a7a011ea4fcc8099e3c164d", "score": "0.48804033", "text": "func (mgr *ClientManager) Event() error {\n\tevent, err := event.New(mgr.sdk.ChannelContext(mgr.ChannelID, fabsdk.WithUser(mgr.Username), fabsdk.WithOrg(mgr.Org)))\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"Failed to create new channel event\")\n\t}\n\tmgr.event = event\n\n\treturn nil\n}", "title": "" }, { "docid": "13aca4ce8273e25c60f713ba9a8d7d56", "score": "0.48711398", "text": "func (c *Client) Event(e *Event) error {\n\tif c == nil {\n\t\treturn ErrNoClient\n\t}\n\tc.Lock()\n\tvar err error\n\tif err = c.buffer.writeEvent(*e, c.Tags); err == errBufferFull {\n\t\tc.flushLocked()\n\t\terr = c.buffer.writeEvent(*e, c.Tags)\n\t}\n\tc.Unlock()\n\treturn err\n}", "title": "" }, { "docid": "93de69d45c19467f7e722a5086c32e73", "score": "0.48706928", "text": "func (h *MessageHandler) HandleEvent(c *Connection, ev *Event) error {\n\tif ev.Type != h.Type {\n\t\tlog.Printf(\"%v handler got wrong type %v\\n\", h.Type, ev.Type)\n\t\treturn errors.New(\"Wrong event type\")\n\t}\n\n\tdata := make(map[string]interface{})\n\terr := json.Unmarshal([]byte(ev.Data), &data)\n\tif err != nil {\n\t\tlog.Printf(\"Erorr unmarshalling ev.Data %v\\n\", err)\n\t\treturn err\n\t}\n\n\tlog.Printf(\"Got message event %v\\n\", data[\"text\"])\n\treturn nil\n}", "title": "" }, { "docid": "b7714144c84bf7479326816249f73d31", "score": "0.48657304", "text": "func IsChannelMessage(b uint8) bool {\n\treturn !hasBitU8(b, 6)\n}", "title": "" }, { "docid": "660ac95020df22db97d04b19e1d4a81a", "score": "0.48639444", "text": "func (e *SteamDatagramTicket) GetEventName() string {\n\treturn \"SteamDatagramTicket\"\n}", "title": "" }, { "docid": "660ac95020df22db97d04b19e1d4a81a", "score": "0.48639444", "text": "func (e *SteamDatagramTicket) GetEventName() string {\n\treturn \"SteamDatagramTicket\"\n}", "title": "" }, { "docid": "efc0bbc267dd9056aef785dd9bab71da", "score": "0.48638472", "text": "func MatchEvent(event, flag int) bool {\n\treturn event == 0 || event&flag != 0\n}", "title": "" }, { "docid": "bee64b589bf652adab738800a713957d", "score": "0.48623985", "text": "func (h *ProjectionMessageHandler) HandleEvent(\n\tctx context.Context,\n\tr, c, n []byte,\n\ts dogma.ProjectionEventScope,\n\te dogma.Event,\n) (bool, error) {\n\tif h.HandleEventFunc != nil {\n\t\treturn h.HandleEventFunc(ctx, r, c, n, s, e)\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "a552437cb3797e78aa34377015cd7d13", "score": "0.4852929", "text": "func (b *BoxLayout) HandleEvent(ev tcell.Event) bool {\n\tswitch ev.(type) {\n\tcase *EventWidgetContent:\n\t\t// This can only have come from one of our children.\n\t\tb.changed = true\n\t\tb.PostEventWidgetContent(b)\n\t\treturn true\n\t}\n\tfor _, c := range b.cells {\n\t\tif c.widget.HandleEvent(ev) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b3e813d98839456e9b0d2f112e7044df", "score": "0.48523825", "text": "func (*OpenconfigSystem_System_Aaa_Authorization_Events_Event) IsYANGGoStruct() {}", "title": "" }, { "docid": "b3e813d98839456e9b0d2f112e7044df", "score": "0.48523825", "text": "func (*OpenconfigSystem_System_Aaa_Authorization_Events_Event) IsYANGGoStruct() {}", "title": "" }, { "docid": "b3e813d98839456e9b0d2f112e7044df", "score": "0.48523825", "text": "func (*OpenconfigSystem_System_Aaa_Authorization_Events_Event) IsYANGGoStruct() {}", "title": "" }, { "docid": "a768ff5e37adabf13d0d4587580b2865", "score": "0.4849345", "text": "func (m *Message) IsFromClient() bool {\n\treturn m.NickName != \"\"\n}", "title": "" }, { "docid": "0068f1c3dbba1166f0bfb2661d89a14c", "score": "0.48427606", "text": "func (o *MicrosoftGraphReminder) HasEventSubject() bool {\n\tif o != nil && o.EventSubject != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a0b718b73fbd2269f0cd183bd87d75b9", "score": "0.4840691", "text": "func (r recorder) Event(object runtime.Object, reason, message string) {\n\tr.EventRecorder.Event(object, corev1.EventTypeNormal, r.String(reason), message)\n}", "title": "" }, { "docid": "4138f15158c1ea4de56758eade2222b5", "score": "0.4839945", "text": "func (m *Monitor) Event(title, text string) error {\n\tm.log(\"Event{title: %s, text: %s}\", title, text)\n\terr := m.client.SimpleEvent(title, text)\n\tm.error(err)\n\treturn err\n}", "title": "" } ]
716ac078043cfd6d55b1c1528089f935
Specifies the maximum number of resources to return in the response.
[ { "docid": "83533661358ba05ba5f32834ad921a22", "score": "0.0", "text": "func (r ApiGetServerConfigImportListRequest) Top(top int32) ApiGetServerConfigImportListRequest {\n\tr.top = &top\n\treturn r\n}", "title": "" } ]
[ { "docid": "48065e20c3376ce69f35980cda41d43a", "score": "0.6762729", "text": "func (o CircuitBreakersResponseOutput) MaxRequests() pulumi.IntOutput {\n\treturn o.ApplyT(func(v CircuitBreakersResponse) int { return v.MaxRequests }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "34c51336d487916698a0c3e860619d08", "score": "0.65412897", "text": "func (o CircuitBreakersOutput) MaxRequests() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v CircuitBreakers) *int { return v.MaxRequests }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "bbe7c500a4660f31c299916ca0d63c1c", "score": "0.64409214", "text": "func (o ResourceLimitResponseOutput) Maximum() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ResourceLimitResponse) string { return v.Maximum }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "efa4b6372dc7dc221e3a1fd19176f062", "score": "0.6248626", "text": "func (o BackendResponseOutput) MaxConnections() pulumi.IntOutput {\n\treturn o.ApplyT(func(v BackendResponse) int { return v.MaxConnections }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "bcba436b1079a4ef5a2c1cc45b4f9b19", "score": "0.62042147", "text": "func Limit(limit int) RequestOption {\n\treturn Param(\"limit\", limit)\n}", "title": "" }, { "docid": "71bd6e612db4c5fb1c97e82393abe041", "score": "0.61798805", "text": "func (o HttpReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HttpReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "8b37e7e4ed7795a6b79fada959423b24", "score": "0.6130044", "text": "func (r ApiLocationsGetRequest) MaxResults(maxResults int32) ApiLocationsGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "7e48b5cf2fd927c4eb6d0073f5c98b1e", "score": "0.6129272", "text": "func (r ApiDatacentersServersGetRequest) MaxResults(maxResults int32) ApiDatacentersServersGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "ee20f53a01e79bcd8b0e2ee79f5449a1", "score": "0.6122576", "text": "func (o CircuitBreakersPtrOutput) MaxRequests() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *CircuitBreakers) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxRequests\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "a046a6499cbc2201d45e42d3e2fff3ed", "score": "0.61181444", "text": "func (r ApiDatacentersServersRemoteConsoleGetRequest) MaxResults(maxResults int32) ApiDatacentersServersRemoteConsoleGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "b88dc1737c73ce9df9d6b929aad95565", "score": "0.61100996", "text": "func (o AzureBlobStorageReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobStorageReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "533da411e7c53d0907736ea967b8d84e", "score": "0.61036515", "text": "func (o RestSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v RestSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "37ccfc59b007aab818b0f1c6994132b8", "score": "0.6091498", "text": "func (r ApiDatacentersServersTokenGetRequest) MaxResults(maxResults int32) ApiDatacentersServersTokenGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "df182acd339c331323c614bac8ceed14", "score": "0.6078245", "text": "func (o CircuitBreakersResponseOutput) MaxConnections() pulumi.IntOutput {\n\treturn o.ApplyT(func(v CircuitBreakersResponse) int { return v.MaxConnections }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "a7a928085c36d4aa803fd9a329a1a587", "score": "0.6072555", "text": "func (o OracleCloudStorageReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v OracleCloudStorageReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "47f53eeea9a194ea017ad9b784b00812", "score": "0.60634285", "text": "func (o AzureBlobFSReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobFSReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "1137a5d292aa639b62ef0a7aaf9c5e4e", "score": "0.6059936", "text": "func (o AzureFileStorageReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureFileStorageReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "5162122cbdad8db5ed6d796f8210c6a8", "score": "0.6053057", "text": "func (_options *ListResourceKeysOptions) SetLimit(limit int64) *ListResourceKeysOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "09563f771b390d412aded820c28e2cf5", "score": "0.6049238", "text": "func (o AmazonS3CompatibleReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AmazonS3CompatibleReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "a4efa39182fdf84dd6420e0909160452", "score": "0.6034678", "text": "func (o RestSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v RestSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "31137ae08d3de253f29dac8de4cde571", "score": "0.6031081", "text": "func MaxConcurrentRequests(max int) Option {\n\treturn optionFunc(func(c *Cache) {\n\t\tif max > 0 {\n\t\t\tc.maxRequests = max\n\t\t}\n\t})\n}", "title": "" }, { "docid": "21a9052c2fedf10cfe1ce0a3a5843baf", "score": "0.60129946", "text": "func (r ApiTargetgroupsGetRequest) MaxResults(maxResults int32) ApiTargetgroupsGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "c633cce882880f3ee28d8ac519ff0b76", "score": "0.60063946", "text": "func (o GooglePrivacyDlpV2BigQueryOptionsResponseOutput) RowsLimit() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GooglePrivacyDlpV2BigQueryOptionsResponse) string { return v.RowsLimit }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d77c5b588c8b888b709b8b2e298c4226", "score": "0.6005585", "text": "func WithLimit(n int64) clientv3.OpOption { return clientv3.WithLimit(n) }", "title": "" }, { "docid": "767e9f874d6e346b008039074c2c1bd8", "score": "0.6004614", "text": "func MaxRequestRetries(max int) Option {\n\treturn optionFunc(func(c *Cache) {\n\t\tif max > 0 {\n\t\t\tc.maxRetries = max\n\t\t}\n\t})\n}", "title": "" }, { "docid": "7b4e76f2427fa52e32026f691e54a27d", "score": "0.5997561", "text": "func (o AzureDataLakeStoreReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDataLakeStoreReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "c669628ba2b3aefa0d669786de67666e", "score": "0.5991525", "text": "func MaxOpenConnections(maximum int) Option {\n\treturn func(options *ClientOptions) error {\n\t\toptions.MaxOpenConnections = maximum\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "ebd871e54af1539b4ebb2599e2f3aaa2", "score": "0.59861505", "text": "func (c *ReportsGenerateCall) MaxResults(maxResults int64) *ReportsGenerateCall {\n\tc.urlParams_.Set(\"maxResults\", fmt.Sprint(maxResults))\n\treturn c\n}", "title": "" }, { "docid": "8a69b79d6c464c22460e869a5a20e5f3", "score": "0.59793305", "text": "func (o FileServerReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v FileServerReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "c668f936e17a84d3cd038d276d5de7b5", "score": "0.59762985", "text": "func (_options *ListResourceBindingsOptions) SetLimit(limit int64) *ListResourceBindingsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "28e2e167c485141978368fbbb794e17b", "score": "0.5967543", "text": "func (r ApiDatacentersServersNicsFlowlogsGetRequest) MaxResults(maxResults int32) ApiDatacentersServersNicsFlowlogsGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "610ceaa8778c2839d59cba4d659d7a8c", "score": "0.5962972", "text": "func (o AmazonS3ReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AmazonS3ReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "016dc5c488da762331d90d9113be4e93", "score": "0.59614104", "text": "func (s *Stat) MaxResources() int32 {\n\treturn s.maxResources\n}", "title": "" }, { "docid": "016dc5c488da762331d90d9113be4e93", "score": "0.59614104", "text": "func (s *Stat) MaxResources() int32 {\n\treturn s.maxResources\n}", "title": "" }, { "docid": "a406adc2bbe30aaf80be8dbb9d5c1564", "score": "0.5950523", "text": "func (o AzureBlobFSSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobFSSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "03c2bfac48ef15fa68c8b76e5252ad7b", "score": "0.59466714", "text": "func (o CircuitBreakersResponseOutput) MaxRequestsPerConnection() pulumi.IntOutput {\n\treturn o.ApplyT(func(v CircuitBreakersResponse) int { return v.MaxRequestsPerConnection }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "262cfdcb653e37bfeae97646aa447394", "score": "0.59457916", "text": "func (r ApiDatacentersServersCdromsGetRequest) MaxResults(maxResults int32) ApiDatacentersServersCdromsGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "22b0487343f8360c5c030a94a7a4624f", "score": "0.59407496", "text": "func (o CircuitBreakersResponseOutput) MaxPendingRequests() pulumi.IntOutput {\n\treturn o.ApplyT(func(v CircuitBreakersResponse) int { return v.MaxPendingRequests }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "305c1a29f1048d76ebf66cab7ea34656", "score": "0.5938735", "text": "func (c *ReportsSavedGenerateCall) MaxResults(maxResults int64) *ReportsSavedGenerateCall {\n\tc.urlParams_.Set(\"maxResults\", fmt.Sprint(maxResults))\n\treturn c\n}", "title": "" }, { "docid": "d4824af7880050d86f2648bcd08f944f", "score": "0.5936452", "text": "func (o HttpReadSettingsOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HttpReadSettings) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "4e5a747bb849a0e399810843a9a1d9ba", "score": "0.5935124", "text": "func (r ApiSnapshotsGetRequest) MaxResults(maxResults int32) ApiSnapshotsGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "f55ee77fde92f810e061f1b214417e77", "score": "0.593401", "text": "func (o GoogleCloudStorageReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v GoogleCloudStorageReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "b65b2c05ccc0552b82b38b644104648a", "score": "0.5923652", "text": "func (o AzureBlobFSSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobFSSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "c92a118ad52dd9a86391bad9c64bbb63", "score": "0.59206384", "text": "func (o ServiceComputeLoggingHttpOutput) RequestMaxEntries() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v ServiceComputeLoggingHttp) *int { return v.RequestMaxEntries }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "a6c0f3b906639c37fac7d13aa771df53", "score": "0.59171444", "text": "func (o HttpSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HttpSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "14e56660bdf5b7f9350659573620828e", "score": "0.59109235", "text": "func (_Comptroller *ComptrollerSession) MaxAssets() (*big.Int, error) {\n\treturn _Comptroller.Contract.MaxAssets(&_Comptroller.CallOpts)\n}", "title": "" }, { "docid": "0290d863053fcc73ae1ebe4d6f84ea1c", "score": "0.59054893", "text": "func (o HdfsReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HdfsReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "53023fd617fe86197ef84098e2fa07e5", "score": "0.5901157", "text": "func (o AzureBlobStorageWriteSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobStorageWriteSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "77058f1287b1619ccd7d6cf48505e090", "score": "0.5896162", "text": "func (_options *ListResourceKeysForInstanceOptions) SetLimit(limit int64) *ListResourceKeysForInstanceOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "5a0df1a6d81cffeffe4290eb7538c490", "score": "0.5882951", "text": "func (o ServiceVclLoggingHttpOutput) RequestMaxEntries() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v ServiceVclLoggingHttp) *int { return v.RequestMaxEntries }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "5aace8e8f46e15b81bcb3c3320cbe466", "score": "0.5882806", "text": "func (o MongoDbCursorMethodsPropertiesResponseOutput) Limit() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v MongoDbCursorMethodsPropertiesResponse) interface{} { return v.Limit }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "ff3433123feecd710742713136d6521b", "score": "0.58805805", "text": "func (o *Output) MaxSize() int { return 1024 * 1024 * 1024 }", "title": "" }, { "docid": "3d727c3e38cdba302cc58190e1fc6ee1", "score": "0.58805794", "text": "func (o CircuitBreakersOutput) MaxRequestsPerConnection() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v CircuitBreakers) *int { return v.MaxRequestsPerConnection }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "e03a1f850143422bd7616f11d17526e2", "score": "0.58742744", "text": "func (o CosmosDbMongoDbApiSourceResponseOutput) BatchSize() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbMongoDbApiSourceResponse) interface{} { return v.BatchSize }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "195d3d875b681e4afb11ffb9a368665d", "score": "0.587287", "text": "func (_options *ListResourceInstancesOptions) SetLimit(limit int64) *ListResourceInstancesOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "c97310543738cf13bb1f404c2d820cba", "score": "0.5868095", "text": "func MaxConn(n int) Option {\n\treturn setServerOption(maxConnKey{}, n)\n}", "title": "" }, { "docid": "3503c8978455306c44b91682f69a4fb8", "score": "0.5864984", "text": "func MaxInFlight(count int) option {\n\treturn func(opts *clientOptions) {\n\t\topts.wsOptions = append(opts.wsOptions, ws.MaxInFlight(count))\n\t}\n}", "title": "" }, { "docid": "158564583c871838e82db43c0ddc8d51", "score": "0.58642364", "text": "func MaxConn(n int) server.Option {\n\treturn setServerOption(maxConnKey{}, n)\n}", "title": "" }, { "docid": "0a3bce249de5da5ba64abc046ec139ae", "score": "0.58528745", "text": "func (dm *Datamuse) Max(n uint) *Datamuse {\n\tdm.setQueryParam(\"max\", strconv.FormatUint(uint64(n), 10))\n\treturn dm\n}", "title": "" }, { "docid": "e94249e84a1c235e1e1f882da3dfe588", "score": "0.58526695", "text": "func (_Comptroller *ComptrollerCallerSession) MaxAssets() (*big.Int, error) {\n\treturn _Comptroller.Contract.MaxAssets(&_Comptroller.CallOpts)\n}", "title": "" }, { "docid": "585a23214a2a891d7136b8d22a29d2a4", "score": "0.5848998", "text": "func (o AmazonMWSSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AmazonMWSSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "e114f050f7f7843c785e43fe346fe8da", "score": "0.5845684", "text": "func (c *ResourcesBuildingsListCall) MaxResults(maxResults int64) *ResourcesBuildingsListCall {\n\tc.urlParams_.Set(\"maxResults\", fmt.Sprint(maxResults))\n\treturn c\n}", "title": "" }, { "docid": "26fbcd302c613c90bdaf16b2e8f5a5ad", "score": "0.58426964", "text": "func (o AzureFileStorageWriteSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureFileStorageWriteSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "17d8801aabf07b7f9aec82b70d6cc5d5", "score": "0.5841116", "text": "func (o AzureBlobFSWriteSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobFSWriteSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "2a4d07a0e769826c053ad6869f68f87b", "score": "0.5838915", "text": "func MaxIdleConnections(maximum int) Option {\n\treturn func(options *ClientOptions) error {\n\t\toptions.MaxIdleConnections = maximum\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "10f579b4a3465c20456e027dcd3c13c1", "score": "0.5836778", "text": "func (o SqlDWSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlDWSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "edf49b91eba214587875bd94763001bf", "score": "0.58339417", "text": "func MaxAllowed(n int) echo.MiddlewareFunc {\n\tsem := make(chan struct{}, n)\n\tacquire := func() { sem <- struct{}{} }\n\trelease := func() { <-sem }\n\treturn func(h echo.Handler) echo.Handler {\n\t\treturn echo.HandlerFunc(func(c echo.Context) error {\n\t\t\tacquire() // before request\n\t\t\terr := h.Handle(c)\n\t\t\trelease() // after request\n\t\t\treturn err\n\t\t})\n\t}\n}", "title": "" }, { "docid": "ab0b7105f128b7f423d7a71ea3bf9822", "score": "0.58320177", "text": "func (r ApiDatacentersServersVolumesGetRequest) MaxResults(maxResults int32) ApiDatacentersServersVolumesGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "3024ccda77d44b2c59348a7364fc6558", "score": "0.58192086", "text": "func (o WebSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v WebSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "0260269959a6f3576f999509d68477f2", "score": "0.58077866", "text": "func (osd *OpenSearchDomains) MaxBatchSize() int {\n\treturn 10\n}", "title": "" }, { "docid": "800c00dfd7605bbada5778a972a0e894", "score": "0.5805002", "text": "func (o BlobSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v BlobSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "e9d2fb809768a946126f94338f6cf782", "score": "0.5804381", "text": "func (o FileSystemSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v FileSystemSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "ccf13a3d733a75586086b6c79e7636d9", "score": "0.580222", "text": "func (o JsonSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v JsonSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "944e9ea67e8de33e3fdd6cfb057359a7", "score": "0.58012944", "text": "func WithMaxEntries(n int) Option {\n\treturn func(v *Buffer) {\n\t\tv.maxEntries = n\n\t}\n}", "title": "" }, { "docid": "7e5739638075dc0eddfa98a56a12c972", "score": "0.5796944", "text": "func (o ODataSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v ODataSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "0300888226b4958d9026310d0eedf12f", "score": "0.5796215", "text": "func (o SqlMISourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlMISourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "59027adb232d8835072d082968c61377", "score": "0.57872134", "text": "func (o SqlMISinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlMISinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "402f779d124fbcc6d961906868041027", "score": "0.5778671", "text": "func (o AzureDataLakeStoreWriteSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDataLakeStoreWriteSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "cbf5a6006983f312641fbe8a2e0be83a", "score": "0.57758635", "text": "func (o *SnapmirrorReleaseIterRequest) MaxRecords() int {\n\tvar r int\n\tif o.MaxRecordsPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.MaxRecordsPtr\n\treturn r\n}", "title": "" }, { "docid": "8aafedce846a47d644f989640efdc1c2", "score": "0.57722294", "text": "func (o CosmosDbMongoDbApiSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbMongoDbApiSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "faf9d6a9ac795a77bcedde5fddb000dd", "score": "0.57672995", "text": "func (o FileServerWriteSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v FileServerWriteSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "5a858b6cb5ba7bd0d9adcddd04ed3f33", "score": "0.5759849", "text": "func (c *RegionViewsListresourcesCall) MaxResults(maxResults int64) *RegionViewsListresourcesCall {\n\tc.params_.Set(\"maxResults\", fmt.Sprintf(\"%v\", maxResults))\n\treturn c\n}", "title": "" }, { "docid": "b98eb40d483c2906ffb51dffe02fe5f2", "score": "0.5759482", "text": "func (o BlobSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v BlobSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "5ce5623ed17aeeb5c4eff1abe5c0bbd9", "score": "0.5755678", "text": "func (o *IscsiInitiatorAuthGetIterRequest) MaxRecords() int {\n\tvar r int\n\tif o.MaxRecordsPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.MaxRecordsPtr\n\treturn r\n}", "title": "" }, { "docid": "5e225aa19dbf8020192b6562cbbc7185", "score": "0.5750585", "text": "func (_options *ListResourceBindingsForAliasOptions) SetLimit(limit int64) *ListResourceBindingsForAliasOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "5dd51c7dade8a10a11110c1bd9f2306b", "score": "0.57486176", "text": "func (o AzureDataExplorerSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDataExplorerSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "0963ba9e7b45a6144356009cfff33456", "score": "0.57476556", "text": "func (o AzureDataLakeStoreSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDataLakeStoreSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "2198b83a29e90d3e2abb97b538fc7e67", "score": "0.57469344", "text": "func (o AzureDatabricksDeltaLakeSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDatabricksDeltaLakeSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "0bce9c04cbeb0b90f055df73411a9981", "score": "0.5745558", "text": "func (o SalesforceServiceCloudSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SalesforceServiceCloudSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "85b41aea6c6f4df02542ff7df853198d", "score": "0.57447904", "text": "func (o SqlServerSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlServerSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "a3fdc4227110998241f3efea34ff9287", "score": "0.5728279", "text": "func (o CosmosDbMongoDbApiSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbMongoDbApiSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "0c587150a9d55b2e5f1c559532c239ea", "score": "0.5726843", "text": "func (o CosmosDbSqlApiSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbSqlApiSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "b4a392271af96682c28fc58960567e1d", "score": "0.5725976", "text": "func Limit(amount int) RequestOption {\n\treturn func(o *requestOptions) {\n\t\to.urlParams.Set(\"limit\", strconv.Itoa(amount))\n\t}\n}", "title": "" }, { "docid": "6db14652716cf1b430319d24ed0c216d", "score": "0.5724448", "text": "func (o FileSystemSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v FileSystemSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "88e827bbdbaf6201196ccf1843ea9fb0", "score": "0.57219684", "text": "func MaxRows(maxRows int64) Option {\n\treturn MaxRowsConfig(maxRows)\n}", "title": "" }, { "docid": "a896a46ac661f4d77c4bc9ea53c0dc6e", "score": "0.5720217", "text": "func (p *Parameter) MaxItems(maxItems int64) *Parameter {\n\tp.data.MaxItems = &maxItems\n\treturn p\n}", "title": "" }, { "docid": "4b0f6678c55128e72977aed8fef75dcd", "score": "0.57189065", "text": "func (c *EntityUsageReportsGetCall) MaxResults(maxResults int64) *EntityUsageReportsGetCall {\n\tc.urlParams_.Set(\"maxResults\", fmt.Sprint(maxResults))\n\treturn c\n}", "title": "" }, { "docid": "a5dfe2c588a23c225ca629abee8a2af6", "score": "0.57148284", "text": "func TooManyRequests() *ErrorResponse {\n\treturn NewErrorResponse(\n\t\thttp.StatusTooManyRequests,\n\t\t\"TOO_MANY_REQUESTS\",\n\t\t\"The client has sent too many requests to the server.\",\n\t)\n}", "title": "" }, { "docid": "bbe58469da8a5d44103e7ce8b681a7b1", "score": "0.5712942", "text": "func SetMaxPrintRows(n int) {\n\tmaxPrintRows = n\n}", "title": "" }, { "docid": "40289e6be16a0fdffd01aca5ae3d8865", "score": "0.5712314", "text": "func (o AvroSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AvroSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "5c08f25c5d15acc4a1ed6769771e52d8", "score": "0.57102144", "text": "func (o JsonSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v JsonSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" } ]
64e16649996e9818bc99477adcdf2461
ClearedEdges returns all edge names that were cleared in this mutation.
[ { "docid": "8e1e2ffa64557ee442e6a2871f7228e0", "score": "0.0", "text": "func (m *DataRoomMutation) ClearedEdges() []string {\n\tedges := make([]string, 0, 7)\n\tif m.clearedpromotion {\n\t\tedges = append(edges, dataroom.EdgePromotion)\n\t}\n\tif m.clearedstatusroom {\n\t\tedges = append(edges, dataroom.EdgeStatusroom)\n\t}\n\tif m.clearedtyperoom {\n\t\tedges = append(edges, dataroom.EdgeTyperoom)\n\t}\n\treturn edges\n}", "title": "" } ]
[ { "docid": "b499afc71d2a91596259ed646536a66a", "score": "0.70037967", "text": "func (m *EmployeeMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedqueue != nil {\n\t\tedges = append(edges, employee.EdgeQueue)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "21c2d664cd3dc7136e3c17757b178184", "score": "0.69047046", "text": "func (m *StatusMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedcheckouts != nil {\n\t\tedges = append(edges, status.EdgeCheckouts)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "a7a3ab2730f416bf5ece4a2295948a3f", "score": "0.68976974", "text": "func (m *SettingMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "690e83b493221f1e76ccbf7d3399e1a8", "score": "0.6871963", "text": "func (m *CityMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\tif m.removedconstructions != nil {\n\t\tedges = append(edges, city.EdgeConstructions)\n\t}\n\tif m.removedqueue != nil {\n\t\tedges = append(edges, city.EdgeQueue)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "d113966086c5e0be5e2dacdc570f9a86", "score": "0.6849575", "text": "func (m *TitleMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "e9d14554d32cab04f302c79b97d6d28d", "score": "0.6842315", "text": "func (m *QccEnterpriseDataMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "396855326640e8e77abc09f60ea9adfe", "score": "0.6827508", "text": "func (m *FoodMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "6826278c05a150e0c9579383a51bc8eb", "score": "0.68258965", "text": "func (m *OAuthConnectionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "02fc23c2675e5a68d71d937e861d0833", "score": "0.6822357", "text": "func (m *CheckoutMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 4)\n\treturn edges\n}", "title": "" }, { "docid": "a3d31963bf180c71be67c19da29d7ce7", "score": "0.6805486", "text": "func (m *StockManagerMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "0b9416d8cc34809e06ba2a5ac3abf4db", "score": "0.6800833", "text": "func (m *StatusReserveMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedreserves != nil {\n\t\tedges = append(edges, statusreserve.EdgeReserves)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "aa72e0cbf0afb0d6f2f2981cb0e6d2c6", "score": "0.6797586", "text": "func (m *RoomMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedappointment != nil {\n\t\tedges = append(edges, room.EdgeAppointment)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "424ff430d6c7e5ab351bfa4ad0c0e3af", "score": "0.6795892", "text": "func (m *RentalMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\treturn edges\n}", "title": "" }, { "docid": "1ea398d093a2ab0076a9d591146598be", "score": "0.67931855", "text": "func (m *ConstructionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 5)\n\tif m.removedqueue != nil {\n\t\tedges = append(edges, construction.EdgeQueue)\n\t}\n\tif m.removedaffects != nil {\n\t\tedges = append(edges, construction.EdgeAffects)\n\t}\n\tif m.removedaffected_by != nil {\n\t\tedges = append(edges, construction.EdgeAffectedBy)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "d9ce673bc5ee6f4205402bcc515e3709", "score": "0.6786446", "text": "func (m *PatientMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedqueue != nil {\n\t\tedges = append(edges, patient.EdgeQueue)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "59fc36ad2644b6f670a0eae48f4a4c01", "score": "0.6777579", "text": "func (m *SubjectMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removed_Subject_ID != nil {\n\t\tedges = append(edges, subject.EdgeSubjectID)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "5cb4c14bd3a943ea2ec6b8ba4c546985", "score": "0.67715245", "text": "func (m *MemberMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedorders != nil {\n\t\tedges = append(edges, member.EdgeOrders)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "236e11df83e6970526004c5250a6516d", "score": "0.676734", "text": "func (m *PromotionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedreserves != nil {\n\t\tedges = append(edges, promotion.EdgeReserves)\n\t}\n\tif m.removeddatarooms != nil {\n\t\tedges = append(edges, promotion.EdgeDatarooms)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "351fde8ad0a080040777340c769ec38b", "score": "0.6764648", "text": "func (m *StatusRoomMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removeddatarooms != nil {\n\t\tedges = append(edges, statusroom.EdgeDatarooms)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "6ac70d0cac8e00d7ed6f9f9943e42562", "score": "0.6758916", "text": "func (m *DeliveryMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "fcc43f754ea7e557dbd1f89da1cd67ce", "score": "0.6755084", "text": "func (m *AddressMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "a41cb81d40704fbc9aceb57337084f2e", "score": "0.67497915", "text": "func (m *DoctorMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "0e59cab6d35e8efb268abeafa26bae55", "score": "0.6747827", "text": "func (m *MetricsMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "9bb997cde5518a19adbd49da8b315b33", "score": "0.67455935", "text": "func (m *DataRoomMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 7)\n\tif m.removedreserves != nil {\n\t\tedges = append(edges, dataroom.EdgeReserves)\n\t}\n\tif m.removedfixs != nil {\n\t\tedges = append(edges, dataroom.EdgeFixs)\n\t}\n\tif m.removeddetails != nil {\n\t\tedges = append(edges, dataroom.EdgeDetails)\n\t}\n\tif m.removedcheckins != nil {\n\t\tedges = append(edges, dataroom.EdgeCheckins)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "6b7607148bec1931eda4dbd2a536c43f", "score": "0.67452973", "text": "func (m *QuestionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedanswer != nil {\n\t\tedges = append(edges, question.EdgeAnswer)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "f9000978d5b27d3487c41c96a24acdbc", "score": "0.67447346", "text": "func (m *AppointmentMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 4)\n\treturn edges\n}", "title": "" }, { "docid": "998e56ccdb4ef449fc13139f640deff6", "score": "0.67425245", "text": "func (m *StatusOpinionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedcheckouts != nil {\n\t\tedges = append(edges, statusopinion.EdgeCheckouts)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "68ffd1cbb747f6073439a34713184925", "score": "0.67375827", "text": "func (m *ReserveRoomMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 5)\n\tif m.removedcheckins != nil {\n\t\tedges = append(edges, reserveroom.EdgeCheckins)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "c212cf94fbd7ef3cd5bced5f0b166209", "score": "0.67374295", "text": "func (m *CounterMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "7232dbd7ae6670de47b2c9467fa5185e", "score": "0.6734878", "text": "func (m *SessionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "7232dbd7ae6670de47b2c9467fa5185e", "score": "0.6734878", "text": "func (m *SessionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "d5e767b9e7572294c46314fa9845029a", "score": "0.67347103", "text": "func (m *CheckInMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 6)\n\treturn edges\n}", "title": "" }, { "docid": "89fa65d7bdb2d8f80da625113e8efbbd", "score": "0.6732615", "text": "func (m *PostMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "acc6fdb9ab16f22acc6370712d3d4fb0", "score": "0.6731225", "text": "func (m *GraphMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedmetrics != nil {\n\t\tedges = append(edges, graph.EdgeMetrics)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "53090b521d40c964cbf8cf6adfb042f0", "score": "0.6728928", "text": "func (m *GenderMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "2488c86ea4f0bb1d45fa857ed0936f47", "score": "0.67286587", "text": "func (m *StatusCheckInMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedcheckins != nil {\n\t\tedges = append(edges, statuscheckin.EdgeCheckins)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "b6364512963b75cc1316e34b957b6dcc", "score": "0.67275894", "text": "func (m *BookMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "b9e365a30637504329760fc97108b4f8", "score": "0.67176783", "text": "func (m *AdminMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "7ca83c09c891c26fa3e33621fd2414b6", "score": "0.6705782", "text": "func (m *QueueMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "7ca83c09c891c26fa3e33621fd2414b6", "score": "0.6705782", "text": "func (m *QueueMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "1707d62f5e2a2c19a3d453564e1289d1", "score": "0.6705078", "text": "func (m *InfoMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "f17fd8ac32dcf343f3bbe9e56c1f0de2", "score": "0.6703288", "text": "func (m *BookingMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "c02c212f4819403512267001f136b995", "score": "0.6692268", "text": "func (m *NodeMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\treturn edges\n}", "title": "" }, { "docid": "d9ed83489b8f14bfe9015c3941a217ec", "score": "0.6689071", "text": "func (m *CategoryMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "88f51255d00044130235d0bfeafd3651", "score": "0.66862917", "text": "func (m *PhoneMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\treturn edges\n}", "title": "" }, { "docid": "9aa36f9766496936e91e7fe4365fd7a3", "score": "0.66841334", "text": "func (m *WorkspaceMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\tif m.removedworkspace_roles != nil {\n\t\tedges = append(edges, workspace.EdgeWorkspaceRoles)\n\t}\n\tif m.removedgroups != nil {\n\t\tedges = append(edges, workspace.EdgeGroups)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "a29dc74206c45f63b0a1d7e0907a443c", "score": "0.6683974", "text": "func (m *MetricMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 4)\n\tif m.removedhistograms != nil {\n\t\tedges = append(edges, metric.EdgeHistograms)\n\t}\n\tif m.removedcounters != nil {\n\t\tedges = append(edges, metric.EdgeCounters)\n\t}\n\tif m.removedgauges != nil {\n\t\tedges = append(edges, metric.EdgeGauges)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "53d57a63fde290cef61e895a4faf8cf5", "score": "0.66767657", "text": "func (m *CounterStaffMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\tif m.removedcheckins != nil {\n\t\tedges = append(edges, counterstaff.EdgeCheckins)\n\t}\n\tif m.removedcheckouts != nil {\n\t\tedges = append(edges, counterstaff.EdgeCheckouts)\n\t}\n\tif m.removeddetails != nil {\n\t\tedges = append(edges, counterstaff.EdgeDetails)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "ab36d94a66a06ad4aaadba6ea5822b77", "score": "0.66751873", "text": "func (m *CollectionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedbooks != nil {\n\t\tedges = append(edges, collection.EdgeBooks)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "289e3854a10ec719624d9ce2e4cbf5bf", "score": "0.6673721", "text": "func (m *EmployeeMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedpatients != nil {\n\t\tedges = append(edges, employee.EdgePatients)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "4f1671fc2347c36a7ed80045499a0158", "score": "0.66704404", "text": "func (m *OrderMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "a8ab0947262162a9307ac4df3a608957", "score": "0.6657729", "text": "func (m *PatientMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 7)\n\tif m.removedmedicalfiles != nil {\n\t\tedges = append(edges, patient.EdgeMedicalfiles)\n\t}\n\tif m.removedqueue != nil {\n\t\tedges = append(edges, patient.EdgeQueue)\n\t}\n\tif m.removedappointment != nil {\n\t\tedges = append(edges, patient.EdgeAppointment)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "d0bee535adee7b096ac7b234b912fc21", "score": "0.66572964", "text": "func (m *DentistMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedqueue != nil {\n\t\tedges = append(edges, dentist.EdgeQueue)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "116d69597b720b0babc788550ce3f6c3", "score": "0.6652444", "text": "func (m *GithubEventMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "22d37029a6a9d688da50e8f123c8ba1d", "score": "0.6650279", "text": "func (m *TypeRoomMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removeddatarooms != nil {\n\t\tedges = append(edges, typeroom.EdgeDatarooms)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "c2b14e263687ca1294edf92b276977c1", "score": "0.6648395", "text": "func (m *InquiryMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 4)\n\treturn edges\n}", "title": "" }, { "docid": "ff84c3a2da9c2e8b7f981afa4317b223", "score": "0.66450953", "text": "func (m *FormMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "719a2cf708a24619b21a1336d0cc7d56", "score": "0.6639626", "text": "func (m *PostMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedlabels != nil {\n\t\tedges = append(edges, post.EdgeLabels)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "d84a4744e03400903c49fbe0cdb0ddc2", "score": "0.66380006", "text": "func (m *PaybackMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 4)\n\treturn edges\n}", "title": "" }, { "docid": "24b106db3bc85694cec708b07008ea31", "score": "0.66377836", "text": "func (m *UserMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "91d63d458d3f2d299b3d6a24f719a842", "score": "0.6637709", "text": "func (m *NurseMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 6)\n\tif m.removedqueue != nil {\n\t\tedges = append(edges, nurse.EdgeQueue)\n\t}\n\tif m.removedmedicalfiles != nil {\n\t\tedges = append(edges, nurse.EdgeMedicalfiles)\n\t}\n\tif m.removeddentalexpenses != nil {\n\t\tedges = append(edges, nurse.EdgeDentalexpenses)\n\t}\n\tif m.removedpatients != nil {\n\t\tedges = append(edges, nurse.EdgePatients)\n\t}\n\tif m.removeddentists != nil {\n\t\tedges = append(edges, nurse.EdgeDentists)\n\t}\n\tif m.removedappointment != nil {\n\t\tedges = append(edges, nurse.EdgeAppointment)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "3073abe59d6a6d27f7bf0fcb34f0ef2a", "score": "0.66342914", "text": "func (m *UserMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\tif m.removedcities != nil {\n\t\tedges = append(edges, user.EdgeCities)\n\t}\n\tif m.removedqueue != nil {\n\t\tedges = append(edges, user.EdgeQueue)\n\t}\n\tif m.removedconstructions != nil {\n\t\tedges = append(edges, user.EdgeConstructions)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "6ad882e2a95d2c9ee2eb3201762ba28f", "score": "0.66322744", "text": "func (m *DegreeMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removeddentists != nil {\n\t\tedges = append(edges, degree.EdgeDentists)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "3c19df6ec5044051b12ce91fbcf7d637", "score": "0.66238767", "text": "func (m *QueueItemMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "6a7865667743107aba48f7f102935c27", "score": "0.6623296", "text": "func (m *CardMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "6a7865667743107aba48f7f102935c27", "score": "0.6623296", "text": "func (m *CardMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "6a7865667743107aba48f7f102935c27", "score": "0.6623296", "text": "func (m *CardMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "2325d0ac6dacc02348006d8bcb2160e5", "score": "0.66231865", "text": "func (m *WorkspaceRoleMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\treturn edges\n}", "title": "" }, { "docid": "2969a20f140b08aeebcaa7aca5a9bc2d", "score": "0.661751", "text": "func (m *PermissionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "9377a80a5adc5cd52b2f8ea89ff848d0", "score": "0.6611841", "text": "func (m *GaugeMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "01321e5b0f4da1b4a94578b35947b5b6", "score": "0.66093665", "text": "func (m *MetadataMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "684f01a964eb04b9ede5ee2533d5f60f", "score": "0.66051084", "text": "func (m *AnswerMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedquestion_id != nil {\n\t\tedges = append(edges, answer.EdgeQuestionID)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "407b3daa6cc58bec3ae8f25853881c25", "score": "0.660266", "text": "func (m *GithubAssetMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "a84bffc6cd6f57c457bc28fc9ff017ef", "score": "0.6596733", "text": "func (m *FixRoomMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "0d2b16f3129996761bad6ce940c7d0cb", "score": "0.6594837", "text": "func (m *FurnitureMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removeddetails != nil {\n\t\tedges = append(edges, furniture.EdgeDetails)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "70df6300fb980bde4d794bab17aa0fe5", "score": "0.6594615", "text": "func (m *GenderMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedpatients != nil {\n\t\tedges = append(edges, gender.EdgePatients)\n\t}\n\tif m.removeddentists != nil {\n\t\tedges = append(edges, gender.EdgeDentists)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "90b4a40454c5b17f6122f362190129fc", "score": "0.65942913", "text": "func (m *CategoryMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\tif m.removedchildren != nil {\n\t\tedges = append(edges, category.EdgeChildren)\n\t}\n\tif m.removeditems != nil {\n\t\tedges = append(edges, category.EdgeItems)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "4f9828ec5f8cd20dc09637bd24e0c460", "score": "0.65914404", "text": "func (m *MedicalTypeMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedsystemequipment != nil {\n\t\tedges = append(edges, medicaltype.EdgeSystemequipment)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "ff6bbad7bb4ba72709f36dceef544aec", "score": "0.65902364", "text": "func (m *ExpertMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removeddentists != nil {\n\t\tedges = append(edges, expert.EdgeDentists)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "e9775c07f73c3c1ea507b3e5ca1510e6", "score": "0.6588264", "text": "func (m *PositionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "e9db3eba4a8e9d2865a07fb6829a9d6d", "score": "0.6579755", "text": "func (m *FurnitureTypeMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removeddetails != nil {\n\t\tedges = append(edges, furnituretype.EdgeDetails)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "c3342e2a98edfe13c838f6d5a08a3290", "score": "0.65795064", "text": "func (m *HistogramMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "3825643bc17f8f0cc45a873138744c93", "score": "0.6570835", "text": "func (m *PetMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "8cdc3b69c7230952f596582e710641b6", "score": "0.65686387", "text": "func (m *GenderMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedpatients != nil {\n\t\tedges = append(edges, gender.EdgePatients)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "7ebb6371a9216af64184d26ba4ab0a79", "score": "0.6566674", "text": "func (m *GroupMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedgraphs != nil {\n\t\tedges = append(edges, group.EdgeGraphs)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "e2799bc61f4397a0974825ff9a195d22", "score": "0.6565262", "text": "func (m *PatientMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 4)\n\treturn edges\n}", "title": "" }, { "docid": "d2c51824c67517fb0fd98f6700d02267", "score": "0.656404", "text": "func (m *StateMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedvehicle_registrations != nil {\n\t\tedges = append(edges, state.EdgeVehicleRegistrations)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "e704b58cc9c9e47749cb9649e1f2254f", "score": "0.65620285", "text": "func (m *ApplicationMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedgroups != nil {\n\t\tedges = append(edges, application.EdgeGroups)\n\t}\n\tif m.removedtags != nil {\n\t\tedges = append(edges, application.EdgeTags)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "8175a1db218973529bbfb5adf5165b9d", "score": "0.65612966", "text": "func (m *CategoryMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedcategory_inquiry != nil {\n\t\tedges = append(edges, category.EdgeCategoryInquiry)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "b08b87f9a2d2a3e283076fe5c16e66db", "score": "0.656129", "text": "func (m *RaceMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedpeople != nil {\n\t\tedges = append(edges, race.EdgePeople)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "6b57384d89537888f1ff056d17f829ce", "score": "0.6561125", "text": "func (m *OrderMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "386ba122df03ca75ed9a9500f731c591", "score": "0.6555643", "text": "func (m *OrderMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedorder_items != nil {\n\t\tedges = append(edges, order.EdgeOrderItems)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "8eba0e7daaf3b33d78e2841db2cf8459", "score": "0.6553241", "text": "func (m *LessonplanMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "1e4be125cd239d43d02be8b5cfa0f06f", "score": "0.6551753", "text": "func (m *SystemequipmentMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "8141251727b4ebab7c946fcb880e5a51", "score": "0.65501934", "text": "func (m *PricetypeMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removeddentalexpenses != nil {\n\t\tedges = append(edges, pricetype.EdgeDentalexpenses)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "f16ee55ff83103929e3c264d926de641", "score": "0.6548553", "text": "func (m *OrderMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedorderItems != nil {\n\t\tedges = append(edges, order.EdgeOrderItems)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "6e1d02484d06b75f5de2050a8ae26f76", "score": "0.654467", "text": "func (m *CustomerMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\tif m.removedreserves != nil {\n\t\tedges = append(edges, customer.EdgeReserves)\n\t}\n\tif m.removedfixs != nil {\n\t\tedges = append(edges, customer.EdgeFixs)\n\t}\n\tif m.removedcheckins != nil {\n\t\tedges = append(edges, customer.EdgeCheckins)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "a95194ede76956b4aa89cb09bec8206d", "score": "0.65443414", "text": "func (m *DentistMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 7)\n\tif m.removedmedicalfiles != nil {\n\t\tedges = append(edges, dentist.EdgeMedicalfiles)\n\t}\n\tif m.removedqueue != nil {\n\t\tedges = append(edges, dentist.EdgeQueue)\n\t}\n\tif m.removedappointment != nil {\n\t\tedges = append(edges, dentist.EdgeAppointment)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "b0eabb0fcff71517c30331e4542c840e", "score": "0.65408814", "text": "func (m *DoctorMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedprescriptions != nil {\n\t\tedges = append(edges, doctor.EdgePrescriptions)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "26c41864409bf90748a440ead45ca2ce", "score": "0.6539576", "text": "func (m *DeathCertificateMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 6)\n\treturn edges\n}", "title": "" }, { "docid": "5316d7e94dd9c1079d3b3ed24b692820", "score": "0.6539055", "text": "func (m *GroupRoleMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\treturn edges\n}", "title": "" } ]
662eb44f43c94702080780f8c9cbd720
RegisterHandlers adds each server route to the EchoRouter.
[ { "docid": "5be0520c6bff072b8277f45832696876", "score": "0.81317735", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface) {\n\tRegisterHandlersWithBaseURL(router, si, \"\")\n}", "title": "" } ]
[ { "docid": "85ee62835f16aba3400b806da2f5cd25", "score": "0.83413726", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(\"/guests/reservations\", wrapper.GuestsGetReservations)\n\trouter.POST(\"/guests/reservations\", wrapper.PostReservations)\n\trouter.GET(\"/guests/rooms\", wrapper.GuestsGetRooms)\n\trouter.GET(\"/guests/rooms/:roomId\", wrapper.GuestsGetRoom)\n\trouter.POST(\"/guests/users\", wrapper.GuestsPostUsers)\n\trouter.GET(\"/guests/users/me\", wrapper.GuestsGetMe)\n\trouter.GET(\"/hosts/reservations\", wrapper.HostsGetReservations)\n\trouter.GET(\"/hosts/rooms\", wrapper.HostsGetRooms)\n\trouter.POST(\"/hosts/rooms\", wrapper.HostsPostRooms)\n\trouter.DELETE(\"/hosts/rooms/:roomId\", wrapper.HostsDeleteRooms)\n\trouter.PUT(\"/hosts/rooms/:roomId\", wrapper.HostsPutRooms)\n\trouter.GET(\"/hosts/users/me\", wrapper.HostsGetMe)\n\n}", "title": "" }, { "docid": "e75546137fc90d43d97cdaf49458df86", "score": "0.8089905", "text": "func RegisterHandlers(router interface {\n\tCONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tDELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tGET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tHEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tOPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPOST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tTRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n}, si ServerInterface) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.POST(\"/api/medooze\", wrapper.EventHandler)\n\trouter.GET(\"/api/v1/user\", wrapper.UserIndex)\n\trouter.POST(\"/api/v1/user\", wrapper.UserStore)\n\trouter.GET(\"/api/v1/user/:userID\", wrapper.UserShow)\n\trouter.GET(\"/api/v1/webinar\", wrapper.WebinarIndex)\n\trouter.POST(\"/api/v1/webinar\", wrapper.WebinarStore)\n\trouter.DELETE(\"/api/v1/webinar/:id\", wrapper.WebinarDestroy)\n\trouter.GET(\"/api/v1/webinar/:id\", wrapper.WebinarShow)\n\trouter.GET(\"/api/v1/webinar/:webinarID/mosaic/\", wrapper.WebinarMosaicIndex)\n\trouter.POST(\"/api/v1/webinar/:webinarID/mosaic/\", wrapper.WebinarMosaicStore)\n\trouter.DELETE(\"/api/v1/webinar/:webinarID/mosaic/:mosaicID\", wrapper.WebinarMosaicDestroy)\n\trouter.GET(\"/api/v1/webinar/:webinarID/mosaic/:mosaicID\", wrapper.WebinarMosaicShow)\n\trouter.PATCH(\"/api/v1/webinar/:webinarID/mosaic/:mosaicID\", wrapper.WebinarMosaicUpdate)\n\trouter.GET(\"/api/v1/webinar/:webinarID/mosaic/:mosaicID/slot\", wrapper.WebinarMosaicSlotIndex)\n\trouter.PATCH(\"/api/v1/webinar/:webinarID/mosaic/:mosaicID/slot/:slotID\", wrapper.WebinarMosaicSlotUpdate)\n\trouter.GET(\"/api/v1/webinar/:webinarID/mosaic/:mosaicID/user\", wrapper.WebinarMosaicUserIndex)\n\trouter.POST(\"/api/v1/webinar/:webinarID/mosaic/:mosaicID/user\", wrapper.WebinarMosaicUserStore)\n\trouter.DELETE(\"/api/v1/webinar/:webinarID/mosaic/:mosaicID/user/:userID\", wrapper.WebinarMosaicUserShow)\n\trouter.GET(\"/api/v1/webinar/:webinarID/stream\", wrapper.WebinarStreamIndex)\n\trouter.POST(\"/api/v1/webinar/:webinarID/stream\", wrapper.WebinarStreamStore)\n\trouter.DELETE(\"/api/v1/webinar/:webinarID/stream/:streamID\", wrapper.WebinarStreamDestroy)\n\trouter.PATCH(\"/api/v1/webinar/:webinarID/stream/:streamID\", wrapper.WebinarStreamUpdate)\n\trouter.GET(\"/api/v1/webinar/:webinarID/user\", wrapper.WebinarUserIndex)\n\trouter.POST(\"/api/v1/webinar/:webinarID/user\", wrapper.WebinarUserStore)\n\trouter.DELETE(\"/api/v1/webinar/:webinarID/user/:userID\", wrapper.WebinarUserDestroy)\n\trouter.GET(\"/api/v1/webinar/:webinarID/user/:userID\", wrapper.WebinarUserShow)\n\trouter.PATCH(\"/api/v1/webinar/:webinarID/user/:userID\", wrapper.WebinarUserUpdate)\n\trouter.POST(\"/api/v1/webinar/:webinarID/user/:userID/mosaic\", wrapper.WebinarUserMosaicStore)\n\n}", "title": "" }, { "docid": "3081efad768ece16549a6b2bd00b3c24", "score": "0.80867565", "text": "func RegisterHandlers(router interface {\n\tCONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tDELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tGET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tHEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tOPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPOST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tTRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n}, si ServerInterface) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(\"/hello\", wrapper.Hello)\n\trouter.POST(\"/image\", wrapper.Img)\n\trouter.GET(\"/path/:name\", wrapper.HelloPath)\n\trouter.POST(\"/upload\", wrapper.Nameupload)\n\n}", "title": "" }, { "docid": "ac1096c86c0e69c28f91366f0192f28e", "score": "0.80629367", "text": "func RegisterHandlers(router interface {\n\tCONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tDELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tGET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tHEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tOPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPOST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tTRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n}, si ServerInterface, m ...echo.MiddlewareFunc) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(\"/health\", wrapper.MakeHealthCheck, m...)\n\n}", "title": "" }, { "docid": "ac1096c86c0e69c28f91366f0192f28e", "score": "0.80629367", "text": "func RegisterHandlers(router interface {\n\tCONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tDELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tGET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tHEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tOPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPOST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tTRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n}, si ServerInterface, m ...echo.MiddlewareFunc) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(\"/health\", wrapper.MakeHealthCheck, m...)\n\n}", "title": "" }, { "docid": "4c011f3bdc7fe57b05d78549dc2d67fd", "score": "0.80288494", "text": "func RegisterHandlers(router interface {\n\tCONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tDELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tGET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tHEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tOPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPOST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tTRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n}, si ServerInterface) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(\"/logo\", wrapper.LogoGet)\n\trouter.GET(\"/ping\", wrapper.PingGet)\n\trouter.POST(\"/scoreboard/command\", wrapper.ScoreboardCommandPost)\n\trouter.DELETE(\"/scoreboard/prefs\", wrapper.ScoreboardPrefsDelete)\n\trouter.GET(\"/scoreboard/prefs\", wrapper.ScoreboardPrefsGet)\n\trouter.PUT(\"/scoreboard/prefs\", wrapper.ScoreboardPrefsPut)\n\trouter.GET(\"/scoreboard/prefs/default\", wrapper.ScoreboardPrefsDefaultGet)\n\trouter.GET(\"/scoreboard/status\", wrapper.ScoreboardStatusGet)\n\trouter.PUT(\"/scoreboard/status\", wrapper.ScoreboardStatusPut)\n\trouter.POST(\"/session\", wrapper.SessionPost)\n\n}", "title": "" }, { "docid": "a9053d9e8cd9ec1670f6affb92baf4bb", "score": "0.80259174", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface, m ...echo.MiddlewareFunc) {\n\tRegisterHandlersWithBaseURL(router, si, \"\", m...)\n}", "title": "" }, { "docid": "83d30a2ac5fc0ceb5c5eeb181518494c", "score": "0.79976535", "text": "func RegisterHandlers(router interface {\n\tCONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tDELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tGET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tHEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tOPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPOST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tTRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n}, si ServerInterface) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(\"/v1/assets\", wrapper.GetAssetInfo)\n\trouter.GET(\"/v1/doc\", wrapper.GetDocs)\n\trouter.GET(\"/v1/health\", wrapper.GetHealth)\n\trouter.GET(\"/v1/network\", wrapper.GetNetworkData)\n\trouter.GET(\"/v1/nodes\", wrapper.GetNodes)\n\trouter.GET(\"/v1/pools\", wrapper.GetPools)\n\trouter.GET(\"/v1/pools/detail\", wrapper.GetPoolsData)\n\trouter.GET(\"/v1/stakers\", wrapper.GetStakersData)\n\trouter.GET(\"/v1/stakers/:address\", wrapper.GetStakersAddressData)\n\trouter.GET(\"/v1/stakers/:address/pools\", wrapper.GetStakersAddressAndAssetData)\n\trouter.GET(\"/v1/stats\", wrapper.GetStats)\n\trouter.GET(\"/v1/swagger.json\", wrapper.GetSwagger)\n\trouter.GET(\"/v1/thorchain/constants\", wrapper.GetThorchainProxiedConstants)\n\trouter.GET(\"/v1/thorchain/lastblock\", wrapper.GetThorchainProxiedLastblock)\n\trouter.GET(\"/v1/thorchain/pool_addresses\", wrapper.GetThorchainProxiedEndpoints)\n\trouter.GET(\"/v1/txs\", wrapper.GetTxDetails)\n\n}", "title": "" }, { "docid": "f9799bb93dbd97035def091020d53fa0", "score": "0.7971818", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(\"/system/export\", wrapper.ExportData1)\n\trouter.POST(\"/system/import\", wrapper.ImportData1)\n\trouter.GET(\"/system/status\", wrapper.GetStatus1)\n\n}", "title": "" }, { "docid": "20a53b472882b6a78a6b8d73ea0a3ecc", "score": "0.7938773", "text": "func RegisterHandlers(router interface {\n\tCONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tDELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tGET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tHEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tOPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPOST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tPUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n\tTRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route\n}, si ServerInterface, m ...echo.MiddlewareFunc) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(\"/v2/accounts\", wrapper.SearchForAccounts, m...)\n\trouter.GET(\"/v2/accounts/:account-id\", wrapper.LookupAccountByID, m...)\n\trouter.GET(\"/v2/accounts/:account-id/transactions\", wrapper.LookupAccountTransactions, m...)\n\trouter.GET(\"/v2/applications\", wrapper.SearchForApplications, m...)\n\trouter.GET(\"/v2/applications/:application-id\", wrapper.LookupApplicationByID, m...)\n\trouter.GET(\"/v2/assets\", wrapper.SearchForAssets, m...)\n\trouter.GET(\"/v2/assets/:asset-id\", wrapper.LookupAssetByID, m...)\n\trouter.GET(\"/v2/assets/:asset-id/balances\", wrapper.LookupAssetBalances, m...)\n\trouter.GET(\"/v2/assets/:asset-id/transactions\", wrapper.LookupAssetTransactions, m...)\n\trouter.GET(\"/v2/blocks/:round-number\", wrapper.LookupBlock, m...)\n\trouter.GET(\"/v2/transactions\", wrapper.SearchForTransactions, m...)\n\trouter.GET(\"/v2/transactions/:txid\", wrapper.LookupTransactions, m...)\n\n}", "title": "" }, { "docid": "eb18be88f6aab254f11a805028e0c0e4", "score": "0.79126394", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(\"/threads\", wrapper.GetThreads)\n\trouter.POST(\"/threads\", wrapper.PostThreads)\n\trouter.GET(\"/threads/:threadId\", wrapper.GetThreadsThreadId)\n\trouter.POST(\"/threads/:threadId/responses\", wrapper.PostThreadsThreadIdResponses)\n\n}", "title": "" }, { "docid": "492e66eac8459b3771672e4768843d01", "score": "0.78109705", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.POST(\"/auth/set-password\", wrapper.SetPassword)\n\trouter.GET(\"/auth/token\", wrapper.Token)\n\n}", "title": "" }, { "docid": "698ac050dc132234ac6012d9c448d234", "score": "0.75824213", "text": "func (h *handler) RegisterRouteHandlers(v1 *echo.Echo) {\n\n\t// API Health check\n\tv1.GET(\"/health\", h.health)\n\n\t// Test Workflow endpoints\n\tv1.GET(\"/workflow-a\", h.testWorkerA)\n\tv1.GET(\"/workflow-b\", h.testWorkerB)\n}", "title": "" }, { "docid": "e2b67879cd8846f23124a5d48e6435e5", "score": "0.7546308", "text": "func (h handler) RegisterHandlers(router *mux.Router) {\n\trouter.HandleFunc(\"/\", h.helloWorld)\n}", "title": "" }, { "docid": "4e4aef5761e422d18d687b580b6ea753", "score": "0.75138915", "text": "func RegisterHandlers(cliCtx client.Context, r *mux.Router) {\n\tregisterQueryRoutes(cliCtx, r)\n\tregisterTxRoutes(cliCtx, r)\n}", "title": "" }, { "docid": "3f5e54898d4d5c629aeada905d63fbb7", "score": "0.74520606", "text": "func (s *Server) RegisterHandlers(_ *runtime.ServeMux, _ *grpc.ClientConn) {}", "title": "" }, { "docid": "88a23af31c5b62e02d7afddc41cc105f", "score": "0.7398675", "text": "func RegisterHandlers(r chi.Router, grpc *grpc.Server, db *sql.DB, omdbapi *omdbapi.OmdbApi) {\n\tr.Mount(\"/omdb\", RegisterHTTPHandlers(NewImdbHTTP(grpc, db, omdbapi)))\n}", "title": "" }, { "docid": "e381779692295aded035c7b29577f2d0", "score": "0.71526974", "text": "func (s *HTTPServer) registerHandlers() {\n\t// TODO: Check with team is promethous metrics is required\n\n\t// Request w.r.t to backup is handled here\n\ts.mux.HandleFunc(\"/latest/backups/\", s.wrap(s.backupV1alpha1SpecificRequest))\n\n\t// Request w.r.t to restore is handled here\n\ts.mux.HandleFunc(\"/latest/restore/\", s.wrap(s.restoreV1alpha1SpecificRequest))\n}", "title": "" }, { "docid": "f079a769e2afafbe972d6ada6fe1d902", "score": "0.7127497", "text": "func (gs *GatewayServer) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn) {\n\tttnpb.RegisterGsHandler(gs.Context(), s, conn)\n\tttnpb.RegisterGtwGsHandler(gs.Context(), s, conn)\n}", "title": "" }, { "docid": "1759bc23a8cf60d177fb1beb55c885d5", "score": "0.705452", "text": "func RegisterHandlers(events event.Events) error {\n\tfor _, e := range events {\n\n\t\trtr.Handle(e.Type, e.Route, e.Handler)\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1046af74fa03b0a61509108513ffc3d9", "score": "0.698851", "text": "func RegisterHandlers(r *router.Router) {\n\tr.GET(\"/request\", func(ctx *fasthttp.RequestCtx) { ctx.Write(HandleRequest()) })\n\tr.GET(\"/admin/request\", func(ctx *fasthttp.RequestCtx) { ctx.Write(HandleAdminRequest()) })\n\n\t// pprof request handler\n\tr.GET(\"/debug/pprof/profile\", handleProfilerRequest)\n}", "title": "" }, { "docid": "fa147b248248a1c61014fddd02506c1b", "score": "0.6960076", "text": "func (a *Agent) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn) {\n}", "title": "" }, { "docid": "8410d0085c502657820a3701f1d5aee3", "score": "0.6935357", "text": "func RegisterHandlers(mux *http.ServeMux, cfg config.Config, publish chan queue.Message) {\n\tlog.Println(\"Registering handlers\")\n\tprefix := \"/webhooks\"\n\tpaths := map[string]Handler{\n\t\tprefix + \"/membership\": &MembershipHandler{publish},\n\t\tprefix + \"/user-preferences\": &PreferenceHandler{publish},\n\t\tprefix + \"/marketing\": &MarketingHandler{publish},\n\t}\n\tfor p, h := range paths {\n\t\tmux.Handle(p, authMiddleware(h.HandlePOST, cfg.APIKey))\n\t}\n}", "title": "" }, { "docid": "925f6fce0f177c060ba8c1ef971c538d", "score": "0.68663704", "text": "func (js *JoinServer) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn) {\n\tttnpb.RegisterJsEndDeviceRegistryHandler(js.Context(), s, conn)\n}", "title": "" }, { "docid": "645279b7964d79f5f032f9ce4bbbb88f", "score": "0.68547285", "text": "func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(baseURL+\"/todos\", wrapper.GetTodos)\n\trouter.POST(baseURL+\"/todos\", wrapper.CreateTodo)\n\trouter.DELETE(baseURL+\"/todos/:todoId\", wrapper.DeleteTodo)\n\trouter.GET(baseURL+\"/todos/:todoId\", wrapper.GetTodo)\n\trouter.PUT(baseURL+\"/todos/:todoId\", wrapper.UpdateTodo)\n\n}", "title": "" }, { "docid": "5604b30fa9ade4668920b51190e201c0", "score": "0.68284243", "text": "func (srv *Server) RegisterRoutes(ctrl *controller.Controller) {\n\tsrv.router.HandleFunc(sendEthRoute, ctrl.SendEth).Methods(\"GET\")\n\tsrv.router.HandleFunc(getLastRoute, ctrl.GetLast).Methods(\"GET\")\n}", "title": "" }, { "docid": "d4479336160eaa84dda34d37cd463c41", "score": "0.6822978", "text": "func (is *IdentityServer) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn) {\n\tttnpb.RegisterIsHandler(is.Context(), s, conn)\n\tttnpb.RegisterEntityAccessHandler(is.Context(), s, conn)\n\tttnpb.RegisterApplicationRegistryHandler(is.Context(), s, conn)\n\tttnpb.RegisterApplicationAccessHandler(is.Context(), s, conn)\n\tttnpb.RegisterClientRegistryHandler(is.Context(), s, conn)\n\tttnpb.RegisterClientAccessHandler(is.Context(), s, conn)\n\tttnpb.RegisterEndDeviceRegistryHandler(is.Context(), s, conn)\n\tttnpb.RegisterGatewayRegistryHandler(is.Context(), s, conn)\n\tttnpb.RegisterGatewayAccessHandler(is.Context(), s, conn)\n\tttnpb.RegisterGatewayBatchRegistryHandler(is.Context(), s, conn) // nolint:errcheck\n\tttnpb.RegisterGatewayBatchAccessHandler(is.Context(), s, conn) // nolint:errcheck\n\tttnpb.RegisterOrganizationRegistryHandler(is.Context(), s, conn)\n\tttnpb.RegisterOrganizationAccessHandler(is.Context(), s, conn)\n\tttnpb.RegisterUserRegistryHandler(is.Context(), s, conn)\n\tttnpb.RegisterUserAccessHandler(is.Context(), s, conn)\n\tttnpb.RegisterUserSessionRegistryHandler(is.Context(), s, conn)\n\tttnpb.RegisterUserInvitationRegistryHandler(is.Context(), s, conn)\n\tttnpb.RegisterEntityRegistrySearchHandler(is.Context(), s, conn)\n\tttnpb.RegisterEndDeviceRegistrySearchHandler(is.Context(), s, conn)\n\tttnpb.RegisterOAuthAuthorizationRegistryHandler(is.Context(), s, conn)\n\tttnpb.RegisterContactInfoRegistryHandler(is.Context(), s, conn)\n\tttnpb.RegisterNotificationServiceHandler(is.Context(), s, conn)\n\tttnpb.RegisterEndDeviceBatchRegistryHandler(is.Context(), s, conn) // nolint:errcheck\n}", "title": "" }, { "docid": "6d8bcc82815fa41fb155c68037bcf16f", "score": "0.6794056", "text": "func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(baseURL+\"/contentObject/:param\", wrapper.GetContentObject)\n\trouter.GET(baseURL+\"/cookie\", wrapper.GetCookie)\n\trouter.GET(baseURL+\"/enums\", wrapper.EnumParams)\n\trouter.GET(baseURL+\"/header\", wrapper.GetHeader)\n\trouter.GET(baseURL+\"/labelExplodeArray/:param\", wrapper.GetLabelExplodeArray)\n\trouter.GET(baseURL+\"/labelExplodeObject/:param\", wrapper.GetLabelExplodeObject)\n\trouter.GET(baseURL+\"/labelNoExplodeArray/:param\", wrapper.GetLabelNoExplodeArray)\n\trouter.GET(baseURL+\"/labelNoExplodeObject/:param\", wrapper.GetLabelNoExplodeObject)\n\trouter.GET(baseURL+\"/matrixExplodeArray/:id\", wrapper.GetMatrixExplodeArray)\n\trouter.GET(baseURL+\"/matrixExplodeObject/:id\", wrapper.GetMatrixExplodeObject)\n\trouter.GET(baseURL+\"/matrixNoExplodeArray/:id\", wrapper.GetMatrixNoExplodeArray)\n\trouter.GET(baseURL+\"/matrixNoExplodeObject/:id\", wrapper.GetMatrixNoExplodeObject)\n\trouter.GET(baseURL+\"/passThrough/:param\", wrapper.GetPassThrough)\n\trouter.GET(baseURL+\"/queryDeepObject\", wrapper.GetDeepObject)\n\trouter.GET(baseURL+\"/queryForm\", wrapper.GetQueryForm)\n\trouter.GET(baseURL+\"/simpleExplodeArray/:param\", wrapper.GetSimpleExplodeArray)\n\trouter.GET(baseURL+\"/simpleExplodeObject/:param\", wrapper.GetSimpleExplodeObject)\n\trouter.GET(baseURL+\"/simpleNoExplodeArray/:param\", wrapper.GetSimpleNoExplodeArray)\n\trouter.GET(baseURL+\"/simpleNoExplodeObject/:param\", wrapper.GetSimpleNoExplodeObject)\n\trouter.GET(baseURL+\"/simplePrimitive/:param\", wrapper.GetSimplePrimitive)\n\trouter.GET(baseURL+\"/startingWithNumber/:1param\", wrapper.GetStartingWithNumber)\n\n}", "title": "" }, { "docid": "ea2cb59446c86116c970104e22c6c55c", "score": "0.66892326", "text": "func registerRoutes(ds *DataServer) http.Handler {\n\tr := chi.NewRouter()\n\tr.Route(\"/websocket\", func(r chi.Router) {\n\t\tr.Get(\"/\", ds.websocket)\n\t})\n\treturn r\n}", "title": "" }, { "docid": "296dc0cd540e59e8e2e5cabe990c55f3", "score": "0.66682947", "text": "func (s *Server) RegisterRoutes(r *httptreemux.TreeMux) {\n\n\tr.OptionsHandler = corsHandler\n\n\tr.GET(\"/sheets\", s.SheetInfoHandler)\n\tlog.Infof(\"registering: GET /sheets\")\n\tgroup := r.NewGroup(GenPath(\"sheets\", ParamsKeySheetname))\n\tlog.Infof(\"registering: GET /sheets/:sheetname/info/:lng/:lat\")\n\tgroup.GET(GenPath(\"info\", ParamsKeyLng, ParamsKeyLat), s.GridInfoHandler)\n\tlog.Infof(\"registering: GET /sheets/:sheetname/info/:mdgid\")\n\tgroup.GET(GenPath(\"info\", \"mdgid\", ParamsKeyMDGID), s.GridInfoHandler)\n\tif s.Queue != nil {\n\t\tlog.Infof(\"registering: POST /sheets/:sheetname/mdgid\")\n\t\tgroup.POST(\"/mdgid\", s.QueueHandler)\n\t}\n}", "title": "" }, { "docid": "d3777c82d7421e289c2907dc5031b77d", "score": "0.6662798", "text": "func registerHandlers(r *mux.Router, s *Service) {\n\t// static files\n\tsfs := http.StripPrefix(staticFilePath, http.FileServer(http.Dir(srcutil.Path(staticDirectory))))\n\tr.PathPrefix(staticFilePath).Handler(sfs)\n\n\t// oidc login flow endpoints\n\tr.HandleFunc(loginPath, auth.MustWithAuth(s.Login, s.checker, auth.RequireNone)).Methods(http.MethodGet)\n\tr.HandleFunc(finishLoginPath, auth.MustWithAuth(s.FinishLogin, s.checker, auth.RequireNone)).Methods(http.MethodGet)\n\tr.HandleFunc(acceptInformationReleasePath, auth.MustWithAuth(s.AcceptInformationRelease, s.checker, auth.RequireNone)).Methods(http.MethodPost)\n\tr.HandleFunc(rejectInformationReleasePath, auth.MustWithAuth(s.RejectInformationRelease, s.checker, auth.RequireNone)).Methods(http.MethodPost)\n\tr.HandleFunc(acceptLoginPath, auth.MustWithAuth(s.AcceptLogin, s.checker, auth.RequireNone)).Methods(http.MethodGet)\n\n\t// hydra related oidc endpoints\n\tr.HandleFunc(hydraLoginPath, auth.MustWithAuth(s.HydraLogin, s.checker, auth.RequireNone)).Methods(http.MethodGet)\n\tr.HandleFunc(hydraConsentPath, auth.MustWithAuth(s.HydraConsent, s.checker, auth.RequireNone)).Methods(http.MethodGet)\n\n\t// CLI login endpoints\n\tcliAuthURL := urlPathJoin(s.getDomainURL(), cliAuthPath)\n\thydraAuthURL := urlPathJoin(s.hydraPublicURL, oauthAuthPath)\n\thydraTokenURL := urlPathJoin(s.hydraPublicURL, oauthTokenPath)\n\tcliAcceptURL := urlPathJoin(s.getDomainURL(), cliAcceptPath)\n\tr.HandleFunc(cliRegisterPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), cli.RegisterFactory(s.GetStore(), cliRegisterPath, s.encryption, cliAuthURL, s.hydraPublicURL, hydraAuthURL, hydraTokenURL, cliAcceptURL, http.DefaultClient)), s.checker, auth.RequireClientIDAndSecret))\n\tr.HandleFunc(cliAuthPath, auth.MustWithAuth(cli.NewAuthHandler(s.GetStore()).Handle, s.checker, auth.RequireNone)).Methods(http.MethodGet)\n\tr.HandleFunc(cliAcceptPath, auth.MustWithAuth(s.cliAcceptHandler.Handle, s.checker, auth.RequireNone)).Methods(http.MethodGet)\n\n\t// info endpoints\n\tr.HandleFunc(infoPath, auth.MustWithAuth(s.Status, s.checker, auth.RequireNone)).Methods(http.MethodGet)\n\tr.HandleFunc(jwksPath, auth.MustWithAuth(s.JWKS, s.checker, auth.RequireNone)).Methods(http.MethodGet)\n\n\t// administration endpoints\n\tr.HandleFunc(realmPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.realmFactory()), s.checker, auth.RequireAdminTokenClientCredential))\n\tr.HandleFunc(configPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.configFactory()), s.checker, auth.RequireAdminTokenClientCredential))\n\tr.HandleFunc(configIdentityProvidersPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.configIdpFactory()), s.checker, auth.RequireAdminTokenClientCredential))\n\tr.HandleFunc(configClientsPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.configClientFactory()), s.checker, auth.RequireAdminTokenClientCredential))\n\tr.HandleFunc(configOptionsPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.configOptionsFactory()), s.checker, auth.RequireAdminTokenClientCredential))\n\tr.HandleFunc(configResetPath, auth.MustWithAuth(s.ConfigReset, s.checker, auth.RequireAdminTokenClientCredential)).Methods(http.MethodGet)\n\tr.HandleFunc(configHistoryPath, auth.MustWithAuth(s.ConfigHistory, s.checker, auth.RequireAdminTokenClientCredential)).Methods(http.MethodGet)\n\tr.HandleFunc(configHistoryRevisionPath, auth.MustWithAuth(s.ConfigHistoryRevision, s.checker, auth.RequireAdminTokenClientCredential)).Methods(http.MethodGet)\n\n\t// light-weight admin functions using client_id, client_secret and client scope to limit use\n\tr.HandleFunc(syncClientsPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.syncClientsFactory()), s.checker, auth.RequireClientIDAndSecret))\n\n\t// readonly config endpoints\n\tr.HandleFunc(identityProvidersPath, auth.MustWithAuth(s.IdentityProviders, s.checker, auth.RequireClientIDAndSecret)).Methods(http.MethodGet)\n\tr.HandleFunc(localeMetadataPath, auth.MustWithAuth(s.LocaleMetadata, s.checker, auth.RequireClientIDAndSecret)).Methods(http.MethodGet)\n\tr.HandleFunc(translatorsPath, auth.MustWithAuth(s.PassportTranslators, s.checker, auth.RequireClientIDAndSecret)).Methods(http.MethodGet)\n\tr.HandleFunc(clientPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.clientFactory()), s.checker, auth.RequireClientIDAndSecret))\n\n\t// scim service endpoints\n\tr.HandleFunc(scimGroupPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), scim.GroupFactory(s.GetStore(), scimGroupPath)), s.checker, auth.RequireAdminTokenClientCredential))\n\tr.HandleFunc(scimGroupsPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), scim.GroupsFactory(s.GetStore(), scimGroupsPath)), s.checker, auth.RequireAdminTokenClientCredential))\n\tr.HandleFunc(scimMePath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), scim.MeFactory(s.GetStore(), s.getDomainURL(), scimMePath)), s.checker, auth.RequireAccountAdminUserTokenCredential))\n\tr.HandleFunc(scimUserPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), scim.UserFactory(s.GetStore(), s.getDomainURL(), scimUserPath)), s.checker, auth.RequireAccountAdminUserTokenCredential))\n\tr.HandleFunc(scimUsersPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), scim.UsersFactory(s.GetStore(), s.getDomainURL(), scimUsersPath)), s.checker, auth.RequireAdminTokenClientCredential))\n\n\t// token service endpoints\n\tr.HandleFunc(tokensPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.store, tokensapi.ListTokensFactory(tokensPath, s.tokenProviders, s.store)), s.checker, auth.RequireUserTokenClientCredential)).Methods(http.MethodGet)\n\tr.HandleFunc(tokenPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.store, tokensapi.DeleteTokenFactory(tokenPath, s.tokenProviders, s.store)), s.checker, auth.RequireUserTokenClientCredential)).Methods(http.MethodDelete)\n\n\t// consents service endpoints\n\tconsentService := s.consentService()\n\tr.HandleFunc(listConsentPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), consentsapi.ListConsentsFactory(consentService, listConsentPath)), s.checker, auth.RequireUserTokenClientCredential)).Methods(http.MethodGet)\n\tr.HandleFunc(deleteConsentPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), consentsapi.DeleteConsentFactory(consentService, deleteConsentPath, true)), s.checker, auth.RequireUserTokenClientCredential)).Methods(http.MethodDelete)\n\n\t// audit logs endpoints\n\tr.HandleFunc(auditlogsPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.store, auditlogsapi.ListAuditlogsPathFactory(auditlogsPath, s.auditlogs)), s.checker, auth.RequireUserTokenClientCredential)).Methods(http.MethodGet)\n\n\t// legacy endpoints\n\tr.HandleFunc(adminClaimsPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.adminClaimsFactory()), s.checker, auth.RequireAdminTokenClientCredential))\n\tr.HandleFunc(adminTokenMetadataPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.adminTokenMetadataFactory()), s.checker, auth.RequireAdminTokenClientCredential))\n\n\t// proxy hydra oauth token endpoint\n\tif s.hydraPublicURLProxy != nil {\n\t\tr.HandleFunc(oauthTokenPath, s.hydraPublicURLProxy.HydraOAuthToken).Methods(http.MethodPost)\n\t}\n}", "title": "" }, { "docid": "4a2ee2b9e6fc727c02ddf3ab0090f456", "score": "0.6631018", "text": "func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(baseURL+\"/api/v1/crawl_requests\", wrapper.IndexCrawlRequests)\n\trouter.POST(baseURL+\"/api/v1/crawl_requests\", wrapper.CreateCrawlRequest)\n\trouter.GET(baseURL+\"/api/v1/crawl_requests/:uuid\", wrapper.GetApiV1CrawlRequestsUuid)\n\trouter.GET(baseURL+\"/api/v1/crawls\", wrapper.GetApiV1Crawls)\n\trouter.GET(baseURL+\"/api/v1/crawls/:uuid\", wrapper.GetApiV1CrawlsUuid)\n\trouter.GET(baseURL+\"/api/v1/health\", wrapper.GetApiV1Health)\n\n}", "title": "" }, { "docid": "5a9c11c3d8f6960b1c7c4b235b94cf21", "score": "0.6630252", "text": "func RegisterRoutes() {\n\thttp.Handle(\"/\", h(RootHandler))\n\thttp.Handle(\"/vote\", h(VoteHandler))\n\thttp.Handle(\"/results\", h(ResultsHandler))\n\thttp.Handle(\"/version\", h(VersionHandler))\n\thttp.Handle(\"/cleartable\", h(ClearHandler))\n}", "title": "" }, { "docid": "07b5ea4c57242fbcc6871678e0d023c4", "score": "0.66221786", "text": "func (w *Backend) regHandlers() *http.ServeMux {\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/ws-server\",\n\t\tfunc(rw http.ResponseWriter, req *http.Request) {\n\t\t\tlog.Println(\"connected to ws-server\")\n\t\t\ts := websocket.Server{\n\t\t\t\tHandler: websocket.Handler(func(ws *websocket.Conn) {\n\t\t\t\t\tjsonrpc.ServeConn(ws)\n\t\t\t\t\tlog.Println(\"ws-server was disconnected\")\n\t\t\t\t}),\n\t\t\t}\n\t\t\ts.ServeHTTP(rw, req)\n\t\t})\n\tmux.HandleFunc(\"/ws-client\",\n\t\tfunc(rw http.ResponseWriter, req *http.Request) {\n\t\t\tlog.Println(\"connected to ws-client\")\n\t\t\ts := websocket.Server{\n\t\t\t\tHandler: websocket.Handler(func(ws *websocket.Conn) {\n\t\t\t\t\tw.client = jsonrpc.NewClient(ws)\n\t\t\t\t\t<-w.closeClient //wait for Close()\n\t\t\t\t}),\n\t\t\t}\n\t\t\ts.ServeHTTP(rw, req)\n\t\t})\n\tmux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.ServeFile(w, r, r.URL.Path[1:])\n\t})\n\treturn mux\n}", "title": "" }, { "docid": "61775a8762347944ed21d3f265c57e21", "score": "0.6612446", "text": "func (s *Server) registerRoutes() {\n\ts.router.HandleFunc(\"/logs\", authenticationMiddleware(s.config.JwtSecret, s.handlerLogCreate)).Methods(\"POST\")\n\ts.router.HandleFunc(\"/logs\", authenticationMiddleware(s.config.JwtSecret, s.handlerLogsList)).Methods(\"GET\")\n}", "title": "" }, { "docid": "803540265bb86e92eff57c4472834ca6", "score": "0.6567512", "text": "func RegisterHandlers(r *routing.Router, version string) {\n r.To(\"GET,HEAD\", \"/healthcheck\", healthcheck(version))\n}", "title": "" }, { "docid": "79e4eef0118f755cbc1db6ad286f039a", "score": "0.6557871", "text": "func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, storeName string) {\n\tr.HandleFunc(fmt.Sprintf(\"/%s/egress/{%s}\", storeName, peerName), getEgressHandler(cliCtx, storeName)).Methods(\"GET\")\n\tr.HandleFunc(fmt.Sprintf(\"/%s/mailbox/{%s}\", storeName, peerName), getMailboxHandler(cliCtx, storeName)).Methods(\"GET\")\n\tr.HandleFunc(fmt.Sprintf(\"/%s/mailbox\", storeName), deliverMailboxHandler(cliCtx)).Methods(\"POST\")\n\tr.HandleFunc(fmt.Sprintf(\"/%s/storage/{%s}\", storeName, pathName), getStorageHandler(cliCtx, storeName)).Methods(\"GET\")\n\tr.HandleFunc(fmt.Sprintf(\"/%s/keys/{%s}\", storeName, keysName), getKeysHandler(cliCtx, storeName)).Methods(\"GET\")\n\tr.HandleFunc(fmt.Sprintf(\"/%s/keys\", storeName), getKeysHandler(cliCtx, storeName)).Methods(\"GET\")\n}", "title": "" }, { "docid": "e4c00054a0ad6bba767100ff13e05285", "score": "0.65455943", "text": "func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(baseURL+\"/product\", wrapper.GetAllProducts)\n\trouter.POST(baseURL+\"/product\", wrapper.CreateProduct)\n\trouter.GET(baseURL+\"/product/:productId\", wrapper.GetProductById)\n\n}", "title": "" }, { "docid": "bea044c5ba286bf604cb4ae3adab8fc4", "score": "0.6536907", "text": "func RegisterHandlers(clientCtx client.Context, rtr *mux.Router) {\n\tr := rest.WithHTTPDeprecationHeaders(rtr)\n\tr.HandleFunc(\"/supply/total\", TotalSupplyHandlerFn(clientCtx)).Methods(\"GET\")\n\tr.HandleFunc(\"/supply/liquid\", LiquidSupplyHandlerFn(clientCtx)).Methods(\"GET\")\n}", "title": "" }, { "docid": "72451e8200946ab439ca9d92d75f950a", "score": "0.65055555", "text": "func RegisterHandlers(r *gin.Engine, revision string) {\n\tr.GET(\"/ping\", healthcheck(revision))\n}", "title": "" }, { "docid": "15e4f7a580663a2ac80b17385d9d7f4a", "score": "0.64943576", "text": "func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string, m ...echo.MiddlewareFunc) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.POST(baseURL+\"/with_both_bodies\", wrapper.PostBoth, m...)\n\trouter.GET(baseURL+\"/with_both_responses\", wrapper.GetBoth, m...)\n\trouter.POST(baseURL+\"/with_json_body\", wrapper.PostJson, m...)\n\trouter.GET(baseURL+\"/with_json_response\", wrapper.GetJson, m...)\n\trouter.POST(baseURL+\"/with_other_body\", wrapper.PostOther, m...)\n\trouter.GET(baseURL+\"/with_other_response\", wrapper.GetOther, m...)\n\trouter.GET(baseURL+\"/with_trailing_slash/\", wrapper.GetJsonWithTrailingSlash, m...)\n\n}", "title": "" }, { "docid": "d0b6c7bb099223fd2e4841fbbb582c81", "score": "0.648743", "text": "func RegisterRoutes() {\n\thttp.Handle(\"/\", h(RootHandler))\n\thttp.Handle(\"/hello\", h(HelloHandler))\n\thttp.Handle(\"/goodbye\", h(GoodbyeHandler))\n}", "title": "" }, { "docid": "40788075ae54b60911bf78a5b1630d6b", "score": "0.6445789", "text": "func RegisterRoutes(clientCtx client.Context, r *mux.Router) {\n}", "title": "" }, { "docid": "aba8747ed0b1b61a011f2b22bf70466f", "score": "0.6442695", "text": "func RegisterHandlers(mux *http.ServeMux) {\n\tmux.HandleFunc(\"/wbt\", wideBulletHandler)\n\n\tstatsGo.PrettyPrintEnabled()\n\tmux.HandleFunc(\"/stat/go\", statsGo.Handler)\n}", "title": "" }, { "docid": "31fb498a353b8dcd0b0f161737205d65", "score": "0.64392", "text": "func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.POST(baseURL+\"/\", wrapper.Post)\n\n}", "title": "" }, { "docid": "b585c91ce1f1e9c60080dd13f58d806c", "score": "0.64271903", "text": "func (service *Service) addHandlers(router *mux.Router) {\n\trouter.HandleFunc(service.config.RequestRoot, service.rootHandler)\n\n\trouter.HandleFunc(makeRequestPath(service.config.RequestRoot, \"/datasets\"), service.listDatasetsHandler).Methods(\"GET\")\n}", "title": "" }, { "docid": "a12a2aea22bb5362d9995b47b4a9d6ef", "score": "0.64131826", "text": "func RegisterHandlers(router *gin.Engine) {\n\tp := ginprometheus.NewPrometheus(\"gin\")\n\tp.Use(router)\n}", "title": "" }, { "docid": "530e9e31d2565640ef45e45ed5f0d1b1", "score": "0.64115876", "text": "func (l *listener) RegisterHandlers(handlers ...interface{}) error {\n\tfor _, h := range handlers {\n\t\tt, err := l.RegisterMuxHandler(h)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tzeroVal := reflect.New(t).Elem().Interface()\n\t\terr = l.RegisterType(zeroVal)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d0ddcefc75be96ea99a239f27b179ae0", "score": "0.6409484", "text": "func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(baseURL+\"/api/v1/dm.json\", wrapper.GetDocJSON)\n\trouter.GET(baseURL+\"/api/v1/docs\", wrapper.GetDocHTML)\n\trouter.GET(baseURL+\"/api/v1/sources\", wrapper.DMAPIGetSourceList)\n\trouter.POST(baseURL+\"/api/v1/sources\", wrapper.DMAPICreateSource)\n\trouter.DELETE(baseURL+\"/api/v1/sources/:source-name\", wrapper.DMAPIDeleteSource)\n\trouter.PATCH(baseURL+\"/api/v1/sources/:source-name/start-relay\", wrapper.DMAPIStartRelay)\n\trouter.GET(baseURL+\"/api/v1/sources/:source-name/status\", wrapper.DMAPIGetSourceStatus)\n\trouter.PATCH(baseURL+\"/api/v1/sources/:source-name/stop-relay\", wrapper.DMAPIStopRelay)\n\trouter.GET(baseURL+\"/api/v1/tasks\", wrapper.DMAPIGetTaskList)\n\trouter.POST(baseURL+\"/api/v1/tasks\", wrapper.DMAPIStartTask)\n\trouter.DELETE(baseURL+\"/api/v1/tasks/:task-name\", wrapper.DMAPIDeleteTask)\n\trouter.GET(baseURL+\"/api/v1/tasks/:task-name/status\", wrapper.DMAPIGetTaskStatus)\n}", "title": "" }, { "docid": "2fbcc625f85b1a39ca34c231491df48a", "score": "0.6409149", "text": "func registerHandlers() {\n\tdisabled := make(map[string]bool)\n\tif conf.Disable != \"\" {\n\t\tfor _, endpoint := range strings.Split(conf.Disable, \",\") {\n\t\t\tdisabled[endpoint] = true\n\t\t}\n\t}\n\n\tfor path, getHandler := range endpoints {\n\t\tlog.Debugf(\"getHandler for %s\", path)\n\n\t\tif _, ok := disabled[path]; ok {\n\t\t\tlog.Infof(\"endpoint '%s' is explicitly disabled\", path)\n\t\t} else if handler, err := getHandler(); err != nil {\n\t\t\tlog.Warningf(\"endpoint '%s' is disabled: %v\", path, err)\n\t\t} else {\n\t\t\tif path, handler, err = wrapHandler(path, handler, err); err != nil {\n\t\t\t\tlog.Warningf(\"endpoint '%s' is disabled by wrapper: %v\", path, err)\n\t\t\t} else {\n\t\t\t\tlog.Infof(\"endpoint '%s' is enabled\", path)\n\t\t\t\thttp.Handle(path, handler)\n\t\t\t}\n\t\t}\n\t}\n\tlog.Info(\"Handler set up complete.\")\n}", "title": "" }, { "docid": "a5d1eaa536e0411a41bad5e649fc38c8", "score": "0.64069444", "text": "func (e *Environment) InstallHandlers(r *router.Router) {\n\te.InstallHandlersWithMiddleware(r, e.Base())\n}", "title": "" }, { "docid": "13c37ced708bb7ad7f0310d07b8deb28", "score": "0.6401415", "text": "func (r ServerRouter) SetRoutes(mux *http.ServeMux) {\n\tmux.HandleFunc(\"/healthz\", func(w http.ResponseWriter, _ *http.Request) {})\n\tmux.HandleFunc(\"/sessions/\", serverSessionsHandler(r.Logic))\n}", "title": "" }, { "docid": "193c70434705295f2375e65c9adb2f46", "score": "0.63984174", "text": "func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(baseURL+\"/nothing\", wrapper.GetNothing)\n\n}", "title": "" }, { "docid": "4cd5ce7355d38431005dd00224ce6d9f", "score": "0.63949883", "text": "func (srv *Server) RegisterRoutes() {\n\tsrv.Router.Handle(srv.config.Server.Endpoint, srv.FeaturesHandler()).Methods(\"GET\")\n}", "title": "" }, { "docid": "4ec35db39d29303d727a8da62b2c78d9", "score": "0.63945955", "text": "func registerHandlers(service handleFuncer, tab []apiDesc) {\n\tws := newApiWiring(basePath, tab)\n\tmaps := ws.GetMaps()\n\tfor path, vmap := range maps {\n\t\taddPath(service, path, vmap)\n\t}\n}", "title": "" }, { "docid": "d126294c45eab0ceddba5c0064a91111", "score": "0.6392306", "text": "func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(baseURL+\"/oidc/authorize\", wrapper.GetOidcAuthorize)\n\trouter.POST(baseURL+\"/oidc/par\", wrapper.PostOidcPar)\n\trouter.POST(baseURL+\"/oidc/token\", wrapper.PostOidcToken)\n\n}", "title": "" }, { "docid": "adc3a7ce9dc778b2444d1c7a6fb0f015", "score": "0.63911116", "text": "func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, storeName string) {\n\t// Health Check Endpoint\n\tr.HandleFunc(\n\t\tfmt.Sprintf(\"/%s/ping\", storeName),\n\t\tpingHandler(cliCtx, storeName),\n\t).Methods(http.MethodGet, http.MethodOptions)\n\n\t// limit api calls\n\t// limit it to 60 per minute\n\tlmt := tollbooth.NewLimiter(60, &limiter.ExpirableOptions{DefaultExpirationTTL: time.Hour})\n\tlmt.SetMessage(\"You have reached maximum request limit.\")\n\n\t// Dynamically create endpoints of all funcs in querier.go\n\tfor _, q := range query.Queries {\n\t\tendpoint := q.Endpoint(storeName, restURLParam, restURLParam2)\n\t\tif endpoint != \"\" { // don't setup REST endpoint if THORNode have no endpoint\n\t\t\tr.Handle(\n\t\t\t\tendpoint,\n\t\t\t\ttollbooth.LimitFuncHandler(\n\t\t\t\t\tlmt,\n\t\t\t\t\tgetHandlerWrapper(q, storeName, cliCtx),\n\t\t\t\t),\n\t\t\t).Methods(http.MethodGet, http.MethodOptions)\n\t\t}\n\t}\n\n\t// Get unsigned json for emitting a transaction. Validators only.\n\tr.HandleFunc(\n\t\tfmt.Sprintf(\"/%s/txs\", storeName),\n\t\tpostTxsHandler(cliCtx),\n\t).Methods(http.MethodPost)\n\n\tr.HandleFunc(\n\t\tfmt.Sprintf(\"/%s/tss\", storeName),\n\t\tnewTssPoolHandler(cliCtx),\n\t).Methods(http.MethodPost)\n\n\tr.HandleFunc(\n\t\tfmt.Sprintf(\"/%s/errata\", storeName),\n\t\tnewErrataTxHandler(cliCtx),\n\t).Methods(http.MethodPost)\n\n\tr.HandleFunc(\n\t\tfmt.Sprintf(\"/%s/native/tx\", storeName),\n\t\tnewNativeTxHandler(cliCtx),\n\t).Methods(http.MethodPost)\n\n\tr.Use(mux.CORSMethodMiddleware(r))\n\tr.Use(customCORSHeader())\n}", "title": "" }, { "docid": "9c0a58f7437881fb67384cd56a4c49ed", "score": "0.6370838", "text": "func Handlers() *mux.Router {\n\tr := mux.NewRouter()\n\n\tr.HandleFunc(\"/send\", Send)\n\n\treturn r\n}", "title": "" }, { "docid": "1df660bd63012850c879a794498d6c87", "score": "0.6349039", "text": "func (s *OktaAuthService) AddHandlers(srv *server.Server) {\n\tsrv.Echo().Get(\"/login\", s.loginHandler)\n\tsrv.Echo().Post(\"/login/callback\", s.loginCallbackHandler)\n\tsrv.Echo().Get(\"/login/failed\", s.loginFailedHandler)\n}", "title": "" }, { "docid": "6e13e5da80aecf65c80fe6f2f945da4f", "score": "0.6334125", "text": "func (ac *Config) RegisterHandlers(mux *http.ServeMux, handlePath, servedir string, addDomain bool) {\n\ttheme := ac.defaultTheme\n\t// Theme aliases. Use a map if there are more than 2 aliases in the future.\n\tif theme == \"light\" {\n\t\t// The \"light\" theme is the \"gray\" theme\n\t\ttheme = \"gray\"\n\t}\n\n\t// Handle all requests with this function\n\tallRequests := func(w http.ResponseWriter, req *http.Request) {\n\t\t// Rejecting requests is handled by the permission system, which\n\t\t// in turn requires a database backend.\n\t\tif ac.perm != nil {\n\t\t\tif ac.perm.Rejected(w, req) {\n\t\t\t\t// Prepare to count bytes written\n\t\t\t\tsc := sheepcounter.New(w)\n\t\t\t\t// Get and call the Permission Denied function\n\t\t\t\tac.perm.DenyFunction()(sc, req)\n\t\t\t\t// Log the response\n\t\t\t\tac.LogAccess(req, http.StatusForbidden, sc.Counter())\n\t\t\t\t// Reject the request by just returning\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// Local to this function\n\t\tservedir := servedir\n\n\t\t// Look for the directory that is named the same as the host\n\t\tif addDomain {\n\t\t\tservedir = filepath.Join(servedir, utils.GetDomain(req))\n\t\t}\n\n\t\turlpath := req.URL.Path\n\n\t\t//log.Debugln(\"Checking reverse proxy\", urlpath, ac.reverseProxyConfig)\n\t\tif ac.reverseProxyConfig != nil {\n\t\t\tif rproxy := ac.reverseProxyConfig.FindMatchingReverseProxy(urlpath); rproxy != nil {\n\t\t\t\t//log.Debugf(\"Querying reverse proxy %+v, %+v\\n\", rproxy, req)\n\t\t\t\tres, err := rproxy.DoProxyPass(*req)\n\t\t\t\tif err != nil {\n\t\t\t\t\tw.WriteHeader(http.StatusBadGateway)\n\t\t\t\t\tw.Write([]byte(\"reverse proxy error, please check your server config for AddReverseProxy calls\\n\"))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tdata, err := io.ReadAll(res.Body)\n\t\t\t\tif err != nil {\n\t\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tres.Body.Close()\n\t\t\t\tfor k, vals := range res.Header {\n\t\t\t\t\tfor _, v := range vals {\n\t\t\t\t\t\tw.Header().Set(k, v)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tw.WriteHeader(res.StatusCode)\n\t\t\t\tw.Write(data)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tfilename := utils.URL2filename(servedir, urlpath)\n\t\t// Remove the trailing slash from the filename, if any\n\t\tnoslash := filename\n\t\tif strings.HasSuffix(filename, utils.Pathsep) {\n\t\t\tnoslash = filename[:len(filename)-1]\n\t\t}\n\t\thasdir := ac.fs.Exists(filename) && ac.fs.IsDir(filename)\n\t\tdirname := filename\n\t\thasfile := ac.fs.Exists(noslash)\n\n\t\t// Set the server headers, if not disabled\n\t\tif !ac.noHeaders {\n\t\t\tac.ServerHeaders(w)\n\t\t}\n\n\t\t// Share the directory or file\n\t\tif hasdir {\n\t\t\t// Prepare to count bytes written\n\t\t\tsc := sheepcounter.New(w)\n\t\t\t// Get the directory page\n\t\t\tac.DirPage(sc, req, servedir, dirname, theme)\n\t\t\t// Log the access\n\t\t\tac.LogAccess(req, http.StatusOK, sc.Counter())\n\t\t\treturn\n\t\t} else if !hasdir && hasfile {\n\t\t\t// Prepare to count bytes written\n\t\t\tsc := sheepcounter.New(w)\n\t\t\t// Share a single file instead of a directory\n\t\t\tac.FilePage(sc, req, noslash, ac.defaultLuaDataFilename)\n\t\t\t// Log the access\n\t\t\tac.LogAccess(req, http.StatusOK, sc.Counter())\n\t\t\treturn\n\t\t}\n\t\t// Not found\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tdata := themes.NoPage(filename, theme)\n\t\tac.LogAccess(req, http.StatusNotFound, int64(len(data)))\n\t\tw.Write(data)\n\t}\n\n\t// Handle requests differently depending on rate limiting being enabled or not\n\tif ac.disableRateLimiting {\n\t\tmux.HandleFunc(handlePath, allRequests)\n\t} else {\n\t\tlimiter := tollbooth.NewLimiter(float64(ac.limitRequests), nil)\n\t\tlimiter.SetMessage(themes.MessagePage(\"Rate-limit exceeded\", \"<div style='color:red'>You have reached the maximum request limit.</div>\", theme))\n\t\tlimiter.SetMessageContentType(\"text/html;charset=utf-8\")\n\t\tmux.Handle(handlePath, tollbooth.LimitFuncHandler(limiter, allRequests))\n\t}\n}", "title": "" }, { "docid": "e16c49e1deef62bb03867945c640c94e", "score": "0.63227135", "text": "func registerOperationHandlers() {\n\tlogger.Debug(\"register server handlers\")\n\tbridgev2.RegisterOperationHandler(&bridgev2.OperationHandler{bridgev2.FrameOperationValidate, libcommon.ValidateConnectionHandler})\n\tbridgev2.RegisterOperationHandler(&bridgev2.OperationHandler{bridgev2.FrameOperationUploadFile, UploadFileHandler})\n\tbridgev2.RegisterOperationHandler(&bridgev2.OperationHandler{bridgev2.FrameOperationDownloadFile, DownFileHandler})\n}", "title": "" }, { "docid": "5b6a54f194443edbed9e1b468e46541c", "score": "0.63218206", "text": "func (s *Server) RegisterRoutes(server *web.Server) {\n\trouter := server.Prefix(ttnpb.HTTPAPIPrefix + \"/gcs/gateways/{gateway_id}/\").Subrouter()\n\trouter.Use(\n\t\tmux.MiddlewareFunc(webmiddleware.Namespace(\"gatewayconfigurationserver\")),\n\t\tmux.MiddlewareFunc(webmiddleware.Metadata(\"Authorization\")),\n\t\tvalidateAndFillIDs,\n\t)\n\tif s.config.RequireAuth {\n\t\trouter.Use(mux.MiddlewareFunc(s.requireGatewayRights(ttnpb.RIGHT_GATEWAY_INFO)))\n\t}\n\n\trouter.Handle(\"/semtechudp/global_conf.json\",\n\t\ts.makeJSONHandler(func(ctx context.Context, gtw *ttnpb.Gateway) (interface{}, error) {\n\t\t\treturn semtechudp.Build(gtw, s.FrequencyPlans)\n\t\t}),\n\t).Methods(http.MethodGet)\n\n\trouter.Handle(\"/kerlink-cpf/lorad/lorad.json\",\n\t\ts.makeJSONHandler(func(ctx context.Context, gtw *ttnpb.Gateway) (interface{}, error) {\n\t\t\treturn cpf.BuildLorad(gtw, s.FrequencyPlans)\n\t\t}),\n\t).Methods(http.MethodGet)\n\n\trouter.Handle(\"/kerlink-cpf/lorafwd/lorafwd.toml\",\n\t\ts.makeTextMarshalerHandler(\"application/toml\", func(ctx context.Context, gtw *ttnpb.Gateway) (encoding.TextMarshaler, error) {\n\t\t\treturn cpf.BuildLorafwd(gtw)\n\t\t}),\n\t).Methods(http.MethodGet)\n}", "title": "" }, { "docid": "803d3245a55e8e1b32765547f9f0353f", "score": "0.63053656", "text": "func RegisterRoutes(r weave.Registry, auth x.Authenticator) {\n\tpropBucket := NewProposalBucket()\n\telecBucket := NewElectorateBucket()\n\tr.Handle(pathVoteMsg, &VoteHandler{\n\t\tauth: auth,\n\t\tpropBucket: propBucket,\n\t\telecBucket: elecBucket,\n\t\tvoteBucket: NewVoteBucket(),\n\t})\n\tr.Handle(pathTallyMsg, &TallyHandler{\n\t\tauth: auth,\n\t\tbucket: propBucket,\n\t})\n\tr.Handle(pathCreateTextProposalMsg, &TextProposalHandler{\n\t\tauth: auth,\n\t\tpropBucket: propBucket,\n\t\telecBucket: elecBucket,\n\t\trulesBucket: NewElectionRulesBucket(),\n\t})\n}", "title": "" }, { "docid": "1284ce450aeb67a49b22e583f383fe48", "score": "0.62986594", "text": "func registerAuthRoutes(s *Server) {\n\n\tauthRoutes, avaRoutes := s.AuthService.Handlers()\n\n\ts.Router.GET(\"/auth/me\", h.AuthMeHandler)\n\ts.Router.POST(\"/auth/register\", h.AuthRegisterHandler)\n\n\ts.Router.Any(\"/auth/*\", echo.WrapHandler(authRoutes))\n\ts.Router.Any(\"/avatar/*\", echo.WrapHandler(avaRoutes))\n\n}", "title": "" }, { "docid": "3288797ffbb80d3a047ea201b870bd79", "score": "0.62832505", "text": "func (s *Service) InstallHandlers(r *router.Router, base router.MiddlewareChain) {\n\t// GET so that this can be invoked from cron\n\tr.GET(fireAllTasksURL, base.Extend(gaemiddleware.RequireCron), s.FireAllTasksHandler)\n\tr.POST(processShardPattern, base.Extend(gaemiddleware.RequireTaskQueue(baseName)),\n\t\tfunc(ctx *router.Context) {\n\t\t\tloop := ctx.Request.URL.Query().Get(\"single\") == \"\"\n\t\t\ts.ProcessShardHandler(ctx, loop)\n\t\t})\n}", "title": "" }, { "docid": "e8c6258fe6d6fd2b54011b2264836aab", "score": "0.6268613", "text": "func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router) {\n // this line is used by starport scaffolding\n\tr.HandleFunc(\"/amulet/buying\", listBuyingHandler(cliCtx, \"amulet\")).Methods(\"GET\")\n\tr.HandleFunc(\"/amulet/buying\", createBuyingHandler(cliCtx)).Methods(\"POST\")\n\tr.HandleFunc(\"/amulet/selling\", listSellingHandler(cliCtx, \"amulet\")).Methods(\"GET\")\n\tr.HandleFunc(\"/amulet/selling\", createSellingHandler(cliCtx)).Methods(\"POST\")\n\tr.HandleFunc(\"/amulet/amulet\", listAmuletHandler(cliCtx, \"amulet\")).Methods(\"GET\")\n\tr.HandleFunc(\"/amulet/amulet\", createAmuletHandler(cliCtx)).Methods(\"POST\")\n}", "title": "" }, { "docid": "d7084bb8f66fb584822e714f910ac5f9", "score": "0.62501967", "text": "func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router) {\n // this line is used by starport scaffolding # 1\n\t\tr.HandleFunc(\"/woodpecker/bodyIndex\", listBodyIndexHandler(cliCtx, \"woodpecker\")).Methods(\"GET\")\n\t\tr.HandleFunc(\"/woodpecker/bodyIndex/{key}\", getBodyIndexHandler(cliCtx, \"woodpecker\")).Methods(\"GET\")\n\t\tr.HandleFunc(\"/woodpecker/bodyIndex\", setBodyIndexHandler(cliCtx)).Methods(\"POST\")\n\t\tr.HandleFunc(\"/woodpecker/bodyIndex\", deleteBodyIndexHandler(cliCtx)).Methods(\"DELETE\")\n\n\t\t\n\n\n\t\tr.HandleFunc(\"/woodpecker/medicalHistory\", createMedicalHistoryHandler(cliCtx)).Methods(\"POST\")\n\t\tr.HandleFunc(\"/woodpecker/medicalHistory\", listAllMedicalHistoryHandler(cliCtx, \"woodpecker\")).Methods(\"GET\")\n\t\tr.HandleFunc(\"/woodpecker/medicalHistory/{hashKey}\", listMedicalHistoryHandler(cliCtx, \"woodpecker\")).Methods(\"GET\")\n\t\tr.HandleFunc(\"/woodpecker/medicalHistory/{hashKey}/{id}\", getMedicalHistoryHandler(cliCtx, \"woodpecker\")).Methods(\"GET\")\n\t\tr.HandleFunc(\"/woodpecker/medicalHistory\", setMedicalHistoryHandler(cliCtx)).Methods(\"PUT\")\n\t\tr.HandleFunc(\"/woodpecker/medicalHistory\", deleteMedicalHistoryHandler(cliCtx)).Methods(\"DELETE\")\n\n\t\t\n\t\tr.HandleFunc(\"/woodpecker/attribute\", listAttributeHandler(cliCtx, \"woodpecker\")).Methods(\"GET\")\n\t\tr.HandleFunc(\"/woodpecker/attribute/{key}\", getAttributeHandler(cliCtx, \"woodpecker\")).Methods(\"GET\")\n\t\tr.HandleFunc(\"/woodpecker/attribute\", setAttributeHandler(cliCtx)).Methods(\"POST\")\n\t\tr.HandleFunc(\"/woodpecker/attribute\", deleteAttributeHandler(cliCtx)).Methods(\"DELETE\")\n}", "title": "" }, { "docid": "019948bc6c9e591e6652b91c10104502", "score": "0.6235625", "text": "func RegisterRoutes(r *mux.Router) {\n\tr.HandleFunc(\"/apps/sign\", SignHandler).Methods(\"POST\")\n\tr.HandleFunc(\"/apps/verify\", VerifiyHandler).Methods(\"POST\")\n}", "title": "" }, { "docid": "c22986d32db7f2fffb68f6072bf7d2ec", "score": "0.62290746", "text": "func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, storeName string) {\n\tr.HandleFunc(\"/sessions\", createSessionHander(cliCtx)).Methods(\"POST\")\n\tr.HandleFunc(\"/sessions/{sessionID}\", getSessionHandler(cliCtx, storeName)).Methods(\"GET\")\n}", "title": "" }, { "docid": "16df22e3174a006570e28293bb61130b", "score": "0.6222322", "text": "func Handlers(){\n\tr := mux.NewRouter()\n\n\tr.HandleFunc(\"/\", handle).Methods(\"GET\")\n\n\tPORT := os.Getenv(\"PORT\")\n\tif PORT == \"\" {\n\t\tPORT = conf.Config.Port\n\t}\n\thandler := cors.AllowAll().Handler(r)\n\tlog.Fatal(http.ListenAndServe(\":\"+PORT, handler))\n}", "title": "" }, { "docid": "705bbbce09b84b5cafe6874ef053ad39", "score": "0.62183386", "text": "func RegisterHandlers(s server.Server, o Options) error {\n\tuserDao := dao.NewUserDao(o.DB)\n\terr := pb.RegisterUserServiceHandler(s, &userService{id: o.ServiceName, dao: userDao})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ada6dbf06b45812c1015b409736be4de", "score": "0.6216833", "text": "func RegisterHandlers(mux *http.ServeMux, options ...Option) {\n\tconfig := defaultProfileConfig()\n\tconfig.apply(options)\n\n\tif config.pprof {\n\t\tmux.Handle(\"/debug/pprof/\", pprofHandlerFunc(http.HandlerFunc(pprof.Index), config.enableTLS))\n\t}\n\tif config.cmdline {\n\t\tmux.Handle(\"/debug/pprof/cmdline\", pprofHandlerFunc(http.HandlerFunc(pprof.Cmdline), config.enableTLS))\n\t}\n\tif config.profile {\n\t\tmux.Handle(\"/debug/pprof/profile\", pprofHandlerFunc(http.HandlerFunc(pprof.Profile), config.enableTLS))\n\t}\n\tif config.symbol {\n\t\tmux.Handle(\"/debug/pprof/symbol\", pprofHandlerFunc(http.HandlerFunc(pprof.Symbol), config.enableTLS))\n\t}\n\tif config.trace {\n\t\tmux.Handle(\"/debug/pprof/trace\", pprofHandlerFunc(http.HandlerFunc(pprof.Trace), config.enableTLS))\n\t}\n}", "title": "" }, { "docid": "15cfabefa545e70fc7f6c8362a4cab81", "score": "0.6202172", "text": "func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, storeName string) {\n\tr.HandleFunc(fmt.Sprintf(\"/%s/post/{postOwner}/{postUUID}\", storeName), getPostHandler(cliCtx)).Methods(http.MethodGet)\n\tr.HandleFunc(fmt.Sprintf(\"/%s/posts/{owner}\", storeName), queryListUserPostsHandler(cliCtx)).Methods(http.MethodGet)\n\n\tr.HandleFunc(fmt.Sprintf(\"/%s/posts\", storeName), createPostHandler(cliCtx)).Methods(http.MethodPost)\n\tr.HandleFunc(fmt.Sprintf(\"/%s/posts/{postOwner}/{postUUID}/like\", storeName), likePostHandler(cliCtx)).Methods(http.MethodPost)\n\tr.HandleFunc(fmt.Sprintf(\"/%s/posts/{postOwner}/{postUUID}/delete\", storeName), deletePostHandler(cliCtx)).Methods(http.MethodPost)\n\n\tr.HandleFunc(fmt.Sprintf(\"/%s/moderators\", storeName), moderatorsHandler(cliCtx)).Methods(http.MethodGet)\n\n\tr.HandleFunc(fmt.Sprintf(\"/%s/followers/follow/{whom}\", storeName), createFollowHandler(cliCtx)).Methods(http.MethodPost)\n\tr.HandleFunc(fmt.Sprintf(\"/%s/followers/unfollow/{whom}\", storeName), createUnfollowHandler(cliCtx)).Methods(http.MethodPost)\n\tr.HandleFunc(fmt.Sprintf(\"/%s/followers/{owner}/followees\", storeName), queryFolloweesHandler(cliCtx)).Methods(http.MethodGet)\n}", "title": "" }, { "docid": "2051947e96a527ac97e04a909973a829", "score": "0.6199088", "text": "func AddRoutes(router *mux.Router) {\n\taddHealthCheckHandler(router)\n\taddStandingsHandler(router)\n\taddRosterHandler(router)\n\taddPlayersHandler(router)\n\taddPlayerHandler(router)\n}", "title": "" }, { "docid": "d5d91141695ede739ab3c8f6f7ec2bb3", "score": "0.6198808", "text": "func (this *Router) Register(methods []string, handler Controller) {\n\tthis.mu.Lock()\n\tdefer this.mu.Unlock()\n\tfor _, m := range methods {\n\t\tthis.reg(m, handler)\n\t}\n}", "title": "" }, { "docid": "3675f7aece4cc9e94e90fb6a5bcda3a5", "score": "0.6197323", "text": "func Handlers() {\n\trouter := mux.NewRouter()\n\n\trouter.HandleFunc(\"/api/registro\", middlewares.CheckBD(routers.Register)).Methods(\"POST\")\n\trouter.HandleFunc(\"/api/login\", middlewares.CheckBD(routers.Login)).Methods(\"POST\")\n\trouter.HandleFunc(\"/api/perfil\", middlewares.CheckBD(middlewares.JwtValidation(routers.ShowProfile))).Methods(\"GET\")\n\n\tPORT := os.Getenv(\"PORT\")\n\tif PORT == \"\" {\n\t\tPORT = \"8080\"\n\t}\n\thandler := cors.AllowAll().Handler(router)\n\tlog.Fatal(http.ListenAndServe(\":\"+PORT, handler))\n\n}", "title": "" }, { "docid": "e9c5aa7d7c44877fa863449543164235", "score": "0.6184039", "text": "func (s *Server) RegisterHandler(h Handler) {\n\tlog.WithFields(log.Fields{\n\t\t\"method\": h.Method,\n\t\t\"path\": h.PathString(),\n\t}).Info(\"Registering handler\")\n\ts.Router.Handle(h.Method, h.PathString(), h.HandlerFunc())\n}", "title": "" }, { "docid": "e450213812cecfd6c28359b76fc5fb05", "score": "0.6165128", "text": "func RegisterRoutes(r *mux.Router) {\n\tr.StrictSlash(true)\n\n\t// register routes\n\tr.HandleFunc(\"/health\", HealthCheck).Methods(\"GET\")\n\tr.HandleFunc(\"/sensordata\", GetSensorData).Methods(\"GET\")\n}", "title": "" }, { "docid": "371d6379659dfe8c42e0096eb6cb0009", "score": "0.61591655", "text": "func MakeHandlers(endpoints Endpoints) *mux.Router {\n r := mux.NewRouter()\n r.Use(CommonMiddleware)\n r.Methods(\"GET\").Path(\"/read_question/{id}\").Handler(httptransport.NewServer(endpoints.ReadQuestionEndpoint, DecodeIDRequest, EncodeResponse))\n r.Methods(\"GET\").Path(\"/read_all_questions\").Handler(httptransport.NewServer(endpoints.ReadAllQuestionsEndpoint, DecodeEmptyRequest, EncodeResponse))\n r.Methods(\"POST\").Path(\"/create_question\").Handler(httptransport.NewServer(endpoints.CreateQuestionEndpoint, DecodeQuestionRequest, EncodeResponse))\n r.Methods(\"PUT\").Path(\"/update_question\").Handler(httptransport.NewServer(endpoints.UpdateQuestionEndpoint, DecodeQuestionRequest, EncodeResponse))\n r.Methods(\"DELETE\").Path(\"/delete_question/{id}\").Handler(httptransport.NewServer(endpoints.DeleteQuestionEndpoint, DecodeIDRequest, EncodeResponse))\n r.Methods(\"DELETE\").Path(\"/delete_all_questions\").Handler(httptransport.NewServer(endpoints.DeleteAllQuestionsEndpoint, DecodeEmptyRequest, EncodeResponse))\n r.Methods(\"GET\").Path(\"/read_questions_of_user/{user}\").Handler(httptransport.NewServer(endpoints.ReadQuestionsOfUserEndpoint, DecodeUserRequest, EncodeResponse))\n r.Methods(\"GET\").Path(\"/read_answers_of_user/{user}\").Handler(httptransport.NewServer(endpoints.ReadAnswersOfUserEndpoint, DecodeUserRequest, EncodeResponse))\n return r\n}", "title": "" }, { "docid": "cdcf37836b2de024acc6adb0fd2ac8b4", "score": "0.6156093", "text": "func (s *rpcServer) addHandlers() {\n\t// When client connects/disconnects\n\ts.rpcSrv.OnConnect(s.onClientConnect)\n\ts.rpcSrv.OnDisconnect(s.onClientDisconnect)\n\n\t// General\n\ts.rpcSrv.Handle(rpcHandleAuth, s.handleAuth)\n\n\t// Objects\n\ts.rpcSrv.Handle(rpcHandleSendObject, s.sendObject)\n\ts.rpcSrv.Handle(rpcHandleGetIdentity, s.getID)\n\n\t// Statistics\n\n\t// Notifications\n\ts.rpcSrv.Handle(rpcHandleSubscribeMessages, s.subscribeMessages)\n\ts.rpcSrv.Handle(rpcHandleSubscribeBroadcasts, s.subscribeBroadcasts)\n\ts.rpcSrv.Handle(rpcHandleSubscribeGetpubkeys, s.subscribeGetpubkeys)\n\ts.rpcSrv.Handle(rpcHandleSubscribePubkeys, s.subscribePubkeys)\n\ts.rpcSrv.Handle(rpcHandleSubscribeUnknownObjs, s.subscribeUnknownObjects)\n\n}", "title": "" }, { "docid": "00d6874452027ba229dd1faeee578724", "score": "0.6142889", "text": "func initHandlers(r *mux.Router) {\n\t// If gorilla-mux is enabled, r is pointer to mux.Router and we have to use it.\n\t// Once first match is found, appropriate handler is called, so make sure you \n\t// order patterns appropriately. Pattern is regexp.\n\t// usage would be: r.HandleFunc(\"/some-regexp-pattern\", handlerFn)\n\t//\n\t// If gorilla-mux is disabled, you will use default http's way of defining patterns.\n\t// Patterns are not regexp. Instead, longest match will win, so you don't have to worry\n\t// about ordering in this case.\n\t// usage: http.HandleFunc(\"/pattern\", handlerFn)\n\t//\n\t// this code is based on sample config provided, where gorilla-mux is enabled, so\n\tr.HandleFunc(\"/\", indexPage) // otherwise, we would use http.HandleFunc(\"/\", indexPage)\n\tr.HandleFunc(\"/login\", loginPage)\n\t\t\n}", "title": "" }, { "docid": "cd8d097bcef2b52c4d6ad931aa1e2f17", "score": "0.6142379", "text": "func RegisterRouter(app *iris.Framework) {\n\tapp.Get(\"/\", func(ctx *iris.Context) {\n\t\tctx.Render(\"index.html\", iris.Map{})\n\t})\n\n\tapi := app.Party(\"/api/v1\")\n\t{\n\t\tapi.Get(\"/r/:bucket/:key\", GetValHandler)\n\t\tapi.Get(\"/prefix/:bucket/:prefix\", PrefixScanHandler)\n\t\tapi.Put(\"/w\", PutValHander)\n\t\tapi.Get(\"/d/:bucket/:key\", DeleteKeyHandler)\n\n\t\tbucket := api.Party(\"/bucket\")\n\t\t{\n\t\t\tbucket.Get(\"/\", ListBucketsHandler)\n\n\t\t\tbucket.Get(\"/:name\", ListBucketByNameHandler)\n\t\t\tbucket.Post(\"/:name\", CreateBucketHandler)\n\t\t\tbucket.Delete(\"/:name\", DeleteBucketHandler)\n\t\t}\n\n\t\tdb := api.Party(\"/db\")\n\t\t{\n\t\t\tdb.Get(\"/status\", StatusHandler)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3d46e92c5569b5ecc7cb37fd87361f64", "score": "0.6130266", "text": "func AddRoutes(mux *http.ServeMux, server *QProxyServer) error {\n\tlocalClient := &gateway.QProxyDirectClient{server}\n\tgwmux := grpcgw_runtime.NewServeMux()\n\n\tif err := rpc.RegisterQProxyHandlerClient(context.Background(), gwmux, localClient); err != nil {\n\t\treturn errors.Wrap(err, \"registering qproxy handler client\")\n\t}\n\n\tmux.Handle(\"/v1/\", CompressionHandler{gwmux.ServeHTTP})\n\t// Don't need to use our CompressionHandler, as prometheus has their own\n\tmux.Handle(\"/metrics\", promhttp.Handler())\n\n\t// TODO: Implement\n\t// mux.HandleFunc(\"/version\", server.version)\n\n\t// register all debug routes on our muxer\n\tmux.HandleFunc(\"/debug/pprof/\", pprof.Index)\n\tmux.HandleFunc(\"/debug/pprof/cmdline\", pprof.Cmdline)\n\tmux.HandleFunc(\"/debug/pprof/profile\", pprof.Profile)\n\tmux.HandleFunc(\"/debug/pprof/symbol\", pprof.Symbol)\n\tmux.Handle(\"/debug/pprof/goroutine\", pprof.Handler(\"goroutine\"))\n\tmux.Handle(\"/debug/pprof/heap\", pprof.Handler(\"heap\"))\n\tmux.Handle(\"/debug/pprof/threadcreate\", pprof.Handler(\"threadcreate\"))\n\tmux.Handle(\"/debug/pprof/block\", pprof.Handler(\"block\"))\n\n\treturn nil\n}", "title": "" }, { "docid": "f9ac40087ed940b6614e0e4b38fc41e6", "score": "0.61294454", "text": "func registerRoutes(rs *lcd.RestServer) {\n\tbandclient.RegisterRoutes(rs.CliCtx, rs.Mux)\n\tclient.RegisterRoutes(rs.CliCtx, rs.Mux)\n\tauthrest.RegisterTxRoutes(rs.CliCtx, rs.Mux)\n\tapp.ModuleBasics.RegisterRESTRoutes(rs.CliCtx, rs.Mux)\n}", "title": "" }, { "docid": "b1f4c847ae88e9a8b8be9a03a97225ea", "score": "0.6119122", "text": "func (b *bot) registerHandlers() {\n\tchat := b.chatHandler\n\tconv := b.convHandler\n\twallet := b.walletHandler\n\terr := b.errHandler\n\n\tb.handlers = keybase.Handlers{\n\t\tChatHandler: &chat,\n\t\tConversationHandler: &conv,\n\t\tWalletHandler: &wallet,\n\t\tErrorHandler: &err,\n\t}\n}", "title": "" }, { "docid": "3001718f5acf43029d75d96e9cfb90d7", "score": "0.6101783", "text": "func (exchange *Exchange) Register(service *ServiceRecord) {\n\texchange.services[service.ID] = service\n\tfor method, patterns := range service.Routes {\n\t\tfor _, pattern := range patterns {\n\t\t\tpattern = \"/api\" + pattern\n\t\t\t// log.Printf(\"\\n>\\tADDING PATTERN\\n>\\tPATTERN DETAILS: %v %v\\n>\\tSERVICE DETAILS: %v %v\", method, pattern, service.Address, service.ID)\n\t\t\texchange.mux.Add(method, pattern, service.Address, service.ID, service, exchange.client)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e574d4b9b49af772a981a2fb7f7d3254", "score": "0.6097436", "text": "func InitHandlers() {\n\thttp.HandleFunc(uriSetType, loghttp.Adapter(setFSType))\n\n\thttp.HandleFunc(\"/fetch/request-static\", loghttp.Adapter(staticFetchDirect))\n\n\thttp.HandleFunc(uriFetchCommandSender, loghttp.Adapter(staticFetchViaPosting2Receiver))\n\thttp.HandleFunc(uriFetchCommandReceiver, loghttp.Adapter(fetchCommandReceiver))\n\n\thttp.HandleFunc(UriMountNameY, loghttp.Adapter(serveFile))\n\n\t// working only for memfs\n\thttp.Handle(\"/fetch/reservoire/static/\", http.StripPrefix(\"/fetch/reservoire/static/\", fileserver1))\n\n\thttp.Handle(routes.FetchSimilarURI, loghttp.Adapter(FetchSimilar))\n\thttp.Handle(\"/fetch/similiar/form/\", loghttp.Adapter(fetchSimForm))\n\n}", "title": "" }, { "docid": "6bf64313f830c72422fec6be6473fd05", "score": "0.6086515", "text": "func (r ClientP2pRouter) SetRoutes(mux *http.ServeMux) {\n\tmux.HandleFunc(\"/healthz\", func(w http.ResponseWriter, _ *http.Request) {})\n\tmux.HandleFunc(\"/messages/\", clientp2pHandler(r.Logic))\n}", "title": "" }, { "docid": "5017fe3ef746517ead978137ff49728a", "score": "0.60659975", "text": "func Register(hs ...Handler) {\n\tmux.Register(hs...)\n}", "title": "" }, { "docid": "5d9532828a037c381771ce4ddd98e6f6", "score": "0.6065305", "text": "func SetHandlers(m *http.ServeMux, c *crawler.Crawler) {\n\tm.HandleFunc(\"/\", index)\n\tm.HandleFunc(\"/api/v1/link\", linkHandler(c))\n\tm.HandleFunc(\"/api/v1/stop\", stopAll(c))\n\n\tm.HandleFunc(\"/debug/pprof/\", pprof.Index)\n\tm.HandleFunc(\"/debug/pprof/cmdline\", pprof.Cmdline)\n\tm.HandleFunc(\"/debug/pprof/profile\", pprof.Profile)\n\tm.HandleFunc(\"/debug/pprof/symbol\", pprof.Symbol)\n\tm.HandleFunc(\"/debug/pprof/trace\", pprof.Trace)\n\n}", "title": "" }, { "docid": "6945d2c6a957e867d9576716bc1fee8f", "score": "0.6065033", "text": "func SetRouters(e *echo.Echo, h *handler.Handler) {\n\tcfg, err := h.GetDefaultConfig()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// set default middleware\n\te.Pre(middleware.RemoveTrailingSlash())\n\tif cfg.Applications.Servers.GraphQLAPI.Options.Middlewares.Logger.Enable {\n\t\te.Use(middleware.Logger())\n\t}\n\te.Use(middleware.Recover())\n\te.Use(middleware.RequestID())\n\n\t// html template\n\tt := &Template{\n\t\ttemplates: template.Must(template.ParseGlob(\"www/templates/**/*.*ml\")),\n\t}\n\te.Renderer = t\n\n\t// Set CORS\n\te.Use(middleware.CORSWithConfig(middleware.CORSConfig{\n\t\tAllowOrigins: []string{\"*\"},\n\t\tAllowMethods: []string{http.MethodGet, http.MethodPut, http.MethodPost, http.MethodDelete, http.MethodOptions},\n\t}))\n\n\t// features\n\tfeatures, err := features.NewFeatures(h)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// System\n\tgs := e.Group(\"system\")\n\trouter.SetSystem(gs, features.System)\n\n\t// GraphQL\n\tgql := e.Group(\"graphql\")\n\trouter.SetGraphQLSchema(gql, e, features.GraphQLSchema)\n}", "title": "" }, { "docid": "3369c2f46501a7687c01cd8270f24805", "score": "0.606261", "text": "func InstallHandlers(r *router.Router, base router.MiddlewareChain) {\n\tr.GET(\"/internal/cron/ts_mon/housekeeping\", base, housekeepingHandler)\n}", "title": "" }, { "docid": "4f77021902475cb1991369839dc69c03", "score": "0.60537905", "text": "func (s *server) LoadHandlers() {\n\tusers := s.Router.Group(\"/api/v1/users\")\n\t{\n\t\tusers.POST(\"/add\", handleUserAdd(s.AddingService))\n\t\tusers.GET(\"/get\", handleUserGet(s.ListingService))\n\t\tusers.PUT(\"/edit/:id\", handleUserEdit(s.EditingService))\n\t\tusers.DELETE(\"/delete/:id\", handleUserDelete(s.DeletingService))\n\t}\n\ts.Router.GET(\"/healthcheck\", handleHealthcheck)\n}", "title": "" } ]
d5c82886f3c697a7ccb4515b9fcf53a1
GetSection returns map for the given key
[ { "docid": "b0c8ed44d1b8fdabe5cb64fd99b6c1ee", "score": "0.73101395", "text": "func (c *Config) GetSection(key string) (map[interface{}]interface{}, error) {\n\tif v, err := c.getData(key); err != nil {\n\t\treturn nil, errors.New(\"not exist setction\")\n\t} else if vv, ok := v.(map[interface{}]interface{}); ok {\n\t\treturn vv, nil\n\t}\n\treturn nil, errors.New(\"section not map[interface{}]interface{}\")\n}", "title": "" } ]
[ { "docid": "d2d3b27806ee99e21420721f5c4bf7a2", "score": "0.723132", "text": "func (c *Config) GetSection(key string) (map[interface{}]interface{}, error) {\n\tif v, err := c.getData(key); err != nil {\n\t\treturn nil, err\n\t} else if vv, ok := v.(map[interface{}]interface{}); ok {\n\t\treturn vv, nil\n\t}\n\treturn nil, errors.New(\"section not map[interface{}]interface{}\")\n}", "title": "" }, { "docid": "acccf296451bfa26c0b5e96f579b1338", "score": "0.6705065", "text": "func (i Ini) Get(section, key string) (string, bool) {\n\ts, ok := i[strings.ToLower(section)]\n\tif !ok {\n\t\treturn \"\", false\n\t}\n\n\tr, ok := s[strings.ToLower(key)]\n\treturn r, ok\n}", "title": "" }, { "docid": "f26cad6e6029462cc393e22843ea2376", "score": "0.6562988", "text": "func (ss *Sections) Get(k string) (*Section, bool) {\n\tv, ok := ss.kv[k]\n\tif !ok {\n\t\treturn nil, false\n\t}\n\n\treturn v, true\n}", "title": "" }, { "docid": "183d0ac2552532d10437dfb34b9e84bb", "score": "0.6388321", "text": "func (c *Configer) GetSection(section string) (map[string]string, error) {\n\tif v, ok := c.data[section]; ok {\n\t\treturn v, nil\n\t}\n\treturn nil, errors.New(\"not exist section\")\n}", "title": "" }, { "docid": "e9971bec756207ad35d5f7fa1d4ccc1e", "score": "0.6285794", "text": "func (this FontInfo) GetSectionMap() map[rune]image.Rectangle {\n\tf := truetype.Font(this)\n\n\tsecMap := map[rune]image.Rectangle{}\n\n\tcurW := 0\n\n\tfor _, v := range text {\n\t\ti := f.Index(v)\n\t\thmet := f.HMetric(100, i)\n\n\t\t// advance width is how much font advances on x which next font starts AFTER that.\n\t\tminX := curW + 1\n\t\tminY := 0\n\t\tmaxX := curW + int(hmet.AdvanceWidth)\n\t\tmaxY := 100 //int(f.Bounds(100).Max.Y) + 1\n\n\t\tsecMap[v] = image.Rect(minX, minY, maxX, maxY)\n\t\tfmt.Print(\"SECMAP for: \", string(v))\n\t\tfmt.Println(secMap[v])\n\n\t\tcurW = maxX\n\t}\n\n\treturn secMap\n\n}", "title": "" }, { "docid": "2b1267326412772c6bb826540f111eb6", "score": "0.58318263", "text": "func GetSection(s string) map[string]string {\n\tcfg,err := config.ReadDefault(*configFile) //读取配置文件,并返回其Config\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Fail to find %v,%v\",*configFile,err)\n\t}\n\n\tif cfg.HasSection(s) { //判断配置文件中是否有section(一级标签)\n\t\toptions,err := cfg.SectionOptions(s) //获取一级标签的所有子标签options(只有标签没有值)\n\t\tif err == nil {\n\t\t\tfor _,v := range options{\n\t\t\t\toptionValue,err := cfg.String(s,v) //根据一级标签section和option获取对应的值\n\t\t\t\tif err == nil {\n\t\t\t\t\tCONFIG[v] =optionValue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn CONFIG\n}", "title": "" }, { "docid": "01aa3e36f3760d622c8c3c2f955864d0", "score": "0.5688861", "text": "func GetKeyValue(section string, key string) string {\n\treturn cfg.Section(section).Key(key).String()\n}", "title": "" }, { "docid": "066220bdd01d39cdb7e8ef6430c12362", "score": "0.56831694", "text": "func (p *ISupportPlugin) GetMap(key string) (map[string]string, bool) {\n\tdata, ok := p.raw[key]\n\tif !ok {\n\t\treturn nil, false\n\t}\n\n\tret := make(map[string]string)\n\tfor _, v := range strings.Split(data, \",\") {\n\t\tinnerData := strings.SplitN(v, \":\", 2)\n\t\tif len(innerData) != 2 {\n\t\t\treturn nil, false\n\t\t}\n\n\t\tret[innerData[0]] = innerData[1]\n\t}\n\n\treturn ret, true\n}", "title": "" }, { "docid": "3c349cc72c73ede2770d105024462e1d", "score": "0.56823605", "text": "func GetConfigSectionI(section string, config ...string) map[string]interface{} {\n\tvar filename string\n\tif config == nil {\n\t\tfilename = defaultSettings.ConfigFile\n\t} else {\n\t\tfilename = config[0]\n\t}\n\n\tsectionValue := GetConfigSectionAll(section, filename)\n\n\tvar result map[string]interface{}\n\tif sectionValue == nil {\n\t\tlog.Warning(\"Section \"+section+\" doesn't exist on \"+filename, \"\")\n\t\tresult = nil\n\t} else {\n\t\tresult = sectionValue.(map[string]interface{})\n\t}\n\treturn result\n}", "title": "" }, { "docid": "19aa61ab401d90fb177951c6b222ed8d", "score": "0.556544", "text": "func (in *Ini) getSection(secName, subName string) *Section {\n\tx := len(in.secs) - 1\n\tfor ; x >= 0; x-- {\n\t\tif in.secs[x].mode == lineModeEmpty || in.secs[x].mode == lineModeComment {\n\t\t\tcontinue\n\t\t}\n\t\tif in.secs[x].nameLower != secName {\n\t\t\tcontinue\n\t\t}\n\t\tif in.secs[x].sub != subName {\n\t\t\tcontinue\n\t\t}\n\t\treturn in.secs[x]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "58bb0bb58d309eb0e5d1f3d774f066ed", "score": "0.5552627", "text": "func (hm *HMap) Get(mainKey string, subKey string) (interface{}, error) {\n\tif hm.M != nil {\n\t\thm.M.RLock()\n\t\tdefer hm.M.RUnlock()\n\t}\n\n\tif _, ok := hm.Content[mainKey]; ok {\n\t\tif _, ok2 := hm.Content[mainKey][subKey]; ok2 {\n\t\t\treturn hm.Content[mainKey][subKey], nil\n\t\t} else {\n\t\t\treturn nil, errors.New(\"no such subKey key \" + subKey)\n\t\t}\n\t} else {\n\t\treturn nil, errors.New(\"no such mainKey key \" + mainKey)\n\t}\n}", "title": "" }, { "docid": "c3062f8335974d39c093ae9244f87e0e", "score": "0.55163044", "text": "func GetConfigSection(section string, config ...string) map[string]string {\n\tresult := make(map[string]string)\n\tlist := GetConfigSectionI(section, config...)\n\tfor identifier, value := range list {\n\t\tresult[identifier] = value.(string)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "3686b85a09f0a2912977e7e15f058dbd", "score": "0.55057937", "text": "func (c *ConfigParams) GetSection(section string) *ConfigParams {\n\tresult := NewEmptyConfigParams()\n\tprefix := section + \".\"\n\n\tfor key := range c.Value() {\n\t\t// Prevents exception on the next line\n\t\tif len(key) < len(prefix) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Perform case sensitive match\n\t\tkeyPrefix := key[0:len(prefix)]\n\t\tif keyPrefix == prefix {\n\t\t\tsectionKey := key[len(prefix):]\n\t\t\tresult.Put(sectionKey, c.Get(key))\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "3672a392658a1dba374ee236db8e3892", "score": "0.54517525", "text": "func Get(section string) (interface{}, error) {\n\tval := getLoaded(section)\n\tdef := GetDefault(section)\n\tswitch {\n\tcase val == nil && def == nil:\n\t\treturn nil, errors.Errorf(\"section not found: %s\", section)\n\tcase val != nil && def == nil:\n\t\treturn val, nil\n\t}\n\tdecoder, _ := mapstructure.NewDecoder(&mapstructure.DecoderConfig{\n\t\tWeaklyTypedInput: true,\n\t\tResult: def,\n\t})\n\tif err := decoder.Decode(val); err != nil {\n\t\treturn nil, errors.Errorf(\"error while parsing section: %s\", section)\n\t}\n\treturn def, nil\n}", "title": "" }, { "docid": "fff8078bfb1c8278617e57708c5f1ea4", "score": "0.539904", "text": "func (m *InterfaceMap) Get(key string) interface{} {\n\treturn m.d[key]\n}", "title": "" }, { "docid": "7b784e1c1a4ab96f42c2254c54cac975", "score": "0.53827536", "text": "func (c *IniConfig) GetValue(section, key string) (string, bool) {\n\ts := c.file.Section(section)\n\tif !s.HasKey(key) {\n\t\treturn \"\", false\n\t}\n\treturn s.Key(key).String(), true\n}", "title": "" }, { "docid": "591b71a68d03567c2f311e84798b513d", "score": "0.5358856", "text": "func (c *Conf) GetMap(path string) map[string]string {\r\n\tc.mutex.RLock()\r\n\tdefer c.mutex.RUnlock()\r\n\tkvMap, _ := c.root.getMap(path)\r\n\treturn kvMap\r\n}", "title": "" }, { "docid": "3747dee1f4fcdc9e8fba1ba9084d8ea2", "score": "0.5352125", "text": "func (m *sectionLookup) getByID(id string) *proto.Section {\n\treturn m.byID[id]\n}", "title": "" }, { "docid": "0441c9cebe4f83db13271914c389b554", "score": "0.535161", "text": "func Get(ctx context.Context, key string) interface{} {\n\tcm := ctx.Value(keyType(mapKey))\n\n\tif cm == nil {\n\t\treturn nil\n\t}\n\n\tm, ok := cm.(ctxMap)\n\tif !ok {\n\t\treturn nil\n\t}\n\n\treturn m[keyType(key)]\n}", "title": "" }, { "docid": "31a979bb8bb2bdc7f460770566b46225", "score": "0.53058106", "text": "func (c Map) Get(key string) string {\n\tval, exists := (c)[key]\n\tif !exists {\n\t\treturn \"\"\n\t}\n\treturn val\n}", "title": "" }, { "docid": "8111bdfec3475f1805c95a31c8531119", "score": "0.5305664", "text": "func (l LogLine) GetSection() string {\n sections := strings.Split(l.Resource, \"/\")\n section := strings.Split(sections[1], \"?\")\n\n return section[0]\n}", "title": "" }, { "docid": "cfe4131784da64fd276250567215c515", "score": "0.5300283", "text": "func (m *sectionLookup) getByName(name string) *proto.Section {\n\treturn m.byName[name]\n}", "title": "" }, { "docid": "7b824c6dd797737141e98fa4df2f4a17", "score": "0.52889234", "text": "func (a *Client) GetSection(params *GetSectionParams, authInfo runtime.ClientAuthInfoWriter) (*GetSectionOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSectionParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSection\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/sections/{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: &GetSectionReader{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.(*GetSectionOK)\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 getSection: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "def8cd281ac0ce9d291faa4a82f23666", "score": "0.5284185", "text": "func (in *Ini) AsMap(sectionName, subName string) (out map[string][]string) {\n\tout = make(map[string][]string)\n\n\tfor x := 0; x < len(in.secs); x++ {\n\t\tsec := in.secs[x]\n\n\t\tif len(sectionName) > 0 && sectionName != sec.nameLower {\n\t\t\tcontinue\n\t\t}\n\t\tif len(sectionName) > 0 && subName != sec.sub {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor y := 0; y < len(sec.vars); y++ {\n\t\t\tv := sec.vars[y]\n\n\t\t\tif v.mode == lineModeEmpty {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif v.mode&lineModeSection > 0 || v.mode&lineModeSubsection > 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar key string\n\n\t\t\tif len(sectionName) > 0 && len(subName) > 0 {\n\t\t\t\tkey += v.key\n\t\t\t} else {\n\t\t\t\tkey += sec.nameLower + fieldTagSeparator\n\t\t\t\tkey += sec.sub + fieldTagSeparator\n\t\t\t\tkey += v.key\n\t\t\t}\n\n\t\t\tvals, ok := out[key]\n\t\t\tif !ok {\n\t\t\t\tout[key] = []string{v.value}\n\t\t\t} else {\n\t\t\t\tout[key] = libstrings.AppendUniq(vals, v.value)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "3fbc202e0a2ae1e9faa717dcfd688785", "score": "0.5273535", "text": "func (c *Context) get(m map[string][]string, key string) (map[string]string, bool) {\n\tdicts := make(map[string]string)\n\texist := false\n\tfor k, v := range m {\n\t\tif i := strings.IndexByte(k, '['); i >= 1 && k[0:i] == key {\n\t\t\tif j := strings.IndexByte(k[i+1:], ']'); j >= 1 {\n\t\t\t\texist = true\n\t\t\t\tdicts[k[i+1:][:j]] = v[0]\n\t\t\t}\n\t\t}\n\t}\n\treturn dicts, exist\n}", "title": "" }, { "docid": "32197206d7ad7a164dcc03e791972b46", "score": "0.52514094", "text": "func (m *ConcurrentMap) Get(key uint16) (interface{}, bool) {\n\t// Get shard\n\tshard := m.getShard(key)\n\tshard.mux.RLock()\n\t// Get item from shard.\n\tval, ok := shard.items[key]\n\tshard.mux.RUnlock()\n\treturn val, ok\n}", "title": "" }, { "docid": "6462aa56036a7584bb876c6a3bba498c", "score": "0.5238655", "text": "func (c *config) get(section, key string) (string, bool) {\n\t// Make sure such section exists.\n\tif _, ok := c.body[section]; !ok {\n\t\treturn \"\", false\n\t}\n\n\t// Make sure such key exist.\n\tv, ok := c.body[section][key]\n\tif !ok {\n\t\treturn \"\", false\n\t}\n\n\t// Replace environment variables in the received value\n\t// and return it.\n\tv = envVar.ReplaceAllStringFunc(v, func(k string) string {\n\t\treturn os.Getenv(envVar.ReplaceAllString(k, \"$1\"))\n\t})\n\treturn v, true\n}", "title": "" }, { "docid": "5cf9c36b1753d59871c9c98cd3b0a6e5", "score": "0.5238002", "text": "func (m *SafeMap) Get(key string) interface{} {\n if val, ok := m.data[key]; ok {\n return val\n }\n\n return nil\n}", "title": "" }, { "docid": "d622ab2127e8d955b6f550156b151937", "score": "0.52316403", "text": "func (p paramsData) GetMap(key string) paramsData {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tvar data paramsData\n\tif v, ok := p.GetInterface(key).(map[string]interface{}); ok {\n\t\tdata = v\n\t}\n\treturn data\n}", "title": "" }, { "docid": "417a2c5d722060b0b12e28e74c86cd23", "score": "0.5230733", "text": "func (s *HashMapStorage) RangeGetKV(start, end string) (map[string]string, error) {\n\t// start and end are already hashed\n\tres := make(map[string]string)\n\tmax := MaxID()\n\tzero := ZeroID()\n\ts.mMut.RLock()\n\tfor k := range s.m {\n\t\tif ((start <= end) && (k >= start) && (k < end)) ||\n\t\t\t((start > end) && (((k >= start) && (k <= max)) || ((k >= zero) && (k < end)))) {\n\t\t\t// fmt.Printf(\"Range: Get V(%s)=%s\\n\", k, s.m[k])\n\t\t\tres[k] = s.m[k]\n\t\t}\n\t}\n\n\ts.mMut.RUnlock()\n\treturn res, nil\n}", "title": "" }, { "docid": "1390af8a47ce63686065d3c69a986045", "score": "0.51839423", "text": "func findDocumentSectionMap(section map[string]interface{}) (map[string]interface{}, error) {\n\tfor k, v := range section {\n\t\tswitch vv := v.(type) {\n\t\tcase map[string]interface{}:\n\t\t\tif k == \"documents\" {\n\t\t\t\treturn vv, nil\n\t\t\t}\n\t\t\trecurseResult, err := findDocumentSectionMap(vv)\n\t\t\tif err == nil {\n\t\t\t\treturn recurseResult, nil\n\t\t\t}\n\t\tcase []interface{}:\n\t\t\t// TODO iterate over the entries and see if the documents section is there\n\t\t}\n\t}\n\treturn nil, errors.New(\"unable to find document section\")\n}", "title": "" }, { "docid": "4b567826967d3868e3b6a73f4548c622", "score": "0.51574016", "text": "func (this *MyHashMap) Get(key int) int {\n\tval, ok := this.content[key]\n\tif !ok {\n\t\treturn -1\n\t}\n\treturn val\n}", "title": "" }, { "docid": "4921c8c05fd6196968959b1d70bf0163", "score": "0.5153479", "text": "func (r *Retriever) getNestedValue(key string, sectionMap interface{}) (string, error) {\n\tif !strings.Contains(key, \".\") {\n\t\tvalue, exists := sectionMap.(map[string]interface{})[key]\n\t\tif !exists {\n\t\t\treturn \"\", fmt.Errorf(\"Can't find key '%s'\", key)\n\t\t}\n\t\treturn fmt.Sprintf(\"%v\", value), nil\n\t}\n\tattrs := strings.SplitN(key, \".\", 2)\n\tnewSectionMap, exists := sectionMap.(map[string]interface{})[attrs[0]]\n\tif !exists {\n\t\treturn \"\", fmt.Errorf(\"Can't find '%v' section in CR\", attrs)\n\t}\n\treturn r.getNestedValue(attrs[1], newSectionMap.(map[string]interface{}))\n}", "title": "" }, { "docid": "d0e251935780ee0f34fa32fa368efaa4", "score": "0.51402843", "text": "func IDMapGet(m IDMap, key string) interface{} {\n\tmeta := IDMapMetadata[m]\n\tmeta.Lock.Lock()\n\tdefer meta.Lock.Unlock()\n\n\tmapValue := reflect.ValueOf(m).Elem()\n\tret := mapValue.MapIndex(reflect.ValueOf(key)).Interface()\n\n\treturn ret\n}", "title": "" }, { "docid": "6e1583d1cd5387646adbe2c76cc3e4d9", "score": "0.51354325", "text": "func (c MetadataCarrier) Get(key string) string {\n\treturn c.Map[key]\n}", "title": "" }, { "docid": "7f0fda799647d301bfe414314243ef00", "score": "0.5127358", "text": "func (s *GeddisStore) GetByKey(key, subKey string) (string, error) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\ts.cleanExpired()\n\n\telem, ok := s.m[key]\n\tif !ok {\n\t\treturn \"\", ErrNotFound\n\t}\n\n\telemSlice, ok := elem.(map[string]string)\n\tif !ok {\n\t\treturn \"\", ErrInvalidType\n\t}\n\n\tresp, ok := elemSlice[subKey]\n\tif !ok {\n\t\treturn \"\", ErrInvalidIndex\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "f0accab4219fd0ced0da5ded651ab582", "score": "0.511156", "text": "func (v AMap) Get(key string) string {\n\tif v == nil {\n\t\treturn \"\"\n\t}\n\treturn v[key]\n}", "title": "" }, { "docid": "89361d2f7ad7aa2c32675d0a5770aaef", "score": "0.5107129", "text": "func (s *GeddisStore) GetMap(key string) (map[string]string, error) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\ts.cleanExpired()\n\n\telem, ok := s.m[key]\n\tif !ok {\n\t\treturn nil, ErrNotFound\n\t}\n\n\telemMap, ok := elem.(map[string]string)\n\tif !ok {\n\t\treturn nil, ErrInvalidType\n\t}\n\n\tresp := make(map[string]string, len(elemMap))\n\tfor i, val := range elemMap {\n\t\tresp[i] = val\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "a1f122130cf597ec60713c7a781764f0", "score": "0.510344", "text": "func (m *InMemory) Get(key string) (string, bool, error) {\n\tm.mu.RLock()\n\tvalue, ok := m.data[key]\n\tm.mu.RUnlock()\n\n\treturn value, ok, nil\n}", "title": "" }, { "docid": "5dd6efa6a1ae4f99ed03e30949312e63", "score": "0.5090531", "text": "func (m *StringMap) Get(key string) (interface{}, bool) {\n\tval, ok := (*m)[key]\n\treturn val, ok\n}", "title": "" }, { "docid": "915307b88cfc7a0ce64074fe858c7997", "score": "0.5087698", "text": "func (m *Map) Get(ctx context.Context, key interface{}) (interface{}, error) {\n\tlid := extractLockID(ctx)\n\tif keyData, err := m.validateAndSerialize(key); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\trequest := codec.EncodeMapGetRequest(m.name, keyData, lid)\n\t\tif response, err := m.invokeOnKey(ctx, request, keyData); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\treturn m.convertToObject(codec.DecodeMapGetResponse(response))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6481cc473abdd5903a1c2ba030fbdc92", "score": "0.5081559", "text": "func (hm *HashMap) Get(key int) (value string, ok bool) {\n\thm.RLock()\n\tresult, ok := hm.data[key-1]\n\thm.RUnlock()\n\treturn result, ok\n}", "title": "" }, { "docid": "253087b71f15eadaedf48bd38c673e99", "score": "0.50787044", "text": "func (this *MyHashMap) Get(key int) int {\n\tpos := key / 1000\n\tarr := this.arr[pos]\n\tfor _, v := range arr {\n\t\tif v[0] == key {\n\t\t\treturn v[1]\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "bb7136d6de446badcec35cd99f5580f4", "score": "0.50761986", "text": "func (m *Map) Get(key maps.Key) (maps.Value, bool) {\n\tv, ok := m.m[key]\n\treturn v, ok\n}", "title": "" }, { "docid": "72ff7286185cf1654d111c94c02344f7", "score": "0.50760806", "text": "func getMapKey(\n\tpath string, data map[string]interface{}, addMissing bool,\n) (m map[string]interface{}, key string) {\n\tparts := strings.SplitN(path, \".\", 2)\n\n\tval, ok := data[parts[0]]\n\tif !ok {\n\t\tif addMissing {\n\t\t\tif len(parts) == 2 {\n\t\t\t\tval = map[string]interface{}{}\n\t\t\t\tdata[parts[0]] = val\n\t\t\t} else {\n\t\t\t\t// We'll return data, parts[0] below\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil, \"\"\n\t\t}\n\t}\n\n\tif len(parts) == 1 {\n\t\treturn data, parts[0]\n\t} else {\n\t\tvalMap, ok := val.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, \"\"\n\t\t}\n\t\treturn getMapKey(parts[1], valMap, addMissing)\n\t}\n}", "title": "" }, { "docid": "10a93329c7f928f38f325a538c73ac33", "score": "0.5072727", "text": "func (hashMap *HashMap) Get(key string) interface{} {\n\tindex := hashMap.findIndex(key)\n\tif index == -1 {\n\t\treturn nil\n\t}\n\n\treturn hashMap.data[index].value\n}", "title": "" }, { "docid": "abca4db6d0df38a8c4448e2f9d8dcafe", "score": "0.5072401", "text": "func (d Map) Get(keypath string) interface{} {\n\tvar segs []string = strings.Split(keypath, \".\")\n\tobj := d\n\tfor fieldIndex, field := range segs {\n\t\tif fieldIndex == len(segs)-1 {\n\t\t\treturn obj[field]\n\t\t}\n\t\tswitch obj[field].(type) {\n\t\tcase Map:\n\t\t\tobj = obj[field].(Map)\n\t\tcase map[string]interface{}:\n\t\t\tobj = Map(obj[field].(map[string]interface{}))\n\t\t}\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "6bbb53b7068ac8c6b4bf1aecc5d6d409", "score": "0.5070492", "text": "func (o *SafeMap) Get(key string) (val interface{}) {\n val,_ = o.Load(key)\n\treturn\n}", "title": "" }, { "docid": "e0eacf26e7a2284e3f6c6acd12178ab3", "score": "0.506116", "text": "func (m concurrentMap) Get(key uint64) (*entry, bool) {\n\t// Get shard\n\tshard := m.getShard(key)\n\t// shard.RLock()\n\t// Get item from shard.\n\tval, ok := shard.items[key]\n\t// shard.RUnlock()\n\treturn val, ok\n}", "title": "" }, { "docid": "825faef69b2a78e3077ff519b5a4f9c8", "score": "0.5057556", "text": "func (in *Ini) Get(secName, subName, key, def string) (val string, ok bool) {\n\tif len(in.secs) == 0 || len(secName) == 0 || len(key) == 0 {\n\t\treturn def, false\n\t}\n\n\tx := len(in.secs) - 1\n\tsec := strings.ToLower(secName)\n\n\tfor ; x >= 0; x-- {\n\t\tif in.secs[x].nameLower != sec {\n\t\t\tcontinue\n\t\t}\n\n\t\tif in.secs[x].sub != subName {\n\t\t\tcontinue\n\t\t}\n\n\t\tval, ok = in.secs[x].get(key, def)\n\t\tif ok {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn def, false\n}", "title": "" }, { "docid": "ae38e7d34e1092e31b7f6603f6628ea4", "score": "0.505537", "text": "func (lhm *linkedhashmap) Get(key interface{}) interface{} {\n\tif node, ok := lhm.container[key]; ok {\n\t\treturn node.value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "19b483289eef57819a08a9ae527f27d4", "score": "0.50412726", "text": "func (m *Mapper) GetFromKey(resourceKey string, existingTags *map[string]string) (*map[string]string, error) {\n\tvar (\n\t\tmatch bool\n\t\terr error\n\t)\n\tresult := make(map[string]string)\n\tfor _, keyM := range m.KeyMap {\n\t\tif match, err = regexp.MatchString(\"(?i)^\"+keyM.KeyPattern+\"$\", resourceKey); err != nil {\n\t\t\treturn &result, err\n\t\t}\n\t\tif match {\n\t\t\tfor _, dst := range keyM.Destination {\n\t\t\t\tif _, ok := (*existingTags)[dst.Name]; ok {\n\t\t\t\t\tcontinue // skip if tag already in existingTags\n\t\t\t\t}\n\t\t\t\tif _, ok := result[dst.Name]; ok {\n\t\t\t\t\tcontinue // skip if tag already set\n\t\t\t\t}\n\t\t\t\tresult[dst.Name] = dst.Value\n\t\t\t}\n\t\t}\n\t}\n\treturn &result, err\n}", "title": "" }, { "docid": "82d6684885bec58f7127772f29b6b74c", "score": "0.50240546", "text": "func (c *MapCacheProvider) Get(namespace string, key string) (rv interface{}, err error) {\n\tns := c.getNamespace(namespace)\n\trv, ok := ns.data[key]\n\tif !ok {\n\t\terr = NotFoundError\n\t}\n\treturn\n}", "title": "" }, { "docid": "3276d6382631a9063d83eb1a38f3c562", "score": "0.50219256", "text": "func (this *MyHashMap) Get(key int) int {\n\treturn this.data[key]\n}", "title": "" }, { "docid": "2566529784766c4b98711520ca0867ef", "score": "0.5015371", "text": "func (m ConcurrentMap) Get(key string) (interface{}, bool) {\n\t// Get shard\n\tshard := m.GetShard(key)\n\tshard.RLock()\n\t// Get item from shard.\n\tval, ok := shard.items[key]\n\tshard.RUnlock()\n\treturn val, ok\n}", "title": "" }, { "docid": "3f8c0667b12004c809ed735f5fbc11d0", "score": "0.49980435", "text": "func (s *serviceCache) GetByKey(key string) (interface{}, bool, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tif v, ok := s.serviceMap[key]; ok {\n\t\treturn v, true, nil\n\t}\n\treturn nil, false, nil\n}", "title": "" }, { "docid": "3f8c0667b12004c809ed735f5fbc11d0", "score": "0.49980435", "text": "func (s *serviceCache) GetByKey(key string) (interface{}, bool, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tif v, ok := s.serviceMap[key]; ok {\n\t\treturn v, true, nil\n\t}\n\treturn nil, false, nil\n}", "title": "" }, { "docid": "6c1f5c75670b4e3c60052dfb4da5d01b", "score": "0.49952173", "text": "func (m *Map) Get(key interface{}) (value interface{}) {\n\tvalue, _ = m.GetOk(key)\n\treturn\n}", "title": "" }, { "docid": "d3a68337edb5e6e57f3c4357db315b20", "score": "0.4992122", "text": "func (p ChMap) Get(key interface{}) (interface{}, bool) {\n\tv, ok := p.data[key]\n\treturn v, ok\n}", "title": "" }, { "docid": "adcc4522ef7e92db00a858996187a057", "score": "0.49906507", "text": "func (c *ConfigMap) Load(key string) (*string, error) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tcmap, err := c.getOrCreate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif val, ok := cmap.Data[key]; ok {\n\t\treturn &val, nil\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "f254306e0ef0e926faf56809649fb62a", "score": "0.49865475", "text": "func (c *Configuration) Get(key string) string {\n\treturn c.m[key]\n}", "title": "" }, { "docid": "7413bd62cdf906f0152bf6e10114d06e", "score": "0.498549", "text": "func (r *Retriever) getCRKey(section string, key string) (string, error) {\n\tobj := r.plan.CR.Object\n\tobjName := r.plan.CR.GetName()\n\tlogger := r.logger.WithValues(\"CR.Name\", objName, \"CR.section\", section, \"CR.key\", key)\n\tlogger.Info(\"Reading CR attributes...\")\n\n\tsectionMap, exists := obj[section]\n\tif !exists {\n\t\treturn \"\", fmt.Errorf(\"Can't find '%s' section in CR named '%s'\", section, objName)\n\t}\n\n\treturn r.getNestedValue(key, sectionMap)\n}", "title": "" }, { "docid": "3dff8e9c0e187bbc505f4ba8ff8cda71", "score": "0.49833634", "text": "func (m MapCache) Get(_ context.Context, key string) (value interface{}, ok bool) {\n\tv, ok := m[key]\n\treturn v, ok\n}", "title": "" }, { "docid": "1779caaeba17c40e891b644f103a7353", "score": "0.49760175", "text": "func (a *WordsApiService) GetSection(ctx context.Context, data *models.GetSectionRequest) (models.SectionResponse, *http.Response, error) {\n var (\n successPayload models.SectionResponse\n )\n\n requestData, err := data.CreateRequestData();\n if err != nil {\n return successPayload, nil, err\n }\n\n requestData.Path = a.client.cfg.BaseUrl + requestData.Path;\n\n r, err := a.client.prepareRequest(ctx, requestData)\n if err != nil {\n return successPayload, nil, err\n }\n\n response, err := a.client.callAPI(r)\n\n if err != nil || response == nil {\n return successPayload, nil, err\n }\n\n defer response.Body.Close()\n \n\n if response.StatusCode == 401 {\n return successPayload, nil, errors.New(\"Access is denied\")\n }\n if response.StatusCode >= 300 {\n var apiError models.WordsApiErrorResponse;\n\n if err = json.NewDecoder(response.Body).Decode(&apiError); err != nil {\n return successPayload, nil, err\n }\n\n return successPayload, response, &apiError\n }\n if err = json.NewDecoder(response.Body).Decode(&successPayload); err != nil {\n return successPayload, response, err\n }\n\n return successPayload, response, err\n}", "title": "" }, { "docid": "9857a042d1e442bf47176dab4a48fd07", "score": "0.49652302", "text": "func (l *Parser) Get(key string) interface{} {\n\treturn l.k.Get(key)\n}", "title": "" }, { "docid": "4c2b0840bc93bdc23cc4a721807aa978", "score": "0.4957076", "text": "func (self *MemoryConfig) Get(key string) string {\n\tif self.data == nil {\n\t\tself.init()\n\t}\n\treturn self.data[key]\n}", "title": "" }, { "docid": "5fa3f21326fcf4e69c9cde79e38f1234", "score": "0.49565917", "text": "func (f *FixedHashMap) Get(key string) interface{} {\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "82813382eb44256715b30c1e4bc2482b", "score": "0.49543908", "text": "func (ck *Clerk) Get(key string) string {\n\targs := GetArgs{}\n\targs.Key = key\n\n\tfor {\n\t\tshard := key2shard(key)\n\t\tgid := ck.config.Shards[shard]\n\t\tif servers, ok := ck.config.Groups[gid]; ok {\n\t\t\t// try each server for the shard.\n\t\t\tfor si := 0; si < len(servers); si++ {\n\t\t\t\tsrv := ck.make_end(servers[si])\n\t\t\t\tvar reply GetReply\n\t\t\t\tok := srv.Call(\"ShardKV.Get\", &args, &reply)\n\t\t\t\tif ok && (reply.Err == OK || reply.Err == ErrNoKey) {\n\t\t\t\t\treturn reply.Value\n\t\t\t\t}\n\t\t\t\tif ok && (reply.Err == ErrWrongGroup) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\t// ... not ok, or ErrWrongLeader\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(100 * time.Millisecond)\n\t\t// ask controler for the latest configuration.\n\t\tck.config = ck.sm.Query(-1)\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "f0a4bdf3b763f8a2882fc46dcf0fd29e", "score": "0.4948299", "text": "func (this *MyHashMap) Get(key int) int {\n\treturn this.arr[key]\n}", "title": "" }, { "docid": "4a5b506bb30abf9871d7516749df0fa4", "score": "0.494009", "text": "func (f *File) Section(name string) *Section {\n\tfor _, s := range f.Sections {\n\t\tif s.Name == name {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d70b06e8ffdc9bf4197152aa7f0d7b64", "score": "0.49384075", "text": "func (r *StringMap) Get(key string) string {\n\tr.RLock()\n\tdefer r.RUnlock()\n\treturn r.M[key]\n}", "title": "" }, { "docid": "e3f20cc349d31147f063c870cc06ad42", "score": "0.49375203", "text": "func (src NestedParameterMap) GetNestedMap(key string) NestedParameterMap {\n\treturn src[key].(NestedParameterMap)\n}", "title": "" }, { "docid": "0df039a06e32775f0eb9edac58decfa9", "score": "0.49311075", "text": "func Get(key string) (map[string]string, error) {\n\tres, err := client.Get(context.Background(), &pb.GetRequest{Key: key})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif res.Value == \"\" {\n\t\treturn nil, errors.New(\"Key not recognized\")\n\t}\n\n\tdata := make(map[string]string)\n\tdata[res.Key] = res.Value\n\treturn data, nil\n}", "title": "" }, { "docid": "7ce7fdfe9677468c25e474e0ba9e6111", "score": "0.49303284", "text": "func (m metadata) Get(key string) interface{} {\n\treturn m[key]\n}", "title": "" }, { "docid": "286ca5ce1d970a5a081daf2e70dc02f9", "score": "0.4922895", "text": "func (dict *baseDict) Get(key string) interface{} {\n\tdict.Lock()\n\tdefer dict.Unlock()\n\n\treturn dict.m[key]\n}", "title": "" }, { "docid": "2577d029fbe65db0aead315e51faf8c4", "score": "0.49224535", "text": "func (my *Tuner) Section(key string) *Tuner {\n\tif my.params[key] != nil {\n\t\tmy.current = key\n\t}\n\t//fmt.Print(\"\\n111\")\n\treturn my\n}", "title": "" }, { "docid": "b82fec4de705990d51fe2b4da77a7210", "score": "0.4911398", "text": "func (m *sectionLookup) getCategory(category string) []*proto.Section {\n\treturn m.byCategory[category]\n}", "title": "" }, { "docid": "076ea669dd3de7328c102533161bc8ee", "score": "0.49111435", "text": "func (a *archive) Get(key string) (string, bool) {\n\ta.mutex.RLock()\n\tv, ok := a.kvs[key]\n\ta.mutex.RUnlock()\n\treturn v, ok\n}", "title": "" }, { "docid": "dbb8ae600fcc5e1bde630e8e67b224ee", "score": "0.49106693", "text": "func (lm *LinkedMap) Get(k string) (interface{}, bool) {\n\tif lm == nil {\n\t\treturn nil, false\n\t}\n\n\tv, ok := lm.dataMap[k]\n\n\treturn v, ok\n}", "title": "" }, { "docid": "b83ab8d40c99b1982949479ba099a16d", "score": "0.4907829", "text": "func (c Config) Get(section string, out interface{}) (err error) {\n\tsectionJson := c.jsonData[section]\n\tif sectionJson == nil {\n\t\treturn fmt.Errorf(\"Could not find config section %s in config file %s\", section, c.configFileName)\n\t}\n\n\tmarshalled, err := json.Marshal(sectionJson)\n\tif err == nil {\n\t\terr = json.Unmarshal(marshalled, &out)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "db08d3bd507385f69c5601214a6549e2", "score": "0.4887755", "text": "func getLoaded(section string) interface{} {\n\treturn findValue(strings.Split(section, \".\"), globalConfig)\n}", "title": "" }, { "docid": "b527d6f4269c5022ee05b9e9055e0727", "score": "0.48787424", "text": "func (op Options) GetMap(key string) map[string]interface{} {\n\tm, ok := op[key]\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tswitch v := m.(type) {\n\tcase Options:\n\t\treturn v\n\tcase map[string]interface{}:\n\t\treturn v\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "52df8c22431107d3eec5e4f11490c64c", "score": "0.48758948", "text": "func (m *Map) Load(key interface{}) (value interface{}, ok bool) {}", "title": "" }, { "docid": "27b378868dbc78750ed9c4192b6a5217", "score": "0.48720333", "text": "func (in *Ini) Section(secName, subName string) (sec *Section) {\n\tif len(secName) == 0 {\n\t\treturn nil\n\t}\n\n\tsec = &Section{\n\t\tname: secName,\n\t\tsub: subName,\n\t}\n\n\tsecName = strings.ToLower(secName)\n\tfor x := 0; x < len(in.secs); x++ {\n\t\tif secName != in.secs[x].nameLower {\n\t\t\tcontinue\n\t\t}\n\t\tif subName != in.secs[x].sub {\n\t\t\tcontinue\n\t\t}\n\n\t\tsec.merge(in.secs[x])\n\t}\n\treturn\n}", "title": "" }, { "docid": "d5807f74a480d38979b7fa650da1d667", "score": "0.48717684", "text": "func (c *Config) Get(key string) interface{} {\n\treturn c.data[key]\n}", "title": "" }, { "docid": "ad9b0d01f7889adc561ac7f38e7223d2", "score": "0.4864702", "text": "func Get(r *http.Request, key interface{}) interface{} {\n\tmutex.RLock()\n\tif ctx := data[r]; ctx != nil {\n\t\tvalue := ctx[key]\n\t\tmutex.RUnlock()\n\t\treturn value\n\t}\n\tmutex.RUnlock()\n\treturn nil\n}", "title": "" }, { "docid": "e1a1b880cfffa7ebda65923406e779cc", "score": "0.4841083", "text": "func (i *IniConf) HasSection(sectionName string) bool {\n\ti.mutex.RLock()\n\tdefer i.mutex.RUnlock()\n\tidxName := i.idxName(sectionName)\n\t_, result := i.sectionMap[idxName]\n\treturn result\n}", "title": "" }, { "docid": "3c81eb556a8d135196e07a7ed47d7bab", "score": "0.48340914", "text": "func (sr *sectionsReader) readSection(r *readpos.ReadPos) (bool, error) {\n\tm := sr.m\n\n\tlogger.Println(\"Reading section ID\")\n\tid, err := r.ReadByte()\n\tif err == io.EOF {\n\t\treturn true, nil\n\t} else if err != nil {\n\t\treturn false, err\n\t}\n\tif id != uint8(SectionIDCustom) {\n\t\tif id <= sr.lastSecOrder {\n\t\t\treturn false, fmt.Errorf(\"wasm: sections must occur at most once and in the prescribed order\")\n\t\t}\n\t\tsr.lastSecOrder = id\n\t}\n\n\ts := RawSection{ID: SectionID(id)}\n\n\tlogger.Println(\"Reading payload length\")\n\n\tpayloadDataLen, err := leb128.ReadVarUint32(r)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tlogger.Printf(\"Section payload length: %d\", payloadDataLen)\n\n\ts.Start = r.CurPos\n\n\tsectionBytes := new(bytes.Buffer)\n\n\tsectionBytes.Grow(int(getInitialCap(payloadDataLen)))\n\tsectionReader := io.LimitReader(io.TeeReader(r, sectionBytes), int64(payloadDataLen))\n\n\tvar sec Section\n\tswitch s.ID {\n\tcase SectionIDCustom:\n\t\tlogger.Println(\"section custom\")\n\t\tcs := &SectionCustom{}\n\t\tm.Customs = append(m.Customs, cs)\n\t\tsec = cs\n\tcase SectionIDType:\n\t\tlogger.Println(\"section type\")\n\t\tm.Types = &SectionTypes{}\n\t\tsec = m.Types\n\tcase SectionIDImport:\n\t\tlogger.Println(\"section import\")\n\t\tm.Import = &SectionImports{}\n\t\tsec = m.Import\n\tcase SectionIDFunction:\n\t\tlogger.Println(\"section function\")\n\t\tm.Function = &SectionFunctions{}\n\t\tsec = m.Function\n\tcase SectionIDTable:\n\t\tlogger.Println(\"section table\")\n\t\tm.Table = &SectionTables{}\n\t\tsec = m.Table\n\tcase SectionIDMemory:\n\t\tlogger.Println(\"section memory\")\n\t\tm.Memory = &SectionMemories{}\n\t\tsec = m.Memory\n\tcase SectionIDGlobal:\n\t\tlogger.Println(\"section global\")\n\t\tm.Global = &SectionGlobals{}\n\t\tsec = m.Global\n\tcase SectionIDExport:\n\t\tlogger.Println(\"section export\")\n\t\tm.Export = &SectionExports{}\n\t\tsec = m.Export\n\tcase SectionIDStart:\n\t\tlogger.Println(\"section start\")\n\t\tm.Start = &SectionStartFunction{}\n\t\tsec = m.Start\n\tcase SectionIDElement:\n\t\tlogger.Println(\"section element\")\n\t\tm.Elements = &SectionElements{}\n\t\tsec = m.Elements\n\tcase SectionIDCode:\n\t\tlogger.Println(\"section code\")\n\t\tm.Code = &SectionCode{}\n\t\tsec = m.Code\n\tcase SectionIDData:\n\t\tlogger.Println(\"section data\")\n\t\tm.Data = &SectionData{}\n\t\tsec = m.Data\n\tdefault:\n\t\treturn false, InvalidSectionIDError(s.ID)\n\t}\n\terr = sec.ReadPayload(sectionReader)\n\tif err != nil {\n\t\tlogger.Println(err)\n\t\treturn false, err\n\t}\n\ts.End = r.CurPos\n\ts.Bytes = sectionBytes.Bytes()\n\t*sec.GetRawSection() = s\n\tswitch s.ID {\n\tcase SectionIDCode:\n\t\ts := m.Code\n\t\tif m.Function == nil || len(m.Function.Types) == 0 {\n\t\t\treturn false, MissingSectionError(SectionIDFunction)\n\t\t}\n\t\tif len(m.Function.Types) != len(s.Bodies) {\n\t\t\treturn false, errors.New(\"wasm: the number of entries in the function and code section are unequal\")\n\t\t}\n\t\tif m.Types == nil {\n\t\t\treturn false, MissingSectionError(SectionIDType)\n\t\t}\n\t\tfor i := range s.Bodies {\n\t\t\ts.Bodies[i].Module = m\n\t\t}\n\t}\n\tm.Sections = append(m.Sections, sec)\n\treturn false, nil\n}", "title": "" }, { "docid": "624af1e2705b6faccb81c0e807a98f39", "score": "0.4827672", "text": "func (m *ClientMap) Get(k string)*network.TcpClient {\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": "bd0b01e450378588c20411c5760a6549", "score": "0.4815012", "text": "func (a *Client) GetDistrictForSection(params *GetDistrictForSectionParams, authInfo runtime.ClientAuthInfoWriter) (*GetDistrictForSectionOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetDistrictForSectionParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getDistrictForSection\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/sections/{id}/district\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetDistrictForSectionReader{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.(*GetDistrictForSectionOK)\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 getDistrictForSection: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "69428703aaf3dcf3bf0d42eb1046e4f0", "score": "0.480958", "text": "func getSections(mdString string) map[string]string {\n\tparsedContent := strings.Split(\"\\n\"+mdString, \"\\n## \")\n\tsections := make(map[string]string, len(parsedContent))\n\tfor _, s := range parsedContent {\n\t\tif strings.HasPrefix(s, \"#\") {\n\t\t\t// not a H2 Section\n\t\t\tcontinue\n\t\t}\n\t\tparts := strings.SplitN(s, \"\\n\", 2)\n\t\tif len(parts) == 2 {\n\t\t\tsections[strings.ToLower(parts[0])] = parts[1]\n\t\t}\n\t}\n\treturn sections\n}", "title": "" }, { "docid": "dcef4b49961bf0e26175f70a41055a3c", "score": "0.48090664", "text": "func (m *LGMap) Get(k int) (interface{},bool) {\n //m.lock.RLock()\n //defer m.lock.RUnlock()\n\n val, ok := m.bm[k]\n return val,ok\n}", "title": "" }, { "docid": "cd45a656b7a0ab85cd39680a4efc9e77", "score": "0.48035967", "text": "func (c *Config) GetValue(section, name string) (string, error) {\n\tc.ReadList()\n\tconf := c.ReadList()\n\n\tfor key, value := range conf {\n\t\tif key == section {\n\t\t\treturn value[name], nil\n\t\t}\n\t}\n\n\treturn \"\", errors.New(\"no value\")\n}", "title": "" }, { "docid": "f7762096480ce7db22393529f942d5c2", "score": "0.4798914", "text": "func (hm *HMap) GetByMainKey(mainKey string) ([]interface{}, error) {\n\tif hm.M != nil {\n\t\thm.M.RLock()\n\t\tdefer hm.M.RUnlock()\n\t}\n\n\tif _, ok := hm.Content[mainKey]; !ok {\n\t\treturn nil, errors.New(\"no such mainKey key \" + mainKey)\n\t}\n\trs := make([]interface{}, 0, 5)\n\ttmp := hm.Content[mainKey]\n\tfor _, v := range tmp {\n\t\trs = append(rs, v)\n\t}\n\treturn rs, nil\n}", "title": "" }, { "docid": "5422470a6a0380cd3d58e8287a4a399d", "score": "0.47907302", "text": "func (m *Map) Get(ctx context.Context, key interface{}) (interface{}, error) {\n\tif m.hasNearCache {\n\t\treturn m.ncm.Get(ctx, m, key)\n\t}\n\tkeyData, err := m.validateAndSerialize(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn m.getFromRemote(ctx, keyData)\n}", "title": "" }, { "docid": "ce30eaa8ce71139627ed6338e6d187ff", "score": "0.47834277", "text": "func (m *ConcurrentMapString) Get(key string) (string, error) {\n\tm.RLock()\n\tdefer m.RUnlock()\n\n\tv, exists := m.data[key]\n\n\tif !exists {\n\t\treturn \"\", fmt.Errorf(\"ConcurrentMapString: Cannot get map value, key does not exist: %q\", key)\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "abd0254fa856f5e1bfd89d23023a31d4", "score": "0.477568", "text": "func (cm *ConfigMap) Get(key interface{}, newConfig func() (interface{}, error)) (interface{}, error) {\n\tcm.mu.Lock()\n\tdefer cm.mu.Unlock()\n\n\tcfg := cm.m[key]\n\tif cfg != nil {\n\t\treturn cfg, nil\n\t}\n\tcfg, err := newConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcm.m[key] = cfg\n\tcm.entriesCount.Inc()\n\treturn cfg, nil\n}", "title": "" }, { "docid": "e588f6be1b5e454217c84aeae4481be6", "score": "0.47753343", "text": "func (this *MyHashMap) Get(key int) int {\n\thash := key % capacity\n\tcurr := this.Key_Space[hash]\n\n\tif curr == nil {\n\t\treturn -1\n\t}\n\n\tfor curr != nil {\n\t\tif curr.Key == key {\n\t\t\treturn curr.Value\n\t\t}\n\t\tcurr = curr.Next\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "100665e17cec5197dc6af398a6fd09a7", "score": "0.47737092", "text": "func GetMap() map[string]int { //string llave, int valor\n\n\t//inicializar mapa forma 1\n\tmapTest := make(map[string]int)\n\tmapTest[\"llave1\"] = 1\n\tmapTest[\"llave2\"] = 10\n\tfmt.Println(mapTest)\n\n\t//inicializar mapa forma 2\n\tmapTest2 := map[string]int{\n\t\t\"Juan\": 18,\n\t\t\"Laura\": 23,\n\t\t\"Tatis\": 16,\n\t}\n\n\tdelete(mapTest, \"llave1\") //Eliminar llaves\n\treturn mapTest2\n}", "title": "" }, { "docid": "cef32ade187a66bb65de7bd929a5f231", "score": "0.477285", "text": "func Get(key string) (SDBInterface, *SDBError) {\n\tmutex.Lock() // lock required as of go 1.6 concurrent read and write are not safe in map\n\tdefer mutex.Unlock()\n\tif val, ok := sdbMap[key]; !ok {\n\t\treturn nil, getErrObj(ErrKeyNotPresent, \"given key:\"+key)\n\t} else {\n\t\treturn val, nil\n\t}\n}", "title": "" } ]
40c0b4802bfb3810de9adb75b1b21e21
New creates a new Service. It uses the provided http.Client for requests. Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
[ { "docid": "c7bbe3273639d896c356f831a30227f0", "score": "0.7749558", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Anomalies = NewAnomaliesService(s)\n\ts.Apps = NewAppsService(s)\n\ts.Vitals = NewVitalsService(s)\n\treturn s, nil\n}", "title": "" } ]
[ { "docid": "968ec065a46d8ffaf595b0404978491b", "score": "0.79477084", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Groups = NewGroupsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "6f9e7b2dc4d65818364247ce195c116d", "score": "0.79144627", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.V1 = NewV1Service(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "62e7e051b0bcdd68b6185775ffe90bc1", "score": "0.790559", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.AgentUsers = NewAgentUsersService(s)\n\ts.Devices = NewDevicesService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "880dc2c6c8c3f450c79ed099839fec1e", "score": "0.7896998", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Accounts = NewAccountsService(s)\n\ts.Contacts = NewContactsService(s)\n\ts.Locations = NewLocationsService(s)\n\ts.Settings = NewSettingsService(s)\n\ts.Subscriptions = NewSubscriptionsService(s)\n\ts.Timeline = NewTimelineService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "6e5c76dcf37a0437429f3a8dc7425711", "score": "0.788235", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Locations = NewLocationsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "41fba710ccbab188acb81fee102f8a8c", "score": "0.7879264", "text": "func New(ctrlClient client.Client) *Service {\n\treturn &Service{\n\t\tClient: ctrlClient,\n\t}\n}", "title": "" }, { "docid": "818cfd66aa7bf8d8883878d569461119", "score": "0.7871823", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Organizations = NewOrganizationsService(s)\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "e45badb261cd31917d5e3992a7704b6e", "score": "0.78696495", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Admin = NewAdminService(s)\n\ts.Cursor = NewCursorService(s)\n\ts.TopicStats = NewTopicStatsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "e45badb261cd31917d5e3992a7704b6e", "score": "0.78696495", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Admin = NewAdminService(s)\n\ts.Cursor = NewCursorService(s)\n\ts.TopicStats = NewTopicStatsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.78306067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "96696a0aedddc9f5871bed4e94283605", "score": "0.78188014", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Controller = NewControllerService(s)\n\ts.Debugger = NewDebuggerService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "3da62ebea2e1d8a022b2edf150fee3e3", "score": "0.78165406", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Namespaces = NewNamespacesService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "e3406fbb2ee2159df0c194177e6e7113", "score": "0.7815226", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Adclients = NewAdclientsService(s)\n\ts.Adunits = NewAdunitsService(s)\n\ts.Customchannels = NewCustomchannelsService(s)\n\ts.Reports = NewReportsService(s)\n\ts.Urlchannels = NewUrlchannelsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "f25ffacab4784c776b696ae53149014b", "score": "0.78117025", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Divisions = NewDivisionsService(s)\n\ts.Elections = NewElectionsService(s)\n\ts.Representatives = NewRepresentativesService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "95a6462ade966b14340601ce1492df73", "score": "0.7810916", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Bookshelves = NewBookshelvesService(s)\n\ts.Cloudloading = NewCloudloadingService(s)\n\ts.Dictionary = NewDictionaryService(s)\n\ts.Familysharing = NewFamilysharingService(s)\n\ts.Layers = NewLayersService(s)\n\ts.Myconfig = NewMyconfigService(s)\n\ts.Mylibrary = NewMylibraryService(s)\n\ts.Notification = NewNotificationService(s)\n\ts.Onboarding = NewOnboardingService(s)\n\ts.Personalizedstream = NewPersonalizedstreamService(s)\n\ts.Promooffer = NewPromoofferService(s)\n\ts.Series = NewSeriesService(s)\n\ts.Volumes = NewVolumesService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "f764fbded20bc6ba2bafb44d1f46a145", "score": "0.7803067", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Bot = NewBotService(s)\n\ts.Bots = NewBotsService(s)\n\ts.Queues = NewQueuesService(s)\n\ts.Server = NewServerService(s)\n\ts.Task = NewTaskService(s)\n\ts.Tasks = NewTasksService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "345e3a47d6f9b7d15ac7bc84cbf550c6", "score": "0.77998006", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.ContactGroups = NewContactGroupsService(s)\n\ts.OtherContacts = NewOtherContactsService(s)\n\ts.People = NewPeopleService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "a99a773d544a3030171eeed52269ec43", "score": "0.77967286", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.AvailableProjects = NewAvailableProjectsService(s)\n\ts.Operations = NewOperationsService(s)\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "cc4f7e8e5ac77812203774854f914045", "score": "0.77961904", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.GithubDotComWebhook = NewGithubDotComWebhookService(s)\n\ts.Locations = NewLocationsService(s)\n\ts.Operations = NewOperationsService(s)\n\ts.Projects = NewProjectsService(s)\n\ts.V1 = NewV1Service(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "1bbf9ef4bf0599215c1b006e265a095a", "score": "0.7791892", "text": "func New(store store.ServiceInterface, auth auth.ServiceInterface, transport transport.ServiceInterface, options Options) *Service {\n\tsetDefaultOptions(&options)\n\treturn &Service{\n\t\tstore: store,\n\t\tauth: auth,\n\t\ttransport: transport,\n\t\toptions: options,\n\t}\n}", "title": "" }, { "docid": "d0e5b0605b223e969c6e51814b470a24", "score": "0.778383", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.AccountSummaries = NewAccountSummariesService(s)\n\ts.Accounts = NewAccountsService(s)\n\ts.Properties = NewPropertiesService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "dccc8d8671cfc38aeafb915e58acf0f5", "score": "0.77776223", "text": "func New(options ...Option) *Service {\n\tns := &Service{}\n\n\tfor _, op := range options {\n\t\top(ns)\n\t}\n\n\treturn ns\n}", "title": "" }, { "docid": "eb075a04ed9af65f8d583a922ea72794", "score": "0.7776534", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Assets = NewAssetsService(s)\n\ts.Users = NewUsersService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "a779b8c920af4b1c50a4de789d3537d6", "score": "0.7775743", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Asps = NewAspsService(s)\n\ts.Channels = NewChannelsService(s)\n\ts.Chromeosdevices = NewChromeosdevicesService(s)\n\ts.Customer = NewCustomerService(s)\n\ts.Customers = NewCustomersService(s)\n\ts.DomainAliases = NewDomainAliasesService(s)\n\ts.Domains = NewDomainsService(s)\n\ts.Groups = NewGroupsService(s)\n\ts.Members = NewMembersService(s)\n\ts.Mobiledevices = NewMobiledevicesService(s)\n\ts.Orgunits = NewOrgunitsService(s)\n\ts.Privileges = NewPrivilegesService(s)\n\ts.Resources = NewResourcesService(s)\n\ts.RoleAssignments = NewRoleAssignmentsService(s)\n\ts.Roles = NewRolesService(s)\n\ts.Schemas = NewSchemasService(s)\n\ts.Tokens = NewTokensService(s)\n\ts.TwoStepVerification = NewTwoStepVerificationService(s)\n\ts.Users = NewUsersService(s)\n\ts.VerificationCodes = NewVerificationCodesService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "6cae444c8661fae8ae0f3f61f5e96b5b", "score": "0.7765289", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Approvals = NewApprovalsService(s)\n\ts.Components = NewComponentsService(s)\n\ts.Groups = NewGroupsService(s)\n\ts.Issues = NewIssuesService(s)\n\ts.Users = NewUsersService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "0ffe61ac3c84d9c2e6fc9c5fe6350292", "score": "0.7763239", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Devices = NewDevicesService(s)\n\ts.Enterprises = NewEnterprisesService(s)\n\ts.Entitlements = NewEntitlementsService(s)\n\ts.Grouplicenses = NewGrouplicensesService(s)\n\ts.Grouplicenseusers = NewGrouplicenseusersService(s)\n\ts.Installs = NewInstallsService(s)\n\ts.Managedconfigurationsfordevice = NewManagedconfigurationsfordeviceService(s)\n\ts.Managedconfigurationsforuser = NewManagedconfigurationsforuserService(s)\n\ts.Managedconfigurationssettings = NewManagedconfigurationssettingsService(s)\n\ts.Permissions = NewPermissionsService(s)\n\ts.Products = NewProductsService(s)\n\ts.Serviceaccountkeys = NewServiceaccountkeysService(s)\n\ts.Storelayoutclusters = NewStorelayoutclustersService(s)\n\ts.Storelayoutpages = NewStorelayoutpagesService(s)\n\ts.Users = NewUsersService(s)\n\ts.Webapps = NewWebappsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "f277ab8788c315fe394bfc6ef4daaa0b", "score": "0.77546906", "text": "func NewService(options ...option.ClientOption) *service {\n\treturn &service{\n\t\toptions: options,\n\t}\n}", "title": "" }, { "docid": "75af6efaa8c51aa0197a15f915100dec", "score": "0.77474195", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Alerts = NewAlertsService(s)\n\ts.V1beta1 = NewV1beta1Service(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "5f285c521f2a3662d06cdffee5aacaa6", "score": "0.7733436", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Pagespeedapi = NewPagespeedapiService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "8fe622ed9ff3a4c359da7b2434df5646", "score": "0.7716864", "text": "func NewService() Service { return new(service) }", "title": "" }, { "docid": "a04663454ec25db846de49df7f96dfe3", "score": "0.7708748", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Assets = NewAssetsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "66018044d747de2e4033f9d8bec85148", "score": "0.77060014", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.BillingAccounts = NewBillingAccountsService(s)\n\ts.Folders = NewFoldersService(s)\n\ts.Organizations = NewOrganizationsService(s)\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "93db795f90ea5249eb65a855f80c6fd5", "score": "0.7693622", "text": "func NewService(opt *ServiceOptions) *Service {\n\t// Set default values to missing input parameters\n\tif opt == nil {\n\t\topt = &ServiceOptions{}\n\t}\n\tif len(opt.BaseURL) == 0 {\n\t\topt.BaseURL = defaultAPIEndpoint\n\t}\n\tif opt.HTTPClient == nil {\n\t\tschHTTPpClient := &http.Client{\n\t\t\tTimeout: timeout * time.Second,\n\t\t}\n\t\topt.HTTPClient = schHTTPpClient\n\t}\n\n\t// Get API Key\n\tif len(opt.APIKey) == 0 {\n\t\topt.APIKey = os.Getenv(\"IC_API_KEY\")\n\t}\n\n\tif len(opt.APIVersion) == 0 {\n\t\topt.APIVersion = defaultAPIVersion\n\t}\n\n\tauthenticator := &core.IamAuthenticator{\n\t\tApiKey: opt.APIKey,\n\t}\n\ticc := &ICClient{\n\t\tUserAgent: userAgent,\n\t\thttp: opt.HTTPClient,\n\t\tauthenticator: authenticator,\n\t}\n\n\tc, _ := apiv1.NewClient(opt.BaseURL, apiv1.WithHTTPClient(icc))\n\tcwr, _ := apiv1.NewClientWithResponses(opt.BaseURL, apiv1.WithHTTPClient(icc))\n\n\treturn &Service{\n\t\tclient: c,\n\t\tclientWithResponses: cwr,\n\t\tapiVersion: \"/\" + opt.APIVersion,\n\t\tauthenticator: authenticator,\n\t}\n}", "title": "" }, { "docid": "ffa1a53cbbd1f0c489d48dfb9ed373b0", "score": "0.7679244", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Activities = NewActivitiesService(s)\n\ts.Channels = NewChannelsService(s)\n\ts.CustomerUsageReports = NewCustomerUsageReportsService(s)\n\ts.EntityUsageReports = NewEntityUsageReportsService(s)\n\ts.UserUsageReport = NewUserUsageReportService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "48db379ed4f4cb4fa687e3ca1e3653af", "score": "0.76687855", "text": "func New() *Service {\r\n\treturn &Service{}\r\n}", "title": "" }, { "docid": "c72964d6204f4b9bb03779f9e8071d62", "score": "0.7666591", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Media = NewMediaService(s)\n\ts.Notes = NewNotesService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "e4fee4d123198d281e9ecbe4bdef1097", "score": "0.7663216", "text": "func New() Service {\n\treturn service{}\n}", "title": "" }, { "docid": "6ac220858c441c25a11954298a144a9b", "score": "0.76573867", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Jobs = NewJobsService(s)\n\ts.Media = NewMediaService(s)\n\ts.ReportTypes = NewReportTypesService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "e0a4f5e03f06bd556df09cfe71562fea", "score": "0.7648188", "text": "func New() Service {\n\treturn &service{}\n}", "title": "" }, { "docid": "e0a4f5e03f06bd556df09cfe71562fea", "score": "0.7648188", "text": "func New() Service {\n\treturn &service{}\n}", "title": "" }, { "docid": "e0a4f5e03f06bd556df09cfe71562fea", "score": "0.7648188", "text": "func New() Service {\n\treturn &service{}\n}", "title": "" }, { "docid": "e0a4f5e03f06bd556df09cfe71562fea", "score": "0.7648188", "text": "func New() Service {\n\treturn &service{}\n}", "title": "" }, { "docid": "e0a4f5e03f06bd556df09cfe71562fea", "score": "0.7648188", "text": "func New() Service {\n\treturn &service{}\n}", "title": "" }, { "docid": "7c8a1aafa03a89a1c80945b10aec1df9", "score": "0.7635666", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Customresourcedefinitions = NewCustomresourcedefinitionsService(s)\n\ts.Namespaces = NewNamespacesService(s)\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "8548c8261801e3d808e92eca7d9a7b47", "score": "0.76355046", "text": "func New(client client.ConfigProvider) *Service {\n\treturn &Service{\n\t\tAlias: alias.New(client),\n\t\tKey: key.New(client),\n\t}\n}", "title": "" }, { "docid": "523c89b56f242542c3462ef90664aef1", "score": "0.7624734", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Customers = NewCustomersService(s)\n\ts.Media = NewMediaService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "b5f8e26b84b7f4638231939ff19f83a3", "score": "0.76127976", "text": "func New() (*Service, error) {\n\treturn &Service{}, nil\n}", "title": "" }, { "docid": "d49bfde130053789589a703bb8113130", "score": "0.7597286", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Publications = NewPublicationsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "b7d1bd6c1658972b37d2f3930da8eee8", "score": "0.7588902", "text": "func New() *Service {\n\treturn &Service{}\n}", "title": "" }, { "docid": "b7d1bd6c1658972b37d2f3930da8eee8", "score": "0.7588902", "text": "func New() *Service {\n\treturn &Service{}\n}", "title": "" }, { "docid": "b7d1bd6c1658972b37d2f3930da8eee8", "score": "0.7588902", "text": "func New() *Service {\n\treturn &Service{}\n}", "title": "" }, { "docid": "b7d1bd6c1658972b37d2f3930da8eee8", "score": "0.7588902", "text": "func New() *Service {\n\treturn &Service{}\n}", "title": "" }, { "docid": "bf4d354667e46a5ea421b0c17980a6c7", "score": "0.75515795", "text": "func New() Service {\n\tvar svc Service\n\t{\n\t\tsvc = NewBasicService()\n\t}\n\treturn svc\n}", "title": "" }, { "docid": "41489281ccb0b6c2b580d50f5dc71a61", "score": "0.7549776", "text": "func New(c *rpc.ClientConfig) (s *Service) {\n\ts = &Service{}\n\ts.client = rpc.NewDiscoveryCli(_appid, c)\n\treturn s\n}", "title": "" }, { "docid": "6f9e4965614daf20b1778844971c883f", "score": "0.75411135", "text": "func New(ctx context.Context) *Service {\n\treturn &Service{}\n}", "title": "" }, { "docid": "b449ffc3c449be9ccc233031eee32831", "score": "0.75349706", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Datasets = NewDatasetsService(s)\n\ts.Jobs = NewJobsService(s)\n\ts.Models = NewModelsService(s)\n\ts.Projects = NewProjectsService(s)\n\ts.Routines = NewRoutinesService(s)\n\ts.RowAccessPolicies = NewRowAccessPoliciesService(s)\n\ts.Tabledata = NewTabledataService(s)\n\ts.Tables = NewTablesService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c0bf034edcacbafca3a85e7503880218", "score": "0.7509947", "text": "func New(data Data, options ...Option) (*Service, error) {\n\tdo := Options{}\n\tfor _, option := range options {\n\t\toption.f(&do)\n\t}\n\n\treturn &Service{data: data}, nil\n}", "title": "" }, { "docid": "3d9dea191fdad99bd5b75889c578ea05", "score": "0.750611", "text": "func New(dispatcher Dispatcher, opts ...options.Opt) *Service {\n\tparams := defaultParams()\n\toptions.Apply(params, opts)\n\n\treturn &Service{\n\t\tparams: *params,\n\t\tdispatcher: dispatcher,\n\t}\n}", "title": "" }, { "docid": "960cb430d1e2147f4ea89ee841dbecc7", "score": "0.7503253", "text": "func NewService(opts ...Option) Service {\n\treturn newService(opts...)\n}", "title": "" }, { "docid": "960cb430d1e2147f4ea89ee841dbecc7", "score": "0.7503253", "text": "func NewService(opts ...Option) Service {\n\treturn newService(opts...)\n}", "title": "" }, { "docid": "083287c2c2904e3e00b02dd32b9fa1fc", "score": "0.7484908", "text": "func New(client client.ConfigProvider) *Service {\n\treturn &Service{\n\t\tStack: stack.New(client),\n\t}\n}", "title": "" }, { "docid": "a29b53c80ce66a30589c07cd713ba4f4", "score": "0.7464377", "text": "func New(client *http.Client) (*APIService, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &APIService{client: client, BasePath: basePath}\n\ts.BillingAccounts = NewBillingAccountsService(s)\n\ts.Projects = NewProjectsService(s)\n\ts.Services = NewServicesService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "98b2dd493814da4c39ade0f814325b8a", "score": "0.7439696", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.AccountReports = NewAccountReportsService(s)\n\ts.DetailedLeadReports = NewDetailedLeadReportsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "af6813812997675c7f32b9c8c809b6d7", "score": "0.7433188", "text": "func NewService(client Client) Service {\n\treturn Service{\n\t\tclient: client,\n\t}\n}", "title": "" }, { "docid": "491a587ee75e9957ac85debb4e063d80", "score": "0.7423713", "text": "func NewService(name string, url string, opts ...ClientOpt) (*Client, error) {\n\tc, err := bootStrap(name, url, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.typ = ServiceClient\n\t// Same queue for all services - load balancing\n\tif topicLength(name) != 2 && topicLength(name) != 3 {\n\t\treturn nil, fmt.Errorf(\"Invalid name for service: %s\", name)\n\t}\n\tif topicLength(name) == 2 {\n\t\tc.single = false\n\t}\n\n\terr = c.setupService()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, err\n}", "title": "" }, { "docid": "d538172ca37f9f45540f10e7bbe9b179", "score": "0.73965687", "text": "func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {\n\tscopesOption := option.WithScopes(\n\t\t\"https://www.googleapis.com/auth/cloud-platform\",\n\t)\n\t// NOTE: prepend, so we don't override user-specified scopes.\n\topts = append([]option.ClientOption{scopesOption}, opts...)\n\tclient, endpoint, err := htransport.NewClient(ctx, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts, err := New(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif endpoint != \"\" {\n\t\ts.BasePath = endpoint\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "d538172ca37f9f45540f10e7bbe9b179", "score": "0.73965687", "text": "func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {\n\tscopesOption := option.WithScopes(\n\t\t\"https://www.googleapis.com/auth/cloud-platform\",\n\t)\n\t// NOTE: prepend, so we don't override user-specified scopes.\n\topts = append([]option.ClientOption{scopesOption}, opts...)\n\tclient, endpoint, err := htransport.NewClient(ctx, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts, err := New(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif endpoint != \"\" {\n\t\ts.BasePath = endpoint\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "b4ce3136ff1b18a69d9830be546752a1", "score": "0.73946434", "text": "func New(client *http.Client) (*APIService, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &APIService{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c9183c631114de0630d978e66c56dd51", "score": "0.73834103", "text": "func New(opts ...Option) *Client {\n\tc := &Client{client: &http.Client{}}\n\n\t// Apply options\n\tfor _, opt := range opts {\n\t\topt(c)\n\t}\n\n\tc.client.Transport = &http.Transport{TLSClientConfig: c.tlsConfig}\n\tconfigService := httpconfig.NewService(httpconfig.WithTLSConfig(c.tlsConfig))\n\tc.endpointService = endpoint.NewService(\n\t\tstaticdiscovery.NewService(configService),\n\t\tstaticselection.NewService(configService))\n\n\treturn c\n}", "title": "" }, { "docid": "28d66547dc051bc21b6be5191b09458a", "score": "0.7374753", "text": "func NewService(ctx context.Context, opts ...option.ClientOption) (*APIService, error) {\n\tscopesOption := internaloption.WithDefaultScopes(\n\t\t\"https://www.googleapis.com/auth/cloud-billing\",\n\t\t\"https://www.googleapis.com/auth/cloud-billing.readonly\",\n\t\t\"https://www.googleapis.com/auth/cloud-platform\",\n\t)\n\t// NOTE: prepend, so we don't override user-specified scopes.\n\topts = append([]option.ClientOption{scopesOption}, opts...)\n\topts = append(opts, internaloption.WithDefaultEndpoint(basePath))\n\topts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))\n\tclient, endpoint, err := htransport.NewClient(ctx, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts, err := New(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif endpoint != \"\" {\n\t\ts.BasePath = endpoint\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "14ff26c34c9dfef36ff2ece30af3ddbb", "score": "0.7372201", "text": "func New(context *clusterd.Context, namespace string, args []string) *Service {\n\treturn &Service{\n\t\tcontext: context,\n\t\tnamespace: namespace,\n\t\targs: args,\n\t}\n\n}", "title": "" }, { "docid": "24d74b74f748e5bc74cb574b4eb0665a", "score": "0.73675364", "text": "func NewService(ctx context.Context, opts ...option.ClientOption) (*APIService, error) {\n\tscopesOption := internaloption.WithDefaultScopes(\n\t\t\"https://www.googleapis.com/auth/cloud-platform\",\n\t)\n\t// NOTE: prepend, so we don't override user-specified scopes.\n\topts = append([]option.ClientOption{scopesOption}, opts...)\n\topts = append(opts, internaloption.WithDefaultEndpoint(basePath))\n\topts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))\n\tclient, endpoint, err := htransport.NewClient(ctx, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts, err := New(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif endpoint != \"\" {\n\t\ts.BasePath = endpoint\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "d556e95d8b294f2113fa292c02120f40", "score": "0.73658615", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.BlogUserInfos = NewBlogUserInfosService(s)\n\ts.Blogs = NewBlogsService(s)\n\ts.Comments = NewCommentsService(s)\n\ts.PageViews = NewPageViewsService(s)\n\ts.Pages = NewPagesService(s)\n\ts.PostUserInfos = NewPostUserInfosService(s)\n\ts.Posts = NewPostsService(s)\n\ts.Users = NewUsersService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "113e75ee6ae96dabfce4aa6ff894d9f4", "score": "0.73507375", "text": "func New(addr string) *Service {\n\treturn &Service{\n\t\taddr: addr,\n\t}\n}", "title": "" }, { "docid": "46be90eff5c8b2f4d0330f1160e9862f", "score": "0.73462594", "text": "func NewService(client *clients.Client) *Service {\n\treturn &Service{\n\t\tclient: client,\n\t}\n}", "title": "" }, { "docid": "46be90eff5c8b2f4d0330f1160e9862f", "score": "0.73462594", "text": "func NewService(client *clients.Client) *Service {\n\treturn &Service{\n\t\tclient: client,\n\t}\n}", "title": "" }, { "docid": "46be90eff5c8b2f4d0330f1160e9862f", "score": "0.73462594", "text": "func NewService(client *clients.Client) *Service {\n\treturn &Service{\n\t\tclient: client,\n\t}\n}", "title": "" }, { "docid": "62e83f03479b694d86b833e4113afdc9", "score": "0.73380786", "text": "func NewService(options *Options) *Service {\n\treturn &Service{\n\t\tConfig: NewServiceConfig(options),\n\t}\n}", "title": "" }, { "docid": "d9e0649b5d242baf9c9051d3e045a866", "score": "0.73299134", "text": "func New(client client.ConfigProvider) *Service {\n\treturn &Service{\n\t\tPolicy: policy.New(client),\n\t\tRole: role.New(client),\n\t}\n}", "title": "" }, { "docid": "45a53a06fe6d3de7ff620268ffe99eb8", "score": "0.73293173", "text": "func NewService(opts ...service.Option) service.Service {\n\toptions := []service.Option{\n\t\tservice.Client(cmucp.NewClient()),\n\t\tservice.Server(smucp.NewServer()),\n\t}\n\n\toptions = append(options, opts...)\n\n\treturn newService(options...)\n}", "title": "" }, { "docid": "6e1c4272a43e22816c403573db47cdd5", "score": "0.73272616", "text": "func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {\n\tscopesOption := internaloption.WithDefaultScopes(\n\t\t\"https://www.googleapis.com/auth/adwords\",\n\t)\n\t// NOTE: prepend, so we don't override user-specified scopes.\n\topts = append([]option.ClientOption{scopesOption}, opts...)\n\topts = append(opts, internaloption.WithDefaultEndpoint(basePath))\n\topts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))\n\tclient, endpoint, err := htransport.NewClient(ctx, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts, err := New(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif endpoint != \"\" {\n\t\ts.BasePath = endpoint\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "261323238becec69528404d13fad0031", "score": "0.7327064", "text": "func New(cred esign.Credential) *Service {\n\treturn &Service{credential: cred}\n}", "title": "" }, { "docid": "261323238becec69528404d13fad0031", "score": "0.7327064", "text": "func New(cred esign.Credential) *Service {\n\treturn &Service{credential: cred}\n}", "title": "" }, { "docid": "261323238becec69528404d13fad0031", "score": "0.7327064", "text": "func New(cred esign.Credential) *Service {\n\treturn &Service{credential: cred}\n}", "title": "" }, { "docid": "261323238becec69528404d13fad0031", "score": "0.7327064", "text": "func New(cred esign.Credential) *Service {\n\treturn &Service{credential: cred}\n}", "title": "" }, { "docid": "261323238becec69528404d13fad0031", "score": "0.7327064", "text": "func New(cred esign.Credential) *Service {\n\treturn &Service{credential: cred}\n}", "title": "" }, { "docid": "261323238becec69528404d13fad0031", "score": "0.7327064", "text": "func New(cred esign.Credential) *Service {\n\treturn &Service{credential: cred}\n}", "title": "" } ]
0d6f4fb765786c0199c882d88aa7a19e
the service or tester wants to create a Raft server. the ports of all the Raft servers (including this one) are in peers[]. this server's port is peers[me]. all the servers' peers[] arrays have the same order. persister is a place for this server to save its persistent state, and also initially holds the most recent saved state, if any. applyCh is a channel on which the tester or service expects Raft to send ApplyMsg messages. for any longrunning work.
[ { "docid": "0de87adaf442a0a1d89318753ee6e076", "score": "0.5543752", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\trf.NONE = len(peers)\n\trf.votedFor = rf.NONE\n\tdh := newDemotionHelper(rf.me)\n\trf.appendEntriesSignal = make(chan int)\n\trf.DemotionHelper = &dh\n\trf.applyCh = applyCh\n\trf.log = make([]LogEntry, 0)\n\trf.Die = make(chan int)\n\trf.commitIndex = -1\n\trf.lastApplied = -1\n\n\t// Your initialization code here (2A, 2B, 2C).\n\t// FSM YO!!\n\tgo func() {\n\t\trf.state = newFollower()\n\t\tfor {\n\t\t\tfmt.Println(\"================NEW STATE=====================\")\n\t\t\tfmt.Println(\"Id:\",rf.me)\n\t\t\tfmt.Println(\"Term: \", rf.currentTerm)\n\t\t\tfmt.Println(reflect.TypeOf(rf.state))\n\t\t\tfmt.Println(rf.log)\n\t\t\tfmt.Println(\"Voting for: \", rf.votedFor)\n\t\t\tfmt.Println(\"==============================================\")\n\t\t\trf.state = rf.state.ProcessState(rf)\n\t\t\trf.ResetDemotionState(rf)\n\t\t\tif rf.state == nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\t// initialize from state persisted before a crash\n\tfmt.Println(\"READING FROM PREVIOUS STATE\")\n\trf.readPersist(persister.ReadRaftState())\n\trf.recoverFromSnapshot(persister.ReadSnapshot())\n\trf.persist()\n\treturn rf\n}", "title": "" } ]
[ { "docid": "cb09ebf1f4df71037f342e23523273d8", "score": "0.68329495", "text": "func Make(\n peers []*labrpc.ClientEnd,\n me int,\n persister *Persister,\n applyCh chan ApplyMsg,\n) *Raft {\n // Your initialization code here (2A, 2B, 2C).\n // rand.Seed(me)\n rf := &Raft{\n peers: peers,\n persister: persister,\n me: me,\n id: strconv.Itoa(me),\n lastHeartbeat: time.Now(),\n commitIndex: 0,\n lastApplied: 0,\n decommission: false,\n }\n\n rf.transitionToFollower(0)\n\n // initialize from state persisted before a crash\n rf.readPersist(persister.ReadRaftState())\n\n go rf.startElectionProcess()\n go rf.startApplyProcess(applyCh)\n\n return rf\n}", "title": "" }, { "docid": "5676ca611cd9b33aaf83ced5ac3401d8", "score": "0.65695727", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\tDPrintf(\"Make:init raft for -%d \\n\",me)\n\t// Your initialization code here (2A, 2B, 2C).\n\n\trf.currentTerm = 0\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\trf.state = 0 //0: follower ;1 :candidated;2:leader\n\trf.votedFor = -1\n\trf.logs = append(rf.logs,logEntry{LogTerm:rf.currentTerm,LogIndex:rf.lastApplied,LogComd:100})\n\trf.chanGrantVote = make(chan bool,100)\n\trf.chanHb = make(chan bool,100)\n\trf.chanLeader = make(chan bool,100)\n\trf.chanCommit=make(chan bool,100)\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\n\n\tgo func(server *Raft){\n\t\tfor{\n\n\t\t\t//selection timeout\n\n\t\t\t//randNum :=rand.Intn(150)\n\t\t\t////DPrintf(\"server %d :sleep for %d ms\\n\",server.me,randNum)\n\t\t\t//time.Sleep(time.Duration(150 +randNum) * time.Millisecond)\n\t\t\t//DPrintf(\"server %d start for main state =%d at %d \",server.me,server.state,\n\t\t\t//\ttime.Now().Nanosecond())\n\t\t\t//DPrintf(\"%d state is %d\",rf.me,rf.state)\n\t\t\tswitch server.state {\n\t\t\tcase STATE_FOLLOWER:\n\t\t\t\trandNum :=550+rand.Int()%333\n\t\t\t\t//DPrintf(\"%d timeafter %d\\n\",server.me,randNum)\n\t\t\t\tselect {\n\t\t\t\tcase <-server.chanHb:\n\t\t\t\t\tDPrintf(\"XXXXXXXX:%d get hb at %d\",server.me,time.Now().Nanosecond())\n\t\t\t\tcase <-server.chanGrantVote:\n\t\t\t\tcase <-time.After(time.Duration(randNum)* time.Millisecond):\n\n\t\t\t\t\tDPrintf(\"START ELECTION:server %d change state to %d at %d\\n\",\n\t\t\t\t\t\tserver.me,STATE_CANDIDATE,time.Now().Nanosecond())\n\t\t\t\t\tserver.state = STATE_CANDIDATE\n\t\t\t\t\tserver.votedFor = -1\n\t\t\t\t}\n\t\t\tcase STATE_CANDIDATE:\n\n\t\t\t\tgo server.broadcastRequestVotes()\n\t\t\t\trandNum :=550+rand.Int()%333\n\t\t\t\tDPrintf(\"%d nexttime election after %d\\n\",server.me,randNum)\n\t\t\t\tselect {\n\t\t\t\tcase <-time.After(time.Duration(randNum) * time.Millisecond):\n\t\t\t\t\tDPrintf(\"%d timeout and re req vote at %d\",server.me,time.Now().Nanosecond())\n\t\t\t\tcase <-server.chanHb:\n\t\t\t\t\tserver.state = STATE_FOLLOWER\n\t\t\t\tcase <-server.chanLeader:\n\t\t\t\t\tserver.state = STATE_LEADER\n\t\t\t\t\trf.nextIndexs = make([]int,len(rf.peers))\n\t\t\t\t\trf.matchIndexs = make([]int,len(rf.peers))\n\t\t\t\t\tfor idx,_ := range server.peers{\n\t\t\t\t\t\tserver.nextIndexs[idx] = server.getLastIndex()+1\n\t\t\t\t\t\tserver.matchIndexs[idx] =0\n\t\t\t\t\t}\n\t\t\t\t\tDPrintf(\"server %d:to be leader\\n\",server.me)\n\t\t\t\t}\n\t\t\tcase STATE_LEADER:\n\t\t\t\t//DPrintf(\"server %d: is leader,starting to send hb..\\n\",server.me)\n\t\t\t\tserver.broadAppendEntries()\n\t\t\t\ttime.Sleep(time.Duration(10 * time.Millisecond))\n\t\t\t}\n\t\t\t//DPrintf(\"%d againg ..........at %d\",server.me,time.Now().Nanosecond())\n\t\t}\n\t}(rf)\n\tgo func(){\n\t\tfor{\n\t\t\tselect {\n\t\t\tcase <-rf.chanCommit:\n\t\t\t\trf.mu.Lock()\n\t\t\t\tcommitIndex := rf.commitIndex\n\t\t\t\tbaseIndex := rf.logs[0].LogIndex\n\t\t\t\tfor i := rf.lastApplied+1; i <= commitIndex; i++ {\n\t\t\t\t\tmsg := ApplyMsg{Index: i, Command: rf.logs[i-baseIndex].LogComd}\n\t\t\t\t\tapplyCh <- msg\n\t\t\t\t\t//fmt.Printf(\"me:%d %v\\n\",rf.me,msg)\n\t\t\t\t\trf.lastApplied = i\n\t\t\t\t\tDPrintf(\"APPLY %d apply msg %v\",rf.me,msg)\n\t\t\t\t}\n\t\t\t\trf.mu.Unlock()\n\t\t\t}\n\t\t}\n\n\t}()\n\n\n\treturn rf\n}", "title": "" }, { "docid": "59191c7668a197237b25e05cff55cf73", "score": "0.6333453", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n rf.heartBeatInterval = int64(heartBeatInterval)\n rf.votedFor = -1\n rf.t = time.NewTimer(rf.genElectionTimeout())\n rf.flagChan = make(chan string, 1)\n\n // Timeout goroutine\n rf.elecTimeFunc = func(rfp *Raft, timeSigChan chan string) {\n DPrintf(\"peer %d election timer started\\n\", rfp.me)\n //for {\n select {\n case <- rf.t.C:\n DPrintf(\"peer %d election timeout\\n\", rfp.me)\n //Remind peer to exit\n rfp.flagChan <- cmdExit\n rf.t.Stop()\n DPrintf(\"peer %d election timer goroutine exited\\n\", rfp.me)\n return\n case <- timeSigChan:\n DPrintf(\"timeout goroutine was asked to exit\\n\")\n return\n }\n //}\n }\n\n\t// Your initialization code here (2A, 2B, 2C).\n DPrintf(\"Create peer %d\\n\", me)\n go func(rfp *Raft) {\n cmdChan := make(chan string, 1)\n\n // Initial state should be follower\n cmdChan <- follower\n\n go func(rf *Raft, cmdChan chan string) {\n for {\n select {\n case cmd := <- cmdChan:\n switch cmd {\n case follower:\n rf.follower(cmdChan)\n case candidate:\n rf.candidate(cmdChan)\n case leader:\n rf.leader(cmdChan)\n case dead:\n DPrintf(\"peer %d exited\\n\", rf.me)\n return\n default:\n DPrintf(\"received unknown cmd\", cmd)\n }\n }\n }\n }(rf, cmdChan)\n }(rf)\n\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\n\treturn rf\n}", "title": "" }, { "docid": "9c6755e531bf1532ca3688e5f89532b6", "score": "0.63009804", "text": "func NewPeer(peers []*rpc.ClientEnd, me int, applyCh chan ApplyCommand) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.me = me\n\n\tif kEnableDebugLogs {\n\t\tpeerName := peers[me].String()\n\t\tlogPrefix := fmt.Sprintf(\"%s \", peerName)\n\t\tif kLogToStdout {\n\t\t\trf.logger = log.New(os.Stdout, peerName, log.Lmicroseconds|log.Lshortfile)\n\t\t} else {\n\t\t\terr := os.MkdirAll(kLogOutputDir, os.ModePerm)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err.Error())\n\t\t\t}\n\t\t\tlogOutputFile, err := os.OpenFile(fmt.Sprintf(\"%s/%s.txt\", kLogOutputDir, logPrefix), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err.Error())\n\t\t\t}\n\t\t\trf.logger = log.New(logOutputFile, logPrefix, log.Lmicroseconds|log.Lshortfile)\n\t\t}\n\t\trf.logger.Println(\"logger initialized\")\n\t} else {\n\t\trf.logger = log.New(ioutil.Discard, \"\", 0)\n\t}\n\n\t// Your initialization code here (3A, 3B)\n\trf.applyCh = applyCh\n\trf.heartBeatCh = make(chan bool)\n\t// election time out range [1s, 2s)\n\trf.electionTimeoutMilli = randInt(1000, 2000)\n\t// heartbeat interval range [0.1s, 0.2s)\n\trf.heartBeatIntervalMilli = randInt(100, 200)\n\t// log index begin at 1\n\trf.statusCh = make(chan Status, 1)\n\trf.stepDownCh = make(chan int)\n\trf.startAgreementCh = make(chan int)\n\trf.persistentState.currentTerm = 0\n\trf.persistentState.votedFor = -1\n\trf.persistentState.log = make([]LogEntry, 1)\n\trf.initVolatileStateOnAllServer()\n\t// original, server is follower\n\trf.status = FOLLOWER\n\trf.statusCh <- FOLLOWER\n\n\tgo rf.handleStatus()\n\n\treturn rf\n}", "title": "" }, { "docid": "1baff28061ee7467409a1a3e0f4f308d", "score": "0.6265623", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\trf.votedFor = -1\n\trf.role = FOLLOWER // start with role as follower\n\trf.currentTerm = 0\n\trf.applyCh = applyCh\n\n\trf.major = len(rf.peers) / 2\n\n\t// Your initialization code here (3A, 3B, 3C).\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\n\trf.nextIndex = make([]int, len(peers))\n\trf.matchIndex = make([]int, len(peers))\n\n\trf.lastReceivedTime = time.Now()\n\n\telectionTimeOut := time.Duration(time.Millisecond) * time.Duration(200+rand.Intn(300))\n\treceiveMessageTimeOut := time.Duration(time.Millisecond) * time.Duration(120+rand.Intn(50))\n\n\t// true log index starts with index = 1, append a dummy header into log arraylist(using go slice)\n\trf.log = []LogEntry{}\n\trf.log = append(rf.log, LogEntry{Term: 0, Index: 0})\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\tgo func() {\n\t\tfor true {\n\t\t\ttime.Sleep(1 * time.Duration(time.Millisecond))\n\t\t\trf.mu.Lock()\n\n\t\t\tif rf.role == FOLLOWER {\n\t\t\t\tif time.Now().Sub(rf.lastReceivedTime) > receiveMessageTimeOut {\n\t\t\t\t\tgo rf.startElection()\n\n\t\t\t\t}\n\t\t\t} else if rf.role == LEADER {\n\t\t\t\t//\tgo rf.checkCommited()\n\n\t\t\t\tif time.Now().Sub(rf.sendHeartBeatTime) > 50*time.Millisecond {\n\t\t\t\t\tgo rf.startAgreement()\n\t\t\t\t\t//go rf.sendHeartbeat()\n\n\t\t\t\t}\n\t\t\t} else if rf.role == CANDIDATE {\n\t\t\t\tif time.Now().Sub(rf.electionStartTime) > electionTimeOut {\n\t\t\t\t\tgo rf.startElection()\n\t\t\t\t}\n\t\t\t}\n\t\t\tgo rf.applyToStateMachine()\n\t\t\trf.mu.Unlock()\n\t\t}\n\t}()\n\n\treturn rf\n}", "title": "" }, { "docid": "97d4d35483aa83cba0af6ee0bdf0c76c", "score": "0.6190646", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\n\trf.logReplicationConds = make([]*sync.Cond, len(rf.peers))\n\tfor i := 0; i < len(rf.peers); i++ {\n\t\tlocker := new(sync.Mutex)\n\t\trf.logReplicationConds[i] = sync.NewCond(locker)\n\t}\n\trf.commitIndexCond = sync.NewCond(new(sync.Mutex))\n\n\trf.lastSendApplyChIndex = 0\n\t\n\trf.resetElectionTimer()\n\trf.state = STATE_FOLLOWER\n\trf.currentTerm = 0\n\trf.votedFor = NULL_PEER_ID\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\n\trf.nextIndex = make([]int, len(rf.peers))\n\trf.matchIndex = make([]int, len(rf.peers))\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\t// 一个线程用于定时检查选举是否超时\n\tgo rf.handleElectionTimer()\n\t\n\t// 一个线程用于定时发送心跳\n\tgo rf.handleHeartbeat()\n\n\t// 对于每一个服务器开启一个线程用于发送日志\n\tfor i := 0; i < len(rf.peers); i++ {\n\t\tgo rf.handleLogReplication(i)\n\t}\n\t\n\t// 一个线程用于把已经提交的日志发送到applyCh\n\tgo rf.handleSendApplyCh(applyCh)\n\t\n\t// 一个线程用于apply\n\tgo rf.handleLogApply()\n\n\treturn rf\n}", "title": "" }, { "docid": "f09275591260e1a6130a2d758ea5ae4f", "score": "0.6180161", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\t// Your initialization code here.\n\t// initialize from state persisted before a crash\n\n\trf.CommitIndex = 0\n\trf.LastApplied = 0\n\trf.HeartBeatCh = make(chan bool)\n\trf.ToFollower = make(chan bool)\n\trf.ApplyCh = applyCh\n\n\trf.VotedFor = -1\n\trf.CurrentTerm = 0\n\trf.Role = FOLLOWER\n\n\trf.Log = make([]LogEntry, 1)\n\trf.Log[0] = LogEntry{0, 0, 0}\n\n\trf.Snapshotting = make([]bool, len(rf.peers))\n\trf.tmpSnapshot = make(map[int]*SnapshotInfo)\n\trf.sendingSnapshot = make(map[int]*SnapshotInfo)\n\trf.SnapshotProgress = false\n\n\t// data := persister.ReadRaftState()\n\t// if len(data) != 0 {\n\t// \t// fmt.Println(\"Recovery: \", data)\n\t// \trf.readPersist(data)\n\t// }\n\trf.readPersist(persister.ReadRaftState())\n\trf.LastApplied = rf.Log[0].Index\n\trf.CommitIndex = rf.Log[0].Index\n\t// rf.readPersist(data)\n\tgo func() {\n\t\tfor {\n\t\t\t// fmt.Println(\"for\")\n\t\t\t// fmt.Println(rf.me, \"leader get role\", rf.Role)\n\t\t\tswitch rf.GetRole() {\n\t\t\tcase FOLLOWER:\n\t\t\t\t// fmt.Println(rf.me, \" Role: Follower\")\n\t\t\t\trf.followerAction()\n\t\t\tcase CANDIDATE:\n\t\t\t\t// fmt.Println(rf.me, \" Role: Candidate\")\n\t\t\t\trf.candidateAction()\n\t\t\tcase LEADER:\n\t\t\t\t// fmt.Println(rf.me, \" Role: Leader\")\n\t\t\t\trf.leaderAction()\n\t\t\t}\n\t\t}\n\t}()\n\treturn rf\n}", "title": "" }, { "docid": "d5a762feb5ab60860dad94739c7e9cf2", "score": "0.6171751", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.state = \"follower\"\n\trf.currentTerm = 0\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\trf.log = make([]LogEntry, 1)\n\n\trf.votedFor = -1\n\n\trf.applyCh = applyCh\n\trf.nextIndex = make([]int, len(peers))\n\trf.matchIndex = make([]int, len(peers))\n for i:=0; i<len(rf.matchIndex); i++ {\n \trf.matchIndex[i] = -1\n\t}\n\trf.ch = make(chan bool, 1)\n\trf.ch = make(chan bool, 1)\n\trf.killCh = make(chan bool, 1)\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\theartbeatTime := time.Duration(100) * time.Millisecond\n\t//modify Make() to create a background goroutine\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-rf.killCh:\n\t\t\t\treturn\n\t\t\tdefault :\n\t\t\t}\n\t\t\telectionTimeout := time.Duration(rand.Intn(200) + 300) * time.Millisecond\n\t\t\trf.mu.Lock()\n\t\t\tstate := rf.state\n\t\t\trf.mu.Unlock()\n\t\t\tswitch state {\n\t\t\tcase \"follower\", \"candidate\":\n\t\t\t\t// if receive rpc, then break select, reset election tim\n\t\t\t\tselect {\n\t\t\t\tcase <-rf.ch:\n\t\t\t\tcase <-time.After(electionTimeout):\n\t\t\t\t\t//become Candidate if time out\n\t\t\t\t\trf.mu.Lock()\n\t\t\t\t\trf.changeRole(\"candidate\")\n\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t}\n\t\t\tcase \"leader\":\n\t\t\t\ttime.Sleep(heartbeatTime) // tester doesn't allow the leader send heartbeat RPCs more than ten times per second\n\t\t\t\trf.appendLogEntries() // leader's task is to append log entry\n\t\t\t}\n\t\t}\n\t}()\n\treturn rf\n}", "title": "" }, { "docid": "3af292d10ce1c335ea4265bf1bfdc0a6", "score": "0.6144929", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\trf.stop = false\n\trf.applyCh = applyCh\n\n\tunixNano := time.Now().UnixNano()\n\t// logDebug(\"server %d, nano: %d\\n\", me, unixNano)\n\trand.Seed(unixNano)\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.CurrentTerm = 0\n\trf.VotedFor = -1\n\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\trf.role = \"f\" //initial follower\n\trf.VotedFor = -1\n\t// rf.myVotes = 0\n\n\trf.nextIndex = make([]int, len(peers))\n\trf.matchIndex = make([]int, len(peers))\n\trf.lastTs = 0\n\trf.commitCond = sync.NewCond(&rf.mu)\n\trf.Logs = make([]LogEntry, 1)\n\trf.Logs[0] = LogEntry{0, nil} //the first log is just a placeholder\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\tgo rf.electionDaemon()\n\tgo rf.applyLogEntryDaemon()\n\t//go rf.syncDataDaemon()\n\n\treturn rf\n}", "title": "" }, { "docid": "89aff6f22b9dbf461408b5bb72ee1c7c", "score": "0.6130544", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\t//rpc.RegisterName(\"HelloService\", new(Raft))\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\trf.menkan = len(rf.peers)/2 + 1\n\trf.applyCh = applyCh\n\trf.currentTerm = 1\n\trf.log = make([]Entry, 1)\n\trf.log[0] = Entry{Term: rf.currentTerm}\n\trf.sendApply = make(chan int, 1000)\n\trf.heartBeatchs = make([]HBchs, len(rf.peers))\n\t//3B\n\trf.lastIncludedIndex = -1\n\trf.lastIncludedTerm = 0\n\tfor i := range rf.heartBeatchs {\n\t\trf.heartBeatchs[i].c = make(chan int, 1000)\n\t}\n\trf.chanReset()\n\t// Your initialization code here (2A, 2B, 2C).-------------------------------\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\tgo func(rf *Raft) {\n\t\tfor {\n\t\t\tif rf.killed() {\n\t\t\t\trf.mu.Lock()\n\t\t\t\tdefer rf.mu.Unlock()\n\t\t\t\trf.convert(follower)\n\t\t\t\treturn\n\t\t\t}\n\t\t\trf.mu.Lock()\n\t\t\tst := rf.state\n\t\t\trf.mu.Unlock()\n\t\t\tswitch st {\n\t\t\tcase follower:\n\t\t\t\t//\n\t\t\t\tselect {\n\t\t\t\tcase <-rf.findBiggerChan:\n\t\t\t\tcase <-rf.appendChan:\n\t\t\t\t\t//follower收到有效append,重置超时\n\t\t\t\tcase <-time.After(electionConstTime()):\n\t\t\t\t\t//超时啦,进行选举\n\t\t\t\t\trf.mu.Lock()\n\t\t\t\t\trf.chanReset()\n\t\t\t\t\trf.convert(candidate)\n\t\t\t\t\trf.election()\n\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t}\n\t\t\tcase candidate:\n\t\t\t\tselect {\n\t\t\t\tcase <-rf.findBiggerChan:\n\n\t\t\t\t\t//发现了更大地 term ,转为follower\n\t\t\t\tcase <-rf.appendChan:\n\t\t\t\t\t//candidate 收到有效心跳,转回follower\n\t\t\t\tcase <-rf.voteGrantedChan:\n\t\t\t\t\t//candidate 收到多数投票结果,升级为 leader\n\t\t\t\tcase <-time.After(electionConstTime()):\n\t\t\t\t\t//没有投票结果,也没有收到有效append,重新giao\n\t\t\t\t\trf.mu.Lock()\n\t\t\t\t\trf.chanReset()\n\t\t\t\t\trf.election()\n\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t}\n\t\t\t\t//\n\t\t\tcase leader:\n\t\t\t\tselect {\n\t\t\t\tcase <-rf.findBiggerChan:\n\n\t\t\t\tcase <-rf.appendChan:\n\t\t\t\t\t//收到有效地心跳,转为follower\n\t\t\t\tcase <-time.After(heartbeatConstTime):\n\t\t\t\t\t// \t//进行一次append\n\t\t\t\t\t// rf.mu.Lock()\n\t\t\t\t\t// rf.chanReset()\n\t\t\t\t\t// rf.heartBeat()\n\t\t\t\t\t// rf.mu.Unlock()\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}(rf)\n\tgo rf.apply()\n\treturn rf\n}", "title": "" }, { "docid": "b01dad8e22e0846ddbb68af0b3824c7c", "score": "0.6118189", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\trf.state = follower\n\trf.currentTerm = 0\n\trf.votedFor = -1\n\trf.log = make([]LogEntry, 0)\n\trf.log = append(rf.log, LogEntry{\n\t\tEntryTerm: 0,\n\t\tEntryIndex: 0,\n\t})\n\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\n\trf.seed = rand.NewSource(int64(rf.me))\n\trf.timer = time.NewTimer(0)\n\trf.voteRecv = 0\n\n\trf.nextIndex = make([]int, len(rf.peers))\n\trf.matchIndex = make([]int, len(rf.peers))\n\n\trf.applyCh = applyCh\n\trf.stateUpdateCh = make(chan struct{})\n\trf.commitUpdateCh = make(chan struct{}, 100)\n\n\t// initialize from state persisted before a crash\n\trf.readPersistState(rf.persister.ReadRaftState())\n\trf.readPersistSnapshot(rf.persister.ReadSnapshot())\n\n\t// start goroutine to maintain the server state\n\tgo rf.startStateMachineDaemon()\n\n\t// start goroutine to monitor log entry and apply command to state machine\n\tgo rf.startLogCommitterDaemon()\n\n\treturn rf\n}", "title": "" }, { "docid": "37899ea7d91de1fef002f7af4bc400f7", "score": "0.6097313", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.num = len(peers)\n\trf.persister = persister\n\trf.me = me\n\trf.state = FollowerState\n\trf.currentTerm = 0\n\trf.voteFor = make(map[int]*labrpc.ClientEnd)\n\trf.heartbeatChan = make(chan bool)\n\trf.beLeaderChan = make(chan bool)\n\trf.stopCountChan = make(chan bool)\n\trf.countVoteChan = make(chan int, 100)\n\trf.countVotes = make(map[int]int)\n\trf.uncommitQueue = make(chan interface{}, 100)\n\trf.commitIndex = 0\n\trf.logs = []interface{}{nil} //logs index starts from 1\n\trf.logTerm = []int{-1}\n\trf.lastApplied = 0\n\trf.nextIndex = make([]int, rf.num)\n\trf.applyCh = applyCh\n\trf.applyBufferCh = make(chan ApplyMsg, 100)\n\n\trf.matchIndex = make([]int, rf.num)\n\tgo rf.countVotesLoop()\n\tgo func() {\n\t\tfor {\n\t\t\tswitch rf.state {\n\t\t\tcase FollowerState:\n\t\t\t\tselect {\n\t\t\t\tcase <-time.After(rf.getElectionTimeOut()):\n\t\t\t\t\trf.state = CandidateState\n\t\t\t\tcase <-rf.heartbeatChan:\n\t\t\t\t}\n\t\t\tcase CandidateState:\n\t\t\t\t//what if candidate has become follower now?\n\t\t\t\trf.mu.Lock()\n\t\t\t\trf.currentTerm += 1\n\t\t\t\tlog.Println(rf.currentTerm, rf.me, \" becomes candidate\")\n\t\t\t\trf.voteFor[rf.currentTerm] = rf.peers[rf.me]\n\t\t\t\trf.countVotes[rf.currentTerm]++\n\t\t\t\targs := RequestVoteArgs{\n\t\t\t\t\tCandidateID: rf.me,\n\t\t\t\t\tTerm: rf.currentTerm,\n\t\t\t\t\tLastLogIndex: len(rf.logs) - 1,\n\t\t\t\t\tLastLogTerm: rf.logTerm[len(rf.logs)-1],\n\t\t\t\t}\n\t\t\t\trf.mu.Unlock()\n\t\t\t\tgo rf.broadcastRequestVote(args)\n\t\t\t\tselect {\n\t\t\t\tcase <-rf.beLeaderChan:\n\t\t\t\t\tlog.Println(args.Term, rf.me, \" becomes leader\")\n\t\t\t\t\trf.state = LeaderState\n\t\t\t\t\trf.mu.Lock()\n\t\t\t\t\tif rf.lastApplied != len(rf.logs)-1 {\n\t\t\t\t\t\tpanic(\"lastApplied not equals to logs len\")\n\t\t\t\t\t}\n\t\t\t\t\tfor i := range rf.nextIndex {\n\t\t\t\t\t\tif i == rf.me {\n\t\t\t\t\t\t\trf.matchIndex[i] = rf.lastApplied\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trf.matchIndex[i] = 0\n\t\t\t\t\t\t}\n\t\t\t\t\t\trf.nextIndex[i] = len(rf.logs)\n\t\t\t\t\t}\n\t\t\t\t\trf.mu.Unlock()\n\t\t\t\tcase <-rf.heartbeatChan:\n\t\t\t\t\trf.state = FollowerState\n\t\t\t\t\tlog.Println(args.Term, rf.me, \" candidate becomes follower\")\n\t\t\t\tcase <-time.After(rf.getElectionTimeOut()):\n\t\t\t\t}\n\t\t\tcase LeaderState:\n\t\t\t\t//TODO: reinitialization\n\t\t\t\trf.mu.Lock()\n\t\t\t\targs := AppendEntryArgs{\n\t\t\t\t\tLeaderID: rf.me,\n\t\t\t\t\tTerm: rf.currentTerm,\n\t\t\t\t\tLeaderCommit: rf.commitIndex,\n\t\t\t\t}\n\t\t\t\trf.mu.Unlock()\n\t\t\t\tgo rf.broadcastEmptyAppendEntries(args)\n\t\t\t\tselect {\n\t\t\t\tcase <-rf.heartbeatChan:\n\t\t\t\t\trf.state = FollowerState\n\t\t\t\t\tlog.Println(args.Term, rf.me, \" leader becomes follower\")\n\t\t\t\tcase <-time.After(rf.getHeartBeatTimeOut()):\n\t\t\t\tcase cmd := <-rf.uncommitQueue:\n\t\t\t\t\trf.mu.Lock()\n\t\t\t\t\t// applyMsg := ApplyMsg{len(rf.logs), cmd, false, nil}\n\t\t\t\t\t// log.Printf(\"%d:%d apply msg %v\", rf.currentTerm, rf.me, applyMsg)\n\t\t\t\t\trf.logs = append(rf.logs, cmd)\n\t\t\t\t\trf.logTerm = append(rf.logTerm, rf.currentTerm)\n\t\t\t\t\trf.matchIndex[rf.me] = len(rf.logs) - 1\n\t\t\t\t\targs := AppendEntryArgs{\n\t\t\t\t\t\tLeaderID: rf.me,\n\t\t\t\t\t\tTerm: rf.currentTerm,\n\t\t\t\t\t\tLeaderCommit: rf.commitIndex,\n\t\t\t\t\t}\n\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t\t// go rf.ReceiveApplyMsg(applyMsg)\n\t\t\t\t\tgo func(logs []interface{}, logTerm []int, lastApplied int, nextIndex []int) {\n\t\t\t\t\t\t// Logs and nextIndex may be changed in the main func.\n\t\t\t\t\t\tfor i, _ := range rf.peers {\n\t\t\t\t\t\t\tif i != rf.me {\n\t\t\t\t\t\t\t\tif rf.state != LeaderState {\n\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif lastApplied >= nextIndex[i] {\n\t\t\t\t\t\t\t\t\tgo func(i int, args AppendEntryArgs) {\n\t\t\t\t\t\t\t\t\t\treply := AppendEntryReply{}\n\t\t\t\t\t\t\t\t\t\tt := 1\n\t\t\t\t\t\t\t\t\t\tfor {\n\t\t\t\t\t\t\t\t\t\t\tif rf.state != LeaderState {\n\t\t\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\targs.Entries = logs[nextIndex[i] : lastApplied+1] //To include lastApplied entry\n\t\t\t\t\t\t\t\t\t\t\targs.PrevLogIndex = nextIndex[i] - 1\n\t\t\t\t\t\t\t\t\t\t\targs.PrevLogTerm = logTerm[args.PrevLogIndex]\n\t\t\t\t\t\t\t\t\t\t\tif ok := rf.sendAppendEntry(i, args, &reply); !ok {\n\t\t\t\t\t\t\t\t\t\t\t\tlog.Printf(\"%d:%d sendAppendEntry: retry after %d\", args.Term, rf.me, t)\n\t\t\t\t\t\t\t\t\t\t\t\ttime.Sleep(time.Duration(t) * time.Millisecond)\n\t\t\t\t\t\t\t\t\t\t\t\tt *= 2\n\t\t\t\t\t\t\t\t\t\t\t\tif t > 128 {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlog.Printf(\"%d Cannot append entry %v to %d after retry\", rf.me, args, i)\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t// log.Printf(\"%d send logs %v to %d: %v\", rf.me, args.Entries, server, reply.Agree)\n\t\t\t\t\t\t\t\t\t\t\tif reply.Success {\n\t\t\t\t\t\t\t\t\t\t\t\trf.mu.Lock()\n\t\t\t\t\t\t\t\t\t\t\t\trf.nextIndex[i] = getMax(rf.nextIndex[i], lastApplied+1)\n\t\t\t\t\t\t\t\t\t\t\t\trf.matchIndex[i] = getMax(rf.matchIndex[i], lastApplied)\n\t\t\t\t\t\t\t\t\t\t\t\trf.checkCommit()\n\t\t\t\t\t\t\t\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t\t\t\t\t\t\t\t} else if reply.Term == args.Term {\n\t\t\t\t\t\t\t\t\t\t\t\t// Followers reject appendEntry because the last log does not match. So move ahead\n\t\t\t\t\t\t\t\t\t\t\t\tif nextIndex[i] <= 0 {\n\t\t\t\t\t\t\t\t\t\t\t\t\tpanic(\"nextIndex <= 0\")\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tnextIndex[i]--\n\t\t\t\t\t\t\t\t\t\t\t\tlog.Printf(\"%d:%d sendAppendEntry %v to %d nextIndex:%d\", args.Term, rf.me, args, i, nextIndex[i])\n\t\t\t\t\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t\t\t\t\t} else if reply.Term > args.Term{\n\t\t\t\t\t\t\t\t\t\t\t\trf.mu.Lock()\n\t\t\t\t\t\t\t\t\t\t\t\tif rf.currentTerm < reply.Term {\n\t\t\t\t\t\t\t\t\t\t\t\t\trf.currentTerm = reply.Term\n\t\t\t\t\t\t\t\t\t\t\t\t\tgo pushChan(rf.heartbeatChan, true)\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}(i, args)\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}(rf.logs, rf.logTerm, len(rf.logs) - 1, rf.nextIndex)\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}()\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\treturn rf\n}", "title": "" }, { "docid": "fad3f01c013894ac542c280ca74815a0", "score": "0.6072194", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.applyCh = applyCh\n\trf.currentTerm = 0\n\trf.votedFor = -1\n\trf.log = make([]LogEntry, 1)\n\t// rf.stopLeaderCh = make(chan struct{})\n\t// rf.argCh = make(chan AppendEntriesArgs)\n\t// rf.replyCh = make(chan AppendEntriesReply)\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\trf.nextIndex = []int{}\n\trf.matchIndex = []int{}\n\trf.testTimer = time.NewTimer(BroardcastTime * 10)\n\trf.state = Follower\n\trf.electionTimeOut = time.NewTimer(getElectionTimeOut())\n\trf.heartBeatTimer = time.NewTimer(BroardcastTime)\n\t// rf.HeartBeatCond = sync.NewCond(&rf.mu)\n\trf.CheckMatchIndexCond = sync.NewCond(&rf.mu)\n\tDPrintf(\"[%d] raft server created\", rf.me)\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\trf.startRoutine()\n\treturn rf\n}", "title": "" }, { "docid": "baa65b1fa6a593717e278562035f4b47", "score": "0.60106283", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\tfmt.Println(me,\" initialize term is \",0)\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.currentTerm = 0\n\trf.votedFor = -1 //every heart beat reset\n\trf.log = make([]CommandAndTerm,1)\n\trf.log[0] = CommandAndTerm{0,0}\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\t//initialize self defined\n\trf.currentState = States_FOLLOWER\n\trf.expireTimer = time.NewTimer(time.Millisecond*time.Duration(rf.me*250+rand.Intn(100)))\n\trf.heartbeatTicker = time.NewTicker(time.Millisecond*time.Duration(HEARTBEAT_TIME))\n\trf.applyCh = applyCh\n\trf.notifyApplych = make(chan struct{},100)\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\t//go func\n\tgo rf.applyEvent()\n\tgo func(){\n\t\tfor{\n\t\t\tselect{\n\t\t\tcase <-rf.expireTimer.C:\n\t\t\t\t//electionc\n\t\t\t\trf.startElection()\n\t\t\tcase <-rf.heartbeatTicker.C:\n\t\t\t\tif rf.currentState == States_LEADER{\n\t\t\t\t\tgo rf.BroadcastAppendEntries()\n\t\t\t\t}\n\t\t\t}\n\t\t}}()\n\t\t/*\n \t rf.currentState == States_LEADER{\n\t\t\t\trf.leaderInitialize()\n\t\t\t\tfor range rf.heartbeatTicker.C{\n\t\t\t\t\tif rf.currentState != States_LEADER{\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\trf.BroadcastAppendEntries()\n\t\t\t\t}\n\t\t\t}*/\n\treturn rf\n}", "title": "" }, { "docid": "1a1ccce509b9d2c6772f1c236a551126", "score": "0.5988128", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.Persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.currentState = follower\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\trf.applyCh = applyCh\n\trf.CurrentTerm = 0\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\trf.lastSnapshotIndex = 0\n\n\trf.nextIndex = make(map[int]uint64)\n\trf.matchIndex = make(map[int]uint64)\n\trf.idToAppending = make(map[int]bool)\n\n\trf.closed = make(chan interface{})\n\trf.electionContext, rf.cancelFunc = context.WithCancel(context.Background())\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState(), persister.ReadSnapshot())\n\n\trf.changeToFollower()\n\t// start ticker goroutine to start elections\n\t// go rf.ticker()\n\n\tDPrintf(\"create raft peer %s\", rf.who())\n\n\treturn rf\n}", "title": "" }, { "docid": "bd6a28ecb6de66e611a28ab2b53c7a29", "score": "0.5973668", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{\n\t\tpeers: peers,\n\t\tpersister: persister,\n\t\tme: me,\n\t\tminElectionTimeout: 10,\n\t\tHeartbeatTimeout: 3,\n\t\tclock: time.NewTicker(time.Millisecond * 60),\n\t\tmsgCh: make(chan Message, 1),\n\t\tpropCh: make(chan proposal),\n\t\tstateCh: make(chan state),\n\t\tstopCh: make(chan struct{}),\n\t\tstorage: storage{\n\t\t\toffset: 1,\n\t\t\tapplyCh: applyCh,\n\t\t\tnotifyApplyCh: make(chan int, 100),\n\t\t\tnotifyPersistCh: make(chan chan struct{}),\n\t\t},\n\t}\n\n\trf.becomeFollower(0, -1)\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\t// daemon\n\tgo rf.applyLoop()\n\tgo rf.run()\n\n\treturn rf\n}", "title": "" }, { "docid": "fc42dd2017c560feabca491aa7095837", "score": "0.59337974", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers // including self\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.applyCh = applyCh\n\trf.numPeers = len(rf.peers)\n\trf.majority = int(rf.numPeers/2) + 1\n\trf.lastUpdate = time.Now()\n\n\trf.electionTimeout = time.Duration(300+rand.Intn(200)) * time.Millisecond\n\t// rf.sleepTime = time.Duration(100) * time.Millisecond\n\t// when we start we doesn't include any log in our snapshot\n\trf.lastIncludedIndex = -1\n\trf.lastIncludedTerm = -1\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\trf.log = make([]logEntry, 1)\n\trf.log[0] = logEntry{\"\", -1}\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\tgo rf.onBecomingFollower()\n\tgo rf.checkingCommit()\n\t// go rf.reportingState()\n\n\trf.lastAppendTime = time.Now()\n\n\treturn rf\n}", "title": "" }, { "docid": "e0d9f8fbf96a78aab48f643c5d1831e9", "score": "0.58940417", "text": "func Make(peers []*labrpc.ClientEnd, me int, persister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\t//log.Println(peers, me)\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.applyMsgCh = applyCh\n\trf.state = STATE_FOLLOWER\n\trf.votedFor = VOTED_FOR_NONE\n\trf.newTermCh = make(chan struct{})\n\trf.appendEntryCh = make(chan struct{})\n\trf.matchIndex = make([]int, len(rf.peers))\n\trf.nextIndex = make([]int, len(rf.peers))\n\trf.indexMus = make([]sync.RWMutex, len(rf.peers))\n\tfor i:=0; i<len(rf.peers); i++ {\n\t\trf.nextIndex[i] = 1\n\t}\n\trf.logs = []ReplicateLog{ReplicateLog{}}\n\trf.id = rand.Intn(8999999999)+1000000000\n\tlog.Printf(\"%v join p={%v}\\n\", rf.me, rf.id)\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\tgo rf.work()\n\n\treturn rf\n}", "title": "" }, { "docid": "c016e7d664a6f08a1dbecfcdd9d5e1a4", "score": "0.5860203", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.peersMu = make([]sync.Mutex, len(peers))\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.State = FOLLOWER\n\n\trf.CurrentTerm = 0\n\trf.Log = []RFLog{{\n\t\tLogTerm: 0,\n\t\tMessage: ApplyMsg{\n\t\t\tCommand: \"Raft server start\",\n\t\t},\n\t}}\n\trf.VotedFor = -1\n\n\trf.CompactedLen = 0\n\trf.IncludeIndex = -1\n\trf.IncludeTerm = -1\n\n\trf.CommitIndex = 0\n\trf.LastApplied = 0\n\trf.Cursor = 0\n\n\trf.ElectionTimestamp = time.Now()\n\trf.ApplyChan = applyCh\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\trf.ApplyToCommit()\n\n\t// start ticker goroutine to start elections\n\tgo rf.ticker()\n\n\treturn rf\n}", "title": "" }, { "docid": "87f9962b5109a7a6118b8b1572e3b6d9", "score": "0.5841017", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\tn := len(rf.peers)\n\n\t// Your initialization code here (2A, 2B, 2C).\n\n\t// FIXME: initialize these variables\n\n\trf.me = me\n\trf.currentTerm = 0\n\trf.votedFor = -1\n\trf.log = make([]LogMsg, 0)\n\trf.log = append(rf.log, LogMsg{\n\t\tTerm: 0,\n\t\tCommand: nil,\n\t})\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\trf.nextIndex = make([]int, n)\n\trf.matchIndex = make([]int, n)\n\trf.applyMsg = applyCh\n\trf.status = FOLLOWER\n\n\trf.appendEntriesChan = make(chan bool)\n\trf.requestVoteChan = make(chan bool)\n\trf.electionFinishedChan = make(chan bool)\n\trf.synchonizeFinishedChan = make(chan bool)\n\n\trf.lastIncludedIndex = 0\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\tgo rf.startService()\n\n\t//go rf.startPersistService()\n\n\t//go rf.startPrintLogService()\n\n\t//time.Sleep(ElectionTimeout * 3)\n\treturn rf\n}", "title": "" }, { "docid": "6d0a22409ac0a88070a5f470f85ea5cc", "score": "0.5838996", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\t//1 raft结构体初始化\n\trf.state = Follower\n\trf.currentTerm = 0\n\trf.votedFor = -1\n\trf.voteCount = 0\n\trf.log = make([]LogEntry, 1) //开始index是1\n\t//fmt.Printf(\"日志初始化%v\",len(rf.log))\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\n\trf.applych = applyCh\n\t//初始化同步通信无缓冲通道\n\n\trf.votech = make(chan struct{})\n\trf.appendLogch = make(chan struct{})\n\t//rf.nextIndex=make([]int,len(peers))\n\trf.matchIndex = make([]int, len(peers))\n\telecttime := 300 + rand.Intn(100)\n\t//electtime*=4\n\trf.electTimeout = time.Duration(electtime) * time.Millisecond\n\trf.timer = time.NewTimer(rf.electTimeout) //初始化定时器\n\tfmt.Printf(\"%v---\", time.Now().Format(\"2006-01-02 15:04:05.000\"))\n\tfmt.Printf(\"create raft%v...\", me)\n\tfmt.Printf(\"raft%v's term[%v] election timeout is:%v\\n\", rf.me, rf.currentTerm, rf.electTimeout)\n\n\t//节点开始运行,因为make要立即返回,开一个goroutine\n\tgo func() {\n\t\tdefer rf.timer.Stop()\n\t\t//重新设置时间timeout\n\t\t//\t2 节点运行,根据状态运动\n\t\tfor {\n\t\t\trf.mu.Lock()\n\t\t\tstate := rf.state\n\t\t\trf.mu.Unlock()\n\t\t\t//electtime:=300+rand.Intn(100)\n\t\t\t//electtime*=4\n\t\t\t//rf.electTimeout=time.Duration(electtime)*time.Millisecond\n\n\t\t\tswitch state {\n\t\t\tcase Follower:\n\t\t\t\tselect {\n\t\t\t\tcase <-rf.appendLogch: //收到心跳\n\t\t\t\t\trf.timer.Reset(rf.electTimeout)\n\t\t\t\tcase <-rf.votech: //收到投票\n\t\t\t\t\trf.timer.Reset(rf.electTimeout)\n\t\t\t\t\t// \t3开始都是follower\n\t\t\t\tcase <-rf.timer.C:\n\n\t\t\t\t\tfmt.Printf(\"%v---\", time.Now().Format(\"2006-01-02 15:04:05.000\"))\n\t\t\t\t\tfmt.Printf(\"raft%v[%v] term[%v]收到定时器通知\\n\", rf.me, statemap[rf.state], rf.currentTerm)\n\t\t\t\t\t//定时器如果不reset,只会发一条消息,reset之后才会再次发消息,下次发消息的时间间隔是reset传入的时间\n\t\t\t\t\t//rf.timer.Reset(rf.electTimeout)\n\t\t\t\t\t//4 某个节点超时,切换成申请者,并且开始选举\n\t\t\t\t\trf.mu.Lock()\n\t\t\t\t\trf.becomeCandidate()\n\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t\trf.startElection()\n\t\t\t\t}\n\t\t\tcase Candidate:\n\n\t\t\t\tselect {\n\t\t\t\tcase <-rf.appendLogch: //收到心跳\n\t\t\t\t\trf.timer.Reset(rf.electTimeout)\n\t\t\t\t\t//rf.becomeNewFollower()\n\t\t\t\tcase <-rf.votech: //收到投票\n\t\t\t\t\trf.timer.Reset(rf.electTimeout)\n\t\t\t\tcase <-rf.timer.C:\n\t\t\t\t\tfmt.Printf(\"%v---\", time.Now().Format(\"2006-01-02 15:04:05.000\"))\n\t\t\t\t\tfmt.Printf(\"raft%v[%v] term[%v]收到定时消息\\n\", rf.me, statemap[rf.state], rf.currentTerm)\n\n\t\t\t\t\t//rf.timer.Reset(rf.electTimeout)\n\t\t\t\t\trf.startElection()\n\t\t\t\tdefault: //8收到过半投票,变成leader\n\t\t\t\t\t//fmt.Printf(\"%v\\n\",rf.voteCount)\n\t\t\t\t\t//time.Sleep(100)\n\t\t\t\t\trf.mu.Lock()\n\t\t\t\t\tif rf.voteCount > len(rf.peers)/2 {\n\t\t\t\t\t\trf.becomeLeader()\n\t\t\t\t\t}\n\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t}\n\t\t\tcase Leader: //10开始发心跳\n\t\t\t\tfmt.Printf(\"%v---\", time.Now().Format(\"2006-01-02 15:04:05.000\"))\n\t\t\t\tfmt.Printf(\"raft%v[%v] term[%v]发送心跳之前\\n\", rf.me, statemap[rf.state], rf.currentTerm)\n\t\t\t\tfmt.Printf(\"leader raft%v[%v] term[%v]的日志长度%v 日志内容 %v\\n\", rf.me, statemap[rf.state], rf.currentTerm, len(rf.log), rf.log)\n\n\t\t\t\trf.startAppendLog() //发心跳或appendentry\n\t\t\t\t//time.Sleep(HeartBeatTime)\n\n\t\t\t}\n\t\t}\n\t}()\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\treturn rf\n}", "title": "" }, { "docid": "b6ec250195fe317200a15c8c97ade41f", "score": "0.57651687", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\trf.state.me = me\n\trf.state.numPeers = len(rf.peers)\n\trf.state.queue = make(chan StateRequest)\n\n\t// Your initialization code here (2A, 2B, 2C).\n\t// initialize from state persisted before a crash\n\trf.state.readPersist(persister)\n\n\trf.state.setRole(FOLLOWER)\n\n\trf.heartbeatInterval = 100 * time.Millisecond // max number test permits\n\trf.retryInterval = 20 * time.Millisecond // max number test permits\n\trf.rpcCh = make(chan bool)\n\trf.newEntry = make(chan int)\n\n\trf.commit = make(chan int)\n\trf.applyCh = applyCh\n\trf.shutDown = make(chan interface{})\n\n\tgo rf.state.stateLoop()\n\tgo rf.run()\n\tgo rf.commitLoop()\n\tDTPrintf(\"%d is created, log len: %d\\n\", rf.me, rf.state.getLogLen())\n\n\treturn rf\n}", "title": "" }, { "docid": "8e9a6983b80073d202fbcc831e57003e", "score": "0.5748507", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here.\n\trf.currentTerm = 0\n\trf.votedFor = -1\n\trf.log = append(rf.log, LogEntry{0, 0, nil})\n\n\trf.state = FOLLOWER\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\trf.nextIndex = nil\n\trf.matchIndex = nil\n\n\trf.resetTimeout = make(chan bool, 1)\n\t//rf.heartBeatCh = make(chan bool, 1)\n\t//rf.grantVoteCh = make(chan bool, 1)\n\trf.toFollowerCh = make(chan bool, 1)\n\trf.newMatch = false\n\trf.newMatchCh = make(chan bool, 1)\n\trf.newLeader = false\n\trf.newLeaderCh = make(chan bool, 1)\n\t//rf.newCommand = false\n\t//rf.newCommandCh = make(chan bool, 1)\n\trf.newCommit = false\n\trf.newCommitCh = make(chan bool, 1)\n\trf.applyMsgCh = applyCh\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\tgo rf.Loop()\n\tgo rf.ApplyCheckLoop()\n\treturn rf\n}", "title": "" }, { "docid": "9d153f2589cd302aa5d87072762d99ba", "score": "0.57319456", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\trf.state = follower\n\trf.currentTerm = 0\n\trf.votedFor = -1\n\trf.addLogEntry(logEntry{0, 0, nil})\n\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\trf.applyCh = applyCh\n\trf.convertState = make(chan int, 1)\n\trf.electionTimeout = time.Duration(rand.Int63n(16)*20+300) * time.Millisecond\n\trf.killServer = make(chan int)\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\tgo rf.runService()\n\treturn rf\n}", "title": "" }, { "docid": "03dae3e1bf0dc0e1bb8f38482c335715", "score": "0.5725254", "text": "func serve(s *KVStore, r *rand.Rand, peers *arrayPeers, id string, port int) {\n\t\n\tconst MaxUint = ^uint64(0) \n\tconst MinUint = 0 \n\tconst MaxInt = int64(MaxUint >> 1) \n\tconst MinInt = -MaxInt - 1\n\tlog.SetFlags(log.LstdFlags | log.Lshortfile)\n\traft := Raft{AppendChan: make(chan AppendEntriesInput), VoteChan: make(chan VoteInput)}\n\t// Start in a Go routine so it doesn't affect us.\n\tgo RunRaftServer(&raft, port)\n\tpeerClients := make(map[string]pb.RaftClient)\n\t//////////////////////////////////////////////////////////////STATE////////////////////////////////////////////////////////////\n\t\n\ttotal_peer_index := len(*peers)+1//here///////////////////////\n\ttimer := time.NewTimer(randomDuration(r, false))\n\tCurrState := \"1\" //1-follower, 2-Candidate, 3-Leader\n\tvotedFor := \"\"\n\tvote_count := 0\n\tlocalLeaderID := \"\"\n\tvar local_log []*pb.Entry\n\tcurrentTerm := int64(0)\n\tlocalLastLogTerm := int64(0)\n\tlocalCommitIndex := int64(-1)\n\tlocalLastApplied := int64(-1)\n\tlocalLastLogIndex := int64(-1)\n\t\n\t\n\t\n\tlocalNextIndex := make(map[string]int64)\n\tlocalMatchIndex := make(map[string]int64)\n\tclientReq_id_map := make(map[int64]InputChannelType)\n\n\t\n\tfor _, peer := range *peers {\n\t\tclient, err := connectToPeer(peer)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to connect to GRPC server %v\", err)\n\t\t}\n\t\tpeerClients[peer] = client\n\t\tlocalNextIndex[peer] = 0\n\t\tlocalMatchIndex[peer] = -1\n\t\tlog.Printf(\"Connected to %v\", peer)\n\t}\n\tlocalMatchIndex[id] = -1\n\tlocalNextIndex[id] = 0\n\n\ttype AppendResponse struct {\n\t\tret *pb.AppendEntriesRet\n\t\terr error\n\t\tpeer string\n\t\tlen_ae int64 // length of append entries\n\t\tnext_index int64 //old next index, helps removing redundant next index updates\n\t}\n\n\ttype VoteResponse struct {\n\t\tret *pb.RequestVoteRet\n\t\terr error\n\t\tpeer string\n\t}\n\tappendResponseChan := make(chan AppendResponse)\n\tvoteResponseChan := make(chan VoteResponse)\n\n\t\n\n\n\t// Run forever handling inputs from various channels\n\tfor {\n\t\t\n\t\tselect {\n\t\t\t\t\n\t\t\tcase <-timer.C:\n\t\t\t\t// log.Printf(\"Timeout wentoff\")\n\t\t\t\tif CurrState != \"3\" {\n\t\t\t\t\tlog.Printf(\"Timeout %v\", id)\n\t\t\t\t\t\n\t\t\t\t\tvote_count = 1\n\t\t\t\t\tfellow_peers := len(peerClients)///chekc here\n\t\t\t\t\tcurrentTerm += 1\n\t\t\t\t\tCurrState = \"2\"\n\t\t\t\t\tfor p, c := range peerClients {\n\t\t\t\t\t\t// Send in parallel so we don't wait for each client.\n\t\t\t\t\t\tlog.Printf(\"requesting from %v\", p)\n\t\t\t\t\t\tgo func(c pb.RaftClient, p string) {\n\t\t\t\t\t\t\t// ret, err := c.RequestVote(context.Background(), &pb.RequestVoteArgs{Term: 1, CandidateID: id})\n\t\t\t\t\t\t\tret, err := c.RequestVote(context.Background(), &pb.RequestVoteArgs{Term: currentTerm, CandidateID: id, LastLogIndex: localLastLogIndex, LasLogTerm: localLastLogTerm})\n\t\t\t\t\t\t\tvoteResponseChan <- VoteResponse{ret: ret, err: err, peer: p}\n\t\t\t\t\t\t\t// log.Printf(\"But now I entered timer time out thingy\")\n\t\t\t\t\t\t}(c, p)\n\t\t\t\t\t\t// log.Printf(\"But now I exited timer time out thingy\")\n\t\t\t\t\t}\n\t\t\t\t\tlog.Printf(\"candidate %v requesting from %v peer\", id, fellow_peers)\n\t\t\t\t\trestartTimer(timer, r, false)\n\t\t\t\t} else {\n\t\t\t\t\t// Send heartbeats\n\t\t\t\t\t// log.Printf(\"Sending heartbeats\")\n\t\t\t\t\tnew_entry_struct := pb.AppendEntriesArgs{Term: currentTerm, LeaderID: id, PrevLogIndex: localLastLogIndex, PrevLogTerm: localLastLogTerm, LeaderCommit: localCommitIndex}\n\t\t\t\t\tfor p, c := range peerClients {\n\t\t\t\t\t\tgo func(c pb.RaftClient, p string) {\n\t\t\t\t\t\t\t// log.Printf(\"Sending heartbeats to %v\",p)\n\t\t\t\t\t\t\tret, err := c.AppendEntries(context.Background(), &new_entry_struct)\n\t\t\t\t\t\t\tbufferNextIndex := localNextIndex[p]\n\t\t\t\t\t\t\t// _ = ret\n\t\t\t\t\t\t\t// _ = err\n\t\t\t\t\t\t\tappendResponseChan <- AppendResponse{ret: ret, err: err, peer: p, len_ae: int64(0), next_index: bufferNextIndex}\n\t\t\t\t\t\t}(c, p)\n\t\t\t\t\t}\n\t\t\t\t\trestartTimer(timer, r, true)\n\t\t\t\t}\n\t\t\t\t\n\t\t\tcase op := <-s.C:\n\t\t\t\tlog.Printf(\"We received an operation from a client\")\n\t\t\t\t// We received an operation from a client\n\t\t\t\t// TODO: Figure out if you can actually handle the request here. If not use the Redirect result to send the\n\t\t\t\t// client elsewhere.\n\t\t\t\t// TODO: Use Raft to make sure it is safe to actually run the command.\n\n\t\t\t\tif CurrState == \"3\" {\n\t\t\t\t\t\n\t\t\t\t\tupdate := pb.Entry{Term: currentTerm, Index: localLastLogIndex + 1, Cmd: &op.command}\n\t\t\t\t\tlocal_log = append(local_log, &update)\n\t\t\t\t\tlog.Printf(\"Leader received from a client\")\n\t\t\t\t\tclientReq_id_map[update.Index] = op\n\t\t\t\t\t\n\t\t\t\t\tfor p, c := range peerClients {\n\t\t\t\t\t\tlog.Printf(\"Sending append entries to %v\", p)\n\t\t\t\t\t\tgo func(c pb.RaftClient, p string) {\n\t\t\t\t\t\t\tstart := localNextIndex[p]\n\t\t\t\t\t\t\tlocal_prevLogTerm := int64(0)\n\t\t\t\t\t\t\tlocalPrevNextIndex := localNextIndex[p]\n\t\t\t\t\t\t\tlog.Printf(\"length of local_log %v, localNextIndex[p] %v\",len(local_log), start)\n\t\t\t\t\t\t\tif(start>0){\n\t\t\t\t\t\t\t\tlocal_prevLogTerm = local_log[start].Term\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tnew_entry_list := local_log[start:]\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tnew_entry_struct := pb.AppendEntriesArgs{Term: currentTerm, LeaderID: id, PrevLogIndex: localNextIndex[p]-1, PrevLogTerm: local_prevLogTerm, LeaderCommit: localCommitIndex, Entries: new_entry_list}\n\t\t\t\t\t\t\tret, err := c.AppendEntries(context.Background(), &new_entry_struct)\n\t\t\t\t\t\t\tappendResponseChan <- AppendResponse{ret: ret, err: err, peer: p, len_ae: int64(len(new_entry_list)), next_index: localPrevNextIndex}\n\t\t\t\t\t\t}(c, p)\n\t\t\t\t\t}\n\t\t\t\t\tlocalLastLogIndex += 1 \n\t\t\t\t\tlocalLastLogTerm = currentTerm\n\t\t\t\t} else {\n\t\t\t\t\tres := pb.Result{Result: &pb.Result_Redirect{Redirect: &pb.Redirect{Server: localLeaderID}}}\n\t\t\t\t\top.response <- res\n\t\t\t\t\tlog.Printf(\"Redirect to client\")\n\t\t\t\t}\n\n\t\t\tcase ae := <-raft.AppendChan:\n\t\t\t\t\n\t\t\t\t// We received an AppendEntries request from a Raft peer\n\t\t\t\t// TODO figure out what to do here, what we do is entirely wrong.\n\t\t\t\tleader_commit := ae.arg.LeaderCommit\n\t\t\t\t\n\t\t\t\tae_list := ae.arg.Entries\n\t\t\t\tisHeartBeat := false\n\t\t\t\tif len(ae_list) == 0 {\n\t\t\t\t\tisHeartBeat = true \n\t\t\t\t} \n\t\t\t\tleader_PrevLogIndex := ae.arg.PrevLogIndex\n\t\t\t\tleader_PrevLogTerm := ae.arg.PrevLogTerm\n\t\t\t\tif isHeartBeat {\n\t\t\t\t\t// log.Printf(\"Received heartbeat from %v\", localLeaderID)\n\t\t\t\t\tif ae.arg.Term > currentTerm {\n\t\t\t\t\t\tcurrentTerm = ae.arg.Term\n\t\t\t\t\t\tCurrState = \"1\"\n\t\t\t\t\t\tlocalLeaderID = ae.arg.LeaderID\n\t\t\t\t\t\tlog.Printf(\"Term %v: Now the leader is %v in term %v (heartbeat)\", currentTerm, localLeaderID)\n\t\t\t\t\t}\n\t\t\t\t\tif localLastLogIndex < leader_PrevLogIndex{\n\t\t\t\t\t\tlog.Printf(\"failed because of heartbeat localLastLogIndex %v, leader_PrevLogIndex %v\",localLastLogIndex,leader_PrevLogIndex)\n\t\t\t\t\t\tae.response <- pb.AppendEntriesRet{Term: currentTerm, Success: false}\n\t\t\t\t\t}\n\t\t\t\t\tif localLastLogIndex < leader_commit {\n\t\t\t\t\t\tlocalCommitIndex = localLastLogIndex\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlocalCommitIndex = leader_commit\n\t\t\t\t\t}\n\t\t\t\t\t// log.Printf(\"local commit index is %v, local leader's commit index is %v, leader's last log index is %v\",localCommitIndex, leader_commit, leader_PrevLogIndex)\n\t\t\t\t\t// ae.response <- pb.AppendEntriesRet{Term: currentTerm, Success: true}\n\t\t\t\t} else {\n\t\t\t\t\t// log.Printf(\"Received append entry from %v\", ae.arg.LeaderID)\n\t\t\t\t\tif ae.arg.Term < currentTerm {\n\t\t\t\t\t\tlog.Printf(\"failed append entry as local term is bigger\")\n\t\t\t\t\t\tae.response <- pb.AppendEntriesRet{Term: currentTerm, Success: false}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Printf(\"localLastLogIndex %v leader_PrevLogIndex %v len(local_log) %v leader_PrevLogTerm %v length of append list %v\", localLastLogIndex, leader_PrevLogIndex, len(local_log), leader_PrevLogTerm, len(ae_list))\n\t\t\t\t\t\tif localLastLogIndex < leader_PrevLogIndex {\n\t\t\t\t\t\t\tlog.Printf(\"failed because leader has lengthier log : local last log index %v, leader prev log index %v\",localLastLogIndex, leader_PrevLogIndex)\n\t\t\t\t\t\t\tae.response <- pb.AppendEntriesRet{Term: currentTerm, Success: false}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif leader_PrevLogIndex != -1 && local_log[leader_PrevLogIndex].Term != leader_PrevLogTerm{\n\t\t\t\t\t\t\t\tlog.Printf(\"Failed because terms are unequal\")\n\t\t\t\t\t\t\t\tae.response <- pb.AppendEntriesRet{Term: currentTerm, Success: false}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// deletion_stop := false\n\t\t\t\t\t\t\t\tif localLastLogIndex > leader_PrevLogIndex {\n\t\t\t\t\t\t\t\t\tlog.Printf(\"checking because local log is lengthier\")\n\t\t\t\t\t\t\t\t\t// ae.response <- pb.AppendEntriesRet{Term: currentTerm, Success: false}\n\t\t\t\t\t\t\t\t\tlocal_log = local_log[:(leader_PrevLogIndex+1)]\n\t\t\t\t\t\t\t\t\tfor _, entry := range ae_list {\n\t\t\t\t\t\t\t\t\t\tlocal_log = append(local_log, entry)\n\t\t\t\t\t\t\t\t\t\t// if entry.Index > localLastLogIndex{\n\t\t\t\t\t\t\t\t\t\t// \tlocal_log = append(local_log, entry)\n\t\t\t\t\t\t\t\t\t\t// } else {\n\t\t\t\t\t\t\t\t\t\t// \tif local_log[entry.Index].Term != entry.Term{\n\t\t\t\t\t\t\t\t\t\t// \t\tlocal_log = local_log[:entry.Index]\n\t\t\t\t\t\t\t\t\t\t// \t\tlocal_log = append(local_log,entry)\n\t\t\t\t\t\t\t\t\t\t// \t\tlocalLastLogIndex = len(local_log)+1\n\t\t\t\t\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t\t\t\t\t// }\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tlog.Printf(\"Successfully edited the log\")\n\t\t\t\t\t\t\t\t\tae.response <- pb.AppendEntriesRet{Term: currentTerm, Success: true}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tif localLastLogIndex == leader_PrevLogIndex {\n\t\t\t\t\t\t\t\t\t\t// log.Printf(\"Now appending entries into local log\")\n\t\t\t\t\t\t\t\t\t\tfor _, entry := range ae_list {\n\t\t\t\t\t\t\t\t\t\t\tlocal_log = append( local_log, entry)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tlog.Printf(\"Sucessfull in adding entire log\")\n\t\t\t\t\t\t\t\t\t\tae.response <- pb.AppendEntriesRet{Term: currentTerm, Success: true}\n\t\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// localLastLogIndex = int64(len(local_log) - 1)\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\tcurrentTerm = ae.arg.Term // ?? here ??\n\t\t\t\t\t\tCurrState = \"1\" // ??\n\t\t\t\t\t\tlocalLeaderID = ae.arg.LeaderID // ?? here ??\n\t\t\t\t\t\tlocalLastLogIndex = int64(len(local_log) - 1)\n\t\t\t\t\t\tif len(local_log) > 0{\n\t\t\t\t\t\t\tlocalLastLogTerm = local_log[localLastLogIndex].Term\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tlocalLastLogTerm = -1\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif leader_commit < localLastLogIndex {\n\t\t\t\t\t\t\tlocalCommitIndex = leader_commit\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tlocalCommitIndex = localLastLogIndex\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// log.Printf(\"local commit index is %v, local leader's commit index is %v\",localCommitIndex, leader_commit)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// log.Printf(\"Done appending\")\n\t\t\t\trestartTimer(timer, r, false)\n\t\t\tcase vr := <-raft.VoteChan:\n\t\t\t\t// log.Printf(\"We received a RequestVote RPC from a raft peer\")\n\t\t\t\t// We received a RequestVote RPC from a raft peer\n\t\t\t\t// TODO: Fix this.\n\n\t\t\t\tbufferTerm := vr.arg.Term\n\t\t\t\tbufferID := vr.arg.CandidateID\n\t\t\t\tbufferLastLogIndex := vr.arg.LastLogIndex\n\t\t\t\tbufferLasLogTerm := vr.arg.LasLogTerm\n\t\t\t\t// log.Printf(\"We received a RequestVote RPC and we are entering conditional check\")\n\t\t\t\tif bufferTerm < currentTerm {\n\t\t\t\t\tvr.response <- pb.RequestVoteRet{Term: currentTerm, VoteGranted: false}\n\t\t\t\t\t// log.Printf(\"local term %v is bigger than candidate's term %v\",currentTerm,bufferTerm)\n\t\t\t\t} else {\n\t\t\t\t\tif bufferTerm > currentTerm {\n\t\t\t\t\t\t// log.Printf(\"buffer's term is bigger\")\n\t\t\t\t\t\tvotedFor = \"\"\n\t\t\t\t\t}\n\t\t\t\t\tcurrentTerm = bufferTerm\n\t\t\t\t\t// log.Printf(\"We are entering second conditional check\")\n\t\t\t\t\tif votedFor == \"\" || votedFor == bufferID {\n\t\t\t\t\t\tif bufferLasLogTerm > localLastLogTerm || bufferLastLogIndex >= localLastLogIndex {\n\t\t\t\t\t\t\t// log.Printf(\"Vote to be granted succesfully\")\n\t\t\t\t\t\t\tvr.response <- pb.RequestVoteRet{Term: currentTerm, VoteGranted: true}\n\t\t\t\t\t\t\tvotedFor = bufferID\n\t\t\t\t\t\t\tlog.Printf(\"follower %v voted %v\", id, votedFor)\n\t\t\t\t\t\t\tlocalLeaderID = votedFor\n\t\t\t\t\t\t\t// log.Printf(\"Vote granted succesfully\")\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// log.Printf(\"Vote grant failed 1\")\n\t\t\t\t\t\t\tvr.response <- pb.RequestVoteRet{Term: currentTerm, VoteGranted: false}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// log.Printf(\"Vote grant failed 2\")\n\t\t\t\t\t\tvr.response <- pb.RequestVoteRet{Term: currentTerm, VoteGranted: false}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// log.Printf(\"Exiting conditional check\")\n\t\t\t\tCurrState = \"1\"\n\t\t\t\trestartTimer(timer, r, false) // ??\n\n\t\t\t\t\n\t\t\t\t// log.Printf(\"We received a RequestVote RPC from a raft peer\")\n\t\t\t\t// vr.response <- pb.RequestVoteRet{Term: currentTerm, VoteGranted: false} // Should it be last call?\n\t\t\tcase vr := <-voteResponseChan:\n\t\t\t\t// We received a response to a previou vote request.\n\t\t\t\t// log.Printf(\"We received a response to a previous vote request.\")\n\t\t\t\t// TODO: Fix this\n\t\t\t\tif vr.err != nil {\n\t\t\t\t\tlog.Printf(\"Error calling RPC %v\", vr.err)\n\t\t\t\t} else {\n\t\t\t\t\tpeer_term := vr.ret.Term\n\t\t\t\t\t// log.Printf(\"We entered no error and handling vote response at %v\", id)\n\t\t\t\t\tcheck_vote_status := vr.ret.VoteGranted\n\t\t\t\t\t\n\t\t\t\t\tif peer_term > currentTerm {\n\t\t\t\t\t\tlog.Printf(\"peer %v is now follower, peer term %v, current term %v\", id, peer_term, currentTerm)\n\t\t\t\t\t\tCurrState = \"1\"\n\t\t\t\t\t\tcurrentTerm = peer_term\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif check_vote_status {\n\t\t\t\t\t\t\tvote_count += 1\n\t\t\t\t\t\t\tif vote_count > total_peer_index/2 && CurrState == \"2\" {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tCurrState = \"3\"\n\t\t\t\t\t\t\t\tlocalLeaderID = id\n\t\t\t\t\t\t\t\tlog.Printf(\"peer %v is now leader, peer term %v, %v / %v votes\", id, peer_term, vote_count, total_peer_index)\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tnew_entry_struct := pb.AppendEntriesArgs{Term: currentTerm, LeaderID: id, PrevLogIndex: localLastLogIndex, PrevLogTerm: localLastLogTerm, LeaderCommit: localCommitIndex}\n\t\t\t\t\t\t\t\tfor p, c := range peerClients {\n\t\t\t\t\t\t\t\t\tlocalNextIndex[p] = localLastLogIndex + 1\n\t\t\t\t\t\t\t\t\tgo func(c pb.RaftClient, p string) {\n\t\t\t\t\t\t\t\t\t\tret, err := c.AppendEntries(context.Background(), &new_entry_struct)\n\t\t\t\t\t\t\t\t\t\tbufferNextIndex := localNextIndex[p]\n\t\t\t\t\t\t\t\t\t\t// _ = ret\n\t\t\t\t\t\t\t\t\t\t// _ = err\n\t\t\t\t\t\t\t\t\t\tappendResponseChan <- AppendResponse{ret: ret, err: err, peer: p, len_ae: int64(0), next_index: bufferNextIndex}\n\t\t\t\t\t\t\t\t\t}(c, p)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\trestartTimer(timer, r, true)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t\n\n\t\t\t\t}\n\t\t\t\t// log.Printf(\"I am exiting response to a vote request\")\n\t\t\tcase ar := <-appendResponseChan:\n\t\t\t\tlog.Printf(\"We received a response to a previous AppendEntries RPC call\")\n\t\t\t\t// We received a response to a previous AppendEntries RPC call\n\t\t\t\tpeer_index := ar.peer\n\t\t\t\t// followerTerm := ar.ret.Term\n\t\t\t\tlenOfAppendedEntries := ar.len_ae\n\t\t\t\tpeer_prevNextIndex := ar.next_index\n\t\t\t\tif ar.err != nil {\n\t\t\t\t\tlog.Printf(\"Error calling RPC %v\", ar.err)\n\t\t\t\t} else {\n\t\t\t\t\tfollowerAppendSuccess := ar.ret.Success\t\t\t\t\t\t\n\t\t\t\t\tif followerAppendSuccess {\n\t\t\t\t\t\tlog.Printf(\"It was a successful append entry operation for %v\",peer_index)\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tif lenOfAppendedEntries > 0{\n\t\t\t\t\t\t\tbuffer := int64(len(local_log))\n\t\t\t\t\t\t\tif localNextIndex[peer_index] < buffer{\n\t\t\t\t\t\t\t\tlog.Printf(\"for peer %v: peer_prevNextIndex %v, localNextIndex[peer_index] %v, len(local_log) %v, localLastLogIndex %v, lenOfAppendedEntries %v\",peer_prevNextIndex, peer_index, localNextIndex[peer_index],len(local_log), localLastLogIndex, lenOfAppendedEntries)\n\t\t\t\t\t\t\t\tlocalMatchIndex[peer_index] = peer_prevNextIndex + int64(lenOfAppendedEntries)-1\n\n\n\t\t\t\t\t\t\t\tlocalNextIndex[peer_index] = localMatchIndex[peer_index] + 1\n\t\t\t\t\t\t\t\tlog.Printf(\"for peer %v: localNextIndex[peer_index] %v, len(local_log) %v, localLastLogIndex %v, lenOfAppendedEntries %v\",peer_index, localNextIndex[peer_index],len(local_log), localLastLogIndex, lenOfAppendedEntries)\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\tlog.Printf(\"Now checking commit indices\")\n\t\t\t\t\t\t\t\tnextMaxlocalCommitIndex := localCommitIndex\n\t\t\t\t\t\t\t\tfor i := localCommitIndex; i <= localLastLogIndex; i++ {\n\t\t\t\t\t\t\t\t\tpeer_countReplicatedUptoi := 1\n\t\t\t\t\t\t\t\t\tfor _, followerlocalMatchIndex := range localMatchIndex {\n\t\t\t\t\t\t\t\t\t\tif followerlocalMatchIndex >= i {\n\t\t\t\t\t\t\t\t\t\t\tpeer_countReplicatedUptoi += 1\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif peer_countReplicatedUptoi > total_peer_index/2 {\n\t\t\t\t\t\t\t\t\t\tnextMaxlocalCommitIndex = i\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlocalCommitIndex = nextMaxlocalCommitIndex\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\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ar.ret.Term <= currentTerm{\n\t\t\t\t\t\t\tlog.Printf(\"It was not a successful append entry operation\")\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tif localNextIndex[peer_index] <= localLastLogIndex && len(local_log) > 0 {\n\t\t\t\t\t\t\t\tif lenOfAppendedEntries>0 && localNextIndex[peer_index] > 0{\n\t\t\t\t\t\t\t\t\tlog.Printf(\"Reducing peer %v next index %v\",peer_index,localNextIndex[peer_index])\n\t\t\t\t\t\t\t\t\tlocalNextIndex[peer_index] = peer_prevNextIndex - 1\n\t\t\t\t\t\t\t\t\tlog.Printf(\"Reducing peer %v next index %v\",peer_index,localNextIndex[peer_index])\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbufferNextIndex := localNextIndex[peer_index]\n\t\t\t\t\t\t\t\tbufferLastLogTerm := int64(0)\n\t\t\t\t\t\t\t\tif bufferNextIndex >=0 {\n\t\t\t\t\t\t\t\t\tbufferLastLogTerm = local_log[bufferNextIndex].Term\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// log.Printf(\"2 %v,%v\",bufferLastLogTerm,bufferNextIndex)\n\t\t\t\t\t\t\t\tbufferLastLogIndex := bufferNextIndex - 1\n\t\t\t\t\t\t\t\treplacingPlusNewEntries := local_log[bufferNextIndex:]\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tbuffernew_entry_struct := pb.AppendEntriesArgs{Term: currentTerm, LeaderID: id, PrevLogIndex: bufferLastLogIndex, PrevLogTerm: bufferLastLogTerm, LeaderCommit: localCommitIndex, Entries: replacingPlusNewEntries}\n\t\t\t\t\t\t\t\tlog.Printf(\"It was not a successful append entry operation but successful call\")\n\t\t\t\t\t\t\t\tgo func(c pb.RaftClient, p string) {\n\t\t\t\t\t\t\t\t\tret, err := c.AppendEntries(context.Background(), &buffernew_entry_struct)\n\t\t\t\t\t\t\t\t\tappendResponseChan <- AppendResponse{ret: ret, err: err, peer: p, len_ae: int64(len(replacingPlusNewEntries)), next_index: bufferNextIndex}\n\t\t\t\t\t\t\t\t}(peerClients[peer_index], peer_index)\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}\n\t\t\t\t\t\n\t\t\t\t\tlog.Printf(\"Got append entries response from %v\", ar.peer)\t\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\t//log.Printf(\"But this not that strange\")\n\t\t\t\tif localCommitIndex > localLastApplied {\n\t\t\t\t\tlocalLastApplied += 1\n\t\t\t\t\topCmd := local_log[localLastApplied].Cmd \n\t\t\t\t\tclientRequest, existsInlocalMachine := clientReq_id_map[localLastApplied]\n\t\t\t\t\tif CurrState == \"3\" {\n\t\t\t\t\t\tif existsInlocalMachine {\n\t\t\t\t\t\t\tlog.Printf(\"Handling command now\")\n\t\t\t\t\t\t\ts.HandleCommandLeader(clientRequest) \n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts.HandleCommandFollower(opCmd) \n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t}\n\t}\n\tlog.Printf(\"Strange to arrive here\")\n}", "title": "" }, { "docid": "8c240d565070a7c21c65594c77bf7533", "score": "0.5724021", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\tLogf(DEBUG, CfgLogLevel, \"Make invoke\")\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\trf.CurrentTerm = 0\n\trf.ApplyCh = applyCh\n\n\trf.State = Follower\n\trf.VotedFor = -1\n\n\trf.LastLogIndex = 0\n\trf.LastLogTerm = 1\n\n\trf.lastApplied = -1\n\trf.commitIndex = -1\n\n\tfor i := 0; i < len(peers); i++ {\n\t\trf.nextIndex = append(rf.nextIndex, len(rf.log))\n\t\trf.matchIndex = append(rf.matchIndex, -1)\n\t}\n\n\trf.log = []LogEntry{}\n\n\trand.Seed(time.Now().UnixNano())\n\trf.Timeout = time.Duration(int64(500)+rand.Int63n(500)) * time.Millisecond\n\t//go func(){\n\t//\trf.mu.Lock()\n\trf.Timer = time.AfterFunc(rf.Timeout, func() { rf.InitCandidate() })\n\t//rf.mu.Unlock()\n\t//}()\n\n\t// Your initialization code here (2A, 2B, 2C).\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\t// go through peers\n\t// init each peer\n\t//\n\treturn rf\n}", "title": "" }, { "docid": "f220077052a3882cf816c541527a535e", "score": "0.57068914", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trand.Seed(time.Now().UnixNano())\n\n\trf := &Raft{}\n\trf.me = me\n\trf.peers = peers\n\trf.persister = persister\n\trf.n = len(peers)\n\trf.majority = (rf.n + 1) / 2\n\trf.applyCh = applyCh\n\n\tDPrintf(\"[%d] raft init\\n\", rf.me)\n\trf.state = follower // init as follower\n\trf.resetElectionTimeOut()\n\n\trf.curTerm = 0\n\trf.voteFor = -1\n\trf.log = append(rf.log, Entry{0, 0, nil})\n\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\n\t// start go routine\n\tgo rf.routine()\n\tgo rf.tryCommit()\n\tgo rf.checkCommitIndex()\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\treturn rf\n}", "title": "" }, { "docid": "b133f63d7430426de4026ccaed1b6bad", "score": "0.56881046", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here.\n\t// TODO(1): create a background goroutine that starts en election\n\t// (by sending out RequestVote RPCs) when it hasn't heard from another\n\t// peer in a while ** election timeouts should be randomized **\n\t\n\t// TODO: if necessary, read from persister state\n\t// if so, update log\n\n\trf.currentTerm = 0\n\trf.votedFor = -1\n\trf.commitIndex = -1\n\trf.lastApplied = -1\n\trf.state = FOLLOWER\n\t// set random election timeout?\n\n\n\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\n\treturn rf\n}", "title": "" }, { "docid": "82172d81507f727a7e874ce1e72328a6", "score": "0.567193", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.state = FollowerState\n\trf.stateCh = make(chan int)\n\n\trf.currentTerm = 0\n\trf.votedFor = -1\n\trf.log = make([]Log, 1)\n\trf.log[0].Index = 0\n\trf.log[0].Term = 0\n\trf.applyCh = applyCh\n\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\n\trf.nextIndex = make([]int, len(peers))\n\trf.matchIndex = make([]int, len(peers))\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\trf.readSnapshot(persister.ReadSnapshot())\n\trf.displayLog()\n\n\tgo rf.createCommitTimer()\n\n\tgo rf.stateMachine()\n\n\treturn rf\n}", "title": "" }, { "docid": "46a54b68795aca4e2a0a11649040e2ad", "score": "0.5661308", "text": "func (rf *Raft) msgApplyCh() {\n\t// • If commitIndex > lastApplied: increment lastApplied,\n\t// apply log[lastApplied] to state machine (§5.3)\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\n\tfirstLogIndex := rf.getFirstLogIndex()\n\n\tfor rf.commitIndex > rf.lastApplied {\n\t\trf.lastApplied++\n\t\tmsgLogIndex := rf.lastApplied - firstLogIndex\n\n\t\tnewApplyMsg := ApplyMsg{\n\t\t\tCommandValid: true,\n\t\t\tCommand: rf.log[msgLogIndex].Command,\n\t\t\tCommandIndex: rf.log[msgLogIndex].Index,\n\t\t\tCommandTerm: rf.log[msgLogIndex].Term,\n\t\t}\n\t\t// DPrintf(\"Term[%d], Follower[%d]: sending to applyCh.\\n\", rf.currentTerm, rf.me)\n\t\trf.applyCh <- newApplyMsg\n\t\tDPrintf(\"Term[%d], Server[%d]: sent to applyCh %v.\\n\", rf.currentTerm, rf.me, newApplyMsg)\n\t}\n\n\tassert(rf.commitIndex == rf.lastApplied, \"INVESTIGATE: Append -- rf.commitIndex != rf.lastApplied\\n\")\n}", "title": "" }, { "docid": "8868e3b9dcfd41a51a8182a60a4a3766", "score": "0.56587124", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{\n\t\tpeers: peers,\n\t\tpersister: persister,\n\t\tme: me,\n\t\tapplyCh: applyCh,\n\t\trole: Follower,\n\t\tcurrentTerm: 0,\n\t\tvotedFor: -1,\n\t\tgetVotedTickets: 0,\n\t\tlogs: make([]*Entry, 0),\n\t\tcommitIndex: 0,\n\t\tlastApplied: 0,\n\t}\n\n\t// according to raft-extented paper, log index starts from 1\n\trf.logs = append(rf.logs, &Entry{\n\t\tTerm: 0,\n\t\tCommand: \"start\",\n\t})\n\trf.nextIndex = make([]int, len(rf.peers))\n\trf.matchIndex = make([]int, len(rf.peers))\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\t// start ticker goroutine to start elections / send heartbeats\n\tgo rf.electionTicker()\n\tgo rf.leaderTicker()\n\n\treturn rf\n}", "title": "" }, { "docid": "2cacf56cbec16a9383d927fe57bbcfe2", "score": "0.5654131", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.mu.Lock()\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\trf.step = 100\n\trf.voteFor = -1\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.state = Follower\n\trf.applyCh = applyCh\n\trf.heartBeatTimerReset = make(chan int)\n\trf.stateReset = make(chan int)\n\t// rf.voteTimerReset = make(chan int)\n\trf.currentTerm = 0\n\trf.committedIndex = -1\n\trf.lastApplied = -1\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\t// fmt.Println(\"make new raft \", rf.me)\n\n\tgo rf.MainLoop()\n\n\treturn rf\n}", "title": "" }, { "docid": "cc89cd2d139f53ae4aa80d6b80028952", "score": "0.5653538", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\tDPrintf(\"[Make] create Raft server[%d].\", me)\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here.\n\trf.currentTerm = 0\n\trf.votedFor = -1\n\trf.state = FOLLOWER\n\trf.timer = time.NewTimer(getRandomTimeout())\n\trf.resetTimerCh = make(chan bool, 5)\n\trf.commitIndex = 0\n\trf.voteCount = 0\n\trf.lastApplied = 0\n\trf.applyCh = applyCh\n\trf.logs = append(rf.logs, LogEntry{-1, nil}) // NOTICE: insert an empty log!\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\tgo rf.loopAsFollower()\n\treturn rf\n}", "title": "" }, { "docid": "e52006549b15bceb897c47170dfd80e6", "score": "0.56494117", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.state = Follower\n\trf.currentTerm = 0\n\trf.votedFor = nullVotedFor\n\t// first index of logs is 1\n\t// Thus, we use a dummy variable for index 0\n\t// At index 0, term = 0, Command is nil\n\trf.logs = make([]LogEntry, 1)\n\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\n\trf.applyCh = applyCh\n\t// Use buffered channel to avoid go routine leak\n\t// and non blocking\n\trf.killCh = make(chan bool, 1)\n\trf.voteCh = make(chan bool, 1)\n\trf.appendLogCh = make(chan bool, 1)\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\t// create a background goroutine that will kick off leader election/apppend entries periodically\n\tgo rf.periodicCheck()\n\n\treturn rf\n}", "title": "" }, { "docid": "4ed703001972837a22a22aa6089cd2bf", "score": "0.56389457", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.stat = Follower\n\trf.currentTerm = 0\n\trf.voteFor = -1\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\trf.log = make([]Entry, 0)\n\trf.log = append(rf.log, Entry{0, 0, 0})\n\trf.voteCh = make(chan struct{})\n\trf.appendCh = make(chan struct{})\n\trf.commitCh = make(chan struct{})\n\trf.applyCh = applyCh\n\n\trf.timer = time.NewTimer(getRandomTimeOut())\n\tgo rf.mainLoop()\n\tgo rf.doCommitLoop()\n\t// initialize from state persisted before a crash\n\trf.mu.Lock()\n\trf.readPersist(persister.ReadRaftState())\n\trf.mu.Unlock()\n\n\n\treturn rf\n}", "title": "" }, { "docid": "af0a27fd6ad44b81c15ca6cffce47dbf", "score": "0.562048", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.applyCh = applyCh\n\n\trf.notifyCommitCh = make(chan bool, 1)\n\n\trf.currentTerm = 0\n\trf.votedFor = -1\n\trf.isLeader = false\n\trf.latestCall = time.Now()\n\n\trf.log = make([]LogEntries, 0)\n\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\n\trf.firstLogIndex = 1\n\trf.lastLogIndex = 0\n\n\trf.lastIncludedIndex = 0\n\trf.lastIncludedTerm = 0\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\t// start ticker goroutine to start elections\n\tgo rf.ticker()\n\tgo rf.applyStateMachine()\n\n\treturn rf\n}", "title": "" }, { "docid": "fb3d71a87e9186080bb6a3888c7ea96c", "score": "0.56081796", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.done = make(chan struct{})\n\trf.resetElectionTimer = make(chan struct{})\n\trf.leaderChange = make(chan struct{})\n\trf.applySignal = make(chan struct{})\n\trf.leaderID = -1\n\trf.votedFor = -1\n\trf.commitIndex = -1\n\trf.lastApplied = -1\n\trf.nextIndex = make([]int, len(peers))\n\trf.matchIndex = make([]int, len(peers))\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\tgo rf.election()\n\tgo rf.application(applyCh)\n\n\treturn rf\n}", "title": "" }, { "docid": "d37e553835a8880837139c8ac0d1cfee", "score": "0.5562708", "text": "func serve(s *KVStore, r *rand.Rand, peers *arrayPeers, id string, port int) {\n\tr.Seed(200)\n\traft := Raft{AppendChan: make(chan AppendEntriesInput), VoteChan: make(chan VoteInput)}\n\t// Start in a Go routine so it doesn't affect us.\n\tgo RunRaftServer(&raft, port)\n\n\tpeerClients := make(map[string]pb.RaftClient)\n\n\tfor _, peer := range *peers {\n\t\tclient, err := connectToPeer(peer)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to connect to GRPC server %v\", err)\n\t\t}\n\n\t\tpeerClients[peer] = client\n\t\tlog.Printf(\"Connected to %v\", peer)\n\t}\n\n\ttype AppendResponse struct {\n\t\tret *pb.AppendEntriesRet\n\t\tprevLogIndex int64\n\t\t//lastLogIndex int64 // the index of last log\n\t\tlenEntries int64\n\t\terr error\n\t\tpeer string\n\t}\n\n\ttype VoteResponse struct {\n\t\tret *pb.RequestVoteRet\n\t\terr error\n\t\tpeer string\n\t}\n\tappendResponseChan := make(chan AppendResponse)\n\tvoteResponseChan := make(chan VoteResponse)\n\n\t// Create a timer and start running it\n\ttimer := time.NewTimer(randomDuration(r))\n\tleadertimer := time.NewTimer(heartbeatDuration(r))\n\n\t// Persistent state on all server\n\tcurrentTerm := int64(0)\n\tvotedFor := \"\"\n\tvar LOG []*pb.Entry\n\n\t// Volatile state on all server\n\tcommitIndex := int64(0)\n\tlastApplied := int64(0)\n\n\t// Volatile state on leaders\t// Reinitialized after election\n\tnextIndex := make(map[string]int64)\n\tmatchIndex := make(map[string]int64)\n\tleader_matchIndex := int64(0)\n\n\t// my own variable\n\trole := FOLLOWER\n\tnum_votes_received := 0\n\tcurrLeader := id\n\tresponseChan := make(map[int64]chan pb.ResultBatch) // only for leader to store the response channel for each operation\n\n\t// initialize LOG with a empty entry with index 0\n\tLOG = append(LOG, &pb.Entry{Term: 0, Index: 0, CmdB: nil})\n\n\t// Run forever handling inputs from various channels\n\tfor {\n\t\t//time.Sleep(10 * time.Millisecond)\n\t\t//log.Println(LOG)\n\t\t//All Servers: If commitIndex > lastApplied: increment lastApplied, apply log[lastApplied] to state machine\n\n\t\t// if role is leader then send append entry RPCs each round\n\t\tif role == LEADER {\n\t\t\t// If there exists an N such that N > commitIndex, a majority of matchIndex[i]>=N, and log[N].Term == currentTerm: set commitIndex = N\n\t\t\tfor i := commitIndex + 1; i < int64(len(LOG)); i++ {\n\t\t\t\tif LOG[i].Term == currentTerm {\n\t\t\t\t\tcount := 0\n\t\t\t\t\tif leader_matchIndex >= i {\n\t\t\t\t\t\tcount += 1\n\t\t\t\t\t}\n\t\t\t\t\tfor p := range peerClients {\n\t\t\t\t\t\tif matchIndex[p] >= i {\n\t\t\t\t\t\t\tcount += 1\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif count > (len(peerClients)+1)/2 {\n\t\t\t\t\t\tcommitIndex = i\n\t\t\t\t\t} else {\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\tif commitIndex > lastApplied { // Response after entry applied to state machine if this server is LEADER\n\t\t\t\tlastApplied += 1\n\t\t\t\t// implement parallelism\n\t\t\t\tgo s.HandleBatchCommand(BatchInputChannelType{command_batch: *LOG[lastApplied].CmdB, response_batch: responseChan[lastApplied]})\n\t\t\t}\n\t\t} else if commitIndex > lastApplied { // Update state machine if this server is not leader\n\t\t\tlastApplied += 1\n\t\t\t// implement parallelism\n\t\t\tgo s.UpdateStateMachineWBC(*LOG[lastApplied].CmdB)\n\t\t}\n\n\t\tselect {\n\t\tcase <-timer.C:\n\t\t\t// The timer went off.\n\t\t\tlog.Printf(\"Time out!\")\n\t\t\t// On conversion to candidate, start election:\n\t\t\trole = CANDIDATE\n\t\t\t// \tIncrement current term\n\t\t\tcurrentTerm += 1\n\t\t\t// \tVote for self\n\t\t\tvotedFor = id\n\t\t\tnum_votes_received = 1\n\t\t\t// \tSend request vote RPCs to all other servers\n\t\t\tfor p, c := range peerClients {\n\t\t\t\t// Send in parallel so we don't wait for each client.\n\t\t\t\t// get lastLogTerm\n\t\t\t\tlastLogTerm := LOG[len(LOG)-1].Term\n\t\t\t\tlastLogIndex := LOG[len(LOG)-1].Index\n\n\t\t\t\tgo func(c pb.RaftClient, p string) {\n\t\t\t\t\tret, err := c.RequestVote(context.Background(), &pb.RequestVoteArgs{Term: currentTerm, CandidateID: id, LastLogIndex: lastLogIndex, LasLogTerm: lastLogTerm})\n\t\t\t\t\tvoteResponseChan <- VoteResponse{ret: ret, err: err, peer: p}\n\t\t\t\t}(c, p)\n\t\t\t}\n\t\t\t// This will also take care of any pesky timeouts that happened while processing the operation.\n\t\t\trestartTimer(timer, r)\n\t\tcase <-leadertimer.C:\n\t\t\tif role == LEADER {\n\t\t\t\tlastLogIndex := LOG[len(LOG)-1].Index\n\t\t\t\tfor p, c := range peerClients {\n\t\t\t\t\tprevLogIndex := LOG[nextIndex[p]-1].Index\n\t\t\t\t\tprevLogTerm := LOG[nextIndex[p]-1].Term\n\t\t\t\t\t// If last log index >= nextIndex for a follower: send Append Entries RPC with log entries starting at nextIndex\n\t\t\t\t\tvar entries []*pb.Entry = nil\n\t\t\t\t\tif nextIndex[p] < int64(len(LOG)) {\n\t\t\t\t\t\tentries = LOG[nextIndex[p]:]\n\t\t\t\t\t}\n\t\t\t\t\tgo func(c pb.RaftClient, p string) {\n\t\t\t\t\t\tret, err := c.AppendEntries(context.Background(), &pb.AppendEntriesArgs{Term: currentTerm, LeaderID: id, PrevLogIndex: prevLogIndex, PrevLogTerm: prevLogTerm, LeaderCommit: commitIndex, Entries: entries})\n\t\t\t\t\t\tappendResponseChan <- AppendResponse{ret: ret, prevLogIndex: prevLogIndex, lenEntries: int64(len(entries)), err: err, peer: p}\n\t\t\t\t\t}(c, p)\n\t\t\t\t\t// implement pipeline\n\t\t\t\t\tnextIndex[p] = lastLogIndex + 1\n\t\t\t\t}\n\t\t\t\trestartTimer(timer, r)\n\t\t\t\trestartLeaderTimer(leadertimer, r)\n\t\t\t}\n\t\t/*\n\t\t\tcase op := <-s.C:\n\t\t\t\t// We received an operation from a client\n\t\t\t\t// Figure out if you can actually handle the request here. If not use the Redirect result to send the\n\t\t\t\t// client elsewhere.\n\t\t\t\tif role != LEADER { // send pb.Redirect{currLeader} back to client\n\t\t\t\t\top.response <- pb.Result{Result: &pb.Result_Redirect{Redirect: &pb.Redirect{Server: currLeader}}}\n\t\t\t\t} else { // if role is LEADER\n\t\t\t\t\tlog.Printf(\"received operation %v\", op.command)\n\t\t\t\t\t// append entry to local log\n\t\t\t\t\tlastLogIndex := LOG[len(LOG)-1].Index\n\n\t\t\t\t\tlastLogIndex += 1\n\t\t\t\t\t//log.Printf(\" new log index: %v\", lastLogIndex)\n\t\t\t\t\tLOG = append(LOG, &pb.Entry{Term: currentTerm, Index: lastLogIndex, Cmd: &op.command})\n\t\t\t\t\tresponseChan[lastLogIndex] = op.response\n\t\t\t\t}\n\t\t\t\t// Use Raft to make sure it is safe to actually run the command.\n\t\t*/\n\t\tcase op_b := <-s.BC: // after implement batching\n\t\t\t// We received an operation from a client\n\t\t\t// Figure out if you can actually handle the request here. If not use the Redirect result to send the\n\t\t\t// client elsewhere.\n\t\t\tif role != LEADER { // send pb.Redirect{currLeader} back to client\n\t\t\t\tredirect_m := pb.Result{Result: &pb.Result_Redirect{Redirect: &pb.Redirect{Server: currLeader}}}\n\t\t\t\tlog.Printf(\"Redirect to %v\", redirect_m)\n\t\t\t\tres_b := make([]*pb.Result, 0)\n\t\t\t\tres_b = append(res_b, &redirect_m)\n\t\t\t\top_b.response_batch <- pb.ResultBatch{ResB: res_b}\n\t\t\t} else { // if role is LEADER\n\t\t\t\tlog.Printf(\"received operation batch: %v\", len(op_b.command_batch.CmdB))\n\t\t\t\t// append entry to local log\n\t\t\t\tlastLogIndex := LOG[len(LOG)-1].Index\n\n\t\t\t\tlastLogIndex += 1\n\t\t\t\t//log.Printf(\" new log index: %v\", lastLogIndex)\n\t\t\t\tLOG = append(LOG, &pb.Entry{Term: currentTerm, Index: lastLogIndex, CmdB: &op_b.command_batch})\n\t\t\t\t// write log to non-volatile storage \n\t\t\t\tgo func(){\n\t\t\t\t\t// to improve efficiency, write to disk concurrenctly\n\t\t\t\t\t// after finished writing to disk\n\t\t\t\t\tleader_matchIndex = LOG[len(LOG)-1].Index\n\t\t\t\t}()\n\t\t\t\tresponseChan[lastLogIndex] = op_b.response_batch\n\n\t\t\t}\n\t\t\t// Use Raft to make sure it is safe to actually run the command.\n\n\t\tcase ae := <-raft.AppendChan:\n\t\t\t// We received an AppendEntries request from a Raft peer\n\n\t\t\t// If RPC request or response contains term T > currentTerm: set currentTerm = T, convert to follower\n\t\t\tif ae.arg.Term > currentTerm {\n\t\t\t\tcurrentTerm = ae.arg.Term\n\t\t\t\trole = FOLLOWER\n\t\t\t\tvotedFor = \"\"\n\t\t\t\tnum_votes_received = 0\n\t\t\t}\n\t\t\t// If AppendEntries RPC received from new leader: convert to follower\n\t\t\tif role != LEADER && ae.arg.LeaderID != currLeader {\n\t\t\t\tcurrLeader = ae.arg.LeaderID\n\t\t\t\trole = FOLLOWER\n\t\t\t\tvotedFor = \"\"\n\t\t\t\tnum_votes_received = 0\n\t\t\t}\n\t\t\t//\t Reply false if term < currentTerm\n\t\t\tif ae.arg.Term < currentTerm {\n\t\t\t\tae.response <- pb.AppendEntriesRet{Term: currentTerm, Success: false}\n\t\t\t} else if int64(len(LOG)) <= ae.arg.PrevLogIndex || LOG[ae.arg.PrevLogIndex].Term != ae.arg.PrevLogTerm {\n\t\t\t\t// Reply false if log doesn't contain an entry at prevLogIndex whose term matches prevLogTerm\n\t\t\t\t//log.Printf(\"LOG doesn't contain an entry at prevLogIndex's term match prevLogTerm\")\n\t\t\t\tae.response <- pb.AppendEntriesRet{Term: currentTerm, Success: false}\n\t\t\t} else {\n\t\t\t\tif ae.arg.Entries != nil {\n\t\t\t\t\tlog.Printf(\"Received append entry from %v at term %v\", ae.arg.LeaderID, ae.arg.Term)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Printf(\"Received heartbeats from %v at term %v\", ae.arg.LeaderID, ae.arg.Term)\n\t\t\t\t}\n\t\t\t\t// If an existing entry conflicts with a new one (same index but different terms), delete the existing entry and all that follow it\n\t\t\t\tstart_to_delete_index := int64(len(LOG))\n\t\t\t\tfor i := ae.arg.PrevLogIndex + 1; i < int64(len(LOG)) && i-ae.arg.PrevLogIndex-1 < int64(len(ae.arg.Entries)); i++ {\n\t\t\t\t\tif LOG[i].Term != ae.arg.Entries[i-ae.arg.PrevLogIndex-1].Term {\n\t\t\t\t\t\tstart_to_delete_index = i\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//log.Printf(\"start to delete index: %v\", start_to_delete_index)\n\t\t\t\tLOG = LOG[:start_to_delete_index]\n\t\t\t\t// Append any new entries not already in the log\n\t\t\t\tfor i := start_to_delete_index - ae.arg.PrevLogIndex - 1; i < int64(len(ae.arg.Entries)); i++ {\n\t\t\t\t\tLOG = append(LOG, ae.arg.Entries[i])\n\t\t\t\t}\n\t\t\t\t// If leaderCommit > commitIndex, set commitIndex = min(leaderCommit, index of last new entry)\n\t\t\t\tif ae.arg.LeaderCommit > commitIndex {\n\t\t\t\t\tlastNewEntryIndex := int64(len(LOG)) - 1\n\t\t\t\t\tcommitIndex = Min(ae.arg.LeaderCommit, lastNewEntryIndex)\n\t\t\t\t}\n\t\t\t\tae.response <- pb.AppendEntriesRet{Term: currentTerm, Success: true}\n\t\t\t}\n\t\t\t// This will also take care of any pesky timeouts that happened while processing the operation.\n\t\t\trestartTimer(timer, r)\n\t\tcase vr := <-raft.VoteChan:\n\t\t\t// We received a RequestVote RPC from a raft peer\n\t\t\tlog.Printf(\"Received vote request from %v\", vr.arg.CandidateID)\n\t\t\t// If RPC request or response contains term T > currentTerm: set currentTerm = T, convert to follower\n\t\t\tif vr.arg.Term > currentTerm {\n\t\t\t\tcurrentTerm = vr.arg.Term\n\t\t\t\trole = FOLLOWER\n\t\t\t\tnum_votes_received = 0\n\t\t\t\tvotedFor = \"\"\n\t\t\t}\n\n\t\t\t// get lastLogTerm and lastLogIndex for second condition below\n\t\t\tlastLogTerm := LOG[len(LOG)-1].Term\n\t\t\tlastLogIndex := LOG[len(LOG)-1].Index\n\n\t\t\tif vr.arg.Term < currentTerm {\n\t\t\t\t// Reply false if term < currentTerm\n\t\t\t\t//log.Printf(\"Candidate %v 's term: %v is smaller than current term: %v\", vr.arg.CandidateID, vr.arg.Term, currentTerm)\n\t\t\t\tvr.response <- pb.RequestVoteRet{Term: currentTerm, VoteGranted: false}\n\t\t\t} else if (votedFor == \"\" || votedFor == vr.arg.CandidateID) && vr.arg.LastLogIndex >= lastLogIndex && vr.arg.LasLogTerm >= lastLogTerm {\n\t\t\t\t// If votedFor is null or candidateId, and candidate's log is at least up-to-date as receiver's log, grant vote\n\t\t\t\tvotedFor = vr.arg.CandidateID\n\t\t\t\tvr.response <- pb.RequestVoteRet{Term: currentTerm, VoteGranted: true}\n\t\t\t\trestartTimer(timer, r)\n\t\t\t} else {\n\t\t\t\tvr.response <- pb.RequestVoteRet{Term: currentTerm, VoteGranted: false}\n\t\t\t}\n\t\tcase vr := <-voteResponseChan:\n\t\t\t// We received a response to a previous vote request.\n\t\t\tif vr.err != nil {\n\t\t\t\t// Do not do Fatalf here since the peer might be gone but we should survive.\n\t\t\t\t//log.Printf(\"Error calling RPC %v\", vr.err)\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Got response to vote request from %v\", vr.peer)\n\t\t\t\t//log.Printf(\"Peers %s granted %v term %v\", vr.peer, vr.ret.VoteGranted, vr.ret.Term)\n\t\t\t\t// If RPC request or response contains term T > currentTerm: set currentTerm = T, convert to follower\n\t\t\t\tif vr.ret.Term > currentTerm {\n\t\t\t\t\tcurrentTerm = vr.ret.Term\n\t\t\t\t\trole = FOLLOWER\n\t\t\t\t\tvotedFor = \"\"\n\t\t\t\t\tnum_votes_received = 0\n\t\t\t\t}\n\t\t\t\tif vr.ret.Term == currentTerm && vr.ret.VoteGranted && role == CANDIDATE {\n\t\t\t\t\tnum_votes_received += 1\n\t\t\t\t}\n\t\t\t\t// if vr.ret.Term < currentTerm\n\t\t\t\t//\tdo nothing, ignore previous vote request's response\n\t\t\t\tif num_votes_received > (len(peerClients)+1)/2 && role == CANDIDATE {\n\t\t\t\t\tlog.Printf(\"Received %v votes from peers, current term: %v, I become leader!!!\", num_votes_received, currentTerm)\n\t\t\t\t\trole = LEADER\n\t\t\t\t\tcurrLeader = id\n\t\t\t\t\t// initialize volatile state on leaders\n\t\t\t\t\t// \tget lastLogIndex\n\t\t\t\t\tlastLogIndex := int64(0)\n\t\t\t\t\tlastLogIndex = LOG[len(LOG)-1].Index\n\t\t\t\t\tfor _, peer := range *peers {\n\t\t\t\t\t\tnextIndex[peer] = lastLogIndex + 1\n\t\t\t\t\t\tmatchIndex[peer] = 0\n\t\t\t\t\t}\n\t\t\t\t\tleader_matchIndex = lastLogIndex\n\n\t\t\t\t\tfor p, c := range peerClients {\n\t\t\t\t\t\tprevLogIndex := LOG[nextIndex[p]-1].Index\n\t\t\t\t\t\tprevLogTerm := LOG[nextIndex[p]-1].Term\n\n\t\t\t\t\t\tgo func(c pb.RaftClient, p string) {\n\t\t\t\t\t\t\tret, err := c.AppendEntries(context.Background(), &pb.AppendEntriesArgs{Term: currentTerm, LeaderID: id, PrevLogIndex: prevLogIndex, PrevLogTerm: prevLogTerm, LeaderCommit: commitIndex, Entries: nil})\n\t\t\t\t\t\t\tappendResponseChan <- AppendResponse{ret: ret, prevLogIndex: prevLogIndex, lenEntries: int64(0), err: err, peer: p}\n\t\t\t\t\t\t}(c, p)\n\t\t\t\t\t}\n\t\t\t\t\trestartLeaderTimer(leadertimer, r)\n\t\t\t\t}\n\t\t\t}\n\t\tcase ar := <-appendResponseChan:\n\t\t\t// We received a response to a previous AppendEntries RPC call\n\t\t\tif ar.err != nil {\n\t\t\t\t//log.Printf(\"Error calling RPC %c\", ar.err)\n\t\t\t} else {\n\t\t\t\t// If RPC request or response contains term T > currentTerm: set currentTerm = T, convert to follower\n\t\t\t\tif ar.ret.Term > currentTerm {\n\t\t\t\t\tcurrentTerm = ar.ret.Term\n\t\t\t\t\trole = FOLLOWER\n\t\t\t\t\tvotedFor = \"\"\n\t\t\t\t\tnum_votes_received = 0\n\t\t\t\t}\n\t\t\t\tif role == LEADER && ar.ret.Term == currentTerm {\n\t\t\t\t\t//log.Printf(\"Got append response from %v at term %v %v\", ar.peer, currentTerm, ar.prevLogIndex+ar.lenEntries)\n\t\t\t\t\t// If successful: update nextIndex and matchIndex for follower\n\t\t\t\t\tif ar.ret.Success == true {\n\t\t\t\t\t\tmatchIndex[ar.peer] = ar.prevLogIndex + ar.lenEntries\n\t\t\t\t\t\tnextIndex[ar.peer] = ar.prevLogIndex + ar.lenEntries + 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If AppendEntries fails because of log inconsistency: decrement nextIndex and retry\n\t\t\t\t\t\t//if nextIndex[ar.peer] > 1 {\n\t\t\t\t\t\t//\tnextIndex[ar.peer] -= 1\n\t\t\t\t\t\t//}\n\t\t\t\t\t\tnextIndex[ar.peer] = ar.prevLogIndex\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\tlog.Printf(\"Strange to arrive here\")\n}", "title": "" }, { "docid": "ebb0c175532fd42f7f06023a6ab3dcae", "score": "0.55351144", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\tr := &Raft{}\n\tr.peers = peers\n\tr.persister = persister\n\tr.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\t// init\n\tr.coreEventChan = make(chan *event, 1024)\n\tr.applyChan = applyCh\n\tr.state = Follower\n\tr.stopped = make(chan bool)\n\tr.nextIndex = make([]int, len(r.peers))\n\tr.matchIndex = make([]int, len(r.peers))\n\tr.readPersist(persister.ReadRaftState())\n\ts := fmt.Sprintf(\"start with voted for: %v, commitIndex: %v, lastApply: %v log len: %v\", r.votedFor, r.commitIndex, r.lastApplied, len(r.log))\n\tDPrintf(r.me, r.currentTerm, r.state, s)\n\n\t// initialize from state persisted before a crash\n\n\tr.routineGroup.Add(1)\n\tgo func() {\n\t\tdefer r.routineGroup.Done()\n\t\tr.eventLoop()\n\t}()\n\n\n\treturn r\n}", "title": "" }, { "docid": "665d9e075a4639fe4841d32b7e454a79", "score": "0.5517538", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.status = FOLLOWER\n\trf.currentTerm = 0\n\trf.votedFor = -1\n\trf.log = nil\n\trf.snapshotLastIncludedIndex = 0\n\trf.snapshotLastIncludedTerm = 0\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\n\trf.applyCh = applyCh\n\trf.needLogReplication = make([]EventDispatcher, len(rf.peers))\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\trf.lastApplied = rf.snapshotLastIncludedIndex\n\trf.snapshot = persister.ReadSnapshot()\n\n\t// start ticker goroutine to start elections\n\tgo rf.electionTicker()\n\tgo rf.applyRoutine()\n\n\treturn rf\n}", "title": "" }, { "docid": "9754e16dc85804d5c6a807e6b30a688e", "score": "0.5421422", "text": "func Make(peers []*labrpc.ClientEnd, me int, persister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.role = Follower\n\trf.applyMsgCh = applyCh\n\trf.roleWantCh = make(chan RoleWant)\n\trf.nextIndexes = make([]int, len(rf.peers))\n\trf.matchIndexes = make([]int, len(rf.peers))\n\trf.setVotedFor(-1)\n\trf.logs = []Log{{\n\t\tCommand: nil,\n\t\tTerm: -1,\n\t\tIndex: 0,\n\t}}\n\trf.setCurrentTerm(0)\n\trf.quitCh = make(chan struct{})\n\trf.Run()\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\treturn rf\n}", "title": "" }, { "docid": "679a16ae1b2c6bbc44c9cfdbdcce7f0c", "score": "0.54099053", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\trf.n = len(rf.peers)\n\trf.state = FOLLOWER\n\trf.currentTerm = 0\n\trf.votedFor = -1\n\trf.votedMe = 0\n\trf.log = make([]LogEntry, 0)\n\trf.log = append(rf.log, LogEntry{Term: 0})\n\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\n\trf.nextIndex = make([]int, rf.n)\n\trf.matchIndex = make([]int, rf.n)\n\n\trf.chanVote = make(chan bool, 100)\n\trf.chanHeartBeat = make(chan bool, 100)\n\trf.chanGrantVote = make(chan bool, 100)\n\trf.chanCommit = make(chan bool, 100)\n\n\trf.chanApply = applyCh\n\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\tgo rf.RaftLoop()\n\tgo rf.ApplyCommitted()\n\n\treturn rf\n}", "title": "" }, { "docid": "51ee7ce827d62858ce07047ee0e5aed3", "score": "0.5384366", "text": "func (r *ForwardingClient) Apply(cmd []byte, reply *int) error {\n\tif r.fsm.raft.State() != raft.Leader {\n\t\treturn ErrNotLeader\n\t}\n\t\n\tif r.fsm.raft.VerifyLeader().Error() != nil {\n\t\treturn ErrNotLeader\n\t}\n\n\tif errF := r.fsm.raft.Apply(cmd, raftTimeout); errF.Error() != nil {\n\t\treturn errF.Error()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d73ebb56bb54896481bf96cb99e8c41e", "score": "0.5356594", "text": "func main() {\n\tdone := make(chan bool)\n\n\tlog.Println(\"Reading config\")\n\tcfg := config.NewConfig()\n\n\tlog.Println(\"Initializing caches...\")\n\n\tdataCache := database.NewMemoryDatabase()\n\ttxCache := database.NewMemoryDatabase()\n\n\tlog.Println(\"Initializing wal...\")\n\n\twal, err := database.NewFileDatabase(cfg.WalConfig)\n\tif err != nil {\n\t\tlog.Fatalln(\"Could not create local write-ahead log: \", err.Error())\n\t}\n\n\tlog.Println(\"Initializing coordinator service for recovery...\")\n\tcoordinatorService := service.NewTPCCoordinator(cfg.PeerList, false, cfg.Port)\n\n\tlog.Println(\"Initializing server...\")\n\n\tparticipantService := service.NewTPCParticipant(wal, dataCache, txCache, coordinatorService)\n\n\tcommitServer := controller.NewCommitServer(participantService)\n\n\tlog.Println(\"Getting listener on: \", cfg.Port)\n\n\tlis, err := net.Listen(\"tcp\", \"127.0.0.1:\" + cfg.Port)\n\tif err != nil {\n\t\tlog.Fatalln(\"Failed to start listening: \", err.Error())\n\t}\n\n\tlog.Println(\"Starting server...\")\n\n\tgrpcServer := grpc.NewServer()\n\tpbservice.RegisterCommitServer(grpcServer, commitServer)\n\tgo func() {\n\t\tif err := grpcServer.Serve(lis); err != nil {\n\t\t\tlog.Fatalln(\"Failed to start serving: \", err.Error())\n\t\t}\n\t}()\n\n\terr = coordinatorService.Connect()\n\tif err != nil {\n\t\tlog.Fatalln(\"Failed to connect to peers: \", err.Error())\n\t}\n\n\tlog.Println(\"Recovering last state...\")\n\terr = participantService.Recover(false)\n\tif err != nil {\n\t\tlog.Fatalln(\"Could not recover state: \", err.Error())\n\t}\n\n\t<- done\n}", "title": "" }, { "docid": "1463586a20b9451d7fd4b55e0368ef9c", "score": "0.53263295", "text": "func FireAServer(myid int) Server {\n\n\tfileName := \"clusterConfig.json\"\n\tvar obj ClusterConfig\n\tfile, e := ioutil.ReadFile(fileName)\n\n\tif e != nil {\n\t\tpanic(\"File error: \" + e.Error())\n\t}\n\n\tjson.Unmarshal(file, &obj)\n\n\tlogfile := os.Getenv(\"GOPATH\") + \"/log/log_\" + strconv.Itoa(myid)\n\n\ttLog := createNewLog(logfile)\n\n\tserverVar := &Raft{\n\t\tPid: UNKNOWN,\n\t\tPeers: make([]int, len(obj.Servers)-1),\n\t\tPath: \"\",\n\t\tTerm: INITIALIZATION,\n\t\tVotedFor: NOVOTE,\n\t\tVotedTerm: UNKNOWN,\n\t\tLeaderId: UNKNOWN,\n\t\tCommitIndex: 0,\n\t\tElectTicker: nil,\n\t\tPrevLogIndex: 0,\n\t\tPrevLogTerm: 0,\n\t\tMatchIndex: make(map[int]uint64),\n\t\tNextIndex: make(map[int]uint64),\n\t\tLastApplied: 0,\n\t\tState: FOLLOWER, //Initialized server as FOLLOWER\n\t\tIn: make(chan *Envelope),\n\t\tOut: make(chan *Envelope),\n\t\tAddress: map[int]string{},\n\t\tClientSockets: make(map[int]*zmq.Socket),\n\t\tLsnVar: 0,\n\t\tLogSockets: make(map[int]*zmq.Socket),\n\t\tInchan: make(chan *LogEntryStruct),\n\t\tOutchan: make(chan interface{}),\n\t\tClusterSize: len(obj.Servers) - 1,\n\t\tGotConsensus: make(chan bool),\n\t\tSLog: tLog,\n\t\tInprocess: false,\n\t}\n\n\tcount := 0\n\tLeaderID = UNKNOWN\n\tQuorum = UNKNOWN\n\n\t//fmt.Println(\"======= Initating Server : \", myid, \"==========\")\n\n\tvar clientPortAddr string\n\tfor i := range obj.Servers {\n\n\t\tif obj.Servers[i].Id == strconv.Itoa(myid) {\n\t\t\tserverVar.Pid, _ = strconv.Atoi(obj.Servers[i].Id)\n\t\t\tclientPortAddr = obj.Servers[i].HostName + \":\" + obj.Servers[i].ClientPort\n\n\t\t} else {\n\n\t\t\tserverVar.Peers[count], _ = strconv.Atoi(obj.Servers[i].Id)\n\t\t\t//fmt.Println(\"Peers -> \", serverVar.Peers[count])\n\t\t\tcount++\n\n\t\t}\n\t\t//Assigning first ID as leader\n\t\tif LeaderID == -1 {\n\t\t\tLeaderID, _ = strconv.Atoi(obj.Servers[i].Id)\n\n\t\t}\n\n\t\t//fmt.Println(\"Server PID = \", serverVar.Pid)\n\t\tserverVar.Path = obj.Path.Path\n\n\t\tservid, _ := strconv.Atoi(obj.Servers[i].Id)\n\t\tserverVar.Address[servid] = obj.Servers[i].HostName + \":\" + obj.Servers[i].LogPort\n\t\t//fmt.Println(\"Server Address is \",serverVar.Address[servid],\"servid = \",servid)\n\n\t}\n\n\tgob.Register(LogEntryStruct{})\n\tgob.Register(appendEntries{})\n\tgob.Register(appendEntriesResponse{})\n\tgob.Register(Command{})\n\n\tno_servers, _ := strconv.Atoi(obj.Count.Count)\n\tQuorum = int((no_servers-1)/2 + 1.0)\n\tfor i := range serverVar.PeersIds() {\n\t\tserverVar.LogSockets[serverVar.Peers[i]], _ = zmq.NewSocket(zmq.PUSH)\n\t\tserverVar.LogSockets[serverVar.Peers[i]].SetSndtimeo(time.Millisecond * 30)\n\t\terr := serverVar.LogSockets[serverVar.Peers[i]].Connect(\"tcp://\" + serverVar.Address[serverVar.Peers[i]])\n\t\t//fmt.Println(\"Log Port : \", serverVar.LogSockets[serverVar.Peers[i]])\n\t\tif err != nil {\n\t\t\tpanic(\"Connect error \" + err.Error())\n\t\t}\n\n\t\t//initialize matchIndex\n\t\tserverVar.MatchIndex[serverVar.Peers[i]] = 0\n\t\tserverVar.NextIndex[serverVar.Peers[i]] = serverVar.GetLastApplied() + 1\n\n\t\tvoteMap[serverVar.Peers[i]] = false\n\n\t\t//fmt.Println(\"serverVar.NextIndex[serverVar.Peers[i]] = \", serverVar.NextIndex[serverVar.Peers[i]])\n\t}\n\t// Fork methods for communication within cluster\n\n\t//fmt.Println(\"Leader = \", LeaderID)\n\n\tserverVar.SLog.ApplyFunc = func(e *LogEntryStruct) {\n\n\t\t//fmt.Println(\"ApplyFunc() --> \", e.Logsn)\n\t\tserverVar.Inchan <- e\n\t}\n\tgo SendMail(serverVar)\n\tgo GetMail(serverVar)\n\n\t//Open port for client-server communication\n\tgo serverVar.ClientServerComm(clientPortAddr)\n\n\treturn serverVar\n}", "title": "" }, { "docid": "a9dcdc9ab314ac2920b7084bb78b8c59", "score": "0.5312675", "text": "func newServer(site_id string, peers Map) *Server {\n\trecord := read_stable_storage()\n\tif record == nil {\n\t\trecord = newLogRecord(peers.Hosts)\n\t}\n\n\ts := Server{site_id: site_id,\n\t\tpeers: peers.Hosts,\n\t\tpeer_addrs: make(map[string]*net.UDPAddr),\n\t\tstdin_c: make(chan string),\n\t\tnetwk_c: make(chan Message),\n\t\trecord: *record}\n\n\tfor id, node := range s.peers {\n\t\ts.peer_addrs[id] = &net.UDPAddr{\n\t\t\tPort: node.UdpStartPort,\n\t\t\tIP: net.ParseIP(node.IpAddress)}\n\t}\n\treturn &s\n}", "title": "" }, { "docid": "312caf111c13620bccd093b7ab4b7786", "score": "0.52990836", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\n\t// Your initialization code here (2A, 2B, 2C).\n\trf.state = STATE_FOLLOWER\n\trf.voteCount = 0\n\n\trf.currentTerm = 0\n\trf.votedFor = -1\n\trf.log = append(rf.log, LogEntry{Term: 0})\n\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\n\trf.chanGiveVote = make(chan bool, 100)\n\trf.chanWinElect = make(chan bool, 100)\n\trf.chanHeartbeat = make(chan bool, 100)\n\trf.chanApply = applyCh\n\n\t// Initialize from persistent state prior to crash\n\trf.ReadPersist(persister.ReadRaftState())\n\trf.RecoverFromSnapshot(persister.ReadSnapshot())\n\trf.Persist()\n\n\tgo rf.Operate()\n\n\treturn rf\n}", "title": "" }, { "docid": "6801b43fc7a19ef4542f41b83ec99b54", "score": "0.52791107", "text": "func Make(serverMap []string, me int,\n\tpersister *Persister, c *websocket.Conn, N int, config map[int]bool) *Raft {\n\trf := &Raft{}\n\trf.peers = serverMap\n\trf.persister = persister\n\trf.me = me\n\trf.state = Follower\n\trf.currentTerm = 0\n\trf.commitIndex = 0\n\trf.lastApplied = 0\n\trf.votedFor = -1\n\trf.c = c\n\trf.config = config\n\trf.configNum = 0\n\trf.N = N\n\trf.numMissedElections = 0\n\tatomic.StoreInt32(&AwaitingVote, 0)\n\tatomic.StoreInt32(&AwaitingHB, 0)\n\tvar nextIndex []int\n\tvar matchIndex []int\n\tvar aliveCheck []int\n\ti := 0\n\tfor i < len(serverMap) {\n\t\tnextIndex = append(nextIndex, 1)\n\t\tmatchIndex = append(matchIndex, 0)\n\t\taliveCheck = append(aliveCheck, 0)\n\t\ti++\n\t}\n\trf.nextIndex = nextIndex\n\trf.matchIndex = matchIndex\n\trf.aliveCheck = aliveCheck\n\t// log.Printf(\"length of nextIndex: %d\", len(nextIndex))\n\trf.log = []LogEntry{}\n\trf.log = append(rf.log, LogEntry{nil, 0})\n\n\t// Your initialization code here (2A, 2B, 2C).\n\t// run requestVoteRPC if hasn't heard from peers in awhile\n\t// go rf.checkTimeout(applyCh)\n\tgo rf.checkTimeout()\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\treturn rf\n}", "title": "" }, { "docid": "90375a6c299d167a7e88a821466a32a8", "score": "0.5229372", "text": "func StartServer(servers []*labrpc.ClientEnd, me int, persister *raft.Persister) *ShardMaster {\n sm := new(ShardMaster)\n sm.me = me\n\n sm.session = Session{LastApplied: make(map[int64]int64)}\n\n sm.configs = make([]Config, 1)\n sm.configs[0].Groups = map[int][]string{}\n\n labgob.Register(Op{})\n sm.applyCh = make(chan raft.ApplyMsg)\n sm.rf = raft.Make(servers, me, persister, sm.applyCh)\n\n // Your code here.\n sm.replyMap = make(map[Info]chan chan OpReply)\n sm.opCh = make(chan Op)\n\n go sm.PollingApplyCh()\n\n return sm\n}", "title": "" }, { "docid": "1bdc8c183f73ecd49fd816db3516d442", "score": "0.51726574", "text": "func peerManager(peer_ch chan net.Conn, quit_ch chan Peer, stdin_ch chan string){\n peers := make(map[string]Peer) // map from ip to Peer\n connectPeers(peers, quit_ch)\n for {\n select{\n case new_peer := <- peer_ch:\n if new_peer != nil{\n this_peer := addNewPeer(&peers, new_peer)\n go peerLoop(this_peer, quit_ch)\n }\n case to_quit := <- quit_ch:\n closePeer(&peers, &to_quit)\n case input := <- stdin_ch:\n broadcastMsg(peers, input) \n }\n }\n}", "title": "" }, { "docid": "d21764668f4db8a25d440b4d1721c24d", "score": "0.51710314", "text": "func serve(s *KVStore, r *rand.Rand, peers *arrayPeers, id string, port int) {\n\traft := Raft{AppendChan: make(chan AppendEntriesInput), VoteChan: make(chan VoteInput)}\n\t// Start in a Go routine so it doesn't affect us.\n\tgo RunRaftServer(&raft, port)\n\n\tpeerClients := make(map[string]pb.RaftClient)\n\n\tfor _, peer := range *peers {\n\t\tclient, err := connectToPeer(peer)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to connect to GRPC server %v\", err)\n\t\t}\n\n\t\tpeerClients[peer] = client\n\t\tlog.Printf(\"Connected to %v\", peer)\n\t}\n\n\ttype AppendResponse struct {\n\t\tret *pb.AppendEntriesRet\n\t\terr error\n\t\tpeer string\n\t}\n\n\ttype VoteResponse struct {\n\t\tret *pb.RequestVoteRet\n\t\terr error\n\t\tpeer string\n\t}\n\tappendResponseChan := make(chan AppendResponse)\n\tvoteResponseChan := make(chan VoteResponse)\n\n\t// Create a timer and start running it\n\ttimer := time.NewTimer(randomDuration(r))\n\n\t// Run forever handling inputs from various channels\n\tfor {\n\t\tselect {\n\t\tcase <-timer.C:\n\t\t\t// The timer went off.\n\t\t\tlog.Printf(\"Timeout\")\n\t\t\tfor p, c := range peerClients {\n\t\t\t\t// Send in parallel so we don't wait for each client.\n\t\t\t\tgo func(c pb.RaftClient, p string) {\n\t\t\t\t\tret, err := c.RequestVote(context.Background(), &pb.RequestVoteArgs{Term: 1, CandidateID: id})\n\t\t\t\t\tvoteResponseChan <- VoteResponse{ret: ret, err: err, peer: p}\n\t\t\t\t}(c, p)\n\t\t\t}\n\t\t\t// This will also take care of any pesky timeouts that happened while processing the operation.\n\t\t\trestartTimer(timer, r)\n\t\tcase op := <-s.C:\n\t\t\t// We received an operation from a client\n\t\t\t// TODO: Figure out if you can actually handle the request here. If not use the Redirect result to send the\n\t\t\t// client elsewhere.\n\t\t\t// TODO: Use Raft to make sure it is safe to actually run the command.\n\t\t\ts.HandleCommand(op)\n\t\tcase ae := <-raft.AppendChan:\n\t\t\t// We received an AppendEntries request from a Raft peer\n\t\t\t// TODO figure out what to do here, what we do is entirely wrong.\n\t\t\tlog.Printf(\"Received append entry from %v\", ae.arg.LeaderID)\n\t\t\tae.response <- pb.AppendEntriesRet{Term: 1, Success: true}\n\t\t\t// This will also take care of any pesky timeouts that happened while processing the operation.\n\t\t\trestartTimer(timer, r)\n\t\tcase vr := <-raft.VoteChan:\n\t\t\t// We received a RequestVote RPC from a raft peer\n\t\t\t// TODO: Fix this.\n\t\t\tlog.Printf(\"Received vote request from %v\", vr.arg.CandidateID)\n\t\t\tvr.response <- pb.RequestVoteRet{Term: 1, VoteGranted: false}\n\t\tcase vr := <-voteResponseChan:\n\t\t\t// We received a response to a previou vote request.\n\t\t\t// TODO: Fix this\n\t\t\tif vr.err != nil {\n\t\t\t\t// Do not do Fatalf here since the peer might be gone but we should survive.\n\t\t\t\tlog.Printf(\"Error calling RPC %v\", vr.err)\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Got response to vote request from %v\", vr.peer)\n\t\t\t\tlog.Printf(\"Peers %s granted %v term %v\", vr.peer, vr.ret.VoteGranted, vr.ret.Term)\n\t\t\t}\n\t\tcase ar := <-appendResponseChan:\n\t\t\t// We received a response to a previous AppendEntries RPC call\n\t\t\tlog.Printf(\"Got append entries response from %v\", ar.peer)\n\t\t}\n\t}\n\tlog.Printf(\"Strange to arrive here\")\n}", "title": "" }, { "docid": "03e1adc7a56f78397e387990842c68cb", "score": "0.5168618", "text": "func TestRaftApply(t *testing.T) {\n\tvar (\n\t\tnodes []*rRaft.Backend\n\n\t\tnodeCount = 3\n\t\tcommitTimeout = 5 * time.Millisecond\n\t)\n\n\tfor i := 0; i < nodeCount; i++ {\n\t\tports := dynaport.Get(3)\n\t\tdataDir, err := ioutil.TempDir(\"\", \"raft-db-test\")\n\t\trequire.NoError(t, err)\n\n\t\tdefer func(dir string) {\n\t\t\t_ = os.RemoveAll(dir)\n\t\t}(dataDir)\n\n\t\tln, err := net.Listen(\n\t\t\t\"tcp\",\n\t\t\tfmt.Sprintf(\"127.0.0.1:%d\", ports[0]),\n\t\t)\n\n\t\trequire.NoError(t, err)\n\n\t\tconfig := &rRaft.Config{}\n\t\tconfig.StreamLayer = rRaft.NewStreamLayer(ln)\n\t\tconfig.Raft.LogLevel = \"trace\"\n\t\tconfig.RPCAddr = fmt.Sprintf(\"127.0.0.1:%d\", ports[1])\n\t\tconfig.RaftAddr = fmt.Sprintf(\"127.0.0.1:%d\", ports[2])\n\t\tconfig.Raft.LocalID = raft.ServerID(fmt.Sprintf(\"%d\", i))\n\t\tconfig.Raft.HeartbeatTimeout = 50 * time.Millisecond\n\t\tconfig.Raft.ElectionTimeout = 50 * time.Millisecond\n\t\tconfig.Raft.LeaderLeaseTimeout = 50 * time.Millisecond\n\t\tconfig.Raft.CommitTimeout = commitTimeout\n\t\tconfig.ApplyRegistrator = registry.NewApplyRegistrator()\n\n\t\tif i == 0 {\n\t\t\tconfig.Bootstrap = true\n\t\t}\n\n\t\tdb, err := gmap.New(dataDir)\n\t\trequire.NoError(t, err)\n\n\t\tnode, err := rRaft.New(db, config)\n\t\trequire.NoError(t, err)\n\n\t\tif i != 0 {\n\t\t\ttags := map[string]string{\n\t\t\t\t\"raft_addr\": ln.Addr().String(),\n\t\t\t\t\"rpc_addr\": config.RPCAddr,\n\t\t\t}\n\t\t\terr = nodes[0].Join(\n\t\t\t\tfmt.Sprintf(\"%d\", i), tags, false)\n\t\t} else {\n\t\t\terr = node.WaitForLeader(3 * time.Second)\n\t\t}\n\t\trequire.NoError(t, err)\n\n\t\terr = config.ApplyRegistrator.RegisterApplyRead(\"countTab\", fnCount)\n\t\trequire.NoError(t, err)\n\n\t\tnodes = append(nodes, node)\n\t}\n\n\tvar (\n\t\ttab = []byte{'t', 'a', 'b'}\n\t)\n\n\t_, err := count(nodes[0], rkvApi.ReadCluster, tab)\n\trequire.Equal(t, true, dbApi.IsNoTableError(err))\n\n\t// write some data\n\tfor i := 0; i < 10; i++ {\n\t\terr := nodes[0].Put(\n\t\t\ttab,\n\t\t\t[]byte(fmt.Sprintf(\"key-%d\", i)),\n\t\t\t[]byte(fmt.Sprintf(\"val-%d\", i)),\n\t\t)\n\t\trequire.NoError(t, err)\n\t}\n\n\tn, err := count(nodes[0], rkvApi.ReadAny, tab)\n\trequire.NoError(t, err)\n\trequire.Equal(t, 10, n)\n\n\tn, err = count(nodes[0], rkvApi.ReadCluster, tab)\n\trequire.NoError(t, err)\n\trequire.Equal(t, 10, n)\n\n\terr = nodes[0].Delete(tab, []byte(\"key-1\"))\n\trequire.NoError(t, err)\n\n\tn, err = count(nodes[0], rkvApi.ReadLeader, tab)\n\trequire.NoError(t, err)\n\trequire.Equal(t, 9, n)\n\n\t// followers: eventually on any node with ReadAny\n\trequire.Eventually(t, func() bool {\n\t\tfor j := 1; j < nodeCount; j++ {\n\t\t\tn, err = count(nodes[j], rkvApi.ReadAny, tab)\n\t\t\tif err != nil {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\trequire.Equal(t, 9, n)\n\t\t}\n\t\treturn true\n\t}, 500*time.Millisecond, 50*time.Millisecond)\n\n\t// followers: ReadLeader, ReadCluster (TODO: route to leader),\n\tfor i := 1; i < 3; i++ {\n\t\tn, err = count(nodes[i], rkvApi.ReadLeader, tab)\n\t\trequire.Error(t, err) // not a leader\n\n\t\tn, err = count(nodes[i], rkvApi.ReadCluster, tab)\n\t\trequire.Error(t, err) // not a leader\n\t}\n\n\t// call not registered function\n\t_, err = nodes[0].ApplyFuncRead(rkvApi.ReadLeader, \"unregistered\", nil)\n\trequire.Error(t, err)\n}", "title": "" }, { "docid": "7c56a681c680f93f7765e558f5c4df36", "score": "0.5168105", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\trf.state = FOLLOWER\n\trf.log = make([]*LogEntry, 1)\n\trf.log[0] = &LogEntry{}\n\trf.votedFor = -1\n\trf.currentTerm = 0\n\trf.appendCh = make(chan *AppendEntriesArgs)\n\trf.voteCh = make(chan *RequestVoteArgs)\n\trf.applyCh = applyCh\n\trf.electionTimer = time.NewTimer(electionRandDuration())\n\trf.heartBeatTimer = time.NewTimer(heartBeatRandDuration())\n\n\trf.readPersist(persister.ReadRaftState())\n\n\trf.nextIndex = make([]int, len(rf.peers))\n\tfor i, _ := range rf.nextIndex {\n\t\trf.nextIndex[i] = len(rf.log)\n\t}\n\trf.matchIndex = make([]int, len(rf.peers))\n\t// Your initialization code here (2A, 2B, 2C).\n\t//initialize from state persisted before a crash\n\tgo rf.handler()\n\n\treturn rf\n}", "title": "" }, { "docid": "5711219fea9cf9d49f23f618b58262fb", "score": "0.51588047", "text": "func (rf *Raft) broadcastAppendEntries() {\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\n\tbaseIndex := rf.logs[0].LogIndex\n\tlast := rf.getLastIndex()\n\tnewCommitIndex := rf.commitIndex\n\n\t// find next entry to be committed\n\tfor i := rf.commitIndex + 1; i <= last; i++ {\n\t\tcommitted := 1\n\t\tfor peer := range rf.peers {\n\t\t\tif peer != rf.me && rf.matchIndex[peer] >= i && rf.logs[i-baseIndex].LogTerm == rf.currentTerm {\n\t\t\t\tcommitted++\n\t\t\t}\n\t\t}\n\t\tif committed*2 > len(rf.peers) { // most server has stored the entry -- committed\n\t\t\tnewCommitIndex = i\n\t\t}\n\t}\n\n\tif newCommitIndex != rf.commitIndex { // to be committed\n\t\trf.commitIndex = last\n\t\trf.chanCommit <- true\n\t}\n\n\tfor peer := range rf.peers {\n\t\tif peer != rf.me && rf.state == STATE_LEADER {\n\t\t\tif rf.nextIndex[peer] > baseIndex { // new entries needed from leader to followers\n\t\t\t\tvar args AppendEntriesArgs\n\t\t\t\targs.Term = rf.currentTerm\n\t\t\t\targs.LeaderId = rf.me\n\t\t\t\targs.PrevLogIndex = rf.nextIndex[peer] - 1\n\t\t\t\targs.PrevLogTerm = rf.logs[args.PrevLogIndex-baseIndex].LogTerm\n\t\t\t\targs.Entries = make([]LogEntry, len(rf.logs[args.PrevLogIndex-baseIndex+1:]))\n\t\t\t\tcopy(args.Entries, rf.logs[args.PrevLogIndex-baseIndex+1:])\n\t\t\t\targs.LeaderCommitIndex = rf.commitIndex\n\t\t\t\tgo func(peer int) {\n\t\t\t\t\tvar reply AppendEntriesReply\n\t\t\t\t\trf.sendAppendEntries(peer, args, &reply)\n\t\t\t\t}(peer)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0d0d5a630016bd80c16b81df27ef9cf3", "score": "0.5139467", "text": "func Make(peers []*labrpc.ClientEnd, me int,\n\tpersister *Persister, applyCh chan ApplyMsg) *Raft {\n\trf := &Raft{}\n\trf.peers = peers\n\trf.persister = persister\n\trf.me = me\n\trf.applyCh = applyCh\n\t\n\t// Your initialization code here.\n\trf.votedFor = -1\n\trf.commitIndex = -1\n\trf.lastApplied = -1\n\trf.rand = rand.New(rand.NewSource(int64(me)))\n\trf.votesLock = &sync.Mutex{}\n\trf.commitIndexMutex = &sync.Mutex{}\n\t\n\t// initialize from state persisted before a crash\n\trf.readPersist(persister.ReadRaftState())\n\n\t// fmt.Println(\"Make \" + strconv.Itoa(me))\n\trf.becomeFollower(rf.currentTerm)\n\treturn rf\n}", "title": "" }, { "docid": "7a60715ba2007f1ddd28754489325e05", "score": "0.5112683", "text": "func (sm *ShardMaster) Applyloop() {\n\tfor {\n\t\tapplymsg := <-sm.applyCh\n\t\tcomm := applymsg.Command.(Op)\n\t\t//sm.mu.Lock()\n\t\t_, ok := sm.ack[comm.ClientId]\n\t\tif !ok {\n\t\t\tsm.ack[comm.ClientId] = 0\n\t\t}\n\t\tif sm.ack[comm.ClientId] < comm.CommandId {\n\t\t\tsm.Shards = comm.Conf.Shards\n\t\t\tsm.Groups = make(map[int][]string)\n\t\t\tfor key, value := range comm.Conf.Groups {\n\t\t\t\tsm.Groups[key] = value\n\t\t\t}\n\t\t\tcomm.Conf.Num = sm.configNum\n\t\t\tsm.configNum++\n\t\t\tsm.configs = append(sm.configs, comm.Conf)\n\t\t\tif sm.rf.IsLeader() {\n\t\t\t\t//fmt.Println(\"Shards after apply:\", sm.Shards)\n\t\t\t}\n\t\t\t//fmt.Println(\"Configs of peer\", sm.me, \"after apply:\", sm.configs)\n\t\t\t//fmt.Println(\"ConfigNum of peer\", sm.me, \"after apply:\", sm.configNum)\n\t\t\tsm.ack[comm.ClientId] = comm.CommandId\n\t\t}\n\t\t_, ok = sm.exeChan[applymsg.Index]\n\t\tif !ok {\n\t\t\tsm.exeChan[applymsg.Index] = make(chan Op, 1)\n\t\t} else {\n\t\t\tselect {\n\t\t\tcase <-sm.exeChan[applymsg.Index]:\n\t\t\tdefault:\n\t\t\t}\n\t\t\tsm.exeChan[applymsg.Index] <- comm\n\t\t}\n\t\t//sm.mu.Unlock()\n\t}\n}", "title": "" }, { "docid": "2b3e8924cbad2ef0d53d35fa6c5437a1", "score": "0.5099281", "text": "func startServer() {\n\t\n dict = new(Dict)\n \n server := rpc.NewServer()\n server.Register(dict)\n \n\t\n //Call find successor\n \t// fix_my_successor()\n var e error;var err error\n listener, e = net.Listen(config_obj.Protocol, \":\"+strconv.Itoa(config_obj.Port))\n\n if e != nil {\n log.Fatal(\"listener error:\", e)\n \n }\n println(\"\\nAccepting connections...\\n\")\n \n\t \n\t //If it first node, then do not call Join otherwise call Join\n if (config_obj.IsFirstNode !=1) {\n Join();\n \t}\n\n //Listen for connections\n for {\n\t\t \n \t \tconn,err = listener.Accept()\n \tif err != nil {\n \t\t// println(\"Connection is \",conn)\n \t log.Fatal(err)\n\n \t }\n\n \t fmt.Println(\"\\n*******New Connection established*******\") \n\t\t\tgo server.ServeCodec(jsonrpc.NewServerCodec(conn))\n }\n\t\t\n \n\n}", "title": "" }, { "docid": "56fe1ff119f3ddc5862a09e9bb0523ea", "score": "0.5085628", "text": "func serve(s *KVStore, r *rand.Rand, peers *arrayPeers, id string, port int, client string, kvs *KvStoreServer, byzantine bool) {\n\traft := Raft{NewClientRequestChan: make(chan ClientReqInput), PrePrepareMsgChan: make(chan PrePrepareInput), PrepareMsgChan: make(chan PrepareInput), CommitMsgChan: make(chan CommitInput)}\n\t// Start in a Go routine so it doesn't affect us.\n\tgo RunRaftServer(&raft, port)\n\n\tpeerClients := make(map[string]pb.RaftClient)\n\tclientConn, _ := connectToPeer(client)\n\tfor _, peer := range *peers {\n\t\tclient, err := connectToPeer(peer)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to connect to GRPC server %v\", err)\n\t\t}\n\n\t\tpeerClients[peer] = client\n\t\tlog.Printf(\"Connected to %v\", peer)\n\t}\n\tpbftmessageChan:=make(chan MsgRet)\n\tclientResponseChan:=make(chan ClientResponse)\n\ttype AppendResponse struct {\n\t\tret *pb.AppendEntriesRet\n\t\terr error\n\t\tpeer string\n\t}\n\n\ttype VoteResponse struct {\n\t\tret *pb.RequestVoteRet\n\t\terr error\n\t\tpeer string\n\t}\n\tsequenceno:=int64(-1)\n\tmaxlen:=int64(0)\n\tvar logentries []logEntry\n\t// Run forever handling inputs from various channels\n\tfor {\n\t\tselect {\n\t\tcase op := <-s.C:\n\t\t\t// We received an operation from a client\n\t\t\t// TODO: Figure out if you can actually handle the request here. If not use the Redirect result to send the\n\t\t\t// client elsewhere.\n\t\t\t// TODO: Use Raft to make sure it is safe to actually run the command.\n\t\t\ts.HandleCommand(op)\n\t\tcase clr := <-raft.NewClientRequestChan:\n\t\t\tlog.Printf(\"Recd New client request.\")\n\t\t\trequest:=clr.Arg\n\t\t\ttimestamp:=request.Timestamp\n\t\t\tdigest:=Digest(request)\n\t\t\tsequenceno+=1\n\t\t\tpreprepare:=pb.PrePrepareArgs{Sequenceno: sequenceno, Digest: digest, Node: id, Clientrequest: request}\n\t\t\tfor p, c := range peerClients {\n\t\t\t\tgo func(c pb.RaftClient, p string) {\n\t\t\t\t\ttime.Sleep(10 * time.Millisecond)\n\t\t\t\t\tret, err := c.PrePrepare(context.Background(), &preprepare)\n\t\t\t\t\tpbftmessageChan<-MsgRet{ret: ret, err:err, peer: p}\n\t\t\t\t}(c, p)\n\t\t\t}\n\n\t\t\tlog_entry:= logEntry{sequencenumber: sequenceno, clientReq: request, prePrepare: &preprepare, pre: make([]*pb.PrepareArgs, maxlen), com: make([]*pb.CommitArgs, maxlen), prepared: false, committed: false, committedLocal: false}\n\t\t\tlogentries = append(logentries, log_entry)\n\t\t\tlog.Printf(\"Appended to log entry\")\n\t\t\tresponse:=pb.ClientReqRet{Didwork:1, Timestamp: timestamp}\n\t\t\tclr.Response<-response\n\t\tcase clr := <-raft.PrePrepareMsgChan:\n\t\t\tlog.Printf(\"Recd pre-prepare request..\")\n\t\t\t//check if prepare message valid!\n\t\t\tverified:=true\n\t\t\tdigest := Digest(clr.Arg.Clientrequest)\n\t\t\tif digest != clr.Arg.Digest{\n\t\t\t\tverified=false\n\t\t\t}\n\t\t\tif verified{\n\t\t\t\tif(byzantine){\n\t\t\t\t\tdigest=tamper(digest)\n\t\t\t\t}\t\n\t\t\t\tpreparemsg:=pb.PrepareArgs{Sequenceno: clr.Arg.Sequenceno, Digest: digest, Node: id}\n\t\t\t\tlog.Printf(\"Appending new entry to logs\")\n\t\t\t\tlog_entry:= logEntry{sequencenumber: clr.Arg.Sequenceno, clientReq: clr.Arg.Clientrequest, prePrepare: clr.Arg, pre: make([]*pb.PrepareArgs, maxlen), com: make([]*pb.CommitArgs, maxlen), prepared: false, committed: false, committedLocal: false}\n\t\t\t\told_prepares:=log_entry.pre\n\t\t\t\told_prepares=append(old_prepares, &preparemsg)\n\t\t\t\tlog_entry.pre=old_prepares\n\t\t\t\tlogentries = append(logentries, log_entry)\n\t\t\t\tfor p, c := range peerClients {\n\t\t\t\t\tgo func(c pb.RaftClient, p string) {\n\t\t\t\t\t\ttime.Sleep(10 * time.Millisecond)\n\t\t\t\t\t\tret, err := c.Prepare(context.Background(), &preparemsg)\n\t\t\t\t\t\tpbftmessageChan<-MsgRet{ret: ret, err:err, peer: p}\n\t\t\t\t\t}(c, p)\n\t\t\t\t}\n\t\t\t}\n\t\t\tresp:= pb.MsgRet{Sequenceno: sequenceno, Success: verified, Typeofmsg: \"pre_prepare\", Node: id}\n\t\t\tclr.Response <- resp\n\t\tcase clr := <-raft.PrepareMsgChan:\n\t\t\tlog.Printf(\"Recd prepare request..\")\n\t\t\t//check if prepare message valid!\n\t\t\tprep_msg:=clr.Arg\n\t\t\tprepared:=false\n\t\t\tvalid:=true\n\t\t\tdigest := logentries[prep_msg.Sequenceno].prePrepare.Digest\n\t\t\tif digest != prep_msg.Digest {\n\t\t\t\tvalid=false\n\t\t\t}\n\t\t\tif valid{\n\t\t\t\tlog.Printf(\"Seqno: %v\", prep_msg.Sequenceno )\n\t\t\t\told_entry := logentries[prep_msg.Sequenceno]\n\t\t\t\tprev_prepares := old_entry.pre\n\t\t\t\tprev_prepares = append(prev_prepares, prep_msg)\n\t\t\t\told_entry.pre = prev_prepares\n\t\t\t\tlogentries[prep_msg.Sequenceno] = old_entry\n\t\t\t\t//TODO: fix next 3 lines tomorrow morning.\n\t\t\t\tprepared=checkifprepared(old_entry)\n\t\t\t\told_entry.prepared = prepared\n\t\t\t\tlogentries[prep_msg.Sequenceno] = old_entry\n\t\t\t\tif prepared{\n\t\t\t\t\tlog.Printf(\"PREPARED!!\")\n\t\t\t\t\tcommitmsg:=pb.CommitArgs{Sequenceno: prep_msg.Sequenceno, Digest: prep_msg.Digest, Node: id}\n\t\t\t\t\tfor p, c := range peerClients {\n\t\t\t\t\t\tgo func(c pb.RaftClient, p string) {\n\t\t\t\t\t\t\ttime.Sleep(10 * time.Millisecond)\n\t\t\t\t\t\t\tret, err := c.Commit(context.Background(), &commitmsg)\n\t\t\t\t\t\t\tpbftmessageChan<-MsgRet{ret: ret, err:err, peer:p}\n\t\t\t\t\t\t}(c, p)\n\t\t\t\t\t}\n\t\t\t\t\tpreventry:=logentries[prep_msg.Sequenceno]\n\t\t\t\t\tprevcommits:=preventry.com\n\t\t\t\t\tprevcommits=append(prevcommits,&commitmsg)\n\t\t\t\t\tpreventry.com=prevcommits\n\t\t\t\t\tlogentries[prep_msg.Sequenceno]=preventry\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tresp:= pb.MsgRet{Sequenceno: sequenceno, Success: valid, Typeofmsg: \"prepare\", Node: id}\n\t\t\tclr.Response <- resp\n\t\tcase clr := <-raft.CommitMsgChan:\n\t\t\tcom_msg:=clr.Arg\n\t\t\tvalid:=true\n\t\t\tlog.Printf(\"Recd commit request..\")\n\t\t\tdigest := logentries[com_msg.Sequenceno].prePrepare.Digest\n\t\t\tif digest != com_msg.Digest {\n\t\t\t\tvalid=false\n\t\t\t}\n\t\t\tif valid{\n\t\t\t\tpreventry:=logentries[com_msg.Sequenceno]\n\t\t\t\tprevcommits:=preventry.com\n\t\t\t\tprevcommits=append(prevcommits,com_msg)\n\t\t\t\tpreventry.com=prevcommits\n\t\t\t\tlogentries[com_msg.Sequenceno]=preventry\n\t\t\t\tiscommitedlocal:=checkifcommitlocal(preventry)\n\t\t\t\tif iscommitedlocal{\n\t\t\t\t\tlog.Printf(\"COMMIT LOCAL\")\n\t\t\t\t\tcr:=preventry.clientReq\n\t\t\t\t\ttotalop := strings.Split(cr.Operation, \":\")\n\t\t\t\t\toper := totalop[0]\n\t\t\t\t\tkey := totalop[1]\n\t\t\t\t\tval := totalop[2]\n\t\t\t\t\tres := pb.Result{Result: &pb.Result_S{S: &pb.Success{}}}\n\t\t\t\t\tif oper == \"SET\" {\n\t\t\t\t\t\tkvs.Store[key] = val\n\t\t\t\t\t\tres = pb.Result{Result: &pb.Result_Kv{Kv: &pb.KeyValue{Key: key, Value: val}}}\n\t\t\t\t\t} else if oper == \"GET\" {\n\t\t\t\t\t\tval = kvs.Store[key]\n\t\t\t\t\t\tres = pb.Result{Result: &pb.Result_Kv{Kv: &pb.KeyValue{Key: key, Value: val}}}\n\t\t\t\t\t}\n\t\t\t\t\tcr.Res=&res\n\t\t\t\t\tcr.Client=id\n\t\t\t\t\tgo func(c pb.RaftClient) {\n\t\t\t\t\t\tret, err := c.NewClientRequest(context.Background(), cr)\n\t\t\t\t\t\tclientResponseChan <- ClientResponse{ret: ret, err: err, node: id}\n\t\t\t\t\t}(clientConn)\n\t\t\t\t}\n\n\t\t\t\n\t\t\t}\n\t\t\tresp:= pb.MsgRet{Sequenceno: sequenceno, Success: valid, Typeofmsg: \"commit\", Node: id}\n\t\t\tclr.Response <- resp\n\n\t\t}\n\t}\n\tlog.Printf(\"Strange to arrive here\")\n}", "title": "" }, { "docid": "f392318dfa56ca647d5d0cc85bd35e3f", "score": "0.4981655", "text": "func Apply(server *grpc.Server, ctn *registry.DeviceModelContainer) {\n\tprotocol.RegisterDeviceModelServiceServer(server,\n\t\tNewDeviceModelRPC(ctn.Resolve(\"device-model-service\").(service.DeviceModelService)))\n\tlog.Println(\"Successfully registered DeviceModelRPC!\")\n}", "title": "" }, { "docid": "bef4dd9a85d873f18af688edc4e4624e", "score": "0.49742267", "text": "func main() {\n\tfmt.Println(\"welcome to the fully anonymous MIT confessions!\")\n\tapplyCh := make(chan libraft.ApplyMsg)\n\trf := mockraft.New(applyCh)\n\ts := anonbcast.NewServer(\"0\", rf)\n\tdefer s.Kill()\n\n\tnet := labrpc.MakeNetwork()\n\tdefer net.Cleanup()\n\tend1 := net.MakeEnd(\"client1\")\n\tend2 := net.MakeEnd(\"client2\")\n\tsvc := labrpc.MakeService(s)\n\tsrv := labrpc.MakeServer()\n\tsrv.AddService(svc)\n\tnet.AddServer(\"server\", srv)\n\tnet.Connect(\"client1\", \"server\")\n\tnet.Enable(\"client1\", true)\n\tnet.Connect(\"client2\", \"server\")\n\tnet.Enable(\"client2\", true)\n\n\tcp1 := network.New([]*labrpc.ClientEnd{end1}, 0)\n\tcp2 := network.New([]*labrpc.ClientEnd{end2}, 0)\n\n\tvar mu sync.Mutex\n\tcg1 := ConfessionsGenerator{\n\t\tid: \"1\",\n\t\tmu: &mu,\n\t}\n\tcg2 := ConfessionsGenerator{\n\t\tid: \"2\",\n\t\tmu: &mu,\n\t}\n\n\tclcf := anonbcast.ClientConfig{\n\t\tMessageTimeout: time.Second * 30,\n\t\tProtocolTimeout: time.Second * 10,\n\t\tMessageSize: 100,\n\t}\n\tseedConf := make(map[string]bool)\n\tseedConf[\"0\"] = true\n\tc1 := anonbcast.NewClient(s, cg1, cp1, seedConf, clcf)\n\tdefer c1.Kill()\n\tresults := c1.CreateResCh()\n\tdefer c1.DestroyResCh(results)\n\torderedResults := make(chan anonbcast.RoundResult)\n\tgo resultOrderer(results, orderedResults)\n\tc2 := anonbcast.NewClient(s, cg2, cp2, seedConf, clcf)\n\tdefer c2.Kill()\n\n\tfor i := 0; ; i++ {\n\t\ttime.Sleep(time.Millisecond * 100)\n\t\terr := c1.Start(i)\n\t\tfor err != nil {\n\t\t\ttime.Sleep(time.Millisecond * 100)\n\t\t\terr = c1.Start(i)\n\t\t}\n\t\tfmt.Printf(\"Starting round %d!\\n\", i)\n\t\tr := <-orderedResults\n\t\tif r.Round != i {\n\t\t\tlog.Fatalf(\"round %d not equal to index %d\", r.Round, i)\n\t\t}\n\t\tif r.Succeeded {\n\t\t\tfmt.Printf(\"Round %d succeeded! Anonymized broadcast messages are:\\n\", r.Round)\n\t\t\tfor _, m := range r.Messages {\n\t\t\t\tfmt.Printf(\"\\t%s\\n\", string(m))\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Printf(\"Round %d failed :(\\n\", r.Round)\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "d392d5186e9f3719728a2d3826482056", "score": "0.49580956", "text": "func (kv *KVServer) receiveApply() {\n\tfor {\n\t\tselect {\n\t\tcase msg := <-kv.applyCh:\n\t\t\top, ok := msg.Command.(Op)\n\t\t\tindex := msg.CommandIndex\n\t\t\tvar result message\n\t\t\tresult.op = &op\n\t\t\tresult.err = OK\n\t\t\tif !msg.CommandValid || !ok {\n\t\t\t\tresult.err = ErrCommandNotValid\n\t\t\t\tgo kv.publish(index, &result)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tkv.mu.Lock()\n\t\t\tmaxSeq, ok := kv.seqMapping[op.CID]\n\t\t\tDPrintfKV(\"id: %d, listenAndApply(), msg recieved, msg: %v, op.SEQ: %d, maxSeq: %d\", kv.rf.GetID(), msg, op.SEQ, maxSeq)\n\t\t\tif op.SEQ <= maxSeq && op.Command != GET {\n\t\t\t\tkv.mu.Unlock()\n\t\t\t\tgo kv.publish(index, &result)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif op.SEQ > maxSeq {\n\t\t\t\tkv.seqMapping[op.CID] = op.SEQ\n\t\t\t}\n\t\t\tkv.mu.Unlock()\n\n\t\t\tsuccess := false\n\t\t\tswitch op.Command {\n\t\t\tcase GET:\n\t\t\t\tresult.value, success = kv.db.Get(op.Key) // blocking\n\t\t\t\tif !success {\n\t\t\t\t\tresult.err = ErrNoKey\n\t\t\t\t}\n\t\t\tcase PUT:\n\t\t\t\tsuccess = kv.db.Put(op.Key, op.Value) // blocking\n\t\t\tcase APPEND:\n\t\t\t\tsuccess = kv.db.Append(op.Key, op.Value) // blocking\n\n\t\t\tdefault:\n\t\t\t\tresult.err = ErrCommandNotValid\n\t\t\t}\n\t\t\tif success {\n\t\t\t\tresult.err = OK\n\t\t\t}\n\t\t\tkv.persist()\n\n\t\t\t// DPrintfKV(\"ID: %d, Persisted, seqMapping: %v\", kv.rf.GetID(), kv.seqMapping)\n\t\t\tgo kv.publish(index, &result)\n\t\tcase <-kv.killCh:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "931bb90c9c53b330cc556472012fecbb", "score": "0.4957613", "text": "func (kv *ShardKV) applyDaemon() {\n\tfor {\n\t\tselect {\n\t\tcase msg, ok := <-kv.applyCh:\n\t\t\tif ok {\n\t\t\t\t// have snapshot to apply?\n\t\t\t\tif msg.UseSnapshot {\n\t\t\t\t\tkv.mu.Lock()\n\t\t\t\t\tkv.readSnapshot(msg.Snapshot)\n\t\t\t\t\t// must be persisted, in case of crashing before generating another snapshot\n\t\t\t\t\tkv.generateSnapshot(msg.Index)\n\t\t\t\t\tkv.mu.Unlock()\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// have client's request? must filter duplicate command\n\t\t\t\tif msg.Command != nil && msg.Index > kv.snapshotIndex {\n\t\t\t\t\tvar err Err = OK\n\t\t\t\t\tkv.mu.Lock()\n\t\t\t\t\tswitch cmd := msg.Command.(type) {\n\t\t\t\t\tcase Op:\n\t\t\t\t\t\t// switch to new config already?\n\t\t\t\t\t\tshard := key2shard(cmd.Key)\n\t\t\t\t\t\tif kv.configs[0].Shards[shard] != kv.gid {\n\t\t\t\t\t\t\tfmt.Printf(\"[%d-%d]: server %d (gid: %d) has switched to new config %d, \"+\n\t\t\t\t\t\t\t\t\"no responsibility for shard %d\\n\",\n\t\t\t\t\t\t\t\tkv.gid, kv.me, kv.me, kv.gid, kv.configs[0].Num, shard)\n\t\t\t\t\t\t\terr = ErrWrongGroup\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif dup, ok := kv.duplicate[cmd.ClientID]; !ok || dup.Seq < cmd.SeqNo {\n\t\t\t\t\t\t\tswitch cmd.Op {\n\t\t\t\t\t\t\tcase \"Get\":\n\t\t\t\t\t\t\t\tkv.duplicate[cmd.ClientID] = &LatestReply{Seq: cmd.SeqNo,\n\t\t\t\t\t\t\t\t\tReply: GetReply{Value: kv.db[cmd.Key]}}\n\t\t\t\t\t\t\tcase \"Put\":\n\t\t\t\t\t\t\t\tkv.db[cmd.Key] = cmd.Value //kv.db的key对应着shard索引,直接把原来的内容替换掉\n\t\t\t\t\t\t\t\tkv.duplicate[cmd.ClientID] = &LatestReply{Seq: cmd.SeqNo}\n\t\t\t\t\t\t\tcase \"Append\":\n\t\t\t\t\t\t\t\tkv.db[cmd.Key] += cmd.Value\n\t\t\t\t\t\t\t\tkv.duplicate[cmd.ClientID] = &LatestReply{Seq: cmd.SeqNo}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tfmt.Printf(\"[%d-%d]: server %d receive invalid cmd: %v\\n\", kv.gid, kv.me, kv.me, cmd)\n\t\t\t\t\t\t\t\tpanic(\"invalid command operation\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tcase Cfg:\n\t\t\t\t\t\t// duplicate detection: newer than current config\n\t\t\t\t\t\tif cmd.Config.Num > kv.configs[0].Num {\n\t\t\t\t\t\t\tkv.switchConfig(&cmd.Config)\n\t\t\t\t\t\t}\n\t\t\t\t\tcase Mig:\n\t\t\t\t\t\t// apply data and dup, then start to accept client requests\n\t\t\t\t\t\tif cmd.Num == kv.configs[0].Num && !kv.isMigrateDone(\"applyMigrateData\") {\n\t\t\t\t\t\t\tkv.applyMigratedData(cmd)\n\t\t\t\t\t\t}\n\t\t\t\t\tcase CleanUp:\n\t\t\t\t\t\tif kv.gcHistory[cmd.Shard] < cmd.Num && cmd.Num <= kv.configs[0].Num {\n\t\t\t\t\t\t\tif kv.configs[0].Shards[cmd.Shard] != kv.gid {\n\t\t\t\t\t\t\t\tkv.shardGC(cmd)\n\t\t\t\t\t\t\t\tkv.gcHistory[cmd.Shard] = cmd.Num\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tkv.gcHistory[cmd.Shard] = kv.configs[0].Num\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfmt.Printf(\"[%d-%d]: server %d, shard: %d, config: %d - %d, gc history: %d\\n\",\n\t\t\t\t\t\t\t\tkv.gid, kv.me, kv.me, cmd.Shard, cmd.Num, kv.configs[0].Num, kv.gcHistory[cmd.Shard])\n\t\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tpanic(\"Oops... unknown cmd type from applyCh\")\n\t\t\t\t\t}\n\t\t\t\t\t// snapshot detection: up through msg.Index\n\t\t\t\t\tif needSnapshot(kv) {\n\t\t\t\t\t\t// save snapshot and notify raft\n\t\t\t\t\t\tkv.generateSnapshot(msg.Index)\n\t\t\t\t\t\tkv.rf.NewSnapshot(msg.Index)\n\t\t\t\t\t}\n\t\t\t\t\t// notify channel\n\t\t\t\t\tif notifyCh, ok := kv.notifyChs[msg.Index]; ok && notifyCh != nil {\n\t\t\t\t\t\tnotifyCh <- err\n\t\t\t\t\t\tdelete(kv.notifyChs, msg.Index)\n\t\t\t\t\t}\n\t\t\t\t\tkv.mu.Unlock()\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-kv.shutdownCh:\n\t\t\tfmt.Printf(\"[%d-%d]: server %d is shutting down.\\n\", kv.gid, kv.me, kv.me)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5dfa1f09e3248d4f99f298cf0bea4376", "score": "0.4911494", "text": "func (this *Mulitcaster) lisenter(server Server){\n\trpc.Register(&(this.sender))\n\tl, e := net.Listen(\"tcp\", \":\"+server.comm_port)\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\tfor{\n\t\tc, e := l.Accept()\n\t\tif e != nil {\n\t\t\tlog.Fatal(\"client connect error: \", e)\n\t\t}\n\t\tgo rpc.ServeConn(c)\n\t}\n}", "title": "" }, { "docid": "198cd74d0ab0bdcb26cd05b9a9b491dc", "score": "0.49073008", "text": "func (rf *Raft) broadcastAppendEntriesRPC() {\n\tfor server := range rf.peers {\n\t\tif server != rf.me && rf.status == LEADER {\n\t\t\t//send entries in parallel\n\t\t\tgo func(server int) {\n\t\t\t\tprevLogIndex := rf.nextIndex[server] - 1\n\t\t\t\t//if entries is empty, means heartbeat\n\t\t\t\targs := AppendEntriesArgs{\n\t\t\t\t\tTerm: rf.currentTerm,\n\t\t\t\t\tLeaderID: rf.me,\n\t\t\t\t\tLeaderCommit: rf.commitIndex,\n\t\t\t\t\tPrevLogIndex: prevLogIndex,\n\t\t\t\t\tPrevLogTerm: rf.log[prevLogIndex].Term,\n\t\t\t\t\tEntries: rf.log[(prevLogIndex + 1):],\n\t\t\t\t}\n\t\t\t\treply := AppendEntriesReply{}\n\t\t\t\tDPrintf(\"leader-%v sendAppendEntries to server-%v\\n\", rf.me, server)\n\t\t\t\trf.sendAppendEntries(server, &args, &reply)\n\t\t\t}(server)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a91be0da68fd3ea8e15964c944ef4398", "score": "0.488847", "text": "func (kv *ShardKV) apply() {\n\tfor !kv.killed() {\n\t\tmsg := <-kv.applyCh // new message committed in raft\n\t\tkv.debug(\"New message #%v to apply %v\\n\", msg.CommandIndex, msg)\n\t\tstart := time.Now()\n\t\tif msg.CommandValid {\n\t\t\top := msg.Command.(Op)\n\n\t\t\tkv.mu.Lock()\n\n\t\t\twriteCh := kv.checkNewClient(op.ClientId)\n\n\t\t\t// apply command\n\t\t\terr, result := kv.applyToStateMachine(op)\n\n\t\t\tkv.debug(\"Message #%v applied to state machine.\\n\", msg.CommandIndex)\n\n\t\t\tif msg.CommandIndex > kv.lastIndex {\n\t\t\t\tkv.lastIndex = msg.CommandIndex\n\t\t\t}\n\n\t\t\tkv.mu.Unlock()\n\n\t\t\t// size has exceeded\n\t\t\tif kv.maxraftstate != -1 && kv.rf.GetRaftStateSize() >= kv.maxraftstate {\n\t\t\t\tkv.debug(\"Snapshotting\")\n\t\t\t\tkv.mu.Lock()\n\t\t\t\tdata := kv.makeSnapshot()\n\t\t\t\tkv.rf.Snapshot(kv.lastIndex, data) // force raft to trim itself and save the data\n\t\t\t\tkv.mu.Unlock()\n\t\t\t}\n\n\t\t\tgo func() {\n\t\t\t\tselect {\n\t\t\t\tcase writeCh <- Result{Err: err, Op: result, Index: msg.CommandIndex}:\n\t\t\t\t\tkv.debug(\"Message #%v received.\\n\", op.RequestId)\n\t\t\t\tcase <-time.After(time.Millisecond * 20):\n\t\t\t\t\tkv.debug(\"No one to get message #%v, skipping\\n\", op.RequestId)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t} else if msg.SnapshotValid {\n\t\t\t// try to install the received snapshot\n\t\t\tkv.mu.Lock()\n\t\t\tif kv.rf.CondInstallSnapshot(msg.SnapshotTerm, msg.SnapshotIndex, msg.Snapshot) {\n\t\t\t\tkv.debug(\"Applying new snapshot from index %v\\n\", msg.SnapshotIndex)\n\t\t\t\tdata := msg.Snapshot\n\t\t\t\tkv.loadSnapshot(data) //\n\t\t\t\tkv.lastIndex = msg.SnapshotIndex\n\n\t\t\t} else {\n\t\t\t\tkv.debug(\"Invalid snapshot. Skipping\\n\")\n\t\t\t}\n\t\t\tkv.mu.Unlock()\n\t\t} else {\n\t\t\tpanic(fmt.Sprintf(\"Received non valid message %v\\n\", msg))\n\t\t}\n\t\tend := time.Now()\n\t\tkv.debug(\"Sending message took %v\\n\", time.Duration(end.Sub(start)))\n\t}\n}", "title": "" }, { "docid": "9125a7772a306d243a78270f5cfc6899", "score": "0.4875021", "text": "func (rf *Raft) sendAppendEntries(server int) {\n\trf.replication[server].Lock()\n\tfor rf.alive && rf.state == STATE_LEADER && rf.getLastLogIndex() >= rf.nextIndex[server] {\n\n\t\trf.mu.Lock() //\n\t\tvar snapshotStatus = rf.snapshot.LastEntryIndex\n\t\tif rf.nextIndex[server] <= rf.snapshot.LastEntryIndex {\n\t\t\t// send snapshot\n\n\t\t\trf.mu.Unlock() //\n\t\t\tDPrintf(strconv.Itoa(rf.me) + \" sending snapshot with logs up to \" + strconv.Itoa(rf.snapshot.LastEntryIndex) + \" to peer \" + strconv.Itoa(server) + \" term \" + strconv.Itoa(rf.CurrentTerm))\n\t\t\tvar successfullySent= false\n\t\t\targ := SendSnapshotArgs{rf.me, rf.CurrentTerm, rf.snapshot}\n\t\t\tvar reply AppendEntriesReply\n\t\t\tfor rf.alive && rf.state == STATE_LEADER && !successfullySent {\n\t\t\t\tsuccessfullySent = rf.peers[server].Call(\"Raft.InstallSnapshot\", &arg, &reply)\n\t\t\t\tif !successfullySent {\n\t\t\t\t\tDPrintf(\"+ \" + strconv.Itoa(rf.me) + \" lost connection with \" + strconv.Itoa(server))\n\t\t\t\t}\n\t\t\t}\n\t\t\trf.mu.Lock()\n\t\t\tif rf.state != STATE_LEADER {\n\t\t\t\trf.mu.Unlock()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif snapshotStatus != rf.snapshot.LastEntryIndex {\n\t\t\t\trf.mu.Unlock()\n\t\t\t\tbreak // A snapshot has been created. Abandon and restart at the next heartbeat.\n\t\t\t}\n\t\t\tif reply.Term > rf.CurrentTerm {\n\t\t\t\trf.becomeFollower(reply.Term)\n\t\t\t\trf.mu.Unlock()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\trf.matchIndex[server] = rf.snapshot.LastEntryIndex\n\t\t\tDPrintf(\"- replication (snapshot): \" + strconv.Itoa(server) + \" now has \" + strconv.Itoa(rf.snapshot.LastEntryIndex))\n\t\t\trf.nextIndex[server] = rf.getLogAfter(rf.snapshot.LastEntryIndex).Index\n\t\t\trf.incrementCommit()\n\t\t\trf.mu.Unlock()\n\n\n\t\t} else {\n\t\t\t// send log\n\n\t\t\tvar entries= rf.getLogsFrom(rf.nextIndex[server])\n\t\t\tvar prevLog= rf.getLogBefore(entries[0].Index)\n\t\t\tvar prevLogTerm= prevLog.Term\n\t\t\tvar prevLogIndex= prevLog.Index\n\t\t\trf.mu.Unlock() //\n\t\t\tDPrintf(strconv.Itoa(rf.me) + \" trying to replicate \" + strconv.Itoa(rf.nextIndex[server]) + \" => \" + strconv.Itoa(rf.getLastLogIndex()) + \" term \" + strconv.Itoa(rf.CurrentTerm) + \" to \" + strconv.Itoa(server) + \", prev=\" + strconv.Itoa(prevLogIndex) + \", prevTerm=\" + strconv.Itoa(prevLogTerm))\n\t\t\tvar toAppend= AppendEntries{entries, rf.me, rf.commitIndex, rf.CurrentTerm, prevLogIndex, prevLogTerm}\n\t\t\tvar successfullySent= false\n\t\t\tvar reply AppendEntriesReply\n\t\t\tfor rf.alive && rf.state == STATE_LEADER && !successfullySent {\n\t\t\t\tsuccessfullySent = rf.peers[server].Call(\"Raft.AppendEntriesHandler\", &toAppend, &reply)\n\t\t\t\tif !successfullySent {\n\t\t\t\t\tDPrintf(\"+ \" + strconv.Itoa(rf.me) + \" lost connection with \" + strconv.Itoa(server))\n\t\t\t\t}\n\t\t\t}\n\t\t\trf.mu.Lock()\n\t\t\tif rf.state != STATE_LEADER {\n\t\t\t\trf.mu.Unlock()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif snapshotStatus != rf.snapshot.LastEntryIndex {\n\t\t\t\trf.mu.Unlock()\n\t\t\t\tbreak // A snapshot has been created. Abandon and restart at the next heartbeat.\n\t\t\t}\n\t\t\tif reply.Term > rf.CurrentTerm {\n\t\t\t\trf.becomeFollower(reply.Term)\n\t\t\t\trf.mu.Unlock()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif reply.Status {\n\t\t\t\trf.matchIndex[server] = entries[len(entries) - 1].Index\n\t\t\t\tDPrintf(\"- replication: \" + strconv.Itoa(server) + \" now has \" + strconv.Itoa(entries[len(entries) - 1].Index))\n\t\t\t\trf.nextIndex[server] = rf.getLogAfter(entries[len(entries) - 1].Index).Index\n\t\t\t\tprevLogTerm = rf.getLogAfter(prevLogIndex).Term\n\t\t\t\tprevLogIndex = rf.getLogAfter(prevLogIndex).Index\n\t\t\t\trf.incrementCommit()\n\t\t\t} else {\n\t\t\t\trf.nextIndex[server] = rf.getLogBefore(rf.nextIndex[server]).Index\n\t\t\t\tprevLogIndex = rf.getLogBefore(rf.nextIndex[server]).Index\n\t\t\t\tprevLogTerm = rf.getLogBefore(rf.nextIndex[server]).Term\n\t\t\t\tif prevLogIndex > rf.snapshot.LastEntryIndex {\n\t\t\t\t\tif rf.nextIndex[server] > reply.LastEntryIndex && rf.entryIsIncluded(reply.LastEntryIndex) && rf.getLogTerm(reply.LastEntryIndex) == reply.LastEntryTerm {\n\t\t\t\t\t\t// server is simply late => jump to its last log\n\t\t\t\t\t\tvar target = rf.getLogAfter(reply.LastEntryIndex).Index\n\t\t\t\t\t\tfor prevLogIndex > rf.snapshot.LastEntryIndex && rf.nextIndex[server] > target {\n\t\t\t\t\t\t\trf.nextIndex[server] = rf.getLogBefore(rf.nextIndex[server]).Index\n\t\t\t\t\t\t\tprevLogIndex = rf.getLogBefore(rf.nextIndex[server]).Index\n\t\t\t\t\t\t\tprevLogTerm = rf.getLogBefore(rf.nextIndex[server]).Term\n\t\t\t\t\t\t}\n\t\t\t\t\t\tDPrintf(\"replication correction for \" + strconv.Itoa(server) + \": jumped to server's last log prevIndex=\" + strconv.Itoa(prevLogIndex))\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// there is a conflict => jump to beginning of term of conflicting log\n\t\t\t\t\t\tvar conflictingTerm = reply.ConflictingLogTerm\n\t\t\t\t\t\tif prevLogTerm < conflictingTerm {\n\t\t\t\t\t\t\tconflictingTerm = prevLogTerm\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor prevLogIndex > rf.snapshot.LastEntryIndex && prevLogTerm >= conflictingTerm {\n\t\t\t\t\t\t\trf.nextIndex[server] = rf.getLogBefore(rf.nextIndex[server]).Index\n\t\t\t\t\t\t\tprevLogIndex = rf.getLogBefore(rf.nextIndex[server]).Index\n\t\t\t\t\t\t\tprevLogTerm = rf.getLogBefore(rf.nextIndex[server]).Term\n\t\t\t\t\t\t}\n\t\t\t\t\t\tDPrintf(\"replication correction for: \" + strconv.Itoa(server) + \" jumped to term new term=\" + strconv.Itoa(rf.getLog(rf.nextIndex[server]).Term) + \" nextIndex=\" + strconv.Itoa(rf.getLog(rf.nextIndex[server]).Index))\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\trf.nextIndex[server] = rf.snapshot.LastEntryIndex // snapshot will be sent\n\t\t\t\t}\n\t\t\t}\n\t\t\trf.mu.Unlock()\n\t\t}\n\t}\n\trf.replication[server].Unlock()\n}", "title": "" }, { "docid": "2efa11d3ec4ad0adbef55fc561b5f816", "score": "0.48328674", "text": "func (c *Controller) addPeerWorker() {\n\tfor {\n\t\taddr := <-c.addPeerChan\n\t\tlog.WithFields(log.Fields{\"controller\": c, \"func\": \"addPeerWorker\", \"addr\": addr}).Info(\"Received peering info\")\n\n\t\t//Skip known peers\n\t\tif _, known := c.Peers.Load(addr); known {\n\t\t\tlog.WithFields(log.Fields{\"controller\": c, \"func\": \"addPeerWorker\", \"addr\": addr}).Debug(\"Skip known peer\")\n\t\t\tcontinue\n\t\t}\n\n\t\t//Add peers to the list of known peers\n\t\tpeer := NewPeer(addr, c.config)\n\t\tc.Peers.Store(addr, peer)\n\t}\n}", "title": "" }, { "docid": "e37ff41d73e4740a3f5d6ed13ff9d3e6", "score": "0.4827713", "text": "func (kv *KVServer) applier() {\n\tfor !kv.killed() {\n\t\tm := <-kv.applyCh\n\t\tkv.mu.Lock()\n\t\tif m.SnapshotValid { //snapshot\n\t\t\tkv.logger.L(logger.ServerSnap, \"recv Installsnapshot %v %v\\n\", m.SnapshotIndex, kv.lastApplied)\n\t\t\tif kv.rf.CondInstallSnapshot(m.SnapshotTerm,\n\t\t\t\tm.SnapshotIndex, m.Snapshot) {\n\t\t\t\told_apply := kv.lastApplied\n\t\t\t\tkv.logger.L(logger.ServerSnap, \"decide Installsnapshot %v <- %v\\n\", m.SnapshotIndex, kv.lastApplied)\n\t\t\t\tkv.applyInstallSnapshot(m.Snapshot)\n\t\t\t\tfor i := old_apply + 1; i <= m.SnapshotIndex; i++ {\n\t\t\t\t\tkv.notify(i)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if m.CommandValid && m.CommandIndex == 1+kv.lastApplied {\n\t\t\tkv.logger.L(logger.ServerApply, \"apply %d %#v lastApplied %v\\n\", m.CommandIndex, m.Command, kv.lastApplied)\n\n\t\t\tkv.lastApplied = m.CommandIndex\n\t\t\tv, ok := m.Command.(Command)\n\t\t\tif !ok {\n\t\t\t\t//err\n\t\t\t\tpanic(\"not ok assertion in apply!\")\n\t\t\t}\n\t\t\tkv.applyCommand(v) //may ignore duplicate cmd\n\n\t\t\tif kv.needSnapshot() {\n\t\t\t\tkv.doSnapshotForRaft(m.CommandIndex)\n\t\t\t}\n\t\t\tkv.notify(m.CommandIndex)\n\n\t\t} else if m.CommandValid && m.CommandIndex != 1+kv.lastApplied {\n\t\t\t// out of order cmd, just ignore\n\t\t\tkv.logger.L(logger.ServerApply, \"ignore apply %v for lastApplied %v\\n\",\n\t\t\t\tm.CommandIndex, kv.lastApplied)\n\t\t} else {\n\t\t\t// wrong command\n\t\t\tkv.logger.L(logger.ServerApply, \"Invalid apply msg\\n\")\n\t\t}\n\n\t\tkv.mu.Unlock()\n\t}\n\n}", "title": "" }, { "docid": "76b63b7a012192c6612950653bb1da0a", "score": "0.47980323", "text": "func (c *AddServiceCommand) Apply(server raft.Server) (interface{}, error) {\n\treg := server.Context().(registry.Registry)\n\terr := reg.Add(c.Service)\n\n\tif err == nil {\n\t\tlog.Println(\"Added Service:\", c.Service)\n\t}\n\n\treturn c.Service, err\n}", "title": "" }, { "docid": "3bdf2b08b6899f156d1f80777c350363", "score": "0.4797884", "text": "func (kv *KVServer) applyChHandler() {\n\tvar msg raft.ApplyMsg\n\tfor !kv.killed() {\n\t\tmsg = <- kv.applyCh // must be FIFO\n\t\tif msg.CommandValid {\n\t\t\t// append to\n\t\t\tkv.mu.Lock()\n\t\t\tcmd, ok := msg.Command.(Op)\n\t\t\tDPrintf3(\"%d: applyChHandler processing %d\", kv.me, cmd.ClientRequestID)\n\t\t\tif ok {\n\t\t\t\t//DPrintf3(\"%d: Appending & executing %d, (%s, %s), commit #: %d\", kv.me, cmd.Operation, cmd.Key, cmd.Value, msg.CommandIndex)\n\t\t\t\t// Check whether the request is exectued\n\t\t\t\tcommitIdx, ok := kv.reqCommitIdx[cmd.ClientRequestID]\n\t\t\t\tif ok {\n\t\t\t\t\t//DPrintf3(\"%d: Skip duplicate request %l. \", kv.me, cmd.ClientRequestID)\n\t\t\t\t\t// Save the log but don't execute it\n\t\t\t\t\t//DPrintf3(\"Duplicate request %d\", cmd.ClientRequestID)\n\t\t\t\t\tkv.committedLogs[msg.CommandIndex] = kv.committedLogs[commitIdx]\n\t\t\t\t} else {\n\t\t\t\t\t// Execute op\n\t\t\t\t\tswitch cmd.Operation {\n\t\t\t\t\tcase OpGet:\n\t\t\t\t\t\tcmd.Value = kv.data[cmd.Key]\n\t\t\t\t\tcase OpAppend:\n\t\t\t\t\t\t_, ok := kv.data[cmd.Key]\n\t\t\t\t\t\tif !ok {\n\t\t\t\t\t\t\tkv.data[cmd.Key] = cmd.Value\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tkv.data[cmd.Key] += cmd.Value\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//DPrintf3(\"%d: Appending (%s, %s) into kvdata %s\", kv.me, cmd.Key, cmd.Value, kv.data[cmd.Key])\n\t\t\t\t\tcase OpPut:\n\t\t\t\t\t\tkv.data[cmd.Key] = cmd.Value\n\t\t\t\t\t\t//DPrintf3(\"%d: Putting (%s, %s) into kvdata %s\", kv.me, cmd.Key, cmd.Value, kv.data[cmd.Key])\n\t\t\t\t\t}\n\t\t\t\t\tkv.committedLogs[msg.CommandIndex] = Log{cmd: cmd, term: msg.RaftTerm}\n\t\t\t\t\tkv.reqCommitIdx[cmd.ClientRequestID] = msg.CommandIndex\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tDPrintf3(\"%d: Type assertion in applyChHandler failed!\", kv.me)\n\t\t\t}\n\t\t\tif ch, ok := kv.callbackCh[cmd.ClientRequestID]; ok {\n\t\t\t\tch <- kv.committedLogs[msg.CommandIndex]\n\t\t\t\t//close(ch)\n\t\t\t\tdelete(kv.callbackCh, cmd.ClientRequestID)\n\t\t\t}\n\t\t\tkv.mu.Unlock()\n\t\t} else {\n\t\t\tDPrintf3(\"%d: msg invalid!\", kv.me)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ef5c7553df9d97b3fe754ac3a796a08e", "score": "0.47870064", "text": "func (this *Mulitcaster) Initiallized(server Server, members []Server){\n\tthis.members = make(map[string]string)\n\tfor s := range members {\n\t\t// TODO: add server name as key and server ip + comm_port as server\n\t\tthis.members[members[s].name] = members[s].combineAddr(\"comm\")\n\t}\n\tthis.myInfo = server\n\tthis.sender = RPCRecver{this, make(map[string]chan string)}\n\n\tthis.voted = false\n\tthis.numVotes = 0\n\tthis.masterChan = make(chan string)\n\n\tthis.ackChans = make(map[string]chan string)\n\tthis.msgChans = make(map[string]chan ListContent)\n\tthis.elecChan = make(chan ElectionMsg, 128)\n\tthis.electionLock = new(sync.Mutex)\n\tgo this.lisenter(server)\n}", "title": "" }, { "docid": "b313516dc71dee9776f6e7d4372eb6f6", "score": "0.47856608", "text": "func (s *Syncer) Apply(state DPSyncerState) error {\n\tif !s.synced {\n\t\tlog.Infof(\"Loading BPF map state from dataplane\")\n\t\tif err := s.startupSync(state); err != nil {\n\t\t\treturn fmt.Errorf(fmt.Sprintf(\"startup sync err: %v\", err))\n\t\t}\n\t\tlog.Infof(\"Loaded BPF map state from dataplane\")\n\t\ts.mapsLock.Lock()\n\t} else {\n\t\t// if we were not synced yet, the fixer cannot run yet\n\t\t//s.StopExpandNPFixup()\n\n\t\ts.mapsLock.Lock()\n\t\ts.prevSvcMap = s.newSvcMap\n\t\ts.prevEpsMap = s.newEpsMap\n\t}\n\n}", "title": "" }, { "docid": "24d63c2ae8142476a12cd9f39a35aaf8", "score": "0.47794503", "text": "func (s *ksServer) Apply(ctx context.Context, req ApplyRequest) error {\n\treturn fmt.Errorf(\"Not Implemented.\")\n}", "title": "" }, { "docid": "feda09228cdc45e0dccb81be367be83f", "score": "0.4772339", "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\tsm.configs[0].Num = 0;\n\tsm.configs[0].Shards = [NShards]int{};\n\n\tgob.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\tsm.result = make(map[int]chan OpReply);\n\tsm.commandMap = make(map[int64]int);\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase applyMsg := <-sm.applyCh:\n\t\t\t\top, ok := applyMsg.Command.(Op)\n\t\t\t\tif ok {\n\t\t\t\t\tsm.mu.Lock();\n\n\t\t\t\t\tvar opReply OpReply;\n\t\t\t\t\topReply.ClientId = op.ClientId;\n\t\t\t\t\topReply.SequenceNumber = op.SequenceNumber;\n\t\t\t\t\topReply.WrongLeader = true;\n\n\t\t\t\t\t// execute command\n\t\t\t\t\tif sm.commandMap[op.ClientId] < op.SequenceNumber {\n\t\t\t\t\t\tif op.Action == \"Join\" {\n\t\t\t\t\t\t\topReply.WrongLeader = false;\n\n\t\t\t\t\t\t\t//new config\n\t\t\t\t\t\t\tvar newConfig Config;\n\t\t\t\t\t\t\tnewConfig.Num = len(sm.configs);\n\t\t\t\t\t\t\tnewConfig.Shards = [NShards] int{};\n\t\t\t\t\t\t\tnewConfig.Groups = make(map[int][]string);\n\n\t\t\t\t\t\t\tfor key, val := range sm.configs[len(sm.configs)-1].Groups {\n\t\t\t\t\t\t\t\tnewConfig.Groups[key] = val;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor i := 0; i < len(newConfig.Shards); i++ {\n\t\t\t\t\t\t\t\tnewConfig.Shards[i] = sm.configs[len(sm.configs)-1].Shards[i];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t//join\n\t\t\t\t\t\t\tfor gid, servers := range op.Servers {\n\t\t\t\t\t\t\t\t_, found := newConfig.Groups[gid];\n\t\t\t\t\t\t\t\tif !found {\n\t\t\t\t\t\t\t\t\tnewConfig.Groups[gid] = servers;\n\t\t\t\t\t\t\t\t\tsm.RebalanceConfig(&newConfig, \"Join\", gid);\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\tsm.configs = append(sm.configs, newConfig);\n\n\t\t\t\t\t\t} else if op.Action == \"Leave\" {\n\t\t\t\t\t\t\topReply.WrongLeader = false;\n\n\t\t\t\t\t\t\tvar newConfig Config;\n\t\t\t\t\t\t\tnewConfig.Num = len(sm.configs);\n\t\t\t\t\t\t\tnewConfig.Shards = [NShards] int{};\n\t\t\t\t\t\t\tnewConfig.Groups = make(map[int][]string);\n\n\t\t\t\t\t\t\tfor key, val := range sm.configs[len(sm.configs)-1].Groups {\n\t\t\t\t\t\t\t\tnewConfig.Groups[key] = val;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor i := 0; i < len(newConfig.Shards); i++ {\n\t\t\t\t\t\t\t\tnewConfig.Shards[i] = sm.configs[len(sm.configs)-1].Shards[i];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t//leave\n\t\t\t\t\t\t\tfor _, gid := range op.GIDs {\n\t\t\t\t\t\t\t\t_, found := newConfig.Groups[gid];\n\t\t\t\t\t\t\t\tif found {\n\t\t\t\t\t\t\t\t\tdelete(newConfig.Groups, gid);\n\t\t\t\t\t\t\t\t\tsm.RebalanceConfig(&newConfig, \"Leave\", gid);\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\tsm.configs = append(sm.configs, newConfig);\n\n\n\n\t\t\t\t\t\t} else if op.Action == \"Move\" {\n\t\t\t\t\t\t\topReply.WrongLeader = false;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//new config\n\t\t\t\t\t\t\tvar newConfig Config;\n\t\t\t\t\t\t\tnewConfig.Num = len(sm.configs);\n\t\t\t\t\t\t\tnewConfig.Shards = [NShards] int{};\n\t\t\t\t\t\t\tnewConfig.Groups = make(map[int][]string);\n\n\t\t\t\t\t\t\tfor key, val := range sm.configs[len(sm.configs)-1].Groups {\n\t\t\t\t\t\t\t\tnewConfig.Groups[key] = val;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor i := 0; i < len(newConfig.Shards); i++ {\n\t\t\t\t\t\t\t\tnewConfig.Shards[i] = sm.configs[len(sm.configs)-1].Shards[i];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t//move\n\t\t\t\t\t\t\tnewConfig.Shards[op.Shard] = op.GID;\n\t\t\t\t\t\t\tsm.configs = append(sm.configs, newConfig);\n\n\n\t\t\t\t\t\t} else if op.Action == \"Query\" {\n\t\t\t\t\t\t\topReply.WrongLeader = false;\n\n\t\t\t\t\t\t\tnum := op.Num;\n\t\t\t\t\t\t\tif num >= len(sm.configs) || num == -1 {\n\t\t\t\t\t\t\t\topReply.Config = sm.configs[len(sm.configs) - 1];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\topReply.Config = sm.configs[num];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsm.commandMap[op.ClientId] = op.SequenceNumber;\n\t\t\t\t\t} else if op.Action == \"Query\" {\n\t\t\t\t\t\tnum := op.Num;\n\t\t\t\t\t\tif num >= len(sm.configs) || num == -1 {\n\t\t\t\t\t\t\topReply.Config = sm.configs[len(sm.configs) - 1];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\topReply.Config = sm.configs[num];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t_, channelExists := sm.result[applyMsg.Index];\n\n\t\t\t\t\tif channelExists {\n\t\t\t\t\t\tsm.result[applyMsg.Index] <- opReply;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsm.result[applyMsg.Index] = make(chan OpReply, 1);\n\t\t\t\t\t}\n\n\t\t\t\t\tsm.mu.Unlock();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn sm;\n}", "title": "" }, { "docid": "32c93da095cd328a06325ab1c84aa16d", "score": "0.47703165", "text": "func (e *node) SetPeers(ctx context.Context, peers []string) error {\n\n\t// If the main loop is not running, there is no risk of race\n\tif atomic.LoadInt64(&e.running) != 1 {\n\t\te.peers = peers\n\t\treturn nil\n\t}\n\n\tselect {\n\tcase <-e.send(SetPeersReq{Peers: peers}):\n\t\treturn nil\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n}", "title": "" }, { "docid": "778c6f16219e35106d6d40cde81c88c6", "score": "0.47672608", "text": "func Fly() {\n\tlis, err := net.Listen(\"tcp\", conf.Conf.Server.Host + \":\" + conf.Conf.Server.Port)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to listen: %v\", err)\n\t}\n\ts := grpc.NewServer()\n\n\tregister.RegService(s)\n\n\t// Register reflection service on gRPC server.\n\treflection.Register(s)\n\tlog.Printf(\"holmes server start listen on: %s:%s\\n\", conf.Conf.Server.Host, conf.Conf.Server.Port)\n\tif err := s.Serve(lis); err != nil {\n\t\tlog.Fatalf(\"failed to serve: %v\", err)\n\t}\n}", "title": "" }, { "docid": "953a07cb41375bf0f028f7bc179eeba4", "score": "0.47655445", "text": "func Make(peers []string, me int, rpcs *rpc.Server) *Paxos {\n px := &Paxos{}\n px.peers = peers\n px.me = me\n\n\n // Your initialization code here.\n px.peers_min = make([]int,len(px.peers))\n px.instance_map = make(map[int]instance_state)\n px.global_min = 0\n//fmt.Println(\"Num of peers:\")\n//fmt.Println(len(px.peers))\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 l, e := net.Listen(\"unix\", peers[me]);\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.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 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\n return px\n}", "title": "" }, { "docid": "6c9d36c2aee7f17238f216b470245b6a", "score": "0.47640723", "text": "func (h *Handler) RouteCoordinator() {\n\t// iceCandidates := map[string][]string{}\n\toClient := h.oClient\n\n\t/* Coordinator */\n\n\t// Received from coordinator the serverID\n\toClient.Receive(\n\t\t\"serverID\",\n\t\tfunc(response cws.WSPacket) (request cws.WSPacket) {\n\t\t\t// Stick session with serverID got from coordinator\n\t\t\tlog.Println(\"Received serverID \", response.Data)\n\t\t\th.serverID = response.Data\n\n\t\t\treturn cws.EmptyPacket\n\t\t},\n\t)\n\n\t/* WebRTC Connection */\n\n\toClient.Receive(\n\t\t\"initwebrtc\",\n\t\tfunc(resp cws.WSPacket) (req cws.WSPacket) {\n\t\t\tlog.Println(\"Received a request to createOffer from browser via coordinator\")\n\n\t\t\tpeerconnection := webrtc.NewWebRTC()\n\t\t\tvar initPacket struct {\n\t\t\t\tIsMobile bool `json:\"is_mobile\"`\n\t\t\t}\n\t\t\terr := json.Unmarshal([]byte(resp.Data), &initPacket)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Error: Cannot decode json:\", err)\n\t\t\t\treturn cws.EmptyPacket\n\t\t\t}\n\n\t\t\tlocalSession, err := peerconnection.StartClient(\n\t\t\t\tinitPacket.IsMobile,\n\t\t\t\tfunc(candidate string) {\n\t\t\t\t\t// send back candidate string to browser\n\t\t\t\t\toClient.Send(cws.WSPacket{\n\t\t\t\t\t\tID: \"candidate\",\n\t\t\t\t\t\tData: candidate,\n\t\t\t\t\t\tSessionID: resp.SessionID,\n\t\t\t\t\t}, nil)\n\t\t\t\t},\n\t\t\t)\n\n\t\t\t// localSession, err := peerconnection.StartClient(initPacket.IsMobile, iceCandidates[resp.SessionID])\n\t\t\t// h.peerconnections[resp.SessionID] = peerconnection\n\n\t\t\t// Create new sessions when we have new peerconnection initialized\n\t\t\tsession := &Session{\n\t\t\t\tpeerconnection: peerconnection,\n\t\t\t}\n\t\t\th.sessions[resp.SessionID] = session\n\t\t\tlog.Println(\"Start peerconnection\", resp.SessionID)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Error: Cannot create new webrtc session\", err)\n\t\t\t\treturn cws.EmptyPacket\n\t\t\t}\n\n\t\t\treturn cws.WSPacket{\n\t\t\t\tID: \"offer\",\n\t\t\t\tData: localSession,\n\t\t\t}\n\t\t},\n\t)\n\n\toClient.Receive(\n\t\t\"answer\",\n\t\tfunc(resp cws.WSPacket) (req cws.WSPacket) {\n\t\t\tlog.Println(\"Received answer SDP from browser\")\n\t\t\tsession := h.getSession(resp.SessionID)\n\n\t\t\tif session != nil {\n\t\t\t\tpeerconnection := session.peerconnection\n\n\t\t\t\terr := peerconnection.SetRemoteSDP(resp.Data)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"Error: Cannot set RemoteSDP of client: \" + resp.SessionID)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Error: No session for ID: %s\\n\", resp.SessionID)\n\t\t\t}\n\n\t\t\treturn cws.EmptyPacket\n\t\t},\n\t)\n\n\toClient.Receive(\n\t\t\"candidate\",\n\t\tfunc(resp cws.WSPacket) (req cws.WSPacket) {\n\t\t\tlog.Println(\"Received remote Ice Candidate from browser\")\n\t\t\tsession := h.getSession(resp.SessionID)\n\n\t\t\tif session != nil {\n\t\t\t\tpeerconnection := session.peerconnection\n\n\t\t\t\terr := peerconnection.AddCandidate(resp.Data)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"Error: Cannot add IceCandidate of client: \" + resp.SessionID)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Error: No session for ID: %s\\n\", resp.SessionID)\n\t\t\t}\n\n\t\t\treturn cws.EmptyPacket\n\t\t},\n\t)\n\n\t/* Game Logic */\n\n\toClient.Receive(\n\t\t\"start\",\n\t\tfunc(resp cws.WSPacket) (req cws.WSPacket) {\n\t\t\tlog.Println(\"Received a start request from coordinator\")\n\t\t\tsession := h.getSession(resp.SessionID)\n\t\t\tif session == nil {\n\t\t\t\tlog.Printf(\"Error: No session for ID: %s\\n\", resp.SessionID)\n\t\t\t\treturn cws.EmptyPacket\n\t\t\t}\n\n\t\t\tpeerconnection := session.peerconnection\n\t\t\t// TODO: Standardize for all types of packet. Make WSPacket generic\n\t\t\tvar startPacket struct {\n\t\t\t\tGameName string `json:\"game_name\"`\n\t\t\t\tIsMobile bool `json:\"is_mobile\"`\n\t\t\t}\n\n\t\t\terr := json.Unmarshal([]byte(resp.Data), &startPacket)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Error: Cannot decode json:\", err)\n\t\t\t\treturn cws.EmptyPacket\n\t\t\t}\n\n\t\t\troom := h.startGameHandler(startPacket.GameName, resp.RoomID, resp.PlayerIndex, peerconnection, util.GetVideoEncoder(startPacket.IsMobile))\n\t\t\tsession.RoomID = room.ID\n\t\t\t// TODO: can data race\n\t\t\th.rooms[room.ID] = room\n\n\t\t\treturn cws.WSPacket{\n\t\t\t\tID: \"start\",\n\t\t\t\tRoomID: room.ID,\n\t\t\t}\n\t\t},\n\t)\n\n\toClient.Receive(\n\t\t\"quit\",\n\t\tfunc(resp cws.WSPacket) (req cws.WSPacket) {\n\t\t\tlog.Println(\"Received a quit request from coordinator\")\n\t\t\tsession := h.getSession(resp.SessionID)\n\n\t\t\tif session != nil {\n\t\t\t\troom := h.getRoom(session.RoomID)\n\t\t\t\t// Defensive coding, check if the peerconnection is in room\n\t\t\t\tif room.IsPCInRoom(session.peerconnection) {\n\t\t\t\t\th.detachPeerConn(session.peerconnection)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Error: No session for ID: %s\\n\", resp.SessionID)\n\t\t\t}\n\n\t\t\treturn cws.EmptyPacket\n\t\t},\n\t)\n\n\toClient.Receive(\n\t\t\"save\",\n\t\tfunc(resp cws.WSPacket) (req cws.WSPacket) {\n\t\t\tlog.Println(\"Received a save game from coordinator\")\n\t\t\tlog.Println(\"RoomID:\", resp.RoomID)\n\t\t\treq.ID = \"save\"\n\t\t\treq.Data = \"ok\"\n\t\t\tif resp.RoomID != \"\" {\n\t\t\t\troom := h.getRoom(resp.RoomID)\n\t\t\t\tif room == nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\terr := room.SaveGame()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"[!] Cannot save game state: \", err)\n\t\t\t\t\treq.Data = \"error\"\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treq.Data = \"error\"\n\t\t\t}\n\n\t\t\treturn req\n\t\t})\n\n\toClient.Receive(\n\t\t\"load\",\n\t\tfunc(resp cws.WSPacket) (req cws.WSPacket) {\n\t\t\tlog.Println(\"Received a load game from coordinator\")\n\t\t\tlog.Println(\"Loading game state\")\n\t\t\treq.ID = \"load\"\n\t\t\treq.Data = \"ok\"\n\t\t\tif resp.RoomID != \"\" {\n\t\t\t\troom := h.getRoom(resp.RoomID)\n\t\t\t\terr := room.LoadGame()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"[!] Cannot load game state: \", err)\n\t\t\t\t\treq.Data = \"error\"\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treq.Data = \"error\"\n\t\t\t}\n\n\t\t\treturn req\n\t\t})\n\n\toClient.Receive(\n\t\t\"playerIdx\",\n\t\tfunc(resp cws.WSPacket) (req cws.WSPacket) {\n\t\t\tlog.Println(\"Received an update player index event from coordinator\")\n\t\t\treq.ID = \"playerIdx\"\n\n\t\t\troom := h.getRoom(resp.RoomID)\n\t\t\tsession := h.getSession(resp.SessionID)\n\t\t\tidx, err := strconv.Atoi(resp.Data)\n\t\t\tlog.Printf(\"Got session %v and room %v\", session, room)\n\n\t\t\tif room != nil && session != nil && err == nil {\n\t\t\t\troom.UpdatePlayerIndex(session.peerconnection, idx)\n\t\t\t\treq.Data = strconv.Itoa(idx)\n\t\t\t} else {\n\t\t\t\treq.Data = \"error\"\n\t\t\t}\n\n\t\t\treturn req\n\t\t})\n\n\toClient.Receive(\n\t\t\"terminateSession\",\n\t\tfunc(resp cws.WSPacket) (req cws.WSPacket) {\n\t\t\tlog.Println(\"Received a terminate session \", resp.SessionID)\n\t\t\tsession := h.getSession(resp.SessionID)\n\t\t\tif session != nil {\n\t\t\t\tsession.Close()\n\t\t\t\tdelete(h.sessions, resp.SessionID)\n\t\t\t\th.detachPeerConn(session.peerconnection)\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Error: No session for ID: %s\\n\", resp.SessionID)\n\t\t\t}\n\n\t\t\treturn cws.EmptyPacket\n\t\t},\n\t)\n}", "title": "" }, { "docid": "325deddfa36afc8109410ff4a0b2b809", "score": "0.4760714", "text": "func (s *KingbusServer) applyConfChange(cc raftpb.ConfChange) (bool, error) {\n\tif err := s.cluster.ValidateConfigurationChange(cc); err != nil {\n\t\tcc.NodeID = etcdraft.None\n\t\tconfState := s.raftNode.ApplyConfChange(cc)\n\t\tsaveConfState(s.cluster.Store, confState)\n\t\treturn false, err\n\t}\n\n\t//save confState for restore\n\tconfState := s.raftNode.ApplyConfChange(cc)\n\tdefer saveConfState(s.cluster.Store, confState)\n\n\tswitch cc.Type {\n\tcase raftpb.ConfChangeAddNode:\n\t\tm := new(membership.Member)\n\t\tif err := json.Unmarshal(cc.Context, m); err != nil {\n\t\t\tlog.Log.Fatalf(\"unmarshal member should never fail: %v\", err)\n\t\t}\n\t\tif cc.NodeID != uint64(m.ID) {\n\t\t\tlog.Log.Fatalf(\"nodeID should always be equal to member id\")\n\t\t}\n\t\ts.cluster.AddMember(m)\n\t\tif m.ID != s.id {\n\t\t\ts.raftNode.Transport.AddPeer(m.ID, m.PeerURLs)\n\t\t}\n\tcase raftpb.ConfChangeRemoveNode:\n\t\tid := types.ID(cc.NodeID)\n\t\ts.cluster.RemoveMember(id)\n\t\tif id == s.id {\n\t\t\treturn true, nil\n\t\t}\n\t\ts.raftNode.Transport.RemovePeer(id)\n\tcase raftpb.ConfChangeUpdateNode:\n\t\tm := new(membership.Member)\n\t\tif err := json.Unmarshal(cc.Context, m); err != nil {\n\t\t\tlog.Log.Fatalf(\"unmarshal member should never fail: %v\", err)\n\t\t}\n\t\tif cc.NodeID != uint64(m.ID) {\n\t\t\tlog.Log.Fatalf(\"nodeID should always be equal to member id\")\n\t\t}\n\t\ts.cluster.UpdateRaftAttributes(m.ID, m.RaftAttributes)\n\t\tif m.ID != s.id {\n\t\t\ts.raftNode.Transport.UpdatePeer(m.ID, m.PeerURLs)\n\t\t}\n\t\t//todo ConfChangeAddLearnerNode\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "c85da89537bd0f13d2e3172244a83724", "score": "0.47475094", "text": "func (rf *Raft) callAppendEntries(server int) (*AppendEntriesReply, bool) {\n\tvar args *AppendEntriesArgs\n\trf.mu.Lock()\n\tboolObj, ok := rf.sending.Load(server)\n\tvar isSending bool\n\tif !ok {\n\t\trf.sending.Store(server, true)\n\t\tisSending = false\n\t} else {\n\t\tisSending = boolObj.(bool)\n\t}\n\tif isSending {\n\t\trf.mu.Unlock()\n\t\treturn nil, false\n\t}\n\trf.sending.Store(server, true)\n\tdefer rf.sending.Store(server, false)\n\n\t// if the leader discard the log that detects consistency, then send the snapshot\n\t// to the corresponding follower.\n\tif rf.nextIndex[server] <= rf.lastIncludedIndex {\n\t\tok := rf.sendSnapshotToServer(server)\n\t\tif !ok || rf.nextIndex[server] <= rf.lastIncludedIndex {\n\t\t\trf.mu.Unlock()\n\t\t\treturn nil, false\n\t\t}\n\t}\n\n\tvar entries []*Entry\n\tnextIndex := rf.nextIndex[server]\n\tif rf.matchIndex[server] >= rf.nextIndex[server] {\n\t\tentries = rf.LogManager.Slice(nextIndex, rf.LogManager.length())\n\t} else {\n\t\tentries = rf.LogManager.Slice(nextIndex, rf.LogManager.length())\n\t\t// TODO don't send all entries.\n\t}\n\t//fmt.Printf(\"[%d] nextIndex:%d, LogManager offset:%d, lastIncludedIndex:%d\\n\",\n\t//\trf.me, nextIndex, rf.LogManager.Offset, rf.lastIncludedIndex)\n\targs = &AppendEntriesArgs{\n\t\tTerm: rf.CurrentTerm,\n\t\tLeaderId: rf.me,\n\t\tPrevLogIndex: nextIndex - 1,\n\t\tPrevLogTerm: rf.LogManager.get(nextIndex - 1).Term,\n\t\tEntries: entries,\n\t\tLeaderCommit: rf.commitIndex,\n\t}\n\n\t// At some point, this goroutine prepares the args after another goroutine\n\t// has already received the reply and converted state to follower. In this\n\t// case, a disconnected leader reconnect to the net, it will send an AppendLog\n\t// RPC, while it has already changed state and updated term.\n\tif rf.state != Leader {\n\t\trf.mu.Unlock()\n\t\treturn nil, false\n\t}\n\n\trf.mu.Unlock()\n\treply := &AppendEntriesReply{}\n\tok = rf.sendAppendEntriesTimeout(time.Millisecond*50, server, args, reply)\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\tif !ok || rf.state != Leader || rf.CurrentTerm != args.Term {\n\t\t//DPrintf(\"[%d] send to %d failed\", rf.me, server)\n\t\treturn nil, false\n\t}\n\n\tif reply.Term > rf.CurrentTerm {\n\t\tDPrintf(\"[%d] current CurrentTerm less than reply.CurrentTerm\", rf.me)\n\t\trf.convertToFollower(reply.Term, true)\n\t\treturn nil, false\n\t}\n\n\tif reply.Success {\n\t\t//fmt.Printf(\"server %d\\n\", server)\n\t\trf.nextIndex[server] += len(entries)\n\t\trf.matchIndex[server] = rf.nextIndex[server] - 1\n\t\tN := -1\n\t\tfor i := rf.commitIndex + 1; i < rf.LogManager.length(); i++ {\n\t\t\tcnt := 1\n\t\t\tfor _, j := range rf.matchIndex {\n\t\t\t\tif j >= i {\n\t\t\t\t\t//fmt.Printf(\"server commitIndex:%d, %d matchIndex:%d\", i, server, j)\n\t\t\t\t\tcnt++\n\t\t\t\t}\n\t\t\t}\n\t\t\t//fmt.Printf(\"cnt:%v commitIndex:%d matchIndex:%v\\n\", cnt, rf.commitIndex, rf.matchIndex)\n\t\t\tif cnt > len(rf.peers)/2 && rf.LogManager.get(i).Term == rf.CurrentTerm {\n\t\t\t\tN = i\n\t\t\t}\n\t\t}\n\t\tif N != -1 {\n\t\t\tfor i := rf.commitIndex + 1; i <= N; i++ {\n\t\t\t\trf.commitIndex = i\n\t\t\t\tneedLock := false\n\t\t\t\tif i == N {\n\t\t\t\t\tneedLock = true\n\t\t\t\t}\n\t\t\t\trf.sendCommandToKV(rf.LogManager.get(i).Command, true, i, needLock)\n\t\t\t}\n\t\t}\n\t\treturn reply, true\n\t} else {\n\t\t//fmt.Printf(\"[%d] %d 匹配失败,nextIndex:%d,command:%v\\n args:%v reply:%v\\n\", rf.me, server,\n\t\t//\trf.nextIndex[server], rf.log[rf.nextIndex[server]-1].Command, args, reply)\n\t\trf.nextIndex[server] = reply.LastTermIndex + 1\n\t}\n\treturn reply, false\n}", "title": "" }, { "docid": "9f8b231a717f9eb40a1ca42b88652bf1", "score": "0.47394657", "text": "func listenForPeers() {\r\n\t// listen to incoming udp packets\r\n\tvar err error\r\n\tpacketConn, err = net.ListenPacket(\"udp\", net.JoinHostPort(publicIp, \"6121\"))\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\r\n\t// Continously listen for handshake packets\r\n\t// Eventually after a successful round of handshaking, all peers will\r\n\t// be seeders and will block on the next ReadFrom() call until the next\r\n\t// round\r\n\tfor connectedToTracker { // terminate when we leave a tracker\r\n\t\t// Read a packet\r\n\t\tbuffer := make([]byte, 2048)\r\n\t\tn, addr, e := packetConn.ReadFrom(buffer) // block here\r\n\t\tif e != nil {\r\n\t\t\tbreak\r\n\t\t}\r\n\r\n\t\ts := string(buffer[:n])\r\n\t\tsubstrs := strings.Split(s, \":\")\r\n\t\tip, _, _ := net.SplitHostPort(addr.String())\r\n\t\traddr := net.UDPAddr{IP: net.ParseIP(ip), Port: 6121}\r\n\r\n\t\t// Process the packet and handle\r\n\t\tswitch substrs[0] {\r\n\t\tcase \"request\": // where this client is a non-seeder\r\n\t\t\tif currentSong == \"\" {\r\n\t\t\t\tcurrentSong = substrs[1]\r\n\t\t\t}\r\n\r\n\t\t\tif isSeeder || hasSongLocally(substrs[1]) {\r\n\t\t\t\tpacketConn.WriteTo([]byte(\"reject\"), &raddr)\r\n\t\t\t} else {\r\n\t\t\t\tpacketConn.WriteTo([]byte(\"accept\"), &raddr)\r\n\t\t\t}\r\n\t\tcase \"confirm\": // where this client is a non-seeder\r\n\t\t\tif isSeeder { // if we already confirmed, don't reject a confirm from our origin\r\n\t\t\t\tgo func() {\r\n\t\t\t\t\tfor i := 0; i < 5; i++ { // redundancy\r\n\t\t\t\t\t\tpacketConn.WriteTo([]byte(\"reject\"), &raddr)\r\n\t\t\t\t\t\ttime.Sleep(500 * time.Microsecond)\r\n\t\t\t\t\t}\r\n\t\t\t\t}()\r\n\t\t\t} else {\r\n\t\t\t\t//originSeeder = ip\r\n\t\t\t\tisSeeder = true\r\n\t\t\t\tgo seedToPeers(currentSong)\r\n\t\t\t}\r\n\t\tcase \"accept\": // where this client is a seeder\r\n\t\t\tif isSeeder && len(seedees) < maxSeedees {\r\n\t\t\t\tip, _, _ := net.SplitHostPort(addr.String())\r\n\t\t\t\tseedees = append(seedees, ip)\r\n\t\t\t\tgo func() {\r\n\t\t\t\t\tfor i := 0; i < 5; i++ { // redundancy\r\n\t\t\t\t\t\tpacketConn.WriteTo([]byte(\"confirm\"), &raddr)\r\n\t\t\t\t\t\ttime.Sleep(500 * time.Microsecond)\r\n\t\t\t\t\t}\r\n\t\t\t\t}()\r\n\t\t\t\tmux.Lock()\r\n\t\t\t\tpeerToConn[ip] = true\r\n\t\t\t\tmux.Unlock()\r\n\t\t\t} else if isSeeder && len(seedees) >= maxSeedees {\r\n\t\t\t\tmux.Lock()\r\n\t\t\t\tpeerToConn[ip] = true\r\n\t\t\t\tmux.Unlock()\r\n\t\t\t} else {\r\n\t\t\t\t// is a non-seeder; shouldn't get here; sanity check\r\n\t\t\t\tlog.Fatal(\"non-seeder tried to accept other non-seeder\")\r\n\t\t\t}\r\n\t\tcase \"reject\": // where this client is a seeder\r\n\t\t\tmux.Lock()\r\n\t\t\tpeerToConn[ip] = true\r\n\t\t\tmux.Unlock()\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "dcb51d69a429ed819cc5fc6f29b5413c", "score": "0.4722388", "text": "func (rf *Raft) Broadcast() {\n\tfor true {\n\t\tfor idxPeer := range rf.peers {\n\t\t\trf.mu.Lock()\n\t\t\tif rf.state != LEADER {\n\t\t\t\trf.mu.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif idxPeer == rf.me {\n\t\t\t\trf.InitElectionConf()\n\t\t\t\trf.mu.Unlock()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trf.mu.Unlock()\n\n\t\t\tgo func(server int) {\n\t\t\t\trf.mu.Lock()\n\n\t\t\t\tif rf.state != LEADER {\n\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// log.Printf(\"broadcast: leader = %v, server = %v, nextIndex = %v, matchIndex = %v, lastIncludedIndex = %v, logs = %v \\n\", rf.me, server, rf.nextIndex, rf.matchIndex, rf.LastIncludedIndex, rf.Logs)\n\n\t\t\t\t// log compaction\n\t\t\t\tif rf.nextIndex[server] <= rf.LastIncludedIndex {\n\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t\trf.SendSnapshot(server)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\trf.mu.Unlock()\n\t\t\t\trf.SendAppendEntries(server)\n\t\t\t}(idxPeer)\n\n\t\t}\n\t\ttime.Sleep(time.Duration(100) * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "6ab175065cd0bcf0ee33cdc1e229d8c3", "score": "0.4709211", "text": "func acceptConnections(ln *net.Listener, s *Server) {\n\tfor {\n\t\tconn, _ := (*ln).Accept()\n\t\tif len(s.clients) == 0 {\n\t\t\tinitTerrain(s.gamestate)\n\t\t}\n\t\tclient := createClient(conn, s.clientID) // Saves connection and adds a channel for clients to broadcast to\n\t\tclientLock.Lock()\n\t\ts.clients[client] = s.clientID // Add to map of clients\n\t\tclientLock.Unlock()\n\t\ts.gamestate.UniqueID = s.clientID\n\t\ttankLock.Lock()\n\t\taddTank(s.gamestate, s.clientID, \"red\") //Marcus - alla börjar som RED nu, bör vara ett val att när man som client startar att få välja vilket team man ska vara\n\t\ttankLock.Unlock()\n\t\ts.clientID++\n\t\tgo listenToClient(client, s)\n\t\tlockAllGamestate()\n\t\tnewmsg, err := json.Marshal(*(s.gamestate))\n\t\tunlockAllGamestate()\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\t\tclientLock.RLock()\n\t\tfor client := range s.clients {\n\t\t\t// send updated gamestate with new player to all clients\n\t\t\tclient.conn.Write([]byte(newmsg))\n\t\t\tlog.Println(\"wrote to client: \", s.clientID)\n\t\t}\n\t\tclientLock.RUnlock()\n\t}\n}", "title": "" }, { "docid": "12054413baf4dd1ad9a24a1740dde462", "score": "0.4698405", "text": "func (kv *RaftKV) ReadyToApply() {\n\tfor msg := range kv.applyCh{\n\t\top := msg.Command.(Op)\n\t\tvar ret OpWithAR\n\t\tif op.Kind == \"Get\" {\n\t\t\targs := op.Args.(GetArgs)\n\t\t\tret.Args = args\n\t\t}else{\n\t\t\targs := op.Args.(PutAppendArgs)\n\t\t\tret.Args = args\n\t\t}\n\t\tret.Kind = op.Kind\n\t\tret.Reply = kv.Apply(op)\n\t\tkv.mu.Lock()\n\t\tif _, ok := kv.message[msg.Index]; !ok {\n\t\t\tkv.message[msg.Index] = make(chan OpWithAR, 1)\n\t\t} else {\n\t\t\tselect {\n\t\t\tcase <-kv.message[msg.Index]:\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\tkv.message[msg.Index] <- ret\n\t\tkv.mu.Unlock()\n\t}\n}", "title": "" }, { "docid": "bd89fec5560d172a45ac6e79cd538347", "score": "0.4689576", "text": "func (rf *Raft) sendAppendEntries(server int, args *AppendEntriesArgs, reply *AppendEntriesReply) bool {\n\tok := rf.peers[server].Call(\"Raft.AppendEntries\", args, reply)\n\tif !ok {\n\t\trf.mu.Lock()\n\t\t_, _ = DPrintf(red(\"[T%v] %v: Network Error! AppendEntries: No connection to Peer %v\"), rf.currentTerm, rf.me, server)\n\t\trf.mu.Unlock()\n\t\treturn false\n\t}\n\n\t// Evaluate RPC Result\n\trf.processAppendEntriesReply(server, *args, reply)\n\treturn true\n}", "title": "" }, { "docid": "597cf97de2383cc725e55efccd9034c3", "score": "0.4685355", "text": "func (g *Gossiper) ListenPeers() {\n\tfor {\n\t\tbuffer := make([]byte, 4096)\n\t\tn, temp, err := g.GossiperUDPConn.ReadFromUDP(buffer)\n\t\tif n == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tclientAddress := temp.String()\n\t\t//println(clientAddress)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"ERROR:\", err)\n\t\t\tfmt.Println(\"Bytes read:\", n)\n\t\t\tpanic(err)\n\t\t}\n\t\t//var gossippacket GossipPacket\n\t\tgossippacket := GossipPacket{}\n\t\terr = protobuf.Decode(buffer[0:n], &gossippacket)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"ERROR11:\", err)\n\t\t\tpanic(err)\n\t\t}\n\t\tif gossippacket.Simple != nil {\n\t\t\tfmt.Println(\"SIMPLE MESSAGE origin\", gossippacket.Simple.OriginalName,\n\t\t\t\t\"from\", gossippacket.Simple.RelayPeerAddr, \"contents\", gossippacket.Simple.Contents)\n\t\t\tg.addNewAddrAndPrintPeers(clientAddress)\n\t\t\t//Store the original name in a string map\n\t\t\tPeerNames[clientAddress] = gossippacket.Simple.OriginalName\n\t\t\tif g.Simple {\n\t\t\t\tgossippacket.Simple.RelayPeerAddr = g.GossipAddr\n\t\t\t\tg.sendGossip(gossippacket, clientAddress)\n\t\t\t}\n\n\t\t} else if gossippacket.Rumor != nil {\n\t\t\t//Store the original name in a string map\n\t\t\tPeerNames[clientAddress] = gossippacket.Rumor.Origin\n\t\t\t//Save the rumor ID\n\t\t\t//rumorID[gossippacket.Rumor.Origin]\n\t\t\tfmt.Println(\"RUMOR origin\", gossippacket.Rumor.Origin,\n\t\t\t\t\"from\", clientAddress, \"ID\", gossippacket.Rumor.ID,\n\t\t\t\t\"contents\", gossippacket.Rumor.Text)\n\n\t\t\tg.addNewAddrAndPrintPeers(clientAddress)\n\n\t\t\tif !g.Simple {\n\t\t\t\tvar psSlice []PeerStatus\n\t\t\t\tif g.KnownAddresses != nil {\n\t\t\t\t\tfor _, address := range g.KnownAddresses {\n\t\t\t\t\t\tif PeerNames[address] != \"\" {\n\t\t\t\t\t\t\tpsSlice = append(psSlice, PeerStatus{\n\t\t\t\t\t\t\t\tIdentifier: PeerNames[address],\n\t\t\t\t\t\t\t\tNextID: RumorID[PeerNames[address]] + 1,\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\tsp := StatusPacket{Want: psSlice}\n\t\t\t\tgp := GossipPacket{Status: &sp}\n\t\t\t\tg.sendGossip(gp, clientAddress)\n\t\t\t}\n\n\t\t} else if gossippacket.Status != nil { //Need to implement status packet logic.\n\t\t\tfmt.Print(\"STATUS from \", clientAddress)\n\t\t\tfor _, element := range gossippacket.Status.Want {\n\t\t\t\tfmt.Print(\" peer \", element.Identifier, \" nextID \", element.NextID)\n\t\t\t}\n\t\t\tfmt.Println()\n\t\t\tfmt.Println(\"PEERS\", g.Peers)\n\t\t} else {\n\t\t\tfmt.Println(\"you must be trolling dude\")\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "7978899b13f5d1e7014d6651bf6393e8", "score": "0.4677861", "text": "func createChatServer(capacity int) *ChatServer {\n\tserver := &ChatServer{\n\t\tAddUsr: make(chan User, capacity),\n\t\tAddNick: make(chan User, capacity),\n\t\tRemoveNick: make(chan User, capacity),\n\t\tNickMap: make(map[string]User),\n\t\tUsers: make(map[string]User),\n\t\tRooms: make(map[string]ChatRoom),\n\t\tCreate: make(chan ChatRoom, capacity),\n\t\tDelete: make(chan ChatRoom, capacity),\n\t\tUsrJoin: make(chan Request, capacity),\n\t\tUsrLeave: make(chan Request, capacity),\n\t}\n\treturn server\n}", "title": "" }, { "docid": "a86a65a7e976f181a13b96c89807ad7a", "score": "0.46670547", "text": "func listenPeerRpc(ln net.Listener, miner *Miner, opCh chan PropagateOpArgs,\n\tblkCh chan PropagateBlockArgs, opSCh chan blockchain.OperationInfo,\n\tblkSCh chan blockchain.Block, reqCh chan net.Addr) {\n\tpRpc := PeerRpc{miner, opCh, blkCh, opSCh, blkSCh, reqCh, make(map[string]Empty)}\n\n\tfmt.Println(\"listenPeerRpc::listening on: \", ln.Addr().String())\n\n\tserver := rpc.NewServer()\n\tserver.RegisterName(\"Peer\", &pRpc)\n\n\tlog.SetFlags(log.LstdFlags | log.Lshortfile)\n\n\tserver.Accept(ln)\n}", "title": "" }, { "docid": "200d62c85a6e1751239878841f8d1c27", "score": "0.4659887", "text": "func (kv *KVServer) notifyRPCHandle(m raft.ApplyMsg) {\n \tapplychan, exist := kv.indexchan[m.CommandIndex]\n\tif exist {\n\t\t// 注意只有leader才有indexchan\n\t\tDPrintf(\"KVServer %v get applychan for index: %v\", kv.me, m.CommandIndex)\n\t\tapplychan <-m\n\t} else {\n\t\tDPrintf(\"KVServer %v has no applychan for index: %v\", kv.me, m.CommandIndex)\n\t}\n}", "title": "" }, { "docid": "4b4e8ec067022b28dcb1d5529fdcf204", "score": "0.46492383", "text": "func (rf *Raft) changeToFollower(){\n\tDPrintf(\"raft %s change to follower \", rf.who())\n\t// leader to follower, need notify service commit index, log index, make not commit service to retry\n\tif rf.currentState == leader{\n\t\tDPrintf(\"raft %s change to follower from leader, need notify\", rf.who())\n\t\trf.applyCh <- ApplyMsg{\n\t\t\tfalse,\n\t\t\tServiceMessage{\"leaderChange\",\n\t\t\t\tLeaderChange{int(rf.commitIndex), int(rf.getLastLogIndex())}},\n\t\t\tint(rf.commitIndex),\n\t\t\tfalse,\n\t\t\tmake([]byte, 0),\n\t\t\t-1,\n\t\t\t-1,\n\t\t}\n\t}\n\n\trf.currentState = follower\n\t//rf.VotedFor = -1\n\trf.hasReceiveRpc = false\n\trf.persist()\n\t//reset timer\n\trf.cancelFunc()\n\trf.electionContext, rf.cancelFunc = context.WithCancel(context.Background())\n\tgo func(ctx context.Context) {rf.followerElectionTimeout(ctx)}(rf.electionContext)\n}", "title": "" }, { "docid": "343930c4ff076a3b95c3f344dc076eb6", "score": "0.46447533", "text": "func (h *bgpPeers) Apply(a *api.BGPPeer) (*api.BGPPeer, error) {\n\treturn a, h.c.apply(*a, h)\n}", "title": "" }, { "docid": "5faf8c004cd55da81d22a3fa5c8d840e", "score": "0.464162", "text": "func (s *Server) Replicate(peers []string, delay time.Duration, strategy string, epsilon float64) error {\n\t// Store the peers and delay on the server\n\ts.peers = peers\n\ts.delay = delay\n\n\t// Create the peer selection strategy\n\tstrategy = strings.ToLower(strategy)\n\tswitch strategy {\n\tcase \"uniform\":\n\t\ts.bandit = new(Uniform)\n\tcase \"epsilon\":\n\t\ts.bandit = &EpsilonGreedy{Epsilon: epsilon}\n\tcase \"annealing\":\n\t\ts.bandit = new(AnnealingEpsilonGreedy)\n\tdefault:\n\t\treturn fmt.Errorf(\"no peer selection bandit strategy named %s\", strategy)\n\t}\n\n\t// Initialize the bandit with the number of cases\n\ts.bandit.Init(len(s.peers))\n\n\t// Create the sync stats objects for each peer\n\ts.syncs = make(map[string]*SyncStats)\n\tfor _, peer := range peers {\n\t\ts.syncs[peer] = new(SyncStats)\n\t}\n\n\t// Schedule the anti-entropy delay\n\ttime.AfterFunc(s.delay, s.AntiEntropy)\n\n\t// Give notice and return no error\n\tinfo(\"replicating to %d peers with anti-entropy interval %s\", len(peers), delay)\n\treturn nil\n}", "title": "" }, { "docid": "0b1aac2da24a7439ae7820da3e8072c2", "score": "0.4635759", "text": "func (rc *raftNode) publishEntries(ctx context.Context, ents []sdraftpb.Entry) bool {\n\t// This is the only function where rc.cluster is being modified while the\n\t// raft node is active. This is called synchronously by the caller. So there\n\t// is no need to provide thread-safety to cluster.\n\tfor i := range ents {\n\t\tswitch ents[i].Type {\n\t\tcase sdraftpb.EntryNormal:\n\t\t\tif len(ents[i].Data) == 0 {\n\t\t\t\t// ignore empty messages\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ts := string(ents[i].Data)\n\t\t\tselect {\n\t\t\tcase rc.commitC <- s:\n\t\t\tcase <-rc.stopc:\n\t\t\t\treturn false\n\t\t\t}\n\n\t\tcase sdraftpb.EntryConfChange:\n\t\t\tvar cc sdraftpb.ConfChange\n\t\t\tif err := protoutil.Unmarshal(ents[i].Data, &cc); err != nil {\n\t\t\t\tlog.Fatal(ctx, err)\n\t\t\t}\n\t\t\trc.confState = *rc.node.ApplyConfChange(cc)\n\t\t\tswitch cc.Type {\n\t\t\tcase sdraftpb.ConfChangeAddNode:\n\t\t\t\tlog.Infof(ctx, \"Processing add node conf change: %v\", cc)\n\t\t\t\tif len(cc.Context) > 0 {\n\t\t\t\t\tnodeID := types.ID(cc.NodeID).String()\n\t\t\t\t\tif node, ok := rc.cluster.Node(nodeID); ok && node.IsRemoved {\n\t\t\t\t\t\tlog.Warningf(ctx, \"Removed node %v cannot be added back to the cluster\", nodeID)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\t// avoid adding self as peer\n\t\t\t\t\tif kronosutil.NodeAddrToString(rc.localAddr) != string(cc.Context) {\n\t\t\t\t\t\trc.transport.AddPeer(\n\t\t\t\t\t\t\ttypes.ID(cc.NodeID),\n\t\t\t\t\t\t\t[]string{withProtocol(string(cc.Context), !rc.transport.TLSInfo.Empty())},\n\t\t\t\t\t\t)\n\t\t\t\t\t\tlog.Infof(ctx, \"Added peer id: %s\", nodeID)\n\t\t\t\t\t}\n\n\t\t\t\t\taddr, err := kronosutil.NodeAddr(string(cc.Context))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(ctx, \"Failed to convert %s to NodeAddr, err: %v\", string(cc.Context), err)\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\n\t\t\t\t\tif _, ok := rc.cluster.Node(nodeID); ok {\n\t\t\t\t\t\tlog.Infof(ctx, \"Node to add %v already exists in cluster metadata\", nodeID)\n\t\t\t\t\t\tbreak // this exits the switch case\n\t\t\t\t\t}\n\n\t\t\t\t\t// This is the single goroutine where write operations are performed\n\t\t\t\t\t// on cluster once the node starts.\n\t\t\t\t\t// Hence we do not require a lock between Node(), AddNode() and\n\t\t\t\t\t// Persist()\n\t\t\t\t\tif err := rc.cluster.AddNode(nodeID, addr); err != nil {\n\t\t\t\t\t\tlog.Errorf(\n\t\t\t\t\t\t\tctx, \"Failed to add node id: %s, addr: %s to cluster metadata, err: %v\",\n\t\t\t\t\t\t\tnodeID, addr, err,\n\t\t\t\t\t\t)\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\tif err := rc.cluster.Persist(); err != nil {\n\t\t\t\t\t\tlog.Errorf(\n\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\"Failed to persist cluster metadata after adding the node, error: %v\",\n\t\t\t\t\t\t\terr,\n\t\t\t\t\t\t)\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\tlog.Infof(ctx, \"Successfully added node %v\", nodeID)\n\t\t\t\t}\n\t\t\tcase sdraftpb.ConfChangeRemoveNode:\n\t\t\t\tlog.Infof(ctx, \"Processing remove node conf change %v\", cc)\n\t\t\t\tnodeID := types.ID(cc.NodeID).String()\n\t\t\t\trc.removeNode(nodeID)\n\t\t\t\tif err := rc.cluster.Persist(); err != nil {\n\t\t\t\t\tlog.Errorf(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\"Failed to persist cluster metadata after remove node, error: %v\",\n\t\t\t\t\t\terr,\n\t\t\t\t\t)\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\tif nodeID == rc.nodeID {\n\t\t\t\t\tlog.Info(ctx, \"Shutting down as node is removed from the cluster\")\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\tlog.Infof(ctx, \"Successfully removed node %s\", nodeID)\n\t\t\t}\n\t\t\t// received a confChange, mark the confChangeSinceLastSnap true to\n\t\t\t// actively trigger a snapshot to remove the confChange entries asap as\n\t\t\t// they contain stale addresses which can create edge cases when Re-IP and\n\t\t\t// node addition happens in short intervals.\n\t\t\trc.snapTriggerConfig.confChangeSinceLastSnap = true\n\t\t}\n\n\t\t// after commit, update appliedIndex\n\t\trc.appliedIndex = ents[i].Index\n\n\t}\n\treturn true\n}", "title": "" }, { "docid": "982b2dbf5223a8014ebdba51cd14f02d", "score": "0.46343467", "text": "func (pm *PeerManager) returnServerPeerInfo() {\n\tpi := pm.getPeerInfo()\n\tPToSPI <- pi\n}", "title": "" }, { "docid": "9c4b842ed22234f0a44d35c2fd11e013", "score": "0.4631871", "text": "func (pm *PeerManager) syncPeers(peers []string) error {\n\tif len(peers) == 0 {\n\t\treturn fmt.Errorf(\"syncPeers event can't discovery self\")\n\t}\n\n\tpm.addRemovePeers(peers)\n\treturn nil\n}", "title": "" }, { "docid": "55171ab371f72c8408c1d1dd828e0dda", "score": "0.46162498", "text": "func (r *Raft) leaderSendHeartbeats() {\n\tr.mutex.Lock()\n\tsavedCurrentTerm := r.term\n\tr.mutex.Unlock()\n\n\t// Log replication code\n\tfor peer := range r.Server.peerClients {\n\t\tgo func(peer string) {\n\t\t\tr.mutex.Lock()\n\t\t\tni := r.nextIndex[peer]\n\t\t\tprevLogIndex := ni - 1\n\t\t\tprevLogTerm := -1\n\t\t\tif prevLogIndex >= 0 {\n\t\t\t\tprevLogTerm = r.logs[prevLogIndex].Term\n\t\t\t}\n\t\t\tlogs := r.logs[ni:]\n\t\t\targs := AppendEntryArg{\n\t\t\t\tTerm: savedCurrentTerm,\n\t\t\t\tLeaderID: r.id,\n\t\t\t\t// log replication\n\t\t\t\tPrevLogIndex: prevLogIndex,\n\t\t\t\tPrevLogTerm: prevLogTerm,\n\t\t\t\tLogs: logs,\n\t\t\t\tLeaderCommit: r.commitIndex,\n\t\t\t}\n\t\t\tr.mutex.Unlock()\n\t\t\t// log.Printf(\"Leader sending AppendEntries to %v: ni=%d, args=%+v\", peer, 0, args)\n\t\t\tvar reply AppendEntryRes\n\t\t\tif err := r.Server.Call(peer, r.appendEntriesService, args, &reply); err == nil {\n\t\t\t\tr.mutex.Lock()\n\t\t\t\tdefer r.mutex.Unlock()\n\t\t\t\tif reply.Term > savedCurrentTerm {\n\t\t\t\t\tlog.Printf(\"term out of date in heartbeat reply\")\n\t\t\t\t\tr.changeStateToFollower(reply.Term)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif r.state == leader && savedCurrentTerm == reply.Term {\n\t\t\t\t\tif reply.Success {\n\t\t\t\t\t\tr.nextIndex[peer] = ni + len(logs)\n\t\t\t\t\t\tr.matchIndex[peer] = r.nextIndex[peer] - 1\n\t\t\t\t\t\t// log.Printf(\"AppendEntries reply from %s success: nextIndex := %v, matchIndex := %v\", peer, r.nextIndex, r.matchIndex)\n\n\t\t\t\t\t\tsavedCommitIndex := r.commitIndex\n\t\t\t\t\t\tfor i := r.commitIndex + 1; i < len(r.logs); i++ {\n\t\t\t\t\t\t\tif r.logs[i].Term == r.term {\n\t\t\t\t\t\t\t\tmatchCount := 1\n\t\t\t\t\t\t\t\tfor peer := range r.Server.peerClients {\n\t\t\t\t\t\t\t\t\tif r.matchIndex[peer] >= i {\n\t\t\t\t\t\t\t\t\t\tmatchCount++\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif matchCount*2 > len(r.Server.peerClients)+1 {\n\t\t\t\t\t\t\t\t\tr.commitIndex = i\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\tif r.commitIndex != savedCommitIndex {\n\t\t\t\t\t\t\tlog.Printf(\"leader sets commitIndex := %d\", r.commitIndex)\n\t\t\t\t\t\t\tr.newCommitReadyChan <- struct{}{}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tr.nextIndex[peer] = ni - 1\n\t\t\t\t\t\t// log.Printf(\"AppendEntries reply from %s !success: nextIndex := %d\", peer, ni-1)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}(peer)\n\t}\n}", "title": "" }, { "docid": "7649fd1ef08a6be867050f6a3651cf2b", "score": "0.4614813", "text": "func (rf *Raft) sendAppendEntries(server int, args AppendEntriesArgs, reply *AppendEntriesReply) bool {\n\tok := rf.peers[server].Call(\"Raft.AppendEntries\", args, reply)\n\treturn ok\n}", "title": "" }, { "docid": "955fc653e8cbfbf0e782ca775593284e", "score": "0.46119824", "text": "func Make(peers []string, me int, rpcs *rpc.Server) *Paxos {\n px := &Paxos{}\n px.peers = peers\n px.me = me\n ////\n px.max_seen_seq = -1\n px.seq_map = make(map[int]Proposal)\n px.done_map = px.fill(make(map[int]int),len(peers)) //populate map w/ -1's\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 l, e := net.Listen(\"unix\", peers[me])\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.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 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 return px\n}", "title": "" }, { "docid": "d921b22189cb1008cd963971090d7797", "score": "0.4610134", "text": "func (s *Server) handleChannels(chans <-chan ssh.NewChannel, sshConn ssh.Conn) {\n\t// Service the incoming Channel channel.\n\tfor newChannel := range chans {\n\n\t\tlog.Printf(\"Received channel: %v\", newChannel.ChannelType())\n\t\t// Check the type of channel\n\t\tif t := newChannel.ChannelType(); t != s.ChannelName {\n\t\t\tnewChannel.Reject(ssh.UnknownChannelType, fmt.Sprintf(\"unknown channel type: %s\", t))\n\t\t\tcontinue\n\t\t}\n\t\tchannel, requests, err := newChannel.Accept()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"could not accept channel (%s)\", err)\n\t\t\tcontinue\n\t\t}\n\t\tlog.Printf(\"Accepted channel\")\n\n\t\t// Channels can have out-of-band requests\n\t\tgo func(in <-chan *ssh.Request) {\n\t\t\tfor req := range in {\n\t\t\t\tok := false\n\t\t\t\tswitch req.Type {\n\n\t\t\t\tcase \"subsystem\":\n\t\t\t\t\tok = true\n\t\t\t\t\tlog.Printf(\"subsystem '%s'\", req.Payload[4:])\n\t\t\t\t\tswitch string(req.Payload[4:]) {\n\t\t\t\t\t//RPCSubsystem Request made indicates client desires RPC Server access\n\t\t\t\t\tcase RPCSubsystem:\n\t\t\t\t\t\tgo s.ServeConn(channel)\n\t\t\t\t\t\tlog.Printf(\"Started SSH RPC\")\n\t\t\t\t\t\t// triggers reverse RPC connection as well\n\t\t\t\t\t\tclientChannel, err := openRPCClientChannel(sshConn, s.ChannelName+\"-reverse\")\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Printf(\"Failed to create client channel: \" + err.Error())\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\trpcClient := rpc.NewClient(clientChannel)\n\t\t\t\t\t\tif s.CallbackFunc != nil {\n\t\t\t\t\t\t\ts.CallbackFunc(rpcClient, sshConn)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlog.Printf(\"Started SSH RPC client\")\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tlog.Printf(\"Unknown subsystem: %s\", req.Payload)\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Printf(\"declining %s request...\", req.Type)\n\t\t\t\t}\n\t\t\t\treq.Reply(ok, nil)\n\t\t\t}\n\t\t}(requests)\n\t}\n}", "title": "" }, { "docid": "9ee5c8664b6748a6d5ba9fe88041835c", "score": "0.46090114", "text": "func Make(peers []string, me int, rpcs *rpc.Server) *Paxos {\n\tpx := &Paxos{}\n\tpx.peers = peers\n\tpx.me = me\n\tpx.numMajority = (len(peers) / 2) + 1\n\tpx.acceptorHistory = make(map[int]*AcceptorState)\n\tpx.peerMins = make([]int, len(peers))\n\tfor i := range px.peerMins {\n\t\tpx.peerMins[i] = -1\n\t}\n\tpx.maxSeq = -1\n\n\t// Your initialization code here.\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.dead == false {\n\t\t\t\tconn, err := px.l.Accept()\n\t\t\t\tif err == nil && px.dead == false {\n\t\t\t\t\tif px.unreliable && (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.unreliable && (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\tpx.rpcCount++\n\t\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpx.rpcCount++\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.dead == 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": "" } ]
4cb55679a181654de7bacb583fdf1426
ProtoToCertificateCertificateDescriptionSubjectDescription converts a CertificateCertificateDescriptionSubjectDescription object from its proto representation.
[ { "docid": "604675d5e671b5859651dfa722d1a955", "score": "0.7912686", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionSubjectDescription(p *privatecapb.PrivatecaCertificateCertificateDescriptionSubjectDescription) *privateca.CertificateCertificateDescriptionSubjectDescription {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionSubjectDescription{\n\t\tSubject: ProtoToPrivatecaCertificateCertificateDescriptionSubjectDescriptionSubject(p.GetSubject()),\n\t\tSubjectAltName: ProtoToPrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltName(p.GetSubjectAltName()),\n\t\tHexSerialNumber: dcl.StringOrNil(p.GetHexSerialNumber()),\n\t\tLifetime: dcl.StringOrNil(p.GetLifetime()),\n\t\tNotBeforeTime: dcl.StringOrNil(p.GetNotBeforeTime()),\n\t\tNotAfterTime: dcl.StringOrNil(p.GetNotAfterTime()),\n\t}\n\treturn obj\n}", "title": "" } ]
[ { "docid": "c0ccf7839aacb9857d486bb3508b59d0", "score": "0.783346", "text": "func PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectToProto(o *privateca.CertificateCertificateDescriptionSubjectDescriptionSubject) *privatecapb.PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubject {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubject{}\n\tp.SetCommonName(dcl.ValueOrEmptyString(o.CommonName))\n\tp.SetCountryCode(dcl.ValueOrEmptyString(o.CountryCode))\n\tp.SetOrganization(dcl.ValueOrEmptyString(o.Organization))\n\tp.SetOrganizationalUnit(dcl.ValueOrEmptyString(o.OrganizationalUnit))\n\tp.SetLocality(dcl.ValueOrEmptyString(o.Locality))\n\tp.SetProvince(dcl.ValueOrEmptyString(o.Province))\n\tp.SetStreetAddress(dcl.ValueOrEmptyString(o.StreetAddress))\n\tp.SetPostalCode(dcl.ValueOrEmptyString(o.PostalCode))\n\treturn p\n}", "title": "" }, { "docid": "089f30ab66f18253f916eabda8dd01b2", "score": "0.77146196", "text": "func PrivatecaCertificateCertificateDescriptionSubjectDescriptionToProto(o *privateca.CertificateCertificateDescriptionSubjectDescription) *privatecapb.PrivatecaCertificateCertificateDescriptionSubjectDescription {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionSubjectDescription{}\n\tp.SetSubject(PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectToProto(o.Subject))\n\tp.SetSubjectAltName(PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltNameToProto(o.SubjectAltName))\n\tp.SetHexSerialNumber(dcl.ValueOrEmptyString(o.HexSerialNumber))\n\tp.SetLifetime(dcl.ValueOrEmptyString(o.Lifetime))\n\tp.SetNotBeforeTime(dcl.ValueOrEmptyString(o.NotBeforeTime))\n\tp.SetNotAfterTime(dcl.ValueOrEmptyString(o.NotAfterTime))\n\treturn p\n}", "title": "" }, { "docid": "7fffa8687e83c9e73df3a04c5c533977", "score": "0.76565284", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionSubjectDescriptionSubject(p *privatecapb.PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubject) *privateca.CertificateCertificateDescriptionSubjectDescriptionSubject {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionSubjectDescriptionSubject{\n\t\tCommonName: dcl.StringOrNil(p.GetCommonName()),\n\t\tCountryCode: dcl.StringOrNil(p.GetCountryCode()),\n\t\tOrganization: dcl.StringOrNil(p.GetOrganization()),\n\t\tOrganizationalUnit: dcl.StringOrNil(p.GetOrganizationalUnit()),\n\t\tLocality: dcl.StringOrNil(p.GetLocality()),\n\t\tProvince: dcl.StringOrNil(p.GetProvince()),\n\t\tStreetAddress: dcl.StringOrNil(p.GetStreetAddress()),\n\t\tPostalCode: dcl.StringOrNil(p.GetPostalCode()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "416984062976e553c15ea37633154690", "score": "0.6342522", "text": "func PrivatecaCertificateCertificateDescriptionX509DescriptionToProto(o *privateca.CertificateCertificateDescriptionX509Description) *privatecapb.PrivatecaCertificateCertificateDescriptionX509Description {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionX509Description{}\n\tp.SetKeyUsage(PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageToProto(o.KeyUsage))\n\tp.SetCaOptions(PrivatecaCertificateCertificateDescriptionX509DescriptionCaOptionsToProto(o.CaOptions))\n\tsPolicyIds := make([]*privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionPolicyIds, len(o.PolicyIds))\n\tfor i, r := range o.PolicyIds {\n\t\tsPolicyIds[i] = PrivatecaCertificateCertificateDescriptionX509DescriptionPolicyIdsToProto(&r)\n\t}\n\tp.SetPolicyIds(sPolicyIds)\n\tsAiaOcspServers := make([]string, len(o.AiaOcspServers))\n\tfor i, r := range o.AiaOcspServers {\n\t\tsAiaOcspServers[i] = r\n\t}\n\tp.SetAiaOcspServers(sAiaOcspServers)\n\tsAdditionalExtensions := make([]*privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensions, len(o.AdditionalExtensions))\n\tfor i, r := range o.AdditionalExtensions {\n\t\tsAdditionalExtensions[i] = PrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensionsToProto(&r)\n\t}\n\tp.SetAdditionalExtensions(sAdditionalExtensions)\n\treturn p\n}", "title": "" }, { "docid": "cf6a03fd85d73e3822cfd794f3a002ab", "score": "0.6224094", "text": "func PrivatecaCertificateCertificateDescriptionToProto(o *privateca.CertificateCertificateDescription) *privatecapb.PrivatecaCertificateCertificateDescription {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescription{}\n\tp.SetSubjectDescription(PrivatecaCertificateCertificateDescriptionSubjectDescriptionToProto(o.SubjectDescription))\n\tp.SetX509Description(PrivatecaCertificateCertificateDescriptionX509DescriptionToProto(o.X509Description))\n\tp.SetPublicKey(PrivatecaCertificateCertificateDescriptionPublicKeyToProto(o.PublicKey))\n\tp.SetSubjectKeyId(PrivatecaCertificateCertificateDescriptionSubjectKeyIdToProto(o.SubjectKeyId))\n\tp.SetAuthorityKeyId(PrivatecaCertificateCertificateDescriptionAuthorityKeyIdToProto(o.AuthorityKeyId))\n\tp.SetCertFingerprint(PrivatecaCertificateCertificateDescriptionCertFingerprintToProto(o.CertFingerprint))\n\tsCrlDistributionPoints := make([]string, len(o.CrlDistributionPoints))\n\tfor i, r := range o.CrlDistributionPoints {\n\t\tsCrlDistributionPoints[i] = r\n\t}\n\tp.SetCrlDistributionPoints(sCrlDistributionPoints)\n\tsAiaIssuingCertificateUrls := make([]string, len(o.AiaIssuingCertificateUrls))\n\tfor i, r := range o.AiaIssuingCertificateUrls {\n\t\tsAiaIssuingCertificateUrls[i] = r\n\t}\n\tp.SetAiaIssuingCertificateUrls(sAiaIssuingCertificateUrls)\n\treturn p\n}", "title": "" }, { "docid": "f55f5bd2cd8a60881c369c8b5d2c6c2a", "score": "0.6208243", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltName(p *privatecapb.PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltName) *privateca.CertificateCertificateDescriptionSubjectDescriptionSubjectAltName {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionSubjectDescriptionSubjectAltName{}\n\tfor _, r := range p.GetDnsNames() {\n\t\tobj.DnsNames = append(obj.DnsNames, r)\n\t}\n\tfor _, r := range p.GetUris() {\n\t\tobj.Uris = append(obj.Uris, r)\n\t}\n\tfor _, r := range p.GetEmailAddresses() {\n\t\tobj.EmailAddresses = append(obj.EmailAddresses, r)\n\t}\n\tfor _, r := range p.GetIpAddresses() {\n\t\tobj.IPAddresses = append(obj.IPAddresses, r)\n\t}\n\tfor _, r := range p.GetCustomSans() {\n\t\tobj.CustomSans = append(obj.CustomSans, *ProtoToPrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltNameCustomSans(r))\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "d9953e3163cfd35e033d0c674d092d6f", "score": "0.6161919", "text": "func (o CertificateDescriptionResponseOutput) SubjectDescription() SubjectDescriptionResponseOutput {\n\treturn o.ApplyT(func(v CertificateDescriptionResponse) SubjectDescriptionResponse { return v.SubjectDescription }).(SubjectDescriptionResponseOutput)\n}", "title": "" }, { "docid": "f006930b3e6778f41ad0bf9d246c4955", "score": "0.6153513", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionX509Description(p *privatecapb.PrivatecaCertificateCertificateDescriptionX509Description) *privateca.CertificateCertificateDescriptionX509Description {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionX509Description{\n\t\tKeyUsage: ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsage(p.GetKeyUsage()),\n\t\tCaOptions: ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionCaOptions(p.GetCaOptions()),\n\t}\n\tfor _, r := range p.GetPolicyIds() {\n\t\tobj.PolicyIds = append(obj.PolicyIds, *ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionPolicyIds(r))\n\t}\n\tfor _, r := range p.GetAiaOcspServers() {\n\t\tobj.AiaOcspServers = append(obj.AiaOcspServers, r)\n\t}\n\tfor _, r := range p.GetAdditionalExtensions() {\n\t\tobj.AdditionalExtensions = append(obj.AdditionalExtensions, *ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensions(r))\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "210438cbc1c6121cffb23cd6516caf02", "score": "0.6072811", "text": "func ProtoToPrivatecaCertificateCertificateDescription(p *privatecapb.PrivatecaCertificateCertificateDescription) *privateca.CertificateCertificateDescription {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescription{\n\t\tSubjectDescription: ProtoToPrivatecaCertificateCertificateDescriptionSubjectDescription(p.GetSubjectDescription()),\n\t\tX509Description: ProtoToPrivatecaCertificateCertificateDescriptionX509Description(p.GetX509Description()),\n\t\tPublicKey: ProtoToPrivatecaCertificateCertificateDescriptionPublicKey(p.GetPublicKey()),\n\t\tSubjectKeyId: ProtoToPrivatecaCertificateCertificateDescriptionSubjectKeyId(p.GetSubjectKeyId()),\n\t\tAuthorityKeyId: ProtoToPrivatecaCertificateCertificateDescriptionAuthorityKeyId(p.GetAuthorityKeyId()),\n\t\tCertFingerprint: ProtoToPrivatecaCertificateCertificateDescriptionCertFingerprint(p.GetCertFingerprint()),\n\t}\n\tfor _, r := range p.GetCrlDistributionPoints() {\n\t\tobj.CrlDistributionPoints = append(obj.CrlDistributionPoints, r)\n\t}\n\tfor _, r := range p.GetAiaIssuingCertificateUrls() {\n\t\tobj.AiaIssuingCertificateUrls = append(obj.AiaIssuingCertificateUrls, r)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "29ea826f26c66d30a7a46a02b2d287a7", "score": "0.59001493", "text": "func (o CertificateCertificateDescriptionOutput) SubjectDescriptions() CertificateCertificateDescriptionSubjectDescriptionArrayOutput {\n\treturn o.ApplyT(func(v CertificateCertificateDescription) []CertificateCertificateDescriptionSubjectDescription {\n\t\treturn v.SubjectDescriptions\n\t}).(CertificateCertificateDescriptionSubjectDescriptionArrayOutput)\n}", "title": "" }, { "docid": "5fe7a7e3d75054a99f15a777b61152d2", "score": "0.5826113", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionSubjectKeyId(p *privatecapb.PrivatecaCertificateCertificateDescriptionSubjectKeyId) *privateca.CertificateCertificateDescriptionSubjectKeyId {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionSubjectKeyId{\n\t\tKeyId: dcl.StringOrNil(p.GetKeyId()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "235dea5afa019a1534003869b9f82a02", "score": "0.5797863", "text": "func PrivatecaCertificateCertificateDescriptionSubjectKeyIdToProto(o *privateca.CertificateCertificateDescriptionSubjectKeyId) *privatecapb.PrivatecaCertificateCertificateDescriptionSubjectKeyId {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionSubjectKeyId{}\n\tp.SetKeyId(dcl.ValueOrEmptyString(o.KeyId))\n\treturn p\n}", "title": "" }, { "docid": "44a03cd0d37c453dbba4937acdb3d6cc", "score": "0.5787915", "text": "func PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltNameToProto(o *privateca.CertificateCertificateDescriptionSubjectDescriptionSubjectAltName) *privatecapb.PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltName {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltName{}\n\tsDnsNames := make([]string, len(o.DnsNames))\n\tfor i, r := range o.DnsNames {\n\t\tsDnsNames[i] = r\n\t}\n\tp.SetDnsNames(sDnsNames)\n\tsUris := make([]string, len(o.Uris))\n\tfor i, r := range o.Uris {\n\t\tsUris[i] = r\n\t}\n\tp.SetUris(sUris)\n\tsEmailAddresses := make([]string, len(o.EmailAddresses))\n\tfor i, r := range o.EmailAddresses {\n\t\tsEmailAddresses[i] = r\n\t}\n\tp.SetEmailAddresses(sEmailAddresses)\n\tsIPAddresses := make([]string, len(o.IPAddresses))\n\tfor i, r := range o.IPAddresses {\n\t\tsIPAddresses[i] = r\n\t}\n\tp.SetIpAddresses(sIPAddresses)\n\tsCustomSans := make([]*privatecapb.PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltNameCustomSans, len(o.CustomSans))\n\tfor i, r := range o.CustomSans {\n\t\tsCustomSans[i] = PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltNameCustomSansToProto(&r)\n\t}\n\tp.SetCustomSans(sCustomSans)\n\treturn p\n}", "title": "" }, { "docid": "ab5329c28ffc0c2fff08fb7212c5f61e", "score": "0.54716563", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensions(p *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensions) *privateca.CertificateCertificateDescriptionX509DescriptionAdditionalExtensions {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionX509DescriptionAdditionalExtensions{\n\t\tObjectId: ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensionsObjectId(p.GetObjectId()),\n\t\tCritical: dcl.Bool(p.GetCritical()),\n\t\tValue: dcl.StringOrNil(p.GetValue()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "c377d92239928edd76b4f253fdc32d2f", "score": "0.536755", "text": "func PrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensionsToProto(o *privateca.CertificateCertificateDescriptionX509DescriptionAdditionalExtensions) *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensions {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensions{}\n\tp.SetObjectId(PrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensionsObjectIdToProto(o.ObjectId))\n\tp.SetCritical(dcl.ValueOrEmptyBool(o.Critical))\n\tp.SetValue(dcl.ValueOrEmptyString(o.Value))\n\treturn p\n}", "title": "" }, { "docid": "0df2216a94c20e078fa8a27147ae8742", "score": "0.5355516", "text": "func PrivatecaCertificateCertificateDescriptionCertFingerprintToProto(o *privateca.CertificateCertificateDescriptionCertFingerprint) *privatecapb.PrivatecaCertificateCertificateDescriptionCertFingerprint {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionCertFingerprint{}\n\tp.SetSha256Hash(dcl.ValueOrEmptyString(o.Sha256Hash))\n\treturn p\n}", "title": "" }, { "docid": "8758a118dc46987af80e7869f0b536ac", "score": "0.5321051", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionCertFingerprint(p *privatecapb.PrivatecaCertificateCertificateDescriptionCertFingerprint) *privateca.CertificateCertificateDescriptionCertFingerprint {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionCertFingerprint{\n\t\tSha256Hash: dcl.StringOrNil(p.GetSha256Hash()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "1e19ebea9a13426e725f8d4bc518fac4", "score": "0.52988476", "text": "func PrivatecaCertificateCertificateDescriptionX509DescriptionCaOptionsToProto(o *privateca.CertificateCertificateDescriptionX509DescriptionCaOptions) *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionCaOptions {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionCaOptions{}\n\tp.SetIsCa(dcl.ValueOrEmptyBool(o.IsCa))\n\tp.SetMaxIssuerPathLength(dcl.ValueOrEmptyInt64(o.MaxIssuerPathLength))\n\treturn p\n}", "title": "" }, { "docid": "5e1e4a52b06a481d7f3305e71d04c7a9", "score": "0.5273414", "text": "func ProtoToPrivatecaCertificateConfigSubjectConfigSubject(p *privatecapb.PrivatecaCertificateConfigSubjectConfigSubject) *privateca.CertificateConfigSubjectConfigSubject {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateConfigSubjectConfigSubject{\n\t\tCommonName: dcl.StringOrNil(p.GetCommonName()),\n\t\tCountryCode: dcl.StringOrNil(p.GetCountryCode()),\n\t\tOrganization: dcl.StringOrNil(p.GetOrganization()),\n\t\tOrganizationalUnit: dcl.StringOrNil(p.GetOrganizationalUnit()),\n\t\tLocality: dcl.StringOrNil(p.GetLocality()),\n\t\tProvince: dcl.StringOrNil(p.GetProvince()),\n\t\tStreetAddress: dcl.StringOrNil(p.GetStreetAddress()),\n\t\tPostalCode: dcl.StringOrNil(p.GetPostalCode()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "1fe303dbe0287fa287290fa353127dde", "score": "0.5263699", "text": "func PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageToProto(o *privateca.CertificateCertificateDescriptionX509DescriptionKeyUsage) *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsage {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsage{}\n\tp.SetBaseKeyUsage(PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageBaseKeyUsageToProto(o.BaseKeyUsage))\n\tp.SetExtendedKeyUsage(PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageExtendedKeyUsageToProto(o.ExtendedKeyUsage))\n\tsUnknownExtendedKeyUsages := make([]*privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageUnknownExtendedKeyUsages, len(o.UnknownExtendedKeyUsages))\n\tfor i, r := range o.UnknownExtendedKeyUsages {\n\t\tsUnknownExtendedKeyUsages[i] = PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageUnknownExtendedKeyUsagesToProto(&r)\n\t}\n\tp.SetUnknownExtendedKeyUsages(sUnknownExtendedKeyUsages)\n\treturn p\n}", "title": "" }, { "docid": "0447aa070db3849da35595fe8b48ee81", "score": "0.5198495", "text": "func PrivatecaCertificateCertificateDescriptionPublicKeyToProto(o *privateca.CertificateCertificateDescriptionPublicKey) *privatecapb.PrivatecaCertificateCertificateDescriptionPublicKey {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionPublicKey{}\n\tp.SetKey(dcl.ValueOrEmptyString(o.Key))\n\tp.SetFormat(PrivatecaCertificateCertificateDescriptionPublicKeyFormatEnumToProto(o.Format))\n\treturn p\n}", "title": "" }, { "docid": "c3b43d8b1e01e7200f66c439a3d2f436", "score": "0.515833", "text": "func ProtoToPrivatecaCertificateConfigSubjectConfig(p *privatecapb.PrivatecaCertificateConfigSubjectConfig) *privateca.CertificateConfigSubjectConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateConfigSubjectConfig{\n\t\tSubject: ProtoToPrivatecaCertificateConfigSubjectConfigSubject(p.GetSubject()),\n\t\tSubjectAltName: ProtoToPrivatecaCertificateConfigSubjectConfigSubjectAltName(p.GetSubjectAltName()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "052400268d325c3dd2302a74bb576e03", "score": "0.51539487", "text": "func (in *Subject) DeepCopy() *Subject {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Subject)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "052400268d325c3dd2302a74bb576e03", "score": "0.51539487", "text": "func (in *Subject) DeepCopy() *Subject {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Subject)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "66421a009a46875df3339334b9d44cf1", "score": "0.50628936", "text": "func (o CertificateCertificateDescriptionSubjectDescriptionOutput) Subjects() CertificateCertificateDescriptionSubjectDescriptionSubjectArrayOutput {\n\treturn o.ApplyT(func(v CertificateCertificateDescriptionSubjectDescription) []CertificateCertificateDescriptionSubjectDescriptionSubject {\n\t\treturn v.Subjects\n\t}).(CertificateCertificateDescriptionSubjectDescriptionSubjectArrayOutput)\n}", "title": "" }, { "docid": "5423cf781df25e651b7e2ec47f262dfe", "score": "0.5027758", "text": "func PrivatecaCertificateConfigSubjectConfigSubjectToProto(o *privateca.CertificateConfigSubjectConfigSubject) *privatecapb.PrivatecaCertificateConfigSubjectConfigSubject {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateConfigSubjectConfigSubject{}\n\tp.SetCommonName(dcl.ValueOrEmptyString(o.CommonName))\n\tp.SetCountryCode(dcl.ValueOrEmptyString(o.CountryCode))\n\tp.SetOrganization(dcl.ValueOrEmptyString(o.Organization))\n\tp.SetOrganizationalUnit(dcl.ValueOrEmptyString(o.OrganizationalUnit))\n\tp.SetLocality(dcl.ValueOrEmptyString(o.Locality))\n\tp.SetProvince(dcl.ValueOrEmptyString(o.Province))\n\tp.SetStreetAddress(dcl.ValueOrEmptyString(o.StreetAddress))\n\tp.SetPostalCode(dcl.ValueOrEmptyString(o.PostalCode))\n\treturn p\n}", "title": "" }, { "docid": "153361cafcee770504fd18e7aa23e795", "score": "0.50222445", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsage(p *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsage) *privateca.CertificateCertificateDescriptionX509DescriptionKeyUsage {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionX509DescriptionKeyUsage{\n\t\tBaseKeyUsage: ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageBaseKeyUsage(p.GetBaseKeyUsage()),\n\t\tExtendedKeyUsage: ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageExtendedKeyUsage(p.GetExtendedKeyUsage()),\n\t}\n\tfor _, r := range p.GetUnknownExtendedKeyUsages() {\n\t\tobj.UnknownExtendedKeyUsages = append(obj.UnknownExtendedKeyUsages, *ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageUnknownExtendedKeyUsages(r))\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "11bc2a7b57f806186b69eced5a818a21", "score": "0.50131553", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionCaOptions(p *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionCaOptions) *privateca.CertificateCertificateDescriptionX509DescriptionCaOptions {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionX509DescriptionCaOptions{\n\t\tIsCa: dcl.Bool(p.GetIsCa()),\n\t\tMaxIssuerPathLength: dcl.Int64OrNil(p.GetMaxIssuerPathLength()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "82afd1ad78449c352fbb959602363d18", "score": "0.49729332", "text": "func ProtoToPrivatecaCertificateConfigSubjectConfigSubjectAltName(p *privatecapb.PrivatecaCertificateConfigSubjectConfigSubjectAltName) *privateca.CertificateConfigSubjectConfigSubjectAltName {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateConfigSubjectConfigSubjectAltName{}\n\tfor _, r := range p.GetDnsNames() {\n\t\tobj.DnsNames = append(obj.DnsNames, r)\n\t}\n\tfor _, r := range p.GetUris() {\n\t\tobj.Uris = append(obj.Uris, r)\n\t}\n\tfor _, r := range p.GetEmailAddresses() {\n\t\tobj.EmailAddresses = append(obj.EmailAddresses, r)\n\t}\n\tfor _, r := range p.GetIpAddresses() {\n\t\tobj.IPAddresses = append(obj.IPAddresses, r)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "3fb02275e51f4a9c4324a9f17bc536ab", "score": "0.49048427", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionPublicKey(p *privatecapb.PrivatecaCertificateCertificateDescriptionPublicKey) *privateca.CertificateCertificateDescriptionPublicKey {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionPublicKey{\n\t\tKey: dcl.StringOrNil(p.GetKey()),\n\t\tFormat: ProtoToPrivatecaCertificateCertificateDescriptionPublicKeyFormatEnum(p.GetFormat()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "49a0855747588f8231ad32d40314beb7", "score": "0.4897377", "text": "func PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltNameCustomSansToProto(o *privateca.CertificateCertificateDescriptionSubjectDescriptionSubjectAltNameCustomSans) *privatecapb.PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltNameCustomSans {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltNameCustomSans{}\n\tp.SetObjectId(PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltNameCustomSansObjectIdToProto(o.ObjectId))\n\tp.SetCritical(dcl.ValueOrEmptyBool(o.Critical))\n\tp.SetValue(dcl.ValueOrEmptyString(o.Value))\n\treturn p\n}", "title": "" }, { "docid": "acb4d057d38512b488986ee9dff908b7", "score": "0.48293233", "text": "func (o CertificateDescriptionResponseOutput) X509Description() X509ParametersResponseOutput {\n\treturn o.ApplyT(func(v CertificateDescriptionResponse) X509ParametersResponse { return v.X509Description }).(X509ParametersResponseOutput)\n}", "title": "" }, { "docid": "4b9cd95b9ae61561402a6129f6f7fc30", "score": "0.4777202", "text": "func SubjectFromX509Certificate(cert *x509.Certificate) Subject {\n\treturn SubjectFromDER(cert.Raw)\n}", "title": "" }, { "docid": "51bbfd8a197a1341fcf6b0f2fcdd0e08", "score": "0.4774555", "text": "func ProtoToCertificate(p *privatecapb.PrivatecaCertificate) *privateca.Certificate {\n\tobj := &privateca.Certificate{\n\t\tName: dcl.StringOrNil(p.GetName()),\n\t\tPemCsr: dcl.StringOrNil(p.GetPemCsr()),\n\t\tConfig: ProtoToPrivatecaCertificateConfig(p.GetConfig()),\n\t\tIssuerCertificateAuthority: dcl.StringOrNil(p.GetIssuerCertificateAuthority()),\n\t\tLifetime: dcl.StringOrNil(p.GetLifetime()),\n\t\tCertificateTemplate: dcl.StringOrNil(p.GetCertificateTemplate()),\n\t\tSubjectMode: ProtoToPrivatecaCertificateSubjectModeEnum(p.GetSubjectMode()),\n\t\tRevocationDetails: ProtoToPrivatecaCertificateRevocationDetails(p.GetRevocationDetails()),\n\t\tPemCertificate: dcl.StringOrNil(p.GetPemCertificate()),\n\t\tCertificateDescription: ProtoToPrivatecaCertificateCertificateDescription(p.GetCertificateDescription()),\n\t\tCreateTime: dcl.StringOrNil(p.GetCreateTime()),\n\t\tUpdateTime: dcl.StringOrNil(p.GetUpdateTime()),\n\t\tProject: dcl.StringOrNil(p.GetProject()),\n\t\tLocation: dcl.StringOrNil(p.GetLocation()),\n\t\tCaPool: dcl.StringOrNil(p.GetCaPool()),\n\t\tCertificateAuthority: dcl.StringOrNil(p.GetCertificateAuthority()),\n\t}\n\tfor _, r := range p.GetPemCertificateChain() {\n\t\tobj.PemCertificateChain = append(obj.PemCertificateChain, r)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "990dc77edc4eedd071ed32662290a2ec", "score": "0.47536153", "text": "func PrivatecaCertificateConfigSubjectConfigToProto(o *privateca.CertificateConfigSubjectConfig) *privatecapb.PrivatecaCertificateConfigSubjectConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateConfigSubjectConfig{}\n\tp.SetSubject(PrivatecaCertificateConfigSubjectConfigSubjectToProto(o.Subject))\n\tp.SetSubjectAltName(PrivatecaCertificateConfigSubjectConfigSubjectAltNameToProto(o.SubjectAltName))\n\treturn p\n}", "title": "" }, { "docid": "0e79694bcd096e0c047f0dba4a6fc80b", "score": "0.4739102", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltNameCustomSans(p *privatecapb.PrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltNameCustomSans) *privateca.CertificateCertificateDescriptionSubjectDescriptionSubjectAltNameCustomSans {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionSubjectDescriptionSubjectAltNameCustomSans{\n\t\tObjectId: ProtoToPrivatecaCertificateCertificateDescriptionSubjectDescriptionSubjectAltNameCustomSansObjectId(p.GetObjectId()),\n\t\tCritical: dcl.Bool(p.GetCritical()),\n\t\tValue: dcl.StringOrNil(p.GetValue()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "5abd15883f205fd73c095b817f0bea0d", "score": "0.4680849", "text": "func PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageExtendedKeyUsageToProto(o *privateca.CertificateCertificateDescriptionX509DescriptionKeyUsageExtendedKeyUsage) *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageExtendedKeyUsage {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageExtendedKeyUsage{}\n\tp.SetServerAuth(dcl.ValueOrEmptyBool(o.ServerAuth))\n\tp.SetClientAuth(dcl.ValueOrEmptyBool(o.ClientAuth))\n\tp.SetCodeSigning(dcl.ValueOrEmptyBool(o.CodeSigning))\n\tp.SetEmailProtection(dcl.ValueOrEmptyBool(o.EmailProtection))\n\tp.SetTimeStamping(dcl.ValueOrEmptyBool(o.TimeStamping))\n\tp.SetOcspSigning(dcl.ValueOrEmptyBool(o.OcspSigning))\n\treturn p\n}", "title": "" }, { "docid": "d261f53600d7bc3ef6d806088a903274", "score": "0.46363747", "text": "func (*CreateSubjectCategoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_cms_cms_proto_rawDescGZIP(), []int{36}\n}", "title": "" }, { "docid": "a7a3fd51056cee86a867440e6c0523d2", "score": "0.4609509", "text": "func (*GetSubjectCategoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_cms_cms_proto_rawDescGZIP(), []int{34}\n}", "title": "" }, { "docid": "e90892eb7012305e7b8cd515c01a6a08", "score": "0.4608392", "text": "func CertificateToProto(resource *privateca.Certificate) *privatecapb.PrivatecaCertificate {\n\tp := &privatecapb.PrivatecaCertificate{}\n\tp.SetName(dcl.ValueOrEmptyString(resource.Name))\n\tp.SetPemCsr(dcl.ValueOrEmptyString(resource.PemCsr))\n\tp.SetConfig(PrivatecaCertificateConfigToProto(resource.Config))\n\tp.SetIssuerCertificateAuthority(dcl.ValueOrEmptyString(resource.IssuerCertificateAuthority))\n\tp.SetLifetime(dcl.ValueOrEmptyString(resource.Lifetime))\n\tp.SetCertificateTemplate(dcl.ValueOrEmptyString(resource.CertificateTemplate))\n\tp.SetSubjectMode(PrivatecaCertificateSubjectModeEnumToProto(resource.SubjectMode))\n\tp.SetRevocationDetails(PrivatecaCertificateRevocationDetailsToProto(resource.RevocationDetails))\n\tp.SetPemCertificate(dcl.ValueOrEmptyString(resource.PemCertificate))\n\tp.SetCertificateDescription(PrivatecaCertificateCertificateDescriptionToProto(resource.CertificateDescription))\n\tp.SetCreateTime(dcl.ValueOrEmptyString(resource.CreateTime))\n\tp.SetUpdateTime(dcl.ValueOrEmptyString(resource.UpdateTime))\n\tp.SetProject(dcl.ValueOrEmptyString(resource.Project))\n\tp.SetLocation(dcl.ValueOrEmptyString(resource.Location))\n\tp.SetCaPool(dcl.ValueOrEmptyString(resource.CaPool))\n\tp.SetCertificateAuthority(dcl.ValueOrEmptyString(resource.CertificateAuthority))\n\tsPemCertificateChain := make([]string, len(resource.PemCertificateChain))\n\tfor i, r := range resource.PemCertificateChain {\n\t\tsPemCertificateChain[i] = r\n\t}\n\tp.SetPemCertificateChain(sPemCertificateChain)\n\tmLabels := make(map[string]string, len(resource.Labels))\n\tfor k, r := range resource.Labels {\n\t\tmLabels[k] = r\n\t}\n\tp.SetLabels(mLabels)\n\n\treturn p\n}", "title": "" }, { "docid": "5202940d5f1df71ed48ef3a3abfadb00", "score": "0.45677394", "text": "func (o *MicrosoftGraphScheduleItem) SetSubject(v string) {\n\to.Subject = &v\n}", "title": "" }, { "docid": "e8711a875a24d7c8d3f1d4db6352a2dd", "score": "0.45336175", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageExtendedKeyUsage(p *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageExtendedKeyUsage) *privateca.CertificateCertificateDescriptionX509DescriptionKeyUsageExtendedKeyUsage {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionX509DescriptionKeyUsageExtendedKeyUsage{\n\t\tServerAuth: dcl.Bool(p.GetServerAuth()),\n\t\tClientAuth: dcl.Bool(p.GetClientAuth()),\n\t\tCodeSigning: dcl.Bool(p.GetCodeSigning()),\n\t\tEmailProtection: dcl.Bool(p.GetEmailProtection()),\n\t\tTimeStamping: dcl.Bool(p.GetTimeStamping()),\n\t\tOcspSigning: dcl.Bool(p.GetOcspSigning()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "dc671e17ae005fab22b82635e3704422", "score": "0.45237622", "text": "func (in *ComponentDescription) DeepCopy() *ComponentDescription {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComponentDescription)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a1179e8db7feccd4f0e02aebe77c8823", "score": "0.45109716", "text": "func PrivatecaCertificateCertificateDescriptionX509DescriptionPolicyIdsToProto(o *privateca.CertificateCertificateDescriptionX509DescriptionPolicyIds) *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionPolicyIds {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionPolicyIds{}\n\tsObjectIdPath := make([]int64, len(o.ObjectIdPath))\n\tfor i, r := range o.ObjectIdPath {\n\t\tsObjectIdPath[i] = r\n\t}\n\tp.SetObjectIdPath(sObjectIdPath)\n\treturn p\n}", "title": "" }, { "docid": "7640de34a07e882a746c6c7637ca4278", "score": "0.4510519", "text": "func PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageBaseKeyUsageToProto(o *privateca.CertificateCertificateDescriptionX509DescriptionKeyUsageBaseKeyUsage) *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageBaseKeyUsage {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageBaseKeyUsage{}\n\tp.SetDigitalSignature(dcl.ValueOrEmptyBool(o.DigitalSignature))\n\tp.SetContentCommitment(dcl.ValueOrEmptyBool(o.ContentCommitment))\n\tp.SetKeyEncipherment(dcl.ValueOrEmptyBool(o.KeyEncipherment))\n\tp.SetDataEncipherment(dcl.ValueOrEmptyBool(o.DataEncipherment))\n\tp.SetKeyAgreement(dcl.ValueOrEmptyBool(o.KeyAgreement))\n\tp.SetCertSign(dcl.ValueOrEmptyBool(o.CertSign))\n\tp.SetCrlSign(dcl.ValueOrEmptyBool(o.CrlSign))\n\tp.SetEncipherOnly(dcl.ValueOrEmptyBool(o.EncipherOnly))\n\tp.SetDecipherOnly(dcl.ValueOrEmptyBool(o.DecipherOnly))\n\treturn p\n}", "title": "" }, { "docid": "a2955fb33662fec4ff975d710bc009a3", "score": "0.45047593", "text": "func (s *Subscription) SetSubject(v string) *Subscription {\n\ts.Subject = &v\n\treturn s\n}", "title": "" }, { "docid": "d6db255909b1cfd3cb148892790f50b7", "score": "0.44986138", "text": "func (*DeleteSubjectCategoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_cms_cms_proto_rawDescGZIP(), []int{40}\n}", "title": "" }, { "docid": "925cb9aafb6b95a07bf0f789efb5bfa1", "score": "0.4493275", "text": "func (s *DescribeEngagementOutput) SetSubject(v string) *DescribeEngagementOutput {\n\ts.Subject = &v\n\treturn s\n}", "title": "" }, { "docid": "376ca70f6b3b79b46466dc21fe9d7ac1", "score": "0.4468887", "text": "func (s *StartEngagementInput) SetSubject(v string) *StartEngagementInput {\n\ts.Subject = &v\n\treturn s\n}", "title": "" }, { "docid": "88e785b0e76bc8709e2578d455923981", "score": "0.4455928", "text": "func (in *CertificateSpec) DeepCopy() *CertificateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertificateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "88e785b0e76bc8709e2578d455923981", "score": "0.4455928", "text": "func (in *CertificateSpec) DeepCopy() *CertificateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertificateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "88e785b0e76bc8709e2578d455923981", "score": "0.4455928", "text": "func (in *CertificateSpec) DeepCopy() *CertificateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertificateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fe4cea2a32a936574cf54aaad0d892d6", "score": "0.44521582", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensionsObjectId(p *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensionsObjectId) *privateca.CertificateCertificateDescriptionX509DescriptionAdditionalExtensionsObjectId {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionX509DescriptionAdditionalExtensionsObjectId{}\n\tfor _, r := range p.GetObjectIdPath() {\n\t\tobj.ObjectIdPath = append(obj.ObjectIdPath, r)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "d22720f4b76fc1bf0f9d45b4293f5c4b", "score": "0.44518578", "text": "func PrivatecaCertificateConfigSubjectConfigSubjectAltNameToProto(o *privateca.CertificateConfigSubjectConfigSubjectAltName) *privatecapb.PrivatecaCertificateConfigSubjectConfigSubjectAltName {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateConfigSubjectConfigSubjectAltName{}\n\tsDnsNames := make([]string, len(o.DnsNames))\n\tfor i, r := range o.DnsNames {\n\t\tsDnsNames[i] = r\n\t}\n\tp.SetDnsNames(sDnsNames)\n\tsUris := make([]string, len(o.Uris))\n\tfor i, r := range o.Uris {\n\t\tsUris[i] = r\n\t}\n\tp.SetUris(sUris)\n\tsEmailAddresses := make([]string, len(o.EmailAddresses))\n\tfor i, r := range o.EmailAddresses {\n\t\tsEmailAddresses[i] = r\n\t}\n\tp.SetEmailAddresses(sEmailAddresses)\n\tsIPAddresses := make([]string, len(o.IPAddresses))\n\tfor i, r := range o.IPAddresses {\n\t\tsIPAddresses[i] = r\n\t}\n\tp.SetIpAddresses(sIPAddresses)\n\treturn p\n}", "title": "" }, { "docid": "4ed1f3200315df324706d9b730a7db92", "score": "0.4439981", "text": "func (o CertificateCertificateDescriptionOutput) SubjectKeyIds() CertificateCertificateDescriptionSubjectKeyIdArrayOutput {\n\treturn o.ApplyT(func(v CertificateCertificateDescription) []CertificateCertificateDescriptionSubjectKeyId {\n\t\treturn v.SubjectKeyIds\n\t}).(CertificateCertificateDescriptionSubjectKeyIdArrayOutput)\n}", "title": "" }, { "docid": "ed399732c9c5858d3d4384a487ffb175", "score": "0.44332385", "text": "func (m *mmsCampaign) SetSubject(val *string) {\n\tm.subjectField = val\n}", "title": "" }, { "docid": "0e0424714065a64d3ee1527bbb7d9d33", "score": "0.44259045", "text": "func (s *DescribePageOutput) SetSubject(v string) *DescribePageOutput {\n\ts.Subject = &v\n\treturn s\n}", "title": "" }, { "docid": "462aa18dc2f8f6e5f6d55bec41a77d6d", "score": "0.4418985", "text": "func (o *CaConfig) SetSubject(v string) {\n\to.Subject = &v\n}", "title": "" }, { "docid": "ee4fc5163cd86734c9372135408f15cc", "score": "0.44131652", "text": "func PrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensionsObjectIdToProto(o *privateca.CertificateCertificateDescriptionX509DescriptionAdditionalExtensionsObjectId) *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensionsObjectId {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionAdditionalExtensionsObjectId{}\n\tsObjectIdPath := make([]int64, len(o.ObjectIdPath))\n\tfor i, r := range o.ObjectIdPath {\n\t\tsObjectIdPath[i] = r\n\t}\n\tp.SetObjectIdPath(sObjectIdPath)\n\treturn p\n}", "title": "" }, { "docid": "520bb1aeb95b86173a1133f0706ca798", "score": "0.4398094", "text": "func (*UpdateSubjectCategoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_cms_cms_proto_rawDescGZIP(), []int{38}\n}", "title": "" }, { "docid": "e64d58eb11dfd0dc107b1e77fb663a01", "score": "0.43969283", "text": "func (*CreateSubjectCategoryReply) Descriptor() ([]byte, []int) {\n\treturn file_api_cms_cms_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "092dcb6cdcaa811a6043aa66572f18eb", "score": "0.43957055", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionPolicyIds(p *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionPolicyIds) *privateca.CertificateCertificateDescriptionX509DescriptionPolicyIds {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionX509DescriptionPolicyIds{}\n\tfor _, r := range p.GetObjectIdPath() {\n\t\tobj.ObjectIdPath = append(obj.ObjectIdPath, r)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "feb8a86af19535f873b2a75a62d65abd", "score": "0.43951634", "text": "func (s *SimpleEmail) SetSubject(v *SimpleEmailPart) *SimpleEmail {\n\ts.Subject = v\n\treturn s\n}", "title": "" }, { "docid": "6fefa08e4540b55f86ed089da5ce4955", "score": "0.43815163", "text": "func ProtoToPrivatecaCertificateConfigX509ConfigAdditionalExtensions(p *privatecapb.PrivatecaCertificateConfigX509ConfigAdditionalExtensions) *privateca.CertificateConfigX509ConfigAdditionalExtensions {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateConfigX509ConfigAdditionalExtensions{\n\t\tObjectId: ProtoToPrivatecaCertificateConfigX509ConfigAdditionalExtensionsObjectId(p.GetObjectId()),\n\t\tCritical: dcl.Bool(p.GetCritical()),\n\t\tValue: dcl.StringOrNil(p.GetValue()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "d5ab60181458805759217a719fa572aa", "score": "0.43758452", "text": "func (*CreateSubjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_cms_cms_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "d2ac9b53ba6dc9439a97fb247ef364b5", "score": "0.43677777", "text": "func (*ListSubjectCategoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_cms_cms_proto_rawDescGZIP(), []int{32}\n}", "title": "" }, { "docid": "f759b9e244e2f93f667ab10022bc0c82", "score": "0.43655732", "text": "func (o CertificateCertificateDescriptionOutput) X509Descriptions() CertificateCertificateDescriptionX509DescriptionArrayOutput {\n\treturn o.ApplyT(func(v CertificateCertificateDescription) []CertificateCertificateDescriptionX509Description {\n\t\treturn v.X509Descriptions\n\t}).(CertificateCertificateDescriptionX509DescriptionArrayOutput)\n}", "title": "" }, { "docid": "86086635677961577d52ab137c3ee864", "score": "0.43587515", "text": "func (*GetSubjectCategoryReply) Descriptor() ([]byte, []int) {\n\treturn file_api_cms_cms_proto_rawDescGZIP(), []int{35}\n}", "title": "" }, { "docid": "248b46b7f7525cfd661e7cd98fa52a5c", "score": "0.43425655", "text": "func (o CertificateAuthorityOutput) Subject() CertificateAuthoritySubjectOutput {\n\treturn o.ApplyT(func(v *CertificateAuthority) CertificateAuthoritySubjectOutput { return v.Subject }).(CertificateAuthoritySubjectOutput)\n}", "title": "" }, { "docid": "6261a123d359c8b4d890ce6d64faed90", "score": "0.43407178", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageBaseKeyUsage(p *privatecapb.PrivatecaCertificateCertificateDescriptionX509DescriptionKeyUsageBaseKeyUsage) *privateca.CertificateCertificateDescriptionX509DescriptionKeyUsageBaseKeyUsage {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionX509DescriptionKeyUsageBaseKeyUsage{\n\t\tDigitalSignature: dcl.Bool(p.GetDigitalSignature()),\n\t\tContentCommitment: dcl.Bool(p.GetContentCommitment()),\n\t\tKeyEncipherment: dcl.Bool(p.GetKeyEncipherment()),\n\t\tDataEncipherment: dcl.Bool(p.GetDataEncipherment()),\n\t\tKeyAgreement: dcl.Bool(p.GetKeyAgreement()),\n\t\tCertSign: dcl.Bool(p.GetCertSign()),\n\t\tCrlSign: dcl.Bool(p.GetCrlSign()),\n\t\tEncipherOnly: dcl.Bool(p.GetEncipherOnly()),\n\t\tDecipherOnly: dcl.Bool(p.GetDecipherOnly()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "6d86c87019c331236da59fe3edb8a144", "score": "0.43398875", "text": "func (in *Certificate) DeepCopy() *Certificate {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Certificate)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6d86c87019c331236da59fe3edb8a144", "score": "0.43398875", "text": "func (in *Certificate) DeepCopy() *Certificate {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Certificate)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6d86c87019c331236da59fe3edb8a144", "score": "0.43398875", "text": "func (in *Certificate) DeepCopy() *Certificate {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Certificate)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9c7749ff6d34640ca95b3ac8f0a67fa9", "score": "0.43296564", "text": "func (o CertificateTemplateIdentityConstraintsCelExpressionOutput) Description() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CertificateTemplateIdentityConstraintsCelExpression) *string { return v.Description }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "476a09c326b02de08284d7cc407d0d6b", "score": "0.43268064", "text": "func (o CertificateConfigSubjectConfigPtrOutput) Subject() CertificateConfigSubjectConfigSubjectPtrOutput {\n\treturn o.ApplyT(func(v *CertificateConfigSubjectConfig) *CertificateConfigSubjectConfigSubject {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Subject\n\t}).(CertificateConfigSubjectConfigSubjectPtrOutput)\n}", "title": "" }, { "docid": "bae5b5d719ed4512b21a9b9e1b0fbb39", "score": "0.4317308", "text": "func (o SubjectDescriptionResponseOutput) Subject() SubjectResponseOutput {\n\treturn o.ApplyT(func(v SubjectDescriptionResponse) SubjectResponse { return v.Subject }).(SubjectResponseOutput)\n}", "title": "" }, { "docid": "df25b48824392c3be0142aff2054f36d", "score": "0.43164957", "text": "func (in *ContainerDescription) DeepCopy() *ContainerDescription {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainerDescription)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cb59841ef1a4c33029b11bfde6b8d30c", "score": "0.43043232", "text": "func (s *EmailTemplateResponse) SetSubject(v string) *EmailTemplateResponse {\n\ts.Subject = &v\n\treturn s\n}", "title": "" }, { "docid": "002fd1af5316b36a5b214c8173b854a4", "score": "0.42894965", "text": "func (o CertificateCertificateDescriptionSubjectDescriptionOutput) SubjectAltNames() CertificateCertificateDescriptionSubjectDescriptionSubjectAltNameArrayOutput {\n\treturn o.ApplyT(func(v CertificateCertificateDescriptionSubjectDescription) []CertificateCertificateDescriptionSubjectDescriptionSubjectAltName {\n\t\treturn v.SubjectAltNames\n\t}).(CertificateCertificateDescriptionSubjectDescriptionSubjectAltNameArrayOutput)\n}", "title": "" }, { "docid": "cfd934c33a74cd24dab5df4e6a9d6953", "score": "0.42838332", "text": "func (o *OAuth2LogoutRequest) SetSubject(v string) {\n\to.Subject = &v\n}", "title": "" }, { "docid": "298f65b11548c4a6e562196640eafad7", "score": "0.42812943", "text": "func (o CertificateTemplateIdentityConstraintsCelExpressionPtrOutput) Description() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *CertificateTemplateIdentityConstraintsCelExpression) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Description\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "63d8fc477a86cd579f83b9e5f7d5ed97", "score": "0.42689174", "text": "func ProtoToPrivatecaCertificateConfig(p *privatecapb.PrivatecaCertificateConfig) *privateca.CertificateConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateConfig{\n\t\tSubjectConfig: ProtoToPrivatecaCertificateConfigSubjectConfig(p.GetSubjectConfig()),\n\t\tX509Config: ProtoToPrivatecaCertificateConfigX509Config(p.GetX509Config()),\n\t\tPublicKey: ProtoToPrivatecaCertificateConfigPublicKey(p.GetPublicKey()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "787a5c21c0abd1049fc34dbb939678d4", "score": "0.42649442", "text": "func PrivatecaCertificateConfigToProto(o *privateca.CertificateConfig) *privatecapb.PrivatecaCertificateConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateConfig{}\n\tp.SetSubjectConfig(PrivatecaCertificateConfigSubjectConfigToProto(o.SubjectConfig))\n\tp.SetX509Config(PrivatecaCertificateConfigX509ConfigToProto(o.X509Config))\n\tp.SetPublicKey(PrivatecaCertificateConfigPublicKeyToProto(o.PublicKey))\n\treturn p\n}", "title": "" }, { "docid": "d4b9571d26778ef3fdf2569deb5796e4", "score": "0.42615885", "text": "func (s *EmailTemplateRequest) SetSubject(v string) *EmailTemplateRequest {\n\ts.Subject = &v\n\treturn s\n}", "title": "" }, { "docid": "bddbf8ae2454e06cd254d12d44ebd092", "score": "0.4259367", "text": "func PrivatecaCertificateConfigX509ConfigAdditionalExtensionsToProto(o *privateca.CertificateConfigX509ConfigAdditionalExtensions) *privatecapb.PrivatecaCertificateConfigX509ConfigAdditionalExtensions {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateConfigX509ConfigAdditionalExtensions{}\n\tp.SetObjectId(PrivatecaCertificateConfigX509ConfigAdditionalExtensionsObjectIdToProto(o.ObjectId))\n\tp.SetCritical(dcl.ValueOrEmptyBool(o.Critical))\n\tp.SetValue(dcl.ValueOrEmptyString(o.Value))\n\treturn p\n}", "title": "" }, { "docid": "336867182209812b3885c315ce9ee2b1", "score": "0.42553276", "text": "func (*GetSubjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_cms_cms_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "9d46863e002cb6dc6617b1512fb7a95a", "score": "0.42332825", "text": "func (o *GetRelationTuplesParams) SetSubject(subject *string) {\n\to.Subject = subject\n}", "title": "" }, { "docid": "ed459518fb45be26d7b0e405e8927a4c", "score": "0.42298204", "text": "func (*DeleteSubjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_cms_cms_proto_rawDescGZIP(), []int{30}\n}", "title": "" }, { "docid": "86c1050622e9028e6fc2663f6db706a3", "score": "0.42290267", "text": "func (*CreateSubjectReply) Descriptor() ([]byte, []int) {\n\treturn file_api_cms_cms_proto_rawDescGZIP(), []int{27}\n}", "title": "" }, { "docid": "eaf65bde6e70033f8e9ae4aadc740b06", "score": "0.42257753", "text": "func ServiceSubjectParams(sd *descriptor.ServiceDescriptorProto) []string {\n\tif opts := sd.GetOptions(); opts != nil {\n\t\tif e, err := proto.GetExtension(opts, nrpc.E_ServiceSubjectParams); err == nil {\n\t\t\treturn e.([]string)\n\t\t}\n\t}\n\treturn []string{}\n}", "title": "" }, { "docid": "e1cb843278f1acb163a5d83d103cc6be", "score": "0.41968477", "text": "func PrivatecaCertificateCertificateDescriptionAuthorityKeyIdToProto(o *privateca.CertificateCertificateDescriptionAuthorityKeyId) *privatecapb.PrivatecaCertificateCertificateDescriptionAuthorityKeyId {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &privatecapb.PrivatecaCertificateCertificateDescriptionAuthorityKeyId{}\n\tp.SetKeyId(dcl.ValueOrEmptyString(o.KeyId))\n\treturn p\n}", "title": "" }, { "docid": "1c79feb074d319876ba8e1e1378823a7", "score": "0.4193998", "text": "func ProtoToPrivatecaCertificateCertificateDescriptionAuthorityKeyId(p *privatecapb.PrivatecaCertificateCertificateDescriptionAuthorityKeyId) *privateca.CertificateCertificateDescriptionAuthorityKeyId {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &privateca.CertificateCertificateDescriptionAuthorityKeyId{\n\t\tKeyId: dcl.StringOrNil(p.GetKeyId()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "126b8accd7e9ad9899e90bfdd51dbae7", "score": "0.41827738", "text": "func SubjectFromDER(der []byte) Subject {\n\th := hash.NewFromBytes(der)\n\treturn Subject(h.String())\n}", "title": "" }, { "docid": "d051e3f3711c1023665b92ee903ad0a2", "score": "0.41751182", "text": "func (*DeleteSubjectCategoryReply) Descriptor() ([]byte, []int) {\n\treturn file_api_cms_cms_proto_rawDescGZIP(), []int{41}\n}", "title": "" }, { "docid": "96959eb3dbf3716c9207bca0ce6ad3bc", "score": "0.417093", "text": "func (o CertificateInformationOutput) Subject() pulumi.StringOutput {\n\treturn o.ApplyT(func(v CertificateInformation) string { return v.Subject }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2fb3cc86c2b75fdd5788720bb25e1b95", "score": "0.41688982", "text": "func (o CertificateConfigSubjectConfigOutput) Subject() CertificateConfigSubjectConfigSubjectOutput {\n\treturn o.ApplyT(func(v CertificateConfigSubjectConfig) CertificateConfigSubjectConfigSubject { return v.Subject }).(CertificateConfigSubjectConfigSubjectOutput)\n}", "title": "" }, { "docid": "40457ba9ac44dec4c075bf2baf5154a7", "score": "0.41469368", "text": "func (o CertificateOutput) Description() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Certificate) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "77f21380ce91b65d436f244e12cb6c87", "score": "0.41325763", "text": "func (s *ParameterDefinition) SetConstraintDescription(v string) *ParameterDefinition {\n\ts.ConstraintDescription = &v\n\treturn s\n}", "title": "" }, { "docid": "23b2e01bdafbaf676876e3e510ce980a", "score": "0.41250348", "text": "func (*UpdateSubjectCategoryReply) Descriptor() ([]byte, []int) {\n\treturn file_api_cms_cms_proto_rawDescGZIP(), []int{39}\n}", "title": "" }, { "docid": "b54b18eb65d651685d82da18d26d0cdc", "score": "0.41155857", "text": "func (o CertificateInformationResponseOutput) Subject() pulumi.StringOutput {\n\treturn o.ApplyT(func(v CertificateInformationResponse) string { return v.Subject }).(pulumi.StringOutput)\n}", "title": "" } ]
7e71ce1152c3f2875c758b9593df8247
Deprecated: Use CChatRoom_ChatMessageModified_Notification_ChatMessage.ProtoReflect.Descriptor instead.
[ { "docid": "86560837fcf2187e9e245b9c22c6f97f", "score": "0.7740789", "text": "func (*CChatRoom_ChatMessageModified_Notification_ChatMessage) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{116, 0}\n}", "title": "" } ]
[ { "docid": "be3c01d1632fca42a339c176669827c0", "score": "0.7832181", "text": "func (*CChatRoom_ChatMessageModified_Notification) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{116}\n}", "title": "" }, { "docid": "dd440b8d86dbd6bebe8eb008acefd3d8", "score": "0.74433553", "text": "func (*DeprecatedMessage) Descriptor() ([]byte, []int) {\n\treturn file_cmd_protoc_gen_go_testdata_comments_deprecated_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "c5dd40a85baa961401d596bb36ee0717", "score": "0.726584", "text": "func (*CMsgGameClientToServerChatMsg) Descriptor() ([]byte, []int) {\n\treturn file_artifact_dcg_gamemessages_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "1e73f39508e3f96cb31ff0babe5b48a7", "score": "0.7181109", "text": "func (*ChatMessage) Descriptor() ([]byte, []int) {\n\treturn file_proto_chat_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "b9cc63438211c8614c314eab29e62db3", "score": "0.71788347", "text": "func (*CChatRoom_IncomingChatMessage_Notification) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{115}\n}", "title": "" }, { "docid": "70c3aadc96fadcbea2a8769599230115", "score": "0.7138318", "text": "func (*ChatMessage) Descriptor() ([]byte, []int) {\n\treturn file_chat_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "65a28e696c5968acf578e4e4aff5eccd", "score": "0.7133645", "text": "func (*CMsgGameServerToClientChatMsg) Descriptor() ([]byte, []int) {\n\treturn file_artifact_dcg_gamemessages_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "640c3cb74ff03b48cc8232c8928fead0", "score": "0.71048313", "text": "func (*CMsgGCToClientChatMessage) Descriptor() ([]byte, []int) {\n\treturn file_dcg_gcmessages_client_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "74524caa6b4665802e151ed34c709e3a", "score": "0.71005183", "text": "func (*IMChatMessage) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "eb959b75362562c0ad9c705c39d294b9", "score": "0.70838565", "text": "func (*MetricDescriptorChange_Modified) Descriptor() ([]byte, []int) {\n\treturn edgelq_monitoring_proto_v3_metric_descriptor_change_proto_rawDescGZIP(), []int{0, 1}\n}", "title": "" }, { "docid": "20f3fd39c160c500db2332e893204122", "score": "0.7051141", "text": "func (*GroupTipChatMessage) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{43}\n}", "title": "" }, { "docid": "df5187a7a50b46904deb2b27230469c0", "score": "0.7028447", "text": "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "title": "" }, { "docid": "8d6f3f36c5ba5efb86c46765dec0230b", "score": "0.6993515", "text": "func (*LogDescriptorChange_Modified) Descriptor() ([]byte, []int) {\n\treturn edgelq_logging_proto_v1alpha2_log_descriptor_change_proto_rawDescGZIP(), []int{0, 1}\n}", "title": "" }, { "docid": "cfde7d19f0aa75fa0308a8ec57d7e7c2", "score": "0.6974456", "text": "func (*CChatRoom_DeleteChatMessages_Request_Message) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{105, 0}\n}", "title": "" }, { "docid": "4156c38edb09e3b3d39325fd82d17332", "score": "0.6943512", "text": "func (*FriendDelMessage) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{48}\n}", "title": "" }, { "docid": "5a6fbb75ec3a8dcc4e5ff04cf8a8f9b1", "score": "0.6934792", "text": "func (*ServerChatMessage) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{29}\n}", "title": "" }, { "docid": "eb8dad8fdcb38a1261f833183bb86082", "score": "0.69341403", "text": "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_chatgrpc_chatgrpc_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "8eba1935fbf60205012f460e2a63c4f9", "score": "0.69093525", "text": "func (*ChatPrivateMsg) Descriptor() ([]byte, []int) {\n\treturn file_protocol_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "4865326ab5e64c56349d19dc7ba484cc", "score": "0.6909088", "text": "func (*LogDescriptorChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_logging_proto_v1alpha2_log_descriptor_change_proto_rawDescGZIP(), []int{0, 3}\n}", "title": "" }, { "docid": "f0622bbf47c1f859dc34b3d7a2d6f2ef", "score": "0.69062036", "text": "func (*MetricDescriptorChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_monitoring_proto_v3_metric_descriptor_change_proto_rawDescGZIP(), []int{0, 3}\n}", "title": "" }, { "docid": "aea1794bd831e59c4e0df84f0136e9e3", "score": "0.6902722", "text": "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_chat_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "008421691c5f5af41b120ebdc26e788c", "score": "0.68918455", "text": "func (*CTraceMsg_PreviewDamageChanged) Descriptor() ([]byte, []int) {\n\treturn file_artifact_dcg_gamemessages_proto_rawDescGZIP(), []int{78}\n}", "title": "" }, { "docid": "f7785a68c1a58420b0cde0b26a88b587", "score": "0.6874521", "text": "func (*NotifyFriendChange) Descriptor() ([]byte, []int) {\n\treturn file_liqi_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "8aee86aed4f4892537edfa3a6968bae4", "score": "0.6854168", "text": "func (*CChatRoom_AckChatMessage_Notification) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{85}\n}", "title": "" }, { "docid": "d1f635ab8139c4bff789da0a99329c46", "score": "0.6853602", "text": "func (*ChangeNotification) Descriptor() ([]byte, []int) {\n\treturn file_peer_peer_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "ddbd764454cffd0d96f4f0514e6b3245", "score": "0.6848545", "text": "func (*CTraceMsg_ColorsPlayableChanged) Descriptor() ([]byte, []int) {\n\treturn file_artifact_dcg_gamemessages_proto_rawDescGZIP(), []int{79}\n}", "title": "" }, { "docid": "5fdd5bfaa67698a8f1f9244730c04845", "score": "0.68389326", "text": "func (*ChangeNotification) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_server_auth_service_protocol_components_auth_proto_replication_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "376ea1fed5b8da7cea28667a13751937", "score": "0.6825076", "text": "func (*CTraceMsg_ChargesChanged) Descriptor() ([]byte, []int) {\n\treturn file_artifact_dcg_gamemessages_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "6f9912f7aebbbfbeed5a91769ce73edc", "score": "0.68183327", "text": "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_google_firebase_fcm_connection_v1alpha1_connection_api_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "dbbe7dfc743fff8b086dcc182af41214", "score": "0.680588", "text": "func (*UpdateMessageEdited) Descriptor() ([]byte, []int) {\n\treturn file_updates_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "25b02f903a4701f76462368e68a6948f", "score": "0.6805715", "text": "func (*ChatMessage) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "6beb3ee4fead8c35e81bade556c49187", "score": "0.68006355", "text": "func (*BotEditMessage) Descriptor() ([]byte, []int) {\n\treturn file_chat_bot_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "af90a6f55ce8fe87474457f6325fca74", "score": "0.6795223", "text": "func (*AddChatMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "1355efe6278fabe4ebfa5487baa1c228", "score": "0.6787703", "text": "func (*ChatRoomClient_NotifyChatRoomDisconnect_Notification) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{122}\n}", "title": "" }, { "docid": "82a428c589d81ddcb4c13a350b794ec1", "score": "0.6785011", "text": "func (*FriendMessage) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{49}\n}", "title": "" }, { "docid": "e755667ed3ba84c29ea60361579efdb8", "score": "0.6780504", "text": "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_proto_chat_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "404f67f3418bbe4c1c3b3922a1a5da5e", "score": "0.6775929", "text": "func (*GetMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_chat_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "52002ba06708df1d0f5356bf796eeac4", "score": "0.67549634", "text": "func (*MetricDescriptorChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_monitoring_proto_v3_metric_descriptor_change_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "1eac18c655fdf5c73c61c92e51e6697a", "score": "0.6753732", "text": "func (*MessageWithReceivers) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_chat_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "59a410cb6a712883975efec66e024924", "score": "0.6751518", "text": "func (*DelMsgMessage) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "86d8490c0d1d82a561eed644e7d828e0", "score": "0.6741481", "text": "func (*CChatRoom_UpdateMemberListView_Notification) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{107}\n}", "title": "" }, { "docid": "87bc46537ed5a7f6cc1f2137f62fde9c", "score": "0.67378354", "text": "func (*MessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_chatgrpc_chatgrpc_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "cb7abea61e91dfd100cdad01b5621469", "score": "0.672151", "text": "func (*UpdateMessagesDeleted) Descriptor() ([]byte, []int) {\n\treturn file_updates_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "ed1a610616b96765ac9f52ceb8747380", "score": "0.67200017", "text": "func (*CChatRoom_NotifyShouldRejoinChatRoomVoiceChat_Notification) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{120}\n}", "title": "" }, { "docid": "ca73c4dcb854d5ceb58d1f16936c7847", "score": "0.671771", "text": "func (*CLUpdated) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cv_internal_prjmanager_prjpb_events_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "5f006c7570e452f0034c3ba35d78bc2c", "score": "0.6702022", "text": "func (*CChatRoom_ChatRoomGroupRoomsChange_Notification) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{119}\n}", "title": "" }, { "docid": "369848cd52c3bbf7455b24b8a6135520", "score": "0.67019993", "text": "func (*NotifyFriendViewChange) Descriptor() ([]byte, []int) {\n\treturn file_liqi_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "8898a858e708125ef1783c8b9e0dd8df", "score": "0.6699719", "text": "func (*SnapchatMessage) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{27}\n}", "title": "" }, { "docid": "269138fceb297ee47fa6c02f192c7862", "score": "0.66955703", "text": "func (*UpdateNewMessage) Descriptor() ([]byte, []int) {\n\treturn file_updates_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "6382c5b94b9e26571d7dcf1b67e5b0ee", "score": "0.6683274", "text": "func (*FriendSayMessage) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{47}\n}", "title": "" }, { "docid": "fd1ee04cb2dc3a49f8814d95d78c711a", "score": "0.66804296", "text": "func (*IMChatMessageList) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "848545668e60b146e207a98dbc775f8e", "score": "0.6679392", "text": "func (*ModifyCommentStateRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_internal_bugs_monorail_api_proto_issues_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "d715115fc33d21739034be1214fd616e", "score": "0.6659473", "text": "func (*CMsgClientToGCSendChatMessage) Descriptor() ([]byte, []int) {\n\treturn file_dcg_gcmessages_client_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "24cd0bdd05ab3c167e9a6b12bb3b1c98", "score": "0.6657707", "text": "func (*CChatUsability_ClientUsabilityMetrics_Notification) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{126}\n}", "title": "" }, { "docid": "a0468b3054c799931302262b1745b768", "score": "0.66547585", "text": "func (x *fastReflection_MsgUpdateGroupMetadata) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateGroupMetadata\n}", "title": "" }, { "docid": "5586fe8e2d6a68a0bdf11b2481c535c6", "score": "0.6654102", "text": "func (*CTraceMsg_AttributeValueChanged) Descriptor() ([]byte, []int) {\n\treturn file_artifact_dcg_gamemessages_proto_rawDescGZIP(), []int{68}\n}", "title": "" }, { "docid": "92d2a11771696b691d7a6174818f76ad", "score": "0.66498196", "text": "func (desc *immutable) DescriptorProto() *descpb.Descriptor {\n\treturn &descpb.Descriptor{\n\t\tUnion: &descpb.Descriptor_Type{\n\t\t\tType: &desc.TypeDescriptor,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b902470e5114aa7342967f45d600e89e", "score": "0.66361284", "text": "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_chat_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "54f5cbac8016e6ecf548774e157bd841", "score": "0.66342145", "text": "func (*ChatMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_client_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "1484143f40409ce9c956d282b53f4ccd", "score": "0.6632509", "text": "func (*CChatRoom_GetMessageHistory_Response_ChatMessage) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{77, 0}\n}", "title": "" }, { "docid": "dbaa590510e7fa940ecc5baff426a9b2", "score": "0.6626352", "text": "func (*Messages) Descriptor() ([]byte, []int) {\n\treturn file_cgentron_api_messages_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "ce20e01f4d5aa6696f92590f846d34d2", "score": "0.66200966", "text": "func (*MessageVo) Descriptor() ([]byte, []int) {\n\treturn file_chatRoom_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "b247de2f4eba82787afd43c967d3c491", "score": "0.6613029", "text": "func (*FriendInviteMessage) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{45}\n}", "title": "" }, { "docid": "be3f8d3114fe488dbc17c9fb3c0c37af", "score": "0.66119456", "text": "func (*CChatRoom_MemberStateChange_Notification) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{117}\n}", "title": "" }, { "docid": "4a9cc6a8c85a06555d5533ddd1626fe1", "score": "0.6609208", "text": "func (*CTraceMsg_PreviewDeathResultChanged) Descriptor() ([]byte, []int) {\n\treturn file_artifact_dcg_gamemessages_proto_rawDescGZIP(), []int{77}\n}", "title": "" }, { "docid": "4829024eb979986778478fc2ba5357d5", "score": "0.66071945", "text": "func (*CLsUpdated) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cv_internal_prjmanager_prjpb_events_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "409c997d7852de3161a19f1454313371", "score": "0.6606399", "text": "func (*LogDescriptorChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_logging_proto_v1alpha2_log_descriptor_change_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "5d67a582f74060b241ee240413acf801", "score": "0.6605594", "text": "func (*CMsgClientToGCLeaveChatChannel) Descriptor() ([]byte, []int) {\n\treturn file_dcg_gcmessages_client_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "968bc088a0ee697f70398f7517cec9cd", "score": "0.66038996", "text": "func (*CLUpdated) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cv_internal_prjmanager_internal_events_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "fe07d58ab11cfcb957c148b0b0f009a8", "score": "0.6598801", "text": "func (*MessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_chat_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "e26873e03156721d2575e943ac024e59", "score": "0.65950775", "text": "func (*MetricDescriptorChange_Current) Descriptor() ([]byte, []int) {\n\treturn edgelq_monitoring_proto_v3_metric_descriptor_change_proto_rawDescGZIP(), []int{0, 2}\n}", "title": "" }, { "docid": "561e1ea00f019f4ec31858caa8c79dde", "score": "0.6593556", "text": "func (*CChatRoomClient_MemberListViewUpdated_Notification) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{125}\n}", "title": "" }, { "docid": "6c487e1c1222a1961a65fd607b373515", "score": "0.6590665", "text": "func (*LogDescriptorChange_Current) Descriptor() ([]byte, []int) {\n\treturn edgelq_logging_proto_v1alpha2_log_descriptor_change_proto_rawDescGZIP(), []int{0, 2}\n}", "title": "" }, { "docid": "0b7d864004f2a795a9057b2c9296a948", "score": "0.65888065", "text": "func (x *fastReflection_MsgUpdateGroupMembers) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateGroupMembers\n}", "title": "" }, { "docid": "32bfb4ee42f2bc490c317dac8b87f363", "score": "0.65871924", "text": "func (*Notification) Descriptor() ([]byte, []int) {\n\treturn edgelq_monitoring_proto_v3_notification_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "ef8e8c0ad8daeba48482134fe76910bc", "score": "0.6583402", "text": "func (*GetConversationRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_chat_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "37d0528d2c9641819264fbc50218f222", "score": "0.65761584", "text": "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "title": "" }, { "docid": "544b1d8e097104d50301994dc3963e09", "score": "0.6566382", "text": "func (*CChatRoom_DeleteChatMessages_Request) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{105}\n}", "title": "" }, { "docid": "d56ffc93a4e5eac714449dd4a049c475", "score": "0.6563598", "text": "func (*VoiceMessage) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "a3da46f280c1fc761b394feeea76e981", "score": "0.65595114", "text": "func (*NotificationWatchMessage) Descriptor() ([]byte, []int) {\n\treturn file_svc_volchestrator_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "c85ea0c7b52366b87aee214b9d061c36", "score": "0.65589", "text": "func (*NoticeMessage) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{50}\n}", "title": "" }, { "docid": "151c9c6d64b064fcf89e1d7b47c3775e", "score": "0.6558017", "text": "func (*UpdateDraftMessage) Descriptor() ([]byte, []int) {\n\treturn file_updates_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "dd8a746607e0679b27357e424253d344", "score": "0.6550026", "text": "func (*Chat) Descriptor() ([]byte, []int) {\n\treturn file_chat_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "ebc7aa7dd51e29b5b0a724d62ef6d78f", "score": "0.65459216", "text": "func (*ProvisioningApprovalRequestChange_Modified) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha2_provisioning_approval_request_change_proto_rawDescGZIP(), []int{0, 1}\n}", "title": "" }, { "docid": "b8b487d6ee06aca820426e6ca25eab3c", "score": "0.65431553", "text": "func (*FieldTestMessage_Message) Descriptor() ([]byte, []int) {\n\treturn file_cmd_protoc_gen_go_testdata_proto3_fields_proto_rawDescGZIP(), []int{0, 3}\n}", "title": "" }, { "docid": "3635f5e1d9e80a291589c3dfce95a295", "score": "0.65428364", "text": "func (*RoleChange_Modified) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha2_role_change_proto_rawDescGZIP(), []int{0, 1}\n}", "title": "" }, { "docid": "f7defdbef857e9272f2dd8b005dc920f", "score": "0.654203", "text": "func (x *fastReflection_MsgVote) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgVote\n}", "title": "" }, { "docid": "f7defdbef857e9272f2dd8b005dc920f", "score": "0.654203", "text": "func (x *fastReflection_MsgVote) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgVote\n}", "title": "" }, { "docid": "68bd9e9377ef887e5aa4de8a2d9ba1b4", "score": "0.65386087", "text": "func (*ModifyCommentStateResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_internal_bugs_monorail_api_proto_issues_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "6055e1b6abab4f697ede8edbb048f429", "score": "0.653806", "text": "func (*AddConversationRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_chat_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "0cc1b377e1aeb61a0037d9533f327192", "score": "0.6537175", "text": "func (*Msg) Descriptor() ([]byte, []int) {\n\treturn file_api_messages_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "bbe83044041eccf41bf835f9dbf18ee5", "score": "0.6535159", "text": "func (*ReqSayChatMessage) Descriptor() ([]byte, []int) {\n\treturn file_liqi_proto_rawDescGZIP(), []int{410}\n}", "title": "" }, { "docid": "9f0314f4463489018a3bd67be86e1ac5", "score": "0.6529292", "text": "func (*Conversation) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_chat_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "a052cbcfbd64f5a094b43c582db093b1", "score": "0.65291274", "text": "func (*MessageContactRequest) Descriptor() ([]byte, []int) {\n\treturn file_puppet_message_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "1626ef8fbbc6042d6dfce8e58e49a795", "score": "0.65211195", "text": "func (*CMsgGCToClientPrivateLobbyEvent) Descriptor() ([]byte, []int) {\n\treturn file_dcg_gcmessages_client_proto_rawDescGZIP(), []int{64}\n}", "title": "" }, { "docid": "82bbd8ef6424a07455d1b86e6255839c", "score": "0.65180147", "text": "func (*DelGroupNotice) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_im_message_proto_rawDescGZIP(), []int{44}\n}", "title": "" }, { "docid": "03b1acfa38549fdbb12360100a97107a", "score": "0.6511126", "text": "func (*Notification) Descriptor() ([]byte, []int) {\n\treturn file_proto_notification_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "ec8dcd707d734ef485bafc0ec1d3b238", "score": "0.650894", "text": "func (*GetMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_chat_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "532a9ea433b8944b734e3e98409c1db1", "score": "0.6504846", "text": "func (x *fastReflection_EventBridgeReceive) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_EventBridgeReceive\n}", "title": "" }, { "docid": "3669ea3693388c271429f483d5e70357", "score": "0.6503863", "text": "func (*Message3061_Message3066) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{5, 4}\n}", "title": "" } ]
e2cd67c5a91c4320068b98bece31d7ff
Invoked function when return success with no content
[ { "docid": "3c7e68bc0e01f260a6e8af6bac82adee", "score": "0.60173684", "text": "func ResponseWithNoContent(w http.ResponseWriter, code int) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(code)\n}", "title": "" } ]
[ { "docid": "da278c1ab3732323d7ca5d12fdf79626", "score": "0.7050184", "text": "func HandleHTTPSuccessNoContent(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "131fba575bd5959226e099ff3837bebb", "score": "0.6597574", "text": "func (c *CLI) SuccessWithNoContent() {\n\tc.SetStatus(204)\n\tc.committed = true\n}", "title": "" }, { "docid": "0d4833d643d026f5027d13bc1f6797ee", "score": "0.6299677", "text": "func respondWithEmpty(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "7026090eb1123ddb1bdfd5d891eec2bc", "score": "0.6169158", "text": "func SinContenido(w http.ResponseWriter) {\n http.Error(w, \"204 No Content\", http.StatusNoContent)\n}", "title": "" }, { "docid": "48fc58212d1a383a27845c191ac15fa1", "score": "0.6167414", "text": "func (this *controllerStruct) doNothingHandler(request webserver.HttpRequest) webserver.HttpResponse {\n\n\t/*\n\t * Indicate success.\n\t */\n\twebResponse := webResponseStruct{\n\t\tSuccess: true,\n\t\tReason: \"\",\n\t}\n\n\tmimeType, buffer := this.createJSON(webResponse)\n\n\t/*\n\t * Create HTTP response.\n\t */\n\tresponse := webserver.HttpResponse{\n\t\tHeader: map[string]string{\"Content-type\": mimeType},\n\t\tBody: buffer,\n\t}\n\n\treturn response\n}", "title": "" }, { "docid": "5f83f5243d04bbebae3d882811c2135b", "score": "0.6108954", "text": "func None(resp *http.Response, result interface{}) error {\n\tresp.Body.Close()\n\treturn verify(resp, \"\")\n}", "title": "" }, { "docid": "02b59c40b310107eb519ce9ce8bac3e0", "score": "0.6051208", "text": "func (r *RequestHandler) OK(wr http.ResponseWriter, req *http.Request) {\n\tlog.Println(\"ok was requested...\")\n\n\tapi.GeneralSuccess.WriteJSON(wr)\n\treturn\n}", "title": "" }, { "docid": "16111a3a3dd8dc32f2497d88e88b0682", "score": "0.5992793", "text": "func NoContent(w http.ResponseWriter, r *http.Request) {\n\tCallRegisterFuncOrAbortEmptyPlain(w, r, message.MessageStatusNoContent, http.StatusNoContent)\n}", "title": "" }, { "docid": "7177d1d2b6509fc488709fd60dbae5a7", "score": "0.5982153", "text": "func StatusNoContent() RecTestFn {\n\treturn Status(http.StatusNoContent)\n}", "title": "" }, { "docid": "47b4bbca85aa9a89789802fd50db2e73", "score": "0.59331834", "text": "func (res *Response) NoContent() {\n\tres.writer.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "79988db86e4f5377c2be8f388216aa27", "score": "0.5909644", "text": "func NoContent(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "3d1577d30a7a7dd3a295302316c6fa1c", "score": "0.585752", "text": "func (r *Responder) NoContent(w http.ResponseWriter) error {\n\tw.WriteHeader(http.StatusNoContent)\n\treturn nil\n}", "title": "" }, { "docid": "129409793a6f16ec4d8dcb98c1ddc28d", "score": "0.5800798", "text": "func (c *APIContext) NoContent() {\n\tc.Status(http.StatusNoContent)\n}", "title": "" }, { "docid": "ea0e0d840980d0235811cb4e1074fcd1", "score": "0.5798202", "text": "func SendEmptyResponse(w http.ResponseWriter, r *http.Request, response Empty) {\r\n res, err := json.Marshal(response)\r\n if (err != nil) {\r\n // last chance !! - send empty response\r\n http.NotFound(w, r)\r\n }\r\n\r\n // set content type to return JSON\r\n w.Header().Set(\"Content-Type\", \"application/json\")\r\n w.Write(res)\r\n}", "title": "" }, { "docid": "4f45d839b5c09e81e9f04e7048ec2bb5", "score": "0.577716", "text": "func (c *Context) NoContent() {\n\tc.Resp.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "53a1e6625a040241c5c0dcb9a397cb89", "score": "0.57625824", "text": "func (ctx *RefreshUserContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "title": "" }, { "docid": "d7baf41f75e4ed525f2eab3c66d8ff26", "score": "0.573632", "text": "func (api ApiHandler) ReplyNoContent(w http.ResponseWriter, r *http.Request) {\n\trender.JSON(w, r, APIResponse{\n\t\tCode: http.StatusNoContent,\n\t\tMessage: http.StatusText(http.StatusNoContent),\n\t})\n}", "title": "" }, { "docid": "e1b281a1cb6f2419d0b7568626d5e0dd", "score": "0.5734077", "text": "func (w *responseWriter) NoContent() Result {\n\tif w.written {\n\t\tpanic(\"ResponseWriter was already written to\")\n\t}\n\tw.handler.commitPhase(w, NoContentResponse{})\n\tif w.written {\n\t\treturn Result{}\n\t}\n\tw.markWritten()\n\tw.rw.WriteHeader(int(StatusNoContent))\n\treturn Result{}\n}", "title": "" }, { "docid": "8d52c42d74b64bf08b84138807a5f6f3", "score": "0.5681512", "text": "func (o *SyncRunNoContent) Code() int {\n\treturn 204\n}", "title": "" }, { "docid": "1196fedcff46d60ea4b8dd957224581f", "score": "0.56632334", "text": "func (req *Request) NoContent() {\n\tif req == nil {\n\t\treturn\n\t}\n\n\treq.Response.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "dcc577d71cd79253fc601fc5e16b6030", "score": "0.5655476", "text": "func NoContent(ctx context.Context, headersClient go_headers.Client, logClient go_log.Client, w http.ResponseWriter) {\n\theaders := setHeadersInclDefaults(ctx, headersClient, w, nil)\n\tcode := http.StatusNoContent\n\tw.WriteHeader(code)\n\tlogInfoResponse(ctx, logClient, code, headers, 0, nil)\n}", "title": "" }, { "docid": "f6030942e58acb56bb869fe99cbdf7c5", "score": "0.5636437", "text": "func (r *Req) NoContent(code int) {\n\tr.Response.WriteHeader(code)\n}", "title": "" }, { "docid": "8edec113fe999b65fef35d2e61ba8bd4", "score": "0.56321526", "text": "func NoContent() (events.APIGatewayProxyResponse, error) {\n\treturn Response(\"\", http.StatusNoContent)\n}", "title": "" }, { "docid": "6f5bd41ab5e3e81ff2a34d518d30fae8", "score": "0.5631378", "text": "func (w *webPage) isOK() bool {\n return w.err == nil \n}", "title": "" }, { "docid": "3ac18c2720df7599ea694c887c84ee95", "score": "0.56092453", "text": "func (p *Prober) Ok() {\n\tp.setStatus(nil)\n}", "title": "" }, { "docid": "6aee25c833c1c356de3dbddfb83951e5", "score": "0.55986655", "text": "func OK(data interface{}) http.HandlerFunc {\n\treturn jsonContent(http.StatusOK, data)\n}", "title": "" }, { "docid": "86c3ac15d32bb2dcde4fc00df097ac3b", "score": "0.5594281", "text": "func RespondWithEmpty(w http.ResponseWriter, code int) {\n\tRespondWithJSON(w, \"\", code)\n}", "title": "" }, { "docid": "57e553f8e947da83385c7216ed39eaf8", "score": "0.55941623", "text": "func NilHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprintf(w, `{\"status\":\"ok\"}`)\n}", "title": "" }, { "docid": "af1d56d91e6edb9682deb64fd9a1bc9e", "score": "0.5588428", "text": "func SuccessNoContentRequest(message string) render.Renderer {\n\treturn &SuccessResponse{\n\t\tHTTPStatusCode: 404,\n\t\tStatusText: \"resource not found\",\n\t\tData: message,\n\t}\n}", "title": "" }, { "docid": "dbe12c9b2c9b918866b7503629fb821c", "score": "0.5577591", "text": "func NoContent(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(204)\n}", "title": "" }, { "docid": "ce64479b4b0c6fd9530308267ce5401e", "score": "0.552192", "text": "func Okay(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "3ef4b1c4003affb0914021c40378a38f", "score": "0.5507353", "text": "func NoContent() huma.Response {\n\treturn response(http.StatusNoContent)\n}", "title": "" }, { "docid": "b868bad3ea4d9edde87b6e20874666b5", "score": "0.54999197", "text": "func handleNoop(c *client) {\n\tsendMessage(c, 200)\n}", "title": "" }, { "docid": "0ff001b05a0e329259390c530fe51a4e", "score": "0.5491431", "text": "func ReturnFirst(w http.ResponseWriter, r *http.Request) { //see my comments on the ReturnWorkURNS functions above\n\tdefer func() { //Recover fuction for error handling\n\t\tif rfError := recover(); rfError != nil {\n\t\t\tmessage := (\"Error encountered. Please contact development team and send in current logfile!\") //build message part of NodeResponse\n\t\t\tresult := NodeResponse{requestURN: []string{}, Status: \"Exception\", Message: message} //building result (NodeResponse)\n\t\t\tresult.Service = \"/texts/first\" // adding Service part to result (NodeResponse)\n\t\t\tresultJSON, _ := json.Marshal(result) //parsing result to JSON format\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\") //set output format\n\t\t\tfmt.Fprintln(w, string(resultJSON))\n\t\t\tlog.Println(\"Error encountered: \\\"\", rfError, \"\\\"\")\n\t\t\tlog.Println(\"ReturnFirst executed with exeption\")\n\t\t\treturn //necessary?\n\t\t}\n\t}()\n\tlog.Println(\"Called function: ReturnFirst\")\n\tconfvar := LoadConfiguration(\"config.json\") //load variables from config file\n\tvars := mux.Vars(r) //load variable from mux server\n\trequestCEX := \"\" //initalizerequestCEX variable (why?)\n\trequestCEX = vars[\"CEX\"] //\n\tvar sourcetext string\n\tswitch {\n\tcase requestCEX != \"\":\n\t\tsourcetext = confvar.Source + requestCEX + \".cex\"\n\t\tlog.Println(\"CEX-file provided in URL: \" + requestCEX + \". Using \" + sourcetext + \".\")\n\tdefault:\n\t\tsourcetext = confvar.TestSource\n\t\tlog.Println(\"No CEX-file provided in URL. Using \" + confvar.TestSource + \" from config instead.\")\n\t}\n\trequestURN := vars[\"URN\"]\n\t//log.Println(\"Requested URN: \" + requestURN)\n\tif isCTSURN(requestURN) != true {\n\t\tmessage := requestURN + \" is not a valid CTS URN.\"\n\t\tresult := NodeResponse{requestURN: []string{requestURN}, Status: \"Exception\", Message: message}\n\t\tresult.Service = \"/texts/first\"\n\t\tresultJSON, _ := json.Marshal(result)\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tfmt.Fprintln(w, string(resultJSON))\n\t\tlog.Println(\"ReturnFirst executed with exeption\")\n\t\treturn\n\t}\n\tworkResult := ParseURNsAndTextsFromCTSdata(CTSParams{Sourcetext: sourcetext})\n\tworks := append([]string(nil), workResult.URN...)\n\tfor i := range workResult.URN {\n\t\tworks[i] = strings.Join(strings.Split(workResult.URN[i], \":\")[0:4], \":\")\n\t}\n\tworks = removeDuplicatesUnordered(works)\n\tworkindex := 0\n\tfor i := range works {\n\t\tif strings.Contains(requestURN, works[i]) {\n\t\t\tteststring := works[i] + \":\"\n\t\t\tswitch {\n\t\t\tcase requestURN == works[i]:\n\t\t\t\tworkindex = i + 1\n\t\t\tcase strings.Contains(requestURN, teststring):\n\t\t\t\tworkindex = i + 1\n\t\t\t}\n\t\t}\n\t}\n\tvar result NodeResponse\n\tswitch {\n\tcase workindex == 0:\n\t\tlog.Println(\"Requested URN not in ctsdata\")\n\t\tmessage := \"No results for \" + requestURN\n\t\tresult = NodeResponse{requestURN: []string{requestURN}, Status: \"Exception\", Message: message}\n\tdefault:\n\t\tvar RequestedWork Work\n\t\tRequestedWork.WorkURN = works[workindex-1]\n\t\trunindex := 0\n\t\tfor i := range workResult.URN {\n\t\t\tif strings.Join(strings.Split(workResult.URN[i], \":\")[0:4], \":\") == RequestedWork.WorkURN {\n\t\t\t\tRequestedWork.URN = append(RequestedWork.URN, workResult.URN[i])\n\t\t\t\tRequestedWork.Text = append(RequestedWork.Text, workResult.Text[i])\n\t\t\t\trunindex++\n\t\t\t\tRequestedWork.Index = append(RequestedWork.Index, runindex)\n\t\t\t}\n\t\t}\n\t\tresult = NodeResponse{requestURN: []string{requestURN},\n\t\t\tStatus: \"Success\",\n\t\t\tNodes: []Node{Node{URN: []string{RequestedWork.URN[0]},\n\t\t\t\tText: []string{RequestedWork.Text[0]},\n\t\t\t\tNext: []string{RequestedWork.URN[1]},\n\t\t\t\tIndex: RequestedWork.Index[0]}}}\n\t}\n\tresult.Service = \"/texts/first\"\n\tresultJSON, _ := json.Marshal(result)\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tif result.Status == \"Success\" {\n\t\tlog.Println(\"ReturnFirst executed succesfully\")\n\t} else {\n\t\tlog.Println(\"ReturnFirst executed with exeption\")\n\t}\n\tfmt.Fprintln(w, string(resultJSON))\n}", "title": "" }, { "docid": "557dc454cc8e9ac6f0482bbbadbbb4b4", "score": "0.54627657", "text": "func httpSuccesshttpSuccessReply(http_reply http.ResponseWriter) {\n\ttype messageReply struct {\n\t\tStatus string `json:\"status\"`\n\t}\n\thttpSuccessReply := messageReply{Status: \"success\"}\n\thttpSendReply(http_reply, httpSuccessReply)\n}", "title": "" }, { "docid": "c8e6be5fdbd2ca93f1c67b192edd33be", "score": "0.5455396", "text": "func (o *TrialNoContent) Code() int {\n\treturn 204\n}", "title": "" }, { "docid": "faccb13599c0d51b7cb56295d8eb16bb", "score": "0.5451379", "text": "func (ctx *LoginUserContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "title": "" }, { "docid": "81e8491c8a1445e89fa94920fd9c0c4a", "score": "0.54461646", "text": "func (ctx *SendValidationUserContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "title": "" }, { "docid": "8a33815965f686149cd0a3ebcaa410e1", "score": "0.54309285", "text": "func httpSuccessReply(http_reply http.ResponseWriter) {\n\ttype messageReply struct {\n\t\tStatus string `json:\"status\"`\n\t}\n\thttpSuccessReply := messageReply{Status: \"success\"}\n\thttpSendReply(http_reply, httpSuccessReply)\n}", "title": "" }, { "docid": "00553dc074b3ef1a369ffcb336f9ef93", "score": "0.54301214", "text": "func success() models.CommonResp {\n\treturn models.CommonResp{\n\t\tMessage: \"success\",\n\t\tTimestamp: time.Now().Unix(),\n\t}\n}", "title": "" }, { "docid": "3e54cbaf17b944e65ace9fdd629fd54a", "score": "0.5428044", "text": "func (ctx *UpdateBottleContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "title": "" }, { "docid": "55f7ffbddf19e3f760e174af8f8df31f", "score": "0.541949", "text": "func NoContent(w http.ResponseWriter) {\n\tw.Header().Set(\"Content-Type\", contentTypeHeader)\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "f014251816437a2aede8daf6d48919da", "score": "0.541114", "text": "func handleHealthz(w http.ResponseWriter, _ *http.Request) {\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "42593c613e66ed1e55411203e84efda3", "score": "0.539702", "text": "func SendOkStatus(w http.ResponseWriter) {\n\t// Send HTTP 204 everything ok but no content\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "de4750f9e2b4fbf3194225b813adf0a1", "score": "0.53931886", "text": "func (s statusCode) Unsuccessful() bool { return !s.Successful() }", "title": "" }, { "docid": "21ada071d6692323c929fcbc48fc18b3", "score": "0.5381523", "text": "func (p *Controller) RespNoContent() {\n\tp.AbortWithStatus(http.StatusNoContent)\n}", "title": "" }, { "docid": "e52224d7b717f1e35451da29118f7dcd", "score": "0.536931", "text": "func (c *Client) noResultsHandler(_ string) {\n\tc.send <- IrcErrorResponse{\n\t\tMessageType: IRCERROR,\n\t\tStatus: \"No results found for the query.\",\n\t}\n}", "title": "" }, { "docid": "7ce84ea8b6092645985cdc9b80d97618", "score": "0.5360595", "text": "func OK() huma.Response {\n\treturn response(http.StatusOK)\n}", "title": "" }, { "docid": "32f018133dc2516ff684541b1cb0b05b", "score": "0.5337319", "text": "func Ok(w http.ResponseWriter, data interface{}) {\n\tsendResponse(w, http.StatusOK, data)\n}", "title": "" }, { "docid": "ab8087b62142d7e1ffd0f4bd5b1046fd", "score": "0.5327142", "text": "func (ctx *RateBottleContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "title": "" }, { "docid": "59f4d50e94d9dd2904581db2afb3c92e", "score": "0.53127474", "text": "func (c *C) Succeed() {\n\tc.T.Helper()\n\tc.T.Fatal(\"Succeed is not supported\")\n}", "title": "" }, { "docid": "3579c997e8a49fdee1beba6589bdf91e", "score": "0.531095", "text": "func (_m *StatusDescriber) Success() {\n\t_m.Called()\n}", "title": "" }, { "docid": "a64a72dc92c7d79cf5f98df6b3769e1a", "score": "0.53070736", "text": "func (o *RestartRunNoContent) Code() int {\n\treturn 204\n}", "title": "" }, { "docid": "8719c3b4b13db0e98ac1fe4150d8de02", "score": "0.52940595", "text": "func TrowSucess(w http.ResponseWriter, Data interface{}) {\n\tSetStatusCode(w, http.StatusOK)\n\tSetJsonEncoder(w, Data)\n}", "title": "" }, { "docid": "94633043f415e3e346e7cdb7aa887b16", "score": "0.52938795", "text": "func NoEncontrado(w http.ResponseWriter) {\n http.Error(w, \"404 Not Found\", http.StatusNotFound )\n}", "title": "" }, { "docid": "87237c6af089ca8f4f829173aa9fd046", "score": "0.5280612", "text": "func responseNotFound(rw http.ResponseWriter) {\n\tresponseStatusCode(rw, http.StatusNotFound)\n}", "title": "" }, { "docid": "a5a6cfdfad406fd9f6c3a56b138deaa5", "score": "0.5279901", "text": "func (res *APIResponse) Success(w http.ResponseWriter) {\n\tres.Status = true\n\tif res.Message == \"\" {\n\t\tres.Message = http.StatusText(http.StatusOK)\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(res)\n}", "title": "" }, { "docid": "5a77525a4a1c9d5668652ade1bd3f85c", "score": "0.5275962", "text": "func (ctx *LogoutUserContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "title": "" }, { "docid": "4831e9c4c27737430ae20d8acc4fa41d", "score": "0.52756083", "text": "func readyz(w http.ResponseWriter, _ *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "791470a6024b5a9a64da5c95ea621945", "score": "0.5274532", "text": "func (h *Handler) testReady(f http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif h.isReady() {\n\t\t\tf(w, r)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\t_, err := fmt.Fprintf(w, \"Service Unavailable\")\n\t\tif err != nil {\n\t\t\th.logger.Log(\"msg\", \"failed to write to response body\", \"err\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8f594ed79be71307b96657bc843d9ac6", "score": "0.52738476", "text": "func (o *SyncRunNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "18dfdc5ce6c186d5be1ba2fca33faacf", "score": "0.5265478", "text": "func DoesntVerifyHandler(rw http.ResponseWriter, req *http.Request, verify func() bool) {\n\trw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "b04c30849f328d4897a9e5d93eb2f2c2", "score": "0.5262273", "text": "func RespondSuccessAndExit(w http.ResponseWriter, msg string) {\n\n\tresponsecontent := BasicResponse{\n\t\tmsg,\n\t\t200,\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tRespondOrThrowErr(responsecontent, w)\n\n}", "title": "" }, { "docid": "0af876ce4eeedd2b6d454ab9a2773675", "score": "0.52613384", "text": "func RespSuccess(w http.ResponseWriter, data interface{}) {\n\tRespSuccessWithMessage(w, \"\", data)\n}", "title": "" }, { "docid": "a923e98748592755d30cc53f1ac778f0", "score": "0.5261256", "text": "func (o *ResumeRunNoContent) Code() int {\n\treturn 204\n}", "title": "" }, { "docid": "24a7b935c9538e7f6d6eb1361639d063", "score": "0.52611834", "text": "func (o *RemoveEventLoopNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "7123735e60c60702cfb06abf93ee1f8d", "score": "0.5252569", "text": "func respondOK(w http.ResponseWriter) {\n\tres := struct {\n\t\tErr string\n\t}{\n\t\t\"\",\n\t}\n\n\tjson.NewEncoder(w).Encode(&res)\n}", "title": "" }, { "docid": "bacb63484009e47cc4d9ae657132a473", "score": "0.52505654", "text": "func (o *TagRunsNoContent) Code() int {\n\treturn 204\n}", "title": "" }, { "docid": "07500bf8e84732f1c44eb4028a253a44", "score": "0.5243013", "text": "func (r MainResponse) Failure() bool {\n\treturn r.StatusCode != http.StatusOK && r.StatusCode != http.StatusNoContent\n}", "title": "" }, { "docid": "750762feb9d25eedf77abe880eba4cc1", "score": "0.52408916", "text": "func (o *GetHistoryNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "a3b3a146137249cf18569dac52e7b87a", "score": "0.5236568", "text": "func (ctx *RecoveryUserContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"text/plain\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "title": "" }, { "docid": "956be423e40cf21ecefa3c1cb6e2b11e", "score": "0.5235327", "text": "func (o *GetRunArtifactsNoContent) Code() int {\n\treturn 204\n}", "title": "" }, { "docid": "e54306567d41fe7ff17c334349f7c3aa", "score": "0.5234542", "text": "func processResponse(index int, res *http.Response) {\n\tif res.StatusCode != http.StatusOK {\n\t\tlog.Fatalf(\"http status code is not OK: %s\", res.Status)\n\t}\n\tdefer res.Body.Close()\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error reading response: %s\", err)\n\t}\n\tif len(body) == 0 {\n\t\tlog.Fatalf(\"response with empty body. Status: %s\", res.Status)\n\t}\n}", "title": "" }, { "docid": "e33d2ada113e2ff01c567e21ea1495b0", "score": "0.5206799", "text": "func (o *GetConnectionNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "38d3445672ca25964478659bc26c0adc", "score": "0.5203367", "text": "func (ncr NoContentResult) Render(ctx *Ctx) error {\n\tctx.Response.WriteHeader(http.StatusNoContent)\n\treturn nil\n}", "title": "" }, { "docid": "9097e6fab6dd6a29d26e5478d1fba6b7", "score": "0.51952857", "text": "func FuncDefault(w http.ResponseWriter, r *http.Request) {\n\ttools.Return500(w, fmt.Sprintf(\"No implementado URL:%v Method:%v\", r.URL, r.Method))\n}", "title": "" }, { "docid": "002d26ae64b7313ade089193fe02d75e", "score": "0.51944953", "text": "func (h *Handler) testReady(f http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif h.isReady() {\n\t\t\tf(w, r)\n\t\t} else {\n\t\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\t\tfmt.Fprintf(w, \"Service Unavailable\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d24b2b7b950dc1de9949a1b666b0f782", "score": "0.51912206", "text": "func StatusOK() RecTestFn {\n\treturn Status(http.StatusOK)\n}", "title": "" }, { "docid": "6af17d4136e003016f33d573a8d3a20a", "score": "0.51876336", "text": "func (ctx *DeleteBottleContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "title": "" }, { "docid": "d974fa6648a9a9dc437e0e300691a0c6", "score": "0.5186854", "text": "func (o *SyncTagsNoContent) Code() int {\n\treturn 204\n}", "title": "" }, { "docid": "3fc9a28ac384d2c63bec5e45cad24822", "score": "0.51792055", "text": "func (ctx *UpdateAccountContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "title": "" }, { "docid": "ef90394e6e1235eff9587713b3318c26", "score": "0.51772434", "text": "func (o *GetDockerRegistryWebhookNameUsingGETInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "3a018b74a28b110b69eaa49149d1b642", "score": "0.5173482", "text": "func ReturnResponse(r *http.Request, w http.ResponseWriter, msg string, log log.Log) {\n\tif msg != \"\" {\n\t\tlog.Info(\"Return Ok: (200) %s to client: %s\", msg, r.RemoteAddr)\n\t} else {\n\t\tlog.Info(\"Return Ok: (200) to client: %s\", r.RemoteAddr)\n\t}\n\n\n\tif msg == \"\" {\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", variable.DEFAULT_CONTENT_HEADER)\n\tw.WriteHeader(http.StatusOK)\n\n\tio.WriteString(w, msg)\n}", "title": "" }, { "docid": "1f34c3de03862c9420b6d23c01f849aa", "score": "0.5161434", "text": "func (page ResponseWithContinuationGalleryImagePage) NotDone() bool {\n\treturn !page.rwcgi.IsEmpty()\n}", "title": "" }, { "docid": "a4423679580582fd0aa19eef2df51906", "score": "0.51607376", "text": "func TestEmptyResponse(t *testing.T) {\n\tr, _ := http.NewRequest(\"GET\", \"/beego-empty.html\", nil)\n\tw := httptest.NewRecorder()\n\n\thandler := NewControllerRegister()\n\thandler.Add(\"/beego-empty.html\", &TestController{}, WithRouterMethods(&TestController{}, \"get:GetEmptyBody\"))\n\thandler.ServeHTTP(w, r)\n\n\tif body := w.Body.String(); body != \"\" {\n\t\tt.Error(\"want empty body\")\n\t}\n}", "title": "" }, { "docid": "f16cf8d66c6d7415d3e5822486d500fc", "score": "0.51522166", "text": "func handlerEmpty(w http.ResponseWriter, _ *http.Request) {\n\tfmt.Fprint(w, \"\")\n}", "title": "" }, { "docid": "20bce1aa334bed0df349a0a2b79c2b7a", "score": "0.51485366", "text": "func (o *DeleteContentSelectorNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "e8fe7b151f2af049373fb7afd9f6a04d", "score": "0.51474136", "text": "func (r *Responder) Empty(w http.ResponseWriter) error {\n\treturn r.NoContent(w)\n}", "title": "" }, { "docid": "d9c3e6ecc46ffe1e050a4f6079898947", "score": "0.514716", "text": "func (o *UpdateSearchNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "1843e5a0db984f40d06493a6127ea816", "score": "0.5146476", "text": "func respondSuccess() {\n\tresp := Response{\n\t\tStatus: \"Success\",\n\t}\n\tprintJSON(resp)\n}", "title": "" }, { "docid": "3700bb44494484df2fcc0cdb51e7b943", "score": "0.514628", "text": "func (o *GetRunStatsNoContent) Code() int {\n\treturn 204\n}", "title": "" }, { "docid": "701307d7295cc8bdcbe761b3f8ef757a", "score": "0.51455945", "text": "func HandleHTTP(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "dc5b2383919ea4db9dc6dc9e11bdaf7b", "score": "0.51439095", "text": "func addNoJsonResponse(w http.ResponseWriter, req *http.Request) {\n\tjson := req.FormValue(\"gps\")\n\tgo addPosition(json)\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "1437524e0a07fc8841ed4818af1d0b2d", "score": "0.5142506", "text": "func (s statusCode) Successful() bool { return s >= 200 && s < 300 }", "title": "" }, { "docid": "bf7ac70d4a4b3cccc2bd30e4d819a0bc", "score": "0.5139376", "text": "func OK(w http.ResponseWriter, data, meta interface{}) error {\n\treturn SendResponse(w, http.StatusOK, WrapPayload(data, meta), nil)\n}", "title": "" }, { "docid": "87e79309178d2b63575df9d07b021c9a", "score": "0.5136647", "text": "func (ctx *RecoveryLookupUserContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"text/plain\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "title": "" }, { "docid": "5a3ae42435525f4a352da2435ebcf1f0", "score": "0.5136163", "text": "func (o *TagRunsNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "bd7c65f4bab9e51670c64a08516ce8da", "score": "0.513503", "text": "func ReturnLast(w http.ResponseWriter, r *http.Request) {\n\tdefer func() {\n\t\tif rlError := recover(); rlError != nil {\n\t\t\tmessage := (\"Error encountered. Please contact development team and send in current logfile!\") //build message part of NodeResponse\n\t\t\tresult := NodeResponse{requestURN: []string{}, Status: \"Exception\", Message: message} //building result (NodeResponse)\n\t\t\tresult.Service = \"/texts/last\" // adding Service part to result (NodeResponse)\n\t\t\tresultJSON, _ := json.Marshal(result) //parsing result to JSON format\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\") //set output format\n\t\t\tfmt.Fprintln(w, string(resultJSON))\n\t\t\tlog.Println(\"Error encountered: \\\"\", rlError, \"\\\"\")\n\t\t\tlog.Println(\"ReturnLast executed with exeption\")\n\t\t\treturn //necessary?\n\t\t}\n\t}()\n\tlog.Println(\"Called function: ReturnLast\")\n\tconfvar := LoadConfiguration(\"config.json\")\n\tvars := mux.Vars(r)\n\trequestCEX := \"\"\n\trequestCEX = vars[\"CEX\"]\n\tvar sourcetext string\n\tswitch {\n\tcase requestCEX != \"\":\n\t\tsourcetext = confvar.Source + requestCEX + \".cex\"\n\t\tlog.Println(\"CEX-file provided in URL: \" + requestCEX + \". Using \" + sourcetext + \".\")\n\tdefault:\n\t\tsourcetext = confvar.TestSource\n\t\tlog.Println(\"No CEX-file provided in URL. Using \" + confvar.TestSource + \" from config instead.\")\n\t}\n\trequestURN := vars[\"URN\"]\n\tif isCTSURN(requestURN) != true { //test for valid URN\n\t\tmessage := requestURN + \" is not a valid CTS URN.\"\n\t\tresult := NodeResponse{requestURN: []string{requestURN}, Status: \"Exception\", Message: message}\n\t\tresult.Service = \"/texts/last\"\n\t\tresultJSON, _ := json.Marshal(result)\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tfmt.Fprintln(w, string(resultJSON))\n\t\tlog.Println(\"ReturnLast executed with exception\")\n\t\treturn\n\t}\n\tworkResult := ParseURNsAndTextsFromCTSdata(CTSParams{Sourcetext: sourcetext})\n\tworks := append([]string(nil), workResult.URN...)\n\tfor i := range workResult.URN {\n\t\tworks[i] = strings.Join(strings.Split(workResult.URN[i], \":\")[0:4], \":\")\n\t}\n\tworks = removeDuplicatesUnordered(works)\n\tworkindex := 0\n\tfor i := range works {\n\t\tif strings.Contains(requestURN, works[i]) {\n\t\t\tteststring := works[i] + \":\"\n\t\t\tswitch {\n\t\t\tcase requestURN == works[i]:\n\t\t\t\tworkindex = i + 1\n\t\t\tcase strings.Contains(requestURN, teststring):\n\t\t\t\tworkindex = i + 1\n\t\t\t}\n\t\t}\n\t}\n\tvar result NodeResponse\n\tswitch {\n\tcase workindex == 0:\n\t\tlog.Println(\"Requested URN not in ctsdata\")\n\t\tmessage := \"No results for \" + requestURN\n\t\tresult = NodeResponse{requestURN: []string{requestURN}, Status: \"Exception\", Message: message}\n\tdefault:\n\t\tvar RequestedWork Work\n\t\tRequestedWork.WorkURN = works[workindex-1]\n\t\trunindex := 0\n\t\tfor i := range workResult.URN {\n\t\t\tif strings.Join(strings.Split(workResult.URN[i], \":\")[0:4], \":\") == RequestedWork.WorkURN {\n\t\t\t\tRequestedWork.URN = append(RequestedWork.URN, workResult.URN[i])\n\t\t\t\tRequestedWork.Text = append(RequestedWork.Text, workResult.Text[i])\n\t\t\t\trunindex++\n\t\t\t\tRequestedWork.Index = append(RequestedWork.Index, runindex)\n\t\t\t}\n\t\t}\n\t\tresult = NodeResponse{requestURN: []string{requestURN},\n\t\t\tStatus: \"Success\",\n\t\t\tNodes: []Node{Node{URN: []string{RequestedWork.URN[len(RequestedWork.URN)-1]},\n\t\t\t\tText: []string{RequestedWork.Text[len(RequestedWork.URN)-1]},\n\t\t\t\tPrevious: []string{RequestedWork.URN[len(RequestedWork.URN)-2]},\n\t\t\t\tIndex: RequestedWork.Index[len(RequestedWork.URN)-1]}}}\n\t}\n\tresult.Service = \"/texts/last\"\n\tresultJSON, _ := json.Marshal(result)\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tif result.Status == \"Success\" {\n\t\tlog.Println(\"ReturnLast executed succesfully\")\n\t} else {\n\t\tlog.Println(\"ReturnLast executed with exeption\")\n\t}\n\tfmt.Fprintln(w, string(resultJSON))\n}", "title": "" }, { "docid": "e7e457733a277bc58980ac23bf488ea9", "score": "0.51256084", "text": "func (o *GetDockerRegistryWebhookNameUsingGETNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "7bc2a07029750f4c7036e5da58adb557", "score": "0.5118763", "text": "func Success(w http.ResponseWriter, statusCode int, data interface{}) {\n\tsendResponse(w, statusCode, data)\n}", "title": "" } ]
029d32f18fc7cb05c7f3baf6bb48959c
Set expiry ("exp") in the claims to some duration from the present time and return itself so it can be chained
[ { "docid": "0a9ca8e4834151c0b005939949a3e671", "score": "0.58882827", "text": "func (c Claims) SetExpiryIn(tm time.Duration) Claims {\n\tc[\"exp\"] = ExpireIn(tm)\n\treturn c\n}", "title": "" } ]
[ { "docid": "12a7bf95245de658d6516aa988a96858", "score": "0.70303977", "text": "func SetExpiry(claims map[string]interface{}, tm time.Time) {\n\tclaims[\"exp\"] = tm.UTC().Unix()\n}", "title": "" }, { "docid": "8719d42a60cf9de79552f9c1a13f59c0", "score": "0.6992323", "text": "func (c Claims) SetExpiry(tm time.Time) Claims {\n\tc[\"exp\"] = tm.UTC().Unix()\n\treturn c\n}", "title": "" }, { "docid": "13c742831ef31ce6b5bf693f55c4b709", "score": "0.6534611", "text": "func SetExpiryIn(claims map[string]interface{}, tm time.Duration) {\n\tclaims[\"exp\"] = ExpireIn(tm)\n}", "title": "" }, { "docid": "bab39b93a4c456aef7c773a04a2e65c9", "score": "0.6425499", "text": "func WithExpiry(expiry *jwt.NumericDate) NewOpt {\n\treturn issuer.WithExpiry(expiry)\n}", "title": "" }, { "docid": "01f3ddb83d53f42d40ddced12e5dd11d", "score": "0.631298", "text": "func (druo *DeviceRequestUpdateOne) SetExpiry(t time.Time) *DeviceRequestUpdateOne {\n\tdruo.mutation.SetExpiry(t)\n\treturn druo\n}", "title": "" }, { "docid": "fa8dc0796690566f6ef2a87ad6d6f1a9", "score": "0.62984097", "text": "func WithExpClaim(exp time.Time) ExtraClaim {\n\treturn func(token *jwt.Token) {\n\t\ttoken.Claims.(*MyClaims).ExpiresAt = exp.Unix()\n\t}\n}", "title": "" }, { "docid": "32a7fa84b06d48eddc393527bed98ede", "score": "0.6287545", "text": "func (f *Following) Expiry() time.Duration {\n\treturn f.expiry\n}", "title": "" }, { "docid": "cc8277e48ad40627553fd664a2e05b16", "score": "0.623087", "text": "func (dru *DeviceRequestUpdate) SetExpiry(t time.Time) *DeviceRequestUpdate {\n\tdru.mutation.SetExpiry(t)\n\treturn dru\n}", "title": "" }, { "docid": "dbdc8be1b4dd7efc78d98e6fc419486d", "score": "0.6102744", "text": "func (mt *mockTokenBuilder) SetExpiration(t time.Duration) {\n\tmt.SetExpirationFunc(t)\n}", "title": "" }, { "docid": "682dbff8d44f3daccfabca129261c428", "score": "0.60873485", "text": "func (t *JWTToken) SetExpireTime() error {\n\tparts := strings.Split(t.token, \".\")\n\tif len(parts) != 3 {\n\t\treturn errors.New(\"need jwt token\")\n\t}\n\tpayload := parts[1]\n\tif l := len(payload) % 4; l > 0 {\n\t\tpayload += strings.Repeat(\"=\", 4-l)\n\t}\n\tb, err := base64.URLEncoding.DecodeString(payload)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"decode jwt token error: %w\", err)\n\t}\n\tvar m map[string]interface{}\n\tif err := json.Unmarshal(b, &m); err != nil {\n\t\treturn fmt.Errorf(\"unmarshal decode jwt token error: %w\", err)\n\t}\n\tif ts, ok := m[\"exp\"]; ok {\n\t\tt.expiredAt = int64(ts.(float64))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "206641f8fc34eb4af37275fe570f9e8c", "score": "0.60501856", "text": "func (c CreateLeaseReq) ExpirationTime(start time.Time) time.Time {\n\treturn start.Add(c.MaxTimeDur())\n}", "title": "" }, { "docid": "1e54ef0a5bf0a562afb52c5d298217ad", "score": "0.6039473", "text": "func (a *Account) setExpirationTimer(d time.Duration) {\n\ta.etmr = time.AfterFunc(d, a.expiredTimeout)\n}", "title": "" }, { "docid": "d14eed6332b02dfb3954901b317772c5", "score": "0.60199064", "text": "func Expires(dur time.Duration) func(*Jeff) {\n\treturn func(j *Jeff) {\n\t\tj.expires = dur\n\t}\n}", "title": "" }, { "docid": "7b2bc925dd4d0f93b3d3139670cd1de1", "score": "0.5965712", "text": "func WithExpiration(duration time.Duration) TokenOption {\n\treturn func(token jwt.Token) error {\n\t\treturn token.Set(jwt.ExpirationKey, time.Now().Add(duration))\n\t}\n}", "title": "" }, { "docid": "57cd2d64741b68a3c3229d342bb88719", "score": "0.5937418", "text": "func (m *Metadata) Expiry() time.Time {\n\tif m.Expires == nil {\n\t\treturn time.Time{}\n\t}\n\treturn *m.Expires\n}", "title": "" }, { "docid": "0ce36dde5f471cf907b24bce4d0150ee", "score": "0.59271866", "text": "func (c *InstallerV1) Expiry() time.Time {\n\treturn c.Metadata.Expiry()\n}", "title": "" }, { "docid": "7ffaf95898976616d982fe23e06ed136", "score": "0.59079796", "text": "func ExpireIn(tm time.Duration) int64 {\n\treturn EpochNow() + int64(tm.Seconds())\n}", "title": "" }, { "docid": "7ffaf95898976616d982fe23e06ed136", "score": "0.59079796", "text": "func ExpireIn(tm time.Duration) int64 {\n\treturn EpochNow() + int64(tm.Seconds())\n}", "title": "" }, { "docid": "bcf64fbae8236b55decb749dcc757792", "score": "0.5888444", "text": "func Expiry(v time.Time) predicate.AuthCode {\n\treturn predicate.AuthCode(sql.FieldEQ(FieldExpiry, v))\n}", "title": "" }, { "docid": "1d066ad7c2c0b762ae4a4d1a2cd6d9e7", "score": "0.585113", "text": "func WithExpiry(expiry time.Duration) Option {\n\treturn OptionFunc(func(m *Mutex) {\n\t\tm.expiry = expiry\n\t})\n}", "title": "" }, { "docid": "c1135a2269b9c808cbe3d66b7ca690fb", "score": "0.5834883", "text": "func (_options *CreateClaimRuleOptions) SetExpiration(expiration int64) *CreateClaimRuleOptions {\n\t_options.Expiration = core.Int64Ptr(expiration)\n\treturn _options\n}", "title": "" }, { "docid": "b656e1c425770f1fcd2c9ef2059b986a", "score": "0.58149725", "text": "func (ca *CookieAuth) SetExpiry(expiry time.Duration) *CookieAuth {\n\tca.mut.Lock()\n\tca.expiry = expiry\n\tca.mut.Unlock()\n\treturn ca\n}", "title": "" }, { "docid": "97eecf8c22221b10659aafb89c7514b4", "score": "0.5807262", "text": "func (n *Notary) expirationOf(ic *interop.Context, args []stackitem.Item) stackitem.Item {\n\tacc := toUint160(args[0])\n\treturn stackitem.Make(n.ExpirationOf(ic.DAO, acc))\n}", "title": "" }, { "docid": "2a990b4dcb9a6f627e4928b209da8933", "score": "0.5772608", "text": "func (t *Topo) Expiry() time.Time {\n\tif t.TTL == 0 {\n\t\treturn time.Time{}\n\t}\n\treturn t.Timestamp.Add(t.TTL)\n}", "title": "" }, { "docid": "bc744734cd34f46698411cf40445e71e", "score": "0.5766119", "text": "func (d *Authorize) ExpireAt() time.Time {\n\treturn d.CreatedAt.Add(time.Duration(d.ExpiresIn) * time.Second)\n}", "title": "" }, { "docid": "d6f231d09ad92b7c8d7c4e8e0a6cef36", "score": "0.5764972", "text": "func (_options *UpdateClaimRuleOptions) SetExpiration(expiration int64) *UpdateClaimRuleOptions {\n\t_options.Expiration = core.Int64Ptr(expiration)\n\treturn _options\n}", "title": "" }, { "docid": "a9afba932d9fc607567f41f5af7c13f5", "score": "0.57172614", "text": "func (t *TokenV2) Expiry() time.Time {\n\treturn t.Metadata.Expiry()\n}", "title": "" }, { "docid": "71f4cc93c7babb5fc20beb099638de8e", "score": "0.569648", "text": "func (o *SAMLConnectorV2) Expiry() time.Time {\n\treturn o.Metadata.Expiry()\n}", "title": "" }, { "docid": "4ccc09f73eb0bb607c3f15ab9445fe5a", "score": "0.56863064", "text": "func (s *Spec) expiry(current Index) (expiry *Expiry, err error) {\n\tstate, has := s.states[current]\n\tif !has {\n\t\terr = ErrUnknownState(current)\n\t\treturn\n\t}\n\tif state.TTL.TTL > 0 {\n\t\texpiry = &state.TTL\n\t}\n\treturn\n}", "title": "" }, { "docid": "0e2f3fc9f0e4defb48df423a4fd8d6a4", "score": "0.5672807", "text": "func (t *token) ExpiryTime() time.Time {\n\treturn t.Expiry\n}", "title": "" }, { "docid": "490b9e5bd6e05aa2d5578e501fbd1ed2", "score": "0.5672642", "text": "func (m *Metadata) Expiry() time.Time {\n\treturn m.Expires\n}", "title": "" }, { "docid": "92ae1178aad1fc984d86523a40942428", "score": "0.5670588", "text": "func (s *Client) SetWithExpiry(key string, value []byte, seconds int64) error {\n\t_, err := redis.String(s.conn.Do(\"SETEX\", key, seconds, value))\n\tif err != nil {\n\t\treturn status.Errorf(codes.Unavailable, \"%v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c71d2a142ec6d80e4239ffbdaafb77e3", "score": "0.56463397", "text": "func (m *ExpirationPattern) SetDuration(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n err := m.GetBackingStore().Set(\"duration\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0dfee749a8dd59a235fb86207e432a7c", "score": "0.5642127", "text": "func (e *Message) SetExpiry(t time.Time) {\n\te.expiresAt = t\n}", "title": "" }, { "docid": "67f752627d05d316f52417c306410060", "score": "0.5630918", "text": "func ExpandUserExpire(name string, m int) error {\n\to := orm.NewOrm()\n\n\tuser := new(User)\n\n\tqs := o.QueryTable(\"user\")\n\terr := qs.Filter(\"name\", name).One(user)\n\tif err == orm.ErrNoRows {\n\t\treturn err\n\t}\n\n\ttn := time.Now().UTC()\n\tte := user.Expire\n\tif tn.After(te) {\n\t\t// already expired, start from now\n\t\tuser.Expire = tn.AddDate(0, m, 0).UTC()\n\t\tuser.NextRefill = tn.AddDate(0, 1, 0).UTC()\n\t} else {\n\t\t// not expired yet, start from previous expiration\n\t\tuser.Expire = te.AddDate(0, m, 0).UTC()\n\t}\n\n\to.Update(user)\n\treturn nil\n}", "title": "" }, { "docid": "6e31697acb67dbac6ecd50048528b734", "score": "0.56285983", "text": "func (p Payload) ExpirationTime() uint64 {\n\treturn toUint64(p.exp())\n}", "title": "" }, { "docid": "c1904c1c3debbc604573395c152d33c7", "score": "0.56279117", "text": "func (m MapClaims) GetExpirationTime() (*NumericDate, error) {\n\treturn m.parseNumericDate(\"exp\")\n}", "title": "" }, { "docid": "84b6cdcfcdc7a1fbd9ca25d3be475aa9", "score": "0.5626106", "text": "func (user *User) ExpiryDate(now time.Time) time.Time {\n\tresult := user.ValidTo\n\tif !user.HasContactInfo() {\n\t\tif user.ValidFrom.IsZero() {\n\t\t\tlog.Println(\"No start-date for temp code.\")\n\t\t\treturn now.Add(-24 * time.Hour) // in the past\n\t\t}\n\t\tanonLimit := user.ValidFrom.Add(ValidityPeriodAnonymousCards)\n\t\tif result.IsZero() || anonLimit.Before(result) {\n\t\t\tresult = anonLimit\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "193667a5a3e822c5356339feb868b359", "score": "0.5605246", "text": "func (o *SAMLConnectorV2) SetExpiry(expires time.Time) {\n\to.Metadata.SetExpiry(expires)\n}", "title": "" }, { "docid": "f135655c786ad96ef62df25a3f0a7302", "score": "0.55991215", "text": "func (c *InstallerV1) SetExpiry(expires time.Time) {\n\tc.Metadata.SetExpiry(expires)\n}", "title": "" }, { "docid": "47e9c849dd8474c438d3812464f79497", "score": "0.5589146", "text": "func (m *Metadata) SetExpiry(expires time.Time) {\n\tm.Expires = expires\n}", "title": "" }, { "docid": "7b6189e067d0fc02c55e89ce90658142", "score": "0.55794585", "text": "func WithExpiry(expiry time.Duration) Option {\n\treturn func(m *Manager) {\n\t\tm.defaultExpiry = expiry\n\t}\n}", "title": "" }, { "docid": "4be57a96971ec6b869a40ea4067ff6f3", "score": "0.55328053", "text": "func (h *ResourceHeader) SetExpiry(t time.Time) {\n\th.Metadata.SetExpiry(t)\n}", "title": "" }, { "docid": "4be57a96971ec6b869a40ea4067ff6f3", "score": "0.55328053", "text": "func (h *ResourceHeader) SetExpiry(t time.Time) {\n\th.Metadata.SetExpiry(t)\n}", "title": "" }, { "docid": "114769cb4ad9873db133449e74c44d6c", "score": "0.55276185", "text": "func (m *AccessReviewHistoryInstance) SetExpirationDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {\n err := m.GetBackingStore().Set(\"expirationDateTime\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "eca5e65717a1bcc2fa6e26105b0b99d0", "score": "0.5520397", "text": "func (m *CloudPcDeviceImage) SetExpirationDate(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.DateOnly)() {\n err := m.GetBackingStore().Set(\"expirationDate\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "905f6affd8583ec7ed8100a5e87e76f6", "score": "0.55008924", "text": "func (s *Server) SetExpire(ctx context.Context, ex *pb.Expiration) (*pb.Null, error) {\n\tres, err := s.cache.Server.LeaseGrant(ctx, &etcdpb.LeaseGrantRequest{\n\t\tTTL: ex.Exp,\n\t})\n\tif err != nil && err.Error() == util.ErrKeyNotFound.Error() {\n\t\treturn null, util.ErrKeyNotFound\n\t} else if err != nil {\n\t\treturn null, err\n\t}\n\n\t_, err = s.cache.Server.Put(ctx, &etcdpb.PutRequest{\n\t\tKey: util.StringToBytes(ex.Key),\n\t\tLease: res.ID,\n\t})\n\n\treturn null, err\n}", "title": "" }, { "docid": "0ac316ddbcf7fb7194e12abc6241740e", "score": "0.54975057", "text": "func (m *ExpirationPattern) SetDuration(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n m.duration = value\n}", "title": "" }, { "docid": "4dd95686a787fa9d546dbea992bfa963", "score": "0.5483609", "text": "func ShiftExpiration(w http.ResponseWriter, r *http.Request) {\n\tDefault.ShiftExpiration(w, r)\n}", "title": "" }, { "docid": "180607522dff936ca9ac9a14f6345d27", "score": "0.54830307", "text": "func ExpiryEQ(v time.Time) predicate.AuthCode {\n\treturn predicate.AuthCode(sql.FieldEQ(FieldExpiry, v))\n}", "title": "" }, { "docid": "6e828b9ab8d1a4e58ce4511740d8dddf", "score": "0.54724944", "text": "func TestExpiration(t *testing.T) {\n\tc := testInit(t)\n\n\tconst (\n\t\tKey0 = \"zoo\"\n\t\tKey1 = \"foo\"\n\t\tKey2 = \"goo\"\n\t\tVal1 = \"moo\"\n\t\tVal2 = \"bar\"\n\t)\n\n\t// no expiration, should last forever...\n\t_, err := c.Set(Key0, Val1, 0, 0, 0)\n\tassertEqualf(t, mcNil, err, \"shouldn't be an error: %v\", err)\n\n\tv, _, _, err := c.Get(Key0)\n\tassertEqualf(t, mcNil, err, \"shouldn't be an error: %v\", err)\n\tassertEqualf(t, Val1, v, \"wrong value: %v\", v)\n\n\t// 1 second expiration...\n\t_, err = c.Set(Key1, Val1, 0, 1, 0)\n\tassertEqualf(t, mcNil, err, \"shouldn't be an error: %v\", err)\n\ttime.Sleep(1100 * time.Millisecond)\n\t_, _, _, err = c.Get(Key1)\n\tassertEqualf(t, ErrNotFound, err, \"shouldn't be in cache anymore: %v\", err)\n\n\tv, _, _, err = c.Get(Key0)\n\tassertEqualf(t, mcNil, err, \"shouldn't be an error: %v\", err)\n\tassertEqualf(t, Val1, v, \"wrong value: %v\", v)\n}", "title": "" }, { "docid": "f62009803e89a1cf3b439530012f6424", "score": "0.54661494", "text": "func (t *TokenV2) SetExpiry(expires time.Time) {\n\tt.Metadata.SetExpiry(expires)\n}", "title": "" }, { "docid": "5cf34957de51d51632d0b983aaf0353c", "score": "0.5442462", "text": "func (t *Token) SetTimes(iat time.Time) *Token {\n\n\tt.Claims.StandardClaims.IssuedAt = iat.Unix()\n\tt.Claims.StandardClaims.ExpiresAt = iat.Add(time.Hour * time.Duration(t.ttlHours)).Unix()\n\n\t// Set Unix dates at root of struct for convenience (??)\n\tt.IssuedAt = time.Unix(int64(t.Claims.StandardClaims.IssuedAt), 0)\n\tt.ExpiresAt = time.Unix(int64(t.Claims.StandardClaims.ExpiresAt), 0)\n\n\treturn t\n}", "title": "" }, { "docid": "2d26977020e66fed200521b61641a2e3", "score": "0.5442068", "text": "func (l *LNCSessionsStore) SetExpiry(ctx context.Context,\n\tpassphraseEntropy []byte, expiry time.Time) error {\n\n\tvar writeTxOpts LNCSessionsDBTxOptions\n\terr := l.db.ExecTx(ctx, &writeTxOpts, func(tx LNCSessionsDB) error {\n\t\tparams := SetExpiryParams{\n\t\t\tPassphraseEntropy: passphraseEntropy,\n\t\t\tExpiry: sql.NullTime{\n\t\t\t\tTime: expiry,\n\t\t\t\tValid: true,\n\t\t\t},\n\t\t}\n\n\t\treturn tx.SetExpiry(ctx, params)\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to set expiry time to session(%x): \"+\n\t\t\t\"%w\", passphraseEntropy, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d7b0a50f3f9ba6a5ba12bd636aba1abb", "score": "0.5438908", "text": "func (r *EmptyResource) Expiry() time.Time {\n\treturn r.Metadata.Expiry()\n}", "title": "" }, { "docid": "36a2d76b4ad57c32d98184be3d616ed8", "score": "0.54266226", "text": "func (r *redisManager) setWithExpiration(key string, value string, expiry time.Duration) error {\n\terr := r.Client.Set(key, value, expiry*time.Second).Err()\n\treturn err\n}", "title": "" }, { "docid": "c22ee817258ff27eb8b0d1879d41f892", "score": "0.5424295", "text": "func (m *TenantAllowOrBlockListAction) SetExpirationDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {\n err := m.GetBackingStore().Set(\"expirationDateTime\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "2c24d9cdce1f10a33c0e43208bd95803", "score": "0.5423157", "text": "func (this *WhitelistInstance) getExpiryDate(t time.Time, timeToBeAdded time.Duration) (expiryDatetime time.Time) {\n\ttruncatedCreationTime := t.Truncate(24 * time.Hour)\n\tdurationFromStartOfDayUntilCreation := t.Sub(truncatedCreationTime)\n\tsecondsToBeAdded := int(t.Add(timeToBeAdded).Sub(truncatedCreationTime).Seconds())\n\twhitelistAdjustedDurationToBeAdded := time.Duration(secondsToBeAdded%this.whitelistSecondCount) * time.Second\n\n\tfirstInterval := true\n\tvar projectedCreation time.Time\n\tfor whitelistAdjustedDurationToBeAdded.Seconds() > 0 {\n\t\tthis.whitelistHours.IntervalsBetween(whitelistStart, whitelistAfterTwoDaysStart, func(start, end time.Time) bool {\n\t\t\tintervalDuration := end.Sub(start)\n\t\t\tif firstInterval {\n\t\t\t\t// If the current interval ends before the creation, skip for now.\n\t\t\t\tprojectedCreation = start.Truncate(24 * time.Hour).Add(durationFromStartOfDayUntilCreation)\n\t\t\t\tif projectedCreation.After(end) {\n\t\t\t\t\t// And adjust duration.\n\t\t\t\t\tdurationFromStartOfDayUntilCreation = durationFromStartOfDayUntilCreation - intervalDuration\n\t\t\t\t\twhitelistAdjustedDurationToBeAdded = whitelistAdjustedDurationToBeAdded - intervalDuration\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If creation is in the middle of the current interval, start with the creation.\n\t\t\tif projectedCreation.After(start) {\n\t\t\t\twhitelistAdjustedDurationToBeAdded = whitelistAdjustedDurationToBeAdded - projectedCreation.Sub(start)\n\t\t\t\tstart = projectedCreation\n\t\t\t}\n\n\t\t\t// Check if we have reached the wanted time.\n\t\t\tif whitelistAdjustedDurationToBeAdded < intervalDuration {\n\t\t\t\texpiryDatetime = truncatedCreationTime.Add(start.Add(whitelistAdjustedDurationToBeAdded).Sub(whitelistStart))\n\t\t\t}\n\n\t\t\t// Subtract from how much we want to add.\n\t\t\twhitelistAdjustedDurationToBeAdded = time.Duration(whitelistAdjustedDurationToBeAdded.Seconds()-intervalDuration.Seconds()) * time.Second\n\t\t\tif whitelistAdjustedDurationToBeAdded.Seconds() < 0 {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\treturn true\n\t\t})\n\n\t\t// Just a safeguard, this loop should never run more than twice.\n\t\tif !firstInterval {\n\t\t\tlog.Warn().Msgf(\"whitelist loop wants to run a third time\")\n\t\t\tbreak\n\t\t}\n\n\t\tfirstInterval = false\n\t}\n\treturn expiryDatetime\n}", "title": "" }, { "docid": "3e6b0115bde41dab35dbe7ff2bf2ec7b", "score": "0.5419818", "text": "func (s *subscription) RenewExpiresAt() {\n\ts.expiresAt = time.Now().Add(subscriptionTTL)\n}", "title": "" }, { "docid": "88084bbdb37994942909814340d8d0fa", "score": "0.54197824", "text": "func (w *WhitelistInstance) getExpiryDate(t time.Time, timeToBeAdded time.Duration) (expiryDatetime time.Time) {\n\ttruncatedCreationTime := t.Truncate(24 * time.Hour)\n\tprojectedCreation := whitelistStart.Add(t.Sub(truncatedCreationTime))\n\n\tfirst := true\n\tfor timeToBeAdded > 0 {\n\t\t// For all whitelisted intervals...\n\t\tw.whitelistHours.IntervalsBetween(whitelistStart, whitelistEnd, func(start, end time.Time) bool {\n\t\t\t// For the first iteration only...\n\t\t\tif first {\n\t\t\t\t// If the current interval ends before the creation...\n\t\t\t\tif end.Before(projectedCreation) {\n\t\t\t\t\t// Skip for now.\n\t\t\t\t\treturn true\n\t\t\t\t}\n\n\t\t\t\t// If creation is in the middle of the current interval...\n\t\t\t\tif start.Before(projectedCreation) {\n\t\t\t\t\t// Start with creation.\n\t\t\t\t\tstart = projectedCreation\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If expiry time has been reached...\n\t\t\tintervalDuration := end.Sub(start)\n\t\t\tif timeToBeAdded <= intervalDuration {\n\t\t\t\t// This is it, project it back to real time.\n\t\t\t\texpiryDatetime = truncatedCreationTime.Add(start.Add(timeToBeAdded).Sub(whitelistStart))\n\t\t\t\t// But if expiryDatetime is before creation...\n\t\t\t\tfmt.Println(\"before creation? \" + expiryDatetime.String() + \" \" + t.String())\n\t\t\t\tif expiryDatetime.Before(t) {\n\t\t\t\t\t// Simply add 24h.\n\t\t\t\t\texpiryDatetime = expiryDatetime.Add(24 * time.Hour)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Consume this interval.\n\t\t\ttimeToBeAdded -= intervalDuration\n\n\t\t\t// Do we want another interval?\n\t\t\treturn timeToBeAdded > 0\n\t\t})\n\n\t\tfirst = false\n\t}\n\treturn expiryDatetime\n}", "title": "" }, { "docid": "6516d2bf93c1b3a9892d1b28034fd788", "score": "0.541639", "text": "func (tm *TimedMap) setExpires(key interface{}, sec int, d time.Duration) error {\n\tv := tm.get(key, sec)\n\tif v == nil {\n\t\treturn ErrKeyNotFound\n\t}\n\tv.expires = time.Now().Add(d)\n\treturn nil\n}", "title": "" }, { "docid": "9bdc0ff5252343080da53c7f067cb7ee", "score": "0.54094404", "text": "func (c *UIConfigV1) Expiry() time.Time {\n\treturn c.Metadata.Expiry()\n}", "title": "" }, { "docid": "c034c4f359d6e4293d20923471123beb", "score": "0.5396115", "text": "func UpdateExpiration(w http.ResponseWriter, r *http.Request, expires time.Duration) {\n\tDefault.UpdateExpiration(w, r, expires)\n}", "title": "" }, { "docid": "6e8a3d7d133ce48bd1af7a8fae8f5e1a", "score": "0.53898174", "text": "func (s *Sessions) ShiftExpiration(w http.ResponseWriter, r *http.Request) {\n\ts.UpdateExpiration(w, r, s.config.Expires)\n}", "title": "" }, { "docid": "a74a2e53652b99f8064105d97c198f6a", "score": "0.53883433", "text": "func (t *transport) SetExpire(expire time.Duration) { t.expire = expire }", "title": "" }, { "docid": "d7ab41075d4012fa5e13e2ba716b1ff2", "score": "0.53843623", "text": "func (this Key) ExpireIn(duration time.Duration) <-chan bool {\n\t//if the time to expire is in a time range larger than an hour, the number of milliseconds probably is not particularly important, so we can use a regular expire\n\tif duration >= time.Hour {\n\t\treturn BoolCommand(this, this.args(\"expire\", itoa(int(duration/time.Second)))...)\n\t}\n\t//otherwise use pexpire to get down to the nearest millisecond\n\treturn BoolCommand(this, this.args(\"pexpire\", itoa(int(duration/time.Millisecond)))...)\n}", "title": "" }, { "docid": "00ce26cae766658cf9f8c27b4e164c20", "score": "0.5383537", "text": "func SetIssuedNow(claims map[string]interface{}) {\n\tclaims[\"iat\"] = EpochNow()\n}", "title": "" }, { "docid": "a0d6e4c5ffd9df2188163f52a8201b61", "score": "0.5378624", "text": "func (a *Account) checkExpiration(claims *jwt.ClaimsData) {\n\ta.mu.Lock()\n\tdefer a.mu.Unlock()\n\n\ta.clearExpirationTimer()\n\tif claims.Expires == 0 {\n\t\ta.expired = false\n\t\treturn\n\t}\n\ttn := time.Now().Unix()\n\tif claims.Expires <= tn {\n\t\ta.expired = true\n\t\treturn\n\t}\n\texpiresAt := time.Duration(claims.Expires - tn)\n\ta.setExpirationTimer(expiresAt * time.Second)\n\ta.expired = false\n}", "title": "" }, { "docid": "b2be9b61fad400847a0234a90b5942a9", "score": "0.53773546", "text": "func (ls *Lease) ExpirationTime() time.Time {\n\treturn ls.Renewed.Add(ls.Duration)\n}", "title": "" }, { "docid": "670579cc445b396f679b1bac11a84b5f", "score": "0.5369787", "text": "func (m *Metadata) SetExpiry(expires time.Time) {\n\tm.Expires = &expires\n}", "title": "" }, { "docid": "af953f5b37943df69aaf9aadbe1359f8", "score": "0.53649026", "text": "func (data *BasicAccessData) ExpiresAt() time.Time {\n\treturn data.GetCreatedAt().Add(time.Duration(data.GetExpiresIn()) * time.Second)\n}", "title": "" }, { "docid": "47f621eb9d0018474648a58aff94638b", "score": "0.5360182", "text": "func NewExpiration(month, day, year string) *Expiration {\n\te := &Expiration{\n\t\tDay: day,\n\t\tMonth: month,\n\t\tYear: year,\n\t}\n\te.setDate()\n\treturn e\n\n}", "title": "" }, { "docid": "a7a139d8ec8aa606abf5e69abf61d0e2", "score": "0.53525513", "text": "func (c *ServerContext) Expiry() time.Time {\n\treturn c.sctxt.Expiry()\n}", "title": "" }, { "docid": "fb7b5444e314ce1f0d413e6d74956542", "score": "0.53493667", "text": "func (fn ClaimerFunc) NewClaim() *adagio.Claim { return fn() }", "title": "" }, { "docid": "39ded783ee72dbcd170bea7ed38672f6", "score": "0.5341678", "text": "func (r *EmptyResource) SetExpiry(expires time.Time) {\n\tr.Metadata.SetExpiry(expires)\n}", "title": "" }, { "docid": "228a8d8ca2bc006977337d59be7a41b3", "score": "0.53308773", "text": "func (o ConsentOutput) ExpireTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Consent) pulumi.StringOutput { return v.ExpireTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "74002daab9280e6ac26c0936f213ecb7", "score": "0.53288454", "text": "func (_MicroPaymentChannel *MicroPaymentChannelCaller) Expiration(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _MicroPaymentChannel.contract.Call(opts, out, \"expiration\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "fed5622b0dac9586c212a62ad3e7900e", "score": "0.53187805", "text": "func (o SecretOutput) ExpireTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Secret) pulumi.StringOutput { return v.ExpireTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7dc768abba59971e9e28512aeb14428c", "score": "0.53103054", "text": "func WithExpiration(timeExpr int) SendOption {\n\treturn func(h http.Header) {\n\t\th.Set(\"apns-expiration\", strconv.Itoa(timeExpr))\n\t}\n}", "title": "" }, { "docid": "7dc768abba59971e9e28512aeb14428c", "score": "0.53103054", "text": "func WithExpiration(timeExpr int) SendOption {\n\treturn func(h http.Header) {\n\t\th.Set(\"apns-expiration\", strconv.Itoa(timeExpr))\n\t}\n}", "title": "" }, { "docid": "71e061159d59dfc2f28c047fe5eb5d59", "score": "0.5292696", "text": "func WithValidity(notBefore, expiration time.Time) Options {\n\treturn func(c *Claims) error {\n\t\tnow := time.Now().UTC()\n\t\tif expiration.Before(notBefore) {\n\t\t\treturn errors.Errorf(\"nbf < exp: nbf=%v, exp=%v\", notBefore, expiration)\n\t\t}\n\t\trequestedDelay := notBefore.Sub(now)\n\t\tif requestedDelay > MaxValidityDelay {\n\t\t\treturn errors.Errorf(\"requested validity delay is too long: 'requested validity delay'=%v, 'max validity delay'=%v\", requestedDelay, MaxValidityDelay)\n\t\t}\n\t\trequestedValidity := expiration.Sub(notBefore)\n\t\tif requestedValidity < MinValidity {\n\t\t\treturn errors.Errorf(\"requested token validity is too short: 'requested token validity'=%v, 'minimum token validity'=%v\", requestedValidity, MinValidity)\n\t\t} else if requestedValidity > MaxValidity {\n\t\t\treturn errors.Errorf(\"requested token validity is too long: 'requested token validity'=%v, 'maximum token validity'=%v\", requestedValidity, MaxValidity)\n\t\t}\n\t\tc.NotBefore = jose.NewNumericDate(notBefore)\n\t\tc.Expiry = jose.NewNumericDate(expiration)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "873032cf184e16fe642735db6e2575fe", "score": "0.52853256", "text": "func IncreaseExpirationTime(name string, configDir string, client *dnmc.Client) error {\n\tconfigDir, client, err := dirAndClient(configDir, client)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to load config file: %v\", err)\n\t}\n\tsk, _, err := LoadLocalProfile(name, configDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\tprofile, err := client.Lookup(name)\n\tif err != nil && !dnmc.IsErrOutOfDate(err) {\n\t\treturn err\n\t}\n\tversion := profile.GetVersion()\n\tprofile.Version = new(uint64)\n\t*profile.Version = version + 1\n\n\texpire := uint64(time.Now().Add(MAX_VALIDITY_PERIOD*time.Second - 24*time.Hour).Unix())\n\tif profile.GetExpirationTime() < expire {\n\t\tprofile.ExpirationTime = &expire\n\t}\n\tif err := client.Modify(sk, name, profile); err != nil {\n\t\treturn err\n\t}\n\treturn ioutil.WriteFile(filepath.Join(configDir, filename(name), \"profile\"), PBEncode(profile), 0600)\n}", "title": "" }, { "docid": "24960a0fa57c9b288c334a2699dafaa3", "score": "0.52821636", "text": "func (m *SessionToken_Body_TokenLifetime) SetExp(v uint64) {\n\tif m != nil {\n\t\tm.Exp = v\n\t}\n}", "title": "" }, { "docid": "9f41743228598769f9eef33002d11a4c", "score": "0.5275758", "text": "func (subscription *OutlookSubscription) setTime() {\n\texpiration, err := time.Parse(time.RFC3339Nano, subscription.ExpirationDateTime)\n\tif err != nil {\n\t\tsubscription.expirationDate = time.Now().Add(time.Hour * 24 * 7)\n\t\treturn\n\t}\n\tsubscription.expirationDate = expiration\n}", "title": "" }, { "docid": "73309b6af6dcabdfceced27a320f71ca", "score": "0.5272918", "text": "func newExpirationInfo(name string, cert *x509.Certificate, externallyManaged bool) *ExpirationInfo {\n\treturn &ExpirationInfo{\n\t\tName: name,\n\t\tExpirationDate: cert.NotAfter,\n\t\tExternallyManaged: externallyManaged,\n\t}\n}", "title": "" }, { "docid": "8896407ded7698d6dea5dc1a5e05f9f9", "score": "0.5265236", "text": "func (rc *Ctx) ExtendCookieByDuration(name string, path string, duration time.Duration) {\n\tc := rc.Cookie(name)\n\tif c == nil {\n\t\treturn\n\t}\n\tc.Path = path\n\tif c.Expires.IsZero() {\n\t\tc.Expires = time.Now().UTC().Add(duration)\n\t} else {\n\t\tc.Expires = c.Expires.Add(duration)\n\t}\n\thttp.SetCookie(rc.Response, c)\n}", "title": "" }, { "docid": "7347e2e294effc2db6ee23d06ddfc276", "score": "0.52613574", "text": "func (r ExpiryRecord) TTL(now time.Time) (time.Duration, error) {\n\tif r.HasExpiry() {\n\t\tttl := r.Expiry.Time().Sub(now)\n\t\tif ttl < time.Duration(time.Second) {\n\t\t\t// Technically, we could get back a 0 or less Duration - but 0 is \"no expiry\"\n\t\t\tttl = time.Duration(time.Second)\n\t\t}\n\t\treturn ttl, nil\n\t}\n\t// No expiry is a 0 TTL\n\treturn 0, cache.ErrNoExpiry\n}", "title": "" }, { "docid": "f36aae3e815ccf0833371aa1a65b8c24", "score": "0.52592826", "text": "func (_MicroPaymentChannel *MicroPaymentChannelCallerSession) Expiration() (*big.Int, error) {\n\treturn _MicroPaymentChannel.Contract.Expiration(&_MicroPaymentChannel.CallOpts)\n}", "title": "" }, { "docid": "4f98504a5a00184e829b27eb84dcef3b", "score": "0.52570933", "text": "func at(t time.Time, f func()) {\n\tjwt.TimeFunc = func() time.Time {\n\t\treturn t\n\t}\n\tf()\n\tjwt.TimeFunc = time.Now\n}", "title": "" }, { "docid": "4f98504a5a00184e829b27eb84dcef3b", "score": "0.52570933", "text": "func at(t time.Time, f func()) {\n\tjwt.TimeFunc = func() time.Time {\n\t\treturn t\n\t}\n\tf()\n\tjwt.TimeFunc = time.Now\n}", "title": "" }, { "docid": "382b92bd7b2980f33b708f0954cd85cd", "score": "0.5251082", "text": "func (_MicroPaymentChannel *MicroPaymentChannelSession) Expiration() (*big.Int, error) {\n\treturn _MicroPaymentChannel.Contract.Expiration(&_MicroPaymentChannel.CallOpts)\n}", "title": "" }, { "docid": "8e1cb4e1a287101a854b005cc2429490", "score": "0.5226182", "text": "func (h *ResourceHeader) Expiry() time.Time {\n\treturn h.Metadata.Expiry()\n}", "title": "" }, { "docid": "8e1cb4e1a287101a854b005cc2429490", "score": "0.5226182", "text": "func (h *ResourceHeader) Expiry() time.Time {\n\treturn h.Metadata.Expiry()\n}", "title": "" }, { "docid": "f7164ea479cf296af341afa6291bbac3", "score": "0.52072847", "text": "func ExpiryGTE(v time.Time) predicate.AuthCode {\n\treturn predicate.AuthCode(sql.FieldGTE(FieldExpiry, v))\n}", "title": "" }, { "docid": "80141080e31962f3518ab83047f1e444", "score": "0.5199727", "text": "func (dbi *DbItem) expiresAt() time.Time {\n\tif dbi.opts == nil || !dbi.opts.ex {\n\t\treturn maxTime\n\t}\n\treturn dbi.opts.exat\n}", "title": "" }, { "docid": "7c000431e3856e37a96023847c6d470d", "score": "0.51564234", "text": "func (m *EnterpriseCodeSigningCertificate) SetExpirationDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {\n err := m.GetBackingStore().Set(\"expirationDateTime\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1b496b5823ac12381be5b816e0f4d768", "score": "0.51394856", "text": "func getWithin(expires time.Time, within float64) time.Duration {\n\tleft := expires.UTC().Sub(time.Now().UTC()).Seconds()\n\tif left <= 0 {\n\t\treturn time.Duration(0)\n\t}\n\tseconds := int(left * within)\n\n\treturn time.Duration(seconds) * time.Second\n}", "title": "" }, { "docid": "890165f00b3d59e2233ee8ed09c23dcf", "score": "0.5139204", "text": "func (i *Item) SetExpire(ttl int64) {\n\tif ttl == 0 {\n\t\treturn\n\t}\n\ti.ExpiredAt = i.CreatedAt + ttl*int64(time.Millisecond)\n}", "title": "" }, { "docid": "603969f77c83e3b590e5ffbd984d417d", "score": "0.5131435", "text": "func (c *ClientContext) Expiry() time.Time {\n\treturn c.sctxt.Expiry()\n}", "title": "" }, { "docid": "9419f1573ceb24246205a1ad91b46e01", "score": "0.511859", "text": "func (item *Item[K, V]) ExpiresAt() time.Time {\n\titem.mu.RLock()\n\tdefer item.mu.RUnlock()\n\n\treturn item.expiresAt\n}", "title": "" } ]
d9d9ee061c7690362b533e5d8a2f71e0
Call is a single request handler called via client.Call or the generated client code
[ { "docid": "9a2b3eba13c356c89993447926d0c7eb", "score": "0.0", "text": "func (e *GetUserInfo) Call(ctx context.Context, req *getUserInfo.Request, rsp *getUserInfo.Response) error {\n\tdb, err := model.InitDb()\n\tif err != nil {\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(utils.RECODE_DBERR)\n\t\treturn nil\n\t}\n\tuser, err := model.ObtainUserInfo(db, req.Name)\n\tif err != nil {\n\t\trsp.Errno = utils.RECODE_SESSIONERR\n\t\trsp.Errmsg = utils.RecodeText(utils.RECODE_SESSIONERR)\n\t\treturn nil\n\t}\n\tvar userInfo getUserInfo.UserInfo\n\tuserInfo.UserId = int32(user.ID)\n\tuserInfo.Name = user.Name\n\tuserInfo.Mobile = user.Mobile\n\tuserInfo.RealName = user.Real_name\n\tuserInfo.IdCard=user.Id_card\n\tuserInfo.AvatarUrl = user.Avatar_url\n\trsp.Errno = utils.RECODE_OK\n\trsp.Errmsg = utils.RecodeText(utils.RECODE_OK)\n\trsp.Data = &userInfo\n\treturn nil\n}", "title": "" } ]
[ { "docid": "0f0eca421e98469b37dcd038fc922f1c", "score": "0.7263869", "text": "func (ch *Client) Call(ctx context.Context, request *ua.CallRequest) (*ua.CallResponse, error) {\n\tresponse, err := ch.request(ctx, request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn response.(*ua.CallResponse), nil\n}", "title": "" }, { "docid": "eb0c6ec31b3d7af30f037ebedd3a5d9e", "score": "0.7225626", "text": "func (s *Server) Call(call *callInfo, res chan *Response) {\n\tresponse := Response{ID: call.ID}\n\n\tlog.Debugf(\"Call %s.%s\", call.service, call.method)\n\tservice, ok := s.services[call.service]\n\tif !ok {\n\t\tresponse.Error = \"Unknown service\"\n\t} else {\n\t\tservice.Call(call, &response)\n\t}\n\n\tres <- &response\n}", "title": "" }, { "docid": "bca8dfa31fb8822fcf3c2810060a6d0c", "score": "0.7158534", "text": "func (e *Protocol) Call(ctx context.Context, req *protocol.Request, rsp *protocol.Response) error {\n\tlog.Info(\"Received protocol.Call request\")\n\trsp.Msg = \"Hello \" + req.Name\n\treturn nil\n}", "title": "" }, { "docid": "c3f4cd44068d38938d7f800baaa54ce3", "score": "0.71448195", "text": "func (c *Client) Call(p string, req, resp interface{}) error {\n\treturn c.JSONCall(p, req, resp)\n}", "title": "" }, { "docid": "086c782e0c098c4babaa8467cd46caed", "score": "0.708219", "text": "func (client *Client) Call(serviceMethod string, args interface{}, reply interface{}) error {\n\tcall := <-client.Go(serviceMethod, args, reply, make(chan *Call, 1)).Done\n\treturn call.Error\n}", "title": "" }, { "docid": "dbe5f3a00d77aa7c70d50fb2813c68e7", "score": "0.7020282", "text": "func (c *Client) Call(\n\tdest peer.ID,\n\tsvcName, svcMethod string,\n\targs, reply interface{},\n) error {\n\tctx := context.Background()\n\treturn c.CallContext(ctx, dest, svcName, svcMethod, args, reply)\n}", "title": "" }, { "docid": "3f3d0dc4555fd31a342cc5e3f4a5312e", "score": "0.7004657", "text": "func (client *Client) Call(ctx context.Context, serviceMethod string, args interface{}, reply interface{}) error {\n\tcall := client.Go(serviceMethod, args, reply, make(chan *Call, 1))\n\tselect {\n\tcase <-ctx.Done():\n\t\tclient.removeCall(call.Seq)\n\t\treturn errors.New(\"rpc: Call: \" + ctx.Err().Error())\n\tcase <-call.Done:\n\t\treturn call.Error\n\t}\n}", "title": "" }, { "docid": "1d16729482a8952524d45e6a1265221c", "score": "0.6987198", "text": "func (cli *Client) Call(funcname string, args ...interface{}) (Body, error) {\n\tn := cli.prepareResp()\n\tv := []interface{}{\"call\", funcname, args, n}\n\tif err := json.NewEncoder(cli.rw).Encode(v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn cli.waitResp(n)\n}", "title": "" }, { "docid": "8298d2d698465175d4b14ce5f592a105", "score": "0.6986929", "text": "func (rc *RPCClient) Call(method string, args, reply interface{}) error {\n\treturn rc.Client.Call(rpcPrefix+\".\"+method, args, reply)\n}", "title": "" }, { "docid": "4c8653acc7cc7cc1ca9945e01e8af87e", "score": "0.6982092", "text": "func (c *RecordedClient) Call(ctx context.Context, method string, args, result thrift.TStruct) error {\n\tc.calls = append(c.calls, Call{\n\t\tCtx: ctx,\n\t\tMethod: method,\n\t\targs: args,\n\t\tresult: result,\n\t})\n\tif c.client != nil {\n\t\treturn c.client.Call(ctx, method, args, result)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ee057173948cabdbdd74e5efc27f50b2", "score": "0.695225", "text": "func (this *Client) Call(service, method string, args interface{}, reply interface{}) *Error {\n\tserverAddress, err := this.getAddress()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn this.CallWithAddress(serverAddress, service, method, args, reply)\n}", "title": "" }, { "docid": "b7f70a516c19605afd32f41a561ab4dc", "score": "0.69513756", "text": "func (s *Protocol) Call(serviceMethod string, args interface{}, reply interface{}) error {\n\tcall := <-s.Go(serviceMethod, args, reply, make(chan *Call, 1)).Done\n\treturn call.Error\n}", "title": "" }, { "docid": "4e6acba74dc97397d03069a27fd40421", "score": "0.6930578", "text": "func (c *Backend) Call(ctx context.Context, method, path, key string, requestBody, responseBody any) error {\n\treturn c.call(ctx, method, path, key, requestBody, responseBody)\n}", "title": "" }, { "docid": "d8ff97f189fd9b8c9a3cc6bb1375c01f", "score": "0.689986", "text": "func (c *Client) Call(ctx context.Context, addr string, inv *invocation.Invocation, rsp interface{}) error {\n\tvar err error\n\treqSend, err := invocation2HttpRequest(inv)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, ok := rsp.(*Response)\n\tif !ok {\n\t\treturn ErrInvalidResp\n\t}\n\n\tc.contextToHeader(ctx, reqSend)\n\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\tif c.opts.TLSConfig != nil {\n\t\treqSend.Req.URL.Scheme = SchemaHTTPS\n\t} else {\n\t\treqSend.Req.URL.Scheme = SchemaHTTP\n\t}\n\tif addr != \"\" {\n\t\treqSend.Req.URL.Host = addr\n\t}\n\n\t//increase the max connection per host to prevent error \"no free connection available\" error while sending more requests.\n\tc.c.Transport.(*http.Transport).MaxIdleConnsPerHost = 512 * 20\n\n\terrChan := make(chan error, 1)\n\tgo func() { errChan <- c.Do(reqSend, resp) }()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\terr = ErrCanceled\n\tcase err = <-errChan:\n\t}\n\treturn c.failure2Error(err, resp, addr)\n}", "title": "" }, { "docid": "df1619ef2c14b59b72cb95581a0a13bd", "score": "0.68902725", "text": "func (s *tInvoker) Call(msg invoke.Message) error {\n\treturn s.Handler.Call(msg)\n}", "title": "" }, { "docid": "3603fdbcefb8174282baa3a2af1ad0a3", "score": "0.68774927", "text": "func GetCall(w rest.ResponseWriter, r *rest.Request) {\n\t// Get the number the client wants to call\n\tnumber := r.PathParam(\"number\")\n\tlog.Println(\"Will initiate call with number:\", number)\n\t// Create the ClientMakeCall struct which hold the number to call and\n\t// the channel which will return the lock on the call\n\tmakeCall := &ClientMakeCall{\n\t\tLock: make(chan string, 1),\n\t\tNumber: number,\n\t}\n\t// Request that the call be made\n\tOp.MakeCall <- makeCall\n\t// Once the call is made we will have the lock\n\tlock := <-makeCall.Lock\n\t// Send the client the lock so they can end teh call if they wish\n\tw.WriteJson(api.ClientInCall{\n\t\tNumber: number,\n\t\tLock: lock,\n\t})\n\treturn\n}", "title": "" }, { "docid": "3ab816bdc0fb1b1c99c1cbe84932701c", "score": "0.68471694", "text": "func (c *ClientBase) Call(ctx context.Context, caller func(client interface{}) (interface{}, error)) (interface{}, error) {\n\tif !funcutil.CheckCtxValid(ctx) {\n\t\treturn nil, ctx.Err()\n\t}\n\n\tret, err := c.callOnce(ctx, caller)\n\tif err != nil {\n\t\ttraceErr := fmt.Errorf(\"err: %s\\n, %s\", err.Error(), trace.StackTrace())\n\t\tlog.Error(c.GetRole()+\" ClientBase Call grpc first call get error \", zap.Error(traceErr))\n\t\treturn nil, traceErr\n\t}\n\treturn ret, err\n}", "title": "" }, { "docid": "ff2f696002b06763ff03a7eba3e702ec", "score": "0.68449974", "text": "func (c *Client) Call(method string, args interface{}, result interface{}) error {\n\treturn c.CallWithContext(context.Background(), method, args, result)\n}", "title": "" }, { "docid": "680a0731d61da78d3985bdea6b3a33f0", "score": "0.68380183", "text": "func (c *Client) Call(result interface{}, method string, args ...interface{}) error {\n\tctx := context.Background()\n\treturn c.CallContext(ctx, result, method, args...)\n}", "title": "" }, { "docid": "7e022456876c4ea1a5c99e39d32c8365", "score": "0.6807575", "text": "func (c *Client) Call(result interface{}, method string, args ...interface{}) error {\n\tctx := context.Background()\n\treturn c.CallContext(ctx, result, method, args)\n}", "title": "" }, { "docid": "292f940642bfadb35c3324e4bb92ed0a", "score": "0.6745846", "text": "func call(channelClient *channel.Client,request channel.Request) (channel.Response, error) {\n\tswitch request.Fcn {\n\tcase Query:\n\t\treturn channelClient.Query(request)\n\tcase Write:\n\t\treturn channelClient.Execute(request)\n\tcase History:\n\t\treturn channelClient.Query(request)\n\tcase GetByRange:\n\t\treturn channelClient.Query(request)\n\tcase Del:\n\t\treturn channelClient.Execute(request)\n\tcase QueryResult:\n\t\treturn channelClient.Query(request)\n\tcase QueryPrivateData:\n\t\treturn channelClient.Query(request)\n\tcase WritePrivateData:\n\t\treturn channelClient.Execute(request)\n\tcase GetPrivateByRange:\n\t\treturn channelClient.Query(request)\n\tcase WriteHouse:\n\t\treturn channelClient.Execute(request)\n\tcase SetPost:\n\t\treturn channelClient.Execute(request)\n\tcase TestCertificate:\n\t\treturn channelClient.Query(request)\n\t}\n\treturn channel.Response{}, errors.New(\"call unknown func: \" + request.Fcn)\n}", "title": "" }, { "docid": "a95f24650a4bf220d134d27d682f6613", "score": "0.67430425", "text": "func (e *ChatSrv) Call(ctx context.Context, req *chatsrv.Request, rsp *chatsrv.Response) error {\n\tlog.Info(\"Received ChatSrv.Call request\")\n\trsp.Msg = \"Hello \" + req.Name\n\treturn nil\n}", "title": "" }, { "docid": "5ea724271256d62df8846e2cde07a0ae", "score": "0.6721347", "text": "func Call(ctx context.Context, request RequestI, response interface{}, opts ...CallOption) *errorAVA.Error {\n\treturn DefaultClient.Call(ctx, request, response, opts...)\n}", "title": "" }, { "docid": "1e4f09b5f9af3748ee7099e17d3dccde", "score": "0.6718143", "text": "func Call(method string, h CallHandler) Option {\n\tif method != \"*\" && !isValidPart(method) {\n\t\tpanic(\"res: invalid method name: \" + method)\n\t}\n\treturn OptionFunc(func(hs *Handler) {\n\t\tif hs.Call == nil {\n\t\t\ths.Call = make(map[string]CallHandler)\n\t\t}\n\t\tif _, ok := hs.Call[method]; ok {\n\t\t\tpanic(\"res: multiple call handlers for method \" + method)\n\t\t}\n\t\ths.Call[method] = h\n\t})\n}", "title": "" }, { "docid": "42e520550d832bfb4466fbfc16b2be99", "score": "0.66962117", "text": "func (c *Client) Call(request *proto.Request, timeout time.Duration) (*proto.Response, error) {\n\tif err := c.Check(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.service.Call(request, timeout)\n}", "title": "" }, { "docid": "af93bc30aa377ad113c66a8b34619700", "score": "0.66816115", "text": "func (e *User) Call(ctx context.Context, req *user.Request, rsp *user.Response) error {\n\tlog.Log(\"Received User.Call request\")\n\trsp.Msg = \"Hello \" + req.Name\n\treturn nil\n}", "title": "" }, { "docid": "daf020e8e83b7619fdd59120acd5ead5", "score": "0.6671403", "text": "func (t *Account) Call(ctx context.Context, req *account.Request, rsp *account.Response) error {\n\tlog.Log(\"Received Account.Call request\")\n\trsp.Msg = \"Hello \" + req.Name\n\treturn nil\n}", "title": "" }, { "docid": "2041d8072f567759ebd0f10f18eae23f", "score": "0.6633047", "text": "func (c *localClient) Call(action string, name string) (interface{}, error) {\n\tmethod, err := lookupRpcMethod(c.rcvr, action)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treply := newRpcReply(method)\n\n\tparams := []reflect.Value{\n\t\treflect.ValueOf(c.rcvr),\n\t\treflect.ValueOf(name),\n\t\treply,\n\t}\n\n\treturnValues := method.Func.Call(params)\n\n\terrorInterface := returnValues[0].Interface()\n\tif errorInterface != nil {\n\t\terr = errorInterface.(error)\n\t}\n\n\treturn reply.Interface(), err\n}", "title": "" }, { "docid": "6fbfd2795820658b0a5e4efd348b1235", "score": "0.6622506", "text": "func (c *Caller) Call(req *http.Request) (*http.Response, error) {\n\treq = c.addCredentialsToContext(req)\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"while executing call to %s: \", req.URL)\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "91cb2d105a2601b34bc3cc62cbdadb4b", "score": "0.6616203", "text": "func Call(dsn *DSN, request interface{}, response interface{}) (err error) {\n\tc := Conn{Dsn: dsn}\n\terr = c.Dial(dsn)\n\tif err != nil {\n\t\terr = errors.New(fmt.Sprintf(\"Shit hit the fan: %v.\", err))\n\t\treturn\n\t}\n\tdefer c.Close()\n\n\tr, err := c.Send(&request)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = Unserialize(r, &response)\n\treturn\n}", "title": "" }, { "docid": "25d8718c730e0add20130855278d964c", "score": "0.66061085", "text": "func (nc *Client) Call(method string, params interface{}) (*jsonrpc.RPCResponse, error) {\n\treturn nc.rpcClient.Call(method, params)\n}", "title": "" }, { "docid": "720759ba1735285704617523d0c4680c", "score": "0.6603043", "text": "func (cli *client) Call(ctx context.Context, req *Request) error {\n\tpayload, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// connect to the device\n\tconn, err := (&net.Dialer{}).DialContext(ctx, \"tcp\", fmt.Sprintf(\"%s:%d\", cli.ip, cli.port))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tif err := SendRaw(conn, payload); err != nil {\n\t\treturn err\n\t}\n\n\tif req.ResponseExpected() {\n\t\tresponse, err := RecvRaw(conn)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := json.Unmarshal(response, req); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "90b5a53e032fd2cb18f4da9092fab700", "score": "0.65766335", "text": "func (c *Client) Call(path string, request []interface{}) (*gjson.Result, error) {\n\n\tvar (\n\t\tbody = make(map[string]interface{}, 0)\n\t)\n\n\tif c.client == nil {\n\t\treturn nil, errors.New(\"API url is not setup. \")\n\t}\n\n\tauthHeader := req.Header{\n\t\t\"Accept\": \"application/json\",\n\t\t\"Authorization\": \"Basic \" + c.AccessToken,\n\t}\n\n\t//json-rpc\n\tbody[\"jsonrpc\"] = \"2.0\"\n\tbody[\"id\"] = \"101\"\n\tbody[\"method\"] = path\n\tbody[\"params\"] = request\n\n\tif c.Debug {\n\t\tlog.Std.Info(\"Start Request API...\")\n\t}\n\n\tr, err := c.client.Post(c.BaseURL, req.BodyJSON(&body), authHeader)\n\n\tif c.Debug {\n\t\tlog.Std.Info(\"Request API Completed\")\n\t}\n\n\tif c.Debug {\n\t\tlog.Std.Info(\"%+v\", r)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := gjson.ParseBytes(r.Bytes())\n\terr = isError(&resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := resp.Get(\"result\")\n\n\treturn &result, nil\n}", "title": "" }, { "docid": "e68ef60cc98fed86e7e5ae4d2557b5d9", "score": "0.65708816", "text": "func Call(address string, method string, request interface{}, reply interface{}) error {\n\tclient, err := rpc.DialHTTP(\"tcp\", address)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = client.Call(method, request, reply); err != nil {\n\t\tlog.Fatalf(\"Error calling \"+method+\": %v\", err)\n\t}\n\tclient.Close()\n\treturn err\n}", "title": "" }, { "docid": "bd27e370f0b6f28e7b0833d6011409e6", "score": "0.65509844", "text": "func (client BaseClient) Call(ctx context.Context, request *http.Request) (response *http.Response, err error) {\n\tif client.IsRefreshableAuthType() {\n\t\treturn client.RefreshableTokenWrappedCallWithDetails(ctx, request, ClientCallDetails{Signer: client.Signer})\n\t}\n\treturn client.CallWithDetails(ctx, request, ClientCallDetails{Signer: client.Signer})\n}", "title": "" }, { "docid": "d8be8b941ee54580102980ae66d3d15b", "score": "0.6544981", "text": "func (_GenerateId *GenerateIdCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _GenerateId.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "fb9abebf79a7d1e769bcc486ad9ab0bb", "score": "0.65425307", "text": "func (_Demo *DemoCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Demo.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "ed25e6d54fba18990fff318f86a60093", "score": "0.653207", "text": "func ClientCall(method string, result interface{}, args ...interface{}) error {\n\tclient, err := MustRPCClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = client.CallContext(context.Background(), result, method, args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2fa665ea03af8d479ca811358de456c0", "score": "0.6521522", "text": "func (c *remoteClient) Call(action string, name string) (interface{}, error) {\n\tmethod, err := lookupRpcMethod(c.rcvr, action)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treply := newRpcReply(method)\n\n\tservice := reflect.TypeOf(c.rcvr).Elem().Name() + \".\" + method.Name\n\terr = c.client.Call(service, name, reply.Interface())\n\n\treturn reply.Interface(), err\n}", "title": "" }, { "docid": "81ffb5e28ebb47cc224dc718dfc61dd7", "score": "0.65045416", "text": "func (b *Explorer) Call(path string, request interface{}, method string) (*gjson.Result, error) {\n\n\tif b.client == nil {\n\t\treturn nil, errors.New(\"API url is not setup. \")\n\t}\n\n\tif b.Debug {\n\t\tlog.Std.Debug(\"Start Request API...\")\n\t}\n\n\turl := b.BaseURL + path\n\n\tr, err := b.client.Do(method, url, request)\n\n\tif b.Debug {\n\t\tlog.Std.Debug(\"Request API Completed\")\n\t}\n\n\tif b.Debug {\n\t\tlog.Std.Debug(\"%+v\", r)\n\t}\n\n\terr = b.isError(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := gjson.ParseBytes(r.Bytes())\n\n\treturn &resp, nil\n}", "title": "" }, { "docid": "d1baac0ec531372d7c198dd7caf0844e", "score": "0.64935267", "text": "func (b *Backend) Call(method string, out, in interface{}) error {\n\treturn platform.Call(method, out, in)\n}", "title": "" }, { "docid": "034954c2b06af8f9acda81725f4f3bdf", "score": "0.6488648", "text": "func (client *MomentumClient) Call(title string, args interface{}) *AsyncResult {\n\treturn client.sendArgs(title, args)\n}", "title": "" }, { "docid": "a2dbc61d0d26a1e7d3dd81d49aa977cf", "score": "0.6479268", "text": "func (_ScryProtocol *ScryProtocolCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _ScryProtocol.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "447eaa281119f7703b54890acc478ea6", "score": "0.6472106", "text": "func (c *Client) Call(method, url string, body, respType interface{}) (*Response, error) {\n\t// create new request from parameters\n\treq, err := c.NewRequest(method, url, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// send request with client\n\tresp, err := c.Do(req, respType)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\treturn resp, err\n}", "title": "" }, { "docid": "6eefed68aa677389418e9e92dde28235", "score": "0.6446594", "text": "func call(url string, method string, req interface{}, res interface{}) error {\n\tclientPayload, err := json2.EncodeClientRequest(method, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := http.Post(url, \"application/json\", bytes.NewReader(clientPayload))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json2.DecodeClientResponse(resp.Body, res)\n}", "title": "" }, { "docid": "aae00006f3f9ac78c15897ac060c637b", "score": "0.6444485", "text": "func (dgs *demoGenServ) HandleCall(from etf.Tuple, message etf.Term, state interface{}) (string, etf.Term, interface{}) {\n\tfmt.Printf(\"[%s] HandleCall: %#v, From: %#v\\n\", dgs.process.Node.FullName, message, from)\n\n\treply := etf.Term(etf.Tuple{etf.Atom(\"error\"), etf.Atom(\"unknown_request\")})\n\n\tswitch message {\n\tcase etf.Atom(\"hello\"):\n\t\treply = etf.Term(etf.Atom(\"hi\"))\n\t}\n\treturn \"reply\", reply, state\n}", "title": "" }, { "docid": "1093c67f9456dafb9f77140e9ab847bd", "score": "0.6436618", "text": "func (c *MockClient) Call(ctx context.Context, method string, args, result thrift.TStruct) error {\n\tif m, ok := c.methods[method]; ok {\n\t\treturn m(ctx, args, result)\n\t}\n\tif c.FailUnregisteredMethods {\n\t\treturn errors.New(\"thriftclient.MockClient: unregistered method: \" + method)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "64f2944bf294493f9f6d659b62214461", "score": "0.6435833", "text": "func (_Multishot *MultishotCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Multishot.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "f210f69499e8a173e10fb9d33a7e921f", "score": "0.6422984", "text": "func (c *FClient) Call(msg *FunctionMessage) (*FunctionMessage, error) {\n\tctx, cancel := context.WithTimeout(context.TODO(), c.cfg.Timeout)\n\tdefer cancel()\n\treturn c.cli.Call(ctx, msg, callopt)\n}", "title": "" }, { "docid": "e2dfcf1f030a1f6a33ea71f54226c07e", "score": "0.64089763", "text": "func (c *TChannelClient) Call(\n\tctx context.Context,\n\tthriftService, methodName string,\n\treqHeaders map[string]string,\n\treq, resp RWTStruct,\n) (success bool, resHeaders map[string]string, err error) {\n\tserviceMethod := thriftService + \"::\" + methodName\n\tscopeTags := map[string]string{\n\t\tscopeTagClient: c.ClientID,\n\t\tscopeTagClientMethod: methodName,\n\t\tscopeTagsTargetService: c.serviceName,\n\t\tscopeTagsTargetEndpoint: serviceMethod,\n\t}\n\tctx = WithScopeTagsDefault(ctx, scopeTags, c.metrics.Scope())\n\tcall := &tchannelOutboundCall{\n\t\tclient: c,\n\t\tmethodName: c.methodNames[serviceMethod],\n\t\tserviceMethod: serviceMethod,\n\t\treqHeaders: reqHeaders,\n\t\tcontextLogger: c.ContextLogger,\n\t\tmetrics: c.metrics,\n\t}\n\treturn c.call(ctx, call, reqHeaders, req, resp)\n}", "title": "" }, { "docid": "43aea34fa19e3a79460d9d921fd2ea9c", "score": "0.6390545", "text": "func (_TellorAccess *TellorAccessCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _TellorAccess.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "e20d5c56ba2edadafe6c99dfb9c951aa", "score": "0.6384802", "text": "func (_Random *RandomCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Random.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "9e4ee55c695ac79d69d182ab3198f8be", "score": "0.6381221", "text": "func (e *Notification) Call(ctx context.Context, req *notification.Request, rsp *notification.Response) error {\n\tlog.Log(\"Received Notification.Call request\")\n\trsp.Msg = \"Hello \" + req.Name\n\treturn nil\n}", "title": "" }, { "docid": "dfd27a1306af47fbb4b3aba951bc83a5", "score": "0.63804543", "text": "func DefineCall(ctx *broker.Context, services specs.ServiceList, schemas specs.Schemas, node *specs.Node, call *specs.Call, flow specs.FlowInterface) (err error) {\n\tif call.Request != nil {\n\t\terr = ResolveParameterMap(ctx, schemas, call.Request, flow)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif call.Method != \"\" {\n\t\tlogger.Info(ctx, \"defining call types\",\n\t\t\tzap.String(\"call\", node.ID),\n\t\t\tzap.String(\"method\", call.Method),\n\t\t\tzap.String(\"service\", call.Service),\n\t\t)\n\n\t\tservice := services.Get(call.Service)\n\t\tif service == nil {\n\t\t\treturn trace.New(trace.WithMessage(\"undefined service '%s' in flow '%s'\", call.Service, flow.GetName()))\n\t\t}\n\n\t\tmethod := service.GetMethod(call.Method)\n\t\tif method == nil {\n\t\t\treturn trace.New(trace.WithMessage(\"undefined method '%s' in flow '%s'\", call.Method, flow.GetName()))\n\t\t}\n\n\t\toutput := schemas.Get(method.Output)\n\t\tif output == nil {\n\t\t\treturn trace.New(trace.WithMessage(\"undefined method output property '%s' in flow '%s'\", method.Output, flow.GetName()))\n\t\t}\n\n\t\tcall.Descriptor = method\n\t\tcall.Response = &specs.ParameterMap{\n\t\t\tProperty: output.Clone(),\n\t\t}\n\n\t\tcall.Request.Schema = method.Input\n\t\tcall.Response.Schema = method.Output\n\t}\n\n\tif call.Response != nil {\n\t\terr = ResolveParameterMap(ctx, schemas, call.Response, flow)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5e7ee8a76e6d8875bdec47cb4c6bb1f6", "score": "0.63782334", "text": "func (a *Agent) Call(service string, method string, frame []byte, extra ...interface{}) ([]byte, error) {\n\targs := &Args{\n\t\tService: service,\n\t\tMethod: method,\n\t\tFrame: frame,\n\t}\n\n\treply := &Reply{}\n\txc, err := a.getXClient(service)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = xc.Call(context.Background(), ServiceMethodName, args, reply)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn reply.Data, nil\n}", "title": "" }, { "docid": "14e263f2ab9d5fcc92fc6e94c4cb1f80", "score": "0.63756144", "text": "func (c *Client) Call(methodname string, in toolkit.M, out interface{}) error{\n r := c.CallResult(methodname, in)\n if r.Status!=toolkit.Status_OK{\n return errors.New(\"client.CallTo: \" + r.Message)\n }\n \n if out==nil{\n return nil\n }\n \n var e error\n if !r.IsEncoded() {\n e = r.Cast(out, r.EncoderID)\n if e!=nil {\n return errors.New(\"client.CallTo: Cast Fail \" + e.Error())\n }\n return nil\n }\n \n e = r.GetFromBytes(out)\n if e!=nil{\n return errors.New(\"client.CallTo: Decode bytes fail \" + e.Error())\n }\n \n return nil\n}", "title": "" }, { "docid": "e95a374abcc5a5f375aff6d227fdf303", "score": "0.63740927", "text": "func (d *MessageDispatcher) Call(receiver string, method string, arguments ...interface{}) error {\n\t_, err := d.send(MessageSend{\n\t\tReceiver: receiver,\n\t\tSelector: method,\n\t\tArguments: arguments,\n\t\tIsAsynchronous: true,\n\t})\n\treturn err\n}", "title": "" }, { "docid": "974f8f69242091772f54a4c83c27862d", "score": "0.6371268", "text": "func (_Protocol *ProtocolCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Protocol.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "b2712af71962adcdd1816b28cddad8f3", "score": "0.6365008", "text": "func (c *Client) Call(path string, request interface{}) ([]byte, error) {\n\n\t//var (\n\t//\tbody = make(map[string]interface{}, 0)\n\t//)\n\n\t//authHeader := req.Header{\n\t//\t\"Accept\": \"application/json\",\n\t//\t\"Authorization\": \"Basic \" + basicAuth(rpcuser, rpcpassword),\n\t//}\n\n\t//json-rpc\n\t//body[\"jsonrpc\"] = \"2.0\"\n\t//body[\"id\"] = \"1\"\n\t//body[\"method\"] = path\n\t//body[\"params\"] = request\n\n\turl := c.BaseURL + \"/\" + path\n\n\tif c.Debug {log.Println(\"Start Request API...\")}\n\n\tr, err := req.Post(url, req.BodyJSON(&request))\n\tif err != nil {\n\t\tlog.Printf(\"unexpected err: %v\\n\", err)\n\t\treturn nil, err\n\t}\n\n\tif c.Debug {log.Println(\"Request API Completed\")}\n\n\tif c.Debug {\n\t\tlog.Printf(\"%+v\\n\", r)\n\t}\n\n\treturn r.Bytes(), nil\n}", "title": "" }, { "docid": "3fc911987144813bc75f573c55b3d453", "score": "0.63646823", "text": "func Call(in string) (string, error) {\n\tfmt.Println(\"call test.call v2 ,param:\", in)\n\treturn in, nil\n}", "title": "" }, { "docid": "1e0e0b5e49f54f61140100d3e864577e", "score": "0.634622", "text": "func (_Sub *SubCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Sub.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "2d25f21d7ee8dd7ffadf1a575575d1e7", "score": "0.6344122", "text": "func (c *Client) Call(method method.TelegramMethod) (Response, error) {\n\treq, err := c.buildRequest(method)\n\tres, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn Response{}, err\n\t}\n\tdefer res.Body.Close()\n\treturn c.parse(res)\n}", "title": "" }, { "docid": "933eb66f55a601edae4f279b746c2e77", "score": "0.63441145", "text": "func (_Gatekeeper *GatekeeperCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Gatekeeper.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "fd0d389fed2d8a93df07d8d8540ac8e3", "score": "0.6328414", "text": "func (_Demo *DemoRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Demo.Contract.DemoCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "f6e18d8fbd78775c690c351e1b9004f5", "score": "0.6326253", "text": "func (_ZapMaster *ZapMasterCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\r\n\treturn _ZapMaster.Contract.contract.Call(opts, result, method, params...)\r\n}", "title": "" }, { "docid": "a75064f4d791b40de6c640f298a90b6f", "score": "0.63257617", "text": "func (_GenerateId *GenerateIdRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _GenerateId.Contract.GenerateIdCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "cb33271129cc472578eb4f63ba88f8d0", "score": "0.63201517", "text": "func (c *Client) Call(urlSuffix string, httpMethod string, payload []byte) ([]byte, error) {\n\tvar req *http.Request\n\tvar err error\n\n\tif len(payload) > 0 {\n\t\treq, err = http.NewRequest(httpMethod, fmt.Sprintf(\"%s%s\", hubspotBaseURL, urlSuffix), strings.NewReader(string(payload)))\n\t} else {\n\t\treq, err = http.NewRequest(httpMethod, fmt.Sprintf(\"%s%s\", hubspotBaseURL, urlSuffix), nil)\n\t}\n\n\treq.Header[\"Content-Type\"] = []string{\"application/json\"}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer res.Body.Close()\n\n\tbyteArray, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif res.StatusCode < 200 || res.StatusCode > 299 {\n\t\treturn nil, fmt.Errorf(string(byteArray))\n\t}\n\n\treturn byteArray, nil\n}", "title": "" }, { "docid": "b7e2b4c8c69b2e5ee3ad8b6239472f0b", "score": "0.63170004", "text": "func (_Tellor *TellorCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Tellor.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "0c8096d9077fcd7fb278f3bc97cdb73f", "score": "0.6316462", "text": "func (self *WsTrans) Call(ctx context.Context, out interface{}, method string, params ...interface{}) error {\n\tid := randomId()\n\tsub := make(chan either, 1)\n\tself.registerSub(id, sub)\n\tdefer self.unregisterSub(id)\n\n\terr := self.send(id, method, params...)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase either, _ := <-sub:\n\t\tif either.err != nil {\n\t\t\treturn either.err\n\t\t}\n\t\tif either.val == nil {\n\t\t\treturn nil\n\t\t}\n\t\terr := json.Unmarshal(either.val, out)\n\t\treturn errors.WithStack(err)\n\t}\n}", "title": "" }, { "docid": "78eddd4db4603ade52b71458281ae413", "score": "0.6316043", "text": "func (_Gateway *GatewayCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Gateway.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "d322b1a36223bdf82ede19c1c85e57af", "score": "0.63129526", "text": "func (gateway *CoreGateway) Call(method, path string, body io.Reader, v interface{}) error {\n\tif !strings.HasPrefix(path, \"/\") {\n\t\tpath = \"/\" + path\n\t}\n\n\tpath = gateway.Client.APIEnvType.String() + path\n\treturn gateway.Client.Call(method, path, body, v)\n}", "title": "" }, { "docid": "128e934534eeaad4a93ed8785080196d", "score": "0.63113296", "text": "func (_Main *MainCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Main.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "11ecd04e0ff2c9e65a167c624aa1fdb5", "score": "0.6310918", "text": "func (self *GenServer) handle_call(call *CallMessage) {\n\tself.log(\"RECEIVED CALL \",call)\n\tself.impl.HandleCall(call,self.state)\n}", "title": "" }, { "docid": "06ad9479a39e15295ddebb24d8df73fa", "score": "0.6308634", "text": "func (sc *StratumContext) Call(serviceMethod string, args interface{}) (*Request, error) {\n\tsc.Lock()\n\tdefer sc.Unlock()\n\treturn sc.CallLocked(serviceMethod, args)\n}", "title": "" }, { "docid": "396c2961b2f3daaf1068d1a3afea7a70", "score": "0.6302384", "text": "func (_AsyncCall *AsyncCallCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _AsyncCall.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "e56b04e1b40423ae33cdcb1a8bb4588d", "score": "0.6301376", "text": "func (c *Client) Call(req request.Type, data interface{}) error {\n\tenc := coder.New(c.encrypter)\n\tif err := json.NewEncoder(enc).Encode(req); err != nil {\n\t\treturn err\n\t}\n\n\tres, err := PandoraCall(c.formatURL(req), enc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(res, data)\n}", "title": "" }, { "docid": "8c68a6f817e829ad41bc3705a48659b4", "score": "0.62904817", "text": "func (_GovernanceSlasher *GovernanceSlasherCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _GovernanceSlasher.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "0c5f4ab34cd1e6127c9cfc1b035e6e93", "score": "0.62841547", "text": "func (a *StreamAdapter) Call(ctx context.Context, req interface{}) (interface{}, error) {\n\t// optimistically add response acceptor to pending set\n\tvar key interface{}\n\tif a.requestKeyExtractor != nil {\n\t\tkey = a.requestKeyExtractor(req)\n\t}\n\tch := make(chan response, 1)\n\n\terr, startRecvLoop := a.addPending(key, ch)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := a.stream.SendMsg(req); err != nil {\n\t\t// remove from pending set\n\t\tif !a.removePending(key, ch) {\n\t\t\t// it must have been concurrently removed by recvLoop on stream failure\n\t\t\tselect {\n\t\t\tcase r := <-ch:\n\t\t\t\treturn r.resp, r.err\n\t\t\tdefault:\n\t\t\t\t// TODO: shouldn't ever happen... panic?\n\t\t\t}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\t// make sure we have something accepting response messages\n\tif startRecvLoop {\n\t\tgo a.recvLoop()\n\t}\n\n\t// wait for response\n\tselect {\n\tcase r := <-ch:\n\t\treturn r.resp, r.err\n\tcase <-ctx.Done():\n\t\treturn nil, ctx.Err()\n\t}\n}", "title": "" }, { "docid": "b48b1cc391d834b960b020ff7014f53e", "score": "0.62834156", "text": "func (_ScryProtocol *ScryProtocolRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _ScryProtocol.Contract.ScryProtocolCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "ff6ec9be4ac3e3f8a759134f50346a3e", "score": "0.6277885", "text": "func (_Boekiproxy *BoekiproxyCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Boekiproxy.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "9b23af8fe87e4959eff1d879f6dd1a99", "score": "0.6275274", "text": "func (_EndpointRegistry *EndpointRegistryCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _EndpointRegistry.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "dc4f2c5fc84ca24fdd7dc6fa00b67fa8", "score": "0.6273589", "text": "func (_MintedCrowdsaleImpl *MintedCrowdsaleImplRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _MintedCrowdsaleImpl.Contract.MintedCrowdsaleImplCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "34f3f993cdaf3b4cdfc662e78f7eac8f", "score": "0.626875", "text": "func (_Oracle *OracleCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Oracle.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "fc2f368b4ebb621db155c2afd3266cbb", "score": "0.6267384", "text": "func (c *Client) makeCall(call *Call) {\n\tlogger.Debugf(\"makeCall: %s\", call.SvcID)\n\n\t// Handle local RPC calls\n\tif call.Dest == \"\" || c.host == nil || call.Dest == c.host.ID() {\n\t\tlogger.Debugf(\"local call: %s\", call.SvcID)\n\t\tif c.server == nil {\n\t\t\terr := &clientError{\"Cannot make local calls: server not set\"}\n\t\t\tcall.doneWithError(err)\n\t\t\treturn\n\t\t}\n\t\terr := c.server.serverCall(call)\n\t\tcall.doneWithError(err)\n\t\treturn\n\t}\n\n\t// Handle remote RPC calls\n\tif c.host == nil {\n\t\tpanic(\"no host set: cannot perform remote call\")\n\t}\n\tif c.protocol == \"\" {\n\t\tpanic(\"no protocol set: cannot perform remote call\")\n\t}\n\tc.send(call)\n}", "title": "" }, { "docid": "4c2bdded812aebfbc7eb7a87cf84dbd8", "score": "0.62631345", "text": "func (f OnSDKBodyOperationStart) Call(op dyngo.Operation, v interface{}) {\n\tf(op.(*SDKBodyOperation), v.(SDKBodyOperationArgs))\n}", "title": "" }, { "docid": "8736789d9dcdc45d75d2c268654e2d4d", "score": "0.62562793", "text": "func (_Gatekeeper *GatekeeperRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Gatekeeper.Contract.GatekeeperCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "dda35c2a36abfa2749c7bd152992be12", "score": "0.6254097", "text": "func Call(w http.ResponseWriter, r *http.Request, ps httprouter.Params, d device.Handler, db db.Handler, a auth.Authenticator) {\n\treq := entities.CallRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"Could not parse CallRequest\")\n\t\terr := sendJSON(w, entities.ErrorResponse{Error: \"Could not parse CallRequest\"}, 400)\n\t\tif err != nil {\n\t\t\tlogrus.WithError(err).Error(\"!!!! Could not send error JSON response (CallRequest)\")\n\t\t}\n\t\treturn\n\t}\n\n\t// Authenticate User\n\tclaims, err := a.Validate(req.Token)\n\tif err == auth.ErrorValidatingToken {\n\t\tlogrus.WithField(\"token\", req.Token).Info(\"Error validating token\")\n\t\terr := sendJSON(w, entities.ErrorResponse{Error: \"Error validating token\"}, 401)\n\t\tif err != nil {\n\t\t\tlogrus.WithError(err).Error(\"!!!! Could not send error JSON response (CallRequest)\")\n\t\t}\n\t\treturn\n\t}\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"Unknown error validating token\")\n\t\terr := sendJSON(w, entities.ErrorResponse{Error: \"Error validating token\"}, 500)\n\t\tif err != nil {\n\t\t\tlogrus.WithError(err).Error(\"!!!! Could not send error JSON response (CallRequest)\")\n\t\t}\n\t\treturn\n\t}\n\n\tc := d.Call(req.DeviceName, claims.Data[ACCOUNT_SECRET_KEY], req.FunctionName, req.WaitForDeviceResponse)\n\n\tif req.WaitForDeviceResponse {\n\t\tselect {\n\t\tcase res := <-c:\n\t\t\tlogrus.WithField(\"response\", res).Info(\"Device responded\")\n\t\t\tr := entities.SendResponse{\n\t\t\t\tResponse: res,\n\t\t\t}\n\t\t\tsendJSON(w, r, 200)\n\t\tcase <-time.After(3 * time.Second):\n\t\t\tlogrus.Warn(\"Timed out waiting for device response\")\n\t\t\te := entities.ErrorResponse{\n\t\t\t\tError: \"Timed out while waiting for the device to respond\",\n\t\t\t}\n\t\t\tsendJSON(w, e, 500)\n\t\t}\n\t} else {\n\t\tsendOK(w)\n\t}\n}", "title": "" }, { "docid": "48ca230d1a7f0a1113350fed50f72881", "score": "0.62516505", "text": "func (_ChatService *ChatServiceCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _ChatService.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "228f22cef1f25db9ea86a3d92a1116f9", "score": "0.62458783", "text": "func (_Exchange *ExchangeCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Exchange.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "c76f78bfe3088a0f9d4f3105c7596807", "score": "0.62437826", "text": "func (_ZapDispute *ZapDisputeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\r\n\treturn _ZapDispute.Contract.contract.Call(opts, result, method, params...)\r\n}", "title": "" }, { "docid": "7abae45a79e638d9f2538b0cf170e668", "score": "0.62433887", "text": "func (_Wrapper *WrapperCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Wrapper.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "9883b723852551f2dedbe614a9ff93c5", "score": "0.6242999", "text": "func (s *Surrogate) CallRequest(request *Request) (ret Output, err error) {\n\tmethod, err := s.getMethod(request.Method)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tmethodType := method.Type()\n\tif err := s.isValid(methodType, request.NumArguments()); err != nil {\n\t\treturn ret, err\n\t}\n\n\texpected := methodType.NumIn()\n\n\tif methodType.IsVariadic() {\n\t\texpected--\n\t}\n\n\tvalues := make([]reflect.Value, 0, len(request.Inputs))\n\tfor i := 0; i < expected; i++ {\n\t\texpect := methodType.In(i)\n\t\tvalue, err := request.Argument(i, expect)\n\t\tif err != nil {\n\t\t\treturn ret, fmt.Errorf(\"invalid argument type [%d] expecting %s got\", i, expect)\n\t\t}\n\n\t\tvalues = append(values, value)\n\t}\n\n\tif methodType.IsVariadic() {\n\t\texpect := methodType.In(methodType.NumIn() - 1).Elem()\n\t\tfor i := expected; i < request.NumArguments(); i++ {\n\t\t\tvalue, err := request.Argument(i, expect)\n\t\t\tif err != nil {\n\t\t\t\treturn ret, fmt.Errorf(\"invalid argument type [%d] expecting %s\", i+expected, expect)\n\t\t\t}\n\n\t\t\tvalues = append(values, value)\n\t\t}\n\n\t}\n\n\tresults := method.Call(values)\n\n\treturn returnFromValues(results)\n\n}", "title": "" }, { "docid": "2f96453e2992a4cc974afef0621121f8", "score": "0.62422556", "text": "func (_Staking *StakingCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Staking.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "3ec645da7f90e8037810f91bc5d47430", "score": "0.6242176", "text": "func (_Safemoon *SafemoonCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Safemoon.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "55768451dadf4d10ad2a88fd5825d90c", "score": "0.62379086", "text": "func (_WETH *WETHCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _WETH.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "25121fe9e6a06ed48b27515536cee93c", "score": "0.6231879", "text": "func (_ZapStake *ZapStakeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\r\n\treturn _ZapStake.Contract.contract.Call(opts, result, method, params...)\r\n}", "title": "" }, { "docid": "eff84809b5e2a019bafdc70cc166cdf8", "score": "0.6227553", "text": "func (_Hub *HubCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Hub.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "eff84809b5e2a019bafdc70cc166cdf8", "score": "0.6227553", "text": "func (_Hub *HubCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Hub.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "c7520cdf2c3ac01f2ed26c3ad1336c09", "score": "0.6224538", "text": "func (_SigUtilsTester *SigUtilsTesterCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _SigUtilsTester.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "ec82b2777dc68535db4a985991064413", "score": "0.622386", "text": "func (_Protocol *ProtocolRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Protocol.Contract.ProtocolCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "20240378a92eee221ed383cc68b5de30", "score": "0.62212497", "text": "func (_GovernanceSlasher *GovernanceSlasherRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _GovernanceSlasher.Contract.GovernanceSlasherCaller.contract.Call(opts, result, method, params...)\n}", "title": "" } ]
4b9cd34a2d6c8dcb213842ef2c77c224
Apply applies the registered replacements to the given text.
[ { "docid": "29fe3e2c97fd60276c4ee157409cbf9f", "score": "0.7122021", "text": "func (c *IgnoringReplacer) Apply(text string) string {\n\t// To prevent replacing terms inside longer terms (i.e. replace \"Amazon\" inside \"Amazon Web Services\"),\n\t// this method temporarily \"inks out\" (replaces with placeholders) all areas that it has processed,\n\t// and restores the placeholders when done.\n\t// To achieve robustness for all edge cases, all replacements are done this way.\n\t// To ensure the replacements are as specific as possible, this method starts replacing the longer phrases first.\n\tplaceholders := NewPlaceholders()\n\n\t// ink out all the phrases to ignore (longest first)\n\thelpers.LongestFirst(c.ignore)\n\tfor i := range c.ignore {\n\t\tre := c.regexes.CaseInsensitive(c.ignore[i])\n\t\ttext = re.ReplaceAllStringFunc(text, placeholders.Make)\n\t}\n\n\t// ink out the replacements (longest first)\n\treplacementPhrases := c.phrasesToReplace()\n\tfor r := range replacementPhrases {\n\t\tre := c.regexes.CaseInsensitiveWholeWord(replacementPhrases[r])\n\t\thasReplaced := false\n\t\ttext = re.ReplaceAllStringFunc(text, func(match string) string {\n\t\t\tif !hasReplaced {\n\t\t\t\t// first occurrence: ink out with the actual replacement\n\t\t\t\thasReplaced = true\n\t\t\t\treturn placeholders.Make(c.replaceOnce[replacementPhrases[r]])\n\t\t\t}\n\t\t\t// other occurrences: ink out with the match\n\t\t\treturn placeholders.Make(match)\n\t\t})\n\t}\n\n\t// restore all the placeholders\n\tfor phrase := range placeholders {\n\t\ttext = strings.ReplaceAll(text, placeholders[phrase], phrase)\n\t}\n\treturn text\n}", "title": "" } ]
[ { "docid": "8d09612afcba029cfe686a8ab603d3bf", "score": "0.6296336", "text": "func textReplace(data string) string {\n\tfor k, v := range textReplaceMap {\n\t\tdata = strings.Replace(data, k, v, -1)\n\t}\n\treturn data\n}", "title": "" }, { "docid": "c45e6dd2208d422127100c7be2fd78aa", "score": "0.5580022", "text": "func (acc ansiColor) Apply(text string) string {\n\treturn acc.escaped() + text + colorReset.escaped()\n}", "title": "" }, { "docid": "fe9f9626bc8d030a64ea8e2f2197fa04", "score": "0.5305149", "text": "func ApplySubstitutions(ctx *ParseContext, done <-chan interface{}, fragmentStream <-chan types.DocumentFragment) chan types.DocumentFragment {\n\tprocessedFragmentStream := make(chan types.DocumentFragment, bufferSize)\n\tgo func() {\n\t\tdefer close(processedFragmentStream)\n\t\tfor f := range fragmentStream {\n\t\t\tselect {\n\t\t\tcase processedFragmentStream <- applySubstitutionsOnFragment(ctx, f):\n\t\t\tcase <-done:\n\t\t\t\tlog.WithField(\"pipeline_stage\", \"apply_substitutions\").Debug(\"received 'done' signal\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tlog.WithField(\"pipeline_stage\", \"apply_substitutions\").Info(\"done\")\n\t}()\n\treturn processedFragmentStream\n}", "title": "" }, { "docid": "b416e8bd00b3540dc0215aba4eaf8fd7", "score": "0.5288381", "text": "func (c *BaseMail) ReplaceText(replaceFrom, replaceTo string) *BaseMail {\n\tc.Text = strings.ReplaceAll(c.Text, replaceFrom, replaceTo)\n\treturn c\n}", "title": "" }, { "docid": "796cf8d8f694cfd829812ab3460f9715", "score": "0.5267695", "text": "func ConvertTextEffects(result *string) {\n\n\t// *strong in jira* -> `strong in jira`\n\tstrongJira := regexp.MustCompile(`(?U)\\*([^}]+)\\*`)\n\n\t// _emphasis in jira_ -> *emphasis in jira*\n\temphasisJira := regexp.MustCompile(`(?U)_([^}]+)_`)\n\n\t// ??citation in jira?? -> <cite>citation in jira</cite>\n\tcitationJira := regexp.MustCompile(`(?U)\\?\\?([^}]+)\\?\\?`)\n\n\t// -deleted in jira- -> ~~deleted in jira~~\n\t// deletedJira := regexp.MustCompile(`(?U)\\-([^}]+)\\-`)\n\n\t// +inserted in jira+ -> <ins>inserted in jira</ins>\n\tinsertedJira := regexp.MustCompile(`(?U)\\+([^}]+)\\+`)\n\n\t// +superscript in jira+ -> <sup>superscript in jira</sup>\n\tsuperscriptJira := regexp.MustCompile(`(?U)\\^([^}]+)\\^`)\n\n\t// ~subscript in jira~ -> <sub>subscript in jira</sub>\n\tsubscriptJira := regexp.MustCompile(`(?U)\\~([^}]+)\\~`)\n\n\t// {{monospaced in jira}} -> `codes in jira`\n\tmonospacedJira := regexp.MustCompile(`(?U)\\{\\{([^}]+)\\}\\}`)\n\n\t*result = strongJira.ReplaceAllString(*result, \"**\"+`$1`+\"**\")\n\t*result = emphasisJira.ReplaceAllString(*result, \"*\"+`$1`+\"*\")\n\t*result = citationJira.ReplaceAllString(*result, \"<cite>\"+`$1`+\"</cite>\")\n\t*result = subscriptJira.ReplaceAllString(*result, \"<sub>\"+`$1`+\"</sub>\")\n\t// *result = deletedJira.ReplaceAllString(*result, \"~~\"+`$1`+\"~~\")\n\t*result = insertedJira.ReplaceAllString(*result, \"<ins>\"+`$1`+\"</ins>\")\n\t*result = superscriptJira.ReplaceAllString(*result, \"<sup>\"+`$1`+\"</sup>\")\n\t*result = monospacedJira.ReplaceAllString(*result, \"`\"+`$1`+\"`\")\n\n}", "title": "" }, { "docid": "a29fb8f8f4df4d39e457ebe868732634", "score": "0.52659017", "text": "func (self *RewriteRule) Apply(dep *Dependency) error {\n\t// match *all* expressions against the dependency\n\tdepValues := dep.Flatten()\n\tfor field, match := range self.Matches {\n\t\tif !match.MatchString(depValues[field]) {\n\t\t\treturn nil // no match\n\t\t}\n\t}\n\n\t// generate new value map\n\tnewValues := map[string]string{}\n\twriter := &bytes.Buffer{}\n\tfor field, tmpl := range self.Replacements {\n\t\twriter.Reset()\n\t\tif err := tmpl.Execute(writer, depValues); err != nil {\n\t\t\t// TODO: need waaaay more context for this to be useful\n\t\t\treturn fmt.Errorf(\"Error executing replacement rule: %v\", err)\n\t\t}\n\t\tnewValues[field] = writer.String()\n\t}\n\n\t// set up the new dependency\n\tif err := dep.SetValues(newValues); err != nil {\n\t\treturn err\n\t}\n\n\tlog.Debug(\"Dependency rewritten: %t\", dep)\n\n\t// return new dependency\n\treturn nil\n}", "title": "" }, { "docid": "cccc139c12c5f0020bfcc8822ad8a6fa", "score": "0.52446145", "text": "func applyTransform(str string, transform sf) (out string) {\n\tout = \"\"\n\n\tfor idx, line := range strings.Split(str, \"\\n\") {\n\t\tout += transform(idx, line)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d559387bbd9230e1f97fd79503a6d6d6", "score": "0.5152073", "text": "func (f formatMap) Apply(t time.Time, txt string) string {\n\tfc, ok := f[txt]\n\tif !ok {\n\t\treturn fmt.Sprintf(\"%%%s\", txt)\n\t}\n\n\treturn fc(t)\n}", "title": "" }, { "docid": "0d400d1558422c2de38b501dcb56e250", "score": "0.50651026", "text": "func (r *Replacer) commit() {\n\tvar buf bytes.Buffer\n\tvar levels []int\n\n\toffset := 0\n\tfor _, repl := range r.repls {\n\t\tstart := repl.Start\n\t\tstop := repl.Stop\n\t\tword := repl.Word\n\n\t\t// before replacement\n\t\tbuf.WriteString(r.word[offset:start])\n\t\tlevels = append(levels, r.levels[offset:start]...)\n\n\t\t// replacement\n\t\tbuf.WriteString(word)\n\t\tfor i := 0; i < len(word); i++ {\n\t\t\tlevels = append(levels, r.nextLevel)\n\t\t}\n\n\t\toffset = stop\n\t}\n\t// after replacement\n\tbuf.WriteString(r.word[offset:])\n\tlevels = append(levels, r.levels[offset:]...)\n\n\tr.word = buf.String()\n\tr.levels = levels\n\tr.repls = make([]Replacement, 0)\n}", "title": "" }, { "docid": "169fc9bed633e8b9da641569630b092b", "score": "0.49370253", "text": "func ProcessColors(text string, cm ColorMode) string {\n\treplace := func(match string) string {\n\t\tfound := Lookup[Color(match)]\n\n\t\tif found {\n\t\t\treturn getAnsiCode(cm, Color(match))\n\t\t}\n\n\t\treturn match\n\t}\n\n\tafter := ColorRegex.ReplaceAllStringFunc(text, replace)\n\treturn after\n}", "title": "" }, { "docid": "761a23f4e4ca27a3431848cccfb948ba", "score": "0.49360803", "text": "func InReplace(text, allowed []byte, c byte) []byte {\n\tif len(text) == 0 {\n\t\treturn nil\n\t}\n\n\tvar found bool\n\tfor x := 0; x < len(text); x++ {\n\t\tfound = false\n\t\tfor y := 0; y < len(allowed); y++ {\n\t\t\tif text[x] == allowed[y] {\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\ttext[x] = c\n\t\t}\n\t}\n\treturn text\n}", "title": "" }, { "docid": "5443cf23b70cf0e5b26c7c890d1c725f", "score": "0.4925493", "text": "func (u *ItemUpsertBulk) UpdateText() *ItemUpsertBulk {\n\treturn u.Update(func(s *ItemUpsert) {\n\t\ts.UpdateText()\n\t})\n}", "title": "" }, { "docid": "c0f2c3d47f433825eb3e403b5c9cb7f5", "score": "0.49132788", "text": "func (p *PiglatinService) FormatText(originalText string) (model.TranslationResult, error) {\n\n\tvar (\n\t\tpunctuations = \"!?.,-\"\n\t\ttransText []string\n\t)\n\n\tfor _, word := range strings.Split(originalText, \" \") {\n\n\t\ttoTranslate := \"\"\n\t\tif ok, _ := hasSpecialChar(word); !ok {\n\t\t\tfor key, val := range word {\n\n\t\t\t\tif !strings.Contains(punctuations, string(val)) {\n\t\t\t\t\ttoTranslate += string(val)\n\t\t\t\t} else {\n\t\t\t\t\tif toTranslate != \"\" {\n\t\t\t\t\t\ttransText = append(transText, translate(toTranslate))\n\t\t\t\t\t}\n\t\t\t\t\ttransText = append(transText, string(val))\n\t\t\t\t\ttoTranslate = \"\"\n\t\t\t\t}\n\n\t\t\t\tif key == len(word)-1 && !strings.Contains(punctuations, string(val)) {\n\t\t\t\t\ttransText = append(transText, translate(toTranslate))\n\t\t\t\t}\n\n\t\t\t}\n\t\t} else {\n\t\t\ttransText = append(transText, word)\n\t\t}\n\n\t}\n\n\ttranslationResult := model.TranslationResult{\n\t\tOriginalText: originalText,\n\t\tTranslatedText: strings.Join(transText, \" \"),\n\t}\n\n\terr := p.repository.NewText(&translationResult)\n\n\tif err != nil {\n\t\treturn translationResult, err\n\t}\n\n\treturn translationResult, nil\n}", "title": "" }, { "docid": "d7337b819e35e195e40aec0ee81a4308", "score": "0.49120545", "text": "func (t *TextUpdateSystem) Update(dt float32) {\n\tfor _, e := range t.entities {\n\t\t// Do nothing with this text if it doesn't have an updatable function.\n\t\tif e.Updatable == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\te.Updatable(e.Text)\n\t\te.Render()\n\t}\n}", "title": "" }, { "docid": "75da0c58be67ffb7a5141f7ac7f3a73e", "score": "0.48848966", "text": "func ApplyEdits(before string, edits []TextEdit) string {\n\t// Preconditions:\n\t// - all of the edits apply to before\n\t// - and all the spans for each TextEdit have the same URI\n\tif len(edits) == 0 {\n\t\treturn before\n\t}\n\t_, edits, _ = prepareEdits(before, edits)\n\tafter := strings.Builder{}\n\tlast := 0\n\tfor _, edit := range edits {\n\t\tstart := edit.Span.Start().Offset()\n\t\tif start > last {\n\t\t\tafter.WriteString(before[last:start])\n\t\t\tlast = start\n\t\t}\n\t\tafter.WriteString(edit.NewText)\n\t\tlast = edit.Span.End().Offset()\n\t}\n\tif last < len(before) {\n\t\tafter.WriteString(before[last:])\n\t}\n\treturn after.String()\n}", "title": "" }, { "docid": "703c7a2d84fb02b6cab688f42336fd2c", "score": "0.48586902", "text": "func (s *textComponent) Apply(element *Element) {\n\telement.Children = append(element.Children, s)\n}", "title": "" }, { "docid": "0af5a72cd6db34385b951846e202aeea", "score": "0.48508796", "text": "func (m *matcher) applyAt(path string, f func(c compilable)) {\n\tif m.root == nil {\n\t\treturn\n\t}\n\tm.root.applyAt(path, f)\n}", "title": "" }, { "docid": "353d07de6f66216c076f1684875f2b67", "score": "0.48397127", "text": "func Substitute(str string, mapping map[string]string) string {\n\tfor key, val := range mapping {\n\t\tstr = strings.Replace(str, key, val, -1)\n\t}\n\treturn str\n}", "title": "" }, { "docid": "e58565a64c1ef590c2ab8ff3180bbb9e", "score": "0.48370036", "text": "func Apply(source string, fs ...applyFunc) string {\n\tresult := source\n\tfor _, f := range fs {\n\t\tresult = f(result)\n\t}\n\t// log.Debugf(\"applied '%s' -> '%s' (%v characters)\", source, result, len(result))\n\treturn result\n}", "title": "" }, { "docid": "1bf299fd5530b2c62e58103cbfef03ca", "score": "0.48320946", "text": "func (m MatchPattern) Apply(ctx context.Context, results *[]github.CodeResult) *[]github.CodeResult {\n\treturn filterResultsWith(results, getPatternFilterFunc(m.Pattern))\n}", "title": "" }, { "docid": "737f1fc01a7df09c815f3eb11292be93", "score": "0.48297882", "text": "func (r *Replacer) Replace(start, stop int, word string) {\n\tr.ReplaceBy(NewReplacement(start, stop, word))\n}", "title": "" }, { "docid": "56e96bc935b0b00bf4c63971091e3c4a", "score": "0.48193908", "text": "func (t *Db) RunPostTranslation(str string) (string, error) {\n\tstr = strings.TrimSpace(str) // Might not be a good idea\n\n\tvar err error\n\n\tstr, err = t.applyPostStatic(str, TransGeneric)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\tstr, err = t.applyPostDynamic(str, TransGeneric)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\treturn str, nil\n}", "title": "" }, { "docid": "ee0907e4d346997fca5d118e52561f33", "score": "0.4809085", "text": "func redactText(patterns []string, rectProps *redactor.RectangleProps, inputFile, destFile string) error {\n\n\t// Initialize RedactionTerms with regex patterns.\n\tterms := []redactor.RedactionTerm{}\n\tfor _, pattern := range patterns {\n\t\tregexp, err := regexp.Compile(pattern)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tredTerm := redactor.RedactionTerm{Pattern: regexp}\n\t\tterms = append(terms, redTerm)\n\t}\n\n\tpdfReader, f, err := model.NewPdfReaderFromFile(inputFile, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer f.Close()\n\t// Define RedactionOptions.\n\toptions := redactor.RedactionOptions{Terms: terms}\n\tred := redactor.New(pdfReader, &options, rectProps)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = red.Redact()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// write the redacted document to destFile.\n\terr = red.WriteToFile(destFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "39db7fbaeabfcae03a45347d676a83c9", "score": "0.4797259", "text": "func (u *ItemUpsert) UpdateText() *ItemUpsert {\n\tu.SetExcluded(item.FieldText)\n\treturn u\n}", "title": "" }, { "docid": "45ec28c9a4c220fc9d33fc14839d0a76", "score": "0.4781999", "text": "func (g *TemplateGenerator) Replace(args []string) ([]string, error) {\n\tcompiled := make([]string, len(args))\n\tfor i, a := range args {\n\t\tstr, err := g.replaceArgument(a)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to compile argument at position %d\", i)\n\t\t}\n\t\tcompiled[i] = str\n\t}\n\n\treturn compiled, nil\n}", "title": "" }, { "docid": "dbd71894b476f7a24c988e3876d72b43", "score": "0.47568128", "text": "func Apply(columns Columns, input io.Reader, output io.Writer) error {\n\t// Need to know how many words there are so columns can know how many /\n\t// which words to select on to forward into the output.\n\t// There's a more efficient way to do this that involves reading words one\n\t// at a time and keeping track until we resolve the columns selection,\n\t// but meh.\n\n\tscanner := bufio.NewScanner(input)\n\n\tfor scanner.Scan() {\n\t\tif line := next(scanner); line != \"\" {\n\t\t\tif err := process(\n\t\t\t\tline,\n\t\t\t\toutput,\n\t\t\t\tcolumns,\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn scanner.Err()\n}", "title": "" }, { "docid": "72b2e4f1fec581b1bb59714714ef03aa", "score": "0.47424126", "text": "func (n *matcherNode) applyAt(path string, f func(c compilable)) {\n\tpi := pathIterator{path: path}\n\tfor pi.hasNext() {\n\t\ts := pi.next()\n\t\tchild, ok := n.children[s]\n\t\tif !ok {\n\t\t\tif s == catchAll {\n\t\t\t\tn = n.catchAll\n\t\t\t\tbreak\n\t\t\t} else if s[0] == '{' && s[len(s)-1] == '}' {\n\t\t\t\tchild = n.wildChild\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tn = child\n\t}\n\tn.apply(f)\n}", "title": "" }, { "docid": "eb4477584b9f1a3052dd8f48eb459283", "score": "0.4741619", "text": "func ApplyTextTemplate(source io.Reader, config Config) (io.Reader, error) {\n\tsourceText, e := ioutil.ReadAll(source)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\ttmpl, e := template.New(\"config\").Parse(string(sourceText))\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\tvar buffer bytes.Buffer\n\n\tif e = tmpl.Execute(&buffer, &config); e != nil {\n\t\treturn nil, e\n\t}\n\n\treturn bufio.NewReader(&buffer), nil\n}", "title": "" }, { "docid": "e48caa9bccffc5f0dbb9ba73ad5bd3c6", "score": "0.47240263", "text": "func (b *SlackActionApplyConfiguration) WithText(value string) *SlackActionApplyConfiguration {\n\tb.Text = &value\n\treturn b\n}", "title": "" }, { "docid": "7518f92984e1e086648c6c3234ce772c", "score": "0.47139096", "text": "func SubstituteWith(template string, mapping Mapping, pattern *regexp.Regexp, subsFuncs ...SubstituteFunc) (string, error) {\n\tvar err error\n\tresult := pattern.ReplaceAllStringFunc(template, func(substring string) string {\n\t\tmatches := pattern.FindStringSubmatch(substring)\n\t\tgroups := matchGroups(matches, pattern)\n\t\tif escaped := groups[\"escaped\"]; escaped != \"\" {\n\t\t\treturn escaped\n\t\t}\n\n\t\tsubstitution := groups[\"named\"]\n\t\tif substitution == \"\" {\n\t\t\tsubstitution = groups[\"braced\"]\n\t\t}\n\n\t\tif substitution == \"\" {\n\t\t\terr = &InvalidTemplateError{Template: template}\n\t\t\treturn \"\"\n\t\t}\n\n\t\tfor _, f := range subsFuncs {\n\t\t\tvar (\n\t\t\t\tvalue string\n\t\t\t\tapplied bool\n\t\t\t)\n\t\t\tvalue, applied, err = f(substitution, mapping)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\"\n\t\t\t}\n\t\t\tif !applied {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn value\n\t\t}\n\n\t\tvalue, _ := mapping(substitution)\n\t\treturn value\n\t})\n\n\treturn result, err\n}", "title": "" }, { "docid": "5f088584d9541593e55c6267bdabe3d2", "score": "0.47003442", "text": "func ResolveParametersInText(\n\tservice ISsmParameterService,\n\tlog log.T,\n\tinput string,\n\toptions ResolveOptions) (string, error) {\n\n\tresolvedParametersMap, err := ExtractParametersFromText(service, log, input, options)\n\tif err != nil || resolvedParametersMap == nil || len(resolvedParametersMap) == 0 {\n\t\treturn input, err\n\t}\n\n\tfor ref, param := range resolvedParametersMap {\n\t\tvar placeholder = regexp.MustCompile(\"{{\\\\s*\" + ref + \"\\\\s*}}\")\n\t\tinput = placeholder.ReplaceAllString(input, param.Value)\n\t}\n\n\treturn input, nil\n}", "title": "" }, { "docid": "f61bd0fd6628b464fedc6bdb9e927b47", "score": "0.46651724", "text": "func (list *PatchList) Apply(in io.ReaderAt, out io.Writer) error {\n\tvar offset int64\n\tfor _, patch := range *list {\n\t\ttoWrite := int64(patch.Start) - offset\n\t\twritten, err := io.Copy(out, io.NewSectionReader(in, offset, toWrite))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\toffset += toWrite\n\t\tif written != toWrite {\n\t\t\treturn fmt.Errorf(\"unexpected EOF at %d\", offset)\n\t\t}\n\n\t\t_, err = io.WriteString(out, patch.Replacement)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\toffset += int64(patch.End - patch.Start)\n\t}\n\t_, err := io.Copy(out, io.NewSectionReader(in, offset, math.MaxInt64-offset))\n\treturn err\n}", "title": "" }, { "docid": "33a61a26c7ddf78af8017b9ea0d58055", "score": "0.46563792", "text": "func ApplyTemplate(name string, tmpl string, executor interface{}, funcMap template.FuncMap) (string, error) {\n\tcodeTemplate := template.Must(template.New(name).Funcs(funcMap).Parse(tmpl))\n\n\tcode := bytes.NewBuffer(nil)\n\terr := codeTemplate.Execute(code, executor)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"attempting to execute templates %q\", name)\n\t}\n\treturn code.String(), nil\n}", "title": "" }, { "docid": "a34c81aec0ce18d74860a2f0e2e75e2f", "score": "0.46487007", "text": "func doTextProcessor(p proc.TextProcessor, label string, c *Chunk, msg string) *Chunk {\n\tres := p.Run(c.Data)\n\n\tfor _, match := range res.Matches {\n\t\tformattedMsg := fmt.Sprintf(msg)\n\t\tc.Matches = append(c.Matches, NewMatch(match.Match, label, match.Indices, formattedMsg))\n\t\tc.Score += 1\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "2c01ac21bd509937d7157c1ba7fc2ec5", "score": "0.4639305", "text": "func FigletizeText(ctx workflow.Context, inputText string) (string, error) {\n\tao := workflow.ActivityOptions{\n\t\tTaskList: TaskList,\n\t\tScheduleToCloseTimeout: time.Second * 60,\n\t\tScheduleToStartTimeout: time.Second * 60,\n\t\tStartToCloseTimeout: time.Second * 60,\n\t\tHeartbeatTimeout: time.Second * 10,\n\t\tWaitForCancellation: false,\n\t}\n\n\tctx = workflow.WithActivityOptions(ctx, ao)\n\tfuture := workflow.ExecuteActivity(ctx, activity.FigletizeText, inputText)\n\tvar figletedText string\n\tif err := future.Get(ctx, &figletedText); err != nil {\n\n\t\tworkflow.GetLogger(ctx).Error(\"Executing FigletizeText activity\", zap.Error(err))\n\t\treturn \"\", err\n\t}\n\n\tworkflow.GetLogger(ctx).Info(\"FigletizeText workflow done\")\n\treturn figletedText, nil\n}", "title": "" }, { "docid": "09d524f9eab2a757a90b9176fd8e328f", "score": "0.4629719", "text": "func DoReplacements(input string, mapping MappingFunc) interface{} {\n\tvar buf strings.Builder\n\tcheckpoint := 0\n\tfor cursor := 0; cursor < len(input); cursor++ {\n\t\tif input[cursor] == operator && cursor+1 < len(input) {\n\t\t\t// Copy the portion of the input string since the last\n\t\t\t// checkpoint into the buffer\n\t\t\tbuf.WriteString(input[checkpoint:cursor])\n\n\t\t\t// Attempt to read the variable name as defined by the\n\t\t\t// syntax from the input string\n\t\t\tread, isVar, advance := tryReadVariableName(input[cursor+1:])\n\n\t\t\tif isVar {\n\t\t\t\t// We were able to read a variable name correctly;\n\t\t\t\t// apply the mapping to the variable name and copy the\n\t\t\t\t// bytes into the buffer\n\t\t\t\tmapped := mapping(read)\n\t\t\t\tif input == syntaxWrap(read) {\n\t\t\t\t\t// Preserve the type of variable\n\t\t\t\t\treturn mapped\n\t\t\t\t}\n\n\t\t\t\t// Variable is used in a middle of a string\n\t\t\t\tbuf.WriteString(fmt.Sprintf(\"%v\", mapped))\n\t\t\t} else {\n\t\t\t\t// Not a variable name; copy the read bytes into the buffer\n\t\t\t\tbuf.WriteString(read)\n\t\t\t}\n\n\t\t\t// Advance the cursor in the input string to account for\n\t\t\t// bytes consumed to read the variable name expression\n\t\t\tcursor += advance\n\n\t\t\t// Advance the checkpoint in the input string\n\t\t\tcheckpoint = cursor + 1\n\t\t}\n\t}\n\n\t// Return the buffer and any remaining unwritten bytes in the\n\t// input string.\n\treturn buf.String() + input[checkpoint:]\n}", "title": "" }, { "docid": "71d3029ed3b9230c23223e375e5983fc", "score": "0.46288142", "text": "func ApplyTransform(transformer func(string) (string, error), paths ...string) (transformed []string, err error) {\n\tif len(paths) == 0 {\n\t\treturn\n\t}\n\n\ttransformed = make([]string, len(paths))\n\tfor i, path := range paths {\n\t\ttransformed[i], err = transformer(path)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c7538c38bc0aa3536bfee18fd5dda83d", "score": "0.46174487", "text": "func (p *PathMapper) ApplyMappingToTextProtocol(protocol []byte) []byte {\n\treturn p.doTextPathMapping(protocol)\n}", "title": "" }, { "docid": "4fc5861a560adabc5693936b59f9755b", "score": "0.46143475", "text": "func (d *babbleDictionary) applyTransform(s string) (ts string) {\n\ttxf := d.config.TransformWord\n\tif txf != nil {\n\t\tts = txf(s)\n\t}else{\n\t\tts = s\n\t}\n\tif d.config.Downcase {\n\t\treturn strings.ToLower(ts)\n\t}\n\tif d.config.Upcase {\n\t\treturn strings.ToUpper(ts)\n\t}\n\treturn ts\n}", "title": "" }, { "docid": "9c30a5c2a1132d80a921a909b89888bd", "score": "0.45848054", "text": "func (t *T) Apply(needle string) (string, error) {\n\tms, err := t.lhs.Match(needle)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn t.rhs.Apply(ms)\n}", "title": "" }, { "docid": "1f756d4413cd4a3613b8f21ec779aa75", "score": "0.45742884", "text": "func (i *Transform) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = ParseTransformString(string(text))\n\treturn err\n}", "title": "" }, { "docid": "eb29132386730a9b46afe6ba24106f52", "score": "0.4573235", "text": "func (parser *TwitterParser) HandleText(message *core.Message, bot core.IBot) error {\n\tr := regexp.MustCompile(`https://(?i:twitter|x)\\.com\\S+/(\\d+)\\S*`)\n\tmatch := r.FindAllStringSubmatch(message.Text, -1)\n\n\tif len(match) > 0 {\n\t\tparser.l.Infof(\"Processing %s\", match[0][0])\n\t} else {\n\t\treturn fmt.Errorf(\"not implemented\")\n\t}\n\n\tfor _, m := range match {\n\t\terr := parser.tweetHandler.Process(m[1], message, bot)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2172927e9ff20941d561917602f56264", "score": "0.45539105", "text": "func Replace(s string) (string, bool) {\n\tvar matched bool\n\tfor _, m := range Config.Mappings {\n\t\tif m.re.MatchString(s) {\n\t\t\ts, matched = m.Replace(s)\n\n\t\t\t// If we get an exit on match, ditch it.\n\t\t\t// TODO: This should be refactored.\n\t\t\tif m.ExitOnMatch {\n\t\t\t\treturn s, matched\n\t\t\t}\n\t\t}\n\t}\n\n\treturn s, matched\n}", "title": "" }, { "docid": "646d3c815572e349fb2dfd4f673591df", "score": "0.45504758", "text": "func MergeText(text string, program *il.Program) error {\n\treturn parse(text, program)\n}", "title": "" }, { "docid": "8f9f1df6647f086d8bafe3887d2d58fe", "score": "0.45439222", "text": "func Replace(old, new string, n int) MapFunc {\n\treturn func(s string) string { return strings.Replace(s, old, new, n) }\n}", "title": "" }, { "docid": "9d9a697860fde5d860cbfa915e6eed17", "score": "0.45368305", "text": "func (u *ItemUpsertOne) UpdateText() *ItemUpsertOne {\n\treturn u.Update(func(s *ItemUpsert) {\n\t\ts.UpdateText()\n\t})\n}", "title": "" }, { "docid": "65cdf25b44410c06d0c980cba15552de", "score": "0.4530364", "text": "func ApplyTemplate(props interface{}, properties *configProperties) {\n\tstringvalues := properties.StringMap()\n\tfuncmap := make(map[string]interface{})\n\tfuncmap[\"to_upper\"] = strings.ToUpper\n\tfuncmap[\"to_lower\"] = strings.ToLower\n\tfuncmap[\"split\"] = strings.Split\n\tfuncmap[\"reg_match\"] = regMatch\n\tfuncmap[\"reg_replace\"] = regReplace\n\tfuncmap[\"match_srcs\"] = matchSrcs\n\tfuncmap[\"add_if_supported\"] = filter_compiler_flags\n\tpropsVal := reflect.Indirect(reflect.ValueOf(props))\n\n\tapplyTemplateRecursive(propsVal, stringvalues, funcmap)\n}", "title": "" }, { "docid": "3d95b1e067a46527b4fa44ffeb22e1c7", "score": "0.45289686", "text": "func Replace(str string, repls map[string]string) string {\n\tfor k, v := range repls {\n\t\tstr = strings.Replace(str, k, v, -1)\n\t}\n\treturn str\n}", "title": "" }, { "docid": "41a283a13dc3f9e9cf484c2727f90ce7", "score": "0.451365", "text": "func RenderText(text string, theme ColorTheme) string {\n\tvar flag bool\n\ts := make([]string, 5)\n\tscanner := bufio.NewScanner(strings.NewReader(text))\n\tfor scanner.Scan() {\n\t\tif flag {\n\t\t\ts = append(s, New(theme[1]).Sprintln(scanner.Text()))\n\t\t} else {\n\t\t\ts = append(s, New(theme[0]).Sprintln(scanner.Text()))\n\t\t}\n\n\t\tflag = !flag\n\t}\n\n\treturn strings.Join(s, \"\")\n}", "title": "" }, { "docid": "d62e864e5d09edf176bb14503777999f", "score": "0.45010632", "text": "func apply(template string, data map[string]string) string {\n\tm := mustache.New()\n\terr := m.ParseString(template)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\ts, err := m.RenderString(data)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "32c5732c141faca417d5e8ea8f26fd0d", "score": "0.44941357", "text": "func (s *smlWriter) Text(text string) error {\n\tt := strings.Replace(text, \"^\", \"^^\", -1)\n\tt = strings.Replace(t, \"{\", \"^{\", -1)\n\tt = strings.Replace(t, \"}\", \"^}\", -1)\n\ts.writeIndent(false)\n\ts.writer.WriteString(t)\n\treturn nil\n}", "title": "" }, { "docid": "eae2991acdf42bb35ae6381d6c6baefb", "score": "0.44920456", "text": "func (c *Patch) applyTransforms(input interface{}) (interface{}, error) {\n\tvar err error\n\tfor i, t := range c.Transforms {\n\t\tif input, err = t.Transform(input); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, errFmtTransformAtIndex, i)\n\t\t}\n\t}\n\treturn input, nil\n}", "title": "" }, { "docid": "6749d1cf8a5312c86482bc9285bbe623", "score": "0.4484919", "text": "func (b *EmailConfigApplyConfiguration) WithText(value string) *EmailConfigApplyConfiguration {\n\tb.Text = &value\n\treturn b\n}", "title": "" }, { "docid": "7a44dbfedb09e5326f5bda7e04c7221d", "score": "0.4483721", "text": "func (self *Expression) ReplaceAll(content string, replacement string) string {\n return self.Internal.ReplaceAllString(content, replacement)\n}", "title": "" }, { "docid": "bf9aeb9be9fe66a2bf4e0600fe1610fc", "score": "0.4477401", "text": "func (fn *formulaFuncs) replace(name string, argsList *list.List) formulaArg {\n\tif argsList.Len() != 4 {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, fmt.Sprintf(\"%s requires 4 arguments\", name))\n\t}\n\tsourceText, targetText := argsList.Front().Value.(formulaArg).Value(), argsList.Back().Value.(formulaArg).Value()\n\tstartNumArg, numCharsArg := argsList.Front().Next().Value.(formulaArg).ToNumber(), argsList.Front().Next().Next().Value.(formulaArg).ToNumber()\n\tif startNumArg.Type != ArgNumber {\n\t\treturn startNumArg\n\t}\n\tif numCharsArg.Type != ArgNumber {\n\t\treturn numCharsArg\n\t}\n\tsourceTextLen, startIdx := len(sourceText), int(startNumArg.Number)\n\tif startIdx > sourceTextLen {\n\t\tstartIdx = sourceTextLen + 1\n\t}\n\tendIdx := startIdx + int(numCharsArg.Number)\n\tif endIdx > sourceTextLen {\n\t\tendIdx = sourceTextLen + 1\n\t}\n\tif startIdx < 1 || endIdx < 1 {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, formulaErrorVALUE)\n\t}\n\tresult := sourceText[:startIdx-1] + targetText + sourceText[endIdx-1:]\n\treturn newStringFormulaArg(result)\n}", "title": "" }, { "docid": "1423bb084ce6380daf8b85a1bf52f1cc", "score": "0.44751674", "text": "func (m *MonkeyWrench) applyMutations(mutations []*spanner.Mutation) error {\n\t_, err := m.Client.Apply(m.Context, mutations)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9dc5217bec24332b0868f78af32ecec4", "score": "0.44688022", "text": "func (ed *Editor) Replace(s string) {\n\ted.initTransformation()\n\ted.putString(s)\n\ted.commitTransformation()\n\ted.autoscroll()\n\ted.dirty = true\n}", "title": "" }, { "docid": "963f0b801a855074fc5dadd459f3c868", "score": "0.44623533", "text": "func (g *Generator) applyTemplate(tplName string, data interface{}) error {\n\ttplFuncMap := make(template.FuncMap)\n\tcache := make(map[string]interface{})\n\ttplFuncMap[\"ToSnake\"] = strcase.ToSnake\n\ttplFuncMap[\"Add\"] = func(a, b int) int {\n\t\treturn a + b\n\t}\n\ttplFuncMap[\"CacheSet\"] = func(key string, value interface{}) string {\n\t\tcache[key] = value\n\t\treturn \"\"\n\t}\n\ttplFuncMap[\"CacheGet\"] = func(key string) interface{} {\n\t\treturn cache[key]\n\t}\n\ttplContent, err := g.box.FindString(tplName)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttpl, err := template.New(\"\").Funcs(tplFuncMap).Parse(tplContent)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn tpl.Execute(&g.buf, data)\n}", "title": "" }, { "docid": "c4fbb94b0ba54acd68420e0bca2e44fc", "score": "0.44615233", "text": "func Substitute(template string, mapping Mapping) (string, error) {\n\treturn SubstituteWith(template, mapping, defaultPattern, DefaultSubstituteFuncs...)\n}", "title": "" }, { "docid": "6998d0cad593e9d978545bd5585d262e", "score": "0.44588566", "text": "func suggestReplacements(n *trie.Node, results *suggestions, q string, maxEdits uint, logEdits LogEditsT) {\n\tif len(q) > 0 {\n\t\trest := q[1:]\n\t\tfst := string(q[0])\n\t\tfor ch, child := range n.Children {\n\t\t\tlogEdits(maxEdits, \"Replacing\", fst, \"with\", string(ch),\n\t\t\t\t\"->\", n.Val+string(ch)+rest)\n\t\t\tsuggestAllRecur(child, results, rest, maxEdits, logEdits)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a6dcbc1906a08009d2bb0d83c454a9a6", "score": "0.444552", "text": "func (c *CodeInstance) Replace(s *style.Shortcut) (reqs []*docs.Request) {\n\tfor {\n\t\tif res := s.Regex.FindStringSubmatchIndex(c.Code); res != nil {\n\t\t\tutf8DelStart, utf8DelEnd := res[0], res[1]\n\t\t\tutf16DelStart, utf16DelEnd := getUTF16SubstrIndices(c.Code[utf8DelStart:utf8DelEnd], c.Code, *c.StartIndex)\n\n\t\t\t// delete target and insert replacement string\n\t\t\tutf16DelRange := request.GetRange(utf16DelStart, utf16DelEnd, \"\")\n\t\t\treqs = append(reqs, request.Delete(utf16DelRange))\n\t\t\treqs = append(reqs, request.Insert(s.Replace, utf16DelStart))\n\n\t\t\t// update end index for utf16 difference\n\t\t\tutf16InsSize := GetUtf16StringSize(s.Replace)\n\t\t\tnewEndIndex := *c.EndIndex + utf16InsSize - (utf16DelEnd - utf16DelStart)\n\t\t\tc.EndIndex = &newEndIndex\n\n\t\t\t// replace c.Code\n\t\t\tc.Code = c.Code[:utf8DelStart] + s.Replace + c.Code[utf8DelEnd:]\n\t\t\tcontinue\n\t\t}\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "aade70a94b878f9d55825362d029c778", "score": "0.4430442", "text": "func (s stringSource) ReplaceRunes(byteOffset, runeCount int64, str string) {\n}", "title": "" }, { "docid": "f52bab8eb88018d22850b5e6d206cf98", "score": "0.4422814", "text": "func (d *Driver) Apply(s string, parameters map[string]interface{}) (string, error) {\n\tdata, err := mustache.Render(s, parameters)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to execute mustache template\")\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "8cb1a41453f3b2c8ccd15d4e2c8a08fe", "score": "0.44118133", "text": "func (r *Render) Replace(fstTmpl *fasttemplate.Template, replaceMap map[string]string, allowUnresolved bool) (string, error) {\n\tvar unresolvedErr error\n\treplacedTmpl := fstTmpl.ExecuteFuncString(func(w io.Writer, tag string) (int, error) {\n\n\t\ttrimmedTag := strings.TrimSpace(tag)\n\n\t\treplacement, ok := replaceMap[trimmedTag]\n\t\tif len(trimmedTag) == 0 || !ok {\n\t\t\tif allowUnresolved {\n\t\t\t\t// just write the same string back\n\t\t\t\treturn w.Write([]byte(fmt.Sprintf(\"{{%s}}\", tag)))\n\t\t\t}\n\t\t\tunresolvedErr = fmt.Errorf(\"failed to resolve {{%s}}\", tag)\n\t\t\treturn 0, nil\n\t\t}\n\t\t// The following escapes any special characters (e.g. newlines, tabs, etc...)\n\t\t// in preparation for substitution\n\t\treplacement = strconv.Quote(replacement)\n\t\treplacement = replacement[1 : len(replacement)-1]\n\t\treturn w.Write([]byte(replacement))\n\t})\n\tif unresolvedErr != nil {\n\t\treturn \"\", unresolvedErr\n\t}\n\n\treturn replacedTmpl, nil\n}", "title": "" }, { "docid": "14ee2cd7ec9cb35ddb4002e93c7655ca", "score": "0.43981868", "text": "func ReplaceAll(old, new string) MapFunc {\n\treturn func(s string) string { return strings.ReplaceAll(s, old, new) }\n}", "title": "" }, { "docid": "06758d909efbf059146d6412724b929c", "score": "0.43922925", "text": "func TestReplaceWords(t *testing.T) {\n var cases = []struct {\n input []string\n sentence string\n output string\n }{\n {\n input: []string{\"cat\", \"bat\", \"rat\"},\n sentence: \"the cattle was rattled by the battery\",\n output: \"the cat was rat by the bat\",\n },\n {\n input: []string{\"a\", \"b\", \"c\"},\n sentence: \"aadsfasf absbs bbab cadsfafs\",\n output: \"a a b c\",\n },\n }\n for _, c := range cases {\n x := replaceWords(c.input, c.sentence)\n if x != c.output {\n t.Fail()\n }\n }\n}", "title": "" }, { "docid": "840e39c9cf56210fad58e6232abec03c", "score": "0.43875933", "text": "func ApplyTemplate(templateName string, templateDefinition string, context interface{}) string {\n\n\ttemplate := safeParseTemplate(templateName, templateDefinition)\n\n\tvar buf bytes.Buffer\n\ttemplate.Execute(&buf, context)\n\treturn buf.String()\n}", "title": "" }, { "docid": "985eefe702db67dc604693b098dc8c64", "score": "0.43778694", "text": "func Apply(fn Term, args ...Term) Term {\n\tout := fn\n\tfor _, arg := range args {\n\t\tout = App{Fn: out, Arg: arg}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "d793f14e3a487138520f7cafa078dd57", "score": "0.43749848", "text": "func (s *stringIndexBasedReplacer) Replace(url string, macroProvider *macroProvider) (string, error) {\n\ttmplt := s.getTemplate(url)\n\n\tvar result strings.Builder\n\tcurrentIndex := 0\n\tdelimLen := len(delimiter)\n\tfor i, index := range tmplt.startingIndices {\n\t\tmacro := url[index : tmplt.endingIndices[i]+1]\n\t\t// copy prev part\n\t\tresult.WriteString(url[currentIndex : index-delimLen])\n\t\tvalue := macroProvider.GetMacro(macro)\n\t\tif value != \"\" {\n\t\t\tresult.WriteString(value)\n\t\t}\n\t\tcurrentIndex = index + len(macro) + delimLen\n\t}\n\tresult.WriteString(url[currentIndex:])\n\treturn result.String(), nil\n}", "title": "" }, { "docid": "2ed8a6c4527cab13762a93bc38df8413", "score": "0.4372338", "text": "func Replace(haystack, needle, gold string) string {\n\treturn strings.Replace(haystack, needle, gold, -1)\n}", "title": "" }, { "docid": "7208e06be095b2e6874f1dc35ef30981", "score": "0.43713173", "text": "func (m *matcher) apply(f func(c compilable)) {\n\tif m.root == nil {\n\t\treturn\n\t}\n\tm.root.apply(f)\n}", "title": "" }, { "docid": "2ad22d74455fd44a8ea1302198c216ea", "score": "0.43594578", "text": "func (s *State) apply(commit Commit) error {\n\t// state to identify proposals being processed\n\t// in the PendingProposals. Avoids linear loop to\n\t// remove entries from PendingProposals.\n\tvar processedProposals = map[string]bool{}\n\terr := s.applyProposals(commit.Updates, processedProposals)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = s.applyProposals(commit.Removes, processedProposals)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = s.applyProposals(commit.Adds, processedProposals)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0811d88ca0cc21c58478671cf55a9923", "score": "0.4358847", "text": "func (tb *Textbox) Replace(a, b rune) (int, error) {\n\tif !utf8.ValidRune(a) {\n\t\treturn 0, errors.New(\"invalid rune\")\n\t}\n\n\tcount := 0\n\tfor i := range tb.pixels {\n\t\tif tb.pixels[i] == a {\n\t\t\ttb.pixels[i] = b\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count, nil\n}", "title": "" }, { "docid": "841e2ab067280d6fe1dee7aac54b4b35", "score": "0.43541816", "text": "func RangeText(text string) (new string) {\n\tfor _, value := range text {\n\t\tnew += string(value) + \" \"\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "61ebd24c89c9a8a7781f464ea547995b", "score": "0.4348338", "text": "func Text(id ID, bb Rect, text string, style *TextStyle) {\n\tif style == nil {\n\t\tstyle = &gContext.Theme.Text\n\t}\n\tgContext.Text(id, &bb, text, style)\n\treturn\n}", "title": "" }, { "docid": "85f71d49e6592a775c8da03e1052015a", "score": "0.43481803", "text": "func (t TextTemplate) Render(input string) (string, error) {\n\ttemplateMap := t.ExtractTemplateRuleMap(input)\n\n\t// find no template to render\n\tif len(templateMap) == 0 {\n\t\treturn input, nil\n\t}\n\n\tfor k, v := range templateMap {\n\t\t// has new gjson syntax, add manually\n\t\tif strings.Contains(v, GJSONTag) {\n\t\t\tif _, exist := t.dict[k]; !exist {\n\t\t\t\tif err := t.setWithGJSON(k, v); err != nil {\n\t\t\t\t\treturn \"\", err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tt.ft = fasttemplate.New(input, t.beginToken, t.endToken)\n\treturn t.ft.ExecuteString(t.dict), nil\n}", "title": "" }, { "docid": "62afea302dd4e12f7c95ff84c516741b", "score": "0.43453273", "text": "func ReplaceCommonTags(text string) string {\n\tlog.Print(\"Replace html tags\")\n\tvar (\n\t\treBr = regexp.MustCompile(\"<br\\\\s*/?>\")\n\t\treHr = regexp.MustCompile(\"<hr.*?/?>\")\n\t\treP = regexp.MustCompile(\"<p>([^ ]+?)</p>\")\n\t\treBold = regexp.MustCompile(\"<b.*?/?>((?s:.*?))</b>\")\n\t\treStrong = regexp.MustCompile(\"<strong.*?>(.*?)</strong>\")\n\t\treItalic = regexp.MustCompile(\"<i>((?s:.+?))</i>\")\n\t\treSpan = regexp.MustCompile(\"<span.*?>(.*?)</span>\")\n\t\treCenter = regexp.MustCompile(\"<center>((?s:.*?))</center>\")\n\t\treFont = regexp.MustCompile(\"<font.+?color\\\\s*=\\\\\\\\?[\\\"«]?#?(\\\\w+)\\\\\\\\?[\\\"»]?.*?>((?s:.*?))</font>\")\n\t\treA = regexp.MustCompile(\"<a.+?href=\\\\\\\\?\\\"(.+?)\\\\\\\\?\\\".*?>(.+?)</a>\")\n\t\tres = text\n\t)\n\n\tres = strings.Replace(text, \"_\", \"\\\\_\", -1)\n\tif mrBr := reBr.FindAllStringSubmatch(text, -1); len(mrBr) > 0 {\n\t\tfor _, item := range mrBr {\n\t\t\tres = regexp.MustCompile(item[0]).ReplaceAllLiteralString(res, \"\\n\")\n\t\t}\n\t}\n\tif mrHr := reHr.FindAllStringSubmatch(res, -1); len(mrHr) > 0 {\n\t\tfor _, item := range mrHr {\n\t\t\tres = regexp.MustCompile(item[0]).ReplaceAllLiteralString(res, \"\\n\")\n\t\t}\n\t}\n\tif mrP := reP.FindAllStringSubmatch(res, -1); len(mrP) > 0 {\n\t\tfor _, item := range mrP {\n\t\t\tres = regexp.MustCompile(regexp.QuoteMeta(item[0])).\n\t\t\t\tReplaceAllLiteralString(res, fmt.Sprintf(\"\\n%s\", item[1]))\n\t\t}\n\t}\n\tif mrFont := reFont.FindAllStringSubmatch(res, -1); len(mrFont) > 0 {\n\t\tfor _, item := range mrFont {\n\t\t\tres = regexp.MustCompile(regexp.QuoteMeta(item[0])).\n\t\t\t\tReplaceAllLiteralString(res, fmt.Sprintf(\"%s\", item[2]))\n\t\t\t//ReplaceAllLiteral(res, []byte(fmt.Sprintf(\"#%s#%s#\", item[1], item[2])))\n\t\t}\n\t}\n\tif mrBold := reBold.FindAllStringSubmatch(res, -1); len(mrBold) > 0 {\n\t\tfor _, item := range mrBold {\n\t\t\tres = regexp.MustCompile(regexp.QuoteMeta(item[0])).\n\t\t\t\tReplaceAllLiteralString(res, fmt.Sprintf(\"*%s*\", item[1]))\n\t\t}\n\t}\n\tif mrStrong := reStrong.FindAllStringSubmatch(res, -1); len(mrStrong) > 0 {\n\t\tfor _, item := range mrStrong {\n\t\t\tres = regexp.MustCompile(regexp.QuoteMeta(item[0])).\n\t\t\t\tReplaceAllLiteralString(res, fmt.Sprintf(\"*%s*\", item[1]))\n\t\t}\n\t}\n\tif mrItalic := reItalic.FindAllStringSubmatch(res, -1); len(mrItalic) > 0 {\n\t\tfor _, item := range mrItalic {\n\t\t\tres = regexp.MustCompile(regexp.QuoteMeta(item[0])).\n\t\t\t\tReplaceAllLiteralString(res, fmt.Sprintf(\"_%s_\", item[1]))\n\t\t}\n\t}\n\tif mrSpan := reSpan.FindAllStringSubmatch(res, -1); len(mrSpan) > 0 {\n\t\tfor _, item := range mrSpan {\n\t\t\tres = regexp.MustCompile(regexp.QuoteMeta(item[0])).\n\t\t\t\tReplaceAllLiteralString(res, item[1])\n\t\t}\n\t}\n\tif mrCenter := reCenter.FindAllStringSubmatch(res, -1); len(mrCenter) > 0 {\n\t\tfor _, item := range mrCenter {\n\t\t\tres = regexp.MustCompile(regexp.QuoteMeta(item[0])).\n\t\t\t\tReplaceAllLiteralString(res, item[1])\n\t\t}\n\t}\n\tif mrA := reA.FindAllStringSubmatch(res, -1); len(mrA) > 0 {\n\t\tfor _, item := range mrA {\n\t\t\tres = regexp.MustCompile(regexp.QuoteMeta(item[0])).\n\t\t\t\tReplaceAllLiteralString(res, fmt.Sprintf(\"[%s](%s)\", item[2], item[1]))\n\t\t}\n\t}\n\tres = strings.Replace(res, \"&nbsp;\", \" \", -1)\n\tres = regexp.MustCompile(\"</?p>\").ReplaceAllLiteralString(res, \"\")\n\treturn string(res)\n}", "title": "" }, { "docid": "e64a3837c20ec6379b95c8df0d246b00", "score": "0.4337087", "text": "func (b *Builder) Italic(text string) string {\n\treturn fmt.Sprintf(\"*%s*\", text)\n}", "title": "" }, { "docid": "c328f9a339047f43b39ad3d9fc89ed19", "score": "0.4333405", "text": "func (cv *Canvas) FillText(str string, x, y float64) {\n\tif cv.state.font.font == nil {\n\t\treturn\n\t}\n\n\tscaleX := backendbase.Vec{cv.state.transform[0], cv.state.transform[1]}.Len()\n\tscaleY := backendbase.Vec{cv.state.transform[2], cv.state.transform[3]}.Len()\n\tscale := (scaleX + scaleY) * 0.5\n\tfontSize := fixed.Int26_6(math.Round(float64(cv.state.fontSize) * scale))\n\n\t// if the font size is large or rotated or skewed in some way, use the\n\t// triangulated font rendering\n\tif fontSize > fixed.I(25) {\n\t\tcv.fillText2(str, x, y)\n\t\treturn\n\t}\n\tmat := cv.state.transform\n\tif mat[1] != 0 || mat[2] != 0 || mat[0] != mat[3] {\n\t\tcv.fillText2(str, x, y)\n\t\treturn\n\t}\n\n\tfrc := cv.getFRContext(cv.state.font, fontSize)\n\tfnt := cv.state.font.font\n\n\tstrWidth, strHeight, textOffset, str := cv.measureTextRendering(str, &x, &y, frc, scale)\n\tif strWidth <= 0 || strHeight <= 0 {\n\t\treturn\n\t}\n\n\t// make sure textImage is large enough for the rendered string\n\tif textImage == nil || textImage.Bounds().Dx() < strWidth || textImage.Bounds().Dy() < strHeight {\n\t\tvar size int\n\t\tfor size = 2; size < alphaTexSize; size *= 2 {\n\t\t\tif size >= strWidth && size >= strHeight {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif size > alphaTexSize {\n\t\t\tsize = alphaTexSize\n\t\t}\n\t\ttextImage = image.NewAlpha(image.Rect(0, 0, size, size))\n\t}\n\n\t// clear the render region in textImage\n\tfor y := 0; y < strHeight; y++ {\n\t\toff := textImage.PixOffset(0, y)\n\t\tline := textImage.Pix[off : off+strWidth]\n\t\tfor i := range line {\n\t\t\tline[i] = 0\n\t\t}\n\t}\n\n\t// render the string into textImage\n\tcurX := x\n\tp := fixed.Point26_6{}\n\tprev, hasPrev := truetype.Index(0), false\n\tfor _, rn := range str {\n\t\tidx := fnt.Index(rn)\n\t\tif idx == 0 {\n\t\t\tprev = 0\n\t\t\thasPrev = false\n\t\t\tcontinue\n\t\t}\n\t\tif hasPrev {\n\t\t\tkern := fnt.Kern(fontSize, prev, idx)\n\t\t\tif frc.hinting != font.HintingNone {\n\t\t\t\tkern = (kern + 32) &^ 63\n\t\t\t}\n\t\t\tcurX += float64(kern) / 64\n\t\t}\n\t\tadvance, mask, offset, err := frc.glyph(idx, p)\n\t\tif err != nil {\n\t\t\tprev = 0\n\t\t\thasPrev = false\n\t\t\tcontinue\n\t\t}\n\t\tp.X += advance\n\n\t\tdraw.Draw(textImage, mask.Bounds().Add(offset).Sub(textOffset), mask, image.ZP, draw.Over)\n\n\t\tcurX += float64(advance) / 64\n\t}\n\n\t// render textImage to the screen\n\tvar pts [4]backendbase.Vec\n\tpts[0] = cv.tf(backendbase.Vec{float64(textOffset.X)/scale + x, float64(textOffset.Y)/scale + y})\n\tpts[1] = cv.tf(backendbase.Vec{float64(textOffset.X)/scale + x, float64(textOffset.Y)/scale + float64(strHeight)/scale + y})\n\tpts[2] = cv.tf(backendbase.Vec{float64(textOffset.X)/scale + float64(strWidth)/scale + x, float64(textOffset.Y)/scale + float64(strHeight)/scale + y})\n\tpts[3] = cv.tf(backendbase.Vec{float64(textOffset.X)/scale + float64(strWidth)/scale + x, float64(textOffset.Y)/scale + y})\n\n\tmask := textImage.SubImage(image.Rect(0, 0, strWidth, strHeight)).(*image.Alpha)\n\n\tcv.drawShadow(pts[:], mask, false)\n\n\tstl := cv.backendFillStyle(&cv.state.fill, 1)\n\tcv.b.FillImageMask(&stl, mask, pts)\n}", "title": "" }, { "docid": "a10d6f95f58d50829f85cba1aba2478a", "score": "0.4332101", "text": "func replace() {\n\tfor k, v := range replacements {\n\t\t//Get all the indexes for a Key\n\t\tindexes := allIndiciesForString(k, molecule)\n\t\tfor _, i := range indexes {\n\t\t\t//Save the head up to the index\n\t\t\thead := molecule[:i]\n\t\t\t//Save the tail from the index + lenght of the searched key\n\t\t\ttail := molecule[i+len(k):]\n\n\t\t\t//Create a string for all the replacement possbilities\n\t\t\tfor _, com := range v {\n\t\t\t\tnewMol := head + com + tail\n\t\t\t\tif !arrayutils.ContainsString(combinations, newMol) {\n\t\t\t\t\tcombinations = append(combinations, newMol)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2ba30b5a6c48133ce01178ff06dde3e4", "score": "0.4331929", "text": "func substitution(answer string) string {\n\treflections := map[string]string{\n\t\t\"am\": \"are\",\n\t\t\"was\": \"were\",\n\t\t\"i\": \"you\",\n\t\t\"i'd\": \"you would\",\n\t\t\"i've\": \"you have\",\n\t\t\"i'll\": \"you will\",\n\t\t\"my\": \"your\",\n\t\t\"are\": \"am\",\n\t\t\"you've\": \"I have\",\n\t\t\"you'll\": \"I will\",\n\t\t\"your\": \"my\",\n\t\t\"yours\": \"mine\",\n\t\t\"you\": \"me\",\n\t\t\"me\": \"you\",\n\t\t\"myself\": \"yourself\",\n\t\t\"yourself\": \"myself\",\n\t\t\"i'm\": \"you are\",\n\t}\n\n\twords := strings.Split(answer, \" \") // get slices of the words\n\n\tfor i, word := range words {\t// loop through whole sentence\n\t\tif val, ok := reflections[word]; ok {\t// check for the word in reflection\n\t\t\twords[i] = val // substitite the value\n\t\t}//if\n\t}//for\n\n\t// Return substituted string\n\treturn strings.Join(words, \" \") // join back into sentence\n}", "title": "" }, { "docid": "5abd16c6cb82af91ba90463874c0769e", "score": "0.4327744", "text": "func parseWithSubstitutions(content interface{}, subs *substitutions, opts ...Option) ([]interface{}, error) {\n\tserialized, placeholders, err := serialize(content)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(serialized) == 0 {\n\t\treturn nil, nil\n\t}\n\tif log.IsLevelEnabled(log.DebugLevel) {\n\t\tlog.Debugf(\"parsing '%s' with '%s' substitutions\", serialized, subs.toString())\n\t}\n\t// stats := Stats{}\n\telements, err := parseContent(serialized, append(opts, GlobalStore(enabledSubstitutionsKey, subs))...) // , Statistics(&stats, \"no match\"), Debug(false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\telements, err = placeholders.restore(elements)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif log.IsLevelEnabled(log.DebugLevel) {\n\t\tlog.Debugf(\"parsed content:\\n%s\", spew.Sdump(elements))\n\t}\n\tif log.IsLevelEnabled(log.InfoLevel) {\n\t\tlog.Infof(\"parsed '%s' with '%s' substitutions\", serialized, subs.toString())\n\t\t// log.Infof(\"stats:\")\n\t\t// log.Infof(\" expr count: %v\", stats.ExprCnt)\n\t\t// rules := make([]string, 0, len(stats.ChoiceAltCnt))\n\t\t// for rule := range stats.ChoiceAltCnt {\n\t\t// \trules = append(rules, rule)\n\t\t// }\n\t\t// sort.Strings(rules)\n\t\t// for _, rule := range rules {\n\t\t// \tlog.Infof(\" %s:\", rule)\n\t\t// \tmatchs := make([]string, 0, len(stats.ChoiceAltCnt[rule]))\n\t\t// \tfor match := range stats.ChoiceAltCnt[rule] {\n\t\t// \t\tmatchs = append(matchs, match)\n\t\t// \t}\n\t\t// \tsort.Strings(matchs)\n\t\t// \tfor _, match := range matchs {\n\t\t// \t\tlog.Infof(\" - case %s: %d\", match, stats.ChoiceAltCnt[rule][match])\n\n\t\t// \t}\n\t\t// }\n\t}\n\treturn elements, nil\n}", "title": "" }, { "docid": "b0911c4fd5679cfe012229c8f094fa29", "score": "0.43241698", "text": "func replaceWords(dict []string, sentence string) string {\n strs := strings.Split(sentence, \" \")\n for i := 0; i < len(strs); i++ {\n \tstrs[i] = traverseDict(strs[i], dict)\n }\n return strings.Join(strs, \" \")\n}", "title": "" }, { "docid": "d5547aa4583c8fd607437a43a7ebc961", "score": "0.43225703", "text": "func applyTemplate(name string, tmpl string, executor interface{}, fncs template.FuncMap) (string, error) {\n\tcodeTemplate := template.Must(template.New(name).Funcs(fncs).Parse(tmpl))\n\n\tcode := bytes.NewBuffer(nil)\n\terr := codeTemplate.Execute(code, executor)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"attempting to execute template %q\", name)\n\t}\n\treturn code.String(), nil\n}", "title": "" }, { "docid": "7b7343c5e8761ae138836b343cdb9419", "score": "0.43111235", "text": "func (r Rule) Applies(c context.Context, t Txn) bool {\n\tif r.Regexp {\n\t\tmatched, err := regexp.MatchString(r.Pattern, t.OriginalDisplayName)\n\t\tif err != nil {\n\t\t\tlog.Errorf(c, \"error applying rule regexp `%s` to string `%s`\", r.Pattern, t.OriginalDisplayName)\n\t\t\treturn false\n\t\t}\n\t\treturn matched\n\t}\n\treturn r.Pattern == t.OriginalDisplayName\n}", "title": "" }, { "docid": "beaa05ab4ffb1b5dbb78a9e82fa4f8c2", "score": "0.4298771", "text": "func (s *Server) MirrorText(ctx context.Context, in *pb.MirrorTextRequest) (*pb.MirrorTextResponse, error) {\n\tinput := in.Text\n\t// Get Unicode code points.\n\tn := 0\n\trune := make([]rune, len(input))\n\tfor _, r := range input {\n\t\trune[n] = r\n\t\tn++\n\t}\n\trune = rune[0:n]\n\n\t// Reverse\n\tfor i := 0; i < n/2; i++ {\n\t\trune[i], rune[n-1-i] = rune[n-1-i], rune[i]\n\t}\n\n\t// Convert back to UTF-8.\n\tout := &pb.MirrorTextResponse{Text: string(rune)}\n\treturn out, nil\n}", "title": "" }, { "docid": "329011b0c4e9afedb732512867f86158", "score": "0.42966664", "text": "func (s *Scope) Apply(f func()) {\n\ts.Call(\"$apply\", f)\n}", "title": "" }, { "docid": "dcce3d65727b12b6e7c8a1575fc2b66b", "score": "0.42856312", "text": "func (e *Editor) queryReplace() {\n\te.Searchtext = e.getInput(\"Query replace: \")\n\tif len(e.Searchtext) < 1 {\n\t\treturn\n\t}\n\te.Replace = e.getInput(\"With: \")\n\tslen := len(e.Searchtext)\n\tbp := e.CurrentBuffer\n\topoint := bp.Point\n\tlpoint := -1\n\task := true\n\t/* build query replace question string */\n\tquestion := fmt.Sprintf(\"Replace '%s' with '%s' ? \", e.Searchtext, e.Replace)\n\t/* scan through the file, from point */\n\tnumsub := 0\nouter:\n\tfor {\n\t\tfound := bp.searchForward(bp.Point, e.Searchtext)\n\t\t/* if not found set the point to the last point of replacement, or where we started */\n\t\tif found == -1 {\n\t\t\tif lpoint == -1 {\n\t\t\t\tbp.SetPoint(opoint)\n\t\t\t} else {\n\t\t\t\tbp.SetPoint(lpoint)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tbp.SetPoint(found)\n\t\t/* search_forward places point at end of search, move to start of search */\n\t\tfor k := 0; k < slen; k++ {\n\t\t\tbp.PointPrevious()\n\t\t}\n\t\te.Display(e.CurrentWindow, true)\n\n\t\tif ask == true {\n\t\t\tanswer := e.getInput(question)\n\n\t\tinner:\n\t\t\tfor {\n\t\t\t\te.Display(e.CurrentWindow, true)\n\t\t\t\tresp := []rune(answer)\n\t\t\t\tc := ' '\n\t\t\t\tif len(resp) > 0 {\n\t\t\t\t\tc = resp[0]\n\t\t\t\t}\n\t\t\t\tswitch c {\n\t\t\t\tcase 'y': /* yes, substitute */\n\t\t\t\t\tbreak inner\n\t\t\t\tcase 'n': /* no, find next */\n\t\t\t\t\tbp.SetPoint(found) /* set to end of search string */\n\t\t\t\tcase '!': /* yes/stop asking, do the lot */\n\t\t\t\t\task = false\n\t\t\t\t\tbreak inner\n\t\t\t\t//case 0x1B: /* esc */\n\t\t\t\t//flushinp() /* discard any escape sequence without writing in buffer */\n\t\t\t\tcase 'q': /* controlled exit */\n\t\t\t\t\tbreak outer\n\t\t\t\tdefault: /* help me */\n\t\t\t\t\tanswer = e.getInput(\"(y)es, (n)o, (!)do the rest, (q)uit: \")\n\t\t\t\t\t//continue inner\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor k := 0; k < slen; k++ { // delete found search text\n\t\t\tbp.Delete()\n\t\t}\n\t\tbp.Insert(e.Replace) // qed\n\t\tlpoint = bp.Point\n\t\tnumsub++\n\t}\n\te.msg(\"%d substitutions\", numsub)\n}", "title": "" }, { "docid": "7a3be5d1caa87c461e93b6ee96b4b85c", "score": "0.42829093", "text": "func (v *VerbalExpression) Replace(src string, dst string) string {\n\treturn v.Regex().ReplaceAllString(src, dst)\n}", "title": "" }, { "docid": "7bf0bc1eb16b23462d2a76f4e7f91718", "score": "0.42820948", "text": "func (mg *markovGen) ModelApply(title, text string, norma uint) {\n\tfor _, r := range mg.exclude {\n\t\ttext = strings.Replace(text, string(r), \"\", -1)\n\t}\n\tif len(text) < int(mg.depth) {\n\t\tpanic(\"the size of the text after the exclusion of characters must exceed the size of the element\")\n\t}\n\ttext = strings.Repeat(text, int(norma))\n\tmg.texts[title] = text\n\n\tta := strings.Split(text, \"\")\n\tfor i := range ta {\n\t\tj := i + int(mg.depth)\n\t\tif j > len(text) {\n\t\t\tcontinue\n\t\t}\n\t\titem := ta[i:j]\n\t\tmg.model = append(mg.model, strings.Join(item, \"\"))\n\t}\n\tfor len(mg.model) < 1 {\n\t\tmg.ModelApply(title, text, norma+1)\n\t}\n}", "title": "" }, { "docid": "2bcc82dddb7cfc4f54b5068ff780aa85", "score": "0.42678285", "text": "func Apply(nft Nft) error {\n\tdata, err := nft.MarshalText()\n\tif err != nil {\n\t\treturn err\n\t}\n\tf, err := ioutil.TempFile(\"\", \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tf.Close()\n\t\tos.RemoveAll(f.Name())\n\t}()\n\n\tif _, err := f.Write(data); err != nil {\n\t\treturn err\n\t}\n\tf.Close()\n\n\treturn ApplyFromFile(f.Name())\n}", "title": "" }, { "docid": "4ba3f4a92b7581ef7aad0cd4e3146805", "score": "0.42675456", "text": "func TranslProcessReplace(uri string, t *gnmipb.TypedValue, ctx context.Context) error {\n\t/* Form the CURL request and send to client . */\n\tstr := string(t.GetJsonIetfVal())\n\tstr3 := strings.Replace(str, \"\\n\", \"\", -1)\n\tlog.V(2).Info(\"Incoming JSON body is\", str)\n\n\tpayload := []byte(str3)\n\trc, ctx := common_utils.GetContext(ctx)\n\treq := translib.SetRequest{Path:uri, Payload:payload, User: translib.UserRoles{Name: rc.Auth.User, Roles: rc.Auth.Roles}}\n\tif rc.BundleVersion != nil {\n\t\tnver, err := translib.NewVersion(*rc.BundleVersion)\n\t\tif err != nil {\n\t\t\tlog.V(2).Infof(\"REPLACE operation failed with error =%v\", err.Error())\n\t\t\treturn err\n\t\t}\n\t\treq.ClientVersion = nver\n\t}\n\tif rc.Auth.AuthEnabled {\n\t\treq.AuthEnabled = true\n\t}\n\tresp, err1 := translib.Replace(req)\n\n\tif err1 != nil{\n\t\tlog.V(2).Infof(\"REPLACE operation failed with error =%v, %v\", resp.ErrSrc, err1.Error())\n\t\treturn err1\n\t}\n\n\n\treturn nil\n}", "title": "" }, { "docid": "a23b683f268c20a02af5de16d428188b", "score": "0.42665526", "text": "func Apply(q *queries.Query, mods ...QueryMod) {\n\tfor _, mod := range mods {\n\t\tmod(q)\n\t}\n}", "title": "" }, { "docid": "6444dd227a90c17081f43be527ed53a0", "score": "0.42586103", "text": "func (t *Text) Text(str string) *Text {\n\tt.output = str\n\tt.textLines++\n\tt.lines[t.textLines] = str\n\treturn t\n}", "title": "" }, { "docid": "6f00f1dc31e61481218fc4d2a63a8ad5", "score": "0.4257462", "text": "func Translate(from, to, text string, engines []string) ([]byte, error) {\n\tvar results []*result\n\tfor _, e := range engines {\n\t\tswitch e {\n\t\tcase Google:\n\t\t\tresults = append(results, newResult(Google, googleTranslate(from, to, text)))\n\n\t\tcase Baidu:\n\t\t\tresults = append(results, newResult(Baidu, baiduTranslate(from, to, text)))\n\t\t}\n\t}\n\treturn json.Marshal(results)\n}", "title": "" }, { "docid": "476ac5f53c08f9cca745c15fd3ac49e3", "score": "0.42339453", "text": "func (re *RegexpStd) ReplaceAll(src, repl []byte) []byte {\n\t// n := 2\n\t// if bytes.IndexByte(repl, '$') >= 0 {\n\t// \tn = 2 * (re.numSubexp + 1)\n\t// }\n\t// srepl := \"\"\n\t// b := re.replaceAll(src, \"\", n, func(dst []byte, match []int) []byte {\n\t// \tif len(srepl) != len(repl) {\n\t// \t\tsrepl = string(repl)\n\t// \t}\n\t// \treturn re.expand(dst, srepl, src, \"\", match)\n\t// })\n\t// return b\n\tpanic(\"\")\n}", "title": "" }, { "docid": "e8af4c1d9e0986a37cf10f841513b548", "score": "0.42233586", "text": "func (l *LexInner) Replace(start Mark, with string) {\n\tif with != \"\" {\n\t\tl.mark.replace = &Replacer{start, l.mark, with}\n\t}\n}", "title": "" }, { "docid": "3edb75575fa9d60b989a2f62a1d4596d", "score": "0.42215392", "text": "func (l *AutoLinker) Replace(message string) string {\n\tif l.pattern == nil {\n\t\treturn message\n\t}\n\n\t// beacuse MMDisableNonWordPrefix DisableNonWordSuffix are greedy then\n\t// two matches back to back won't get found. So we need to run the\n\t// replace all twice\n\tif !l.link.DisableNonWordPrefix && !l.link.DisableNonWordSuffix {\n\t\tmessage = string(l.pattern.ReplaceAll([]byte(message), []byte(l.link.Template)))\n\t}\n\n\treturn string(l.pattern.ReplaceAll([]byte(message), []byte(l.link.Template)))\n}", "title": "" }, { "docid": "04be29f71ae509f95f2e0a3fb810f3ae", "score": "0.42026028", "text": "func (e entitiesT) fixIndices(text string) {\n\tfor _, entity := range e {\n\t\tstart := utf8.RuneCountInString(text[:entity.ByteRange.Start])\n\t\tentity.Range.Start = start\n\t\tstop := utf8.RuneCountInString(entity.Text)\n\t\tentity.Range.Stop = start + stop\n\t}\n}", "title": "" }, { "docid": "575eb1c3e5d3ed844a2210ade47e47b5", "score": "0.42019984", "text": "func (r *Resolver) SetText(opts *bind.TransactOpts, name string, value string) (*types.Transaction, error) {\n\tnameHash, err := NameHash(r.domain)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r.Contract.SetText(opts, nameHash, name, value)\n}", "title": "" } ]
5a4a702f0732cc0cadf788bfaa0c6712
NewRecoverMsg return a recover msg
[ { "docid": "479e9f5af6e1fcdd0f82f06efbe9984d", "score": "0.7481172", "text": "func NewRecoverMsg(\n\tusername string, resetPubkey, transactionPubkey,\n\tappPubkey crypto.PubKey) RecoverMsg {\n\treturn RecoverMsg{\n\t\tUsername: types.AccountKey(username),\n\t\tNewResetPubKey: resetPubkey,\n\t\tNewTransactionPubKey: transactionPubkey,\n\t\tNewAppPubKey: appPubkey,\n\t}\n}", "title": "" } ]
[ { "docid": "af2fa3da3854c5fef68b329d19180fdf", "score": "0.64722025", "text": "func NewRecoveryMessage() RecoveryMessage {\n\treturn &recoveryMessage{\n\t\tpreparationPayloads: make([]preparationCompact, 0),\n\t\tcommitPayloads: make([]commitCompact, 0),\n\t\tchangeViewPayloads: make([]changeViewCompact, 0),\n\t}\n}", "title": "" }, { "docid": "c2707bc1c66f327781cbaca0bf12fc55", "score": "0.61441445", "text": "func New() Recover {\n\treturn new(defaultRecover)\n}", "title": "" }, { "docid": "2213d47732ecd78b2700aa21b150b540", "score": "0.5913013", "text": "func MessageRecover() {\n\tif r := recover(); r != nil {\n\t\tlog.Println(\"Recovered:\", string(debug.Stack()))\n\t}\n}", "title": "" }, { "docid": "045c100f377f691911e5bd0fa9c483f5", "score": "0.57962656", "text": "func (c *client) newMsg(opCode int16, receiver string, body string) *mirc.Message {\n\tmsg := mirc.NewMsg(opCode, receiver, body)\n\tmsg.Header.Sender = c.Nick\n\treturn msg\n}", "title": "" }, { "docid": "4640388f8ca893ecbf4af4d33a882de1", "score": "0.56292564", "text": "func newMessage(offset uint64, seed int) core.Message {\n\treturn core.Message{\n\t\tKey: []byte(fmt.Sprintf(\"key_%d\", seed)),\n\t\tValue: []byte(fmt.Sprintf(\"value_QnVpbHQgYnkgQm9nZGFuLUNpcHJpYW4gUnVzdSAoZ2l0aHViLmNvbS9iY3J1c3UpIGluIDIwMTkg_%d\", seed)),\n\t\tOffset: offset,\n\t\tTimestamp: time.Unix(0, int64(1553000000000+seed)),\n\t\tHeaders: []*core.Message_Header{\n\t\t\t{\n\t\t\t\tKey: fmt.Sprintf(\"header_key_%d\", seed),\n\t\t\t\tValue: []byte(fmt.Sprintf(\"header_value_IGFuZCB0aGUgd29yayB3YXMgZnVuIDop_%d\", seed)),\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e9b34fb868ce70034ed6ab0d90a61ba4", "score": "0.5611243", "text": "func NewMsg(key string) Msg {\n\treturn &msg{key: key}\n}", "title": "" }, { "docid": "751c95d763706f9af4968e39be41373d", "score": "0.54356754", "text": "func (s *Sender) Recover(ctx context.Context) error {\n\tctx, span := s.startProducerSpanFromContext(ctx, \"sb.Sender.Recover\")\n\tdefer span.End()\n\n\t// we expect the Sender, session or client is in an error state, ignore errors\n\tcloseCtx, cancel := context.WithTimeout(ctx, 10*time.Second)\n\tcloseCtx = tab.NewContext(closeCtx, span)\n\tdefer cancel()\n\t// we must close then rebuild the session/link atomically\n\ts.clientMu.Lock()\n\tdefer s.clientMu.Unlock()\n\t_ = s.close(closeCtx)\n\treturn s.newSessionAndLink(ctx)\n}", "title": "" }, { "docid": "c0755b6b297acf59aced47d6814762e9", "score": "0.53487694", "text": "func Msg(appID string, projectID int64, msgID string, expired int64, origin []byte) (err error) {\n\tkey := fmt.Sprintf(\"%s:%s:%s:%d:%s\", redisPrefix, \"msg\", appID, projectID, msgID)\n\t_, err = renew(key, expired, origin)\n\treturn\n}", "title": "" }, { "docid": "ba12376d29e2dfe28ff7c9f96d393e18", "score": "0.53224385", "text": "func newMessage(from string, clientID int32, msgType int32, arrVal int64, propNum int64, logLen int64, vals ...Action) *Message {\n\tmsg := &Message{\n\t\tFrom: from,\n\t\tClientID: clientID,\n\t\tMsgType: msgType,\n\t\tArrVal: arrVal,\n\t\tPropNum: propNum,\n\t\tLogLen: logLen,\n\t}\n\tif len(vals) != 0 {\n\t\tmsg.Vals = vals\n\t}\n\treturn msg\n}", "title": "" }, { "docid": "cf02e29c044539774cd697113477943a", "score": "0.5303995", "text": "func (client *XenClient) VMRecover(self string, session_to string, force bool) (err error) {\n\t_, err = client.APICall(\"VM.recover\", self, session_to, force)\n\tif err != nil {\n\t\treturn\n\t}\n\t// no return result\n\treturn\n}", "title": "" }, { "docid": "2b2dfa623e5a53298962b780ec39810f", "score": "0.52974576", "text": "func newMessage(command string, payload interface{}, author string) *Message {\n\tvar raw json.RawMessage\n\traw, _ = json.Marshal(payload)\n\t// additionally provide uuid\n\t// otherwise peer wont know if message that he has just received is his own (end of peer-ring)\n\t// or from another peer (he should display it and forward to next peer)\n\treturn &Message{\n\t\tAuthor: author,\n\t\tCommand: command,\n\t\tPayload: &raw,\n\t\tId: uuid.Must(uuid.NewV4()).String(),\n\t}\n}", "title": "" }, { "docid": "32c24637de42c725957be0ca0a869b50", "score": "0.5267956", "text": "func NewRecovery() *Recovery {\n\treturn &Recovery{\n\t\tLogger: log.New(os.Stdout, \"[negroni] \", 0),\n\t\tPrintStack: true,\n\t\tStackAll: false,\n\t\tStackSize: 1024 * 8,\n\t}\n}", "title": "" }, { "docid": "c341e6e2bb1b4b19e3fbab446f6df118", "score": "0.5254184", "text": "func NewMsgID(publisher peer.ID, seqno []byte) MsgID {}", "title": "" }, { "docid": "0f6bda1b89f9cff6c58b3d64b421129d", "score": "0.52526", "text": "func NewRecovery() *Recovery {\n\treturn &Recovery{}\n}", "title": "" }, { "docid": "6f20ab8d067077d2b15941ad07e1ba47", "score": "0.5251541", "text": "func (p *Pipe) newMessage() message {\n\tm := message{sourceID: p.uid}\n\tif len(p.params) > 0 {\n\t\tm.params = p.params\n\t\tp.params = make(map[string][]func())\n\t}\n\tif len(p.feedback) > 0 {\n\t\tm.feedback = p.feedback\n\t\tp.feedback = make(map[string][]func())\n\t}\n\treturn m\n}", "title": "" }, { "docid": "94eaba3715c3c8e78ce6b0f98ceaedf1", "score": "0.52187854", "text": "func (fs *fileStore) recoverMsgBlock(fi os.FileInfo, index uint32) (*msgBlock, error) {\n\tmb := &msgBlock{fs: fs, index: index, cexp: fs.fcfg.CacheExpire, noTrack: fs.noTrackSubjects()}\n\n\tmdir := filepath.Join(fs.fcfg.StoreDir, msgDir)\n\tmb.mfn = filepath.Join(mdir, fi.Name())\n\tmb.ifn = filepath.Join(mdir, fmt.Sprintf(indexScan, index))\n\tmb.sfn = filepath.Join(mdir, fmt.Sprintf(fssScan, index))\n\n\tif mb.hh == nil {\n\t\tkey := sha256.Sum256(fs.hashKeyForBlock(index))\n\t\tmb.hh, _ = highwayhash.New64(key[:])\n\t}\n\n\tvar createdKeys bool\n\n\t// Check if encryption is enabled.\n\tif fs.prf != nil {\n\t\tekey, err := os.ReadFile(filepath.Join(mdir, fmt.Sprintf(keyScan, mb.index)))\n\t\tif err != nil {\n\t\t\t// We do not seem to have keys even though we should. Could be a plaintext conversion.\n\t\t\t// Create the keys and we will double check below.\n\t\t\tif err := fs.genEncryptionKeysForBlock(mb); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcreatedKeys = true\n\t\t} else {\n\t\t\tif len(ekey) < minBlkKeySize {\n\t\t\t\treturn nil, errBadKeySize\n\t\t\t}\n\t\t\t// Recover key encryption key.\n\t\t\trb, err := fs.prf([]byte(fmt.Sprintf(\"%s:%d\", fs.cfg.Name, mb.index)))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tsc := fs.fcfg.Cipher\n\t\t\tkek, err := genEncryptionKey(sc, rb)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tns := kek.NonceSize()\n\t\t\tseed, err := kek.Open(nil, ekey[:ns], ekey[ns:], nil)\n\t\t\tif err != nil {\n\t\t\t\t// We may be here on a cipher conversion, so attempt to convert.\n\t\t\t\tif err = mb.convertCipher(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tmb.seed, mb.nonce = seed, ekey[:ns]\n\t\t\t}\n\t\t\tmb.aek, err = genEncryptionKey(sc, mb.seed)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif mb.bek, err = genBlockEncryptionKey(sc, mb.seed, mb.nonce); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\t// If we created keys here, let's check the data and if it is plaintext convert here.\n\tif createdKeys {\n\t\tif err := mb.convertToEncrypted(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Open up the message file, but we will try to recover from the index file.\n\t// We will check that the last checksums match.\n\tfile, err := os.Open(mb.mfn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tif fi, err := file.Stat(); fi != nil {\n\t\tmb.rbytes = uint64(fi.Size())\n\t} else {\n\t\treturn nil, err\n\t}\n\t// Grab last checksum from main block file.\n\tvar lchk [8]byte\n\tif mb.rbytes >= checksumSize {\n\t\tif mb.bek != nil {\n\t\t\tif buf, _ := mb.loadBlock(nil); len(buf) >= checksumSize {\n\t\t\t\tmb.bek.XORKeyStream(buf, buf)\n\t\t\t\tcopy(lchk[0:], buf[len(buf)-checksumSize:])\n\t\t\t}\n\t\t} else {\n\t\t\tfile.ReadAt(lchk[:], fi.Size()-checksumSize)\n\t\t}\n\t}\n\n\tfile.Close()\n\n\t// Read our index file. Use this as source of truth if possible.\n\tif err := mb.readIndexInfo(); err == nil {\n\t\t// Quick sanity check here.\n\t\t// Note this only checks that the message blk file is not newer then this file, or is empty and we expect empty.\n\t\tif (mb.rbytes == 0 && mb.msgs == 0) || bytes.Equal(lchk[:], mb.lchk[:]) {\n\t\t\tif mb.msgs > 0 && !mb.noTrack && fs.psim != nil {\n\t\t\t\tfs.populateGlobalPerSubjectInfo(mb)\n\t\t\t\t// Try to dump any state we needed on recovery.\n\t\t\t\tmb.tryForceExpireCacheLocked()\n\t\t\t}\n\t\t\tfs.addMsgBlock(mb)\n\t\t\treturn mb, nil\n\t\t}\n\t}\n\n\t// If we get data loss rebuilding the message block state record that with the fs itself.\n\tif ld, _ := mb.rebuildState(); ld != nil {\n\t\tfs.addLostData(ld)\n\t}\n\n\tif mb.msgs > 0 && !mb.noTrack && fs.psim != nil {\n\t\tfs.populateGlobalPerSubjectInfo(mb)\n\t\t// Try to dump any state we needed on recovery.\n\t\tmb.tryForceExpireCacheLocked()\n\t}\n\n\t// Rewrite this to make sure we are sync'd.\n\tmb.writeIndexInfo()\n\tmb.closeFDs()\n\tfs.addMsgBlock(mb)\n\treturn mb, nil\n}", "title": "" }, { "docid": "bbdd1f2af4ca578e977a524aa5a5e1e5", "score": "0.520581", "text": "func NewMsg(msgType string, parent ComposedMsg) (ComposedMsg, error) {\n\tvar msg ComposedMsg\n\n\tmsg.ParentHeader = parent.Header\n\tmsg.Header.Session = parent.Header.Session\n\tmsg.Header.Username = parent.Header.Username\n\tmsg.Header.MsgType = msgType\n\tmsg.Header.ProtocolVersion = ProtocolVersion\n\tmsg.Header.Timestamp = time.Now().UTC().Format(time.RFC3339)\n\n\tu, err := uuid.NewV4()\n\tif err != nil {\n\t\treturn msg, err\n\t}\n\tmsg.Header.MsgID = u.String()\n\n\treturn msg, nil\n}", "title": "" }, { "docid": "6781819dbe41e9cc9b6578afc8fcdc1a", "score": "0.5195941", "text": "func NewMsg(server string, gid string) *Msg {\n\treturn &Msg{TransBase: *NewTransBase(gid, \"msg\", server, \"\")}\n}", "title": "" }, { "docid": "170b259a5c8ec3d53eddae44789e3d16", "score": "0.51716965", "text": "func NewConfirmMessage(s string) ConfirmMessage{\n return ConfirmMessage{\n s:s,\n }\n}", "title": "" }, { "docid": "5d5abad9aa5229e2d7e28ac0210e8efc", "score": "0.51293194", "text": "func newDecMessage(encPayload []byte) (dec *decMessage) {\n\terr := lenCheck(len(encPayload), messageBytes)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdec = new(decMessage)\n\tdec.payload = make([]byte, messageBytes)\n\tcopy(dec.payload, encPayload)\n\treturn\n}", "title": "" }, { "docid": "664ea0c40a5ca0c0e43136053914d5ec", "score": "0.5129297", "text": "func NewProposeMsg(parent consensus.Hash, qc consensus.QuorumCert, cmd consensus.Command, view consensus.View, id hotstuff.ID) consensus.ProposeMsg {\n\treturn consensus.ProposeMsg{ID: id, Block: consensus.NewBlock(parent, qc, cmd, view, id)}\n}", "title": "" }, { "docid": "6cab742a91bf7cc63f9843fda3000bc9", "score": "0.51272744", "text": "func (_ECRecoveryMock *ECRecoveryMockTransactor) Recover(opts *bind.TransactOpts, hash [32]byte, sig []byte) (*types.Transaction, error) {\n\treturn _ECRecoveryMock.contract.Transact(opts, \"recover\", hash, sig)\n}", "title": "" }, { "docid": "20f6113b5a9e09ca40f26ab4aeb5d3fb", "score": "0.51127815", "text": "func Recover(phrase, extraWord string) (pvt mint.PrivateKey, err error) {\n\n\t// validate phrase\n\tif !Valid(phrase) {\n\t\terr = fmt.Errorf(\"invalid phrase\")\n\t\treturn\n\t}\n\n\t// hash phrase with salt (at least 8 bytes) and get 32 bytes for ed25519 seeding\n\tseed := pbkdf2.Key([]byte(phrase), []byte(\"mintmint\"+extraWord), 2048, 32, sha512.New)\n\tif len(seed) != ed25519.SeedSize {\n\t\terr = fmt.Errorf(\"seed is %v bytes, expected %v bytes\", len(seed), ed25519.SeedSize)\n\t\treturn\n\t}\n\n\t// new ed25519 key\n\tkey := ed25519.NewKeyFromSeed(seed)\n\n\t// prehash\n\tpvt, err = mint.BytesToPrivateKey(key.Prehash())\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b0542ef5b7b7f6c2b88c948892dfdeab", "score": "0.5105978", "text": "func NewMsg(msgType string, parent ComposedMsg) (msg ComposedMsg) {\n\tmsg.ParentHeader = parent.Header\n\tmsg.Header.Session = parent.Header.Session\n\tmsg.Header.Username = parent.Header.Username\n\tmsg.Header.MsgType = msgType\n\tu, _ := uuid.NewV4()\n\tmsg.Header.MsgID = u.String()\n\tmsg.Header.Version = protocolVersion\n\treturn\n}", "title": "" }, { "docid": "aaca3decf221e898f8601fbb608c8fd6", "score": "0.5102028", "text": "func (s *SQLStore) Recover() (*RecoveredState, error) {\n\ts.Lock()\n\tdefer s.Unlock()\n\tvar (\n\t\tclusterID string\n\t\tdata []byte\n\t\tversion int\n\t\terr error\n\t)\n\tr := s.db.QueryRow(sqlStmts[sqlRecoverServerInfo])\n\tif err := r.Scan(&clusterID, &data, &version); err != nil {\n\t\t// If there is no row, that means nothing to recover. Return nil for the\n\t\t// state and no error.\n\t\tif err == sql.ErrNoRows {\n\t\t\t// If there are channels, we should return an error.\n\t\t\tvar maxChannelID int64\n\t\t\tr := s.db.QueryRow(sqlStmts[sqlRecoverMaxChannelID])\n\t\t\tr.Scan(&maxChannelID)\n\t\t\tif maxChannelID > 0 {\n\t\t\t\treturn nil, ErrNoSrvButChannels\n\t\t\t}\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, sqlStmtError(sqlRecoverServerInfo, err)\n\t}\n\tif version != sqlVersion {\n\t\treturn nil, fmt.Errorf(\"sql: unsupported version: %v (supports [1..%v])\", version, sqlVersion)\n\t}\n\tinfo := &spb.ServerInfo{}\n\tif err := info.Unmarshal(data); err != nil {\n\t\treturn nil, err\n\t}\n\tif info.ClusterID != clusterID {\n\t\treturn nil, fmt.Errorf(\"sql: id %q in column does not match cluster ID in data %q\", clusterID, info.ClusterID)\n\t}\n\n\t// Create recovered state structure and fill it with server info.\n\trs := &RecoveredState{\n\t\tInfo: info,\n\t}\n\n\tvar clients []*Client\n\tcliRows, err := s.db.Query(sqlStmts[sqlRecoverClients])\n\tif err != nil && err != sql.ErrNoRows {\n\t\treturn nil, sqlStmtError(sqlRecoverClients, err)\n\t}\n\tdefer cliRows.Close()\n\tfor cliRows.Next() {\n\t\tvar (\n\t\t\tclientID string\n\t\t\thbInbox string\n\t\t\tproto []byte\n\t\t)\n\t\tif err := cliRows.Scan(&clientID, &hbInbox, &proto); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvar client *Client\n\t\tif len(proto) == 0 {\n\t\t\tclient = &Client{spb.ClientInfo{ID: clientID, HbInbox: hbInbox}}\n\t\t} else {\n\t\t\tinfo := spb.ClientInfo{}\n\t\t\tinfo.Unmarshal(proto)\n\t\t\tclient = &Client{info}\n\t\t}\n\t\tclients = append(clients, client)\n\t}\n\tcliRows.Close()\n\t// Set clients into recovered state.\n\trs.Clients = clients\n\n\t// Get the maxChannelID\n\tr = s.db.QueryRow(sqlStmts[sqlRecoverMaxChannelID])\n\terr = r.Scan(&s.maxChannelID)\n\tif err != nil && err != sql.ErrNoRows {\n\t\treturn nil, sqlStmtError(sqlRecoverMaxChannelID, err)\n\t}\n\t// If there was no channel recovered, we are done\n\tif s.maxChannelID == 0 {\n\t\treturn rs, nil\n\t}\n\t// Get the maxSubID\n\tr = s.db.QueryRow(sqlStmts[sqlRecoverMaxSubID])\n\tif err := r.Scan(&s.maxSubID); err != nil && err != sql.ErrNoRows {\n\t\treturn nil, sqlStmtError(sqlRecoverMaxSubID, err)\n\t}\n\n\t// Recover individual channels\n\tvar channels map[string]*RecoveredChannel\n\tchannelRows, err := s.db.Query(sqlStmts[sqlRecoverChannelsList])\n\tif err != nil && err != sql.ErrNoRows {\n\t\treturn nil, sqlStmtError(sqlRecoverChannelsList, err)\n\t}\n\tdefer channelRows.Close()\n\tfor channelRows.Next() {\n\t\tvar (\n\t\t\tchannelID int64\n\t\t\tname string\n\t\t\tmaxseq uint64 // We get that from the Channels table.\n\t\t\tmmseq uint64 // This is the max seq found in the Messages table for given channel.\n\t\t)\n\t\tif err := channelRows.Scan(&channelID, &name, &maxseq); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tchannelLimits := s.genericStore.getChannelLimits(name)\n\n\t\tmsgStore := s.newSQLMsgStore(name, channelID, &channelLimits.MsgStoreLimits)\n\n\t\t// We need to get the last seq from messages table before possibly expiring messages.\n\t\tr = s.preparedStmts[sqlGetLastSeq].QueryRow(channelID)\n\t\tif err := r.Scan(&mmseq); err != nil {\n\t\t\treturn nil, sqlStmtError(sqlGetLastSeq, err)\n\t\t}\n\t\t// If it is more than the one that was updated in the Channel row, then use this one.\n\t\tif mmseq > maxseq {\n\t\t\tmaxseq = mmseq\n\t\t}\n\n\t\tif err := s.applyLimitsOnRecovery(msgStore); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tr = s.preparedStmts[sqlRecoverChannelMsgs].QueryRow(channelID)\n\t\tvar (\n\t\t\ttotalCount int\n\t\t\tfirst uint64\n\t\t\tlast uint64\n\t\t\ttotalBytes uint64\n\t\t\tlastTimestamp int64\n\t\t)\n\t\tif err := r.Scan(&totalCount, &first, &last, &totalBytes, &lastTimestamp); err != nil && err != sql.ErrNoRows {\n\t\t\treturn nil, sqlStmtError(sqlRecoverChannelMsgs, err)\n\t\t}\n\t\tmsgStore.first = first\n\t\tmsgStore.last = last\n\t\tmsgStore.totalCount = totalCount\n\t\tmsgStore.totalBytes = totalBytes\n\n\t\tsubStore := s.newSQLSubStore(channelID, &channelLimits.SubStoreLimits)\n\t\t// Prevent scheduling to flusher while we are recovering\n\t\tif !s.opts.NoCaching {\n\t\t\t// By setting this to true, we prevent scheduling since\n\t\t\t// scheduling would occur only if needsFlush is false.\n\t\t\tsubStore.cache.needsFlush = true\n\t\t}\n\n\t\tvar subscriptions []*RecoveredSubscription\n\n\t\tsubRows, err := s.preparedStmts[sqlRecoverChannelSubs].Query(channelID)\n\t\tif err != nil {\n\t\t\treturn nil, sqlStmtError(sqlRecoverChannelSubs, err)\n\t\t}\n\t\tdefer subRows.Close()\n\t\tfor subRows.Next() {\n\t\t\tvar (\n\t\t\t\tlastSent uint64\n\t\t\t\tprotoBytes []byte\n\t\t\t\tap *sqlSubAcksPending\n\t\t\t)\n\t\t\tif err := subRows.Scan(&lastSent, &protoBytes); err != nil && err != sql.ErrNoRows {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif protoBytes != nil {\n\t\t\t\tsub := &spb.SubState{}\n\t\t\t\tif err := sub.Unmarshal(protoBytes); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\t// We need to use the max of lastSent column or the one in the proto\n\t\t\t\tif lastSent > sub.LastSent {\n\t\t\t\t\tsub.LastSent = lastSent\n\t\t\t\t}\n\t\t\t\tif s.opts.NoCaching {\n\t\t\t\t\t// We can remove entries for sequence that are below the smallest\n\t\t\t\t\t// sequence that was found in Messages.\n\t\t\t\t\tif _, err := s.preparedStmts[sqlRecoverDoPurgeSubsPending].Exec(sub.ID, msgStore.first); err != nil {\n\t\t\t\t\t\treturn nil, sqlStmtError(sqlRecoverDoPurgeSubsPending, err)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tap = subStore.getOrCreateAcksPending(sub.ID, 0)\n\t\t\t\t}\n\t\t\t\trows, err := s.preparedStmts[sqlRecoverSubPending].Query(sub.ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, sqlStmtError(sqlRecoverSubPending, err)\n\t\t\t\t}\n\t\t\t\tdefer rows.Close()\n\t\t\t\tpendingAcks := make(PendingAcks)\n\t\t\t\tvar gcedRows map[uint64]struct{}\n\t\t\t\tif !s.opts.NoCaching {\n\t\t\t\t\tgcedRows = make(map[uint64]struct{})\n\t\t\t\t}\n\t\t\t\tfor rows.Next() {\n\t\t\t\t\tif err := subStore.recoverPendingRow(rows, sub, ap, pendingAcks, gcedRows); err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trows.Close()\n\n\t\t\t\tif s.opts.NoCaching {\n\t\t\t\t\t// Update the in-memory map tracking last sent\n\t\t\t\t\tsubStore.subLastSent[sub.ID] = sub.LastSent\n\t\t\t\t} else {\n\t\t\t\t\t// Go over garbage collected rows and delete them\n\t\t\t\t\tfor rowID := range gcedRows {\n\t\t\t\t\t\tif err := subStore.deleteSubPendingRow(sub.ID, rowID); err != nil {\n\t\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Add to the recovered subscriptions\n\t\t\t\tif sub.LastSent > maxseq {\n\t\t\t\t\tmaxseq = sub.LastSent\n\t\t\t\t}\n\t\t\t\tsubscriptions = append(subscriptions, &RecoveredSubscription{Sub: sub, Pending: pendingAcks})\n\t\t\t} else if lastSent > maxseq {\n\t\t\t\tmaxseq = lastSent\n\t\t\t}\n\t\t}\n\t\tsubRows.Close()\n\n\t\t// Since messages may have been removed due to limits, or having a higher\n\t\t// last_sent in some of the subscription, update first/last based on known\n\t\t// max sequence.\n\t\tif maxseq > msgStore.last {\n\t\t\tmsgStore.first = maxseq + 1\n\t\t\tmsgStore.last = maxseq\n\t\t}\n\n\t\tif !s.opts.NoCaching {\n\t\t\t// Clear but also allow scheduling now that the recovery is complete.\n\t\t\tsubStore.cache.needsFlush = false\n\t\t}\n\n\t\trc := &RecoveredChannel{\n\t\t\tChannel: &Channel{\n\t\t\t\tMsgs: msgStore,\n\t\t\t\tSubs: subStore,\n\t\t\t},\n\t\t\tSubscriptions: subscriptions,\n\t\t}\n\t\tif channels == nil {\n\t\t\tchannels = make(map[string]*RecoveredChannel)\n\t\t}\n\t\tchannels[name] = rc\n\t\ts.channels[name] = rc.Channel\n\t}\n\tchannelRows.Close()\n\n\t// Set channels into recovered state\n\trs.Channels = channels\n\n\treturn rs, nil\n}", "title": "" }, { "docid": "5d2fc00fc4da281eeabb210951535cef", "score": "0.5085069", "text": "func ReadNew(r io.Reader, sourceAddress string) (*Message, error) {\n\tmessage := Message{}\n\tcontentLength, err := message_fields.ReadInt32(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcontentLength = contentLength - (message_fields.SizeMessageLength + message_fields.SizeTimestamp + message_fields.SizeMessageType + message_fields.SizeNodeIdentifier + message_fields.SizeSignature)\n\tmessage.Timestamp, err = message_fields.ReadInt64(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmessage.Type, err = message_fields.ReadInt16(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif contentLength > 0 {\n\t\tswitch message.Type {\n\t\tcase TypeBlockRequest:\n\t\t\tmessage.Content = &message_content.BlockRequest{}\n\t\tcase TypeBlockResponse:\n\t\t\tmessage.Content = &message_content.BlockResponse{}\n\t\tcase TypeMeshResponse:\n\t\t\tmessage.Content = &message_content.MeshResponse{}\n\t\tcase TypeStatusResponse:\n\t\t\tmessage.Content = &message_content.StatusResponse{}\n\t\tcase TypeMissingBlockVoteRequest:\n\t\t\tmessage.Content = &message_content.MissingBlockVoteRequest{}\n\t\tcase TypeMissingBlockRequest:\n\t\t\tmessage.Content = &message_content.MissingBlockRequest{}\n\t\tcase TypeBootstrapRequest:\n\t\t\tmessage.Content = &message_content.BootstrapRequest{}\n\t\tcase TypeBootstrapResponse:\n\t\t\tmessage.Content = &message_content.BootstrapResponse{}\n\t\tcase TypeNodeJoin:\n\t\t\tmessage.Content = &message_content.NodeJoin{}\n\t\tcase TypeNodeJoinResponse:\n\t\t\tmessage.Content = &message_content.NodeJoinResponse{}\n\t\tcase TypeBlockWithVotesResponse:\n\t\t\tmessage.Content = &message_content.BlockWithVotesResponse{}\n\t\tcase TypeIpAddressResponse:\n\t\t\tmessage.Content = &message_content.IpAddress{}\n\t\tcase TypeWhitelistResponse:\n\t\t\tmessage.Content = &message_content.BooleanResponse{}\n\t\tdefault:\n\t\t\tmessage.Content = &message_content.Default{}\n\t\t}\n\t\terr := message.Content.Read(r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tmessage.SourceId, err = message_fields.ReadNodeId(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif message_fields.AllZeroes(message.SourceId) {\n\t\treturn nil, errors.New(\"cannot convert incoming message, source ID is all zeroes\")\n\t}\n\tmessage.Signature, err = message_fields.ReadSignature(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// TODO: like the Java version, we re-serialize here to check the signature. This is very costly (but safer).\n\tif !ed25519.Verify(message.SourceId, message.SerializeForSigning(), message.Signature) {\n\t\treturn nil, errors.New(\"message signature invalid, source address: \" + sourceAddress)\n\t}\n\tsplit := strings.Split(sourceAddress, \":\")\n\tparsed := net.ParseIP(split[0])\n\tif parsed == nil {\n\t\treturn nil, errors.New(\"cannot convert incoming message, source IP cannot be parsed\")\n\t}\n\tmessage.SourceIP = parsed[len(parsed)-4:]\n\tif message_fields.AllZeroes(message.SourceIP) || utilities.IsPrivateIP(parsed) {\n\t\treturn nil, errors.New(\"cannot convert incoming message, source IP is zero or from a private range\")\n\t}\n\treturn &message, nil\n}", "title": "" }, { "docid": "3542dc6a06a2db3e7ba9b270a6057293", "score": "0.5065547", "text": "func Recover(t *testing.T, msg string, fn func()) {\n\t(Want{t, 3}).Recover(msg, fn)\n}", "title": "" }, { "docid": "e0bc237ff1e5c86958df3d069f1926d0", "score": "0.5053902", "text": "func NewRecovery() *Recovery {\n\treturn &Recovery{\n\t\tStackAll: false,\n\t\tStackSize: 1024 * 8,\n\t}\n}", "title": "" }, { "docid": "eaaaef5190c018a75b2503656765acd0", "score": "0.5053569", "text": "func (_ECRecoveryMock *ECRecoveryMockTransactorSession) Recover(hash [32]byte, sig []byte) (*types.Transaction, error) {\n\treturn _ECRecoveryMock.Contract.Recover(&_ECRecoveryMock.TransactOpts, hash, sig)\n}", "title": "" }, { "docid": "e450343b07d6623027ec8f13e31490b4", "score": "0.5032599", "text": "func (a *API) Recover(ctx context.Context, w http.ResponseWriter, r *http.Request) {\n\tparams := &RecoverParams{}\n\tjsonDecoder := json.NewDecoder(r.Body)\n\terr := jsonDecoder.Decode(params)\n\tif err != nil {\n\t\tBadRequestError(w, fmt.Sprintf(\"Could not read verification params: %v\", err))\n\t\treturn\n\t}\n\n\tif params.Email == \"\" {\n\t\tUnprocessableEntity(w, fmt.Sprintf(\"Password recovery requires an email\"))\n\t\treturn\n\t}\n\n\tuser, err := a.db.FindUserByEmail(params.Email)\n\tif err != nil {\n\t\tif models.IsNotFoundError(err) {\n\t\t\tNotFoundError(w, err.Error())\n\t\t} else {\n\t\t\tInternalServerError(w, err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tuser.GenerateRecoveryToken()\n\tif err := a.db.UpdateUser(user); err != nil {\n\t\tInternalServerError(w, err.Error())\n\t\treturn\n\t}\n\n\tif err := a.mailer.RecoveryMail(user); err != nil {\n\t\tInternalServerError(w, fmt.Sprintf(\"Error sending confirmation mail: %v\", err))\n\t\treturn\n\t}\n\n\tsendJSON(w, 200, &map[string]string{})\n}", "title": "" }, { "docid": "4219ebc6f1387e63c0561d921ff366fa", "score": "0.5031833", "text": "func NewMsg(msgType string, data []byte) Message {\n\treturn new(msgType, \"\", data)\n}", "title": "" }, { "docid": "098f2281564b46e178dd569a7f40002d", "score": "0.50259787", "text": "func (_ECRecoveryMock *ECRecoveryMockSession) Recover(hash [32]byte, sig []byte) (*types.Transaction, error) {\n\treturn _ECRecoveryMock.Contract.Recover(&_ECRecoveryMock.TransactOpts, hash, sig)\n}", "title": "" }, { "docid": "0eb2d79aa155bb68ebd8fc98ffb8e2b8", "score": "0.4963545", "text": "func New(msg string, ref ...int) error {\n\trefCode := InternalError\n\tif len(ref) == 1 {\n\t\trefCode = ref[0]\n\t}\n\treturn Error{\n\t\tReference: refCode,\n\t\tErr: msg,\n\t}\n}", "title": "" }, { "docid": "d4b0fa1a4069697f81d55e5377a33fc0", "score": "0.49589238", "text": "func (m *Master) handleNewMsg(connId int, payload []byte, err error) {\n\tif err != nil {\n\t\tif job, present := m.jobs[connId]; present {\n\t\t\t// client lost\n\t\t\tjob.isLost = true\n\t\t\tjob.numTaskFinished += job.pendingTasks.Len()\n\t\t\tjob.pendingTasks.Init()\n\t\t} else if _, present := m.miners[connId]; present {\n\t\t\t// miner lost\n\t\t\tm.handleLostMiner(connId)\n\t\t}\n\n\t} else {\n\t\tmsg := new(bitcoin.Message)\n\t\tjson.Unmarshal(payload, msg)\n\n\t\tswitch msg.Type {\n\t\tcase bitcoin.Request:\n\t\t\tm.handleClientRequest(connId, msg)\n\t\tcase bitcoin.Result:\n\t\t\tm.handleMinerResult(connId, msg)\n\t\tcase bitcoin.Join:\n\t\t\tm.handleMinerJoin(connId)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "12bed32f9f7d9260d2f9507cf05c98cb", "score": "0.495362", "text": "func exampleRecover() {\n\tn := panicFunction()\n\tfmt.Println(\"main received\", n)\n}", "title": "" }, { "docid": "abe8d8aee50898d677ce5668a9e5e72e", "score": "0.49454036", "text": "func (s *server)GetMsg(ctx context.Context, in *pb.HelloRequest) (*pb.HelloMessage, error) {\n\treturn &pb.HelloMessage{\n\t\tMsg: \" message is: \" + in.Msg,\n\t}, nil\n}", "title": "" }, { "docid": "21e3e8f96c136cc390f540e19132e283", "score": "0.49326196", "text": "func (n *Node) RecvMsg() *Message {\n\treturn <-n.Read\n}", "title": "" }, { "docid": "1a1040aa26f4a3244a4f5255fad13702", "score": "0.49295527", "text": "func (msg MsgRescueCeth) Type() string { return \"rescue_ceth\" }", "title": "" }, { "docid": "0fa609cb2e6ca70b0fdd12c1cb668a20", "score": "0.49246567", "text": "func NewCurrent(uri string) *Msg {\n\treturn &Msg{\n\t\tType: Current,\n\t\tURI: uri,\n\t}\n}", "title": "" }, { "docid": "25942b1cda9937777d3d21c04f7f73a0", "score": "0.49057353", "text": "func NewMessage(o ipld.Object) (Message, error) {\n\n}", "title": "" }, { "docid": "61a266ee1d11b0e7ac95d7417a6ac214", "score": "0.4886696", "text": "func (c *client) newServMsg(opCode int16, body string) *mirc.Message {\n\treturn c.newMsg(opCode, \"server\", body)\n}", "title": "" }, { "docid": "2ca0eccd47771b5c5b0f1e2a571b2447", "score": "0.48863664", "text": "func (d *Driver) DiscoverNew(request *network.DiscoveryNotification) error {\n\treturn fmt.Errorf(\"not supported\")\n}", "title": "" }, { "docid": "fc6394e30206905e160b6be17b168690", "score": "0.48695806", "text": "func NewMessage() Message {\n\treturn Message{\n\t\tParts: [][]byte{},\n\t}\n}", "title": "" }, { "docid": "e5b52bcfbcd06b8d25245253db8f9f4e", "score": "0.48687983", "text": "func NewMessage(rawData string) (message, error) {\n\tlength, messageType, bitmap1, bitmap2, data, err := splitMessage(rawData)\n\tif err != nil {\n\t\treturn message{}, err\n\t}\n\n\tmessageFields, err := getMessageFields(bitmap1, bitmap2)\n\tif err != nil {\n\t\treturn message{}, err\n\t}\n\n\treturn message{\n\t\trawData: rawData,\n\t\tlength: length,\n\t\tmessageType: messageType,\n\t\tbitmap1: bitmap1,\n\t\tbitmap2: bitmap2,\n\t\tdata: data,\n\t\tmessageFields: messageFields,\n\t}, nil\n}", "title": "" }, { "docid": "75b9a9326a065d99c85dc3e7e67d1da5", "score": "0.48615798", "text": "func NewMsgCreateInvoice(statesetID, invoiceId string, invoiceNumber string, billingReason string, amountDue sdk.Coin, amountpaid sdk.Coin, amountRemaining sdk.Coin, subtotal Int, total Int, dueDate Date, periodStartDate Date, periodEndDate Date, merchant sdk.AccAddress, source string) MsgCreateInvoice {\r\n\treturn MsgCreateInvoice{\r\n\t\tStatesetID: statesetID,\r\n\t\tInvoice: invoiceID,\r\n\t\tInvoiceNumber: invoiceNumber,\r\n\t\tInvoiceName: invoiceName,\r\n\t\tBillingReason: billingReason,\r\n\t\tAmountDue: amountDue,\r\n\t\tAmountPaid: amountPaid,\r\n\t\tAmountRemaining: amountRemaining,\r\n\t\tSubtotal: subtotal,\r\n\t\tTotal: total,\r\n\t\tParty: party,\r\n\t\tCounterparty: counterparty,\r\n\t\tDueDate: dueDate,\r\n\t\tPeriodStartDate: periodStartDate\r\n\t\tPeriodEndDate: periodEndDate\r\n\t\tPaid: paid,\r\n\t\tActive: active,\r\n\t\tCreatedTime: CreatedTime\r\n\t}\r\n}", "title": "" }, { "docid": "d1d96a9a9c2c581691154c40c26f5470", "score": "0.48514274", "text": "func rebaseMessage(cls error, err error) string {\n\tdesc := errDesc(err)\n\tclss := cls.Error()\n\tif desc == clss {\n\t\treturn \"\"\n\t}\n\n\treturn strings.TrimSuffix(desc, \": \"+clss)\n}", "title": "" }, { "docid": "e16d2a57eec27055e9199160443cd609", "score": "0.4849914", "text": "func newBIoTMessage() (*BIoTMessage, error) {\n\tmsg := &BIoTMessage{\n\t\tSeverity: \"1\",\n\t\tMsgType: \"Q\",\n\t}\n\n\tid := uuid.New()\n\tmsg.MsgId = id.String()\n\n\treturn msg, nil\n}", "title": "" }, { "docid": "1b48eb6e165d69376b1e1f07a5ebede3", "score": "0.48439825", "text": "func NewInitialMsg(roomID int, guestID string) *InitialMsg {\n\treturn &InitialMsg{\n\t\tCmd: \"enterRoom\",\n\t\tRoomID: roomID,\n\t\tGuestID: guestID,\n\t\tNonopara: fmt.Sprintf(nonopara, guestID, time.Now()),\n\t\tUserName: \"test\",\n\t\tLevel: 1,\n\t\tReqID: 1,\n\t}\n}", "title": "" }, { "docid": "44ec3a5fee64342a515901a47e7ca10e", "score": "0.48402512", "text": "func New(msg string) error {\n\treturn Newf(msg)\n}", "title": "" }, { "docid": "5215a5e71b9a5bc5abc237be1ee10759", "score": "0.48346788", "text": "func (x *fastReflection_MsgCreate) New() protoreflect.Message {\n\treturn new(fastReflection_MsgCreate)\n}", "title": "" }, { "docid": "0f773b6d026fc3765d909108aa7c959c", "score": "0.4832864", "text": "func newMessageID() string {\n\treturn ulid.MustNew(ulid.Now(), rand.Reader).String()\n}", "title": "" }, { "docid": "06f6174a060fbff343865371759cd599", "score": "0.481911", "text": "func NewRegisterMsg(\n\treferrer string, newUser string, registerFee types.LNO,\n\tresetPubkey, transactionPubkey, appPubkey crypto.PubKey) RegisterMsg {\n\treturn RegisterMsg{\n\t\tReferrer: types.AccountKey(referrer),\n\t\tNewUser: types.AccountKey(newUser),\n\t\tRegisterFee: registerFee,\n\t\tNewResetPubKey: resetPubkey,\n\t\tNewTransactionPubKey: transactionPubkey,\n\t\tNewAppPubKey: appPubkey,\n\t}\n}", "title": "" }, { "docid": "a41ce3b1d6030dca6bde103a328f8e12", "score": "0.4803105", "text": "func newMessageView(g *libkb.GlobalContext, conversationID chat1.ConversationID, m chat1.MessageUnboxed) (mv messageView, err error) {\n\tdefer func() { mv.Body = emoji.Sprint(mv.Body) }()\n\tstate, err := m.State()\n\tif err != nil {\n\t\treturn mv, fmt.Errorf(\"unexpected empty message\")\n\t}\n\tswitch state {\n\tcase chat1.MessageUnboxedState_ERROR:\n\t\treturn newMessageViewError(g, conversationID, m.Error())\n\tcase chat1.MessageUnboxedState_OUTBOX:\n\t\treturn newMessageViewOutbox(g, conversationID, m.Outbox())\n\tcase chat1.MessageUnboxedState_VALID:\n\t\treturn newMessageViewValid(g, conversationID, m.Valid())\n\tdefault:\n\t\treturn mv, fmt.Errorf(\"unexpected message state: %v\", state)\n\t}\n\n}", "title": "" }, { "docid": "a2030809e48446c7d957bdf0042f44ca", "score": "0.47995964", "text": "func Decode(r io.Reader) (*Msg, error) {\n\tmsg := new(Msg)\n\tcheckRead := func(err error) {\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tmsgLen := make([]byte, 4)\n\t_, err := io.ReadFull(r, msgLen)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_msgLen := binary.BigEndian.Uint32(msgLen)\n\tif _msgLen > maxMsgLength {\n\t\treturn nil, errors.New(\"peer wire: too long msg\")\n\t}\n\tif _msgLen == 0 {\n\t\tmsg.Kind = KeepAlive\n\t\treturn msg, nil\n\t}\n\tbuf := make([]byte, _msgLen)\n\t_, err = io.ReadFull(r, buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb := bytes.NewBuffer(buf)\n\tcheckRead(readFromBinary(b, &msg.Kind))\n\tswitch msg.Kind {\n\tcase Choke, Unchoke, Interested, NotInterested:\n\tcase Have:\n\t\tcheckRead(readFromBinary(b, &msg.Index))\n\tcase Bitfield:\n\t\tmsg.Bf = b.Bytes()\n\tcase Request, Cancel:\n\t\tcheckRead(readFromBinary(b, &msg.Index, &msg.Begin, &msg.Len))\n\tcase Piece:\n\t\tcheckRead(readFromBinary(b, &msg.Index, &msg.Begin))\n\t\tmsg.Block = b.Bytes()\n\tcase Port:\n\t\tcheckRead(readFromBinary(b, &msg.Port))\n\tcase Extended:\n\t\tcheckRead(readFromBinary(b, &msg.ExtendedID))\n\t\terr = readExtension(msg.ExtendedID, b.Bytes(), msg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\treturn nil, errors.New(\"unknown kind of msg\")\n\t}\n\treturn msg, nil\n}", "title": "" }, { "docid": "c2131ac8ce609a51e6c24480f08dbfcf", "score": "0.4783943", "text": "func (m MsgNewDetailedInfo) construct() MsgDetailedInfoClass { return &m }", "title": "" }, { "docid": "b3c29f062eb6777bd8757a73837a9925", "score": "0.47746083", "text": "func (mm *MemberMaker) readMsg() (m *XLRegMsg, err error) {\n\tinBuf, err := mm.ReadData()\n\tif err == nil && inBuf != nil {\n\t\tm, err = mm.DecryptUnpadDecode(inBuf)\n\t}\n\treturn\n}", "title": "" }, { "docid": "58014bf004f996219a21e24267b403d4", "score": "0.47740647", "text": "func (s *VirtualMachineService) NewRecoverVirtualMachineParams(id string) *RecoverVirtualMachineParams {\n\tp := &RecoverVirtualMachineParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "title": "" }, { "docid": "2813c9dc8ba2a64047b63dbbdeda5ae9", "score": "0.47705805", "text": "func (c *Conn) RecvMsg() ([]byte, error) {\n\tisCmd, body, err := c.read()\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tif !isCmd {\n\t\treturn body, nil\n\t}\n\n\tvar cmd command\n\terr = cmd.unmarshalZMTP(body)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\t// FIXME(sbinet)\n\tswitch cmd.Name {\n\tcase cmdPing:\n\t\tpanic(\"got PING\")\n\t}\n\n\treturn cmd.Body, nil\n}", "title": "" }, { "docid": "f3371b54d061f4bc026c54717e5da1eb", "score": "0.47684658", "text": "func New(contintrptid string, clearingbusinessdate string, parties parties.Parties, expirationqty expirationqty.ExpirationQty, instrument instrument.Instrument) *Message {\n\tvar m Message\n\tm.SetContIntRptID(contintrptid)\n\tm.SetClearingBusinessDate(clearingbusinessdate)\n\tm.SetParties(parties)\n\tm.SetExpirationQty(expirationqty)\n\tm.SetInstrument(instrument)\n\treturn &m\n}", "title": "" }, { "docid": "fda5194d210fd31abd669c1f1b3e842c", "score": "0.47644278", "text": "func CreateRecipeMsgFromRef(ref string, t *testing.T) types.MsgCreateRecipe {\n\tbyteValue := ReadFile(ref, t)\n\t// translate sender from account name to account address\n\tnewByteValue := UpdateSenderKeyToAddress(byteValue, t)\n\t// translate cookbook name to cookbook id\n\tnewByteValue = UpdateCBNameToID(newByteValue, t)\n\t// get item inputs from fileNames\n\titemInputs := GetItemInputsFromBytes(newByteValue, t)\n\t// get entries from fileNames\n\tentries := GetEntriesFromBytes(newByteValue, t)\n\n\tvar rcpTempl types.Recipe\n\terr := json.Unmarshal(newByteValue, &rcpTempl)\n\tt.WithFields(testing.Fields{\n\t\t\"new_bytes\": string(newByteValue),\n\t}).MustNil(err, \"error reading using GetJSONMarshaler\")\n\n\treturn types.NewMsgCreateRecipe(\n\t\trcpTempl.Name,\n\t\trcpTempl.CookbookID,\n\t\trcpTempl.ID,\n\t\trcpTempl.Description,\n\t\trcpTempl.CoinInputs,\n\t\titemInputs,\n\t\tentries,\n\t\trcpTempl.Outputs,\n\t\trcpTempl.BlockInterval,\n\t\trcpTempl.Sender,\n\t)\n}", "title": "" }, { "docid": "33ab98933192bde1c7c1cfad8b9d3e85", "score": "0.47640243", "text": "func New(msg, action string) error { return new(msg, action) }", "title": "" }, { "docid": "72b25c3bfff9513ac9e11562cd873f48", "score": "0.47509736", "text": "func newGorumsMessage(msgType gorumsMsgType) *gorumsMessage {\n\treturn &gorumsMessage{metadata: &ordering.Metadata{}, msgType: msgType}\n}", "title": "" }, { "docid": "444f680e26857465f0278ac2d3af265e", "score": "0.47338894", "text": "func NewMessage(topicName string, body []byte) Message {\n return Message{\n Topic: topicName,\n Body: body,\n }\n}", "title": "" }, { "docid": "59250d541659c07a053498649d55b7f5", "score": "0.47284994", "text": "func (q *Q) NewRawMessage(msg *Message) *Message {\n\tq.lock.Lock()\n\tvar m *Message\n\tif _, exists := q.topics[msg.Topic]; exists {\n\t\tm = q.topics[msg.Topic].NewRawMessage(msg)\n\t} else {\n\t\tq.topics[msg.Topic] = CreateTopic(msg.Topic, q)\n\t\tm = q.topics[msg.Topic].NewRawMessage(msg)\n\t}\n\tq.lock.Unlock()\n\treturn m\n}", "title": "" }, { "docid": "cd95c85dcb180ffa762fde9b973cf6a0", "score": "0.4727615", "text": "func TestMsgReclaimType(t *testing.T) {\n\tmsg := NewMsgReclaim(testDenom, testAddress, testAddress)\n\trequire.Equal(t, TypeMsgReclaim, msg.Type())\n}", "title": "" }, { "docid": "14399b0274d34321b1d182c34b5dd8af", "score": "0.47207204", "text": "func recoverKey(strPrivateKey string, passPhrase string) (*Key, error) {\n\t//validate and conversion\n\tprivKey, vil, err := conversionPrivKey(strPrivateKey)\n\tif !vil || err != nil {\n\t\treturn nil, err\n\t}\n\n\tpub := privKey.PubKey()\n\tpubKey, err := sdk.Bech32ifyAccPub(pub)\n\tif err != nil {\n\t\tfmt.Println(\"newKey error for Bech32ifyAccPub !\", err)\n\t\treturn nil, err\n\t}\n\n\taddress := sdk.AccAddress(pub.Address().Bytes())\n\n\tprivArmor := mintkey.EncryptArmorPrivKey(privKey, passPhrase)\n\n\tkey := &Key{\n\t\tAddress: address.String(),\n\t\tPubKey: pubKey,\n\t\tPrivKey: privArmor,\n\t}\n\n\treturn key, nil\n}", "title": "" }, { "docid": "7ea254ce4e37aaf7f0b94af6897eed09", "score": "0.47202465", "text": "func NewMsg(topic string, body []byte) Msg {\n\tmsg := &msg{\n\t\ttopic: topic,\n\t\tbody: make([]byte, len(body), cap(body)),\n\t}\n\tcopy(msg.body, body)\n\treturn msg\n}", "title": "" }, { "docid": "a639b357836afbb310eed37a7dba4df8", "score": "0.47193718", "text": "func (a *Agent) newKeepalive() (*submitws.Message, error) {\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tip, err := a.getOutboundIp()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tkeepalive := &submitws.Keepalive{\n\t\tOsType: runtime.GOOS,\n\t\tIpAddress: ip,\n\t\tHostname: hostname,\n\t\tArchitecture: runtime.GOARCH,\n\t\tNumRunningTasks: int(atomic.LoadInt64(&a.numRunningTasks)),\n\t}\n\tkeepalivePayload, err := json.Marshal(keepalive)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmsg, err := submitws.NewMessage(submitws.MessageTypeKeepalive, keepalivePayload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn msg, nil\n}", "title": "" }, { "docid": "1865d76d89417e3eb7e3d736e780c846", "score": "0.47158983", "text": "func (c *Conn) Retr(msgID int) (*message.Entity, error) {\n\tb, err := c.Cmd(\"RETR\", true, msgID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm, err := message.Read(b)\n\tif err != nil {\n\t\tif !message.IsUnknownCharset(err) {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "9a79e7d3040f3bc45177048784f9bbbf", "score": "0.47044572", "text": "func New_msg(topic string, data interface{}) *Msg {\n\treturn &Msg{Topic: topic, Data: data}\n}", "title": "" }, { "docid": "ddf444f4f45fd08b706a88dbd0110096", "score": "0.4700455", "text": "func (fr *frame) bridgeRecoverFunc(llfn llvm.Value, fti functionTypeInfo) *frame {\n\t// The bridging function must not be inlined, or the return address\n\t// may not correspond to the source function.\n\tattrKind := llvm.AttributeKindID(\"noinline\")\n\tnoInlineAttr := fr.module.Context().CreateEnumAttribute(attrKind, 0)\n\tllfn.AddFunctionAttr(noInlineAttr)\n\n\t// Call __go_can_recover, passing in the function's return address.\n\tentry := llvm.AddBasicBlock(llfn, \"entry\")\n\tfr.builder.SetInsertPointAtEnd(entry)\n\tcanRecover := fr.runtime.canRecover.call(fr, fr.returnAddress(0))[0]\n\treturnType := fti.functionType.ReturnType()\n\targTypes := fti.functionType.ParamTypes()\n\targTypes = append(argTypes, canRecover.Type())\n\n\t// Create and call the $recover function.\n\tftiRecover := fti\n\tftiRecover.functionType = llvm.FunctionType(returnType, argTypes, false)\n\tllfnRecover := ftiRecover.declare(fr.module.Module, llfn.Name()+\"$recover\")\n\tfr.addCommonFunctionAttrs(llfnRecover)\n\tllfnRecover.SetLinkage(llvm.InternalLinkage)\n\targs := make([]llvm.Value, len(argTypes)-1, len(argTypes))\n\tfor i := range args {\n\t\targs[i] = llfn.Param(i)\n\t}\n\targs = append(args, canRecover)\n\tresult := fr.builder.CreateCall(llfnRecover, args, \"\")\n\tif returnType.TypeKind() == llvm.VoidTypeKind {\n\t\tfr.builder.CreateRetVoid()\n\t} else {\n\t\tfr.builder.CreateRet(result)\n\t}\n\n\t// The $recover function must condition calls to __go_recover on\n\t// the result of __go_can_recover passed in as an argument.\n\tfr = newFrame(fr.unit, llfnRecover)\n\tfr.retInf = ftiRecover.retInf\n\tfr.canRecover = fr.function.Param(len(argTypes) - 1)\n\treturn fr\n}", "title": "" }, { "docid": "67000469cf01baa8d9e2160ea3a0649c", "score": "0.4696436", "text": "func (cli *Client) NewMessage(messages []Message) (map[string]string, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 300*time.Second)\n\tdefer cancel()\n\tctx = ctxWithToken(ctx, \"bearer\", \"zb-test-token\")\n\n\t// create tracer\n\tmethodName := util.CallerFunc(2)\n\ttr := zbtracer.NewTracer(zbtracer.TraceOptions{Name: methodName, Kind: zbtracer.TraceKindClient})\n\tctx, span := tr.Start(ctx, methodName, trace.WithNewRoot(), trace.WithSpanKind(trace.SpanKindClient))\n\tdefer span.End()\n\n\tnewMessageResponse := make(map[string]string, len(messages))\n\tvar pbMessages []*pbcommon.Message\n\n\tfor i, msg := range messages {\n\t\tpbMessage := pbcommon.Message{\n\t\t\tTopic: msg.TopicName,\n\t\t\tData: msg.Data,\n\t\t\tHintPartition: msg.HintPartition,\n\t\t}\n\t\tpbMessages = append(pbMessages, &pbMessage)\n\t\tlog.Debugf(\"Message {%v}: %s, %s, %s\", i, msg.TopicName, msg.HintPartition, msg.Data)\n\t}\n\n\tspan.AddEventWithTimestamp(ctx, time.Now(), \"NewMessage Request\", []core.KeyValue{otkey.New(\"message count\").Int(len(messages))}...)\n\n\tlog.Debugf(\"Requested NewMessage data: %v\", pbMessages)\n\trequest := pbcommon.NewMessageRequest{\n\t\tMessages: pbMessages,\n\t}\n\n\tresponse, err := cli.zbCli.NewMessage(ctx, &request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponses := response.GetResponses()\n\tfor t, r := range responses {\n\t\tnewMessageResponse[t] = r.GetCode().String()\n\t}\n\treturn newMessageResponse, nil\n}", "title": "" }, { "docid": "5a437d5f8853e02cbfe2d339468946ae", "score": "0.46952522", "text": "func New() GraphSyncMessage {\n\treturn newMsg()\n}", "title": "" }, { "docid": "d3091e16f2cbcf88c1c575d75a4b5868", "score": "0.46901903", "text": "func New(mdreqid field.MDReqIDField) (m MarketDataRequestReject) {\n\tm.Message = quickfix.NewMessage()\n\tm.Header = fixt11.NewHeader(&m.Message.Header)\n\tm.Body = &m.Message.Body\n\tm.Trailer.Trailer = &m.Message.Trailer\n\n\tm.Header.Set(field.NewMsgType(\"Y\"))\n\tm.Set(mdreqid)\n\n\treturn\n}", "title": "" }, { "docid": "73fa309023e9b06b6dc31da0b15944e7", "score": "0.46877712", "text": "func NewMessage() Message {\n\treturn make(Message, 0)\n}", "title": "" }, { "docid": "059a285327beba5a55f295955319ddf1", "score": "0.46837598", "text": "func (dl *DriverListener) ReadMessage() (Notification, error) {\n buffer := make([]byte, 20000)\n n, err := dl.handle.Read(buffer[:])\n if err != nil {\n fmt.Printf(\"ReadMessage(): Read error: %+v\\n\", err)\n return nil, err\n }\n if n < 4 {\n fmt.Println(\"ReadMessage(): Not enough bytes returned: \", strconv.FormatInt(int64(n), 10))\n return nil, ErrParsingFailed\n }\n\n notificationType := binary.LittleEndian.Uint32(buffer[0:4])\n var nft Notification\n switch notificationType {\n case NotificationRegistry:\n nft = &RegistryNotification{}\n case NotificationProcessCreated:\n nft = &ProcessCreationNotification{}\n case NotificationDriverLoad:\n nft = &DriverLoadNotification{}\n }\n if nft != nil {\n err = nft.ParseFrom(buffer[0:n])\n if err != nil {\n return nil, err\n }\n return nft, nil\n }\n return nil, ErrInvalidNotificationType\n}", "title": "" }, { "docid": "7ead740183e254007a1c7b199e0bce51", "score": "0.46827573", "text": "func newRecoveryQueue() *resendMap {\n\treturn &resendMap{\n\t\tdelays: make(map[time.Time]time.Duration),\n\t\tunacknowledged: make(map[uint24]resendRecord),\n\t}\n}", "title": "" }, { "docid": "4faff1d7f98e633bb28191a9c47d5c92", "score": "0.46794528", "text": "func NewMsgRepay(sender sdk.AccAddress, amount sdk.Coins) MsgRepay {\n\treturn MsgRepay{\n\t\tSender: sender,\n\t\tAmount: amount,\n\t}\n}", "title": "" }, { "docid": "1f583da5b4bac9fd5715daafcc002e9e", "score": "0.46751884", "text": "func decodeMessage(data []byte) (*Message, []byte) {\n\tfor i, val := range data {\n\t\tif val == 0x5c && data[i+1] == 0x00 && len(data) > i+5 {\n\t\t\tjunk := data[:i]\n\t\t\taddr := data[i+2]\n\t\t\tcmd := data[i+3]\n\t\t\tlength := int(data[i+4])\n\n\t\t\tif len(data) < i+6+length {\n\t\t\t\treturn nil, data\n\t\t\t}\n\n\t\t\tcontent := data[i+5 : i+5+length]\n\t\t\tchk := data[i+5+length]\n\n\t\t\tchk2 := byte(0)\n\t\t\tfor _, v := range data[i+2 : i+5+length] {\n\t\t\t\tchk2 ^= v\n\t\t\t}\n\n\t\t\tif chk == chk2 {\n\t\t\t\tif len(junk) > 0 {\n\t\t\t\t\tsendLog := color.New(color.FgCyan)\n\t\t\t\t\tsendLog.Printf(\"Junk - %x\\n\", junk)\n\t\t\t\t\t//if (len(junk)>19) {\n\t\t\t\t\t//var parameter struct {\n\t\t\t\t\t//\tValue uint16\n\t\t\t\t\t//}\n\t\t\t\t\t//r := bytes.NewReader(junk[3:19])\n\t\t\t\t\t//for {\n\t\t\t\t\t//\terr := binary.Read(r, binary.LittleEndian, &parameter);\n\t\t\t\t\t//\tif (err != nil) {\n\t\t\t\t\t//\t\tbreak\n\t\t\t\t\t//\t}\n\n\t\t\t\t\t//\tlog.Printf(\" - %f - %d\", 45 -(float64(parameter.Value) / 1023 * 33), parameter.Value);\n\t\t\t\t\t//}\n\t\t\t\t\t//}\n\t\t\t\t}\n\t\t\t\t// log.Printf(\" <- %s (%x) - cmd %x len %d data %x\\n\", devices[addr], addr, cmd, length, content)\n\n\t\t\t\tmsg := &Message{\n\t\t\t\t\tAddr: addr,\n\t\t\t\t\tCmd: cmd,\n\t\t\t\t\tData: content,\n\t\t\t\t}\n\n\t\t\t\treturn msg, data[i+6+length:]\n\t\t\t} else {\n\t\t\t\t// log.Printf(\" <- %s (%x) - cmd %x len %d data %x | %x != %x\\n\", devices[addr], addr, cmd, length, content, chk, chk2)\n\n\t\t\t\treturn nil, data[i+6+length:]\n\t\t\t}\n\t\t}\n\n\t\tif val == 0xC0 && len(data) > i+4 { // Response from ex sam40\n\t\t\tcmd := data[i+1]\n\t\t\tlength := int(data[i+2])\n\n\t\t\tif len(data) < i+4+length {\n\t\t\t\treturn nil, data\n\t\t\t}\n\n\t\t\tcontent := data[i+3 : i+3+length]\n\t\t\t// chk := data[i+3+length]\n\n\t\t\tchk2 := byte(0)\n\t\t\tfor _, v := range data[i : i+3+length] {\n\t\t\t\tchk2 ^= v\n\t\t\t}\n\n\t\t\t// log.Printf(\" <- RESPONSE %x len %d data %x | %x ?= %x\\n\", cmd, length, content, chk, chk2)\n\n\t\t\tmsg := &Message{\n\t\t\t\tCmd: cmd,\n\t\t\t\tData: content,\n\t\t\t}\n\t\t\treturn msg, data[i+4+length:]\n\t\t}\n\n\t\tif val == 0x06 { // ACK\n\t\t\t// log.Printf(\" <- ACK\\n\")\n\t\t\tmsg := &Message{\n\t\t\t\tCmd: val,\n\t\t\t}\n\t\t\treturn msg, data[i+1:]\n\t\t}\n\t}\n\n\treturn nil, data\n}", "title": "" }, { "docid": "df5d886d7639acedab16ccb333275afb", "score": "0.46723774", "text": "func NewRecovery(configs ...RecoverConfigFunc) chevron.Middleware {\n\tm := &RecoverMiddleware{\n\t\terrorFactory: defaultPanicErrorFactory,\n\t\tstackBufferSize: 4 << 10,\n\t\tlogAllGoroutines: false,\n\t}\n\n\tfor _, f := range configs {\n\t\tf(m)\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "8582a1aa3f7f5fddd9be887e0081c26b", "score": "0.4670582", "text": "func (msg MsgCreateDefi) Type() string { return TypeMsgCreateDefi }", "title": "" }, { "docid": "de4bfd14bbf755b3dd88163bf506f553", "score": "0.46617585", "text": "func MsgReload(path string) interface{} {\n\treturn msgServerReload{\n\t\tCommand: cmdReload,\n\t\tPath: path,\n\t}\n}", "title": "" }, { "docid": "135d12828fe1b0fe1a43d9ffdbd7766b", "score": "0.466126", "text": "func NewRecoverer(dag format.DAGService) recovery.Recoverer {\n\treturn &reedSolomon{dag: dag}\n}", "title": "" }, { "docid": "595c98da1006082adddfa9af680ce840", "score": "0.46607336", "text": "func New(confirmid string, confirmtranstype int, confirmtype int, confirmstatus int, transacttime time.Time, tradedate string, instrument instrument.Instrument, allocqty float64, side string, cpctyconfgrp cpctyconfgrp.CpctyConfGrp, allocaccount string, avgpx float64, grosstradeamt float64, netmoney float64) *Message {\n\tvar m Message\n\tm.SetConfirmID(confirmid)\n\tm.SetConfirmTransType(confirmtranstype)\n\tm.SetConfirmType(confirmtype)\n\tm.SetConfirmStatus(confirmstatus)\n\tm.SetTransactTime(transacttime)\n\tm.SetTradeDate(tradedate)\n\tm.SetInstrument(instrument)\n\tm.SetAllocQty(allocqty)\n\tm.SetSide(side)\n\tm.SetCpctyConfGrp(cpctyconfgrp)\n\tm.SetAllocAccount(allocaccount)\n\tm.SetAvgPx(avgpx)\n\tm.SetGrossTradeAmt(grosstradeamt)\n\tm.SetNetMoney(netmoney)\n\treturn &m\n}", "title": "" }, { "docid": "3a16235c020702ce4b1e19f646409178", "score": "0.46507108", "text": "func makeEmptyMessage(command string) (Message, error) {\n\tvar message Message\n\tswitch command {\n\tcase COMMAND_VERSION:\n\t\tmessage = &VersionMessage{}\n\tcase COMMMAND_ADDRESS:\n\t\tmessage = &PeerAddressMessage{}\n\t\t//todo getBlocks and getBlock\n\tcase COMMAND_GET_BLOCKS:\n\t\tmessage = &GetBlocksMessage{}\n\tcase COMMAND_GET_HEADERS:\n\t\tmessage = &GetHeadersMessage{}\n\tcase COMMAND_REJECT:\n\t\tmessage = &RejectMessage{}\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unkonwn command %s\", command)\n\n\t}\n\treturn message, nil\n}", "title": "" }, { "docid": "aa77e9ae83973feff190b60ca21fd0f5", "score": "0.46502885", "text": "func NewMessage(mtype MsgType, data []byte) *Message {\n\tmsg := &Message{ID: rand.Uint32(), Type: mtype}\n\tn := 0\n\tif data != nil {\n\t\tn = copy(msg.buf[:], data)\n\t}\n\tmsg.Data = msg.buf[:n]\n\treturn msg\n}", "title": "" }, { "docid": "dcd5805e3e6eed68dd7b2e76b6e1d6dc", "score": "0.4647898", "text": "func (l *Listener) RiceviMsg(line []byte, reply *string) error {\n\n\tvar m Message\n\tvar topic Topic\n\n\t//Unmarshal dei dati inseriti\n\n\terr := json.Unmarshal([]byte(line), &m)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t//imposto la visibilità di default a 0\n\n\tm.Visibility = 0\n\n\t//fmt.Printf(\"ProvaPub: %+v\\n\", m)\n\n\tmsgs = inserisci(*msgs, &m)\n\n\ttopic.topic = m.Topic\n\n\tflag := 0\n\n\t//Controllo che il topic non sia già presente\n\n\tfor i := 0; i < len(topics); i++ {\n\t\tif topics[i].topic == topic.topic {\n\t\t\tflag = 1\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif flag == 0 {\n\t\ttopics = append(topics, topic)\n\t}\n\n\t*reply = \"ACK\"\n\n\t//in base al valore della semantica che è stato aggiunto dall'utente eseguirà\n\t//o la routine per la semantica at leasta once o la routine per la semantica timeout based\n\n\tswitch semantica {\n\n\tcase 1:\n\n\t\t//Semantica at least once\n\n\t\tgo invioSubAtLeastOnce()\n\n\tcase 2:\n\n\t\t//Semantica timeout-based\n\n\t\tgo invioSubTimeoutBased()\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "150278164ab3bcc8d2e665f684bf0def", "score": "0.4647503", "text": "func (s *Signature) Recv() *Var { return s.recv }", "title": "" }, { "docid": "99e44840eb3e27f8fe88f465a420e5b2", "score": "0.46422067", "text": "func GetMsg(code int) string {\n\tmsg, ok := MsgFlags[code]\n\tif ok {\n\t\treturn msg\n\t}\n\n\treturn MsgFlags[e.Error]\n}", "title": "" }, { "docid": "0e6fb44e9c7eaa5764c24c090ff0dc78", "score": "0.4637391", "text": "func ECRecover(h *Hash, r, s, v *Quantity) (*Address, error) {\n\t// The code below is based heavily on the secp256k1.recoverAddress implementation at:\n\t// https://github.com/ethers-io/ethers.js/blob/34397fa2aaa9187f307881ec10f07dc035dc0854/src.ts/utils/secp256k1.ts#L109\n\t// with some trial and error to get working with btcd.\n\t// I also used some of the code changes proposed in:\n\t// https://github.com/tendermint/tendermint/pull/3441\n\t// To determine that btcd is capable of recovering ethereuem addresses.\n\n\t// recover the public key\n\thashBytes, err := hex.DecodeString(h.String()[2:])\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not convert hash to bytes\")\n\t}\n\n\t// NOTE: btcd's secp256k1 expects V at offset 0 NOT offset 64\n\tvb := byte(v.Big().Uint64() + 27)\n\trb, sb := r.Big().Bytes(), s.Big().Bytes()\n\tsig := make([]byte, 65)\n\tsig[0] = vb\n\tcopy(sig[33-len(rb):33], rb)\n\tcopy(sig[65-len(sb):65], sb)\n\n\tkey, _, err := secp256k1.RecoverCompact(secp256k1.S256(), sig, hashBytes)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not recover secp256k1 key\")\n\t}\n\n\t// Get the UNCOMPRESSED public key, which should always start with a 0x04\n\tpubKey := key.SerializeUncompressed()\n\treturn pubKeyBytesToAddress(pubKey)\n}", "title": "" }, { "docid": "1e69891e6135a3f81eafbf27213677f4", "score": "0.46344334", "text": "func NewRebootMessage(seconds int) Notification {\n\tt := time.Now().Add(time.Second * time.Duration(seconds)).Format(time.UnixDate)\n\treturn &toast.Notification{\n\t\tAppID: appID,\n\t\tTitle: \"Reboot Your Machine\",\n\t\tMessage: fmt.Sprintf(\"Reboot now to finish installing updates. Your machine will auto reboot at %s.\", t),\n\t}\n}", "title": "" }, { "docid": "72f6a13129de421dc52e408754225b26", "score": "0.4633103", "text": "func AddRecover(h Worlder) Worlder {\n\treturn &worldRecover{h}\n}", "title": "" }, { "docid": "441f2bda8a39f21ecc1c02b34e302380", "score": "0.46295273", "text": "func newMessage(minsize uint16) (msg *dns.Msg) {\n\tfor ii := 1; ii <= int(minsize); ii++ {\n\t\tmsg = Message(\n\t\t\tQuestion(\"example.com.\", dns.TypeA),\n\t\t\tHeader(false, dns.RcodeSuccess),\n\t\t\tAnswers(genA(50*ii)...))\n\t\tif msg.Len() > int(minsize) {\n\t\t\tbreak\n\t\t}\n\t}\n\tif minsize > dns.MinMsgSize {\n\t\t// This is a large response so we set the EDNS0 record.\n\t\tmsg.SetEdns0(minsize, false)\n\t}\n\treturn msg\n}", "title": "" }, { "docid": "f3f0a846d9aada7bcb4b30a922ec435b", "score": "0.4626319", "text": "func GetMsg(code Code) string {\n\tvar (\n\t\tmsg string\n\t\tok bool\n\t)\n\tif msg, ok = messages[code]; !ok {\n\t\tmsg = noErrorMsg\n\t}\n\treturn msg\n}", "title": "" }, { "docid": "ec493af600537393476a176e10ff3d23", "score": "0.46260175", "text": "func NewVmess(\n\taddress string, port uint32,\n\tuuid, security,\n\tfakeType string,\n\talterID uint32,\n\tnetType, netPath, netHost string,\n\ttls bool, cert string,\n) (*Vmess, error) {\n\tif fakeType != \"none\" {\n\t\treturn nil, fmt.Errorf(\"not support [fake type: %s] now\", fakeType)\n\t}\n\n\tclient, err := gitsrcVmess.NewClient(uuid, security, int(alterID))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"new vmess client failed: %v\", err)\n\t}\n\n\tv := &Vmess{\n\t\taddress: address,\n\t\tport: port,\n\t\tuuid: uuid,\n\t\tsecurity: security,\n\t\tfakeType: fakeType,\n\t\talterID: alterID,\n\t\tclient: client,\n\t\tnet: netType,\n\t\tClientUtil: utils.NewClientUtil(address, strconv.FormatUint(uint64(port), 10)),\n\t\tnetConfig: netConfig{\n\t\t\ttls: tls,\n\t\t},\n\t}\n\n\tswitch v.net {\n\tcase \"ws\":\n\t\tv.path = netPath\n\t\tv.host = netHost\n\tcase \"quic\":\n\t\tv.tls = true\n\t\tv.host = netHost\n\t}\n\n\tif v.tls {\n\t\tv.cert = cert\n\t}\n\t// fmt.Println(v)\n\treturn v, nil\n}", "title": "" }, { "docid": "200bff866caa76abcc4d5d8f9760befe", "score": "0.46252397", "text": "func getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error) {\n\t_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetmsg)), 4, uintptr(fd), uintptr(unsafe.Pointer(clptr)), uintptr(unsafe.Pointer(dataptr)), uintptr(unsafe.Pointer(flags)), 0, 0)\n\tif e1 != 0 {\n\t\terr = e1\n\t}\n\treturn\n}", "title": "" }, { "docid": "1566af010b6e01ae161297559e0a695c", "score": "0.4624977", "text": "func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {\n\treturn nil\n}", "title": "" }, { "docid": "f5af9d3bcf71246223dbcc4841f70cd1", "score": "0.46246713", "text": "func (c *Client) prepareMsg(msg interface{}) (string, error) {\n\tid := crypto.RandHex(2)\n\n\tptr := reflect.TypeOf(msg)\n\n\tif ptr.Kind() != reflect.Ptr {\n\t\treturn \"\", errors.New(\"msg must be a pointer\")\n\t}\n\n\tst := ptr.Elem()\n\tval := reflect.ValueOf(msg).Elem()\n\n\tvar (\n\t\tfoundType bool\n\t\tfoundID bool\n\t)\n\n\tfor i := 0; i < st.NumField(); i++ {\n\t\tfield := st.Field(i)\n\t\tif field.Name == \"Type\" {\n\t\t\tmsgType, _ := field.Tag.Lookup(\"rendezvous_value\")\n\t\t\tif msgType == \"\" {\n\t\t\t\treturn \"\", errors.New(\"type filed missing rendezvous_value struct tag\")\n\t\t\t}\n\t\t\tff := val.Field(i)\n\t\t\tff.SetString(msgType)\n\t\t\tfoundType = true\n\t\t} else if field.Name == \"ID\" {\n\t\t\tff := val.Field(i)\n\t\t\tff.SetString(id)\n\t\t\tfoundID = true\n\t\t}\n\t}\n\n\tif !foundID || !foundType {\n\t\treturn id, errors.New(\"msg type missing required field(s): Type and/or ID\")\n\t}\n\n\treturn id, nil\n}", "title": "" }, { "docid": "5a271c5bb06650cc3f83c5e6a66b374c", "score": "0.46213487", "text": "func (msg Message) Msg(message string) Message {\n\treturn Message{msg.prio, msg.timestamp, msg.hostname, msg.appname, msg.procid, msg.msgid, msg.sd, strings.TrimRightFunc(message, unicode.IsSpace)}\n}", "title": "" }, { "docid": "c87d2034044ceee3ae4294715257c64d", "score": "0.4621251", "text": "func NewMessage(tp string, data interface{}) *Message {\n\tmData := messageGenerator[tp](data)\n\tif mData == \"\" {\n\t\tlog.Printf(\"[Error]: message generator returns empty\")\n\t\treturn nil\n\t}\n\treturn &Message{\n\t\tId: bson.NewObjectId(),\n\t\tType: tp,\n\t\tData: mData,\n\t\tCreatedAt: utils.Now(),\n\t\tIsRead: false,\n\t}\n}", "title": "" } ]
3f30840f9ee8a2c81a59472a432223c2
SetPrimaryAccountNumber sets the PrimaryAccountNumber field's value.
[ { "docid": "81dc47561a18fd68d8889c2415e3fb60", "score": "0.8324124", "text": "func (s *TranslationPinDataIsoFormat034) SetPrimaryAccountNumber(v string) *TranslationPinDataIsoFormat034 {\n\ts.PrimaryAccountNumber = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "58bbc484d0dad237ffafa2c604dd76f6", "score": "0.8403667", "text": "func (s *SessionKeyEmv2000) SetPrimaryAccountNumber(v string) *SessionKeyEmv2000 {\n\ts.PrimaryAccountNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "14bb35e5f4cc688180b3812e66165a60", "score": "0.8392607", "text": "func (s *SessionKeyVisa) SetPrimaryAccountNumber(v string) *SessionKeyVisa {\n\ts.PrimaryAccountNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "c2bb9506850fd5d72359ac4393ab359a", "score": "0.8386212", "text": "func (s *MacAlgorithmEmv) SetPrimaryAccountNumber(v string) *MacAlgorithmEmv {\n\ts.PrimaryAccountNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "45ac7cf876a04b3f10b5fd01db4d2a29", "score": "0.83827686", "text": "func (s *GenerateCardValidationDataInput) SetPrimaryAccountNumber(v string) *GenerateCardValidationDataInput {\n\ts.PrimaryAccountNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "5d1fab43286a4b22eeaf143915555b2a", "score": "0.8357855", "text": "func (s *VerifyCardValidationDataInput) SetPrimaryAccountNumber(v string) *VerifyCardValidationDataInput {\n\ts.PrimaryAccountNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "afb619b42951959f54d466d48e554318", "score": "0.8334076", "text": "func (s *SessionKeyAmex) SetPrimaryAccountNumber(v string) *SessionKeyAmex {\n\ts.PrimaryAccountNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "bf499b025d4a1367f5ca743ded7739cf", "score": "0.8325005", "text": "func (s *GeneratePinDataInput) SetPrimaryAccountNumber(v string) *GeneratePinDataInput {\n\ts.PrimaryAccountNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "c417f91757de9be2e84f8822bf9098c3", "score": "0.8311163", "text": "func (s *SessionKeyEmvCommon) SetPrimaryAccountNumber(v string) *SessionKeyEmvCommon {\n\ts.PrimaryAccountNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "631a07d058bd88e80b0cb59cbc95103f", "score": "0.82548136", "text": "func (s *VerifyPinDataInput) SetPrimaryAccountNumber(v string) *VerifyPinDataInput {\n\ts.PrimaryAccountNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "c215f406ff0dfeb88fff6b7b0405b406", "score": "0.82524", "text": "func (s *SessionKeyMastercard) SetPrimaryAccountNumber(v string) *SessionKeyMastercard {\n\ts.PrimaryAccountNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "8202c6644b32b8071b77946405492d01", "score": "0.5967564", "text": "func (node *Node) SetPrimary(primary bool) {\n\tnode.isPrimary = primary\n}", "title": "" }, { "docid": "8202c6644b32b8071b77946405492d01", "score": "0.5967564", "text": "func (node *Node) SetPrimary(primary bool) {\n\tnode.isPrimary = primary\n}", "title": "" }, { "docid": "5f494063c16badef16dc46bce46d7ca7", "score": "0.59082246", "text": "func (o *AddressNullable) SetPrimary(v bool) {\n\to.Primary = &v\n}", "title": "" }, { "docid": "91964df2f9b0374b84b1bd008b305d12", "score": "0.5883804", "text": "func (m *SurveyCellScanMutation) SetPrimaryScramblingCode(s string) {\n\tm.primary_scrambling_code = &s\n}", "title": "" }, { "docid": "9affb4947ddded133a4ce16eb70338e3", "score": "0.574729", "text": "func (o *Account) SetAccountNumber(v string) {\n\to.AccountNumber.Set(&v)\n}", "title": "" }, { "docid": "e50a822b40f3cb1983cacc4b1d9e056b", "score": "0.5745136", "text": "func (s *Database) SetPrimaryHost(v string) *Database {\n\ts.PrimaryHost = &v\n\treturn s\n}", "title": "" }, { "docid": "567a792ca3ef4da7c6ebc308457f048c", "score": "0.573233", "text": "func (s *FailoverConfig) SetPrimary(v *Primary) *FailoverConfig {\n\ts.Primary = v\n\treturn s\n}", "title": "" }, { "docid": "9f55d07b6b76ac578f5656ffc9a764f2", "score": "0.5729018", "text": "func (inst *CancelBid) SetBiddersPrimaryAccount(biddersPrimaryAccount ag_solanago.PublicKey) *CancelBid {\n\tinst.AccountMetaSlice[0] = ag_solanago.Meta(biddersPrimaryAccount).SIGNER()\n\treturn inst\n}", "title": "" }, { "docid": "eee08899fe74fd46e15f927b959eddfe", "score": "0.57160354", "text": "func (o *AccountStore) SetAccountNumber(v string) {\n\to.AccountNumber.Set(&v)\n}", "title": "" }, { "docid": "e212452d642dcb8ee1929a1a19a8e952", "score": "0.5669171", "text": "func (o *FabricVlan) SetPrimaryVlanId(v int64) {\n\to.PrimaryVlanId = &v\n}", "title": "" }, { "docid": "5a8bedd987918b8d10405a8dda7ba1c6", "score": "0.56668496", "text": "func (s *Component) SetPrimaryHost(v string) *Component {\n\ts.PrimaryHost = &v\n\treturn s\n}", "title": "" }, { "docid": "a964323a721c90420f1b743631b31a79", "score": "0.5650474", "text": "func (o *Email) SetPrimary(v bool) {\n\to.Primary = v\n}", "title": "" }, { "docid": "42d1e0f0ea079778bd6c7a153e998391", "score": "0.562462", "text": "func (ouo *OrderonlineUpdateOne) SetAccountnumber(s string) *OrderonlineUpdateOne {\n\touo.mutation.SetAccountnumber(s)\n\treturn ouo\n}", "title": "" }, { "docid": "808d1e7c321fbf10c8e358a38ceb32d3", "score": "0.56180906", "text": "func (o *CreditBankStatementUploadBankAccount) SetAccountNumber(v string) {\n\to.AccountNumber.Set(&v)\n}", "title": "" }, { "docid": "911abcd48c55eed1e4196e2adf800522", "score": "0.560578", "text": "func (la *layeredAccessor) SetPrimary(a Accessor) {\n\tla.lock.Lock()\n\tla.err = nil\n\tla.primary = a\n\tla.lock.Unlock()\n}", "title": "" }, { "docid": "637a9f305e3c42d032b6edc3e4e5961e", "score": "0.54557306", "text": "func (ou *OrderonlineUpdate) SetAccountnumber(s string) *OrderonlineUpdate {\n\tou.mutation.SetAccountnumber(s)\n\treturn ou\n}", "title": "" }, { "docid": "05552228cef4a0f370908a5d9612d84c", "score": "0.54381925", "text": "func (c *PagingConfig) SetFirstPageNumber(v int) *PagingConfig {\n\tc.FirstPageNumber = v\n\treturn c\n}", "title": "" }, { "docid": "7bd6d6cbca9c3c91ca3441945c63ef78", "score": "0.54143393", "text": "func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetPrimaryTagName(v string) {\n\to.PrimaryTagName = &v\n}", "title": "" }, { "docid": "655e27c043accb34d5ba4ee042241794", "score": "0.54046595", "text": "func (s *MatchDirections) SetPrimaryDirection(direction dprec.Vec3) *MatchDirections {\n\ts.primaryDirection = dprec.UnitVec3(direction)\n\treturn s\n}", "title": "" }, { "docid": "1538657989dbdaa54e49fccccb5f9ec1", "score": "0.5389467", "text": "func (ac *AccountCreate) SetNumber(s string) *AccountCreate {\n\tac.mutation.SetNumber(s)\n\treturn ac\n}", "title": "" }, { "docid": "8067414213d2ecab2a3e7c829f2c486d", "score": "0.5364332", "text": "func (fs *LayeredFS) SetPrimary(primary string) {\n\tfs.lock.Lock()\n\tfs.primary = primary\n\tfs.lock.Unlock()\n}", "title": "" }, { "docid": "acea1eb877a2215c035c71a9ee71a857", "score": "0.5328511", "text": "func (o *ProjectBrandingTheme) SetPrimaryColor(v string) {\n\to.PrimaryColor = &v\n}", "title": "" }, { "docid": "fa8562910c2eafb26d46e39459cac533", "score": "0.529124", "text": "func (o *WorkflowRollbackWorkflow) SetPrimaryWorkflow(v WorkflowWorkflowInfoRelationship) {\n\to.PrimaryWorkflow = &v\n}", "title": "" }, { "docid": "16a5c47e3969c9e87ceae88abd3b66a6", "score": "0.5268938", "text": "func (s *CodegenGenericDataModel) SetPrimaryKeys(v []*string) *CodegenGenericDataModel {\n\ts.PrimaryKeys = v\n\treturn s\n}", "title": "" }, { "docid": "616f1d29cde1863a7e37ebf8fd152a73", "score": "0.5262053", "text": "func (o *GetHorizonD4CScriptsParams) SetSingleAccount(singleAccount *string) {\n\to.SingleAccount = singleAccount\n}", "title": "" }, { "docid": "c32e3eeb0909ee32bab45b9f0e7ca3d3", "score": "0.52436095", "text": "func (o *PutV1NuncConnectionsNuncConnectionIDParams) SetPrimaryColor(primaryColor *string) {\n\to.PrimaryColor = primaryColor\n}", "title": "" }, { "docid": "fc45ef85459be6e440969a7f78d030ca", "score": "0.5238028", "text": "func (o AccountOutput) PrimaryBillingGroupId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Account) pulumi.StringPtrOutput { return v.PrimaryBillingGroupId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f8a8e4bb273842897d1ef2639181f67b", "score": "0.51602805", "text": "func (o *StorageServiceRepairAsyncByKeyspacePostParams) SetPrimaryRange(primaryRange *string) {\n\to.PrimaryRange = primaryRange\n}", "title": "" }, { "docid": "c71099ceb2e5191a50788b32d7c57c3f", "score": "0.511569", "text": "func (o *Email) SetIsPrimary(v bool) {\n\to.IsPrimary = &v\n}", "title": "" }, { "docid": "2b5adecf5b24cf06456d45d4ea1decac", "score": "0.5110508", "text": "func (o *InlineObject840) SetNumber1(v AnyOfobject) {\n\to.Number1 = &v\n}", "title": "" }, { "docid": "a94b53aaa4df7d71306817fdcdbf661b", "score": "0.50754267", "text": "func (m *EducationUser) SetPrimaryRole(value *EducationUserRole)() {\n m.primaryRole = value\n}", "title": "" }, { "docid": "4479c94a7b40ffe7f1ddee922ac4cad8", "score": "0.5074723", "text": "func (m *MailboxEvidence) SetPrimaryAddress(value *string)() {\n err := m.GetBackingStore().Set(\"primaryAddress\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "eb4eb2c43e05dacd7844db860ffe4509", "score": "0.50502634", "text": "func (tc *TransactionController) StartPrimary(ctx context.Context, clientID, handle, redirectURI, codeChallengeMethod, codeChallenge, clientState string) (state *State, err error) {\n\tif handle == \"\" {\n\t\treturn nil, errors.New(errors.ErrorInvalidArgument, \"user handle cannot be empty\")\n\t}\n\tif codeChallenge != \"\" && codeChallengeMethod != \"S256\" {\n\t\treturn nil, errors.New(errors.ErrorInvalidArgument, \"invalid code challenge method\")\n\t}\n\tif err := ValidateRedirectURI(clientID, redirectURI); err != nil {\n\t\treturn nil, err\n\t}\n\n\tu, err := tc.userStore.UserByHandle(ctx, handle)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif u.IsCurrentlyLocked() {\n\t\terr = errors.New(errors.ErrorPermissionDenied, \"user is locked\")\n\t\treturn\n\t}\n\n\tclientApp, err := clientapp.GetByClientID(clientID)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tstate = &State{\n\t\tStateToken: cryptoutil.RandomToken32(),\n\t\tStatus: StatusPrimary,\n\t\tClientID: clientApp.ID,\n\t\tUserID: u.ID,\n\t\tFactors: []string{},\n\t\tRedirectURI: redirectURI,\n\t\tPKCEChallengeMethod: codeChallengeMethod,\n\t\tPKCEChallenge: codeChallenge,\n\t\tClientState: clientState,\n\t}\n\n\tif u.IsPasswordAuthenticationEnabled() {\n\t\tverifier, err := u.PasswordVerifier()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstate.AppendFactor(FactorPassword)\n\t\tstate.PasswordMethod = verifier.Method()\n\t\tstate.PasswordSalt = verifier.Salt()\n\t}\n\n\terr = tc.store.CheckRateLimiter(ctx, u.ID)\n\tif err != nil {\n\t\tstate.Status = StatusBlocked\n\t}\n\n\terr = tc.store.PutState(ctx, state)\n\treturn\n}", "title": "" }, { "docid": "73bf9179b0a5a417ee4b6841bc78defb", "score": "0.500835", "text": "func (transaction *AccountCreateTransaction) SetInitialBalance(initialBalance Hbar) *AccountCreateTransaction {\n\ttransaction.requireNotFrozen()\n\ttransaction.pb.InitialBalance = uint64(initialBalance.AsTinybar())\n\treturn transaction\n}", "title": "" }, { "docid": "832f604f1be12ed51862d57b42438bf9", "score": "0.49871087", "text": "func (o *EmailBody) SetIsPrimary(v bool) {\n\to.IsPrimary = &v\n}", "title": "" }, { "docid": "b48b99003efdd857e25afd4b3bffb89c", "score": "0.49787542", "text": "func (auo *AccountUpdateOne) SetNumber(s string) *AccountUpdateOne {\n\tauo.mutation.SetNumber(s)\n\treturn auo\n}", "title": "" }, { "docid": "018bfc37900f89788abd3d3270e900a9", "score": "0.49623865", "text": "func (c *ClusterSnapshot) PrimaryNodeIndex(partition int) int {\n\tif c.PartitionAssignment == \"modulus\" {\n\t\treturn partition % len(c.Nodes)\n\t} else {\n\t\treturn c.Hasher.Hash(uint64(partition), len(c.Nodes))\n\t}\n}", "title": "" }, { "docid": "551dcf004a52c9e797a0c821a9484ac7", "score": "0.49594077", "text": "func (o GetUsersUserOutput) PrimaryPhone() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetUsersUser) string { return v.PrimaryPhone }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9c02af5d0c62632e69e5e559451515c0", "score": "0.4931471", "text": "func (au *AccountUpdate) SetNumber(s string) *AccountUpdate {\n\tau.mutation.SetNumber(s)\n\treturn au\n}", "title": "" }, { "docid": "e4b36552a5780185c8c4607e4dd45d18", "score": "0.492534", "text": "func SetPrimaryColor(color string) {\n\tstyle := dom.GetWindow().Document().DocumentElement().Style()\n\tstyle.SetProperty(\"--color-primary\", color)\n}", "title": "" }, { "docid": "1d13acf03505ee217cc9563c09444606", "score": "0.49016792", "text": "func (s *TranslateFile) SetPrimaryStore(id string, ts TranslateStore) {\n\tgo func() {\n\t\ts.primaryStoreEvents <- primaryStoreEvent{\n\t\t\tid: id,\n\t\t\tts: ts,\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "0e5aff9629de6385a70c8fa4767a918e", "score": "0.48963174", "text": "func activatePrimary(r *Region) {\n\tr.active = r.primary\n\tr.primaryIsActive = true\n\tr.primaryTimeout = time.Now() // reset timeout\n}", "title": "" }, { "docid": "e46768e83b313b0ee0150f3b4fea0099", "score": "0.48778197", "text": "func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetPrimaryTagValue(v string) {\n\to.PrimaryTagValue = &v\n}", "title": "" }, { "docid": "648445faae139f86cd9034bf43b126e7", "score": "0.48764467", "text": "func (o *StorageRemoteKeySetting) SetPrimaryServer(v StorageKmipServer) {\n\to.PrimaryServer.Set(&v)\n}", "title": "" }, { "docid": "3af164d48beb138b73148cddb9913938", "score": "0.48615244", "text": "func (o *personBase) SetAddressPrimaryKeys(pks []string) {\n\tfor _, obj := range o.oAddresses {\n\t\tif obj.IsDirty() {\n\t\t\tpanic(\"You cannot overwrite items that have changed but have not been saved.\")\n\t\t}\n\t}\n\n\to.oAddresses = nil\n\to.sAddressesPKs = pks\n\to.mAddresses = nil\n\to.oAddressesIsDirty = true\n}", "title": "" }, { "docid": "79dca2cc6642cd325f844ef18c0781a5", "score": "0.48520458", "text": "func (o *ProjectsIdInvoicesJsonInvoice) SetNumber(v string) {\n\to.Number = v\n}", "title": "" }, { "docid": "78a2e01dbbbf469442a764450e0315aa", "score": "0.48227805", "text": "func (o *NodesGetParams) SetServiceProcessorPrimaryVersion(serviceProcessorPrimaryVersion *string) {\n\to.ServiceProcessorPrimaryVersion = serviceProcessorPrimaryVersion\n}", "title": "" }, { "docid": "a60fcb24b37cf433304a77bb51abe941", "score": "0.48204413", "text": "func (o *Account) SetFirstName(v string) {\n\to.FirstName = &v\n}", "title": "" }, { "docid": "c4b4106191f20a9998899e08f11326d6", "score": "0.480008", "text": "func (m NewOrderSingle) SetAccount(v string) {\n\tm.Set(field.NewAccount(v))\n}", "title": "" }, { "docid": "872457adc0902498bdb28a23cbe5f14a", "score": "0.4787255", "text": "func (o *Anchors) SetNumber(v int32) {\n\to.Number = &v\n}", "title": "" }, { "docid": "4729dbfd156449951d98397a707b82a2", "score": "0.47835982", "text": "func (m *subaccount) SetFirstName(val *string) {\n\tm.firstNameField = val\n}", "title": "" }, { "docid": "55f4721a9ba38f6afde3e530bd5b411c", "score": "0.47684318", "text": "func (o *PrivateIpLight) SetIsPrimary(v bool) {\n\to.IsPrimary = &v\n}", "title": "" }, { "docid": "d980698a6bdd0a04139edc178e58df68", "score": "0.47133794", "text": "func (m *CustomerPaymentJournal) SetBalancingAccountNumber(value *string)() {\n err := m.GetBackingStore().Set(\"balancingAccountNumber\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d2a81ca34769666eb4041e4633ee01d1", "score": "0.47105253", "text": "func (res *Resource) SetPrimaryFields(fields ...string) error {\n\tscope := gorm.Scope{Value: res.Value}\n\tres.PrimaryFields = nil\n\n\tif len(fields) > 0 {\n\t\tfor _, fieldName := range fields {\n\t\t\tif field, ok := scope.FieldByName(fieldName); ok {\n\t\t\t\tres.PrimaryFields = append(res.PrimaryFields, field.StructField)\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"%v is not a valid field for resource %v\", fieldName, res.Name)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\tif primaryField := scope.PrimaryField(); primaryField != nil {\n\t\tres.PrimaryFields = []*gorm.StructField{primaryField.StructField}\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"no valid primary field for resource %v\", res.Name)\n}", "title": "" }, { "docid": "bec12e76324affd09d341d0b343919ee", "score": "0.4708562", "text": "func (s *ModifyScalingGroupInput) SetMinInstanceNumber(v int32) *ModifyScalingGroupInput {\n\ts.MinInstanceNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "5e3551c992bf84f97c3f586bf2378951", "score": "0.46942598", "text": "func (o *GetImageMetadataByTypeParams) SetXAnchoreAccount(xAnchoreAccount *string) {\n\to.XAnchoreAccount = xAnchoreAccount\n}", "title": "" }, { "docid": "8a0a5f35f05899048b98fac83abb2a83", "score": "0.46927914", "text": "func (u *User) SetPrimaryEmail(email string) {\n\tu.primaryEmail = email\n\tu.AddEmailAddress(email)\n}", "title": "" }, { "docid": "6e7acfc9249dde24cb6d455c0c12b6d2", "score": "0.46865997", "text": "func (ed *EntryDetail) SetOriginalTraceNumber(s string) {\n\ted.IdentificationNumber = s\n}", "title": "" }, { "docid": "b02295999ce0a2a53bbaedf364ed4a03", "score": "0.46794987", "text": "func setAccountNumber(row MACExcelRow) string{\n\treturn fmt.Sprintf(\"INSERT INTO %s.%s (ACCOUNT_NAME, ACCOUNT_NUMBER, ACCOUNT_COUNTRY_ID) VALUES (%s, '%s', %s);\", \n\t\t\tdbConf.MACTables.AccountNumber.Owner, \n\t\t\tdbConf.MACTables.AccountNumber.Name, \n\t\t\trow.BusinessAccount, \n\t\t\treplaceQuote(row.BusinessName), \n\t\t\tremoveQuote(row.PersonCode))\n}", "title": "" }, { "docid": "76206aaaab7daaa76000994be586a331", "score": "0.46687874", "text": "func (o *UpdateAccountRequest) SetFirstName(v string) {\n\to.FirstName = &v\n}", "title": "" }, { "docid": "4f5a2b6ea6f87690544928e9a6a6ba63", "score": "0.46547854", "text": "func (o *NodesGetParams) SetServiceProcessorPrimaryIsCurrent(serviceProcessorPrimaryIsCurrent *bool) {\n\to.ServiceProcessorPrimaryIsCurrent = serviceProcessorPrimaryIsCurrent\n}", "title": "" }, { "docid": "e123c69b1bb2d0771eb716415ff1d3ba", "score": "0.46525854", "text": "func (cc *CardCreate) SetAccount(a *Account) *CardCreate {\n\treturn cc.SetAccountID(a.ID)\n}", "title": "" }, { "docid": "b575e7e9b7fcfbcb25477f96bc04c3e5", "score": "0.46484336", "text": "func (o *AccountStore) SetAccountNumberNil() {\n\to.AccountNumber.Set(nil)\n}", "title": "" }, { "docid": "4611bccf4a89cbd3c519c710f03d8526", "score": "0.46471742", "text": "func (o *MotivationProperties) SetPrimaryMotivation(s string) error {\n\to.PrimaryMotivation = s\n\treturn nil\n}", "title": "" }, { "docid": "12732edcb749bcb31c7ccfdc5b9e72f2", "score": "0.46433455", "text": "func (s *SuperuserParameters) SetFirstName(v string) *SuperuserParameters {\n\ts.FirstName = &v\n\treturn s\n}", "title": "" }, { "docid": "39c3697f1fc87be92c543c7b31c8880f", "score": "0.46420678", "text": "func (r *EnterprisesService) SetAccount(enterpriseId string, enterpriseaccount *EnterpriseAccount) *EnterprisesSetAccountCall {\n\tc := &EnterprisesSetAccountCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.enterpriseId = enterpriseId\n\tc.enterpriseaccount = enterpriseaccount\n\treturn c\n}", "title": "" }, { "docid": "21057f50114d8aed7f7953ecf10861b1", "score": "0.46314755", "text": "func (o NetworkMappingPropertiesResponseOutput) PrimaryNetworkId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NetworkMappingPropertiesResponse) *string { return v.PrimaryNetworkId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e2b332099ec5a500bf9dcacf2ad93f07", "score": "0.46288115", "text": "func (o *Account) SetAccountNumberNil() {\n\to.AccountNumber.Set(nil)\n}", "title": "" }, { "docid": "32bd3f11e31471c333182f682b125d90", "score": "0.46253037", "text": "func (o *LinkDeliveryRecipient) SetFirstName(v string) {\n\to.FirstName = &v\n}", "title": "" }, { "docid": "2998d0f76b4dbcc7af06108b44c75593", "score": "0.46219075", "text": "func (m PeerMeta) PrimaryAddress() string {\n\tif len(m.Addresses) > 0 {\n\t\treturn types.AddressFromMultiAddr(m.Addresses[0])\n\t} else {\n\t\treturn \"\"\n\t}\n\n}", "title": "" }, { "docid": "d06d6a3d1e22b02512c55431e75850a5", "score": "0.46190444", "text": "func Convert_tenancy_Account_To_v1alpha1_Account(in *tenancy.Account, out *Account, s conversion.Scope) error {\n\treturn autoConvert_tenancy_Account_To_v1alpha1_Account(in, out, s)\n}", "title": "" }, { "docid": "efc3cb1a1b8f50b8353d4a3d5a6aced6", "score": "0.46162954", "text": "func (c *ClusterSnapshot) IsPrimary(nodeID string, partition int) bool {\n\tprimary := c.PrimaryNodeIndex(partition)\n\treturn nodeID == c.Nodes[primary].ID\n}", "title": "" }, { "docid": "b1130614acebd14da9c721c5f4dc119b", "score": "0.46123353", "text": "func (o *personBase) SetProjectPrimaryKeys(objs []string) {\n\to.oProjects = nil\n\to.mProjects = nil\n\to.sProjectsPKs = objs\n\to.oProjectsIsDirty = true\n}", "title": "" }, { "docid": "8aa198f70323b1768d09510520434565", "score": "0.4611324", "text": "func (o AzureToAzureCreateNetworkMappingInputOutput) PrimaryNetworkId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AzureToAzureCreateNetworkMappingInput) *string { return v.PrimaryNetworkId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "da0f4ecf53f0c39980410b4d285523b4", "score": "0.4599701", "text": "func (o *InlineObject840) SetNumber1ExplicitNull(b bool) {\n\to.Number1 = nil\n\to.isExplicitNullNumber1 = b\n}", "title": "" }, { "docid": "037bb108a8119c761999a5a589e28739", "score": "0.4586542", "text": "func (t *Task) SetNumaPolicy(policy int32, nodeMask uint32) {\n\tt.mu.Lock()\n\tdefer t.mu.Unlock()\n\tt.numaPolicy = policy\n\tt.numaNodeMask = nodeMask\n}", "title": "" }, { "docid": "ac4b32dce0e3323120e7f7c1006baaf1", "score": "0.45860213", "text": "func (o A2AVmDiskInputDetailsOutput) PrimaryStagingAzureStorageAccountId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v A2AVmDiskInputDetails) *string { return v.PrimaryStagingAzureStorageAccountId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d7f378065a5c93c88dca576cbd7fbe7c", "score": "0.45782092", "text": "func (o *FabricVlan) GetPrimaryVlanId() int64 {\n\tif o == nil || o.PrimaryVlanId == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.PrimaryVlanId\n}", "title": "" }, { "docid": "12cef474314a3fc1c21d4607b37fc3a2", "score": "0.45780677", "text": "func (o *personBase) SetProjectAsManagerPrimaryKeys(pks []string) {\n\tfor _, obj := range o.oProjectsAsManager {\n\t\tif obj.IsDirty() {\n\t\t\tpanic(\"You cannot overwrite items that have changed but have not been saved.\")\n\t\t}\n\t}\n\n\to.oProjectsAsManager = nil\n\to.sProjectsAsManagerPKs = pks\n\to.mProjectsAsManager = nil\n\to.oProjectsAsManagerIsDirty = true\n}", "title": "" }, { "docid": "c59baffb10c2c8d49ec35d07fb757281", "score": "0.45773727", "text": "func (txCtx TxContext) WithAccountNumber(accnum int64) TxContext {\n\ttxCtx.AccountNumber = accnum\n\treturn txCtx\n}", "title": "" }, { "docid": "d8fdf8a85a0874fc460b2967a7dd703f", "score": "0.45769235", "text": "func (inst *ApproveChecked) SetMintAccount(mint ag_solanago.PublicKey) *ApproveChecked {\n\tinst.Accounts[1] = ag_solanago.Meta(mint)\n\treturn inst\n}", "title": "" }, { "docid": "37558b9ef046be0d7041b36975662006", "score": "0.4574727", "text": "func (tuo *TransactionUpdateOne) SetAccount(a *Account) *TransactionUpdateOne {\n\treturn tuo.SetAccountID(a.ID)\n}", "title": "" }, { "docid": "b4d52c9e2b70ea1a488ad1095b2f7663", "score": "0.45678836", "text": "func (inst *ApproveChecked) SetSourceAccount(source ag_solanago.PublicKey) *ApproveChecked {\n\tinst.Accounts[0] = ag_solanago.Meta(source).WRITE()\n\treturn inst\n}", "title": "" }, { "docid": "2e0d83611d1de10e0f5d6e4302477d3a", "score": "0.4561509", "text": "func (o *QueryImagesByPackageParams) SetXAnchoreAccount(xAnchoreAccount *string) {\n\to.XAnchoreAccount = xAnchoreAccount\n}", "title": "" }, { "docid": "24469890958ff4fb37cd8523df3b04b7", "score": "0.45401567", "text": "func (o HBaseClusterMonitorOutput) PrimaryKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v HBaseClusterMonitor) string { return v.PrimaryKey }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3f0872c77435e4f84afb7f5ee7f09571", "score": "0.4537238", "text": "func (o KafkaClusterMonitorOutput) PrimaryKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v KafkaClusterMonitor) string { return v.PrimaryKey }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4b4e63346dbd694f368120c24d6ab297", "score": "0.453127", "text": "func (o GlobalReplicationGroupOutput) PrimaryReplicationGroupId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *GlobalReplicationGroup) pulumi.StringOutput { return v.PrimaryReplicationGroupId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f5d915610a4d65f3285a3d9ca779a859", "score": "0.45274234", "text": "func PrimaryNodeID(nodeIDs []string, hasher Hasher) string {\n\tsnap := NewClusterSnapshot(NewIDNoder(nodeIDs), hasher, \"jmp-hash\", 1)\n\tprimaryNode := snap.PrimaryFieldTranslationNode()\n\tif primaryNode == nil {\n\t\treturn \"\"\n\t}\n\treturn primaryNode.ID\n}", "title": "" }, { "docid": "5bb9e3895c4c0a014ea342300470b387", "score": "0.45242792", "text": "func (c *ClusterSnapshot) PrimaryPartitionNode(partitionID int) *Node {\n\t// Determine primary owner node.\n\tnodeIndex := c.PrimaryNodeIndex(partitionID)\n\tif nodeIndex < 0 {\n\t\t// no nodes anyway\n\t\treturn nil\n\t}\n\treturn c.Nodes[nodeIndex]\n}", "title": "" }, { "docid": "b795b2160fc6528f5c6ee9a508eb57fe", "score": "0.4520342", "text": "func (c *Client) SetPublicKey(key string) {\n\tc.PublicKey = key\n\tc.computePublicKeyBytes()\n\tc.ID = encryption.Hash(c.PublicKeyBytes)\n}", "title": "" } ]
2db227cf95496945c794023fd46ba06a
This command is a humorous example of how to change a file and check it into a repository, pushing it into a pull request, without This function clones a repo into memory, checks out a new branch, updates a file, pushes the branch and creates a pull request.
[ { "docid": "eb16026cfc75e7878c88c4b62adafa00", "score": "0.6179422", "text": "func updateAndPush(updateField, updateText string) {\n\t//load github credentials. This uses your id_rsa key for mac and linux users\n\tkeys, err := loadPublicKeys()\n\thandleGitCmdError(err)\n\n\t//clone the repo\n\trepo, err := cloneRepoInMemory(keys, exampleRepoUrl)\n\thandleGitCmdError(err)\n\n\t//get the working tree\n\tworktree, err := repo.Worktree()\n\thandleGitCmdError(err)\n\n\t//create a new branch using epoch time to generate a name\n\tbranchName := \"working-update-\" + fmt.Sprint(time.Now().Unix())\n\terr = checkoutNewBranch(worktree, branchName)\n\thandleGitCmdError(err)\n\n\t//update our in memory file\n\terr = updateWorkingtreeFile(worktree, exampleFilePath, updateField, updateText) //TODO fix this\n\thandleGitCmdError(err)\n\n\t//commit and push to git\n\terr = commitAndPushChanges(repo, worktree, keys)\n\thandleGitCmdError(err)\n\n}", "title": "" } ]
[ { "docid": "6e09affe864d95b103c9a6b18a6c5ade", "score": "0.6112137", "text": "func Pull(path string, branch string) error {\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\tcmd := exec.CommandContext(ctx, \"git\", \"reset\", \"--hard\", \"HEAD\")\n\tcmd.Dir = path\n\tcmd.Stderr = os.Stderr\n\tcmd.Stdout = os.Stdout\n\n\terr := cmd.Run()\n\tif err != nil {\n\t\ter := errors.New(\"failed execute command : \" + err.Error())\n\t\tlog.Println(er.Error())\n\t\treturn er\n\t}\n\tcmd = exec.CommandContext(ctx, \"git\", \"pull\", \"--no-ff\", \"origin\", branch)\n\tcmd.Dir = path\n\tcmd.Stderr = os.Stderr\n\tcmd.Stdout = os.Stdout\n\terr = cmd.Run()\n\tif err != nil {\n\t\ter := errors.New(\"failed execute command : \" + err.Error())\n\t\tlog.Println(er.Error())\n\t\treturn er\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a44ef016064279dbf5bc54a7e825cbfb", "score": "0.6072751", "text": "func push() {\n if err := exec.Command(\"git\", \"push\").Run(); err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "05d6ab8aaa9f6c36438edc09e9c14513", "score": "0.6050748", "text": "func pull(gurl, srcPath string) error {\n\tout, err := exec.Command(\"git\", \"-C\", srcPath, \"pull\").CombinedOutput()\n\tlog.Println(string(out))\n\treturn err\n}", "title": "" }, { "docid": "0859e46d86ce94e08b9ff7c7c764b463", "score": "0.59752256", "text": "func ScrubFile(repoPath string, fileName string) error {\n\tgitPath, _ := exec.LookPath(\"git\")\n\tcmd := NewCommand(\"filter-branch\", \"--force\", \"--prune-empty\", \"--tag-name-filter\", \"cat\",\n\t\t\"--index-filter\", \"\\\"\"+gitPath+\"\\\" rm --cached --ignore-unmatch \"+fileName,\n\t\t\"--\", \"--all\")\n\t_, err := cmd.RunInDir(repoPath);\n\tif err != nil && err.Error() == \"exit status 1\" {\n\t\tos.RemoveAll(path.Join(repoPath, \".git/refs/original/\"))\n\t\tcmd = NewCommand(\"reflog\", \"expire\", \"--all\")\n\t\tfmt.Println(\"CMD: \", cmd)\n\t\t_, err = cmd.Run();\n\t\tif err != nil && err.Error() == \"exit status 1\" {\n\t\t\tcmd = NewCommand(\"gc\", \"--aggressive\", \"--prune\")\n\t\t\tfmt.Println(\"CMD: \", cmd)\n\t\t\t_, err = cmd.RunInDir(repoPath);\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "75fef3638878943fc395b554f4dbb20d", "score": "0.5965654", "text": "func pullRequest(cmd *Command, args *Args) {\n\tlocalRepo := github.LocalRepo()\n\n\tcurrentBranch, err := localRepo.CurrentBranch()\n\tutils.Check(err)\n\n\tbaseProject, err := localRepo.MainProject()\n\tutils.Check(err)\n\n\theadProject, err := localRepo.CurrentProject()\n\tutils.Check(err)\n\n\tvar (\n\t\tbase, head string\n\t\tforce, explicitOwner bool\n\t)\n\n\tforce = flagPullRequestForce\n\n\tif flagPullRequestBase != \"\" {\n\t\tbaseProject, base = parsePullRequestProject(baseProject, flagPullRequestBase)\n\t}\n\n\tif flagPullRequestHead != \"\" {\n\t\theadProject, head = parsePullRequestProject(headProject, flagPullRequestHead)\n\t\texplicitOwner = strings.Contains(flagPullRequestHead, \":\")\n\t}\n\n\tif args.ParamsSize() == 1 {\n\t\targ := args.RemoveParam(0)\n\t\tflagPullRequestIssue = parsePullRequestIssueNumber(arg)\n\t}\n\n\tif base == \"\" {\n\t\tmasterBranch, err := localRepo.MasterBranch()\n\t\tutils.Check(err)\n\t\tbase = masterBranch.ShortName()\n\t}\n\n\ttrackedBranch, _ := currentBranch.Upstream()\n\tif head == \"\" {\n\t\tif trackedBranch != nil && trackedBranch.IsRemote() {\n\t\t\tif reflect.DeepEqual(baseProject, headProject) && base == trackedBranch.ShortName() {\n\t\t\t\te := fmt.Errorf(`Aborted: head branch is the same as base (\"%s\")`, base)\n\t\t\t\te = fmt.Errorf(\"%s\\n(use `-h <branch>` to specify an explicit pull request head)\", e)\n\t\t\t\tutils.Check(e)\n\t\t\t}\n\t\t} else {\n\t\t\t// the current branch tracking another branch\n\t\t\t// pretend there's no upstream at all\n\t\t\ttrackedBranch = nil\n\t\t}\n\n\t\tif trackedBranch == nil {\n\t\t\thead = currentBranch.ShortName()\n\t\t} else {\n\t\t\thead = trackedBranch.ShortName()\n\t\t}\n\t}\n\n\tclient := github.NewClient(baseProject.Host)\n\n\t// when no tracking, assume remote branch is published under active user's fork\n\tif trackedBranch == nil && !explicitOwner && client.Credentials.User != headProject.Owner {\n\t\t// disable this on gh\n\t\t//headProject = github.NewProject(\"\", headProject.Name, headProject.Host)\n\t}\n\n\tvar title, body string\n\n\tif flagPullRequestMessage != \"\" {\n\t\ttitle, body = readMsg(flagPullRequestMessage)\n\t}\n\n\tif flagPullRequestFile != \"\" {\n\t\tvar (\n\t\t\tcontent []byte\n\t\t\terr error\n\t\t)\n\t\tif flagPullRequestFile == \"-\" {\n\t\t\tcontent, err = ioutil.ReadAll(os.Stdin)\n\t\t} else {\n\t\t\tcontent, err = ioutil.ReadFile(flagPullRequestFile)\n\t\t}\n\t\tutils.Check(err)\n\t\ttitle, body = readMsg(string(content))\n\t}\n\n\tfullBase := fmt.Sprintf(\"%s:%s\", baseProject.Owner, base)\n\tfullHead := fmt.Sprintf(\"%s:%s\", headProject.Owner, head)\n\n\tif !force && trackedBranch != nil {\n\t\tremoteCommits, _ := git.RefList(trackedBranch.LongName(), \"\")\n\t\tif len(remoteCommits) > 0 {\n\t\t\terr = fmt.Errorf(\"Aborted: %d commits are not yet pushed to %s\", len(remoteCommits), trackedBranch.LongName())\n\t\t\terr = fmt.Errorf(\"%s\\n(use `-f` to force submit a pull request anyway)\", err)\n\t\t\tutils.Check(err)\n\t\t}\n\t}\n\n\tif title == \"\" && flagPullRequestIssue == \"\" {\n\t\tcommits, _ := git.RefList(base, head)\n\t\tt, b, err := writePullRequestTitleAndBody(base, head, fullBase, fullHead, commits)\n\t\tutils.Check(err)\n\t\ttitle = t\n\t\tbody = b\n\t}\n\n\tif title == \"\" && flagPullRequestIssue == \"\" {\n\t\tutils.Check(fmt.Errorf(\"Aborting due to empty pull request title\"))\n\t}\n\n\tvar pullRequestURL string\n\tif args.Noop {\n\t\targs.Before(fmt.Sprintf(\"Would request a pull request to %s from %s\", fullBase, fullHead), \"\")\n\t\tpullRequestURL = \"PULL_REQUEST_URL\"\n\t} else {\n\t\tif title != \"\" {\n\t\t\tpr, err := client.CreatePullRequest(baseProject, base, fullHead, title, body)\n\t\t\tutils.Check(err)\n\t\t\tpullRequestURL = pr.HTMLURL\n\t\t}\n\n\t\tif flagPullRequestIssue != \"\" {\n\t\t\tpr, err := client.CreatePullRequestForIssue(baseProject, base, fullHead, flagPullRequestIssue)\n\t\t\tutils.Check(err)\n\t\t\tpullRequestURL = pr.HTMLURL\n\t\t}\n\t}\n\n\targs.Replace(\"echo\", \"\", pullRequestURL)\n}", "title": "" }, { "docid": "1a0baf8c8e8716b2c1ef880180b97688", "score": "0.5826458", "text": "func Commit(_proposalID int, _commitMessage string) error {\n\t// Name of the branch that will be used\n\tbranchName := \"dit_proposal_\" + strconv.Itoa(_proposalID)\n\n\t// Verifying whether a master branch (or any branch) exists\n\tcmdName := \"git\"\n\tcmdArgs := []string{\"branch\"}\n\tcmdOut, err := exec.Command(cmdName, cmdArgs...).CombinedOutput()\n\tif err != nil {\n\t\treturn errors.New(\"There was an error running git branch\")\n\t}\n\n\t// If not: an empty readme will be pushed to master in order to\n\t// prevent the dit_proposal branch to be the main branch through the first commit\n\tif len(cmdOut) == 0 {\n\t\trepositoryName, err := GetRepository()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Create a README.md file\n\t\terr = ioutil.WriteFile(\"README.md\", []byte(\"# \"+repositoryName), 0644)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"Failed to write README.md file\")\n\t\t}\n\n\t\t// Add it for a commit\n\t\tcmdName = \"git\"\n\t\tcmdArgs = []string{\"add\", \"README.md\"}\n\t\tcmdOut, err = exec.Command(cmdName, cmdArgs...).CombinedOutput()\n\t\tif err != nil {\n\t\t\treturn errors.New(\"There was an error adding the README.md\")\n\t\t}\n\n\t\t// Commit it\n\t\tcmdName = \"git\"\n\t\tcmdArgs = []string{\"commit\", \"-m\", \"Initial push to master\"}\n\t\tcmdOut, err = exec.Command(cmdName, cmdArgs...).CombinedOutput()\n\t\tif err != nil {\n\t\t\treturn errors.New(\"There was an error commiting the initial README\")\n\t\t}\n\n\t\t// Push it\n\t\tcmdName = \"git\"\n\t\tcmdArgs = []string{\"push\", \"-v\"}\n\t\tcmdOut, err = exec.Command(cmdName, cmdArgs...).CombinedOutput()\n\t\tif strings.Contains(string(cmdOut), \"Invalid username or password\") {\n\t\t\thelpers.PrintLine(\"Wrong username or password\", helpers.ERROR)\n\t\t\thelpers.PrintLine(\"Note: If you have 2FA activated for GitHub, please go to: \", helpers.ERROR)\n\t\t\thelpers.PrintLine(\"https://github.blog/2013-09-03-two-factor-authentication/#how-does-it-work-for-command-line-git\", helpers.ERROR)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn errors.New(\"There was an error pushing the initial commit\")\n\t\t}\n\t}\n\n\t// Switch to the dit_proposal branch\n\tcmdName = \"git\"\n\tcmdArgs = []string{\"checkout\", \"-b\", branchName}\n\tcmdOut, err = exec.Command(cmdName, cmdArgs...).CombinedOutput()\n\tif err != nil {\n\t\treturn errors.New(\"There was an error running git checkout\")\n\t}\n\n\t// Verify whether we are on the dit_proposal branch\n\tcmdName = \"git\"\n\tcmdArgs = []string{\"status\"}\n\tcmdOut, err = exec.Command(cmdName, cmdArgs...).CombinedOutput()\n\tif err != nil || !strings.Contains(string(cmdOut), \"On branch \"+branchName) {\n\t\treturn errors.New(\"There was an error running git status\")\n\t}\n\n\t// Adding all files that can be added\n\tcmdName = \"git\"\n\tcmdArgs = []string{\"add\", \".\"}\n\tcmdOut, err = exec.Command(cmdName, cmdArgs...).CombinedOutput()\n\tif err != nil {\n\t\treturn errors.New(\"There was an error running the git add command\")\n\t}\n\n\t// Verifying whether the files have been added\n\tcmdName = \"git\"\n\tcmdArgs = []string{\"diff\", \"--cached\", \"--name-only\"}\n\tcmdOut, err = exec.Command(cmdName, cmdArgs...).CombinedOutput()\n\tif err != nil {\n\t\treturn errors.New(\"There was an error running the git diff command\")\n\t}\n\n\t// If there are no files added, nothing can be committed\n\tif len(cmdOut) == 0 {\n\t\treturn errors.New(\"There are no changed files to add for a commit\")\n\t}\n\n\t// Commit the changes with the provided commit message\n\tcmdName = \"git\"\n\tcmdArgs = []string{\"commit\", \"-m\", _commitMessage, \"-v\"}\n\tcmdOut, err = exec.Command(cmdName, cmdArgs...).CombinedOutput()\n\tif err != nil || !strings.Contains(string(cmdOut), _commitMessage) {\n\t\treturn errors.New(\"There was an error running git commit\")\n\t}\n\n\t// Push these changes to the new branch\n\tcmdName = \"git\"\n\tcmdArgs = []string{\"push\", \"--set-upstream\", \"origin\", branchName, \"-v\"}\n\tcmdOut, err = exec.Command(cmdName, cmdArgs...).CombinedOutput()\n\tif strings.Contains(string(cmdOut), \"Invalid username or password\") {\n\t\thelpers.PrintLine(\"Wrong username or password\", helpers.ERROR)\n\t\thelpers.PrintLine(\"Note: If you have 2FA activated for GitHub, please go to: \", helpers.ERROR)\n\t\thelpers.PrintLine(\"https://github.blog/2013-09-03-two-factor-authentication/#how-does-it-work-for-command-line-git\", helpers.ERROR)\n\t}\n\tif err != nil || !strings.Contains(string(cmdOut), \"set up to track remote branch\") {\n\t\treturn errors.New(\"There was an error running git push\")\n\t}\n\n\t// Switch to the master branch\n\tcmdName = \"git\"\n\tcmdArgs = []string{\"checkout\", \"master\"}\n\tcmdOut, err = exec.Command(cmdName, cmdArgs...).CombinedOutput()\n\tif err != nil {\n\t\treturn errors.New(\"There was an error running the last git checkout\")\n\t}\n\n\t// Verify whether we are on the master branch again\n\tcmdName = \"git\"\n\tcmdArgs = []string{\"status\"}\n\tcmdOut, err = exec.Command(cmdName, cmdArgs...).CombinedOutput()\n\tif err != nil || !strings.Contains(string(cmdOut), \"On branch master\") {\n\t\treturn errors.New(\"There was an error running the last git status\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "04d68794cbac4378b1dcbea99c05e0cc", "score": "0.582279", "text": "func pullRequest(cmd *Command, args *Args) {\n\tvar (\n\t\ttitle, body string\n\t\terr error\n\t)\n\tif args.ParamsSize() == 1 {\n\t\ttitle = args.RemoveParam(0)\n\t}\n\n\tgh := github.New()\n\trepo := gh.Project.LocalRepoWith(flagPullRequestBase, flagPullRequestHead)\n\tif title == \"\" && flagPullRequestIssue == \"\" {\n\t\ttitle, body, err = writePullRequestTitleAndBody(repo)\n\t}\n\n\tif title == \"\" && flagPullRequestIssue == \"\" {\n\t\tutils.Check(fmt.Errorf(\"Aborting due to empty pull request title\"))\n\t}\n\n\tvar pullRequestURL string\n\tif args.Noop {\n\t\targs.Before(fmt.Sprintf(\"Would request a pull request to %s from %s\", repo.FullBase(), repo.FullHead()), \"\")\n\t\tpullRequestURL = \"PULL_REQUEST_URL\"\n\t} else {\n\t\tif title != \"\" {\n\t\t\tpullRequestURL, err = gh.CreatePullRequest(repo.Base, repo.Head, title, body)\n\t\t}\n\t\tutils.Check(err)\n\n\t\tif flagPullRequestIssue != \"\" {\n\t\t\tpullRequestURL, err = gh.CreatePullRequestForIssue(repo.Base, repo.Head, flagPullRequestIssue)\n\t\t}\n\t\tutils.Check(err)\n\n\t}\n\n\targs.Replace(\"echo\", \"\", pullRequestURL)\n}", "title": "" }, { "docid": "152b3a05cfa1f193a8b393e2eb8376a8", "score": "0.5800702", "text": "func GitSucks() {}", "title": "" }, { "docid": "4dbc00fd9f9c2539e92fa044780bde95", "score": "0.5769731", "text": "func gitGet(srcurl string, dest string) {\n hash := strings.Index(srcurl, \"#\")\n _dest := strings.TrimSpace(dest)\n var c *exec.Cmd\n\n _, e := os.Stat(_dest)\n if e == nil {\n // FUTURE\n // println(_dest + \" already exists, to upgrade pass in --upgrade\")\n\n // NOW\n println(_dest + \" already exists, continuing.\")\n return\n }\n\n\n if hash == -1 {\n c = exec.Command(\"git\", \"clone\", srcurl, _dest)\n } else {\n c = exec.Command(\"git\", \"clone\", srcurl[:hash], _dest)\n }\n\n c.Stdout = os.Stdout\n c.Stderr = os.Stderr\n err := c.Run()\n if err != nil {\n os.Exit(1)\n }\n\n if hash == -1 {\n return\n }\n\n last_slash := strings.LastIndex(srcurl, \"/\")\n var reponame string\n if hash == -1 {\n reponame = srcurl[last_slash:]\n } else {\n reponame = srcurl[last_slash:hash]\n }\n\n // this is where we reset to the named hash\n here, wd_err := os.Getwd()\n if (wd_err != nil) {\n println(\"Error getting current working directory.\")\n os.Exit(3)\n }\n os.Chdir(path.Join(_dest, reponame))\n c = exec.Command(\"git\", \"checkout\", srcurl[hash+1:])\n\n hash_err := c.Run()\n if hash_err != nil {\n os.Exit(1)\n }\n os.Chdir(here)\n\n}", "title": "" }, { "docid": "d28198564e02894589e996c88423dfea", "score": "0.5758266", "text": "func newRepo(directory, repoURL, branch string) (*git.Repository, error) {\n\n\tr, err := git.PlainInit(directory, false)\n\tif git.ErrRepositoryAlreadyExists == err {\n\t\tr, err = git.PlainOpen(directory)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmakeACommit(r, directory, \"master\")\n\t_, err = r.CreateRemote(&config.RemoteConfig{\n\t\tName: \"example\",\n\t\tURLs: []string{\"https://github.com/git-fixtures/basic.git\"},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif branch != \"master\" {\n\t\tcreateNewBranch(r, branch)\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "c5d9c87fd799ea4907e019ba7f5e7b77", "score": "0.57363206", "text": "func construct(srcRepo, srcDir, srcURL, srcBranch, dstRepo, dstSubdir string) (string, error) {\n\tcurDir, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif err = os.Chdir(srcRepo); err != nil {\n\t\treturn \"\", err\n\t}\n\tif err = exec.Command(\"git\", \"checkout\", srcBranch).Run(); err != nil {\n\t\treturn \"\", err\n\t}\n\tout, err := exec.Command(\"git\", \"rev-parse\", \"HEAD\").CombinedOutput()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tcommitHash := string(out)\n\tif err = os.Chdir(dstRepo); err != nil {\n\t\treturn \"\", err\n\t}\n\t// TODO: this makes construct() specific for client-go. This keeps\n\t// README.md, CHANGELOG.md, examples folder, .github folder in the\n\t// client-go, rather than copying them from src.\n\tif out, err := exec.Command(\"sh\", \"-c\", fmt.Sprintf(`\\\nfind %s -depth -maxdepth 1 \\( \\\n-name examples -o \\\n-name .github -o \\\n-name .git -o \\\n-name README.md -o \\\n-name CHANGELOG.md -o \\\n-path %s \\) -prune \\\n-o -exec rm -rf {} +`, dstSubdir, dstSubdir)).CombinedOutput(); err != nil {\n\t\tglog.Infof(\"command \\\"find\\\" failed: %s\", out)\n\t\treturn \"\", err\n\t}\n\tif dstSubdir == \"./\" {\n\t\t// don't copy the srcDir folder, just copy its contents\n\t\terr = exec.Command(\"cp\", \"-a\", srcDir+\"/.\", dstSubdir).Run()\n\t} else {\n\t\terr = exec.Command(\"cp\", \"-a\", srcDir, dstSubdir).Run()\n\t}\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// rename _vendor to vendor\n\tif err = exec.Command(\"find\", dstSubdir, \"-depth\", \"-name\", \"_vendor\", \"-type\", \"d\", \"-execdir\", \"mv\", \"{}\", \"vendor\", \";\").Run(); err != nil {\n\t\treturn \"\", err\n\t}\n\tif err = os.Chdir(curDir); err != nil {\n\t\treturn \"\", err\n\t}\n\tcommitMessage := fmt.Sprintf(\"copied from %s, branch %s,\\n\", srcURL, srcBranch)\n\tcommitMessage += fmt.Sprintf(\"last commit is %s\\n\", commitHash)\n\treturn commitMessage, nil\n}", "title": "" }, { "docid": "3febf6abff0f6e2a07be1f06166b74e3", "score": "0.57138556", "text": "func gitPullMaster(dir string) {\n\tcmd := exec.Command(\"git\", \"pull\", \"origin\", \"master\")\n\texecute(cmd, dir)\n\tfmt.Printf(\"Pulling origin master on %s...\\n\", dir)\n}", "title": "" }, { "docid": "4c0d38b8609d908de0e01ac0d62fd11d", "score": "0.5699172", "text": "func bpPull(pullOptions, org, repo, path, outdir string,\n\tclient *github.Client) error {\n\n\topts := github.RepositoryContentGetOptions{}\n\n\t// Either file or directory content will be nil\n\t// file, director, resp, err\n\tfileContent, directoryContent, _, err := client.Repositories.GetContents(context.Background(), org, repo, path, &opts)\n\tif err != nil {\n\t\tlog.Println(\"client.Repositories.GetContents: \", err)\n\t\treturn err\n\t}\n\n\t// TODO: what is this\n\t//fmt.Println(rsp.StatusCode)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tif fileContent != nil {\n\t\tdstr, _ := base64.StdEncoding.DecodeString(*fileContent.Content)\n\t\tfp := outdir + \"/\" + *fileContent.Path\n\t\tif _, err := os.Stat(fp); os.IsNotExist(err) {\n\t\t\tif _, err := os.Create(fp); err != nil {\n\t\t\t\tmsg := fmt.Errorf(\"Creating file %s failed with error %s\\n\", fp, err)\n\t\t\t\treturn msg\n\t\t\t}\n\t\t}\n\t\terr = ioutil.WriteFile(fp, dstr, 0600)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"ioutil.WriteFile error %v\\n\", err.Error())\n\t\t}\n\n\t} else {\n\t\tfor _, item := range directoryContent {\n\t\t\t// If it is a directory, create if necessary\n\t\t\t// Then walk it\n\t\t\tif *item.Type == \"dir\" {\n\t\t\t\tdn := outdir + \"/\" + *item.Path\n\t\t\t\tif _, err := os.Stat(dn); os.IsNotExist(err) {\n\t\t\t\t\tif err := os.MkdirAll(dn, os.ModePerm); err != nil {\n\t\t\t\t\t\tfmt.Errorf(\"Failed creating directory %s with error %s\\n\",\n\t\t\t\t\t\t\tdn, err)\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tfmt.Println(\"Blueprint directory created: \", dn)\n\t\t\t\t}\n\t\t\t\t_ = bpPull(pullOptions, org, repo, *item.Path, outdir, client)\n\t\t\t}\n\n\t\t\t// For files, request their content\n\t\t\tif *item.Type == \"file\" {\n\t\t\t\t_ = bpPull(pullOptions, org, repo, *item.Path, outdir, client)\n\t\t\t}\n\n\t\t}\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b21c151cc09d2e98d4d773e2e6968235", "score": "0.569495", "text": "func commitFile(appConfig *config.AppConfig, packageName, packageVersion string) (result string, err error) {\n\tfolderStructure := helpers.MakeCratePath(packageName)\n\tvar resultPath []string\n\tresultPath = append(resultPath, folderStructure...)\n\tresultPath = append(resultPath, packageName)\n\tresultPathString := strings.Join(resultPath, string(os.PathSeparator))\n\tw, err := appConfig.Repo.Instance.Worktree()\n\tif err != nil {\n\t\treturn result, err\n\t}\n\t_, err = w.Add(resultPathString)\n\tif err != nil {\n\t\tlog.ErrorWithFields(\"Error adding to local repo\", log.Fields{\"error\": err})\n\t\treturn \"\", err\n\t}\n\n\tlog.InfoWithFields(\"File added to local repo\", log.Fields{\"file\": resultPathString})\n\n\tcommitMsg := fmt.Sprintf(\"Commit package %s version %s\",\n\t\tpackageName, packageVersion)\n\tlog.InfoWithFields(\"Commit file to repo\", log.Fields{\n\t\t\"message\": commitMsg,\n\t})\n\tcommit, err := w.Commit(commitMsg, &git.CommitOptions{\n\t\tAuthor: &object.Signature{\n\t\t\tName: appConfig.Repo.Auth.Name,\n\t\t\tEmail: appConfig.Repo.Auth.Email,\n\t\t\tWhen: time.Now(),\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\tobj, err := appConfig.Repo.Instance.CommitObject(commit)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tresult = obj.Hash.String()\n\treturn result, err\n}", "title": "" }, { "docid": "0484854492f5c4488a0d006669f0747a", "score": "0.5641016", "text": "func checkoutNewBranch(repoPath, localPath, oldBranch, newBranch string) error {\n\tif err := git.Checkout(localPath, git.CheckoutOptions{\n\t\tTimeout: time.Duration(setting.Git.Timeout.Pull) * time.Second,\n\t\tBranch: newBranch,\n\t\tOldBranch: oldBranch,\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"git checkout -b %s %s: %v\", newBranch, oldBranch, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6e56c2215c9c679396c78b574a7ded77", "score": "0.5596043", "text": "func ghCreatePR(ctx context.Context, owner, repo, base, branch, title string, issue int, token string, plan map[string]Patch, data Data) (*github.PullRequest, error) {\n\tghc := ghClient(ctx, token)\n\n\t// get base branch\n\tbaseBranch, _, err := ghc.Repositories.GetBranch(ctx, owner, repo, base)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting base branch: %w\", err)\n\t}\n\n\t// get base commit\n\tbaseCommit, _, err := ghc.Repositories.GetCommit(ctx, owner, repo, *baseBranch.Commit.SHA)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting base commit: %w\", err)\n\t}\n\n\t// get base tree\n\tbaseTree, _, err := ghc.Git.GetTree(ctx, owner, repo, baseCommit.GetSHA(), true)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting base tree: %w\", err)\n\t}\n\n\t// update files\n\tchanges, err := ghUpdate(ctx, owner, repo, baseTree, token, plan, data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error updating files: %w\", err)\n\t}\n\tif changes == nil {\n\t\treturn nil, nil\n\t}\n\n\t// create fork\n\tfork, resp, err := ghc.Repositories.CreateFork(ctx, owner, repo, nil)\n\t// https://pkg.go.dev/github.com/google/go-github/v32@v32.1.0/github#RepositoriesService.CreateFork\n\t// This method might return an *AcceptedError and a status code of 202. This is because this is\n\t// the status that GitHub returns to signify that it is now computing creating the fork in a\n\t// background task. In this event, the Repository value will be returned, which includes the\n\t// details about the pending fork. A follow up request, after a delay of a second or so, should\n\t// result in a successful request.\n\tif resp.StatusCode == 202 { // *AcceptedError\n\t\ttime.Sleep(time.Second * 5)\n\t} else if err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating fork: %w\", err)\n\t}\n\n\t// create fork tree from base and changed files\n\tforkTree, _, err := ghc.Git.CreateTree(ctx, *fork.Owner.Login, *fork.Name, *baseTree.SHA, changes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating fork tree: %w\", err)\n\t}\n\n\t// create fork commit\n\tforkCommit, _, err := ghc.Git.CreateCommit(ctx, *fork.Owner.Login, *fork.Name, &github.Commit{\n\t\tMessage: github.String(title),\n\t\tTree: &github.Tree{SHA: forkTree.SHA},\n\t\tParents: []*github.Commit{{SHA: baseCommit.SHA}},\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating fork commit: %w\", err)\n\t}\n\tklog.Infof(\"PR commit '%s' created: %s\", forkCommit.GetSHA(), forkCommit.GetHTMLURL())\n\n\t// create PR branch\n\tprBranch := branch + forkCommit.GetSHA()[:7]\n\tprRef, _, err := ghc.Git.CreateRef(ctx, *fork.Owner.Login, *fork.Name, &github.Reference{\n\t\tRef: github.String(\"refs/heads/\" + prBranch),\n\t\tObject: &github.GitObject{\n\t\t\tType: github.String(\"commit\"),\n\t\t\tSHA: forkCommit.SHA,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating PR branch: %w\", err)\n\t}\n\tklog.Infof(\"PR branch '%s' created: %s\", prBranch, prRef.GetURL())\n\n\t// create PR\n\tmodifiable := true\n\tpr, _, err := ghc.PullRequests.Create(ctx, owner, repo, &github.NewPullRequest{\n\t\tTitle: github.String(title),\n\t\tHead: github.String(*fork.Owner.Login + \":\" + prBranch),\n\t\tBase: github.String(base),\n\t\tBody: github.String(fmt.Sprintf(\"fixes #%d\\n\\nAutomatically created PR to update repo according to the Plan:\\n\\n```\\n%s\\n```\", issue, thePlan(plan, data))),\n\t\tMaintainerCanModify: &modifiable,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating pull request: %w\", err)\n\t}\n\treturn pr, nil\n}", "title": "" }, { "docid": "841cad85d3bd15884156d26857c3b08a", "score": "0.5588375", "text": "func (c *pullRequestChecker) Do() error {\n\tswitch {\n\tcase c.issueNumber < 1,\n\t\tc.changedFiles < 1,\n\t\t!c.IsValidAction():\n\t\treturn nil\n\t}\n\n\tconf := c.config\n\tbase := c.event.PullRequest.Base\n\thead := c.event.PullRequest.Head\n\trepoConfig := conf.GetRepository(base.Repo.GetFullName())\n\tif repoConfig == nil {\n\t\treturn nil\n\t}\n\n\tc.loggingInfo(\"[commitHash:%s]\", c.commitAfter)\n\n\tswitch {\n\tcase !c.config.AddComment,\n\t\t!c.HasCompareCommitHash():\n\t\tc.commitBefore = base.GetSHA()\n\t\tc.commitAfter = head.GetSHA()\n\t}\n\n\tchangedFiles, err := c.apiCompareCommit()\n\tswitch {\n\tcase err != nil:\n\t\treturn err\n\tcase len(changedFiles) == 0:\n\t\treturn nil\n\t}\n\n\tcomment := Comment{}\n\tassignees := &Assignees{}\n\treviewers := &Assignees{}\n\tfor i := range repoConfig.Files {\n\t\trf := repoConfig.Files[i]\n\t\tmatchedFiles := make([]string, 0, len(changedFiles))\n\t\tfor _, f := range changedFiles {\n\t\t\tif rf.Match(f) {\n\t\t\t\tmatchedFiles = append(matchedFiles, f)\n\t\t\t}\n\t\t}\n\t\tif len(matchedFiles) != 0 {\n\t\t\tcomment.Add(rf.GetComment(matchedFiles))\n\t\t\tassignees.Add(rf.Assignees...)\n\t\t\treviewers.Add(rf.Reviewers...)\n\t\t}\n\t}\n\n\tc.apiCreateOrEditComment(comment)\n\n\t// ignore already removed assignee and reviewers.\n\tremovedUsers, err := c.apiGetRemovedEvent()\n\tif err == nil {\n\t\tremoved := removedUsers.List()\n\t\tfmt.Printf(\"[removed] %+v\\n\", removed)\n\t\tassignees.RemoveFromList(removed...)\n\t\treviewers.RemoveFromList(removed...)\n\t}\n\tc.apiAddAssignee(assignees)\n\tc.apiAddReviewers(reviewers)\n\treturn nil\n}", "title": "" }, { "docid": "98cbad123382026812834505c7ff0965", "score": "0.5563247", "text": "func clone(r *plugin.Repo, b *plugin.Build, w *plugin.Workspace, v *Params) error {\n\terr := os.MkdirAll(w.Path, 0777)\n\tif err != nil {\n\t\tfmt.Printf(\"Error creating directory %s. %s\\n\", w.Path, err)\n\t\treturn err\n\t}\n\n\t// generate the .netrc file\n\tif err := writeNetrc(w); err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\treturn err\n\t}\n\n\t// write the rsa private key if provided\n\tif err := writeKey(w); err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\treturn err\n\t}\n\n\tvar cmds []*exec.Cmd\n\n\tif v.SkipVerify {\n\t\tcmds = append(cmds, skipVerify())\n\t}\n\n\t// check for a .git directory and whether it's empty\n\temptyDir := isDirEmpty(filepath.Join(w.Path, \".git\"))\n\tif emptyDir {\n\t\tcmds = append(cmds, initGit())\n\t\tcmds = append(cmds, remote(r))\n\t}\n\n\tswitch {\n\tcase isPullRequest(b) || isTag(b):\n\t\tcmds = append(cmds, fetch(b, v.Tags, v.Depth, emptyDir))\n\t\tcmds = append(cmds, checkoutHead(b))\n\tdefault:\n\t\tcmds = append(cmds, fetch(b, v.Tags, v.Depth, emptyDir))\n\t\tcmds = append(cmds, checkoutSha(b))\n\t}\n\n\tfor name, url := range v.Submodules {\n\t\tcmds = append(cmds, remapSubmodule(name, url))\n\t}\n\n\tif v.Recursive {\n\t\tcmds = append(cmds, updateSubmodules(v.SubmoduleRemote))\n\t}\n\n\tif err := execute(cmds, w.Path); err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\treturn err\n\t}\n\n\tif v.TweakGitattributes {\n\t\ttweakGitattributes(w.Path)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "458c7ad14524065036b840e80a144b7e", "score": "0.55605334", "text": "func (p Pull) Command() []string { return []string{\"pull\", \"origin\", p.branch} }", "title": "" }, { "docid": "f02d2ea9afe3f2494b7d9f4c22f983aa", "score": "0.55442154", "text": "func dummyRev(ctx context.Context, git *gittool.Tool, dir string, branch string, file string, msg string) (gitobj.Hash, error) {\n\tgit = git.WithDir(dir)\n\tcurr, err := gittool.ParseRev(ctx, git, \"HEAD\")\n\tif err != nil {\n\t\t// First commit\n\t\tif branch != \"master\" {\n\t\t\treturn gitobj.Hash{}, fmt.Errorf(\"make dummy rev: %v\", err)\n\t\t}\n\t} else if curr.Ref().Branch() != branch {\n\t\tif _, err := gittool.ParseRev(ctx, git, \"refs/heads/\"+branch); err != nil {\n\t\t\t// Branch doesn't exist, create it.\n\t\t\tif err := git.Run(ctx, \"branch\", \"--\", branch); err != nil {\n\t\t\t\treturn gitobj.Hash{}, fmt.Errorf(\"make dummy rev: %v\", err)\n\t\t\t}\n\t\t\tif err := git.Run(ctx, \"branch\", \"--set-upstream-to=\"+curr.Ref().String(), \"--\", branch); err != nil {\n\t\t\t\treturn gitobj.Hash{}, fmt.Errorf(\"make dummy rev: %v\", err)\n\t\t\t}\n\t\t}\n\t\tif err := git.Run(ctx, \"checkout\", \"--quiet\", branch); err != nil {\n\t\t\treturn gitobj.Hash{}, fmt.Errorf(\"make dummy rev: %v\", err)\n\t\t}\n\t}\n\terr = ioutil.WriteFile(filepath.Join(dir, file), []byte(\"dummy content\"), 0666)\n\tif err != nil {\n\t\treturn gitobj.Hash{}, fmt.Errorf(\"make dummy rev: %v\", err)\n\t}\n\tif err := git.Run(ctx, \"add\", file); err != nil {\n\t\treturn gitobj.Hash{}, fmt.Errorf(\"make dummy rev: %v\", err)\n\t}\n\tif err := git.Run(ctx, \"commit\", \"-m\", msg); err != nil {\n\t\treturn gitobj.Hash{}, fmt.Errorf(\"make dummy rev: %v\", err)\n\t}\n\tcurr, err = gittool.ParseRev(ctx, git, \"HEAD\")\n\tif err != nil {\n\t\treturn gitobj.Hash{}, fmt.Errorf(\"make dummy rev: %v\", err)\n\t}\n\treturn curr.Commit(), nil\n}", "title": "" }, { "docid": "ada4c7cd6d18f3121cd3ce01b3a86f05", "score": "0.55204767", "text": "func clone(directory, remoteURL, branch string, auth transport.AuthMethod, out io.Writer) (*gogit.Repository, error) {\n\tfmt.Fprintf(out, \"Cloning branch %s from %s...\\n\", branch, remoteURL)\n\tref := plumbing.ReferenceName(fmt.Sprintf(\"refs/heads/%s\", branch))\n\trepo, err := gogit.PlainClone(directory, false, &gogit.CloneOptions{\n\t\tURL: remoteURL,\n\t\tAuth: auth,\n\t\tProgress: out,\n\t\tReferenceName: ref,\n\t})\n\terr = SimplifyGitErr(err)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Use this to confirm if pull has completed.\n\t_, err = repo.Head()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn repo, nil\n}", "title": "" }, { "docid": "76aafcf34aab14c671ef9598250d8c5a", "score": "0.5519384", "text": "func (ctr *customTemplateGitHubRepo) pullChanges(repoPath, githubToken string) error {\n\tr, err := git.PlainOpen(repoPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw, err := r.Worktree()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = w.Pull(&git.PullOptions{RemoteName: \"origin\", Auth: getAuth(ctr.owner, githubToken)})\n\tif err != nil {\n\t\treturn errors.Errorf(\"%s/%s: %s\", ctr.owner, ctr.reponame, err.Error())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4c980c8f92450866d574a35751863199", "score": "0.5509869", "text": "func ghCreatePR(ctx context.Context, owner, repo, base, branch, title string, issue int, token string, schema map[string]Item, data interface{}) (*github.PullRequest, error) {\n\tghc := ghClient(ctx, token)\n\n\t// get base branch\n\tbaseBranch, _, err := ghc.Repositories.GetBranch(ctx, owner, repo, base)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get base branch: %w\", err)\n\t}\n\n\t// get base commit\n\tbaseCommit, _, err := ghc.Repositories.GetCommit(ctx, owner, repo, *baseBranch.Commit.SHA)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get base commit: %w\", err)\n\t}\n\n\t// get base tree\n\tbaseTree, _, err := ghc.Git.GetTree(ctx, owner, repo, baseCommit.GetSHA(), true)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get base tree: %w\", err)\n\t}\n\n\t// update files\n\tchanges, err := ghUpdate(ctx, owner, repo, token, schema, data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to update files: %w\", err)\n\t}\n\tif changes == nil {\n\t\treturn nil, nil\n\t}\n\n\t// create fork\n\tfork, resp, err := ghc.Repositories.CreateFork(ctx, owner, repo, nil)\n\t// \"This method might return an *AcceptedError and a status code of 202.\n\t// This is because this is the status that GitHub returns to signify that it is now computing creating the fork in a background task.\n\t// In this event, the Repository value will be returned, which includes the details about the pending fork.\n\t// A follow up request, after a delay of a second or so, should result in a successful request.\"\n\t// (ref: https://pkg.go.dev/github.com/google/go-github/v32@v32.1.0/github#RepositoriesService.CreateFork)\n\tif resp.StatusCode == 202 { // *AcceptedError\n\t\ttime.Sleep(time.Second * 5)\n\t} else if err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create fork: %w\", err)\n\t}\n\n\t// create fork tree from base and changed files\n\tforkTree, _, err := ghc.Git.CreateTree(ctx, *fork.Owner.Login, *fork.Name, *baseTree.SHA, changes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create fork tree: %w\", err)\n\t}\n\n\t// create fork commit\n\tforkCommit, _, err := ghc.Git.CreateCommit(ctx, *fork.Owner.Login, *fork.Name, &github.Commit{\n\t\tMessage: github.String(title),\n\t\tTree: &github.Tree{SHA: forkTree.SHA},\n\t\tParents: []*github.Commit{{SHA: baseCommit.SHA}},\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create fork commit: %w\", err)\n\t}\n\tklog.Infof(\"PR commit '%s' successfully created: %s\", forkCommit.GetSHA(), forkCommit.GetHTMLURL())\n\n\t// create PR branch\n\tprBranch := branch + forkCommit.GetSHA()[:7]\n\tprRef, _, err := ghc.Git.CreateRef(ctx, *fork.Owner.Login, *fork.Name, &github.Reference{\n\t\tRef: github.String(\"refs/heads/\" + prBranch),\n\t\tObject: &github.GitObject{\n\t\t\tType: github.String(\"commit\"),\n\t\t\tSHA: forkCommit.SHA,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create PR branch: %w\", err)\n\t}\n\tklog.Infof(\"PR branch '%s' successfully created: %s\", prBranch, prRef.GetURL())\n\n\t// create PR\n\t_, pretty, err := GetPlan(schema, data)\n\tif err != nil {\n\t\tklog.Fatalf(\"Unable to parse schema: %v\\n%s\", err, pretty)\n\t}\n\tmodifiable := true\n\tpr, _, err := ghc.PullRequests.Create(ctx, owner, repo, &github.NewPullRequest{\n\t\tTitle: github.String(title),\n\t\tHead: github.String(*fork.Owner.Login + \":\" + prBranch),\n\t\tBase: github.String(base),\n\t\tBody: github.String(fmt.Sprintf(\"fixes: #%d\\n\\nAutomatically created PR to update repo according to the Plan:\\n\\n```\\n%s\\n```\", issue, pretty)),\n\t\tMaintainerCanModify: &modifiable,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create PR: %w\", err)\n\t}\n\treturn pr, nil\n}", "title": "" }, { "docid": "afa11b9a82c3ebd5590ef37e40306abe", "score": "0.550702", "text": "func DevShort(branch string, comments []string) {\n\tmainbrach := GetMainBranch()\n\t_, chExist := ChangedFilesExist()\n\tvar err error\n\tif chExist {\n\t\terr = new(gochips.PipedExec).\n\t\t\tCommand(git, \"add\", \".\").\n\t\t\tRun(os.Stdout, os.Stdout)\n\t\tgochips.ExitIfError(err)\n\t\terr = new(gochips.PipedExec).\n\t\t\tCommand(git, \"stash\").\n\t\t\tRun(os.Stdout, os.Stdout)\n\t\tgochips.ExitIfError(err)\n\t}\n\n\terr = new(gochips.PipedExec).\n\t\tCommand(git, \"config\", \"pull.rebase\", \"false\").\n\t\tRun(os.Stdout, os.Stdout)\n\tgochips.ExitIfError(err)\n\n\terr = new(gochips.PipedExec).\n\t\tCommand(git, \"pull\", \"upstream\", mainbrach, \"--no-edit\").\n\t\tRun(os.Stdout, os.Stdout)\n\tgochips.ExitIfError(err)\n\n\t_, stderr, err := new(gochips.PipedExec).\n\t\tCommand(git, \"checkout\", mainbrach).\n\t\tRunToStrings()\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"128\") && strings.Contains(stderr, \"matched multiple\") {\n\t\t\terr = new(gochips.PipedExec).\n\t\t\t\tCommand(git, \"checkout\", \"--track\", \"origin/\"+mainbrach).\n\t\t\t\tRun(os.Stdout, os.Stdout)\n\t\t\tgochips.ExitIfError(err)\n\t\t}\n\t}\n\n\terr = new(gochips.PipedExec).\n\t\tCommand(git, \"checkout\", \"-b\", branch).\n\t\tRun(os.Stdout, os.Stdout)\n\tgochips.ExitIfError(err)\n\n\t// Add empty commit to create commit object and link notes to it\n\terr = new(gochips.PipedExec).\n\t\tCommand(git, \"commit\", \"--allow-empty\", \"-m\", \"Commit for keeping notes in branch\").\n\t\tRun(os.Stdout, os.Stdout)\n\tgochips.ExitIfError(err)\n\taddNotes(comments)\n\n\terr = new(gochips.PipedExec).\n\t\tCommand(git, push, \"-u\", origin, branch).\n\t\tRun(os.Stdout, os.Stdout)\n\tgochips.ExitIfError(err)\n\n\tif chExist {\n\t\terr = new(gochips.PipedExec).\n\t\t\tCommand(git, \"stash\", \"pop\").\n\t\t\tRun(os.Stdout, os.Stdout)\n\t\tgochips.ExitIfError(err)\n\t}\n}", "title": "" }, { "docid": "e4e68168428506b0b62479a0e27a24d7", "score": "0.55059665", "text": "func commit() {\n\troot, err := saveBlob(\"file.txt\")\n\tcheckError(err)\n\t//Throw error if there isn't a commit message.\n\t//TODO: Is this something we want to enforce?\n\tif len(os.Args) < 3 {\n\t\tlog.Fatal(\"please provide a commit message\")\n\t}\n\tcommit, err := saveCommit(root)\n\tcheckError(err)\n\terr = ioutil.WriteFile(\".cap/refs/heads/main\", []byte(commit), 0666)\n\tcheckError(err)\n}", "title": "" }, { "docid": "df60a7f3b29dd7d24785ff3a268ac515", "score": "0.54939115", "text": "func git(command []string, dir string) []byte {\n os.Chdir(dir)\n out, err := exec.Command(\"git\", command...).CombinedOutput()\n\n if err != nil {\n fmt.Println(string(out))\n panic(\"there was a problem running the git command '\" + strings.Join(command, \" \") + \"'. See output above for clues.\")\n }\n\n return out\n}", "title": "" }, { "docid": "219962ee2c39c4a8ec5baa9d03672939", "score": "0.54717463", "text": "func gitPushMirror(gitDir string, logFile io.Writer) error {\n\tcmd := exec.Command(\"git\", \"push\", \"--mirror\")\n\tcmd.Stderr = logFile\n\tcmd.Stdout = logFile\n\tcmd.Dir = gitDir\n\treturn errors.Wrap(cmd.Run(), \"Error pushing mirrored git repo\")\n}", "title": "" }, { "docid": "2fcd5878e047ef954faeeb9980b0f577", "score": "0.5458522", "text": "func Checkout(rev string) error {\n\tcmd := exec.Command(\"git\", \"checkout\", rev)\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "97b0d4275cf06dadf980bee123464d9e", "score": "0.54554385", "text": "func main() {\n\n\tlog.Println(os.Args)\n\tif len(os.Args) < 2 {\n\t\tlog.Fatal(\"provide a file to process\")\n\t}\n\tfilepath := os.Args[1]\n\tbuff, err := os.ReadFile(filepath)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tcontent := string(buff)\n\t// fix markdown link by replacing them with relref shortcodes.\n\tcontent = convertLinks(content)\n\n\t// adds PR links to changelog page\n\tif strings.Contains(filepath, \"CHANGELOG\") {\n\t\tcontent = addPRLinks(content)\n\t}\n\n\tif err := os.WriteFile(filepath, []byte(content), 0); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "2c289da265f9180e8e64f8cb887ba704", "score": "0.54507273", "text": "func Commit(worktreeDir string, msg string) {\n\t// Opens an already existing repository.\n\tr, _ := git.PlainOpen(worktreeDir)\n\n\tw, _ := r.Worktree()\n\n\t_, _ = w.Add(\".\")\n\n\t// We can verify the current status of the worktree using the method Status.\n\tstatus, _ := w.Status()\n\n\tfmt.Println(status)\n\n\tcommit, _ := w.Commit(msg, &git.CommitOptions{\n\t\tAuthor: &object.Signature{\n\t\t\tName: \"Cronicle user\",\n\t\t\tWhen: time.Now(),\n\t\t},\n\t})\n\n\tobj, _ := r.CommitObject(commit)\n\n\tfmt.Println(obj)\n}", "title": "" }, { "docid": "eadb7b8792066c57ae582e4771a54099", "score": "0.5444991", "text": "func (r *Store) GitPull(ctx context.Context, name, origin, remote string) error {\n\tctx, store, _ := r.getStore(ctx, name)\n\treturn store.GitPush(ctx, origin, remote)\n}", "title": "" }, { "docid": "2a68e58eab62e213ee6a36f78c0561b1", "score": "0.54285204", "text": "func gitFetchPrune(gitDir string, logFile io.Writer) error {\n\tcmd := exec.Command(\"git\", \"fetch\", \"-p\", \"origin\")\n\tcmd.Stderr = logFile\n\tcmd.Stdout = logFile\n\tcmd.Dir = gitDir\n\treturn errors.Wrap(cmd.Run(), \"Error fetching\")\n}", "title": "" }, { "docid": "868df1b52999a5b449c67c35e63256db", "score": "0.5427095", "text": "func pull(ctx context.Context, gitFullPath, dir string) error {\n\tctx, span := trace.StartSpan(ctx, \"perfgit.pull\")\n\tdefer span.End()\n\n\tcmd := exec.CommandContext(ctx, gitFullPath, \"pull\")\n\tcmd.Dir = dir\n\tif err := cmd.Run(); err != nil {\n\t\texerr := err.(*exec.ExitError)\n\t\treturn skerr.Wrapf(err, \"Failed to pull repo %q with git %q: %s\", dir, gitFullPath, exerr.Stderr)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "23d5e48ec229c2ce4f5ae3d500b4b6a8", "score": "0.5425191", "text": "func (r *Repo) push() error {\n\treturn try(3, func() error {\n\t\tcmd := exec.Command(\"git\", \"push\", \"-f\", \"--mirror\", \"dest\")\n\t\tcmd.Dir = r.root\n\t\tif out, err := cmd.CombinedOutput(); err != nil {\n\t\t\terr = fmt.Errorf(\"%v\\n\\n%s\", err, out)\n\t\t\tr.logf(\"git push: %v\", err)\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "fc653d9abf767d4f81726ec7991b6e89", "score": "0.53881145", "text": "func PushCommit(manifest model.Manifest, repo, branch, commitString string, dryrun bool, githubToken string) (changes bool, err error) {\n\toutput := bytes.Buffer{}\n\tcmd := VerboseCommand(\"git\", \"status\", \"--porcelain\")\n\tcmd.Dir = manifest.RepoDir(repo)\n\tcmd.Stdout = &output\n\tif err := cmd.Run(); err != nil {\n\t\treturn false, err\n\t}\n\tif output.Len() == 0 {\n\t\tlog.Infof(\"no changes found to commit\")\n\t\treturn false, nil\n\t}\n\tlog.Infof(\"changes found:\\n%s\", &output)\n\n\tif !dryrun {\n\t\tcmd = VerboseCommand(\"git\", \"checkout\", \"-b\", branch)\n\t\tcmd.Dir = manifest.RepoDir(repo)\n\t\tif err := cmd.Run(); err != nil {\n\t\t\treturn true, err\n\t\t}\n\n\t\tcmd = VerboseCommand(\"git\", \"add\", \"-A\")\n\t\tcmd.Dir = manifest.RepoDir(repo)\n\t\tif err := cmd.Run(); err != nil {\n\t\t\treturn true, err\n\t\t}\n\n\t\t// Get user.email and user.name from the GitHub token\n\t\tctx := context.Background()\n\t\tts := oauth2.StaticTokenSource(\n\t\t\t&oauth2.Token{AccessToken: githubToken},\n\t\t)\n\n\t\ttc := oauth2.NewClient(ctx, ts)\n\t\tclient := github.NewClient(tc)\n\n\t\tuser, _, err := client.Users.Get(ctx, \"\")\n\t\tif err != nil {\n\t\t\treturn true, err\n\t\t}\n\n\t\t// user.Email may be nil, so set to an empty string\n\t\temptyString := \"\"\n\t\tif user.Email == nil {\n\t\t\tuser.Email = &emptyString\n\t\t}\n\n\t\tcmd = VerboseCommand(\"git\", \"-c\", \"user.name=\"+*user.Name, \"-c\", \"user.email=\"+*user.Email, \"commit\",\n\t\t\t\"--message\", commitString, \"--author=\"+*user.Name+\"<\"+*user.Email+\">\")\n\t\tcmd.Dir = manifest.RepoDir(repo)\n\t\tif err := cmd.Run(); err != nil {\n\t\t\treturn true, err\n\t\t}\n\n\t\tcmd = VerboseCommand(\"git\", \"push\", \"--set-upstream\", \"origin\", branch)\n\t\tcmd.Dir = manifest.RepoDir(repo)\n\t\tif err := cmd.Run(); err != nil {\n\t\t\treturn true, err\n\t\t}\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "6d544c808ad47045495557f09d6fe8c2", "score": "0.53865623", "text": "func GitRebase(pr *github.PullRequest) error {\n\t\n\tfilepath := git.GetRepositoryFilePath(pr.Head.Repository.FullName)\n\tremoteRepositoryURL := git.GenerateCloneURL(pr.Head.Repository.FullName)\n\n\tif !git.Exists(filepath) {\n\t\tif _, err := git.Clone(remoteRepositoryURL); err != nil {\n\t\t\tpr.PostComment(\"I could not pull \" + pr.Head.Repository.FullName + \" from GitHub.\")\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := git.Fetch(filepath); err != nil {\n\t\tgit.Prune(filepath)\n\t\tpr.PostComment(\"I could not fetch the latest changes from GitHub. Please try again in a few minutes.\")\n\t\treturn err\n\t}\n\n\tif err := git.Checkout(filepath, pr.Head.Ref); err != nil {\n\t\tpr.PostComment(\"I could not checkout \" + pr.Head.Ref + \" locally.\")\n\t\treturn err\n\t}\n\n\tif err := git.Reset(filepath, path.Join(\"origin\", pr.Head.Ref)); err != nil {\n\t\tpr.PostComment(\"I could not checkout \" + pr.Head.Ref + \" locally.\")\n\t\treturn err\n\t}\n\n\tif err := git.Config(filepath, \"user.name\", git.GetName()); err != nil {\n\t\tpr.PostComment(\"I could run git config for user.name on the server.\")\n\t\treturn err\n\t}\n\n\tif err := git.Config(filepath, \"user.email\", git.GetEmail()); err != nil {\n\t\tpr.PostComment(\"I could run git config for user.email on the server.\")\n\t\treturn err\n\t}\n\n\tif err := git.Rebase(filepath, path.Join(\"origin\", pr.Base.Ref)); err != nil {\n\t\tpr.PostComment(\"I could not rebase \" + pr.Head.Ref + \" with \" + pr.Base.Ref + \". There are conflicts.\")\n\t\treturn err\n\t}\n\n\tif err := git.Push(filepath, pr.Head.Ref); err != nil {\n\t\tpr.PostComment(\"I could not push the changes to \" + pr.Base.Ref + \".\")\n\t\treturn err\n\t}\n\n\tpr.PostComment(\"I just pushed up the changes, enjoy!\")\n\treturn nil\n}", "title": "" }, { "docid": "6682d53f7131c16e08e670bbd7d3c312", "score": "0.5386513", "text": "func (c githubClient) UpdateFile(ctx context.Context, opts *Options, path string, msg string, contents []byte) error {\n\tif err := verifyOptions(opts); err != nil {\n\t\treturn err\n\t}\n\n\toptions := &github.RepositoryContentFileOptions{\n\t\tCommitter: &github.CommitAuthor{\n\t\t\tName: github.String(opts.AuthorName),\n\t\t\tEmail: github.String(opts.AuthorEmail),\n\t\t},\n\t\tContent: contents,\n\t\tMessage: github.String(msg),\n\t\tBranch: github.String(opts.Ref),\n\t}\n\n\t// First, check that the file exists in the specified repo.\n\tfile, _, resp, err := c.client.Repositories.GetContents(\n\t\tctx,\n\t\topts.RepoOwner,\n\t\topts.RepoName,\n\t\tpath,\n\t\t&github.RepositoryContentGetOptions{},\n\t)\n\tif err != nil {\n\t\t// If we get a 404, the file does not exist. Return an error. It is up to\n\t\t// the caller to decide whether or not to create the file or to error out.\n\t\tif resp.StatusCode == 404 {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"error\": err,\n\t\t\t\t\"file\": path,\n\t\t\t\t\"ref\": opts.Ref,\n\t\t\t}).Error(\"github client: unable to update file (not found)\")\n\t\t\treturn ErrFileNotFound\n\t\t}\n\t\treturn err\n\t}\n\n\t// The file exists -- update it.\n\toptions.SHA = file.SHA\n\t_, _, err = c.client.Repositories.UpdateFile(\n\t\tctx,\n\t\topts.RepoOwner,\n\t\topts.RepoName,\n\t\tpath,\n\t\toptions,\n\t)\n\treturn err\n}", "title": "" }, { "docid": "9c417a83ae8bb5c266ec4adb4cda9c9d", "score": "0.5384892", "text": "func DeleteFilePost(ctx *context.Context) {\n\tform := web.GetForm(ctx).(*forms.DeleteRepoFileForm)\n\tcanCommit := renderCommitRights(ctx)\n\tbranchName := ctx.Repo.BranchName\n\tif form.CommitChoice == frmCommitChoiceNewBranch {\n\t\tbranchName = form.NewBranchName\n\t}\n\n\tctx.Data[\"PageIsDelete\"] = true\n\tctx.Data[\"BranchLink\"] = ctx.Repo.RepoLink + \"/src/\" + ctx.Repo.BranchNameSubURL()\n\tctx.Data[\"TreePath\"] = ctx.Repo.TreePath\n\tctx.Data[\"commit_summary\"] = form.CommitSummary\n\tctx.Data[\"commit_message\"] = form.CommitMessage\n\tctx.Data[\"commit_choice\"] = form.CommitChoice\n\tctx.Data[\"new_branch_name\"] = form.NewBranchName\n\tctx.Data[\"last_commit\"] = ctx.Repo.CommitID\n\n\tif ctx.HasError() {\n\t\tctx.HTML(http.StatusOK, tplDeleteFile)\n\t\treturn\n\t}\n\n\tif branchName == ctx.Repo.BranchName && !canCommit {\n\t\tctx.Data[\"Err_NewBranchName\"] = true\n\t\tctx.Data[\"commit_choice\"] = frmCommitChoiceNewBranch\n\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.cannot_commit_to_protected_branch\", branchName), tplDeleteFile, &form)\n\t\treturn\n\t}\n\n\tmessage := strings.TrimSpace(form.CommitSummary)\n\tif len(message) == 0 {\n\t\tmessage = ctx.Tr(\"repo.editor.delete\", ctx.Repo.TreePath)\n\t}\n\tform.CommitMessage = strings.TrimSpace(form.CommitMessage)\n\tif len(form.CommitMessage) > 0 {\n\t\tmessage += \"\\n\\n\" + form.CommitMessage\n\t}\n\n\tif _, err := files_service.ChangeRepoFiles(ctx, ctx.Repo.Repository, ctx.Doer, &files_service.ChangeRepoFilesOptions{\n\t\tLastCommitID: form.LastCommit,\n\t\tOldBranch: ctx.Repo.BranchName,\n\t\tNewBranch: branchName,\n\t\tFiles: []*files_service.ChangeRepoFile{\n\t\t\t{\n\t\t\t\tOperation: \"delete\",\n\t\t\t\tTreePath: ctx.Repo.TreePath,\n\t\t\t},\n\t\t},\n\t\tMessage: message,\n\t\tSignoff: form.Signoff,\n\t}); err != nil {\n\t\t// This is where we handle all the errors thrown by repofiles.DeleteRepoFile\n\t\tif git.IsErrNotExist(err) || models.IsErrRepoFileDoesNotExist(err) {\n\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.file_deleting_no_longer_exists\", ctx.Repo.TreePath), tplDeleteFile, &form)\n\t\t} else if models.IsErrFilenameInvalid(err) {\n\t\t\tctx.Data[\"Err_TreePath\"] = true\n\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.filename_is_invalid\", ctx.Repo.TreePath), tplDeleteFile, &form)\n\t\t} else if models.IsErrFilePathInvalid(err) {\n\t\t\tctx.Data[\"Err_TreePath\"] = true\n\t\t\tif fileErr, ok := err.(models.ErrFilePathInvalid); ok {\n\t\t\t\tswitch fileErr.Type {\n\t\t\t\tcase git.EntryModeSymlink:\n\t\t\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.file_is_a_symlink\", fileErr.Path), tplDeleteFile, &form)\n\t\t\t\tcase git.EntryModeTree:\n\t\t\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.filename_is_a_directory\", fileErr.Path), tplDeleteFile, &form)\n\t\t\t\tcase git.EntryModeBlob:\n\t\t\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.directory_is_a_file\", fileErr.Path), tplDeleteFile, &form)\n\t\t\t\tdefault:\n\t\t\t\t\tctx.ServerError(\"DeleteRepoFile\", err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tctx.ServerError(\"DeleteRepoFile\", err)\n\t\t\t}\n\t\t} else if git.IsErrBranchNotExist(err) {\n\t\t\t// For when a user deletes a file to a branch that no longer exists\n\t\t\tif branchErr, ok := err.(git.ErrBranchNotExist); ok {\n\t\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.branch_does_not_exist\", branchErr.Name), tplDeleteFile, &form)\n\t\t\t} else {\n\t\t\t\tctx.Error(http.StatusInternalServerError, err.Error())\n\t\t\t}\n\t\t} else if git_model.IsErrBranchAlreadyExists(err) {\n\t\t\t// For when a user specifies a new branch that already exists\n\t\t\tif branchErr, ok := err.(git_model.ErrBranchAlreadyExists); ok {\n\t\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.branch_already_exists\", branchErr.BranchName), tplDeleteFile, &form)\n\t\t\t} else {\n\t\t\t\tctx.Error(http.StatusInternalServerError, err.Error())\n\t\t\t}\n\t\t} else if models.IsErrCommitIDDoesNotMatch(err) || git.IsErrPushOutOfDate(err) {\n\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.file_changed_while_deleting\", ctx.Repo.RepoLink+\"/compare/\"+util.PathEscapeSegments(form.LastCommit)+\"...\"+util.PathEscapeSegments(ctx.Repo.CommitID)), tplDeleteFile, &form)\n\t\t} else if git.IsErrPushRejected(err) {\n\t\t\terrPushRej := err.(*git.ErrPushRejected)\n\t\t\tif len(errPushRej.Message) == 0 {\n\t\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.push_rejected_no_message\"), tplDeleteFile, &form)\n\t\t\t} else {\n\t\t\t\tflashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{\n\t\t\t\t\t\"Message\": ctx.Tr(\"repo.editor.push_rejected\"),\n\t\t\t\t\t\"Summary\": ctx.Tr(\"repo.editor.push_rejected_summary\"),\n\t\t\t\t\t\"Details\": utils.SanitizeFlashErrorString(errPushRej.Message),\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\tctx.ServerError(\"DeleteFilePost.HTMLString\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tctx.RenderWithErr(flashError, tplDeleteFile, &form)\n\t\t\t}\n\t\t} else {\n\t\t\tctx.ServerError(\"DeleteRepoFile\", err)\n\t\t}\n\t}\n\n\tctx.Flash.Success(ctx.Tr(\"repo.editor.file_delete_success\", ctx.Repo.TreePath))\n\ttreePath := path.Dir(ctx.Repo.TreePath)\n\tif treePath == \".\" {\n\t\ttreePath = \"\" // the file deleted was in the root, so we return the user to the root directory\n\t}\n\tif len(treePath) > 0 {\n\t\t// Need to get the latest commit since it changed\n\t\tcommit, err := ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.BranchName)\n\t\tif err == nil && commit != nil {\n\t\t\t// We have the comment, now find what directory we can return the user to\n\t\t\t// (must have entries)\n\t\t\ttreePath = GetClosestParentWithFiles(treePath, commit)\n\t\t} else {\n\t\t\ttreePath = \"\" // otherwise return them to the root of the repo\n\t\t}\n\t}\n\n\tredirectForCommitChoice(ctx, form.CommitChoice, branchName, treePath)\n}", "title": "" }, { "docid": "2dbecf83cccfad7fd3f651082d994ba2", "score": "0.5367277", "text": "func main() {\n\tcwd, _ := os.Getwd()\n\tprettyPath, _ := prettifyPath(cwd, 60)\n\tbranch := gitCurrentBranch()\n\n\t// pick a color for the branch depending on status output\n\tbranchColor := COLOR_GREEN\n\tstatuses := gitCurrentStatus()\n\tif statuses != nil && len(statuses) > 0 {\n\t\thasUntracked := false\n\t\thasModified := false\n\n\t\tfor _, status := range statuses {\n\t\t\t// true if we have untracked or added files\n\t\t\thasUntracked = hasUntracked || strings.ContainsAny(status, \"A?\")\n\n\t\t\t// true if we have modified, renamed, deleted, or unstaged files\n\t\t\thasModified = hasModified || strings.ContainsAny(status, \"MRDU\")\n\t\t}\n\n\t\tif hasUntracked && !hasModified {\n\t\t\tbranchColor = COLOR_YELLOW\n\t\t} else if hasModified {\n\t\t\tbranchColor = COLOR_RED\n\t\t}\n\t}\n\n\tfmt.Printf(\"┌╼ %s %s %s %s\\n└╼ \\n\",\n\t\tcolored(currentTime(), COLOR_MAGENTA),\n\t\tuserAndHost(),\n\t\tcolored(prettyPath, COLOR_BLUE),\n\t\tcolored(branch, branchColor))\n}", "title": "" }, { "docid": "90ac84e1451bc54b4fbd2fd910719f24", "score": "0.5359808", "text": "func gitCheckoutMaster(dir string) {\n\tcmd := exec.Command(\"git\", \"checkout\", \"master\")\n\texecute(cmd, dir)\n\tfmt.Printf(\"Checking out master on %s...\\n\", dir)\n}", "title": "" }, { "docid": "3c1973b4301aaed0e4ddf1478a82822e", "score": "0.5347477", "text": "func GitCommand(ctx *commandclient.Context) {\n\targs := strings.Join(ctx.Args, \" \")\n\tmatches := GithubURLRegex.FindStringSubmatch(args)\n\tif len(matches) < 3 {\n\t\tmatches = GithubRegex.FindStringSubmatch(args)\n\t}\n\tif len(matches) < 3 {\n\t\t_, err := ctx.Session.ChannelMessageSend(ctx.Message.ChannelID, \"Please provide a valid github url or use username/reponame\")\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Errorln(\"couldn't send message\")\n\t\t}\n\t\treturn\n\t}\n\tusername := matches[1]\n\treponame := matches[2]\n\trepo, err := github.GetRepo(utils.Client, username, reponame)\n\tif err != nil {\n\t\tlog.WithError(err).Errorln(\"failed to fetch github data\")\n\t\t_, err := ctx.Session.ChannelMessageSend(ctx.Message.ChannelID, \"Error retrieving repo data: \"+err.Error())\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Errorln(\"couldn't send message\")\n\t\t}\n\t\treturn\n\t}\n\tembed := &discordgo.MessageEmbed{}\n\tcreateGithubEmbed(repo, embed)\n\tif _, err = ctx.Session.ChannelMessageSendEmbed(ctx.Message.ChannelID, embed); err != nil {\n\t\tlog.WithError(err).WithField(\"repo\", repo).Errorln(\"failed to send a git embed\")\n\t}\n}", "title": "" }, { "docid": "d99778ee9d2d8af77f0fcf75a6c594f1", "score": "0.53382814", "text": "func GitPull(path string) error {\n\terr := os.Chdir(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcmd := exec.Command(\"git\", \"pull\")\n\treturn waitForCommandIgnoreOutput(cmd)\n}", "title": "" }, { "docid": "e63ca0976c75d32a333b08929f3e477a", "score": "0.5333406", "text": "func Commit(action, filepath string, gitFilepaths []string) error {\n\t// NOTE: if an origin file was \"protected\" that had _never_ been\n\t// checked into source control, it will fail during the `git add`.\n\t// Adding a removed file that wasn't checked returns a 128 error in\n\t// git. To get around this, we add each file separately, and ignore\n\t// errors for git add\n\tfor _, filepath := range gitFilepaths {\n\t\texec.Command(\"git\", \"add\", filepath).Run()\n\t}\n\n\tcmd := exec.Command(\"git\", \"commit\", \"-m\", fmt.Sprintf(\"safe: %s %s\", action, TrimSuffix(filepath)))\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\tif err := cmd.Run(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eba6f9a44f9380a859cbec93c2dedbdf", "score": "0.5327654", "text": "func copyAndCheckout(pkgPath string, tag string, out chan fileOperationResult) {\n\ttmp, err := ioutil.TempDir(\"\", \"\")\n\tif err != nil {\n\t\tout <- fileOperationResult{path: tmp, err: fmt.Errorf(\"error creating temporary directory: %v\", err)}\n\t\treturn\n\t}\n\troot := gitRoot(pkgPath) //git initialization dir\n\n\tcmd := exec.Command(\"git\", \"clone\", \"--local\", root)\n\tcmd.Dir = tmp\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tout <- fileOperationResult{path: tmp, err: fmt.Errorf(\"error cloning into temporary folder: %v\", string(output))}\n\t\treturn\n\t}\n\n\t//Checking out to the required tag\n\tcmd = exec.Command(\"git\", \"checkout\", tag)\n\tcmd.Dir = filepath.Join(tmp, filepath.Base(root))\n\toutput, err = cmd.CombinedOutput()\n\tif err != nil {\n\t\tout <- fileOperationResult{path: tmp, err: fmt.Errorf(string(output))}\n\t\treturn\n\t}\n\n\tvar pathFromRoot string\n\tif pkgPath != root {\n\t\tpathFromRoot = pkgPath[len(root)+1:]\n\t}\n\tout <- fileOperationResult{path: filepath.Join(tmp, filepath.Base(root), pathFromRoot), err: nil}\n\n}", "title": "" }, { "docid": "0e716a43083d72d771ddaf3e7a2bc6e6", "score": "0.5317297", "text": "func (gr gitRepo) Update() error {\n\tvar err error\n\n\tif gr.r == nil {\n\t\tgr.r, err = g2g.OpenRepository(gr.absPath)\n\t\tif err != nil {\n\t\t\treturn g2gErrorToRepoError(err)\n\t\t}\n\t}\n\n\torigin, err := gr.r.LookupRemote(\"origin\")\n\tif err != nil {\n\t\treturn g2gErrorToRepoError(err)\n\t}\n\n\tif err = origin.Fetch([]string{}, nil, \"\"); err != nil {\n\t\treturn g2gErrorToRepoError(err)\n\t}\n\n\tref, err := gr.r.Head()\n\tif err != nil {\n\t\treturn g2gErrorToRepoError(err)\n\t}\n\n\tif !ref.IsBranch() {\n\t\treturn errors.New(\"repository reference is not a branch (likely in a detached HEAD state)\")\n\t}\n\n\tremoteRef, err := ref.Branch().Upstream()\n\tif err != nil {\n\t\treturn g2gErrorToRepoError(err)\n\t}\n\tif _, err = ref.SetTarget(remoteRef.Target(), nil, \"pull: Fast-forward\"); err != nil {\n\t\treturn g2gErrorToRepoError(err)\n\t}\n\n\tvar checkoutOpts g2g.CheckoutOpts\n\tcheckoutOpts.Strategy = g2g.CheckoutForce\n\n\tif err = gr.r.CheckoutHead(&checkoutOpts); err != nil {\n\t\treturn g2gErrorToRepoError(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "333486c2fc1f01aca79de488a4f6d9a6", "score": "0.5311912", "text": "func (r *Repo) Checkout(ref string) (err error) {\n\tcmd, _, _ := r.Git(\"checkout\", \"-q\", ref)\n\terr = cmd.Run()\n\treturn\n}", "title": "" }, { "docid": "6ebcaa058069fae1961f1cef5d8106b6", "score": "0.52998847", "text": "func (c Command) CommitFile(file, msg string) error {\n\tcmd := []string{\"git\", \"commit\", file, \"-m\", msg}\n\n\tif c.Noop {\n\t\tc.l.Debugw(\"noop mode - command not run\", \"cmd\", strings.Join(cmd, \" \"))\n\t\treturn nil\n\t}\n\n\t_, err := c.Run(cmd[1:]...)\n\n\treturn err\n}", "title": "" }, { "docid": "d04fbc5d2aee1518f1740734657e464e", "score": "0.5294131", "text": "func main() {\n\tdir, err := os.Getwd()\n\tCheckIfError(err)\n\n\trepo, err := git.PlainOpen(dir)\n\tCheckIfError(err)\n\n\trevision := \"origin/master\"\n\n\t// Resolve revision into a sha1 commit, only some revisions are resolved\n\t// look at the doc to get more details\n\tInfo(\"git rev-parse %s\", revision)\n\n\trevHash, err := repo.ResolveRevision(plumbing.Revision(revision))\n\tCheckIfError(err)\n\trevCommit, err := repo.CommitObject(*revHash)\n\n\tCheckIfError(err)\n\n\theadRef, err := repo.Head()\n\tCheckIfError(err)\n\t// ... retrieving the commit object\n\theadCommit, err := repo.CommitObject(headRef.Hash())\n\tCheckIfError(err)\n\n\tisAncestor, err := headCommit.IsAncestor(revCommit)\n\n\tCheckIfError(err)\n\n\tfmt.Printf(\"Is the HEAD an IsAncestor of origin/master? : %v\\n\", isAncestor)\n}", "title": "" }, { "docid": "555c4ca816cc1272921b1e8512f47486", "score": "0.5285037", "text": "func (g *githubHelper) pushCommit(ctx context.Context, ref *github.Reference, cmd *WriteValueRequest) (err error) {\n\t// Create a tree with what to commit.\n\tentries := []*github.TreeEntry{\n\t\t{\n\t\t\tPath: github.String(cmd.Path),\n\t\t\tType: github.String(\"blob\"),\n\t\t\tContent: github.String(string(cmd.Body)),\n\t\t\tMode: github.String(\"100644\"),\n\t\t},\n\t}\n\n\ttree, _, err := g.client.Git.CreateTree(ctx, g.repoOwner, g.repoName, *ref.Object.SHA, entries)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Get the parent commit to attach the commit to.\n\tparent, _, err := g.client.Repositories.GetCommit(ctx, g.repoOwner, g.repoName, *ref.Object.SHA, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// This is not always populated, but is needed.\n\tparent.Commit.SHA = parent.SHA\n\n\tuser := cmd.User\n\tname := firstRealString(user.Name, user.Login, user.Email, \"?\")\n\temail := firstRealString(user.Email, user.Login, user.Name, \"?\")\n\n\t// Create the commit using the tree.\n\tdate := time.Now()\n\tauthor := &github.CommitAuthor{\n\t\tDate: &date,\n\t\tName: &name,\n\t\tEmail: &email,\n\t}\n\tcommit := &github.Commit{Author: author, Message: &cmd.Message, Tree: tree, Parents: []*github.Commit{parent.Commit}}\n\tnewCommit, _, err := g.client.Git.CreateCommit(ctx, g.repoOwner, g.repoName, commit)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Attach the commit to the main branch.\n\tref.Object.SHA = newCommit.SHA\n\t_, _, err = g.client.Git.UpdateRef(ctx, g.repoOwner, g.repoName, ref, false)\n\treturn err\n}", "title": "" }, { "docid": "2c721dac2c579d9e657a3b0334d2c7fd", "score": "0.5279534", "text": "func Push() {\n\tgit(\"push --all github\")\n}", "title": "" }, { "docid": "6493dc5f86ba936cf0f43015cabb806f", "score": "0.52726495", "text": "func (m *MonoRepo) Sync(branch string, useForce bool) {\n\tforceFlag := \"\"\n\tif useForce {\n\t\tforceFlag = \"-f\"\n\t}\n\n\t// Disable force pushing if branch is a protected branch\n\tif m.isProtectedBranches(branch) {\n\t\tforceFlag = \"\"\n\t}\n\n\tfor _, p := range m.Projects {\n\t\tsplitBranch := fmt.Sprintf(\"%s-%s\", p.Name, branch)\n\n\t\t// Split project\n\t\tfmt.Printf(\"> split project %s in branch %s\\n\", p.Name, splitBranch)\n\t\tm.SplitProject(p, splitBranch)\n\n\t\t// Add project remote with its' git-url\n\t\tfmt.Printf(\"> add remote %s\\n\", p.Name)\n\t\taddRemoteCmd := newCommand(\n\t\t\tfmt.Sprintf(\"git remote add %s %s\", p.Name, p.GitUrl),\n\t\t\tcmd.WithStandardStreams)\n\t\texec(addRemoteCmd)\n\n\t\t// Push project from the split branch to the configured branch\n\t\tfmt.Printf(\"> push project %s\\n\", p.Name)\n\t\tpushCmd := newCommand(\n\t\t\tfmt.Sprintf(\"git push %s %s %s:%s\", forceFlag, p.Name, splitBranch, branch),\n\t\t\tcmd.WithStandardStreams)\n\t\texec(pushCmd)\n\n\t\t// Remove created project remote\n\t\tfmt.Printf(\"> remove remote %s\\n\", p.Name)\n\t\tdelCmd := newCommand(fmt.Sprintf(\"git remote rm %s\", p.Name), cmd.WithStandardStreams)\n\t\texec(delCmd)\n\n\t\t// Remove split branch\n\t\tfmt.Printf(\"> remove branch %s\\n\", splitBranch)\n\t\tdelBranchCmd := newCommand(fmt.Sprintf(\"git branch -D %s\", splitBranch), cmd.WithStandardStreams)\n\t\texec(delBranchCmd)\n\n\t\t// Print empty line\n\t\tfmt.Println()\n\t}\n}", "title": "" }, { "docid": "3d349d85bd78e896940ee0b6dc4837d3", "score": "0.5261035", "text": "func PushMirror(remote string, mirror string, local string, remoteUsername string, remoteToken string, log *zerolog.Logger) error {\n\t// create the mirror path mirror\n\tremoteHost, remotePath, err := utility.UrlHostAndPath(remote)\n\tif err != nil {\n\t\tlog.Fatal().Err(err)\n\t}\n\tremoteUrl, err := url.Parse(remote)\n\tif err != nil {\n\t\treturn err\n\t}\n\tremoteUrl.User = url.UserPassword(remoteUsername, remoteToken)\n\tmirrorDir := path.Join(mirror, remoteHost, remotePath)\n\t// Check the status of the local repo before trying to push\n\tlog.Info().Msgf(\"Checking status of local repo: %s\", local)\n\tresult, _ := utility.Run([]string{\"git\", \"-C\", local, \"status\", \"--short\"})\n\tif err != nil {\n\t\tlog.Fatal().Err(err)\n\t}\n\t// git status --short stdout will be empty if the repo is clean\n\tif result.StdOut != \"\" {\n\t\tmsg := fmt.Sprintf(\"Unable to push dirty repo: %s\", local)\n\t\terr := errors.New(msg)\n\t\tlog.Fatal().Err(err)\n\t}\n\t// Get the current branch name so we can push it\n\tlog.Info().Msgf(\"Get current branch of local repo: %s\", local)\n\tresult, _ = utility.Run([]string{\"git\", \"-C\", local, \"branch\", \"--show-current\"})\n\tbranch := strings.TrimSuffix(result.StdOut, \"\\n\")\n\tlog.Debug().Msgf(\"Got current branch of local repo (%s): %s\", local, branch)\n\n\t//Push the current local branch to the mirror\n\tlog.Info().Msgf(\"Pushing local repo(%s) to mirror(%s)\", local, mirrorDir)\n\tresult, _ = utility.Run([]string{\"git\", \"-C\", local, \"push\", \"--set-upstream\", \"origin\", branch})\n\tif result.ReturnCode != 0 {\n\t\tmsg := fmt.Sprintf(\"Unable to local repo (%s) to mirror (%s)\", local, mirrorDir)\n\t\terr = errors.New(msg)\n\t\tlog.Fatal().Err(err)\n\t}\n\t// Push the mirro to the remote\n\tlog.Info().Msgf(\"Pushing mirror(%s) to remote(%s)\", mirrorDir, remote)\n\tresult, _ = utility.Run([]string{\"git\", \"-C\", mirrorDir, \"push\"})\n\tif result.ReturnCode != 0 {\n\t\tmsg := fmt.Sprintf(\"Unable to push mirror (%s) to remote (%s)\", mirrorDir, remote)\n\t\terr = errors.New(msg)\n\t\tlog.Fatal().Err(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "af5a947bf8381ae1a349f1c151d0453b", "score": "0.5253752", "text": "func createTestRepo(m *rbeconfigsgen.Manifest, configTarballURL, srcDir, outputDir, rbeInst string) error {\n\t// For convenience only when locally running this test.\n\tlog.Printf(\"DELETING the contents of output directory %q but ignoring any errors.\", outputDir)\n\tos.RemoveAll(outputDir)\n\tif err := os.MkdirAll(outputDir, os.ModePerm); err != nil {\n\t\treturn fmt.Errorf(\"unable to create output directory %q: %v\", outputDir, err)\n\t}\n\n\tlog.Printf(\"Copying C++ & Java Hello World source files from examples to the specified output directory.\")\n\tfor _, f := range filesToCopy {\n\t\tif err := copyFile(path.Join(outputDir, f), path.Join(srcDir, f)); err != nil {\n\t\t\treturn fmt.Errorf(\"error copying %q from %q to %q: %v\", f, srcDir, outputDir, err)\n\t\t}\n\t\tlog.Printf(\"Copied %q from %q to %q.\", f, srcDir, outputDir)\n\t}\n\tif err := createWorkspaceFile(m, configTarballURL, outputDir); err != nil {\n\t\treturn fmt.Errorf(\"error creating the Bazel WORKSPACE file: %w\", err)\n\t}\n\tif err := createBUILDFile(outputDir); err != nil {\n\t\treturn fmt.Errorf(\"error creating the Bazel BUILD file: %w\", err)\n\t}\n\tif err := createBazelrcFile(m, configTarballURL, outputDir, rbeInst); err != nil {\n\t\treturn fmt.Errorf(\"error creating the .bazelrc file: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "23e609294bc2df31948e041be47543f9", "score": "0.5247608", "text": "func (self *BranchCommands) New(name string, base string) error {\n\treturn self.cmd.New(fmt.Sprintf(\"git checkout -b %s %s\", self.cmd.Quote(name), self.cmd.Quote(base))).Run()\n}", "title": "" }, { "docid": "ff9a8ee3a58627af04e11fe7ed07a6d9", "score": "0.52440894", "text": "func Compare(a, b string) ([]*Patch, error) {\n\t// Create temporary working directory.\n\tdir, err := ioutil.TempDir(\"\", \"\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create temp dir: %v\", err)\n\t}\n\tcontentPath := path.Join(dir, \"content\")\n\n\t// Initialize git repository.\n\t_, err = execGit(dir, \"init\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_, err = execGit(dir, \"config\", \"user.email\", \"server@npmfs.com\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_, err = execGit(dir, \"config\", \"user.name\", \"server\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Initialize git repository.\n\t_, err = execGit(dir, \"init\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Move contents from \"a\" into repository.\n\terr = os.Rename(a, contentPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"copy contents: %v\", err)\n\t}\n\n\t// Commit version \"a\" to the repository.\n\t_, err = execGit(dir, \"add\", \".\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_, err = execGit(dir, \"commit\", \"--allow-empty\", \"-m\", a)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Return contents from \"a\" to original path.\n\terr = os.Rename(contentPath, a)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"copy contents: %v\", err)\n\t}\n\n\t// Move contents from \"b\" into repository.\n\terr = os.Rename(b, contentPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"copy contents: %v\", err)\n\t}\n\n\t// Commit version \"b\" to the repository.\n\t_, err = execGit(dir, \"add\", \".\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_, err = execGit(dir, \"commit\", \"--allow-empty\", \"-m\", b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Compute diff between contents.\n\tout, err := execGit(dir, \"diff-tree\", \"--patch\", \"-r\", \"--find-renames\", \"--ignore-all-space\", \"HEAD~\", \"HEAD\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"compute diff: %v\", err)\n\t}\n\n\t// Return contents from \"b\" to original path.\n\terr = os.Rename(contentPath, b)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"copy contents: %v\", err)\n\t}\n\n\t// Clean up temporary directory.\n\t_ = os.RemoveAll(dir)\n\n\t// Parse output text.\n\tpatches, err := patchParse(out)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parse output: %v\", err)\n\t}\n\n\treturn patches, nil\n}", "title": "" }, { "docid": "377a677fe9890200ac8d1e2b81393d01", "score": "0.52437246", "text": "func (e *executor) pushChangesetPatch(ctx context.Context) (err error) {\n\texistingSameBranch, err := e.tx.GetChangeset(ctx, store.GetChangesetOpts{\n\t\tExternalServiceType: e.ch.ExternalServiceType,\n\t\tRepoID: e.ch.RepoID,\n\t\tExternalBranch: e.spec.Spec.HeadRef,\n\t\t// TODO: Do we need to check whether it's published or not?\n\t})\n\tif err != nil && err != store.ErrNoResults {\n\t\treturn err\n\t}\n\n\tif existingSameBranch != nil && existingSameBranch.ID != e.ch.ID {\n\t\treturn errPublishSameBranch{}\n\t}\n\n\t// Create a commit and push it\n\t// Figure out which authenticator we should use to modify the changeset.\n\t// au is nil if we want to use the global credentials stored in the external\n\t// service configuration.\n\tpushConf, err := e.css.GitserverPushConfig(ctx, e.tx.ExternalServices(), e.repo)\n\tif err != nil {\n\t\treturn err\n\t}\n\topts, err := buildCommitOpts(e.repo, e.spec, pushConf)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn e.pushCommit(ctx, opts)\n}", "title": "" }, { "docid": "b9a93954bc33cd0d62ab067ba5404cfa", "score": "0.52431774", "text": "func TestPrefixPatchApply(t *testing.T) {\n\tdir, cleanup := testutil.TempDir(t, \"\", \"\")\n\tif *nocleanup {\n\t\tlog.Println(\"directory\", dir)\n\t} else {\n\t\tdefer cleanup()\n\t}\n\tshell(t, dir, `\n\t\tmkdir repos\n\n\t\t# Set up source repository and add a couple of commits:\n\t\t# - add a file file1\n\t\t# - add a file dir2/file2\n\t\tgit init --bare repos/src\n\t\tgit clone repos/src src\n\t\tcd src\n\t\tgit config user.email you@example.com\n\t\tgit config user.name \"your name\"\n\t\techo \"test file 1\" > file1\n\t\tgit add file1\n\t\tgit commit -m'first commit'\n\t\tmkdir dir2\n\t\techo \"test file 2\" > dir2/file2\n\t\tgit add dir2\n\t\tgit commit -m'second commit'\n\t\tgit push\n\n\t\tcd ..\n\n\t\t# Set up second, empty repository. Note that grit cannot\n\t\t# initialize empty repositories, so we add a first commit.\n\t\tgit init --bare repos/dst\n\t\tgit clone repos/dst dst\n\t\tcd dst\n\t\tgit config user.email you@example.com\n\t\tgit config user.name \"your name\"\n\t\tmkdir pfx\n\t\ttouch pfx/.gitignore\n\t\tgit add .\n\t\tgit commit -m'first commit'\n\t\tgit push\n\t`)\n\tsrc, err := Open(filepath.Join(dir, \"repos/src\"), \"\", \"master\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdst, err := Open(filepath.Join(dir, \"repos/dst\"), \"pfx/\", \"master\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Needs to be configured for committer.\n\tdst.Configure(\"user.email\", \"committer@grailbio.com\")\n\tdst.Configure(\"user.name\", \"committer\")\n\tcommits, err := src.Log()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif got, want := len(commits), 2; got != want {\n\t\tt.Fatalf(\"got %v, want %v\", got, want)\n\t}\n\tfor i := len(commits) - 1; i >= 0; i-- {\n\t\tpatch, err := src.Patch(commits[i].Digest, \"pfx/\")\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif len(patch.Diffs) == 0 {\n\t\t\tt.Fatal(\"empty patch\")\n\t\t}\n\t\tlog.Printf(\"path:%v\", patch.Diffs[0].Path)\n\t\tif err := dst.Apply(patch); err != nil {\n\t\t\tt.Fatalf(\"failed to apply patch: %v\\n%s\", err, patch.Patch())\n\t\t}\n\t}\n\tif err := dst.Push(\"origin\", \"master\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Make sure the file is actually there.\n\tshell(t, dir, `\n\t\tgit -C dst pull\n\t\tcmp src/file1 dst/pfx/file1 || error file1\n\t\tcmp src/dir2/file2 dst/pfx/dir2/file2 || error file2\n\t`)\n}", "title": "" }, { "docid": "01e99c394e04c0dd9fa3b7c52d65d856", "score": "0.5240382", "text": "func UpdateRepo(repoPath string, testData string) error {\n\t// Checkout a new branch for the current test run\n\tresult, err := Run([]string{\"git\", \"-C\", repoPath, \"checkout\", \"-b\", testData})\n\tif result.ReturnCode != 0 {\n\t\tlog.Fatal().Err(err).Msgf(\"Unable to checkout new branch in repo: %s\", repoPath)\n\t}\n\n\tval := testData\n\tdata := []byte(val)\n\n\terr = ioutil.WriteFile(path.Join(repoPath, testData), data, 0777)\n\tif err != nil {\n\t\tlog.Fatal().Err(err).Msgf(\"Failed to create file: %s\", path.Join(repoPath, testData))\n\t}\n\t// Add the new file to the repo\n\tresult, _ = Run([]string{\"git\", \"-C\", repoPath, \"add\", \"-A\"})\n\tif result.ReturnCode != 0 {\n\t\tlog.Fatal().Err(err).Msgf(\"Failed to add file(%s) to repo: %s\", path.Join(repoPath, testData), repoPath)\n\t}\n\t// Commit the repo change\n\tresult, _ = Run([]string{\"git\", \"-C\", repoPath, \"commit\", \"-am\", fmt.Sprintf(\"%s\", testData)})\n\tif result.ReturnCode != 0 {\n\t\tlog.Fatal().Err(err).Msgf(\"Failed commit repo: %s\", repoPath)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3359e8af9f8d6253dfdf3c306986411", "score": "0.5239558", "text": "func main() {\n\tCheckArgs(\"<path>\", \"<revision>\")\n\n\tpath := os.Args[1]\n\trevision := os.Args[2]\n\n\t// We instantiate a new repository targeting the given path (the .git folder)\n\tr, err := git.PlainOpen(path)\n\tCheckIfError(err)\n\n\t// Resolve revision into a sha1 commit, only some revisions are resolved\n\t// look at the doc to get more details\n\tInfo(\"git rev-parse %s\", revision)\n\n\th, err := r.ResolveRevision(plumbing.Revision(revision))\n\n\tCheckIfError(err)\n\n\tfmt.Println(h.String())\n}", "title": "" }, { "docid": "a588887d96e2f85ef735943bac5b0aa0", "score": "0.5238076", "text": "func main() {\n\tif len(os.Args) < 2 {\n\t\tprintUsage()\n\t}\n\tswitch action := os.Args[1]; action {\n\tcase \"create\":\n\t\tif len(os.Args) != 6 {\n\t\t\tfmt.Fprintf(os.Stderr, \"Usage: %s create owner repo title body\", os.Args[0])\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif ok, err := CreateIssue(os.Args[2], os.Args[3], os.Args[4], os.Args[5]); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"create issue failed: %s\", err)\n\t\t\tos.Exit(1)\n\t\t} else if !ok {\n\t\t\tfmt.Fprintf(os.Stderr, \"create issue failed: %s\", err)\n\t\t\tos.Exit(1)\n\t\t} else {\n\t\t\tfmt.Fprint(os.Stdout, \"issue created.\")\n\t\t}\n\tcase \"read\":\n\t\tif len(os.Args) != 5 {\n\t\t\tfmt.Fprintf(os.Stderr, \"Usage: %s read owner repo issue-number\", os.Args[0])\n\t\t\tos.Exit(1)\n\t\t}\n\t\tissue, err := ReadIssue(os.Args[2], os.Args[3], os.Args[4])\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"read issue failed: %s\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tfmt.Fprintf(os.Stdout, \"%#v\", issue)\n\tcase \"update\":\n\t\tif len(os.Args) != 7 {\n\t\t\tfmt.Fprintf(os.Stderr, \"Usage: %s update owner repo issue-number title body\", os.Args[0])\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif ok, err := UpdateIssue(os.Args[2], os.Args[3], os.Args[4], os.Args[5], os.Args[6]); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"update issue failed: %s\", err)\n\t\t\tos.Exit(1)\n\t\t} else if !ok {\n\t\t\tfmt.Fprintf(os.Stderr, \"update issue failed: %s\", err)\n\t\t\tos.Exit(1)\n\t\t} else {\n\t\t\tfmt.Fprint(os.Stdout, \"issue updated.\")\n\t\t}\n\t// exercise says \"delete\", but GitHub issue does not support delete.\n\t// Instead, close here.\n\tcase \"close\":\n\t\tif len(os.Args) != 5 {\n\t\t\tfmt.Fprintf(os.Stderr, \"Usage: %s close owner repo issue-number\", os.Args[0])\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif ok, err := CloseIssue(os.Args[2], os.Args[3], os.Args[4]); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"close issue failed: %s\", err)\n\t\t\tos.Exit(1)\n\t\t} else if !ok {\n\t\t\tfmt.Fprintf(os.Stderr, \"close issue failed: %s\", err)\n\t\t\tos.Exit(1)\n\t\t} else {\n\t\t\tfmt.Fprint(os.Stdout, \"issue closed.\")\n\t\t}\n\tdefault:\n\t\tfmt.Fprintf(os.Stderr, \"1st arguments should be selected from create/read/update/delete.\")\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "7095c27d5c5de09151a844205a14d90c", "score": "0.5231646", "text": "func prepareFork(branchName, upstreamOrg, upstreamRepo, myOrg, myRepo string) (repo *git.Repo, err error) {\n\t// checkout the upstream repository\n\tlogrus.Infof(\"cloning/updating repository %s/%s\", upstreamOrg, upstreamRepo)\n\n\trepo, err = git.CleanCloneGitHubRepo(\n\t\tupstreamOrg, upstreamRepo, false,\n\t)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"cloning %s/%s\", upstreamOrg, upstreamRepo)\n\t}\n\n\t// test if the fork remote is already existing\n\turl := git.GetRepoURL(myOrg, myRepo, false)\n\tif repo.HasRemote(userForkName, url) {\n\t\tlogrus.Infof(\n\t\t\t\"Using already existing remote %v (%v) in repository\",\n\t\t\tuserForkName, url,\n\t\t)\n\t} else {\n\t\t// add the user's fork as a remote\n\t\terr = repo.AddRemote(userForkName, myOrg, myRepo)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"adding user's fork as remote repository\")\n\t\t}\n\t}\n\n\t// checkout the new branch\n\terr = repo.Checkout(\"-B\", branchName)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"creating new branch %s\", branchName)\n\t}\n\n\treturn repo, nil\n}", "title": "" }, { "docid": "bbef4553e04042acd07085e7073e90bb", "score": "0.5227343", "text": "func checkoutRemoteBranch(ctx *sql.Context, dbName string, dbData env.DbData, branchName string, apr *argparser.ArgParseResults) error {\n\tremoteRefs, err := actions.GetRemoteBranchRef(ctx, dbData.Ddb, branchName)\n\tif err != nil {\n\t\treturn errors.New(\"fatal: unable to read from data repository\")\n\t}\n\n\tif len(remoteRefs) == 0 {\n\t\treturn fmt.Errorf(\"error: could not find %s\", branchName)\n\t} else if len(remoteRefs) == 1 {\n\t\tremoteRef := remoteRefs[0]\n\t\terr := actions.CreateBranchWithStartPt(ctx, dbData, branchName, remoteRef.String(), false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = checkoutBranch(ctx, dbName, branchName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\trefSpec, err := ref.ParseRefSpecForRemote(remoteRef.GetRemote(), remoteRef.GetBranch())\n\t\tif err != nil {\n\t\t\treturn errhand.BuildDError(fmt.Errorf(\"%w: '%s'\", err, remoteRef.GetRemote()).Error()).Build()\n\t\t}\n\n\t\treturn env.SetRemoteUpstreamForRefSpec(dbData.Rsw, refSpec, remoteRef.GetRemote(), dbData.Rsr.CWBHeadRef())\n\t} else {\n\t\treturn fmt.Errorf(\"'%s' matched multiple (%v) remote tracking branches\", branchName, len(remoteRefs))\n\t}\n}", "title": "" }, { "docid": "e9eb9879edd3814c36971fd5f3e3c0c1", "score": "0.5223427", "text": "func updateLocalCopyToCommit(repoPath, localPath, commit string) error {\n\tif !com.IsExist(localPath) {\n\t\tif err := git.Clone(repoPath, localPath, git.CloneRepoOptions{\n\t\t\tTimeout: time.Duration(setting.Git.Timeout.Clone) * time.Second,\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\"git clone: %v\", err)\n\t\t}\n\t} else {\n\t\t_, err := git.NewCommand(\"fetch\", \"origin\").RunInDir(localPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"git fetch origin: %v\", err)\n\t\t}\n\t\tif err := git.ResetHEAD(localPath, true, \"HEAD\"); err != nil {\n\t\t\treturn fmt.Errorf(\"git reset --hard HEAD: %v\", err)\n\t\t}\n\t}\n\tif err := git.Checkout(localPath, git.CheckoutOptions{\n\t\tBranch: commit,\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"git checkout %s: %v\", commit, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5d5c20dd5068e154b44adb0cf593aaa4", "score": "0.52228796", "text": "func rawMerge(pr *models.PullRequest, doer *models.User, mergeStyle models.MergeStyle, message string) (string, error) {\n\terr := git.LoadGitVersion()\n\tif err != nil {\n\t\tlog.Error(\"git.LoadGitVersion: %v\", err)\n\t\treturn \"\", fmt.Errorf(\"Unable to get git version: %v\", err)\n\t}\n\n\t// Clone base repo.\n\ttmpBasePath, err := createTemporaryRepo(pr)\n\tif err != nil {\n\t\tlog.Error(\"CreateTemporaryPath: %v\", err)\n\t\treturn \"\", err\n\t}\n\tdefer func() {\n\t\tif err := models.RemoveTemporaryPath(tmpBasePath); err != nil {\n\t\t\tlog.Error(\"Merge: RemoveTemporaryPath: %s\", err)\n\t\t}\n\t}()\n\n\tbaseBranch := \"base\"\n\ttrackingBranch := \"tracking\"\n\tstagingBranch := \"staging\"\n\n\tvar outbuf, errbuf strings.Builder\n\n\t// Enable sparse-checkout\n\tsparseCheckoutList, err := getDiffTree(tmpBasePath, baseBranch, trackingBranch)\n\tif err != nil {\n\t\tlog.Error(\"getDiffTree(%s, %s, %s): %v\", tmpBasePath, baseBranch, trackingBranch, err)\n\t\treturn \"\", fmt.Errorf(\"getDiffTree: %v\", err)\n\t}\n\n\tinfoPath := filepath.Join(tmpBasePath, \".git\", \"info\")\n\tif err := os.MkdirAll(infoPath, 0700); err != nil {\n\t\tlog.Error(\"Unable to create .git/info in %s: %v\", tmpBasePath, err)\n\t\treturn \"\", fmt.Errorf(\"Unable to create .git/info in tmpBasePath: %v\", err)\n\t}\n\n\tsparseCheckoutListPath := filepath.Join(infoPath, \"sparse-checkout\")\n\tif err := ioutil.WriteFile(sparseCheckoutListPath, []byte(sparseCheckoutList), 0600); err != nil {\n\t\tlog.Error(\"Unable to write .git/info/sparse-checkout file in %s: %v\", tmpBasePath, err)\n\t\treturn \"\", fmt.Errorf(\"Unable to write .git/info/sparse-checkout file in tmpBasePath: %v\", err)\n\t}\n\n\tvar gitConfigCommand func() *git.Command\n\tif git.CheckGitVersionConstraint(\">= 1.8.0\") == nil {\n\t\tgitConfigCommand = func() *git.Command {\n\t\t\treturn git.NewCommand(\"config\", \"--local\")\n\t\t}\n\t} else {\n\t\tgitConfigCommand = func() *git.Command {\n\t\t\treturn git.NewCommand(\"config\")\n\t\t}\n\t}\n\n\t// Switch off LFS process (set required, clean and smudge here also)\n\tif err := gitConfigCommand().AddArguments(\"filter.lfs.process\", \"\").RunInDirPipeline(tmpBasePath, &outbuf, &errbuf); err != nil {\n\t\tlog.Error(\"git config [filter.lfs.process -> <> ]: %v\\n%s\\n%s\", err, outbuf.String(), errbuf.String())\n\t\treturn \"\", fmt.Errorf(\"git config [filter.lfs.process -> <> ]: %v\\n%s\\n%s\", err, outbuf.String(), errbuf.String())\n\t}\n\toutbuf.Reset()\n\terrbuf.Reset()\n\n\tif err := gitConfigCommand().AddArguments(\"filter.lfs.required\", \"false\").RunInDirPipeline(tmpBasePath, &outbuf, &errbuf); err != nil {\n\t\tlog.Error(\"git config [filter.lfs.required -> <false> ]: %v\\n%s\\n%s\", err, outbuf.String(), errbuf.String())\n\t\treturn \"\", fmt.Errorf(\"git config [filter.lfs.required -> <false> ]: %v\\n%s\\n%s\", err, outbuf.String(), errbuf.String())\n\t}\n\toutbuf.Reset()\n\terrbuf.Reset()\n\n\tif err := gitConfigCommand().AddArguments(\"filter.lfs.clean\", \"\").RunInDirPipeline(tmpBasePath, &outbuf, &errbuf); err != nil {\n\t\tlog.Error(\"git config [filter.lfs.clean -> <> ]: %v\\n%s\\n%s\", err, outbuf.String(), errbuf.String())\n\t\treturn \"\", fmt.Errorf(\"git config [filter.lfs.clean -> <> ]: %v\\n%s\\n%s\", err, outbuf.String(), errbuf.String())\n\t}\n\toutbuf.Reset()\n\terrbuf.Reset()\n\n\tif err := gitConfigCommand().AddArguments(\"filter.lfs.smudge\", \"\").RunInDirPipeline(tmpBasePath, &outbuf, &errbuf); err != nil {\n\t\tlog.Error(\"git config [filter.lfs.smudge -> <> ]: %v\\n%s\\n%s\", err, outbuf.String(), errbuf.String())\n\t\treturn \"\", fmt.Errorf(\"git config [filter.lfs.smudge -> <> ]: %v\\n%s\\n%s\", err, outbuf.String(), errbuf.String())\n\t}\n\toutbuf.Reset()\n\terrbuf.Reset()\n\n\tif err := gitConfigCommand().AddArguments(\"core.sparseCheckout\", \"true\").RunInDirPipeline(tmpBasePath, &outbuf, &errbuf); err != nil {\n\t\tlog.Error(\"git config [core.sparseCheckout -> true ]: %v\\n%s\\n%s\", err, outbuf.String(), errbuf.String())\n\t\treturn \"\", fmt.Errorf(\"git config [core.sparsecheckout -> true]: %v\\n%s\\n%s\", err, outbuf.String(), errbuf.String())\n\t}\n\toutbuf.Reset()\n\terrbuf.Reset()\n\n\t// Read base branch index\n\tif err := git.NewCommand(\"read-tree\", \"HEAD\").RunInDirPipeline(tmpBasePath, &outbuf, &errbuf); err != nil {\n\t\tlog.Error(\"git read-tree HEAD: %v\\n%s\\n%s\", err, outbuf.String(), errbuf.String())\n\t\treturn \"\", fmt.Errorf(\"Unable to read base branch in to the index: %v\\n%s\\n%s\", err, outbuf.String(), errbuf.String())\n\t}\n\toutbuf.Reset()\n\terrbuf.Reset()\n\n\tsig := doer.NewGitSig()\n\tcommitter := sig\n\n\t// Determine if we should sign\n\tsignArg := \"\"\n\tif git.CheckGitVersionConstraint(\">= 1.7.9\") == nil {\n\t\tsign, keyID, signer, _ := pr.SignMerge(doer, tmpBasePath, \"HEAD\", trackingBranch)\n\t\tif sign {\n\t\t\tsignArg = \"-S\" + keyID\n\t\t\tif pr.BaseRepo.GetTrustModel() == models.CommitterTrustModel || pr.BaseRepo.GetTrustModel() == models.CollaboratorCommitterTrustModel {\n\t\t\t\tcommitter = signer\n\t\t\t}\n\t\t} else if git.CheckGitVersionConstraint(\">= 2.0.0\") == nil {\n\t\t\tsignArg = \"--no-gpg-sign\"\n\t\t}\n\t}\n\n\tcommitTimeStr := time.Now().Format(time.RFC3339)\n\n\t// Because this may call hooks we should pass in the environment\n\tenv := append(os.Environ(),\n\t\t\"GIT_AUTHOR_NAME=\"+sig.Name,\n\t\t\"GIT_AUTHOR_EMAIL=\"+sig.Email,\n\t\t\"GIT_AUTHOR_DATE=\"+commitTimeStr,\n\t\t\"GIT_COMMITTER_NAME=\"+committer.Name,\n\t\t\"GIT_COMMITTER_EMAIL=\"+committer.Email,\n\t\t\"GIT_COMMITTER_DATE=\"+commitTimeStr,\n\t)\n\n\t// Merge commits.\n\tswitch mergeStyle {\n\tcase models.MergeStyleMerge:\n\t\tcmd := git.NewCommand(\"merge\", \"--no-ff\", \"--no-commit\", trackingBranch)\n\t\tif err := runMergeCommand(pr, mergeStyle, cmd, tmpBasePath); err != nil {\n\t\t\tlog.Error(\"Unable to merge tracking into base: %v\", err)\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tif err := commitAndSignNoAuthor(pr, message, signArg, tmpBasePath, env); err != nil {\n\t\t\tlog.Error(\"Unable to make final commit: %v\", err)\n\t\t\treturn \"\", err\n\t\t}\n\tcase models.MergeStyleRebase:\n\t\tfallthrough\n\tcase models.MergeStyleRebaseMerge:\n\t\t// Checkout head branch\n\t\tif err := git.NewCommand(\"checkout\", \"-b\", stagingBranch, trackingBranch).RunInDirPipeline(tmpBasePath, &outbuf, &errbuf); err != nil {\n\t\t\tlog.Error(\"git checkout base prior to merge post staging rebase [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t\treturn \"\", fmt.Errorf(\"git checkout base prior to merge post staging rebase [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t}\n\t\toutbuf.Reset()\n\t\terrbuf.Reset()\n\n\t\t// Rebase before merging\n\t\tif err := git.NewCommand(\"rebase\", baseBranch).RunInDirPipeline(tmpBasePath, &outbuf, &errbuf); err != nil {\n\t\t\t// Rebase will leave a REBASE_HEAD file in .git if there is a conflict\n\t\t\tif _, statErr := os.Stat(filepath.Join(tmpBasePath, \".git\", \"REBASE_HEAD\")); statErr == nil {\n\t\t\t\tvar commitSha string\n\t\t\t\tok := false\n\t\t\t\tfailingCommitPaths := []string{\n\t\t\t\t\tfilepath.Join(tmpBasePath, \".git\", \"rebase-apply\", \"original-commit\"), // Git < 2.26\n\t\t\t\t\tfilepath.Join(tmpBasePath, \".git\", \"rebase-merge\", \"stopped-sha\"), // Git >= 2.26\n\t\t\t\t}\n\t\t\t\tfor _, failingCommitPath := range failingCommitPaths {\n\t\t\t\t\tif _, statErr := os.Stat(filepath.Join(failingCommitPath)); statErr == nil {\n\t\t\t\t\t\tcommitShaBytes, readErr := ioutil.ReadFile(filepath.Join(failingCommitPath))\n\t\t\t\t\t\tif readErr != nil {\n\t\t\t\t\t\t\t// Abandon this attempt to handle the error\n\t\t\t\t\t\t\tlog.Error(\"git rebase staging on to base [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t\t\t\t\t\treturn \"\", fmt.Errorf(\"git rebase staging on to base [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcommitSha = strings.TrimSpace(string(commitShaBytes))\n\t\t\t\t\t\tok = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Error(\"Unable to determine failing commit sha for this rebase message. Cannot cast as models.ErrRebaseConflicts.\")\n\t\t\t\t\tlog.Error(\"git rebase staging on to base [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t\t\t\treturn \"\", fmt.Errorf(\"git rebase staging on to base [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t\t\t}\n\t\t\t\tlog.Debug(\"RebaseConflict at %s [%s:%s -> %s:%s]: %v\\n%s\\n%s\", commitSha, pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t\t\treturn \"\", models.ErrRebaseConflicts{\n\t\t\t\t\tStyle: mergeStyle,\n\t\t\t\t\tCommitSHA: commitSha,\n\t\t\t\t\tStdOut: outbuf.String(),\n\t\t\t\t\tStdErr: errbuf.String(),\n\t\t\t\t\tErr: err,\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog.Error(\"git rebase staging on to base [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t\treturn \"\", fmt.Errorf(\"git rebase staging on to base [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t}\n\t\toutbuf.Reset()\n\t\terrbuf.Reset()\n\n\t\t// Checkout base branch again\n\t\tif err := git.NewCommand(\"checkout\", baseBranch).RunInDirPipeline(tmpBasePath, &outbuf, &errbuf); err != nil {\n\t\t\tlog.Error(\"git checkout base prior to merge post staging rebase [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t\treturn \"\", fmt.Errorf(\"git checkout base prior to merge post staging rebase [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t}\n\t\toutbuf.Reset()\n\t\terrbuf.Reset()\n\n\t\tcmd := git.NewCommand(\"merge\")\n\t\tif mergeStyle == models.MergeStyleRebase {\n\t\t\tcmd.AddArguments(\"--ff-only\")\n\t\t} else {\n\t\t\tcmd.AddArguments(\"--no-ff\", \"--no-commit\")\n\t\t}\n\t\tcmd.AddArguments(stagingBranch)\n\n\t\t// Prepare merge with commit\n\t\tif err := runMergeCommand(pr, mergeStyle, cmd, tmpBasePath); err != nil {\n\t\t\tlog.Error(\"Unable to merge staging into base: %v\", err)\n\t\t\treturn \"\", err\n\t\t}\n\t\tif mergeStyle == models.MergeStyleRebaseMerge {\n\t\t\tif err := commitAndSignNoAuthor(pr, message, signArg, tmpBasePath, env); err != nil {\n\t\t\t\tlog.Error(\"Unable to make final commit: %v\", err)\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\tcase models.MergeStyleSquash:\n\t\t// Merge with squash\n\t\tcmd := git.NewCommand(\"merge\", \"--squash\", trackingBranch)\n\t\tif err := runMergeCommand(pr, mergeStyle, cmd, tmpBasePath); err != nil {\n\t\t\tlog.Error(\"Unable to merge --squash tracking into base: %v\", err)\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tif err = pr.Issue.LoadPoster(); err != nil {\n\t\t\tlog.Error(\"LoadPoster: %v\", err)\n\t\t\treturn \"\", fmt.Errorf(\"LoadPoster: %v\", err)\n\t\t}\n\t\tsig := pr.Issue.Poster.NewGitSig()\n\t\tif signArg == \"\" {\n\t\t\tif err := git.NewCommand(\"commit\", fmt.Sprintf(\"--author='%s <%s>'\", sig.Name, sig.Email), \"-m\", message).RunInDirTimeoutEnvPipeline(env, -1, tmpBasePath, &outbuf, &errbuf); err != nil {\n\t\t\t\tlog.Error(\"git commit [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t\t\treturn \"\", fmt.Errorf(\"git commit [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t\t}\n\t\t} else {\n\t\t\tif committer != sig {\n\t\t\t\t// add trailer\n\t\t\t\tmessage += fmt.Sprintf(\"\\nCo-Authored-By: %s\\nCo-Committed-By: %s\\n\", sig.String(), sig.String())\n\t\t\t}\n\t\t\tif err := git.NewCommand(\"commit\", signArg, fmt.Sprintf(\"--author='%s <%s>'\", sig.Name, sig.Email), \"-m\", message).RunInDirTimeoutEnvPipeline(env, -1, tmpBasePath, &outbuf, &errbuf); err != nil {\n\t\t\t\tlog.Error(\"git commit [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t\t\treturn \"\", fmt.Errorf(\"git commit [%s:%s -> %s:%s]: %v\\n%s\\n%s\", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())\n\t\t\t}\n\t\t}\n\t\toutbuf.Reset()\n\t\terrbuf.Reset()\n\tdefault:\n\t\treturn \"\", models.ErrInvalidMergeStyle{ID: pr.BaseRepo.ID, Style: mergeStyle}\n\t}\n\n\t// OK we should cache our current head and origin/headbranch\n\tmergeHeadSHA, err := git.GetFullCommitID(tmpBasePath, \"HEAD\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed to get full commit id for HEAD: %v\", err)\n\t}\n\tmergeBaseSHA, err := git.GetFullCommitID(tmpBasePath, \"original_\"+baseBranch)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed to get full commit id for origin/%s: %v\", pr.BaseBranch, err)\n\t}\n\tmergeCommitID, err := git.GetFullCommitID(tmpBasePath, baseBranch)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed to get full commit id for the new merge: %v\", err)\n\t}\n\n\t// Now it's questionable about where this should go - either after or before the push\n\t// I think in the interests of data safety - failures to push to the lfs should prevent\n\t// the merge as you can always remerge.\n\tif setting.LFS.StartServer {\n\t\tif err := LFSPush(tmpBasePath, mergeHeadSHA, mergeBaseSHA, pr); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\tvar headUser *models.User\n\terr = pr.HeadRepo.GetOwner()\n\tif err != nil {\n\t\tif !models.IsErrUserNotExist(err) {\n\t\t\tlog.Error(\"Can't find user: %d for head repository - %v\", pr.HeadRepo.OwnerID, err)\n\t\t\treturn \"\", err\n\t\t}\n\t\tlog.Error(\"Can't find user: %d for head repository - defaulting to doer: %s - %v\", pr.HeadRepo.OwnerID, doer.Name, err)\n\t\theadUser = doer\n\t} else {\n\t\theadUser = pr.HeadRepo.Owner\n\t}\n\n\tenv = models.FullPushingEnvironment(\n\t\theadUser,\n\t\tdoer,\n\t\tpr.BaseRepo,\n\t\tpr.BaseRepo.Name,\n\t\tpr.ID,\n\t)\n\n\t// Push back to upstream.\n\tif err := git.NewCommand(\"push\", \"origin\", baseBranch+\":\"+pr.BaseBranch).RunInDirTimeoutEnvPipeline(env, -1, tmpBasePath, &outbuf, &errbuf); err != nil {\n\t\tif strings.Contains(errbuf.String(), \"non-fast-forward\") {\n\t\t\treturn \"\", &git.ErrPushOutOfDate{\n\t\t\t\tStdOut: outbuf.String(),\n\t\t\t\tStdErr: errbuf.String(),\n\t\t\t\tErr: err,\n\t\t\t}\n\t\t} else if strings.Contains(errbuf.String(), \"! [remote rejected]\") {\n\t\t\terr := &git.ErrPushRejected{\n\t\t\t\tStdOut: outbuf.String(),\n\t\t\t\tStdErr: errbuf.String(),\n\t\t\t\tErr: err,\n\t\t\t}\n\t\t\terr.GenerateMessage()\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"git push: %s\", errbuf.String())\n\t}\n\toutbuf.Reset()\n\terrbuf.Reset()\n\n\treturn mergeCommitID, nil\n}", "title": "" }, { "docid": "9d7098b8608baf21903902a0caf34976", "score": "0.52172357", "text": "func (wr *GitHubAPIBranchWriter) pushCommit(ctx context.Context, ref *github.Reference, tree *github.Tree) error {\n\n\twr.logger.Printf(\"Push commit for %s @%s\\n\", wr.commit_repo, wr.commit_branch)\n\n\t// Get the parent commit to attach the commit to.\n\n\tlist_opts := &github.ListOptions{}\n\n\tparent, _, err := wr.client.Repositories.GetCommit(ctx, wr.commit_owner, wr.commit_repo, *ref.Object.SHA, list_opts)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to determine parent commit, %w\", err)\n\t}\n\n\t// This is not always populated, but is needed.\n\tparent.Commit.SHA = parent.SHA\n\n\t// Create the commit using the branch.\n\tdate := time.Now()\n\n\tauthor := &github.CommitAuthor{\n\t\tDate: &date,\n\t\tName: &wr.commit_author,\n\t\tEmail: &wr.commit_email,\n\t}\n\n\tparents := []*github.Commit{\n\t\tparent.Commit,\n\t}\n\n\tcommit := &github.Commit{\n\t\tAuthor: author,\n\t\tMessage: &wr.commit_description,\n\t\tTree: tree,\n\t\tParents: parents,\n\t}\n\n\tnewCommit, _, err := wr.client.Git.CreateCommit(ctx, wr.commit_owner, wr.commit_repo, commit)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to create commit, %w\", err)\n\t}\n\n\t// Attach the commit to the main branch.\n\tref.Object.SHA = newCommit.SHA\n\n\t_, _, err = wr.client.Git.UpdateRef(ctx, wr.commit_owner, wr.commit_repo, ref, false)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to update ref, %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2b7bd23c52815a024a63678d0b039132", "score": "0.52098924", "text": "func gitCommands(dir string) {\n\tgitStash(dir)\n\tgitCheckoutMaster(dir)\n\tgitPullMaster(dir)\n}", "title": "" }, { "docid": "357c5ec65d65bcb17d088996329575f1", "score": "0.52056885", "text": "func Upload(cfg vcs.CfgUpload) {\n\terr := new(gochips.PipedExec).\n\t\tCommand(git, \"add\", \".\").\n\t\tRun(os.Stdout, os.Stdout)\n\tgochips.ExitIfError(err)\n\n\tparams := []string{\"commit\", \"-a\"}\n\tfor _, m := range cfg.Message {\n\t\tparams = append(params, mimm, m)\n\t}\n\t_, sterr, err := new(gochips.PipedExec).\n\t\tCommand(git, params...).\n\t\tRunToStrings()\n\tif strings.Contains(sterr, MsgPreCommitError) {\n\t\tvar response string\n\t\tfmt.Println(\"\")\n\t\tfmt.Println(strings.TrimSpace(sterr))\n\t\tfmt.Print(\"Do you want to commit anyway(y/n)?\")\n\t\tfmt.Scanln(&response)\n\t\tif response != \"y\" {\n\t\t\treturn\n\t\t}\n\t\tparams = append(params, \"-n\")\n\t\terr = new(gochips.PipedExec).\n\t\t\tCommand(git, params...).\n\t\t\tRun(os.Stdout, os.Stdout)\n\t}\n\tgochips.ExitIfError(err)\n\n\tfor i := 0; i < 2; i++ {\n\t\t_, sterr, err := new(gochips.PipedExec).\n\t\t\tCommand(git, push).\n\t\t\tRunToStrings()\n\t\tif i == 0 && err != nil {\n\t\t\tif strings.Contains(sterr, \"has no upstream\") {\n\t\t\t\tremotelist := getRemotes()\n\t\t\t\tif len(remotelist) == 0 {\n\t\t\t\t\tfmt.Printf(\"\\nRemote not found. It's somethig wrong with your repository\\n \")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tbrName := GetCurrentBranchName() // Suggest to execute git push --set-upstream origin <branch-name>\n\t\t\t\tvar response string\n\n\t\t\t\tif len(remotelist) == 1 {\n\t\t\t\t\tfmt.Printf(\"\\nCurrent branch has no upstream branch.\\nI am going to execute 'git push --set-upstream origin %s'.\\nAgree[y/n]? \", brName)\n\t\t\t\t\tfmt.Scanln(&response)\n\t\t\t\t\tif response == pushYes {\n\t\t\t\t\t\tsetUpstreamBranch(\"origin\", brName)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfmt.Printf(\"\\nCurrent branch has no upstream branch.\")\n\n\t\t\t\tchoice := \"\"\n\t\t\t\tprompt := &survey.Select{\n\t\t\t\t\tMessage: \"Choose a remote for your branch:\",\n\t\t\t\t\tOptions: remotelist,\n\t\t\t\t}\n\t\t\t\terr := survey.AskOne(prompt, &choice)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err.Error())\n\t\t\t\t}\n\n\t\t\t\tfmt.Printf(\"\\nYour choice is %s.\\nI am going to execute 'git push --set-upstream %s %s'.\\nAgree[y/n]? \", choice, choice, brName)\n\t\t\t\tfmt.Scanln(&response)\n\t\t\t\tif response == pushYes {\n\t\t\t\t\tsetUpstreamBranch(choice, brName)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbreak\n\t}\n\n\tgochips.ExitIfError(err)\n}", "title": "" }, { "docid": "bc6695d4a51451fde247da108c4dbebd", "score": "0.5196621", "text": "func NewPull(branch string) *Pull { return &Pull{branch: branch} }", "title": "" }, { "docid": "04f2a571ec3f67a369073331cc78ecea", "score": "0.51786834", "text": "func UploadFilePost(ctx *context.Context) {\n\tform := web.GetForm(ctx).(*forms.UploadRepoFileForm)\n\tctx.Data[\"PageIsUpload\"] = true\n\tupload.AddUploadContext(ctx, \"repo\")\n\tcanCommit := renderCommitRights(ctx)\n\n\toldBranchName := ctx.Repo.BranchName\n\tbranchName := oldBranchName\n\n\tif form.CommitChoice == frmCommitChoiceNewBranch {\n\t\tbranchName = form.NewBranchName\n\t}\n\n\tform.TreePath = cleanUploadFileName(form.TreePath)\n\n\ttreeNames, treePaths := getParentTreeFields(form.TreePath)\n\tif len(treeNames) == 0 {\n\t\t// We must at least have one element for user to input.\n\t\ttreeNames = []string{\"\"}\n\t}\n\n\tctx.Data[\"TreePath\"] = form.TreePath\n\tctx.Data[\"TreeNames\"] = treeNames\n\tctx.Data[\"TreePaths\"] = treePaths\n\tctx.Data[\"BranchLink\"] = ctx.Repo.RepoLink + \"/src/branch/\" + util.PathEscapeSegments(branchName)\n\tctx.Data[\"commit_summary\"] = form.CommitSummary\n\tctx.Data[\"commit_message\"] = form.CommitMessage\n\tctx.Data[\"commit_choice\"] = form.CommitChoice\n\tctx.Data[\"new_branch_name\"] = branchName\n\n\tif ctx.HasError() {\n\t\tctx.HTML(http.StatusOK, tplUploadFile)\n\t\treturn\n\t}\n\n\tif oldBranchName != branchName {\n\t\tif _, err := ctx.Repo.GitRepo.GetBranch(branchName); err == nil {\n\t\t\tctx.Data[\"Err_NewBranchName\"] = true\n\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.branch_already_exists\", branchName), tplUploadFile, &form)\n\t\t\treturn\n\t\t}\n\t} else if !canCommit {\n\t\tctx.Data[\"Err_NewBranchName\"] = true\n\t\tctx.Data[\"commit_choice\"] = frmCommitChoiceNewBranch\n\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.cannot_commit_to_protected_branch\", branchName), tplUploadFile, &form)\n\t\treturn\n\t}\n\n\tif !ctx.Repo.Repository.IsEmpty {\n\t\tvar newTreePath string\n\t\tfor _, part := range treeNames {\n\t\t\tnewTreePath = path.Join(newTreePath, part)\n\t\t\tentry, err := ctx.Repo.Commit.GetTreeEntryByPath(newTreePath)\n\t\t\tif err != nil {\n\t\t\t\tif git.IsErrNotExist(err) {\n\t\t\t\t\tbreak // Means there is no item with that name, so we're good\n\t\t\t\t}\n\t\t\t\tctx.ServerError(\"Repo.Commit.GetTreeEntryByPath\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// User can only upload files to a directory, the directory name shouldn't be an existing file.\n\t\t\tif !entry.IsDir() {\n\t\t\t\tctx.Data[\"Err_TreePath\"] = true\n\t\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.directory_is_a_file\", part), tplUploadFile, &form)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tmessage := strings.TrimSpace(form.CommitSummary)\n\tif len(message) == 0 {\n\t\tdir := form.TreePath\n\t\tif dir == \"\" {\n\t\t\tdir = \"/\"\n\t\t}\n\t\tmessage = ctx.Tr(\"repo.editor.upload_files_to_dir\", dir)\n\t}\n\n\tform.CommitMessage = strings.TrimSpace(form.CommitMessage)\n\tif len(form.CommitMessage) > 0 {\n\t\tmessage += \"\\n\\n\" + form.CommitMessage\n\t}\n\n\tif err := files_service.UploadRepoFiles(ctx, ctx.Repo.Repository, ctx.Doer, &files_service.UploadRepoFileOptions{\n\t\tLastCommitID: ctx.Repo.CommitID,\n\t\tOldBranch: oldBranchName,\n\t\tNewBranch: branchName,\n\t\tTreePath: form.TreePath,\n\t\tMessage: message,\n\t\tFiles: form.Files,\n\t\tSignoff: form.Signoff,\n\t}); err != nil {\n\t\tif git_model.IsErrLFSFileLocked(err) {\n\t\t\tctx.Data[\"Err_TreePath\"] = true\n\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.upload_file_is_locked\", err.(git_model.ErrLFSFileLocked).Path, err.(git_model.ErrLFSFileLocked).UserName), tplUploadFile, &form)\n\t\t} else if models.IsErrFilenameInvalid(err) {\n\t\t\tctx.Data[\"Err_TreePath\"] = true\n\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.filename_is_invalid\", form.TreePath), tplUploadFile, &form)\n\t\t} else if models.IsErrFilePathInvalid(err) {\n\t\t\tctx.Data[\"Err_TreePath\"] = true\n\t\t\tfileErr := err.(models.ErrFilePathInvalid)\n\t\t\tswitch fileErr.Type {\n\t\t\tcase git.EntryModeSymlink:\n\t\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.file_is_a_symlink\", fileErr.Path), tplUploadFile, &form)\n\t\t\tcase git.EntryModeTree:\n\t\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.filename_is_a_directory\", fileErr.Path), tplUploadFile, &form)\n\t\t\tcase git.EntryModeBlob:\n\t\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.directory_is_a_file\", fileErr.Path), tplUploadFile, &form)\n\t\t\tdefault:\n\t\t\t\tctx.Error(http.StatusInternalServerError, err.Error())\n\t\t\t}\n\t\t} else if models.IsErrRepoFileAlreadyExists(err) {\n\t\t\tctx.Data[\"Err_TreePath\"] = true\n\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.file_already_exists\", form.TreePath), tplUploadFile, &form)\n\t\t} else if git.IsErrBranchNotExist(err) {\n\t\t\tbranchErr := err.(git.ErrBranchNotExist)\n\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.branch_does_not_exist\", branchErr.Name), tplUploadFile, &form)\n\t\t} else if git_model.IsErrBranchAlreadyExists(err) {\n\t\t\t// For when a user specifies a new branch that already exists\n\t\t\tctx.Data[\"Err_NewBranchName\"] = true\n\t\t\tbranchErr := err.(git_model.ErrBranchAlreadyExists)\n\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.branch_already_exists\", branchErr.BranchName), tplUploadFile, &form)\n\t\t} else if git.IsErrPushOutOfDate(err) {\n\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.file_changed_while_editing\", ctx.Repo.RepoLink+\"/compare/\"+util.PathEscapeSegments(ctx.Repo.CommitID)+\"...\"+util.PathEscapeSegments(form.NewBranchName)), tplUploadFile, &form)\n\t\t} else if git.IsErrPushRejected(err) {\n\t\t\terrPushRej := err.(*git.ErrPushRejected)\n\t\t\tif len(errPushRej.Message) == 0 {\n\t\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.push_rejected_no_message\"), tplUploadFile, &form)\n\t\t\t} else {\n\t\t\t\tflashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{\n\t\t\t\t\t\"Message\": ctx.Tr(\"repo.editor.push_rejected\"),\n\t\t\t\t\t\"Summary\": ctx.Tr(\"repo.editor.push_rejected_summary\"),\n\t\t\t\t\t\"Details\": utils.SanitizeFlashErrorString(errPushRej.Message),\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\tctx.ServerError(\"UploadFilePost.HTMLString\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tctx.RenderWithErr(flashError, tplUploadFile, &form)\n\t\t\t}\n\t\t} else {\n\t\t\t// os.ErrNotExist - upload file missing in the intervening time?!\n\t\t\tlog.Error(\"Error during upload to repo: %-v to filepath: %s on %s from %s: %v\", ctx.Repo.Repository, form.TreePath, oldBranchName, form.NewBranchName, err)\n\t\t\tctx.RenderWithErr(ctx.Tr(\"repo.editor.unable_to_upload_files\", form.TreePath, err), tplUploadFile, &form)\n\t\t}\n\t\treturn\n\t}\n\n\tif ctx.Repo.Repository.IsEmpty {\n\t\tif isEmpty, err := ctx.Repo.GitRepo.IsEmpty(); err == nil && !isEmpty {\n\t\t\t_ = repo_model.UpdateRepositoryCols(ctx, &repo_model.Repository{ID: ctx.Repo.Repository.ID, IsEmpty: false}, \"is_empty\")\n\t\t}\n\t}\n\n\tredirectForCommitChoice(ctx, form.CommitChoice, branchName, form.TreePath)\n}", "title": "" }, { "docid": "9a25226562dbc7394ac71a6a539c1057", "score": "0.51637477", "text": "func Clone(cfg *config.GitConfig, opts ...bool) {\n\tfor _, v := range cfg.Repos {\n\t\tremote := v.Git_Remote\n\t\tcleanRemoteBase := strings.Replace(path.Base(v.Git_Remote), \".git\", \"\", -1)\n\t\tlocal := path.Join(v.LocalDir, cleanRemoteBase)\n\t\tlog.Printf(\"processing repo %s in local dir %s %s \\n\", remote, local, emoji.Sprint(\":gear:\"))\n\n\t\tif len(opts) >= 1 {\n\t\t\tif alreadyCloned(local) {\n\t\t\t\tlog.Printf(\"repo %s already cloned in %s, skipping %s \\n\", remote, local, emoji.Sprint(\":kangaroo:\"))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\trepo, err := vcs.NewRepo(remote, local)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\t// Returns: instance of GitRepo\n\t\tok := repo.Ping()\n\t\tif !ok {\n\t\t\tlog.Printf(\"remote origin %s is not reachable %s \\n\", remote, emoji.Sprint(\":no_entry:\"))\n\t\t\tcontinue\n\t\t}\n\t\tcreatDirIfNotExist(local)\n\n\t\tlog.Printf(\"cloning/fetching repo %s in local dir %s %s \\n\", remote, local, emoji.Sprint(\":hourglass_not_done:\"))\n\t\terr = repo.Get()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"repository %s already cloned in path %s, trying to update it %s\\n\", remote, local, emoji.Sprint(\":repeat_button:\"))\n\t\t\tif repo.IsDirty() {\n\t\t\t\tlog.Printf(\"repo %s has modification, skipping updates %s \\n\", remote, emoji.Sprint(\":page_with_curl:\"))\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"repo %s is clean %s \\n\", remote, emoji.Sprint(\":soap:\"))\n\t\t\t\terr = repo.Update()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"error while trying to pull/fetch the %s repository : %v \\n\", remote, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tlog.Printf(\"update complete! %s \\n\", emoji.Sprint(\":thumbs_up:\"))\n\t\t\t}\n\t\t}\n\n\t\terr = repo.UpdateVersion(\"master\")\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d90c318ec9512fd3efa693184c62d196", "score": "0.5163096", "text": "func fetch(b *plugin.Build, tags bool, depth int, emptyDir bool) *exec.Cmd {\n\ttags_option := \"--no-tags\"\n\tif tags {\n\t\ttags_option = \"--tags\"\n\t}\n\tcmd := exec.Command(\n\t\t\"git\",\n\t\t\"fetch\",\n\t\ttags_option,\n\t)\n\tif depth != 0 {\n\t\tcmd.Args = append(cmd.Args, fmt.Sprintf(\"--depth=%d\", depth))\n\t}\n\tcmd.Args = append(cmd.Args, \"origin\")\n\t// when ref is omitted, there may be error with non-standard\n\t// default branches, for example\n\t//\n\t//\tgit init\n\t//\tgit remote add origin https://github.com/apache/log4j\n\t//\tgit fetch --no-tags origin +:\n\t//\tgit reset --hard -q c5f4279081091e562c44bb753f6e52dc6be5fa52\n\t//\n\tif !emptyDir || b.Ref != \"\" {\n\t\tcmd.Args = append(cmd.Args, fmt.Sprintf(\"+%s:\", b.Ref))\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "5bdc7e8be187c2696f3076869441d0a1", "score": "0.5152393", "text": "func (g *GitHubRepo) Push(ctx context.Context, updates updater.UpdateGroup) error {\n\tif err := g.repo.Push(ctx, updates); err != nil {\n\t\treturn err\n\t}\n\tif g.repo.NoPush {\n\t\treturn nil\n\t}\n\n\tif err := g.createPR(ctx, updates); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "491417fbd1a51d2b49f5f0dfab09eb65", "score": "0.5148969", "text": "func makeReservedCommand() {\n\tCopy := func() {\n\t\tfmt.Println(\"Call Copy on \" + COSTE_HOME)\n\t\trepo, err := git.PlainOpen(COSTE_HOME)\n\t\tCheckIfError(err)\n\n\t\tworktree, err := repo.Worktree()\n\t\tCheckIfError(err)\n\n\t\terr = worktree.Checkout(&git.CheckoutOptions {\n\t\t\tBranch: \"refs/heads/coste-history\",\n\t\t})\n\t\tCheckIfError(err)\n\n\t\t/*\n1) FILE COPY TO HISTORY FOLDER\n2) GIT ADD FILE NAME\n3) GIT PUSH FILE NAME\n4) FINISH\n*/\n\t\t\n\t}\n\n\tPaste := func() {\n\t\tfmt.Println(\"Call Paste!\")\n\t}\n\n\tHelp := func() {\n\t\tfmt.Println(\"Help!\")\n\t}\n\tcommands[\"c\"] = Copy\n\tcommands[\"-c\"] = Copy\n\tcommands[\"copy\"] = Copy\n\tcommands[\"--copy\"] = Copy\n\n\tcommands[\"v\"] = Paste\n\tcommands[\"-v\"] = Paste\n\tcommands[\"paste\"] = Paste\n\tcommands[\"--paste\"] = Paste\n\n\tcommands[\"help\"] = Help\n}", "title": "" }, { "docid": "faea23a200685c48a2a8ddb0c929d9ba", "score": "0.51403934", "text": "func (g *Git) ChangeBranch(branchName string) error {\n\tcmd := exec.Command(\"git\", \"checkout\", \"-b\", branchName)\n\t_, err := g.run(cmd)\n\treturn err\n}", "title": "" }, { "docid": "236c07ded3d683c4a5593fbba440846f", "score": "0.5137683", "text": "func Commit(message string) error {\n\treturn sh.Run(\"git\", \"commit\", \"-S\", \"-m\", message)\n}", "title": "" }, { "docid": "3555eb1dcb48bf558fc5c9e16c03b171", "score": "0.5126512", "text": "func cloneRepository(url, path, name string) error {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\t_, err := git.PlainClone(path, false, &git.CloneOptions{\n\t\t\tURL: url,\n\t\t\t//Prognress: os.Stdout,\n\t\t\t// TODO add verbose flag to show/hide these.\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\t// If exists, pull latest changes\n\t\trepo, err := git.PlainOpen(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tworkTree, err := repo.Worktree()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = workTree.Pull(&git.PullOptions{RemoteName: \"origin\"})\n\t\tif err != nil && !strings.Contains(err.Error(), \"already up-to-date\") && !strings.Contains(err.Error(), \"worktree contains unstaged changes\") {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2a6ec575de1d328bd98956c501061b14", "score": "0.51225466", "text": "func (sr *SourceRepo) Checkout(commitID string) error {\n\tlog.Printf(\"Checking out commit: %s\\n\", commitID)\n\twt, err := sr.repo.Worktree()\n\tif err != nil {\n\t\tlog.Printf(\"Getting Worktree failed: %+v\\n\", err)\n\t\treturn err\n\t}\n\terr = wt.Pull(&git.PullOptions{\n\t\tForce: true,\n\t\tProgress: os.Stdout,\n\t})\n\tif err != nil && err != git.NoErrAlreadyUpToDate {\n\t\tlog.Printf(\"Pull failed: %+v\\n\", err)\n\t\treturn err\n\t}\n\terr = wt.Checkout(&git.CheckoutOptions{\n\t\tForce: true,\n\t\tHash: plumbing.NewHash(commitID),\n\t})\n\tif err != nil {\n\t\tlog.Printf(\"Checkout failed: %+v\\n\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2eed3f7bcb9eefcf413d2baf734afae0", "score": "0.5121724", "text": "func (p *Parser) updateEnv() error {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\t// check if git exists by checking the git installation version.\n\tversionStr, err := p.readCommandOutput(gitCmd, versionArg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"checking git version(%s %s) failed: %v\",\n\t\t\tgitCmd, versionArg, err)\n\t}\n\n\t// Check if a valid git version exists. A minimum of v1.5.1 is required.\n\tif err = types.IsGitVersionSupported(versionStr); err != nil {\n\t\t// invalid/unsupported git version must have been found.\n\t\treturn err\n\t}\n\n\t// full clone directory: includes the expected repository name.\n\tworkingDir := filepath.Join(p.cloneDir, cloneRepoAlias)\n\t_, err = os.Stat(workingDir)\n\n\tcompleteRemoteURL := fmt.Sprintf(remoteURL, p.repoOwner, p.repoName)\n\n\tswitch {\n\tcase !os.IsNotExist(err):\n\t\t// The working directory was found thus check if the tracked repo is the\n\t\t// same as the required one.\n\t\ttrackedRepo, err := p.readCommandOutput(gitCmd, remoteDef, trackedRemoteURL, remoteURLRef)\n\n\t\t// If the required tracked repo was found initiate the updates fetch process\n\t\tif err == nil && types.IsMatching(trackedRepo, completeRemoteURL) {\n\t\t\tif err = p.execCommand(gitCmd, pullChangesArg, remoteURLRef); err == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\t// git pull command failed or the required tracked repo wasn't found.\n\t\t// Drop the old repo and proceed to clone the repo a fresh.\n\t\tif err = os.RemoveAll(workingDir); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfallthrough\n\n\tdefault:\n\t\t// The required working directory could not be found or the repo update\n\t\t// process failed. Clone the remote repository into the clone directory.\n\t\terr = p.execCommand(gitCmd, cloneArg, completeRemoteURL, cloneRepoAlias)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to clone %s : %v\", completeRemoteURL, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eb59a8e4e1ceaf2eedf9ccca20c5c204", "score": "0.5117719", "text": "func payload(w salt.ResponseBuffer, r *salt.RequestBuffer) {\n\tb, _ := ioutil.ReadAll(r.Body)\n\tvar gwh GitPushWH\n\terr := json.Unmarshal(b, &gwh)\n\tif err != nil {\n\t\tfmt.Fprint(w, \"Json Error : \"+err.Error())\n\t\treturn\n\t}\n\t_, err = os.Stat(\"./posts/\")\n\t_, errdg := os.Stat(\"./posts/.git\")\n\tif os.IsNotExist(err) {\n\t\tcmd := exec.Command(\"git\", \"clone\", \"https://github.com/aki237/bengine-posts\", \"posts\")\n\t\tcmd.Output()\n\t} else {\n\t\tif os.IsNotExist(errdg) {\n\t\t\texec.Command(\"rm\", \"-rf\", \"posts/*\").Output()\n\t\t\tcmd := exec.Command(\"git\", \"clone\", \"https://github.com/aki237/bengine-posts\", \"posts\")\n\t\t\tcmd.Output()\n\t\t}\n\t\tcmd := exec.Command(\"git\", \"-C\", \"posts\", \"pull\")\n\t\tcmd.Output()\n\t}\n}", "title": "" }, { "docid": "648233130574d982fe0fc2a575631cfd", "score": "0.5107399", "text": "func gitSrc(auths map[string]conf.Auth, packageCacheDir, packagePath, packageUrl, version string) error {\n\tif err := os.MkdirAll(packageCacheDir, 0744); err != nil {\n\t\treturn err\n\t}\n\n\t// generate auth repository url.\n\trepoUrl := packageUrl\n\tif gitUrl, err := url.Parse(packageUrl); err != nil {\n\t\treturn err\n\t} else {\n\t\tif hostAuth, ok := auths[gitUrl.Host]; ok {\n\t\t\tgitUrl.User = url.UserPassword(hostAuth.Username, hostAuth.Token)\n\t\t\trepoUrl = gitUrl.String()\n\t\t}\n\t}\n\n\t// init ReferenceName using branch and tag.\n\tvar checkoutOpt git.CheckoutOptions\n\t// clone repository.\n\tif repos, err := git.PlainClone(packageCacheDir, false, &git.CloneOptions{\n\t\tURL: repoUrl,\n\t\tProgress: os.Stdout,\n\t\t//ReferenceName: referenceName, // specific branch or tag.\n\t\tRecurseSubmodules: git.DefaultSubmoduleRecursionDepth,\n\t}); err != nil {\n\t\tlog.Println(\"Error here\", err)\n\t\treturn err\n\t} else { // clone succeed.\n\t\t// fetch all branches references from remote\n\t\tif err := repos.Fetch(&git.FetchOptions{\n\t\t\tRefSpecs: []config.RefSpec{\"refs/*:refs/*\", \"HEAD:refs/heads/HEAD\"},\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar found = false\n\t\t// check branches and tags\n\t\tif refIter, err := repos.Storer.IterReferences(); err != nil {\n\t\t\treturn err\n\t\t} else {\n\t\t\trefIter := storer.NewReferenceFilteredIter(func(r *plumbing.Reference) bool {\n\t\t\t\treturn r.Name().IsTag() || r.Name().IsBranch()\n\t\t\t}, refIter)\n\n\t\t\tfor {\n\t\t\t\tif t, err := refIter.Next(); err != nil {\n\t\t\t\t\tif err == io.EOF {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (t.Name().String() == \"refs/tags/\"+version) || (t.Name().String() == \"refs/heads/\"+version) {\n\t\t\t\t\t\tcheckoutOpt.Branch = t.Name()\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}\n\t\t}\n\n\t\tif !found {\n\t\t\t// checkout to hash, if hash is not empty, then checkout to some commit.\n\t\t\tcheckoutOpt.Hash = plumbing.NewHash(version)\n\t\t\tif checkoutOpt.Hash.IsZero() {\n\t\t\t\treturn fmt.Errorf(\"invalid commit hash: %s\", version)\n\t\t\t}\n\t\t}\n\n\t\tworktree, err := repos.Worktree()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"pkg\": packagePath,\n\t\t\t\"version\": version,\n\t\t}).Println(\"checkout repository to reference.\")\n\t\t// do checkout\n\t\tif err = worktree.Checkout(&checkoutOpt); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// remove .git directory.\n\terr := os.RemoveAll(filepath.Join(packageCacheDir, \".git\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6a5622eb7b0bf3146113bf870615b448", "score": "0.51073796", "text": "func gitPush(c *gin.Context) {\n\tmatched, _ := VerifySignature(c)\n\tif !matched {\n\t\terr := \"Signatures did not match\"\n\t\tc.String(http.StatusForbidden, err)\n\t\tlog.Warn(err)\n\t\treturn\n\t}\n\tlog.Info(\"Signatures is matched ~\")\n\t//return 200 first\n\tc.String(http.StatusOK, \"OK\")\n\tgo ReLaunch(shell)\n}", "title": "" }, { "docid": "eca8ea6d8c2d05c22aa3e5f79469e8c6", "score": "0.51055694", "text": "func CommitRepoAction(opts CommitRepoActionOptions) error {\n\tpusher, err := models.GetUserByName(opts.PusherName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetUserByName [%s]: %v\", opts.PusherName, err)\n\t}\n\n\trepo, err := models.GetRepositoryByName(opts.RepoOwnerID, opts.RepoName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetRepositoryByName [owner_id: %d, name: %s]: %v\", opts.RepoOwnerID, opts.RepoName, err)\n\t}\n\n\trefName := git.RefEndName(opts.RefFullName)\n\n\t// Change default branch and empty status only if pushed ref is non-empty branch.\n\tif repo.IsEmpty && opts.NewCommitID != git.EmptySHA && strings.HasPrefix(opts.RefFullName, git.BranchPrefix) {\n\t\trepo.DefaultBranch = refName\n\t\trepo.IsEmpty = false\n\t\tif refName != \"master\" {\n\t\t\tgitRepo, err := git.OpenRepository(repo.RepoPath())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := gitRepo.SetDefaultBranch(repo.DefaultBranch); err != nil {\n\t\t\t\tif !git.IsErrUnsupportedVersion(err) {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Change repository empty status and update last updated time.\n\tif err = models.UpdateRepository(repo, false); err != nil {\n\t\treturn fmt.Errorf(\"UpdateRepository: %v\", err)\n\t}\n\n\tisNewBranch := false\n\topType := models.ActionCommitRepo\n\t// Check it's tag push or branch.\n\tif strings.HasPrefix(opts.RefFullName, git.TagPrefix) {\n\t\topType = models.ActionPushTag\n\t\tif opts.NewCommitID == git.EmptySHA {\n\t\t\topType = models.ActionDeleteTag\n\t\t}\n\t\topts.Commits = &models.PushCommits{}\n\t} else if opts.NewCommitID == git.EmptySHA {\n\t\topType = models.ActionDeleteBranch\n\t\topts.Commits = &models.PushCommits{}\n\t} else {\n\t\t// if not the first commit, set the compare URL.\n\t\tif opts.OldCommitID == git.EmptySHA {\n\t\t\tisNewBranch = true\n\t\t} else {\n\t\t\topts.Commits.CompareURL = repo.ComposeCompareURL(opts.OldCommitID, opts.NewCommitID)\n\t\t}\n\n\t\tif err = models.UpdateIssuesCommit(pusher, repo, opts.Commits.Commits, refName); err != nil {\n\t\t\tlog.Error(\"updateIssuesCommit: %v\", err)\n\t\t}\n\t}\n\n\tif len(opts.Commits.Commits) > setting.UI.FeedMaxCommitNum {\n\t\topts.Commits.Commits = opts.Commits.Commits[:setting.UI.FeedMaxCommitNum]\n\t}\n\n\tdata, err := json.Marshal(opts.Commits)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Marshal: %v\", err)\n\t}\n\n\tif err = models.NotifyWatchers(&models.Action{\n\t\tActUserID: pusher.ID,\n\t\tActUser: pusher,\n\t\tOpType: opType,\n\t\tContent: string(data),\n\t\tRepoID: repo.ID,\n\t\tRepo: repo,\n\t\tRefName: refName,\n\t\tIsPrivate: repo.IsPrivate,\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"NotifyWatchers: %v\", err)\n\t}\n\n\tdefer func() {\n\t\tgo models.HookQueue.Add(repo.ID)\n\t}()\n\n\tapiPusher := pusher.APIFormat()\n\tapiRepo := repo.APIFormat(models.AccessModeNone)\n\n\tvar shaSum string\n\tvar isHookEventPush = false\n\tswitch opType {\n\tcase models.ActionCommitRepo: // Push\n\t\tisHookEventPush = true\n\n\t\tif isNewBranch {\n\t\t\tgitRepo, err := git.OpenRepository(repo.RepoPath())\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"OpenRepository[%s]: %v\", repo.RepoPath(), err)\n\t\t\t}\n\n\t\t\tshaSum, err = gitRepo.GetBranchCommitID(refName)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"GetBranchCommitID[%s]: %v\", opts.RefFullName, err)\n\t\t\t}\n\t\t\tif err = models.PrepareWebhooks(repo, models.HookEventCreate, &api.CreatePayload{\n\t\t\t\tRef: refName,\n\t\t\t\tSha: shaSum,\n\t\t\t\tRefType: \"branch\",\n\t\t\t\tRepo: apiRepo,\n\t\t\t\tSender: apiPusher,\n\t\t\t}); err != nil {\n\t\t\t\treturn fmt.Errorf(\"PrepareWebhooks: %v\", err)\n\t\t\t}\n\t\t}\n\n\tcase models.ActionDeleteBranch: // Delete Branch\n\t\tisHookEventPush = true\n\n\t\tif err = models.PrepareWebhooks(repo, models.HookEventDelete, &api.DeletePayload{\n\t\t\tRef: refName,\n\t\t\tRefType: \"branch\",\n\t\t\tPusherType: api.PusherTypeUser,\n\t\t\tRepo: apiRepo,\n\t\t\tSender: apiPusher,\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\"PrepareWebhooks.(delete branch): %v\", err)\n\t\t}\n\n\tcase models.ActionPushTag: // Create\n\t\tisHookEventPush = true\n\n\t\tgitRepo, err := git.OpenRepository(repo.RepoPath())\n\t\tif err != nil {\n\t\t\tlog.Error(\"OpenRepository[%s]: %v\", repo.RepoPath(), err)\n\t\t}\n\t\tshaSum, err = gitRepo.GetTagCommitID(refName)\n\t\tif err != nil {\n\t\t\tlog.Error(\"GetTagCommitID[%s]: %v\", opts.RefFullName, err)\n\t\t}\n\t\tif err = models.PrepareWebhooks(repo, models.HookEventCreate, &api.CreatePayload{\n\t\t\tRef: refName,\n\t\t\tSha: shaSum,\n\t\t\tRefType: \"tag\",\n\t\t\tRepo: apiRepo,\n\t\t\tSender: apiPusher,\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\"PrepareWebhooks: %v\", err)\n\t\t}\n\tcase models.ActionDeleteTag: // Delete Tag\n\t\tisHookEventPush = true\n\n\t\tif err = models.PrepareWebhooks(repo, models.HookEventDelete, &api.DeletePayload{\n\t\t\tRef: refName,\n\t\t\tRefType: \"tag\",\n\t\t\tPusherType: api.PusherTypeUser,\n\t\t\tRepo: apiRepo,\n\t\t\tSender: apiPusher,\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\"PrepareWebhooks.(delete tag): %v\", err)\n\t\t}\n\t}\n\n\tif isHookEventPush {\n\t\tcommits, err := opts.Commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err = models.PrepareWebhooks(repo, models.HookEventPush, &api.PushPayload{\n\t\t\tRef: opts.RefFullName,\n\t\t\tBefore: opts.OldCommitID,\n\t\t\tAfter: opts.NewCommitID,\n\t\t\tCompareURL: setting.AppURL + opts.Commits.CompareURL,\n\t\t\tCommits: commits,\n\t\t\tRepo: apiRepo,\n\t\t\tPusher: apiPusher,\n\t\t\tSender: apiPusher,\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\"PrepareWebhooks: %v\", err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8b086ea352a49c5d2ae694b3669afa34", "score": "0.510344", "text": "func PreGitRecieve(pushURL, owner string) error {\n\treturn checkCreateRepo(pushURL, owner)\n}", "title": "" }, { "docid": "937b6486c48cc502cd1e7f5d9345a360", "score": "0.51027656", "text": "func (g *GitVCSDriver) ChangeBranch(name string) error {\n\tcommand := fmt.Sprintf(\"git checkout --track %s/%s\", g.remote, name)\n\terr := g.runCommand(command)\n\tif err != nil {\n\t\treturn errors.New(\"There was a problem with checking out the branch. Does it exist? Confirm and try again\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "930fe9529353b604f3e130f5d84c5a5f", "score": "0.51014847", "text": "func checkRepoUpdate(app_id string, job_id string, desired_tag string, latestBuildNumber string) bool {\n\trepoUpdated := false\n\tcontent_path := path.Join(IMAGE_PULL_MOUNT, app_id, job_id, desired_tag)\n\tif app_id == \"library\" {\n\t\tcontent_path = path.Join(IMAGE_PULL_MOUNT, job_id, desired_tag)\n\t}\n\tbuildNumberFile := path.Join(content_path, \"BuildNumber\")\n\tprocessedBuildNumber := readTagFileContent(app_id, job_id, desired_tag, \"BuildNumber\")\n\tif processedBuildNumber != \"\" {\n\t\tif latestBuildNumber != processedBuildNumber {\n\t\t\trepoUpdated = false\n\t\t}\n\t} else {\n\t\tlogrus.Info(\"Build is procesed for first time\")\n\t}\n\t//If the directory is not already existing create it\n\t_, err := os.Stat(content_path)\n\tif os.IsNotExist(err) {\n\t\terrDir := os.MkdirAll(content_path, 0777)\n\t\tif errDir != nil {\n\t\t\tlogrus.Errorf(\"Could not create the content dir\")\n\t\t}\n\t} else {\n\t\tlogrus.Info(\"Content Dir is already existing\")\n\t}\n\n\t//Write the latest build number to the file\n\tlatestBuildNumberByte := []byte(latestBuildNumber)\n\tioutil.WriteFile(buildNumberFile, latestBuildNumberByte, 0777)\n\treturn repoUpdated\n}", "title": "" }, { "docid": "f55101d8249f4b724f5df0e0d02c1aab", "score": "0.51004744", "text": "func (o *EnvFactory) PushToGit(cloneURL string, userAuth *auth.UserAuth, dir string) error {\n\tforkPushURL, err := o.Gitter.CreateAuthenticatedURL(cloneURL, userAuth)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"creating push URL for %s\", cloneURL)\n\t}\n\n\tremoteBranch := \"master\"\n\terr = o.Gitter.Push(dir, forkPushURL, true, fmt.Sprintf(\"%s:%s\", \"HEAD\", remoteBranch))\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"pushing merged branch %s\", remoteBranch)\n\t}\n\n\tlog.Logger().Infof(\"pushed code to the repository\")\n\treturn nil\n}", "title": "" }, { "docid": "8e414ab64927e9cd1f27ee6208d275bf", "score": "0.5099708", "text": "func Fetch(gitDir, from, to string) error {\n\targs := []string{\"--git-dir=\" + gitDir, \"fetch\", \"-q\", \"--no-tags\", \"origin\", from + \":\" + to}\n\tcmd := exec.Command(\"git\", args...)\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\tif err := cmd.Start(); err != nil {\n\t\treturn err\n\t}\n\treturn cmd.Wait()\n}", "title": "" }, { "docid": "1ee4da97d8a62066d4f438efa531c0cd", "score": "0.5090714", "text": "func (r *Repo) Push(options plumbing2.PushOptions) (progress bytes.Buffer, err error) {\n\topts := &git.PushOptions{Progress: &progress}\n\tif options.RemoteName != \"\" {\n\t\topts.RemoteName = options.RemoteName\n\t}\n\tif options.Token != \"\" {\n\t\topts.Auth = &http.BasicAuth{Username: options.Token, Password: \"-\"}\n\t}\n\tif options.RefSpec != \"\" {\n\t\topts.RefSpecs = []config.RefSpec{config.RefSpec(options.RefSpec)}\n\t}\n\terr = r.Repository.Push(opts)\n\treturn\n}", "title": "" }, { "docid": "b11043c8371788eb411c11cd950be90c", "score": "0.5085708", "text": "func (t *Test) CreatePullRequestAndGetPreviewEnvironment(statusCode int) error {\n\tapplicationName := t.GetApplicationName()\n\tworkDir := filepath.Join(t.WorkDir, applicationName)\n\towner := t.GetGitOrganisation()\n\n\tutils.LogInfof(\"Creating a Pull Request in folder: %s\\n\", workDir)\n\tt.ExpectCommandExecution(workDir, TimeoutCmdLine, 0, \"git\", \"checkout\", \"-b\", \"changes\")\n\n\t// now lets make a code change\n\tfileName := \"README.md\"\n\treadme := filepath.Join(workDir, fileName)\n\n\tdata := []byte(\"My First PR/n\")\n\terr := ioutil.WriteFile(readme, data, util.DefaultWritePermissions)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tt.ExpectCommandExecution(workDir, time.Minute, 0, \"git\", \"add\", fileName)\n\tt.ExpectCommandExecution(workDir, time.Minute, 0, \"git\", \"commit\", \"-a\", \"-m\", \"My first PR commit\")\n\tt.ExpectCommandExecution(workDir, time.Minute, 0, \"git\", \"push\", \"--set-upstream\", \"origin\", \"changes\")\n\n\to := cmd.CreatePullRequestOptions{\n\t\tCreateOptions: cmd.CreateOptions{\n\t\t\tCommonOptions: &cmd.CommonOptions{\n\t\t\t\tOut: os.Stdout,\n\t\t\t\tErr: os.Stderr,\n\t\t\t\tBatchMode: true,\n\t\t\t},\n\t\t},\n\t\tTitle: \"My First PR commit\",\n\t\tBody: \"PR comments\",\n\t\tDir: workDir,\n\t\tBase: \"master\",\n\t}\n\to.CommonOptions.SetFactory(t.Factory)\n\n\terr = o.Run()\n\tpr := o.Results.PullRequest\n\n\tutils.ExpectNoError(err)\n\tExpect(pr).ShouldNot(BeNil())\n\tprNumber := pr.Number\n\tExpect(prNumber).ShouldNot(BeNil())\n\n\tjobName := owner + \"/\" + applicationName + \"/PR-\" + strconv.Itoa(*prNumber)\n\tt.ThereShouldBeAJobThatCompletesSuccessfully(jobName, TimeoutBuildCompletes)\n\n\tutils.ExpectNoError(err)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// lets verify that there's a Preview Environment...\n\tutils.LogInfof(\"Verifying we have a Preview Environment...\\n\")\n\tjxClient, ns, err := o.JXClientAndDevNamespace()\n\tutils.ExpectNoError(err)\n\n\tenvList, err := jxClient.JenkinsV1().Environments(ns).List(metav1.ListOptions{})\n\tutils.ExpectNoError(err)\n\n\tvar previewEnv *v1.Environment\n\tfor _, env := range envList.Items {\n\t\tspec := &env.Spec\n\t\tif spec.Kind == v1.EnvironmentKindTypePreview {\n\t\t\tif spec.PreviewGitSpec.ApplicationName == applicationName {\n\t\t\t\tcopy := env\n\t\t\t\tpreviewEnv = &copy\n\t\t\t}\n\t\t}\n\t}\n\tExpect(previewEnv).ShouldNot(BeNil(), \"Could not find Preview Environment in namespace %s for application name %s\", ns, applicationName)\n\tif previewEnv != nil {\n\t\tapplicationUrl := previewEnv.Spec.PreviewGitSpec.ApplicationURL\n\t\tExpect(applicationUrl).ShouldNot(Equal(\"\"), \"No Preview Application URL found\")\n\n\t\tutils.LogInfof(\"Running Preview Environment application at: %s\\n\", util.ColorInfo(applicationUrl))\n\n\t\treturn t.ExpectUrlReturns(applicationUrl, statusCode, TimeoutUrlReturns)\n\t} else {\n\t\tutils.LogInfof(\"No Preview Environment found in namespace %s for application: %s\\n\", ns, applicationName)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "db5416e2014d5046f1d1b378e4a2f158", "score": "0.50827754", "text": "func (g *Git) Checkout(branch string, commit string) error {\n\tif branch != \"\" && commit != \"\" {\n\t\treturn ErrBranchAndCommitGiven\n\t}\n\n\t// var branch string\n\tif branch == \"\" {\n\t\tbranch = \"master\"\n\t}\n\n\tvar fetchOptions git.FetchOptions\n\tif g.authMethod == nil {\n\t\tfetchOptions = git.FetchOptions{\n\t\t\tRefSpecs: []c.RefSpec{\"+refs/heads/*:refs/remotes/origin/*\", \"refs/*:refs/*\"},\n\t\t\tForce: true,\n\t\t}\n\t} else {\n\t\tfetchOptions = git.FetchOptions{\n\t\t\tRefSpecs: []c.RefSpec{\"+refs/heads/*:refs/remotes/origin/*\", \"refs/*:refs/*\"},\n\t\t\tForce: true,\n\t\t\tAuth: *g.authMethod,\n\t\t}\n\t}\n\n\terr := g.Repository.Fetch(&fetchOptions)\n\tif err != nil {\n\t\tswitch err {\n\t\tcase git.NoErrAlreadyUpToDate:\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar checkoutOptions git.CheckoutOptions\n\tif commit != \"\" {\n\t\th := plumbing.NewHash(commit)\n\t\tcheckoutOptions = git.CheckoutOptions{\n\t\t\tCreate: false, Force: true, Hash: h,\n\t\t}\n\t} else {\n\t\tb := plumbing.NewBranchReferenceName(branch)\n\t\tcheckoutOptions = git.CheckoutOptions{\n\t\t\tCreate: false, Force: true, Branch: b,\n\t\t}\n\t}\n\n\tif err := g.Worktree.Checkout(&checkoutOptions); err != nil {\n\t\treturn err\n\t}\n\n\t//Set head and commit state after checkout branch/commit\n\tg.Head, err = g.Repository.Head()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Commit, err = g.Repository.CommitObject(g.Head.Hash())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c4e0baed590ba51a8f4da1166aecdca8", "score": "0.5079347", "text": "func setupRepo(t *testing.T, numCommits int) (string, *repograph.Graph, []string, func()) {\n\tgb := git_testutils.GitInit(t)\n\tf := \"somefile\"\n\tcommits := make([]string, 0, numCommits)\n\tt0 := time.Unix(0, 1480437867192070480)\n\tfor i := 0; i < numCommits; i++ {\n\t\tgb.AddGen(f)\n\t\tts := t0.Add(time.Duration(int64(5) * int64(i) * int64(time.Second)))\n\t\th := gb.CommitMsgAt(fmt.Sprintf(\"C%d\", i), ts)\n\t\tcommits = append(commits, h)\n\t}\n\n\ttmp, err := ioutil.TempDir(\"\", \"\")\n\tassert.NoError(t, err)\n\trepo, err := repograph.NewGraph(gb.Dir(), tmp)\n\tassert.NoError(t, err)\n\treturn gb.Dir(), repo, commits, func() {\n\t\tgb.Cleanup()\n\t\ttestutils.RemoveAll(t, tmp)\n\t}\n}", "title": "" }, { "docid": "7ce0cc340baedd6b6e74dfc6f8fa8532", "score": "0.5072171", "text": "func (g *GS) UpdateGitViaGit(c *DeployCmd, response UploadResponse) error {\n\tapp, err := api.Application(c.AccountID, c.AppID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"[DEBUG] Cloning: https://aperture.section.io/account/%d/application/%d/%s.git ...\\n\", c.AccountID, c.AppID, app.ApplicationName)\n\ttempDir, err := ioutil.TempDir(\"\", \"sectinoctl-*\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Println(\"[Debug] tempDir: \", tempDir)\n\t// Git objects storer based on memory\n\tgitAuth := &gitHTTP.BasicAuth{\n\t\tUsername: \"section-token\", // yes, this can be anything except an empty string\n\t\tPassword: api.Token,\n\t}\n\tpayload := PayloadValue{ID: response.PayloadID}\n\tr, err := git.PlainClone(tempDir, false, &git.CloneOptions{\n\t\tURL: fmt.Sprintf(\"https://aperture.section.io/account/%d/application/%d/%s.git\", c.AccountID, c.AppID, app.ApplicationName),\n\t\tAuth: gitAuth,\n\t\tProgress: os.Stdout,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// ... retrieving the branch being pointed by HEAD\n\tref, err := r.Head()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// ... retrieving the commit object\n\tcommit, err := r.CommitObject(ref.Hash())\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Println(\"[DEBUG] HEAD commit: \", commit)\n\t// ... retrieve the tree from the commit\n\ttree, err := commit.Tree()\n\tif err != nil {\n\t\treturn err\n\t}\n\tw, err := r.Worktree()\n\tif err != nil {\n\t\treturn err\n\t}\n\tf, err := tree.File(c.AppPath + \"/.section-external-source.json\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tsrcContent := PayloadValue{}\n\tcontent, err := f.Contents()\n\tif err != nil {\n\t\treturn nil\n\t}\n\terr = json.Unmarshal([]byte(content), &srcContent)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to unmarshal json: %w\", err)\n\t}\n\tct, err := f.Contents()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"couldn't open contents of file: %w\", err)\n\t}\n\tlog.Println(\"[DEBUG] Old external source contents: \", ct)\n\tlog.Println(\"[DEBUG] expected new tarball UUID: \", response.PayloadID)\n\tsrcContent.ID = payload.ID\n\tpl, err := json.MarshalIndent(srcContent, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = ioutil.WriteFile(filepath.Join(tempDir, c.AppPath+\"/.section-external-source.json\"), pl, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = w.Add(c.AppPath + \"/.section-external-source.json\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstatus, err := w.Status()\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Println(\"[DEBUG] git status: \", status)\n\t_, err = w.Add(c.AppPath + \"/.section-external-source.json\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tcommitHash, err := w.Commit(\"[sectionctl] updated nodejs/.section-external-source.json with new deployment.\", &git.CommitOptions{Author: &object.Signature{\n\t\tName: \"sectionctl\",\n\t\tEmail: \"noreply@section.io\",\n\t\tWhen: time.Now(),\n\t}})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to make a commit on the temporary repository: %w\", err)\n\t}\n\tcmt, err := r.CommitObject(commitHash)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get commit object: %w\", err)\n\t}\n\tlog.Println(\"[DEBUG] New Commit: \", cmt.String())\n\tnewTree, err := cmt.Tree()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewF, err := newTree.File(c.AppPath + \"/.section-external-source.json\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctt, err := newF.Contents()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not open conetnts of new file in git: %w\", err)\n\t}\n\tlog.Println(\"[DEBUG] contents in new commit: \", ctt)\n\terr = r.Push(&git.PushOptions{Auth: gitAuth, Progress: os.Stdout})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to push git changes: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3a6a36af3bd266fcef5cd72e6fb4b0d1", "score": "0.5067127", "text": "func (r *Repository) clone(ctx context.Context, o *CloneOptions) error {\n\tif err := o.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tc := &config.RemoteConfig{\n\t\tName: o.RemoteName,\n\t\tURLs: []string{o.URL},\n\t\tFetch: r.cloneRefSpec(o),\n\t}\n\n\tif _, err := r.CreateRemote(c); err != nil {\n\t\treturn err\n\t}\n\n\tref, err := r.fetchAndUpdateReferences(ctx, &FetchOptions{\n\t\tRefSpecs: c.Fetch,\n\t\tDepth: o.Depth,\n\t\tAuth: o.Auth,\n\t\tProgress: o.Progress,\n\t\tTags: o.Tags,\n\t\tRemoteName: o.RemoteName,\n\t}, o.ReferenceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif r.wt != nil && !o.NoCheckout {\n\t\tw, err := r.Worktree()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thead, err := r.Head()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := w.Reset(&ResetOptions{\n\t\t\tMode: MergeReset,\n\t\t\tCommit: head.Hash(),\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif o.RecurseSubmodules != NoRecurseSubmodules {\n\t\t\tif err := w.updateSubmodules(&SubmoduleUpdateOptions{\n\t\t\t\tRecurseSubmodules: o.RecurseSubmodules,\n\t\t\t\tAuth: o.Auth,\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := r.updateRemoteConfigIfNeeded(o, c, ref); err != nil {\n\t\treturn err\n\t}\n\n\tif ref.Name().IsBranch() {\n\t\tbranchRef := ref.Name()\n\t\tbranchName := strings.Split(string(branchRef), \"refs/heads/\")[1]\n\n\t\tb := &config.Branch{\n\t\t\tName: branchName,\n\t\t\tMerge: branchRef,\n\t\t}\n\t\tif o.RemoteName == \"\" {\n\t\t\tb.Remote = \"origin\"\n\t\t} else {\n\t\t\tb.Remote = o.RemoteName\n\t\t}\n\t\tif err := r.CreateBranch(b); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f9c9e694715ece631f6f3df5f3785564", "score": "0.5061289", "text": "func main() {\n\tif len(os.Args) == 1 {\n\t\tfmt.Fprint(os.Stderr, \"not enough input\\n\")\n\t\tos.Exit(1)\n\t}\n\tverb := os.Args[1]\n\n\tswitch verb {\n\tcase \"search\": // read\n\t\tresp, _ := github2.SearchIssues(os.Args[2:])\n\t\tfor _, item := range resp.Items {\n\t\t\tfmt.Printf(\"%8d\\t%.20s...\\t%15s\\n\", item.Number, item.Title, item.User.Login)\n\t\t}\n\tcase \"create\":\n\t\tvar owner, repo string\n\n\t\tfmt.Printf(\"Please enter the repo owner: \")\n\t\t_, err := fmt.Scanln(&owner)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tfmt.Printf(\"Please enter the repo name: \")\n\t\t_, err = fmt.Scanln(&repo)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tresp := github2.CreateIssue(owner, repo)\n\t\tfmt.Println(resp)\n\tdefault:\n\t\tfmt.Fprint(os.Stderr, \"%s is not a recognised command: usage create/read/update/close\\n\", verb)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "a133a9a33b7ab566637e571b658794a3", "score": "0.50542593", "text": "func generateCommand(c *cli.Context) error {\n\tversionFile := c.String(flagFile)\n\tchangelogFile := c.String(flagChangelog)\n\tcwd, err := getCwd(c)\n\tif err != nil {\n\t\treturn cli.NewExitError(err, 1)\n\t}\n\tlog.Infof(\"working in dir: %s\", cwd)\n\tversionPath := path.Join(cwd, versionFile)\n\tchangelogfile := path.Join(cwd, changelogFile)\n\texecDir(cwd, \"git\", \"fetch\", \"--all\")\n\tchangelog, nextVersion, err := generateReleaseAndChangelog(cwd, versionFile, changelog.DefaultFormatFunc)\n\tif err != nil {\n\t\treturn cli.NewExitError(err, 4)\n\t}\n\tcurrentChangelog, err := ioutil.ReadFile(changelogfile)\n\t_, ok := err.(*os.PathError)\n\tif err != nil && !ok {\n\t\treturn cli.NewExitError(err, 5)\n\t}\n\tif nextVersion == nil {\n\t\treturn cli.NewExitError(errors.New(\"could not calculate next version\"), 6)\n\t}\n\terr = ioutil.WriteFile(changelogfile, []byte(fmt.Sprintf(\"%s\\n\\n\\n%s\", changelog, currentChangelog)), os.ModePerm)\n\tif err != nil {\n\t\treturn cli.NewExitError(err, 7)\n\t}\n\terr = ioutil.WriteFile(versionPath, []byte(nextVersion.String()), os.ModePerm)\n\tif err != nil {\n\t\treturn cli.NewExitError(err, 8)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f1ae6d891787570b9bc050a6a07d1fcc", "score": "0.50482", "text": "func NewRepo(dir, srcURL, dstURL, importPath string, dash bool) (*Repo, error) {\n\tvar root string\n\tif importPath == \"\" {\n\t\troot = filepath.Join(dir, \"go\")\n\t} else {\n\t\troot = filepath.Join(dir, path.Base(importPath))\n\t}\n\tr := &Repo{\n\t\tpath: importPath,\n\t\troot: root,\n\t\tcommits: make(map[string]*Commit),\n\t\tbranches: make(map[string]*Branch),\n\t\tmirror: dstURL != \"\",\n\t\tdash: dash,\n\t}\n\n\tneedClone := true\n\tif r.shouldTryReuseGitDir(dstURL) {\n\t\tcmd := exec.Command(\"git\", \"fetch\", \"--all\")\n\t\tcmd.Dir = r.root\n\t\tr.logf(\"running git fetch --all\")\n\t\tt0 := time.Now()\n\t\tvar stderr bytes.Buffer\n\t\tcmd.Stderr = &stderr\n\t\terr := cmd.Run()\n\t\tif err != nil {\n\t\t\tr.logf(\"git fetch --all failed; proceeding to wipe + clone instead; err: %v, stderr: %s\", err, stderr.Bytes())\n\t\t} else {\n\t\t\tneedClone = false\n\t\t\tr.logf(\"ran git fetch --all in %v\", time.Since(t0))\n\t\t}\n\t}\n\tif needClone {\n\t\tos.RemoveAll(r.root)\n\t\tt0 := time.Now()\n\t\tr.logf(\"cloning %v\", srcURL)\n\t\tcmd := exec.Command(\"git\", \"clone\", \"--mirror\", srcURL, r.root)\n\t\tif out, err := cmd.CombinedOutput(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cloning %s: %v\\n\\n%s\", srcURL, err, out)\n\t\t}\n\t\tr.logf(\"cloned in %v\", time.Since(t0))\n\t}\n\n\tif r.mirror {\n\t\tif err := r.addRemote(\"dest\", dstURL); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"adding remote: %v\", err)\n\t\t}\n\t\tr.logf(\"initial push to %v\", dstURL)\n\t\tif err := r.push(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif r.dash {\n\t\tr.logf(\"loading commit log\")\n\t\tif err := r.update(false); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tr.logf(\"found %v branches among %v commits\\n\", len(r.branches), len(r.commits))\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "97b53ec85b494cf5366ce5fb9a0d2f87", "score": "0.5042912", "text": "func (git Client) Commit(message, user, email string) error {\n\t// Note, this used to do runGitCmd(diffCtx, git.dir, \"diff\", \"--cached\", \"--quiet\", \"--\", fi.opts.gitFluxPath); err == nil {\n\tif err := git.runGitCmd(\"diff\", \"--cached\", \"--quiet\"); err == nil {\n\t\tlogger.Info(\"Nothing to commit (the repository contained identical files), moving on\")\n\t\treturn nil\n\t} else if _, ok := err.(*exec.ExitError); !ok {\n\t\treturn err\n\t}\n\n\t// If the username and email have been provided, configure and use these as\n\t// otherwise, git will rely on the global configuration, which may lead to\n\t// confusion at best, as a different username/email will be used, or if\n\t// missing (e.g.: in CI, in a blank environment), will fail with:\n\t// *** Please tell me who you are.\n\t// [...]\n\t// fatal: unable to auto-detect email address (got '[...]')\n\t// N.B.: we do it before committing, instead of after cloning, as other\n\t// operations will not fail because of missing configuration, and as we may\n\t// commit on a repository we haven't cloned ourselves.\n\tif email != \"\" {\n\t\tif err := git.runGitCmd(\"config\", \"user.email\", email); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif user != \"\" {\n\t\tif err := git.runGitCmd(\"config\", \"user.name\", user); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Commit\n\targs := []string{\"commit\",\n\t\t\"-m\", message,\n\t\tfmt.Sprintf(\"--author=%s <%s>\", user, email),\n\t}\n\tif err := git.runGitCmd(args...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2ecbb83b2aec86f8b2f4c80392e2ca51", "score": "0.5039026", "text": "func (a *ARC) PullFile(ctx context.Context, src, dst string) error {\n\treturn adbCommand(ctx, \"pull\", src, dst).Run()\n}", "title": "" }, { "docid": "0af7639f35945089079c4ffc8a3c7f76", "score": "0.5033607", "text": "func (r *Repository) Command(args ...string) *exec.Cmd {\n\tcmd := exec.Command(\"git\", args...)\n\tcmd.Dir = r.dir\n\treturn cmd\n}", "title": "" }, { "docid": "4573ecfc625beb932d4955e39a5756d9", "score": "0.5033417", "text": "func run(ctx context.Context, e *env, c storage.BucketHandle) error {\n\tc := context{}\n\ts := gub.JobStatus{}\n\n\tc.blogf(\"> Cloning: %s/%s\", e.RepoOwner, e.RepoName)\n\tc.sh(\"git\", \"clone\", fmt.Sprintf(\"https://github.com/%s/%s.git\", e.RepoOwner, e.RepoName))\n\tc.sh(\"cd\", e.RepoName)\n\tc.blogf(\"git fetch origin pull/%s/head:prow\", e.PullNumber)\n\tc.sh(\"git\", \"checkout\", \"prow\")\n\tc.sh(\"mkdir\", \"/artifacts\")\n\tout := c.sh(fmt.Sprintf(\"./jobs/%s.sh\", e.JobName));\n\tif err := writeObject(b, jobPath(e), bytes.NewReader(out)); err != nil {\n\t\treturn fmt.Errorf(\"writeObject error: %v\", err)\n\t}\n\n\n\n}", "title": "" } ]
ffdaea19db5a6f0af8ba45a9aa7377f9
RunCommand runs a command on one or more ec2 instances.
[ { "docid": "3261554357d960ad7227c2e4c3934300", "score": "0.6082556", "text": "func RunCommand(search, command string, dryRun bool) (*CommandInvocations, error) {\n\n\t// --dry-run flag\n\tif dryRun {\n\t\tterminal.Information(\"--dry-run flag is set, not making any actual changes!\")\n\t}\n\n\tinstList, errs := GetSSMInstances(search)\n\tif errs != nil {\n\t\treturn &CommandInvocations{}, errors.New(\"Error gathering Instance list\")\n\t}\n\n\tif len(*instList) > 0 {\n\t\t// Print the table\n\t\tinstList.PrintTable()\n\t} else {\n\t\treturn &CommandInvocations{}, errors.New(\"No SSM Instances found matching your search term, Aborting!\")\n\t}\n\n\t// Confirm\n\tif !terminal.PromptBool(\"Are you sure you want to run the command [\" + command + \"] on these instances?\") {\n\t\treturn &CommandInvocations{}, errors.New(\"Aborting!\")\n\t}\n\n\t// Run Em\n\tcommandInvocations, err := runCommand(instList, command, dryRun)\n\tif err != nil {\n\t\treturn commandInvocations, err\n\t}\n\n\tterminal.Information(\"Done!\")\n\n\treturn commandInvocations, nil\n}", "title": "" } ]
[ { "docid": "89ee9e0f822c3b69086ea300932889b2", "score": "0.7126577", "text": "func runCommand(instList *SSMInstances, command string, dryRun bool) (*CommandInvocations, error) {\n\n\tregionInstanceIds := make(map[string][]string)\n\tregionInstanceNames := make(map[string][]string)\n\n\tfor _, instance := range *instList {\n\t\tregionInstanceIds[instance.Region] = append(regionInstanceIds[instance.Region], instance.InstanceID)\n\t\tregionInstanceNames[instance.Region] = append(regionInstanceNames[instance.Region], instance.Name)\n\t}\n\n\tcmdInvocationsCombined := new(CommandInvocations)\n\n\t// Bail if on a dryRun\n\t// TODO more\n\tif dryRun {\n\t\treturn cmdInvocationsCombined, nil\n\t}\n\n\tvar wg sync.WaitGroup\n\tfor region, instanceIds := range regionInstanceIds {\n\t\twg.Add(1)\n\n\t\tterminal.Delta(\"Sending Command [\" + command + \"] to instances [\" + strings.Join(regionInstanceNames[region], \", \") + \"] in [\" + region + \"]!\")\n\n\t\tgo func(region string, instanceIds []string, command string) {\n\t\t\tdefer wg.Done()\n\t\t\tsess := session.Must(session.NewSession(&aws.Config{Region: aws.String(region)}))\n\t\t\tsvc := ssm.New(sess)\n\n\t\t\tparams := &ssm.SendCommandInput{\n\t\t\t\tDocumentName: aws.String(\"AWS-RunShellScript\"),\n\t\t\t\tInstanceIds: aws.StringSlice(instanceIds),\n\n\t\t\t\tParameters: map[string][]*string{\n\t\t\t\t\t\"commands\": {\n\t\t\t\t\t\taws.String(command),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tComment: aws.String(\"awsm sendCommand: \" + command),\n\t\t\t}\n\n\t\t\tresp, err := svc.SendCommand(params)\n\t\t\tif err != nil {\n\t\t\t\tterminal.ErrorLine(err.Error())\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tterminal.Information(\"Sent Command [\" + command + \"] [\" + aws.StringValue(resp.Command.CommandId) + \"] to instances [\" + strings.Join(regionInstanceNames[region], \", \") + \"] in [\" + region + \"]!\")\n\t\t\t}\n\n\t\t\ttargetCount := int(aws.Int64Value(resp.Command.TargetCount))\n\n\t\t\tfor {\n\t\t\t\tcmdInvocations, err := GetRegionCommandInvocationsByCommandID(region, aws.StringValue(resp.Command.CommandId), true)\n\t\t\t\tif err != nil {\n\t\t\t\t\tterminal.ErrorLine(err.Error())\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif len(cmdInvocations) != targetCount || !cmdInvocations.Finished() {\n\t\t\t\t\tterminal.Notice(\"Waiting for response from [\" + region + \"]..\")\n\t\t\t\t\ttime.Sleep(time.Second * 10)\n\t\t\t\t} else {\n\t\t\t\t\tterminal.Information(\"Recieved a response from [\" + region + \"]!\")\n\t\t\t\t\t*cmdInvocationsCombined = append(*cmdInvocationsCombined, cmdInvocations...)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t}(region, instanceIds, command)\n\t}\n\n\twg.Wait()\n\n\treturn cmdInvocationsCombined, nil\n}", "title": "" }, { "docid": "45cf395d94454acd1ed7b4f5fc6b16c7", "score": "0.62020457", "text": "func (c *cmdAction) Run(cmd *cobra.Command, args []string) error {\n\tconf := c.global.conf\n\n\tvar names []string\n\tif c.flagAll {\n\t\t// If no server passed, use current default.\n\t\tif len(args) == 0 {\n\t\t\targs = []string{fmt.Sprintf(\"%s:\", conf.DefaultRemote)}\n\t\t}\n\n\t\t// Get all the servers.\n\t\tresources, err := c.global.ParseServers(args...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, resource := range resources {\n\t\t\t// We don't allow instance names with --all.\n\t\t\tif resource.name != \"\" {\n\t\t\t\treturn fmt.Errorf(i18n.G(\"Both --all and instance name given\"))\n\t\t\t}\n\n\t\t\t// See if we can use the bulk API.\n\t\t\tif resource.server.HasExtension(\"instance_bulk_state_change\") {\n\t\t\t\terr = c.doActionAll(cmd.Name(), resource)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"%s: %w\", resource.remote, err)\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tctslist, err := resource.server.GetInstances(api.InstanceTypeAny)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, ct := range ctslist {\n\t\t\t\tswitch cmd.Name() {\n\t\t\t\tcase \"start\":\n\t\t\t\t\tif ct.StatusCode == api.Running {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\tcase \"stop\":\n\t\t\t\t\tif ct.StatusCode == api.Stopped {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnames = append(names, fmt.Sprintf(\"%s:%s\", resource.remote, ct.Name))\n\t\t\t}\n\t\t}\n\t} else {\n\t\tnames = args\n\n\t\tif len(args) == 0 {\n\t\t\t_ = cmd.Usage()\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tif c.flagConsole != \"\" {\n\t\tif c.flagAll {\n\t\t\treturn fmt.Errorf(i18n.G(\"--console can't be used with --all\"))\n\t\t}\n\n\t\tif len(names) != 1 {\n\t\t\treturn fmt.Errorf(i18n.G(\"--console only works with a single instance\"))\n\t\t}\n\t}\n\n\t// Run the action for every listed instance\n\tresults := runBatch(names, func(name string) error { return c.doAction(cmd.Name(), conf, name) })\n\n\t// Single instance is easy\n\tif len(results) == 1 {\n\t\treturn results[0].err\n\t}\n\n\t// Do fancier rendering for batches\n\tsuccess := true\n\n\tfor _, result := range results {\n\t\tif result.err == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tsuccess = false\n\t\tmsg := fmt.Sprintf(i18n.G(\"error: %v\"), result.err)\n\t\tfor _, line := range strings.Split(msg, \"\\n\") {\n\t\t\tfmt.Fprintf(os.Stderr, \"%s: %s\\n\", result.name, line)\n\t\t}\n\t}\n\n\tif !success {\n\t\tfmt.Fprintln(os.Stderr, \"\")\n\t\treturn fmt.Errorf(i18n.G(\"Some instances failed to %s\"), cmd.Name())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "670db8caf22711d21f4a788e056783fc", "score": "0.57749546", "text": "func RunOnInstances(ctx context.Context, re *regexp.Regexp, cmd []string) (map[string]map[string]*result, error) {\n\tresults := map[string]map[string]*result{}\n\tpool := workerpool.New(50)\n\tfor _, zone := range gce.VALID_ZONES {\n\t\tg, err := gce.NewLocalGCloud(gce.PROJECT_ID_SERVER, zone)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ts := g.Service()\n\t\tcall := s.Instances.List(gce.PROJECT_ID_SERVER, zone)\n\t\tinstances := []string{}\n\t\tif err := call.Pages(ctx, func(list *compute.InstanceList) error {\n\t\t\tfor _, i := range list.Items {\n\t\t\t\tif re.MatchString(i.Name) {\n\t\t\t\t\tinstances = append(instances, i.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tzoneResults := map[string]*result{}\n\t\tresults[zone] = zoneResults\n\t\tmtx := sync.Mutex{}\n\t\tfor _, i := range instances {\n\t\t\t// Alias these vars to prevent them changing from under us.\n\t\t\tinstance := i\n\t\t\tres := zoneResults\n\t\t\tpool.Go(func() {\n\t\t\t\t// TODO(borenet): We can't determine the OS using the API. We will\n\t\t\t\t// fail to SSH into Windows instances.\n\t\t\t\tvm := &gce.Instance{\n\t\t\t\t\tName: instance,\n\t\t\t\t\tOs: gce.OS_LINUX,\n\t\t\t\t\tUser: \"default\",\n\t\t\t\t}\n\t\t\t\tout, err := g.Ssh(ctx, vm, cmd...)\n\t\t\t\tr := &result{}\n\t\t\t\tif err != nil {\n\t\t\t\t\tr.Error = err.Error()\n\t\t\t\t} else {\n\t\t\t\t\tr.Output = out\n\t\t\t\t}\n\t\t\t\tmtx.Lock()\n\t\t\t\tdefer mtx.Unlock()\n\t\t\t\tres[instance] = r\n\t\t\t})\n\t\t}\n\t}\n\tpool.Wait()\n\treturn results, nil\n}", "title": "" }, { "docid": "d42a237e3f4de8aeacb48b4aafc7fd73", "score": "0.568336", "text": "func ExampleEC2_RunInstances_shared00() {\n\tsvc := ec2.New(session.New())\n\tinput := &ec2.RunInstancesInput{\n\t\tBlockDeviceMappings: []*ec2.BlockDeviceMapping{\n\t\t\t{\n\t\t\t\tDeviceName: aws.String(\"/dev/sdh\"),\n\t\t\t\tEbs: &ec2.EbsBlockDevice{\n\t\t\t\t\tVolumeSize: aws.Int64(100),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tImageId: aws.String(\"ami-abc12345\"),\n\t\tInstanceType: aws.String(\"t2.micro\"),\n\t\tKeyName: aws.String(\"my-key-pair\"),\n\t\tMaxCount: aws.Int64(1),\n\t\tMinCount: aws.Int64(1),\n\t\tSecurityGroupIds: []*string{\n\t\t\taws.String(\"sg-1a2b3c4d\"),\n\t\t},\n\t\tSubnetId: aws.String(\"subnet-6e7f829e\"),\n\t\tTagSpecifications: []*ec2.TagSpecification{\n\t\t\t{\n\t\t\t\tResourceType: aws.String(\"instance\"),\n\t\t\t\tTags: []*ec2.Tag{\n\t\t\t\t\t{\n\t\t\t\t\t\tKey: aws.String(\"Purpose\"),\n\t\t\t\t\t\tValue: aws.String(\"test\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tresult, err := svc.RunInstances(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tdefault:\n\t\t\t\tfmt.Println(aerr.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t\t// Message from an error.\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tfmt.Println(result)\n}", "title": "" }, { "docid": "54215f14ebacd5ab4e9a402fe3e9a141", "score": "0.5669446", "text": "func runCommand(cmd *cobra.Command, args []string, callType string) error {\n\tif instanceID == \"\" {\n\t\treturn errors.New(\"instance-id cannot be empty\")\n\t}\n\n\tcmdID, err := awsCmds.SSMSendCmd(true, instanceID, commandString)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Problem making SSM Command Request\")\n\t}\n\n\ttime.Sleep(1 * time.Second)\n\tcmdInfo, err := awsCmds.SSMGetCmd(instanceID, cmdID)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Problem initially getting SSM Command Invocation\")\n\t}\n\n\tvar loopCounter int\n\n\tfor {\n\t\tif cmdInfo.CommandStatus == \"Success\" {\n\t\t\tbreak\n\t\t} else if cmdInfo.CommandStatus == \"Failed\" {\n\t\t\tfmt.Println(\"Command Failed\")\n\t\t\tbreak\n\t\t\t// return errors.New(\"Get Command Invocation Failed\")\n\t\t}\n\n\t\tif loopCounter == 150 {\n\t\t\tfmt.Println(\"Request taking too long to process\")\n\t\t\tfmt.Println(\"Status:\", cmdInfo.CommandStatus)\n\t\t\treturn errors.New(\"get command invocation timed out\")\n\t\t}\n\n\t\t// have to create a new request each time\n\t\tcmdInfo, err = awsCmds.SSMGetCmd(instanceID, cmdID)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Problem getting SSM Command Invocation in loop\")\n\t\t}\n\t\t// user output to see how many checks are needed\n\t\tfmt.Fprint(os.Stderr, \".\")\n\t\tloopCounter++\n\t\t// wait 2 seconds between each check\n\t\ttime.Sleep(2 * time.Second)\n\t}\n\n\tfmt.Println(\"\\nCommand ID:\\t\", cmdInfo.CommandID)\n\tfmt.Println(\"Instance ID:\\t\", cmdInfo.InstanceID)\n\tfmt.Println(\"Command Status:\\t\", cmdInfo.CommandStatus)\n\tfmt.Printf(\"----Output----\\nSTDOUT:\\n%s\\nSTDERR:\\n%s\\n\", cmdInfo.StdOut, cmdInfo.StdErr)\n\treturn nil\n}", "title": "" }, { "docid": "33a8add712b1f9e86ed0d10220ef0390", "score": "0.5563303", "text": "func InstanceCommands() *cobra.Command {\n\tvar targetCloud, projectID, zone string\n\tvar ports []string\n\n\tvar cmdInstance = &cobra.Command{\n\t\tUse: \"instance\",\n\t\tShort: \"manage nanos instances\",\n\t\tValidArgs: []string{\"create\", \"list\", \"delete\", \"stop\", \"start\", \"logs\"},\n\t\tArgs: cobra.OnlyValidArgs,\n\t}\n\n\tcmdInstance.PersistentFlags().StringArrayVarP(&ports, \"port\", \"p\", nil, \"port to open\")\n\tcmdInstance.PersistentFlags().StringVarP(&targetCloud, \"target-cloud\", \"t\", \"onprem\", \"cloud platform [gcp, aws, onprem, vultr, vsphere, azure]\")\n\tcmdInstance.PersistentFlags().StringVarP(&projectID, \"projectid\", \"g\", os.Getenv(\"GOOGLE_CLOUD_PROJECT\"), \"project-id for GCP or set env GOOGLE_CLOUD_PROJECT\")\n\tcmdInstance.PersistentFlags().StringVarP(&zone, \"zone\", \"z\", os.Getenv(\"GOOGLE_CLOUD_ZONE\"), \"zone name for GCP or set env GOOGLE_CLOUD_ZONE\")\n\tcmdInstance.AddCommand(instanceCreateCommand())\n\tcmdInstance.AddCommand(instanceListCommand())\n\tcmdInstance.AddCommand(instanceDeleteCommand())\n\tcmdInstance.AddCommand(instanceStopCommand())\n\tcmdInstance.AddCommand(instanceStartCommand())\n\tcmdInstance.AddCommand(instanceLogsCommand())\n\n\treturn cmdInstance\n}", "title": "" }, { "docid": "a3f513a9c8ed9a435f9c27850f2564b3", "score": "0.5558452", "text": "func main() {\n\tcfg, err := external.LoadDefaultAWSConfig()\n\tif err != nil {\n\t\texitErrorf(\"failed to load config, %v\", err)\n\t}\n\n\tnameFilter := os.Args[1]\n\tawsRegion := \"us-east-1\"\n\n\tcfg.Region = awsRegion\n\tsvc := ec2.New(cfg)\n\n\tfmt.Printf(\"listing instances with tag %v in: %v\\n\", nameFilter, awsRegion)\n\tparams := &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\tstrings.Join([]string{\"*\", nameFilter, \"*\"}, \"\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\treq := svc.DescribeInstancesRequest(params)\n\tresp, err := req.Send()\n\tif err != nil {\n\t\texitErrorf(\"failed to describe instances, %s, %v\", awsRegion, err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", *resp)\n}", "title": "" }, { "docid": "aaa9713dba6b2b0a06233a6f9f647aa7", "score": "0.5488884", "text": "func (drv Driver) RunCommand(args []string) error {\n\treturn drv.SSHClient.RunCommand(args)\n}", "title": "" }, { "docid": "5f8ef31e2e6ed0749f41335c98feb56b", "score": "0.54234153", "text": "func ListEc2Instances(instanceNameFilter string) {\n\tresp := listEc2Instances()\n\n\tfor i := 0; i < len(resp.Reservations); i++ {\n\t\tfor j := 0; j < len(resp.Reservations[i].Instances); j++ {\n\t\t\tinstance := resp.Reservations[i].Instances[j]\n\n\t\t\tif *instance.State.Name == \"running\" {\n\t\t\t\tinstanceName := getName(instance.Tags)\n\n\t\t\t\tif instanceNameFilter == \"\" || instanceNameFilter == instanceName {\n\t\t\t\t\tif verboseLevel == 2 {\n\t\t\t\t\t\tif instance.PublicIpAddress != nil {\n\t\t\t\t\t\t\tfmt.Printf(\"%s %s %s: %s \\n\", tabs(18, *instance.PublicIpAddress), tabs(30, instanceName), *instance.InstanceId, *instance.State.Name)\n\t\t\t\t\t\t} else if instance.PrivateIpAddress != nil {\n\t\t\t\t\t\t\tfmt.Printf(\"%s %s %s: %s \\n\", tabs(18, \"(\"+*instance.PrivateIpAddress+\")\"), tabs(30, instanceName), *instance.InstanceId, *instance.State.Name)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfmt.Printf(\"%s, %s: %s \\n\", instanceName, *instance.InstanceId, *instance.State.Name)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if verboseLevel == 1 {\n\t\t\t\t\t\tfmt.Println(instanceName)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Println(*instance.InstanceId)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c9607d436e0f8d87055419f651eda3b2", "score": "0.5423195", "text": "func (c *CVMClient) RunInstances(req *cvm.RunInstancesRequest) (*cvm.RunInstancesResponse, error) {\n\tres, err := c.client.RunInstances(req)\n\tif err != nil {\n\t\tif terr, ok := err.(*tcerr.TencentCloudSDKError); ok {\n\t\t\treturn nil, fmt.Errorf(\"api error: %s\", terr)\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "4a558c351868d68269e31a17d159ddea", "score": "0.5349176", "text": "func addInstancesCLI(cmds *cobra.Command, out io.Writer) {\n\tcmdRunInstance := &cobra.Command{\n\t\tUse: \"runinstance name\",\n\t\tShort: \"Create an instance\",\n\t\tLong: \"Create an instance with flag parameters. Output error or instance/eip IDs\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\texecRunInstance(cmd, args, getAnchnetClient(cmd), out)\n\t\t},\n\t}\n\tvar cpu, memory, amount, bandwidth int\n\tvar passwd, image_id, ip_group string\n\tcmdRunInstance.Flags().IntVarP(&cpu, \"cpu\", \"c\", 1, \"Number of cpu cores\")\n\tcmdRunInstance.Flags().IntVarP(&amount, \"amount\", \"a\", 1, \"Number of instances to run\")\n\tcmdRunInstance.Flags().IntVarP(&memory, \"memory\", \"m\", 1024, \"Number of memory in MB\")\n\tcmdRunInstance.Flags().IntVarP(&bandwidth, \"bandwidth\", \"b\", 1, \"Public network bandwidth, in MB/s\")\n\tcmdRunInstance.Flags().StringVarP(&passwd, \"passwd\", \"p\", \"caicloud2015ABC\", \"Login password for new instance\")\n\tcmdRunInstance.Flags().StringVarP(&image_id, \"image-id\", \"i\", \"trustysrvx64c\", \"Image ID used to create new instance\")\n\tcmdRunInstance.Flags().StringVarP(&ip_group, \"ip-group\", \"g\", \"eipg-00000000\", \"IP group of the newly created eip\")\n\n\tcmdDescribeInstance := &cobra.Command{\n\t\tUse: \"describeinstance id\",\n\t\tShort: \"Get information of an instance by id\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\texecDescribeInstance(cmd, args, getAnchnetClient(cmd), out)\n\t\t},\n\t}\n\n\tcmdSearchInstance := &cobra.Command{\n\t\tUse: \"searchinstance name\",\n\t\tShort: \"Search instances by name\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\texecSearchInstance(cmd, args, getAnchnetClient(cmd), out)\n\t\t},\n\t}\n\tvar status string\n\tcmdSearchInstance.Flags().StringVarP(&status, \"status\", \"s\", \"running\",\n\t\t\"Comman separated string of status used to search instance: running, pending, stopped, suspended\")\n\n\tcmdTerminateInstances := &cobra.Command{\n\t\tUse: \"terminateinstances ids\",\n\t\tShort: \"Terminate a comma separated list of instances\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\texecTerminateInstances(cmd, args, getAnchnetClient(cmd), out)\n\t\t},\n\t}\n\n\tcmdStartInstances := &cobra.Command{\n\t\tUse: \"startinstances ids\",\n\t\tShort: \"Start a comma separated list of instances\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\texecStartInstances(cmd, args, getAnchnetClient(cmd), out)\n\t\t},\n\t}\n\n\tcmdStopInstances := &cobra.Command{\n\t\tUse: \"stopinstances ids\",\n\t\tShort: \"Stop a comma separated list of instances\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\texecStopInstances(cmd, args, getAnchnetClient(cmd), out)\n\t\t},\n\t}\n\n\t// Add all sub-commands.\n\tcmds.AddCommand(cmdRunInstance)\n\tcmds.AddCommand(cmdDescribeInstance)\n\tcmds.AddCommand(cmdSearchInstance)\n\tcmds.AddCommand(cmdTerminateInstances)\n\tcmds.AddCommand(cmdStartInstances)\n\tcmds.AddCommand(cmdStopInstances)\n}", "title": "" }, { "docid": "855005f5f1b13c5137170b5367a50d35", "score": "0.5285963", "text": "func remoteRunCommand(ssh *easyssh.MakeConfig, command string) {\n\n\tfmt.Print(\"Running command \" + \"'\" + command + \"' on \" + ssh.User + \"@\" + ssh.Server + \"... \")\n\t_, _, _, err := ssh.Run(command, 5)\n\tdms3libs.CheckErr(err)\n\tfmt.Println(\"Success\")\n\n}", "title": "" }, { "docid": "90085c57071b316d3d557d54f87bcf5b", "score": "0.52175677", "text": "func (ctl *TcaCtl) CmdUpdateInstances() *cobra.Command {\n\n\tvar (\n\t\tdisableGrant bool\n\t\tignoreGrantFailure bool\n\t\tdisableAutoRollback bool\n\t\tdoBlock bool\n\t\tshowProgress bool\n\t\t_targetPool = \"\"\n\t)\n\n\t// cnf instances\n\tvar updateInstance = &cobra.Command{\n\t\tUse: \"instantiate [instance name or id]\",\n\t\tShort: \"Updates CNF or VNF instance state.\",\n\t\tLong: templates.LongDesc(`\n\nUpdates CNF or VNF instance state, need to provide id or name of\nof the instance. --block provides option to block and \nwait when task will finished.\n\n`),\n\t\tExample: \"\\t - tcactl update cnf up testapp\\n\" +\n\t\t\t\"\\t - tcactl update cnf up --stderrthreshold INFO --block --pool my_pool01\\n\",\n\t\tAliases: []string{\"up\"},\n\t\tArgs: cobra.MinimumNArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\n\t\t\tctl.checkDefaultsConfig()\n\n\t\t\t// block or not call\n\t\t\tdoBlock, err := cmd.Flags().GetBool(CliBlock)\n\t\t\tCheckErrLogError(err)\n\n\t\t\t// resolve pool id, if client indicated target pool\n\t\t\tpoolName := cmd.Flags().Lookup(CliPool)\n\n\t\t\treq := api.CreateInstanceApiReq{\n\t\t\t\tInstanceName: args[0],\n\t\t\t\tPoolName: poolName.Value.String(),\n\t\t\t\tVimName: ctl.DefaultClusterName,\n\t\t\t\tClusterName: ctl.DefaultClusterName,\n\t\t\t\tIsBlocking: doBlock,\n\t\t\t\tIsVerbose: showProgress,\n\t\t\t\tAdditionalParam: &specs.AdditionalParams{\n\t\t\t\t\tDisableGrant: disableGrant,\n\t\t\t\t\tIgnoreGrantFailure: ignoreGrantFailure,\n\t\t\t\t\tDisableAutoRollback: disableAutoRollback,\n\t\t\t\t},\n\t\t\t}\n\t\t\terr = ctl.tca.CreateCnfInstance(context.Background(), &req)\n\t\t\tCheckErrLogError(err)\n\n\t\t\tfmt.Println(\"Successfully updated state.\")\n\t\t},\n\t}\n\n\t// blocking flag\n\tupdateInstance.Flags().BoolVarP(&doBlock, CliBlock, \"b\", false,\n\t\t\"Flag instructs to blocks and pools the status of the operation.\")\n\n\t// node pool flag\n\tupdateInstance.Flags().StringVar(&_targetPool, CliPool, \"\",\n\t\t\"Updates kubernetes node pool, note it will use same kubernetes cluster, \"+\n\t\t\t\"in case you need swap cloud, you need indicate explicitly,\")\n\t//\n\tupdateInstance.Flags().BoolVar(&disableGrant, CliDisableGran, false,\n\t\t\"Flag disable Helm Grant validation.\")\n\t//\n\tupdateInstance.Flags().BoolVar(&ignoreGrantFailure, CliIgnoreGrantFailure, false,\n\t\t\"Flag ignore grant failure.\")\n\t//\n\tupdateInstance.Flags().BoolVar(&disableAutoRollback, CliDisableAutoRollback, false,\n\t\t\"Flag disable auto rollback.\")\n\t//\n\tupdateInstance.Flags().BoolVarP(&showProgress, CliProgress, \"s\", false,\n\t\t\"Show task progress.\")\n\n\treturn updateInstance\n}", "title": "" }, { "docid": "7aab97196ee81d8fc7ce5955db7bca0c", "score": "0.51980984", "text": "func (srv *Server) runInstances(w http.ResponseWriter, req *http.Request, reqId string) interface{} {\n\tmin := atoi(req.Form.Get(\"MinCount\"))\n\tmax := atoi(req.Form.Get(\"MaxCount\"))\n\tif min < 0 || max < 1 {\n\t\tfatalf(400, \"InvalidParameterValue\", \"bad values for MinCount or MaxCount\")\n\t}\n\tif min > max {\n\t\tfatalf(400, \"InvalidParameterCombination\", \"MinCount is greater than MaxCount\")\n\t}\n\tvar userData []byte\n\tif data := req.Form.Get(\"UserData\"); data != \"\" {\n\t\tvar err error\n\t\tuserData, err = b64.DecodeString(data)\n\t\tif err != nil {\n\t\t\tfatalf(400, \"InvalidParameterValue\", \"bad UserData value: %v\", err)\n\t\t}\n\t}\n\n\t// TODO attributes still to consider:\n\t// ImageId: accept anything, we can verify later\n\t// KeyName ?\n\t// InstanceType ?\n\t// KernelId ?\n\t// RamdiskId ?\n\t// AvailZone ?\n\t// GroupName tag\n\t// Monitoring ignore?\n\t// DisableAPITermination bool\n\t// ShutdownBehavior string\n\t// PrivateIPAddress string\n\n\tsrv.mu.Lock()\n\tdefer srv.mu.Unlock()\n\n\t// make sure that form fields are correct before creating the reservation.\n\tinstType := req.Form.Get(\"InstanceType\")\n\timageId := req.Form.Get(\"ImageId\")\n\tavailZone := req.Form.Get(\"Placement.AvailabilityZone\")\n\n\tr := srv.newReservation(srv.formToGroups(req.Form))\n\n\t// If the user specifies an explicit subnet id, use it.\n\t// Otherwise, get a subnet from the default VPC.\n\tuserSubnetId := req.Form.Get(\"SubnetId\")\n\tinstSubnet := srv.subnets[userSubnetId]\n\tif instSubnet == nil && userSubnetId != \"\" {\n\t\tfatalf(400, \"InvalidSubnetID.NotFound\", \"subnet %s not found\", userSubnetId)\n\t}\n\tif userSubnetId == \"\" {\n\t\tinstSubnet = srv.getDefaultSubnet()\n\t}\n\n\t// Handle network interfaces parsing.\n\tifacesToCreate, limitToOneInstance := srv.parseRunNetworkInterfaces(req)\n\tif len(ifacesToCreate) > 0 && userSubnetId != \"\" {\n\t\t// Since we have an instance-level subnet id\n\t\t// specified, we cannot add network interfaces\n\t\t// in the same request. See http://goo.gl/9aqbT9.\n\t\tfatalf(400, \"InvalidParameterCombination\", \"Network interfaces and an instance-level subnet ID may not be specified on the same request\")\n\t}\n\tif limitToOneInstance {\n\t\tmax = 1\n\t}\n\tif len(ifacesToCreate) == 0 {\n\t\t// No NICs specified, so create a default one to simulate what\n\t\t// EC2 does.\n\t\tifacesToCreate = srv.addDefaultNIC(instSubnet)\n\t}\n\n\tvar resp ec2.RunInstancesResp\n\tresp.RequestId = reqId\n\tresp.ReservationId = r.id\n\tresp.OwnerId = ownerId\n\n\tfor i := 0; i < max; i++ {\n\t\tinst := srv.newInstance(r, instType, imageId, availZone, srv.initialInstanceState)\n\t\t// Create any NICs on the instance subnet (if any), and then\n\t\t// save the VPC and subnet ids on the instance, as EC2 does.\n\t\tinst.ifaces = srv.createNICsOnRun(inst.id(), instSubnet, ifacesToCreate)\n\t\tif instSubnet != nil {\n\t\t\tinst.subnetId = instSubnet.Id\n\t\t\tinst.vpcId = instSubnet.VPCId\n\t\t}\n\t\tinst.UserData = userData\n\t\tresp.Instances = append(resp.Instances, inst.ec2instance())\n\t}\n\treturn &resp\n}", "title": "" }, { "docid": "ef316e6c75cf0d356b9cf5a61d4eb2a7", "score": "0.5186637", "text": "func (client *VirtualMachinesClient) runCommand(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesBeginRunCommandOptions) (*azcore.Response, error) {\n\treq, err := client.runCommandCreateRequest(ctx, resourceGroupName, vmName, parameters, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := client.con.Pipeline().Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) {\n\t\treturn nil, client.runCommandHandleError(resp)\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "774709bfaab852e09e562fd198088370", "score": "0.51343256", "text": "func (instance *Instance) InvokeCommand() (err error) {\n\n\tclient, err := ssh.Dial(\"tcp\", fmt.Sprintf(\"%s:%d\", *instance.PrivateIPAddress, *instance.SSHPort), instance.sshConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to connect to SSH: %s\", err)\n\t}\n\n\tsession, err := client.NewSession()\n\tif err != nil {\n\t\tclient.Close()\n\t\treturn fmt.Errorf(\"unable to launch SSH session: %s\", err)\n\t}\n\n\tstdin, err := session.StdinPipe()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to setup stdin for session: %v\", err)\n\t}\n\tgo io.Copy(stdin, os.Stdin)\n\n\tstdout, err := session.StdoutPipe()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to setup stdout for session: %v\", err)\n\t}\n\tgo io.Copy(os.Stdout, stdout)\n\n\tstderr, err := session.StderrPipe()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to setup stderr for session: %v\", err)\n\t}\n\tgo io.Copy(os.Stderr, stderr)\n\n\tvar commands []string\n\n\tif instance.EntrypointFile != nil {\n\t\tuploadedFilePath, err := instance.UploadFile(*instance.EntrypointFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif *instance.WaitOnCloudInit {\n\t\t\tcommands = append(commands, \"while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done\")\n\t\t}\n\n\t\tcommands = append(commands, uploadedFilePath)\n\n\t}\n\n\tif instance.Command != nil {\n\t\tcommands = append(commands, *instance.Command)\n\n\t}\n\tcommand := strings.Join(commands, \" \\\\\\n && \")\n\tfmt.Printf(\"Executing command: \\n%s\\n\", command)\n\t*instance.ExitCode, err = instance.RunCommand(session, command)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"command exited with code %d: %s\", instance.ExitCode, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f5430fbb94290c3e8154a88628732eaa", "score": "0.51067173", "text": "func (instance *Instance) StartInstance() (err error) {\n\tri := ec2.RunInstancesInput{\n\t\tImageId: instance.AMIID,\n\t\tInstanceType: instance.Type,\n\t\tKeyName: instance.KeyName,\n\t\tMaxCount: aws.Int64(1),\n\t\tMinCount: aws.Int64(1),\n\t\tUserData: instance.UserData,\n\n\t\tBlockDeviceMappings: []*ec2.BlockDeviceMapping{\n\t\t\t&ec2.BlockDeviceMapping{\n\t\t\t\tDeviceName: aws.String(\"/dev/xvda\"), //assumes amazon linux OS\n\t\t\t\tEbs: &ec2.EbsBlockDevice{\n\t\t\t\t\tDeleteOnTermination: aws.Bool(true),\n\t\t\t\t\tVolumeSize: instance.RootEBSSize,\n\t\t\t\t\tVolumeType: aws.String(\"gp2\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\tNetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{\n\t\t\t&ec2.InstanceNetworkInterfaceSpecification{\n\t\t\t\tDeviceIndex: aws.Int64(0),\n\t\t\t\tAssociatePublicIpAddress: aws.Bool(false),\n\t\t\t\tSubnetId: instance.SubnetID,\n\t\t\t\tGroups: instance.SecurityGroupIDs,\n\t\t\t},\n\t\t},\n\n\t\tInstanceInitiatedShutdownBehavior: aws.String(\"terminate\"),\n\t\tInstanceMarketOptions: &ec2.InstanceMarketOptionsRequest{\n\t\t\tMarketType: aws.String(\"spot\"),\n\t\t\tSpotOptions: &ec2.SpotMarketOptions{\n\t\t\t\tBlockDurationMinutes: aws.Int64(360),\n\t\t\t\tInstanceInterruptionBehavior: aws.String(\"terminate\"),\n\t\t\t},\n\t\t},\n\t}\n\n\tif len(*instance.Tags) > 0 {\n\t\tvar ec2Tags []*ec2.Tag\n\t\tfor key, value := range *instance.Tags {\n\t\t\tec2Tags = append(ec2Tags, &ec2.Tag{\n\t\t\t\tKey: aws.String(key),\n\t\t\t\tValue: aws.String(value),\n\t\t\t})\n\t\t}\n\n\t\tri.TagSpecifications = []*ec2.TagSpecification{\n\t\t\t&ec2.TagSpecification{\n\t\t\t\tResourceType: aws.String(\"instance\"),\n\t\t\t\tTags: ec2Tags,\n\t\t\t},\n\t\t\t&ec2.TagSpecification{\n\t\t\t\tResourceType: aws.String(\"volume\"),\n\t\t\t\tTags: ec2Tags,\n\t\t\t},\n\t\t}\n\t}\n\n\tif instance.IamInstanceProfile != nil {\n\t\tri.IamInstanceProfile = &ec2.IamInstanceProfileSpecification{Name: instance.IamInstanceProfile}\n\t}\n\n\tinstance.Reservation, err = ec2Svc.RunInstances(&ri)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, ri := range instance.Reservation.Instances {\n\t\tinstance.PrivateIPAddress = ri.PrivateIpAddress\n\t\tinstance.InstanceID = ri.InstanceId\n\t}\n\n\tif instance.PrivateIPAddress == nil {\n\t\treturn errors.New(\"looks like it didn't get created\")\n\t}\n\n\tdescSpot, err := ec2Svc.DescribeSpotInstanceRequests(&ec2.DescribeSpotInstanceRequestsInput{\n\t\tFilters: []*ec2.Filter{\n\t\t\t&ec2.Filter{\n\t\t\t\tName: aws.String(\"instance-id\"),\n\t\t\t\tValues: []*string{instance.InstanceID},\n\t\t\t}},\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to describe spot instance request: %s\", err)\n\t}\n\tfor _, sp := range descSpot.SpotInstanceRequests {\n\t\tinstance.SpotPrice = sp.ActualBlockHourlyPrice\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2262a303d2ee86f1b3afd3024e9a051c", "score": "0.51042205", "text": "func (machine DockerMachine) Run(command []string) ([]byte, error) {\n\n\t// All commands need to be run in the docker machine, so we create a prefix\n\tcontext := []string{dockerMachineCmd, \"ssh\", \"microbox\"}\n\n\t// now we can generate a run command combining the context with the command\n\trun := append(context, command...)\n\n\t// when we actually run the command, we need to pop off the first item\n\tcmd := exec.Command(run[0], run[1:]...)\n\n\t// run the command and return the output\n\treturn cmd.CombinedOutput()\n}", "title": "" }, { "docid": "b0b28485d108e47b2dac2ef8c59b902b", "score": "0.50518554", "text": "func (c *listCommand) Run(ctx context.Context, env *common_cli.Env, serverClient util.ServerClient) error {\n\tfilter := &agentv1.ListAgentsRequest_Filter{}\n\tif len(c.selectors) > 0 {\n\t\tmatchBehavior, err := parseToSelectorMatch(c.matchSelectorsOn)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tselectors := make([]*types.Selector, len(c.selectors))\n\t\tfor i, sel := range c.selectors {\n\t\t\tselector, err := util.ParseSelector(sel)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error parsing selector %q: %w\", sel, err)\n\t\t\t}\n\t\t\tselectors[i] = selector\n\t\t}\n\t\tfilter.BySelectorMatch = &types.SelectorMatch{\n\t\t\tSelectors: selectors,\n\t\t\tMatch: matchBehavior,\n\t\t}\n\t}\n\n\tagentClient := serverClient.NewAgentClient()\n\n\tpageToken := \"\"\n\tvar agents []*types.Agent\n\tfor {\n\t\tlistResponse, err := agentClient.ListAgents(ctx, &agentv1.ListAgentsRequest{\n\t\t\tPageSize: 1000, // comfortably under the (4 MB/theoretical maximum size of 1 agent in MB)\n\t\t\tPageToken: pageToken,\n\t\t\tFilter: filter,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tagents = append(agents, listResponse.Agents...)\n\t\tif pageToken = listResponse.NextPageToken; pageToken == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif len(agents) == 0 {\n\t\treturn env.Printf(\"No attested agents found\\n\")\n\t}\n\n\tmsg := fmt.Sprintf(\"Found %d attested \", len(agents))\n\tmsg = util.Pluralizer(msg, \"agent\", \"agents\", len(agents))\n\tenv.Printf(msg + \":\\n\\n\")\n\n\treturn printAgents(env, agents...)\n}", "title": "" }, { "docid": "132340fe1840e8754ae56a15f72387c2", "score": "0.5034892", "text": "func (a *Adapter) Run(cmd *client.Command, clientLog *client.Log) (*client.CommandResult, error) {\n\treturn a.container.RunCommandInContainer(cmd, clientLog, \"ubuntu\")\n}", "title": "" }, { "docid": "1c5b1c6bd2a5089f32cae685c83f51db", "score": "0.5026025", "text": "func (_m *EC2API) DescribeInstances(_a0 *ec2.DescribeInstancesInput) (output *ec2.DescribeInstancesOutput, err error) {\r\n\toutput = &ec2.DescribeInstancesOutput{}\r\n\tif err := _m.recorder.CheckError(\"DescribeInstances\"); err != nil {\r\n\t\treturn output, err\r\n\t}\r\n\t_m.recorder.Record(\"DescribeInstances\")\r\n\treturns, exist := _m.recorder.giveRecordedOutput(\"DescribeInstances\", _a0)\r\n\tif exist {\r\n\t\tassertedErr, _ := returns[1].(error)\r\n\t\treturn returns[0].(*ec2.DescribeInstancesOutput), assertedErr\r\n\t}\r\n\tfilteredInstances := []*ec2.Instance{}\r\n\tfor _, instanceId := range _a0.InstanceIds {\r\n\t\tfor _, instance := range _m.createdEc2instances {\r\n\t\t\tif *instance.InstanceId == *instanceId {\r\n\t\t\t\tfilteredInstances = append(filteredInstances, instance)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif len(_a0.Filters) == 0 {\r\n\t\treservations := []*ec2.Reservation{\r\n\t\t\t&ec2.Reservation{\r\n\t\t\t\tInstances: filteredInstances,\r\n\t\t\t},\r\n\t\t}\r\n\t\toutput.Reservations = reservations\r\n\t\treturn\r\n\t}\r\n\tif len(filteredInstances) == 0 {\r\n\t\tfor _, val := range _m.createdEc2instances {\r\n\t\t\tfilteredInstances = append(filteredInstances, val)\r\n\t\t}\r\n\t}\r\n\tfurtherFilteredInstances := []*ec2.Instance{}\r\n\tfor _, val := range filteredInstances {\r\n\t\tfor _, filter := range _a0.Filters {\r\n\t\t\tif *filter.Name == \"vpc-id\" {\r\n\t\t\t\tfor _, vpcId := range filter.Values {\r\n\t\t\t\t\tif *val.VpcId == *vpcId {\r\n\t\t\t\t\t\tfurtherFilteredInstances = append(furtherFilteredInstances, val)\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif len(furtherFilteredInstances) != 0 {\r\n\t\tfilteredInstances = furtherFilteredInstances\r\n\t\tfurtherFilteredInstances = []*ec2.Instance{}\r\n\t} else {\r\n\t\tfurtherFilteredInstances = filteredInstances\r\n\t}\r\n\r\n\tfor _, val := range filteredInstances {\r\n\t\tfor _, filter := range _a0.Filters {\r\n\t\t\tif *filter.Name == \"network-interface.subnet-id\" {\r\n\t\t\t\tfor _, subnetId := range filter.Values {\r\n\t\t\t\t\tif *val.NetworkInterfaces[0].SubnetId == *subnetId {\r\n\t\t\t\t\t\tfurtherFilteredInstances = append(furtherFilteredInstances, val)\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif len(furtherFilteredInstances) == 0 {\r\n\t\tfurtherFilteredInstances = filteredInstances\r\n\t}\r\n\treservations := []*ec2.Reservation{\r\n\t\t&ec2.Reservation{\r\n\t\t\tInstances: furtherFilteredInstances,\r\n\t\t},\r\n\t}\r\n\toutput.Reservations = reservations\r\n\treturn\r\n}", "title": "" }, { "docid": "475b796449a5c557a4f543c9c2bdb4e2", "score": "0.5013194", "text": "func (tag *TagCommand) runTag(args []string) error {\n\tctx := context.Background()\n\tapiClient := tag.cli.Client()\n\n\tsource, target := args[0], args[1]\n\treturn apiClient.ImageTag(ctx, source, target)\n}", "title": "" }, { "docid": "ad287c49449211ec2886b6ac43d8dcfd", "score": "0.49987546", "text": "func newRunCommand() *cobra.Command {\n\tvar cfg *ImageUpdaterConfig = &ImageUpdaterConfig{}\n\tvar once bool\n\tvar kubeConfig string\n\tvar disableKubernetes bool\n\tvar runCmd = &cobra.Command{\n\t\tUse: \"run\",\n\t\tShort: \"Runs the argocd-image-updater with a set of options\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif err := log.SetLogLevel(cfg.LogLevel); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif once {\n\t\t\t\tcfg.CheckInterval = 0\n\t\t\t\tcfg.HealthPort = 0\n\t\t\t}\n\n\t\t\t// Enforce sane --max-concurrency values\n\t\t\tif cfg.MaxConcurrency < 1 {\n\t\t\t\treturn fmt.Errorf(\"--max-concurrency must be greater than 1\")\n\t\t\t}\n\n\t\t\tlog.Infof(\"%s %s starting [loglevel:%s, interval:%s, healthport:%s]\",\n\t\t\t\tversion.BinaryName(),\n\t\t\t\tversion.Version(),\n\t\t\t\tstrings.ToUpper(cfg.LogLevel),\n\t\t\t\tgetPrintableInterval(cfg.CheckInterval),\n\t\t\t\tgetPrintableHealthPort(cfg.HealthPort),\n\t\t\t)\n\n\t\t\t// Load registries configuration early on. We do not consider it a fatal\n\t\t\t// error when the file does not exist, but we emit a warning.\n\t\t\tif cfg.RegistriesConf != \"\" {\n\t\t\t\tst, err := os.Stat(cfg.RegistriesConf)\n\t\t\t\tif err != nil || st.IsDir() {\n\t\t\t\t\tlog.Warnf(\"Registry configuration at %s could not be read: %v -- using a default configuration\", cfg.RegistriesConf, err)\n\t\t\t\t} else {\n\t\t\t\t\terr = registry.LoadRegistryConfiguration(cfg.RegistriesConf)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(\"Could not load registry configuration from %s: %v\", cfg.RegistriesConf, err)\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif cfg.CheckInterval > 0 && cfg.CheckInterval < 60*time.Second {\n\t\t\t\tlog.Warnf(\"check interval is very low - it is not recommended to run below 1m0s\")\n\t\t\t}\n\n\t\t\tvar fullKubeConfigPath string\n\t\t\tvar err error\n\n\t\t\tif !disableKubernetes {\n\t\t\t\tif kubeConfig != \"\" {\n\t\t\t\t\tfullKubeConfigPath, err = filepath.Abs(kubeConfig)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Fatalf(\"Cannot expand path %s: %v\", kubeConfig, err)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif fullKubeConfigPath != \"\" {\n\t\t\t\t\tlog.Debugf(\"Creating Kubernetes client from %s\", fullKubeConfigPath)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Debugf(\"Creating in-cluster Kubernetes client\")\n\t\t\t\t}\n\n\t\t\t\tcfg.KubeClient, err = client.NewKubernetesClient(fullKubeConfigPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatalf(\"Cannot create kubernetes client: %v\", err)\n\t\t\t\t}\n\t\t\t} else if kubeConfig != \"\" {\n\t\t\t\treturn fmt.Errorf(\"--kubeconfig and --disable-kubernetes cannot be specified together\")\n\t\t\t}\n\n\t\t\tif token := os.Getenv(\"ARGOCD_TOKEN\"); token != \"\" && cfg.ClientOpts.AuthToken == \"\" {\n\t\t\t\tlog.Debugf(\"Using ArgoCD API credentials from environment ARGOCD_TOKEN\")\n\t\t\t\tcfg.ClientOpts.AuthToken = token\n\t\t\t}\n\n\t\t\tlog.Infof(\"ArgoCD configuration: [server=%s, auth_token=%v, insecure=%v, grpc_web=%v, plaintext=%v]\",\n\t\t\t\tcfg.ClientOpts.ServerAddr,\n\t\t\t\tcfg.ClientOpts.AuthToken != \"\",\n\t\t\t\tcfg.ClientOpts.Insecure,\n\t\t\t\tcfg.ClientOpts.GRPCWeb,\n\t\t\t\tcfg.ClientOpts.Plaintext,\n\t\t\t)\n\n\t\t\t// Health server will start in a go routine and run asynchronously\n\t\t\tvar hsErrCh chan error\n\t\t\tif cfg.HealthPort > 0 {\n\t\t\t\tlog.Infof(\"Starting health probe server TCP port=%d\", cfg.HealthPort)\n\t\t\t\thsErrCh = health.StartHealthServer(cfg.HealthPort)\n\t\t\t}\n\n\t\t\t// This is our main loop. We leave it only when our health probe server\n\t\t\t// returns an error.\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase err := <-hsErrCh:\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(\"Health probe server exited with error: %v\", err)\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Infof(\"Health probe server exited gracefully\")\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tif lastRun.IsZero() || time.Since(lastRun) > cfg.CheckInterval {\n\t\t\t\t\t\tlog.Debugf(\"Starting image update process\")\n\t\t\t\t\t\tresult, err := runImageUpdater(cfg)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Errorf(\"Error: %v\", err)\n\t\t\t\t\t\t} else if result.NumImagesUpdated > 0 || result.NumErrors > 0 {\n\t\t\t\t\t\t\tlog.Infof(\"Processing results: applications=%d images_considered=%d images_updated=%d errors=%d\",\n\t\t\t\t\t\t\t\tresult.NumApplicationsProcessed,\n\t\t\t\t\t\t\t\tresult.NumImagesConsidered,\n\t\t\t\t\t\t\t\tresult.NumImagesUpdated,\n\t\t\t\t\t\t\t\tresult.NumErrors)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tlog.Debugf(\"Processing results: applications=%d images_considered=%d images_skipped=%d images_updated=%d errors=%d\",\n\t\t\t\t\t\t\t\tresult.NumApplicationsProcessed,\n\t\t\t\t\t\t\t\tresult.NumImagesConsidered,\n\t\t\t\t\t\t\t\tresult.NumSkipped,\n\t\t\t\t\t\t\t\tresult.NumImagesUpdated,\n\t\t\t\t\t\t\t\tresult.NumErrors)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlastRun = time.Now()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif cfg.CheckInterval == 0 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t\t}\n\t\t\tlog.Infof(\"Finished.\")\n\t\t\treturn nil\n\t\t},\n\t}\n\n\trunCmd.Flags().StringVar(&cfg.ClientOpts.ServerAddr, \"argocd-server-addr\", getServerAddrFromEnv(), \"address of ArgoCD API server\")\n\trunCmd.Flags().BoolVar(&cfg.ClientOpts.GRPCWeb, \"argocd-grpc-web\", getBoolValFromEnv(\"ARGOCD_GRPC_WEB\", false), \"use grpc-web for connection to ArgoCD\")\n\trunCmd.Flags().BoolVar(&cfg.ClientOpts.Insecure, \"argocd-insecure\", getBoolValFromEnv(\"ARGOCD_INSECURE\", false), \"(INSECURE) ignore invalid TLS certs for ArgoCD server\")\n\trunCmd.Flags().BoolVar(&cfg.ClientOpts.Plaintext, \"argocd-plaintext\", getBoolValFromEnv(\"ARGOCD_PLAINTEXT\", false), \"(INSECURE) connect without TLS to ArgoCD server\")\n\trunCmd.Flags().StringVar(&cfg.ClientOpts.AuthToken, \"argocd-auth-token\", \"\", \"use token for authenticating to ArgoCD (unsafe - consider setting ARGOCD_TOKEN env var instead)\")\n\trunCmd.Flags().BoolVar(&cfg.DryRun, \"dry-run\", false, \"run in dry-run mode. If set to true, do not perform any changes\")\n\trunCmd.Flags().DurationVar(&cfg.CheckInterval, \"interval\", 2*time.Minute, \"interval for how often to check for updates\")\n\trunCmd.Flags().StringVar(&cfg.LogLevel, \"loglevel\", \"info\", \"set the loglevel to one of trace|debug|info|warn|error\")\n\trunCmd.Flags().StringVar(&kubeConfig, \"kubeconfig\", \"\", \"full path to kubernetes client configuration, i.e. ~/.kube/config\")\n\trunCmd.Flags().IntVar(&cfg.HealthPort, \"health-port\", 8080, \"port to start the health server on, 0 to disable\")\n\trunCmd.Flags().BoolVar(&once, \"once\", false, \"run only once, same as specifying --interval=0 and --healt-port=0\")\n\trunCmd.Flags().StringVar(&cfg.RegistriesConf, \"registries-conf-path\", \"\", \"path to registries configuration file\")\n\trunCmd.Flags().BoolVar(&disableKubernetes, \"disable-kubernetes\", false, \"do not create and use a Kubernetes client\")\n\trunCmd.Flags().IntVar(&cfg.MaxConcurrency, \"max-concurrency\", 10, \"maximum number of update threads to run concurrently\")\n\trunCmd.Flags().StringVar(&cfg.ArgocdNamespace, \"argocd-namespace\", \"argocd\", \"namespace where ArgoCD runs in\")\n\n\treturn runCmd\n}", "title": "" }, { "docid": "e4ff88719d47a120bf8df3199f3bde11", "score": "0.49810308", "text": "func RunSshCommand(command string, hostGroups ...string) error {\n\t// prepare client config, ssh port info\n\tconfig, port, err := prepareCommand()\n\tif err != nil {\n\t\treturn stacktrace.Propagate(err, \"prepare command failed\")\n\t}\n\n\t// get list of masters or workers, or both\n\thosts, err := GetHostnames(hostGroups)\n\tif err != nil {\n\t\treturn stacktrace.Propagate(err, \"cannot read host names\")\n\t}\n\n\t// create wait group and channels\n\tvar wg sync.WaitGroup\n\terrs := make(chan error)\n\tfor _, h := range hosts {\n\t\th := h\n\t\twg.Add(1)\n\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\t// dial on target remote address with given host, config and ssh port\n\t\t\tdialAddr := fmt.Sprintf(\"%s:%d\", h, port)\n\t\t\tconn, err := ssh.Dial(\"tcp\", dialAddr, config)\n\t\t\tif err != nil {\n\t\t\t\terrs <- stacktrace.Propagate(err, \"dial failed to %v\", h)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdefer func(conn *ssh.Client) {\n\t\t\t\tif err := conn.Close(); err != nil {\n\t\t\t\t\tlog.Logger.Warnf(\"connection to %s closed, error: %s\", h, err)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Logger.Debugf(\"connection to %s closed\", h)\n\t\t\t\t}\n\t\t\t}(conn)\n\n\t\t\t// create and set up a session\n\t\t\tsession, err := conn.NewSession()\n\t\t\tif err != nil {\n\t\t\t\terrs <- stacktrace.Propagate(err, \"cannot create session at %v.\", h)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdefer func(session *ssh.Session) {\n\t\t\t\tif err := session.Close(); err != nil && err != io.EOF {\n\t\t\t\t\tlog.Logger.Warnf(\"session at %s closed, error: %s\", h, err)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Logger.Debugf(\"session at %s closed\", h)\n\t\t\t\t}\n\t\t\t}(session)\n\n\t\t\tsession.Stdout = os.Stdout\n\t\t\tsession.Stderr = os.Stderr\n\n\t\t\t// run command on the session, output errors\n\t\t\tif err = session.Run(command); err != nil {\n\t\t\t\terrs <- stacktrace.Propagate(err, \"run command %v failed at %v\", command, h)\n\t\t\t\treturn\n\t\t\t}\n\t\t}()\n\t}\n\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(errs)\n\t}()\n\n\tvar errMsgs []string\n\tfor err := range errs {\n\t\terrMsgs = append(errMsgs, err.Error())\n\t}\n\tif len(errMsgs) > 0 {\n\t\treturn stacktrace.NewError(\"At least one error encountered:\\n%v\", strings.Join(errMsgs, \"\\n\"))\n\t}\n\tlog.Logger.Infof(\"Command %s successful on nodes: %s\", command, hosts)\n\treturn nil\n}", "title": "" }, { "docid": "1c4144ca9e78aefa7c24563785868032", "score": "0.49750826", "text": "func LaunchInstance(clusterName string, sess *session.Session) (*ec2.Reservation, error) {\n\n ec2Svc := ec2.New(sess)\n\n userData, err := getUserData(clusterName)\n if err != nil {\n return nil, fmt.Errorf(\"Can't get user data: %s\", err)\n }\n\n params := &ec2.RunInstancesInput {\n ImageId: aws.String(getAmi()),\n InstanceType: aws.String(getInstanceType()),\n KeyName: aws.String(getKeyPairName()),\n // SubnetId: aws.String(\"vpc-2eb68c4a\"),\n MaxCount: aws.Int64(1),\n MinCount: aws.Int64(1),\n BlockDeviceMappings: getBlockDeviceMappings(),\n\n IamInstanceProfile: &ec2.IamInstanceProfileSpecification {\n Name: aws.String(getInstanceProfileName()),\n },\n\n // The minecraft SG we've already created.\n SecurityGroupIds: []*string{\n aws.String(getSecurityGroupName()),\n },\n // I think I only need the ID.\n // Though the name for the above is: Minecraft_Container_SG_useast1\n // SecurityGroups: []*string{\n // aws.String(\"\")\n // },\n\n UserData: aws.String(userData),\n\n Monitoring: &ec2.RunInstancesMonitoringEnabled{\n Enabled: aws.Bool(true),\n },\n\n }\n\n resp, err := ec2Svc.RunInstances(params)\n if err != nil {\n return nil, err\n }\n // Need to determine the following paramaters\n // ImageID\n // BlockDeviceMappings (this is particuarly important for the Container AMI, \n // which has 2 devices, a root and a data volume each with 'configurable' sizes.\n // Network Interfaces.\n // VPN.\n // Secrutiy Group.\n // KeyPair.\n // UserData - this is where we set up a script to set the param for which cluster to join.\n //\n // I'm thinking that ultimately these are things that hsould be set up in configuration\n // files with profiles that can be used.\n\n return resp, nil\n\n}", "title": "" }, { "docid": "62c5e60e6f5c6580730e906d70d61180", "score": "0.49678764", "text": "func run() {\n\tif *start != \"instance\" {\n\t\tif _, ok := path[*start]; ok {\n\t\t\texecute(\"start\", path[*start])\n\t\t} else {\n\t\t\tlog.Fatal(\"Error: instance name \\\"\", *start, \"\\\" not found in .tomcatmanrc.\")\n\t\t}\n\t}\n\tif *stop != \"instance\" {\n\t\tif _, ok := path[*stop]; ok {\n\t\t\texecute(\"stop\", path[*stop])\n\t\t} else {\n\t\t\tlog.Fatal(\"Error: instance name \\\"\", *stop, \"\\\" not found in .tomcatmanrc.\")\n\t\t}\n\t}\n\tif *restart != \"instance\" {\n\t\tif _, ok := path[*restart]; ok {\n\t\t\texecute(\"restart\", path[*restart])\n\t\t} else {\n\t\t\tlog.Fatal(\"Error: instance name \\\"\", *start, \"\\\" not found in .tomcatmanrc.\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fcd41577fbfd2f6b4687ef94a226bb92", "score": "0.49548727", "text": "func runCommand(cCmd *cobra.Command, machID string, cmd string, args ...string) (retcode int) {\n\tvar err error\n\tif machine.IsLocalMachineID(machID) {\n\t\terr, retcode = runLocalCommand(cmd, args...)\n\t\tif err != nil {\n\t\t\tstderr(\"Error running local command: %v\", err)\n\t\t}\n\t} else {\n\t\tms, err := machineState(machID)\n\t\tif err != nil || ms == nil {\n\t\t\tstderr(\"Error getting machine IP: %v\", err)\n\t\t} else {\n\t\t\taddr := findSSHPort(cCmd, ms.PublicIP)\n\t\t\terr, retcode = runRemoteCommand(cCmd, addr, cmd, args...)\n\t\t\tif err != nil {\n\t\t\t\tstderr(\"Unable to SSH to remote host: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9d840f18a5e131d61b81fd7cd43321a0", "score": "0.4942672", "text": "func (i *ImageCommand) Run(args []string) {\n\tapiClient := i.cli.Client()\n\n\timageList, err := apiClient.ImageList()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"failed to get image list: %s\\n\", err)\n\t\treturn\n\t}\n\n\tif i.flagQuiet {\n\t\tfor _, image := range imageList {\n\t\t\tfmt.Println(image.Name)\n\t\t}\n\t\treturn\n\t}\n\n\tif i.flagDigest {\n\t\tfmt.Printf(\"%-20s %-56s %-71s %s\\n\", \"IMAGE ID\", \"IMAGE NAME\", \"DIGEST\", \"SIZE\")\n\t} else {\n\t\tfmt.Printf(\"%-20s %-56s %s\\n\", \"IMAGE ID\", \"IMAGE NAME\", \"SIZE\")\n\t}\n\n\tfor _, image := range imageList {\n\t\tif i.flagDigest {\n\t\t\tfmt.Printf(\"%-20s %-56s %-71s %s\\n\", image.ID, image.Name, image.Digest, image.Size)\n\t\t} else {\n\t\t\tfmt.Printf(\"%-20s %-56s %s\\n\", image.ID, image.Name, image.Size)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "86845cb0e8eb909ed208c23be58cc83b", "score": "0.49403298", "text": "func commandRun() {\n\t// Validate commandRun-specific flags\n\tif flagExecutorID < 0 || flagExecutorID >= flagExecutorCount {\n\t\tlogrus.Fatalf(\"%q flag has to be greater than 0 and lower than %q\", \"executor-id\", \"executor-count\")\n\t}\n\tif flagExecutorCount < 1 {\n\t\tlogrus.Fatalf(\"%q cannot be lower than 1\", \"executor-count\")\n\t}\n\tif flagExecutorCount > 10 {\n\t\tlogrus.Warnf(\"%q is set to %d, are you sure that's on purpose?\", \"executor-count\", flagExecutorCount)\n\t}\n\n\tif err := os.MkdirAll(temporaryWorkingDir, 0777); err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\tlogger := logrus.WithField(\"executor\", flagExecutorID)\n\n\t// Load custom dockerfile definitions from a file\n\tcustomizedImages := []CustomImage{}\n\t{\n\t\tb, err := os.ReadFile(customizedImagesFile)\n\t\tif err != nil {\n\t\t\tlogger.Fatalf(\"error reading %q: %s\", customizedImagesFile, err)\n\t\t}\n\t\tif err := yaml.Unmarshal(b, &customizedImages); err != nil {\n\t\t\tlogger.Fatalf(\"error unmarshaling %q: %s\", customizedImagesFile, err)\n\t\t}\n\t}\n\n\tlogger.Infof(\"Found %d custom Images to build\", len(customizedImages))\n\n\t// Iterate over every image x tag and retag/rebuild it\n\terrorCounter := 0\n\tfor i, image := range customizedImages {\n\t\t// Skip images meant for other executors\n\t\tif i%flagExecutorCount != flagExecutorID {\n\t\t\tcontinue\n\t\t}\n\t\tif err := image.Validate(); err != nil {\n\t\t\tlogger.Errorf(\"[%d/%d] %q error: %s\", i+1, len(customizedImages), image.Image, err)\n\t\t\terrorCounter++\n\t\t\tcontinue\n\t\t}\n\t\tlogger.Printf(\"[%d/%d] Retagging %q\", i+1, len(customizedImages), image.Image)\n\t\tif image.SHA != \"\" {\n\t\t\tif err := image.RetagUsingSHA(); err != nil {\n\t\t\t\tlogger.Errorf(\"got error: %v\", err)\n\t\t\t\terrorCounter++\n\t\t\t}\n\t\t} else {\n\t\t\tif err := image.RetagUsingTags(); err != nil {\n\t\t\t\tlogger.Errorf(\"got error: %v\", err)\n\t\t\t\terrorCounter++\n\t\t\t}\n\t\t}\n\t}\n\n\tif errorCounter > 0 {\n\t\tlogger.Fatalf(\"Retagging ended with %d errors\", errorCounter)\n\t}\n\tlogger.Infof(\"Done retagging %d images with no errors\", len(customizedImages))\n}", "title": "" }, { "docid": "820ff2392203f789b5a5257c13cb3ed7", "score": "0.49379206", "text": "func (s *Servo) RunECCommand(ctx context.Context, cmd string) error {\n\treturn s.SetString(ctx, ECUARTCmd, cmd)\n}", "title": "" }, { "docid": "42e78d22806a10773efe65b5c5fe9c08", "score": "0.49322337", "text": "func (c *DeleteCommand) Execute(args []string) ExecutionStatus {\n\tlog.Tracef(\"Executing command '%s': args: '%v'\\n\", c.Name, args)\n\n\tflagSet := flag.NewFlagSet(\"html5-delete\", flag.ContinueOnError)\n\tcontentFlag := flagSet.Bool(\"content\", false, \"delete content only\")\n\tvar appHostNames stringSlice\n\tflagSet.Var(&appHostNames, \"name\", \"Name of html5-apps-repo app-host service instance\")\n\tflagSet.Var(&appHostNames, \"n\", \"Name of html5-apps-repo app-host service instance (alias)\")\n\tflagSet.Parse(args)\n\n\tif flagSet.NArg() > 0 || len(appHostNames) > 0 {\n\t\tappHostGUIDs := flagSet.Args()\n\t\tif *contentFlag {\n\t\t\treturn c.DeleteServiceInstancesContent(appHostGUIDs, appHostNames)\n\t\t}\n\t\treturn c.DeleteServiceInstances(appHostGUIDs, appHostNames)\n\t}\n\n\tui.Failed(\"Incorrect number of arguments passed. See [cf html5-delete --help] for more detals\")\n\treturn Failure\n}", "title": "" }, { "docid": "2ba926edcdd747227ce6527610bde21a", "score": "0.48721883", "text": "func testCreateManyInstances(t *testing.T) {\n\tconst n = 10\n\t// Start n instances.\n\tfor i := 0; i < n; i++ {\n\t\tinstanceName := \"echo\" + strconv.Itoa(i+1)\n\t\t_, err := startInstance(instanceImagePath, instanceName, i, startOpts{})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Failed to start instance %s: %v\", instanceName, err)\n\t\t}\n\t}\n\t// Verify all instances started.\n\tif numStarted := getNumberOfInstances(t); numStarted != n {\n\t\tt.Fatalf(\"Expected %d instances, but see %d.\", n, numStarted)\n\t}\n\t// Echo all n instances.\n\tfor i := 0; i < n; i++ {\n\t\techo(t, instanceStartPort+i)\n\t}\n}", "title": "" }, { "docid": "4f13ce6d49eee0db4628d9130c2f3801", "score": "0.4872089", "text": "func (instance Instance) RunCommand(session *ssh.Session, command string) (int, error) {\n\n\terr := session.Run(command)\n\tif err != nil {\n\t\tswitch v := err.(type) {\n\t\tcase *ssh.ExitError:\n\t\t\treturn v.Waitmsg.ExitStatus(), nil\n\t\tdefault:\n\t\t\treturn 1, err\n\t\t}\n\t}\n\n\treturn 0, err\n}", "title": "" }, { "docid": "bbb0ba459b0c54efef36d19a1fdd92d0", "score": "0.48572573", "text": "func Run(cmd *cobra.Command, args []string) {\n\n}", "title": "" }, { "docid": "49c5d46e1c4f28e7bcc1f852dd87a69f", "score": "0.48552772", "text": "func runRemoteCommand(cCmd *cobra.Command, addr string, cmd string, args ...string) (err error, exit int) {\n\tvar sshClient *ssh.SSHForwardingClient\n\ttimeout := getSSHTimeoutFlag(cCmd)\n\tif tun := getTunnelFlag(cCmd); tun != \"\" {\n\t\tsshClient, err = ssh.NewTunnelledSSHClient(globalFlags.SSHUserName, tun, addr, getChecker(cCmd), false, timeout)\n\t} else {\n\t\tsshClient, err = ssh.NewSSHClient(globalFlags.SSHUserName, addr, getChecker(cCmd), false, timeout)\n\t}\n\tif err != nil {\n\t\treturn err, -1\n\t}\n\n\tcmdargs := cmd\n\tfor _, arg := range args {\n\t\tcmdargs += fmt.Sprintf(\" %q\", arg)\n\t}\n\n\tdefer sshClient.Close()\n\n\treturn ssh.Execute(sshClient, cmdargs)\n}", "title": "" }, { "docid": "c47ac41eabd1a16662f754c964c3aad0", "score": "0.48505965", "text": "func (c *Client) EvalEc2Instance(accounts []*policy.Account, p policy.Policy, regions []string, f func(policy.Violation)) error {\n\tvar errs error\n\tctx := context.Background()\n\terr := c.WalkAccountsAndRegions(accounts, regions, func(client *cziAws.Client, account *policy.Account, region string) {\n\t\terr := client.EC2.GetAllInstances(ctx, func(instance *ec2.Instance) {\n\t\t\ti := NewEc2Instance(instance, region)\n\t\t\tif p.Match(i) {\n\t\t\t\tviolation := policy.NewViolation(p, i, false, account)\n\t\t\t\tf(violation)\n\t\t\t}\n\t\t})\n\t\terrs = multierror.Append(errs, err)\n\t})\n\terrs = multierror.Append(errs, err)\n\n\treturn errs\n}", "title": "" }, { "docid": "2a0507e453cb95c32155e341408aa6e1", "score": "0.4850252", "text": "func runCommand(name string, arg ...string) []string {\n\tout := runCommandRaw(name, arg...)\n\treturn strings.Split(out, \"\\n\")\n}", "title": "" }, { "docid": "4fa854f8441cac9360807b25c40b1d7b", "score": "0.4848662", "text": "func (c *Client) RunCmdBlockOnHosts(hosts, description string, input *godog.DocString) error {\n\tc.Results = []Result{}\n\thosts = strings.ReplaceAll(hosts, \" \", \"\")\n\n\tvar hostList []string\n\thostList = strings.Split(hosts, \",\")\n\n\tvar wg sync.WaitGroup\n\tfor _, ip := range c.getClusterIPs(hostList) {\n\t\twg.Add(1)\n\t\tgo func(ip string) {\n\t\t\tdefer wg.Done()\n\t\t\tc.Results = append(\n\t\t\t\tc.Results,\n\t\t\t\tResult{\n\t\t\t\t\tIP: ip,\n\t\t\t\t\tStdout: c.RunCmd(input.Content, ip),\n\t\t\t\t},\n\t\t\t)\n\t\t}(ip)\n\t}\n\twg.Wait()\n\n\treturn nil\n}", "title": "" }, { "docid": "df2938565af3f18254563a161ce22266", "score": "0.4844865", "text": "func (r *Runtime) runCommand(args ...string) ([]string, error) {\n\tglog.V(4).Info(\"rkt: Run command:\", args)\n\n\toutput, err := r.buildCommand(args...).Output()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn strings.Split(strings.TrimSpace(string(output)), \"\\n\"), nil\n}", "title": "" }, { "docid": "3f209658d66737a5c833e5cf7e7f4b25", "score": "0.48358497", "text": "func (s *Server) run(gitoliteCommand ...string) ([]byte, error) {\n\tvar args = []string{\"ssh\", s.Hostname}\n\n\t// allow overriding the ssh command for tests\n\tif len(s.sshCommand) > 0 {\n\t\targs = s.sshCommand\n\t}\n\n\targs = append(args, gitoliteCommand...)\n\n\tcmd := exec.Command(args[0], args[1:]...)\n\tcmd.Stderr = os.Stderr\n\treturn cmd.Output()\n}", "title": "" }, { "docid": "1398c80fec24bb1b5dee72bc3e9ca773", "score": "0.4823186", "text": "func (c *VsmCreateCommand) Run(args []string) int {\n\n\tvar op int\n\n\tflags := c.Meta.FlagSet(\"volume create\", FlagSetClient)\n\tflags.Usage = func() { c.Meta.Ui.Output(c.Help()) }\n\tflags.StringVar(&c.vsmname, \"volname\", \"\", \"\")\n\tflags.StringVar(&c.size, \"size\", \"5G\", \"\")\n\n\tif err := flags.Parse(args); err != nil {\n\t\treturn 1\n\t}\n\n\t// specs file is mandatory\n\targs = flags.Args()\n\tif len(args) != 1 && len(strings.TrimSpace(c.vsmname)) == 0 {\n\t\tc.Ui.Error(c.Help())\n\t\treturn 1\n\t}\n\tif len(args) == 1 {\n\t\tif c.Cmd == nil {\n\t\t\t// sub command\n\t\t\targs = append([]string{string(NomadRun)}, args...)\n\n\t\t\t// main command; append sub cmd to main cmd\n\t\t\tc.Cmd = exec.Command(string(ExecNomad), args...)\n\t\t}\n\n\t\tic := &InternalCommand{\n\t\t\tCmd: c.Cmd,\n\t\t\tUi: c.Ui,\n\t\t}\n\n\t\tif op = ic.Execute(); 0 != op {\n\t\t\tc.Ui.Error(\"Error creating Volume\")\n\t\t\treturn op\n\t\t}\n\t\treturn 1\n\t}\n\tif c.vsmname != \" \" {\n\t\tif strings.HasSuffix(c.size, \"G\") != true {\n\t\t\tfmt.Println(\"-size should contain the suffix 'G',which represent the size in GB (exp: 10G)\")\n\t\t\treturn 0\n\t\t}\n\t\tjobID := c.vsmname\n\n\t\t// Get the HTTP client\n\t\tclient, err := c.Meta.Client()\n\t\tif err != nil {\n\t\t\tc.Ui.Error(fmt.Sprintf(\"Error initializing client: %s\", err))\n\t\t\treturn 1\n\t\t}\n\t\t// Check if the VSM exists\n\t\tjob, _, err := client.Jobs().Info(jobID, nil)\n\t\tif err == nil || job != nil {\n\t\t\tc.Ui.Error(fmt.Sprintf(\"Volume already exist: %q\", jobID))\n\t\t\treturn 1\n\t\t}\n\n\t\tresp := CreateAPIVsm(c.vsmname, c.size)\n\t\tif resp != nil {\n\t\t\tc.Ui.Error(fmt.Sprintf(\"Error Creating Volume %v\", resp))\n\t\t}\n\t}\n\treturn op\n}", "title": "" }, { "docid": "b8b2815c002d61f817da1a3d17c7ff7d", "score": "0.4821322", "text": "func Run(cmd *cobra.Command, v *viper.Viper) {\n\tif err := config.ReadInConfig(v, config.FilePath); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"failed to load configuration file: %s\", err)\n\n\t\tos.Exit(exitcode.ErrConfigFileParse)\n\t}\n\n\tSetupLogging(v)\n\n\tif v.GetBool(\"useragent\") {\n\t\tlog.Debugln(\"command: useragent\")\n\n\t\tif plugin := vipertools.GetString(v, \"plugin\"); plugin != \"\" {\n\t\t\tfmt.Println(heartbeat.UserAgent(plugin))\n\n\t\t\tos.Exit(exitcode.Success)\n\t\t}\n\n\t\tfmt.Println(heartbeat.UserAgentUnknownPlugin())\n\n\t\tos.Exit(exitcode.Success)\n\t}\n\n\tif v.GetBool(\"version\") {\n\t\tlog.Debugln(\"command: version\")\n\n\t\tRunCmd(v, runVersion)\n\t}\n\n\tif v.IsSet(\"config-read\") {\n\t\tlog.Debugln(\"command: config-read\")\n\n\t\tRunCmd(v, configread.Run)\n\t}\n\n\tif v.IsSet(\"config-write\") {\n\t\tlog.Debugln(\"command: config-write\")\n\n\t\tRunCmd(v, configwrite.Run)\n\t}\n\n\tif v.GetBool(\"today\") {\n\t\tlog.Debugln(\"command: today\")\n\n\t\tRunCmd(v, today.Run)\n\t}\n\n\tif v.IsSet(\"today-goal\") {\n\t\tlog.Debugln(\"command: today-goal\")\n\n\t\tRunCmd(v, todaygoal.Run)\n\t}\n\n\tif v.IsSet(\"entity\") {\n\t\tlog.Debugln(\"command: heartbeat\")\n\n\t\tRunCmdWithOfflineSync(v, heartbeatcmd.Run)\n\t}\n\n\tif v.IsSet(\"sync-offline-activity\") {\n\t\tlog.Debugln(\"command: sync-offline-activity\")\n\n\t\tRunCmd(v, offlinesync.Run)\n\t}\n\n\tif v.GetBool(\"offline-count\") {\n\t\tlog.Debugln(\"command: offline-count\")\n\n\t\tRunCmd(v, offlinecount.Run)\n\t}\n\n\tlog.Warnf(\"one of the following parameters has to be provided: %s\", strings.Join([]string{\n\t\t\"--config-read\",\n\t\t\"--config-write\",\n\t\t\"--entity\",\n\t\t\"--offline-count\",\n\t\t\"--sync-offline-activity\",\n\t\t\"--today\",\n\t\t\"--today-goal\",\n\t\t\"--useragent\",\n\t\t\"--version\",\n\t}, \", \"))\n\n\t_ = cmd.Help()\n\n\tos.Exit(exitcode.ErrDefault)\n}", "title": "" }, { "docid": "a236e868a4b2a61bdd895f7974e11fc7", "score": "0.48205927", "text": "func EC2Start(instanceID, region string) error {\n\n\tsess := common.GetAWSSession(region)\n\n\t// Create new EC2 client\n\tec2Svc := ec2.New(sess)\n\n\tinput := &ec2.StartInstancesInput{\n\t\tInstanceIds: []*string{\n\t\t\taws.String(instanceID),\n\t\t},\n\t}\n\n\tresult, err := ec2Svc.StartInstances(input)\n\tif err != nil {\n\t\treturn common.CheckAWSError(err)\n\t}\n\n\tlog.InfoWithValues(\"Starting ec2 instance:\", logrus.Fields{\n\t\t\"CurrentState\": *result.StartingInstances[0].CurrentState.Name,\n\t\t\"PreviousState\": *result.StartingInstances[0].PreviousState.Name,\n\t\t\"InstanceId\": *result.StartingInstances[0].InstanceId,\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "c6a0b3faa0872b0c88959aeb1d7a0b0f", "score": "0.47991887", "text": "func pollForEC2() (instances []virtualMachine, err error) {\n\tparams := &ec2.DescribeInstancesInput{\n\t\tFilters: []ec2.Filter{\n\t\t\t{\n\t\t\t\tName: aws.String(\"tag:\" + requiredTagKey),\n\t\t\t\tValues: []string{\n\t\t\t\t\trequiredTagValue,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tfor region, awsSvcClient := range awsClients {\n\t\tpollEC2StartTime := time.Now()\n\t\treq := awsSvcClient.DescribeInstancesRequest(params)\n\t\tresp, respErr := req.Send(context.Background())\n\t\tif respErr != nil {\n\t\t\tlog.Errorf(\"failed to describe instances, %s, %v\", region, respErr)\n\t\t\terr = respErr\n\t\t\treturn\n\t\t}\n\n\t\tfor _, reservation := range resp.Reservations {\n\t\t\tfor _, instance := range reservation.Instances {\n\t\t\t\tinstanceObj := virtualMachine{\n\t\t\t\t\tInstanceID: *instance.InstanceId, State: string(instance.State.Name),\n\t\t\t\t\tInstanceType: string(instance.InstanceType),\n\t\t\t\t\tRegion: region,\n\t\t\t\t}\n\t\t\t\t// populate info from tags\n\t\t\t\tisASG := false\n\t\t\t\tfor _, tag := range instance.Tags {\n\t\t\t\t\tif *tag.Key == environmentTagKey && *tag.Value != \"\" {\n\t\t\t\t\t\tinstanceObj.Environment = *tag.Value\n\t\t\t\t\t}\n\t\t\t\t\tif *tag.Key == \"Name\" {\n\t\t\t\t\t\tinstanceObj.Name = *tag.Value\n\t\t\t\t\t}\n\t\t\t\t\tif *tag.Key == \"aws:autoscaling:groupName\" {\n\t\t\t\t\t\tisASG = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// if true Instance is part of ASG. bypass this instance\n\t\t\t\tif isASG {\n\t\t\t\t\tcontinue // goto next instance\n\t\t\t\t}\n\t\t\t\t// determine instance cpu and memory\n\t\t\t\tif details, found := getInstanceTypeDetails(instanceObj.InstanceType); found {\n\t\t\t\t\tinstanceObj.MemoryGB = details.MemoryGB\n\t\t\t\t\tinstanceObj.VCPU = details.VCPU\n\t\t\t\t\tif pricingstr, ok := details.PricingHourlyByRegion[region]; ok {\n\t\t\t\t\t\tpricing, err := strconv.ParseFloat(pricingstr, 64)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Errorf(\"failed to parse pricing info to float: %s\", pricingstr)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinstanceObj.PricingHourly = pricing\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif validateEnvName(instanceObj.Environment) {\n\t\t\t\t\tinstances = append(instances, instanceObj)\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\telapsed := time.Since(pollEC2StartTime)\n\t\tlog.Debugf(\"polling for EC2s in region %s took %s\", region, elapsed)\n\t}\n\treturn\n}", "title": "" }, { "docid": "67110c5c445d72a681c04d118e0cb4f5", "score": "0.47981638", "text": "func (c *SSHConnector) Command(name string, args ...string) InstanceCmd {\n\t// TODO(fxbug.dev/45424): Would be best to shell escape\n\tcmdline := strings.Join(append([]string{name}, args...), \" \")\n\treturn &SSHInstanceCmd{connector: c, cmdline: cmdline}\n}", "title": "" }, { "docid": "5edc91820459d16b30aeffd104e92446", "score": "0.47809085", "text": "func runAci() {\n\tif net == \"\" {\n\t\tnet = \"host\"\n\t}\n\n\tcommand := fmt.Sprintf(\"rkt --insecure-options=image --net=%s --interactive=true %s run %s\", net, getMountConfig(), getAciPath(\"dev\"))\n\tfmt.Println(command)\n\tutils.Execute(strings.Split(command, \" \"), streams.NewStdIO())\n}", "title": "" }, { "docid": "4ab51916678b3b0d08137da45f555107", "score": "0.4776496", "text": "func (builder AMBuilder) runCmd(cmd ...string) {\n\trargs := cmd\n\tlog.Printf(\"runCmd: %s\", rargs)\n\tbuilder.dockerImage.Run(rargs...)\n}", "title": "" }, { "docid": "8cae060e7af830ac7f8f15b689c669ea", "score": "0.47727904", "text": "func (tc *TeleportClient) runCommandOnNodes(ctx context.Context, clt *ClusterClient, nodeAddresses []string, command []string) error {\n\tcluster := clt.ClusterName()\n\tctx, span := tc.Tracer.Start(\n\t\tctx,\n\t\t\"teleportClient/runCommandOnNodes\",\n\t\toteltrace.WithSpanKind(oteltrace.SpanKindClient),\n\t\toteltrace.WithAttributes(\n\t\t\tattribute.String(\"cluster\", cluster),\n\t\t),\n\t)\n\tdefer span.End()\n\n\t// Let's check if the first node requires mfa.\n\t// If it's required, run commands sequentially to avoid\n\t// race conditions and weird ux during mfa.\n\tmfaRequiredCheck, err := clt.AuthClient.IsMFARequired(ctx, &proto.IsMFARequiredRequest{\n\t\tTarget: &proto.IsMFARequiredRequest_Node{\n\t\t\tNode: &proto.NodeLogin{\n\t\t\t\tNode: nodeName(nodeAddresses[0]),\n\t\t\t\tLogin: tc.Config.HostLogin,\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tg, gctx := errgroup.WithContext(ctx)\n\tg.SetLimit(commandLimit(ctx, clt.AuthClient, mfaRequiredCheck.Required))\n\tfor _, address := range nodeAddresses {\n\t\taddress := address\n\t\tg.Go(func() error {\n\t\t\tctx, span := tc.Tracer.Start(\n\t\t\t\tgctx,\n\t\t\t\t\"teleportClient/executingCommand\",\n\t\t\t\toteltrace.WithSpanKind(oteltrace.SpanKindClient),\n\t\t\t\toteltrace.WithAttributes(attribute.String(\"node\", address)),\n\t\t\t)\n\t\t\tdefer span.End()\n\n\t\t\tnodeClient, err := tc.ConnectToNode(\n\t\t\t\tctx,\n\t\t\t\tclt,\n\t\t\t\tNodeDetails{\n\t\t\t\t\tAddr: address,\n\t\t\t\t\tNamespace: tc.Namespace,\n\t\t\t\t\tCluster: cluster,\n\t\t\t\t\tMFACheck: mfaRequiredCheck,\n\t\t\t\t},\n\t\t\t\ttc.Config.HostLogin,\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintln(tc.Stderr, err)\n\t\t\t\treturn trace.Wrap(err)\n\t\t\t}\n\t\t\tdefer nodeClient.Close()\n\n\t\t\tfmt.Printf(\"Running command on %v:\\n\", nodeName(address))\n\n\t\t\treturn trace.Wrap(nodeClient.RunCommand(ctx, command))\n\t\t})\n\t}\n\n\treturn trace.Wrap(g.Wait())\n}", "title": "" }, { "docid": "7fc3804cdf50977db87a1287fc668e23", "score": "0.47559395", "text": "func (c *cmdStop) Command() *cobra.Command {\n\tcmdAction := cmdAction{global: c.global}\n\tc.action = &cmdAction\n\n\tcmd := c.action.Command(\"stop\")\n\tcmd.Use = usage(\"stop\", i18n.G(\"[<remote>:]<instance> [[<remote>:]<instance>...]\"))\n\tcmd.Short = i18n.G(\"Stop instances\")\n\tcmd.Long = cli.FormatSection(i18n.G(\"Description\"), i18n.G(\n\t\t`Stop instances`))\n\n\treturn cmd\n}", "title": "" }, { "docid": "d1aa4654f913a5bca2ae56dfc5379354", "score": "0.4746808", "text": "func (ctl *TcaCtl) CmdTerminateInstances() *cobra.Command {\n\n\tvar (\n\t\tdoBlock bool\n\t\tshowProgress bool\n\t)\n\n\tvar cmdTerminate = &cobra.Command{\n\t\tUse: \"terminate [instance name or id]\",\n\t\tShort: \"Command terminates CNF or VNF instance\",\n\t\tLong: templates.LongDesc(`\nThe command terminates active CNF or VNF instances.\n`),\n\t\tAliases: []string{\"down\"},\n\t\tArgs: cobra.MinimumNArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\n\t\t\tdoBlock, err := cmd.Flags().GetBool(CliBlock)\n\t\t\tCheckErrLogError(err)\n\n\t\t\tctl.checkDefaultsConfig()\n\t\t\terr = ctl.tca.TerminateCnfInstance(context.Background(),\n\t\t\t\t&api.TerminateInstanceApiReq{\n\t\t\t\t\tInstanceName: args[0],\n\t\t\t\t\tClusterName: ctl.DefaultClusterName,\n\t\t\t\t\tIsBlocking: doBlock,\n\t\t\t\t\tIsVerbose: showProgress,\n\t\t\t\t})\n\t\t\tCheckErrLogError(err)\n\n\t\t\tfmt.Println(\"Successfully updated state.\")\n\t\t},\n\t}\n\n\t//\n\tcmdTerminate.Flags().BoolVarP(&doBlock, CliBlock, \"b\", false,\n\t\t\"Flag instructs to blocks and pools the status of the operation.\")\n\n\t//\n\tcmdTerminate.Flags().BoolVarP(&showProgress, CliProgress, \"s\", false,\n\t\t\"Show task progress.\")\n\n\treturn cmdTerminate\n}", "title": "" }, { "docid": "1849b1a24368c59dbfb752320a182001", "score": "0.47450656", "text": "func (c *Client) Run(ctx context.Context) error {\n\tfor _, target := range c.config.Targets {\n\t\tlog.Printf(\"Running %q\", target.Title)\n\t\terr := c.runTarget(ctx, target)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"target %q failed: %w\", target, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b6f2abddf613fd75e14d83a971f036f7", "score": "0.4737074", "text": "func (d *Ec2Driver) Create_Instance(params map[string]interface{}) (interface{}, error) {\n\tinput := &ec2.RunInstancesInput{}\n\tvar err error\n\n\t// Required params\n\terr = setFieldWithType(params[\"image\"], input, \"ImageId\", awsstr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = setFieldWithType(params[\"count\"], input, \"MaxCount\", awsint64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = setFieldWithType(params[\"count\"], input, \"MinCount\", awsint64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = setFieldWithType(params[\"type\"], input, \"InstanceType\", awsstr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = setFieldWithType(params[\"subnet\"], input, \"SubnetId\", awsstr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Extra params\n\tif _, ok := params[\"key\"]; ok {\n\t\terr = setFieldWithType(params[\"key\"], input, \"KeyName\", awsstr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, ok := params[\"ip\"]; ok {\n\t\terr = setFieldWithType(params[\"ip\"], input, \"PrivateIpAddress\", awsstr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, ok := params[\"userdata\"]; ok {\n\t\terr = setFieldWithType(params[\"userdata\"], input, \"UserData\", awsstr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, ok := params[\"group\"]; ok {\n\t\terr = setFieldWithType(params[\"group\"], input, \"SecurityGroupIds\", awsstringslice)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, ok := params[\"lock\"]; ok {\n\t\terr = setFieldWithType(params[\"lock\"], input, \"DisableApiTermination\", awsboolattribute)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tstart := time.Now()\n\tvar output *ec2.Reservation\n\toutput, err = d.RunInstances(input)\n\toutput = output\n\tif err != nil {\n\t\td.logger.Errorf(\"create instance error: %s\", err)\n\t\treturn nil, err\n\t}\n\td.logger.ExtraVerbosef(\"ec2.RunInstances call took %s\", time.Since(start))\n\tid := aws.StringValue(output.Instances[0].InstanceId)\n\ttagsParams := map[string]interface{}{\"resource\": id}\n\tif v, ok := params[\"name\"]; ok {\n\t\ttagsParams[\"Name\"] = v\n\t}\n\tif len(tagsParams) > 1 {\n\t\t_, err := d.Create_Tags(tagsParams)\n\t\tif err != nil {\n\t\t\td.logger.Errorf(\"create instance: adding tags: error: %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\t}\n\td.logger.Verbosef(\"create instance '%s' done\", id)\n\treturn aws.StringValue(output.Instances[0].InstanceId), nil\n}", "title": "" }, { "docid": "2be20022b355c063f736de2c2c45bc06", "score": "0.4735016", "text": "func (d *Ec2Driver) Create_Instance_DryRun(params map[string]interface{}) (interface{}, error) {\n\tinput := &ec2.RunInstancesInput{}\n\tinput.DryRun = aws.Bool(true)\n\tvar err error\n\n\t// Required params\n\terr = setFieldWithType(params[\"image\"], input, \"ImageId\", awsstr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = setFieldWithType(params[\"count\"], input, \"MaxCount\", awsint64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = setFieldWithType(params[\"count\"], input, \"MinCount\", awsint64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = setFieldWithType(params[\"type\"], input, \"InstanceType\", awsstr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = setFieldWithType(params[\"subnet\"], input, \"SubnetId\", awsstr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Extra params\n\tif _, ok := params[\"key\"]; ok {\n\t\terr = setFieldWithType(params[\"key\"], input, \"KeyName\", awsstr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, ok := params[\"ip\"]; ok {\n\t\terr = setFieldWithType(params[\"ip\"], input, \"PrivateIpAddress\", awsstr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, ok := params[\"userdata\"]; ok {\n\t\terr = setFieldWithType(params[\"userdata\"], input, \"UserData\", awsstr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, ok := params[\"group\"]; ok {\n\t\terr = setFieldWithType(params[\"group\"], input, \"SecurityGroupIds\", awsstringslice)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, ok := params[\"lock\"]; ok {\n\t\terr = setFieldWithType(params[\"lock\"], input, \"DisableApiTermination\", awsboolattribute)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t_, err = d.RunInstances(input)\n\tif awsErr, ok := err.(awserr.Error); ok {\n\t\tswitch code := awsErr.Code(); {\n\t\tcase code == dryRunOperation, strings.HasSuffix(code, notFound):\n\t\t\tid := fakeDryRunId(\"instance\")\n\t\t\ttagsParams := map[string]interface{}{\"resource\": id}\n\t\t\tif v, ok := params[\"name\"]; ok {\n\t\t\t\ttagsParams[\"Name\"] = v\n\t\t\t}\n\t\t\tif len(tagsParams) > 1 {\n\t\t\t\t_, err = d.Create_Tags_DryRun(tagsParams)\n\t\t\t\tif err != nil {\n\t\t\t\t\td.logger.Errorf(\"create instance: adding tags: error: %s\", err)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t\td.logger.Verbose(\"full dry run: create instance ok\")\n\t\t\treturn id, nil\n\t\t}\n\t}\n\n\td.logger.Errorf(\"dry run: create instance error: %s\", err)\n\treturn nil, err\n}", "title": "" }, { "docid": "b6e8bb84ceea77817f69dee3c91e8966", "score": "0.47341698", "text": "func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsInstance, error) {\n\tvar clustersArn []*string\n\tvar clusters Clusters\n\n\tif p.AutoDiscoverClusters {\n\t\tinput := &ecs.ListClustersInput{}\n\t\tfor {\n\t\t\tresult, err := client.ecs.ListClusters(input)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif result != nil {\n\t\t\t\tclustersArn = append(clustersArn, result.ClusterArns...)\n\t\t\t\tinput.NextToken = result.NextToken\n\t\t\t\tif result.NextToken == nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfor _, cArn := range clustersArn {\n\t\t\tclusters = append(clusters, *cArn)\n\t\t}\n\t} else if p.Cluster != \"\" {\n\t\t// TODO: Deprecated configuration - Need to be removed in the future\n\t\tclusters = Clusters{p.Cluster}\n\t\tlog.Warn(\"Deprecated configuration found: ecs.cluster \" +\n\t\t\t\"Please use ecs.clusters instead.\")\n\t} else {\n\t\tclusters = p.Clusters\n\t}\n\n\tvar instances []ecsInstance\n\n\tlog.Debugf(\"ECS Clusters: %s\", clusters)\n\n\tfor _, c := range clusters {\n\n\t\treq, _ := client.ecs.ListTasksRequest(&ecs.ListTasksInput{\n\t\t\tCluster: &c,\n\t\t\tDesiredStatus: aws.String(ecs.DesiredStatusRunning),\n\t\t})\n\n\t\tvar taskArns []*string\n\n\t\tfor ; req != nil; req = req.NextPage() {\n\t\t\tif err := wrapAws(ctx, req); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\ttaskArns = append(taskArns, req.Data.(*ecs.ListTasksOutput).TaskArns...)\n\t\t}\n\n\t\t// Skip to the next cluster if there are no tasks found on\n\t\t// this cluster.\n\t\tif len(taskArns) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tchunkedTaskArns := chunkedTaskArns(taskArns)\n\t\tvar tasks []*ecs.Task\n\n\t\tfor _, arns := range chunkedTaskArns {\n\t\t\treq, taskResp := client.ecs.DescribeTasksRequest(&ecs.DescribeTasksInput{\n\t\t\t\tTasks: arns,\n\t\t\t\tCluster: &c,\n\t\t\t})\n\n\t\t\tif err := wrapAws(ctx, req); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttasks = append(tasks, taskResp.Tasks...)\n\n\t\t}\n\n\t\tcontainerInstanceArns := make([]*string, 0)\n\t\tbyContainerInstance := make(map[string]int)\n\n\t\ttaskDefinitionArns := make([]*string, 0)\n\t\tbyTaskDefinition := make(map[string]int)\n\n\t\tfor _, task := range tasks {\n\t\t\tif _, found := byContainerInstance[aws.StringValue(task.ContainerInstanceArn)]; !found {\n\t\t\t\tbyContainerInstance[aws.StringValue(task.ContainerInstanceArn)] = len(containerInstanceArns)\n\t\t\t\tcontainerInstanceArns = append(containerInstanceArns, task.ContainerInstanceArn)\n\t\t\t}\n\t\t\tif _, found := byTaskDefinition[aws.StringValue(task.TaskDefinitionArn)]; !found {\n\t\t\t\tbyTaskDefinition[aws.StringValue(task.TaskDefinitionArn)] = len(taskDefinitionArns)\n\t\t\t\ttaskDefinitionArns = append(taskDefinitionArns, task.TaskDefinitionArn)\n\t\t\t}\n\t\t}\n\n\t\tmachines, err := p.lookupEc2Instances(ctx, client, &c, containerInstanceArns)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttaskDefinitions, err := p.lookupTaskDefinitions(ctx, client, taskDefinitionArns)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, task := range tasks {\n\n\t\t\tmachineIdx := byContainerInstance[aws.StringValue(task.ContainerInstanceArn)]\n\t\t\ttaskDefIdx := byTaskDefinition[aws.StringValue(task.TaskDefinitionArn)]\n\n\t\t\tfor _, container := range task.Containers {\n\n\t\t\t\ttaskDefinition := taskDefinitions[taskDefIdx]\n\t\t\t\tvar containerDefinition *ecs.ContainerDefinition\n\t\t\t\tfor _, def := range taskDefinition.ContainerDefinitions {\n\t\t\t\t\tif aws.StringValue(container.Name) == aws.StringValue(def.Name) {\n\t\t\t\t\t\tcontainerDefinition = def\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tinstances = append(instances, ecsInstance{\n\t\t\t\t\tName: fmt.Sprintf(\"%s-%s\", strings.Replace(aws.StringValue(task.Group), \":\", \"-\", 1), *container.Name),\n\t\t\t\t\tID: (aws.StringValue(task.TaskArn))[len(aws.StringValue(task.TaskArn))-12:],\n\t\t\t\t\ttask: task,\n\t\t\t\t\ttaskDefinition: taskDefinition,\n\t\t\t\t\tcontainer: container,\n\t\t\t\t\tcontainerDefinition: containerDefinition,\n\t\t\t\t\tmachine: machines[machineIdx],\n\t\t\t\t\tTraefikLabels: aws.StringValueMap(containerDefinition.DockerLabels),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn instances, nil\n}", "title": "" }, { "docid": "1353e97ae8a1f7e5a4f59a29c37cdd2f", "score": "0.47331083", "text": "func Run(command string, args []string) {\n\tlog.Println(\"Running command \" + command)\n\tlog.Println(strings.Join(args, \" \"))\n\tcmd := exec.Command(command, args...)\n\terr := cmd.Run()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "423852225659c582474c08ade2413021", "score": "0.47235245", "text": "func (c *cmdStart) Command() *cobra.Command {\n\tcmdAction := cmdAction{global: c.global}\n\tc.action = &cmdAction\n\n\tcmd := c.action.Command(\"start\")\n\tcmd.Use = usage(\"start\", i18n.G(\"[<remote>:]<instance> [[<remote>:]<instance>...]\"))\n\tcmd.Short = i18n.G(\"Start instances\")\n\tcmd.Long = cli.FormatSection(i18n.G(\"Description\"), i18n.G(\n\t\t`Start instances`))\n\n\treturn cmd\n}", "title": "" }, { "docid": "aa16dbe55aabc7c5fd645df761ad1338", "score": "0.4719323", "text": "func (c *GetVMSlotsCmd) Run(app subcommands.Application, args []string, env subcommands.Env) int {\n\tctx := cli.GetContext(app, c, env)\n\tclient := getClient(ctx)\n\tresp, err := client.FindVMSlots(ctx, &c.req)\n\tif err != nil {\n\t\terrors.Log(ctx, err)\n\t\treturn 1\n\t}\n\tprintVMSlots(c.f.tsv, resp.Hosts...)\n\treturn 0\n}", "title": "" }, { "docid": "3278d9c1e369e78a574ee7b16731bcf5", "score": "0.47172838", "text": "func Run(args []string) error {\n\tif len(args) == 0 {\n\t\treturn errors.New(\"You must provide a command to run into the container\")\n\t}\n\n\t// Reexec self process (fork) with cloned namespaces and additional\n\t// configuration to isolate the command execution\n\tcmd := exec.Command(selfProc, args[1:]...)\n\tcmd.Stdin = os.Stdin\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\tcmd.Env = os.Environ()\n\tcmd.SysProcAttr = &syscall.SysProcAttr{\n\t\t// Namespaces to clone\n\t\tCloneflags: syscall.CLONE_NEWNS |\n\t\t\tsyscall.CLONE_NEWUTS |\n\t\t\t// syscall.CLONE_NEWIPC |\n\t\t\tsyscall.CLONE_NEWPID |\n\t\t\tsyscall.CLONE_NEWNET |\n\t\t\tsyscall.CLONE_NEWUSER,\n\t\t// Map container to host users and groups\n\t\tUidMappings: []syscall.SysProcIDMap{\n\t\t\t{\n\t\t\t\tContainerID: 0,\n\t\t\t\tHostID: os.Getuid(),\n\t\t\t\tSize: 1,\n\t\t\t},\n\t\t},\n\t\tGidMappings: []syscall.SysProcIDMap{\n\t\t\t{\n\t\t\t\tContainerID: 0,\n\t\t\t\tHostID: os.Getegid(),\n\t\t\t\tSize: 1,\n\t\t\t},\n\t\t},\n\t\t// Maintain the root permissions for configuring network into the container\n\t\t// FIXME: execute only the network configuration as root\n\t\tCredential: &syscall.Credential{Uid: 0},\n\t}\n\n\tif err := cmd.Start(); err != nil {\n\t\treturn fmt.Errorf(\"Could not start command execution - %s\", err)\n\t}\n\n\tc, err := loadCfg()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not read the settings - %s\", err)\n\t}\n\n\tif err := configureNetworkOnHost(c.Network.Bridge, c.Network.Veth, c.Network.CIDR, cmd.Process.Pid); err != nil {\n\t\treturn err\n\t}\n\n\tif err := cmd.Wait(); err != nil {\n\t\treturn fmt.Errorf(\"Error waiting for the command execution to finish - %s\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5f033dd69664dd1bd04ec4ecd6256fe0", "score": "0.4712246", "text": "func RunCommand(from *cobra.Command, commandToRun string, args ...string) error {\n\tcmd, _, err := from.Root().Find(append([]string{commandToRun}, args...))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = cmd.ParseFlags(args); err != nil {\n\t\treturn err\n\t}\n\n\tif fn := cmd.PreRunE; fn != nil {\n\t\tif err = fn(cmd, args); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err = cmd.RunE(cmd, args); err != nil {\n\t\treturn err\n\t}\n\n\tif fn := cmd.PostRunE; fn != nil {\n\t\treturn fn(cmd, args)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8308f85863ed0156a22030f97e1fcf81", "score": "0.47087952", "text": "func perform() Response {\n\tlog.Println(\"Auditing RDS Instances\")\n\tauditableInstances := listAuditableRDSInstances() //todo, make region look up parallel\n\tlog.Printf(\"Found %v Instances with the correct tags\", len(auditableInstances))\n\tvar wg sync.WaitGroup\n\tfor _, instance := range auditableInstances {\n\t\twg.Add(1)\n\t\tgo func(i rDSInstance, x *sync.WaitGroup) {\n\t\t\tdefer x.Done()\n\t\t\tlog.Println(\"Attempting to establish connection to perform audit for RDS instance\", i.identifier)\n\t\t\tcreds := retrieveCredentials(i)\n\t\t\tconnection := buildConnectionOptions(i, creds)\n\t\t\tschemasToAudit := schemaList(i)\n\t\t\tAuditGrowth(i, connection, schemasToAudit)\n\t\t}(instance, &wg)\n\t}\n\twg.Wait()\n\treturn Response{Message: \"tracking run completed\"}\n}", "title": "" }, { "docid": "0d6626b342d148761a2207c03df894c6", "score": "0.46968564", "text": "func (cmd *Containers) Execute() error {\n containerd, err := NewContainerd()\n if err != nil {\n Logger.Error(err)\n return err\n }\n\n Logger.Info(\"Getting list of containers from containerd\")\n containers, err := containerd.Client.Containers(containerd.Context, \"\")\n if err != nil {\n return err\n }\n\n fmt.Println(\"Name\\t\\tImage\\n--------------\\t--------------\")\n for _, container := range containers {\n name := container.ID()\n image, err := container.Image(containerd.Context)\n if err != nil {\n Logger.Error(\"Unknown image for container \", name, \": \", err)\n return err\n }\n fmt.Printf(\"%v\\t%v\\n\", name, image.Name())\n }\n\n return nil\n}", "title": "" }, { "docid": "d6304a30f9ad3eb05e9757a34730545b", "score": "0.4693336", "text": "func execCmd(ctx *cli.Context) error {\n\tprofile, cfg, err := resolveConfig(ctx, guessNArgs(ctx.NArg()))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !ctx.Args().Present() && len(profile) < 1 {\n\t\tlog.Errorln(\"nothing to do!\")\n\t\tcli.ShowAppHelpAndExit(ctx, 1)\n\t}\n\n\tvar c client.AwsClient\n\tc, err = clientFactory.Get(cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif ctx.Bool(refreshFlag.Name) {\n\t\trefreshCreds(c)\n\t}\n\n\t// do a single-shot credential fetch since there's a number of situations below where we'll use\n\t// them. We get the added benefit of having any external IdP authentication handled before\n\t// possibly heading down the path of starting the ecs credential endpoint\n\tvar creds *credentials.Credentials\n\tcreds, err = c.Credentials()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif strings.EqualFold(ctx.String(fmtFlag.Name), \"json\") {\n\t\t// truly a one-shot operation, the credentials_process logic will re-exec the command to refresh credentials\n\t\t// don't handle any other formatting options, or do any thing else, just poop out json formatted credentials\n\t\t// REF: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sourcing-external.html\n\t\tvar out []byte\n\t\tout, err = creds.CredentialsProcess()\n\t\tif err != nil {\n\t\t\t// error will be json marshaling failure\n\t\t\treturn err\n\t\t}\n\t\tfmt.Printf(\"%s\\n\", out)\n\t\treturn nil\n\t}\n\n\tif ctx.Bool(expFlag.Name) {\n\t\tprintCredExpiration(creds)\n\t}\n\n\tif ctx.Bool(whoamiFlag.Name) {\n\t\tif err = printCredIdentity(sts.NewFromConfig(c.ConfigProvider())); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tcmd := ctx.Args().Slice()\n\tif ctx.Args().First() == profile {\n\t\tcmd = ctx.Args().Tail()\n\t}\n\n\tenv := buildEnv(cfg.Region, creds)\n\n\tif len(cmd) > 0 {\n\t\tif ctx.Bool(envFlag.Name) {\n\t\t\t// set credentials in environment, don't start ecs endpoint\n\t\t\tfor k, v := range env {\n\t\t\t\t_ = os.Setenv(k, v)\n\t\t\t}\n\t\t} else {\n\t\t\tvar ch <-chan bool\n\t\t\tch, err = runEcsSvc(c, cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t<-ch\n\t\t\tlog.Debugf(\"ECS endpoint ready\")\n\t\t}\n\n\t\twrapped := wrapCmd(cmd)\n\t\tc := exec.Command(wrapped[0], wrapped[1:]...) //nolint:gosec // it's sort of the whole reason this tool exists\n\t\tc.Stdin = os.Stdin\n\t\tc.Stdout = os.Stdout\n\t\tc.Stderr = os.Stderr\n\n\t\tinstallSignalHandler()\n\t\tif err = c.Run(); err != nil {\n\t\t\tlog.Debug(\"Error running command\")\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tprintCreds(env)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "230b26c9ee45c6bba7e4f66a37614d24", "score": "0.4686394", "text": "func (s *Servo) RunECCommand(ctx context.Context, cmd string) error {\n\tif err := s.SetString(ctx, ECUARTRegexp, \"None\"); err != nil {\n\t\treturn errors.Wrap(err, \"Clearing EC UART Regexp\")\n\t}\n\treturn s.SetString(ctx, ECUARTCmd, cmd)\n}", "title": "" }, { "docid": "58895cf1f9a92343fea003783c2c31ca", "score": "0.46853715", "text": "func (c *cmdAction) Command(action string) *cobra.Command {\n\tcmd := &cobra.Command{}\n\tcmd.RunE = c.Run\n\n\tcmd.Flags().BoolVar(&c.flagAll, \"all\", false, i18n.G(\"Run against all instances\"))\n\n\tif action == \"stop\" {\n\t\tcmd.Flags().BoolVar(&c.flagStateful, \"stateful\", false, i18n.G(\"Store the instance state\"))\n\t} else if action == \"start\" {\n\t\tcmd.Flags().BoolVar(&c.flagStateless, \"stateless\", false, i18n.G(\"Ignore the instance state\"))\n\t}\n\n\tif shared.StringInSlice(action, []string{\"start\", \"restart\", \"stop\"}) {\n\t\tcmd.Flags().StringVar(&c.flagConsole, \"console\", \"\", i18n.G(\"Immediately attach to the console\")+\"``\")\n\t\tcmd.Flags().Lookup(\"console\").NoOptDefVal = \"console\"\n\t}\n\n\tif shared.StringInSlice(action, []string{\"restart\", \"stop\"}) {\n\t\tcmd.Flags().BoolVarP(&c.flagForce, \"force\", \"f\", false, i18n.G(\"Force the instance to stop\"))\n\t\tcmd.Flags().IntVar(&c.flagTimeout, \"timeout\", -1, i18n.G(\"Time to wait for the instance to shutdown cleanly\")+\"``\")\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "c3fea23206cdbbaf18884e63f4997217", "score": "0.46844223", "text": "func getRunningInstances(machine *machinev1.Machine, client aliCloudClient.Client, regionId string) ([]*ecs.Instance, error) {\n\treturn getInstances(machine, client, \"Running\", regionId)\n}", "title": "" }, { "docid": "cf51119eaa4d8a19e8b1ddad595ec1c6", "score": "0.46796224", "text": "func (c *RunCommand) Run(commandArguments []string) int {\n\n\tvar (\n\t\toptions constants.CommonFlags\n\t\timageQueue = utils.NewQueue(0)\n\t)\n\n\tcommandArguments, err := flags.ParseArgs(&options, commandArguments)\n\tif err != nil {\n\t\tlogger.Fatalf(\"Failed to parse runall flags for following CLI arguments:\\n%v\", commandArguments)\n\t}\n\n\tlogger.Debug(\"Entered run command...\")\n\n\tcmdFlags := flag.NewFlagSet(\"run\", flag.ContinueOnError)\n\tcmdFlags.Usage = func() { c.Ui.Output(c.Help()) }\n\n\tif len(commandArguments) == 0 { //only RUN\n\t\tlogger.Fatal(\"Missing arguments.Please specify containers and corrresponding commands or did you mean runall?\")\n\t}\n\n\t//Freeze containers if required.\n\tif len(options.Save) > 0 {\n\t\timageQueue = extractNewImageNames(options.Save)\n\t\tlogger.Debug(\"Save option detected.Following new images will be created:\\n%v\", imageQueue)\n\t}\n\n\tfor index, argument := range commandArguments {\n\n\t\t//Extract the container name\n\t\tlogger.Debug(\"\\nThe %d argument is %s\\n\", index, argument)\n\t\targuments := strings.Split(argument, constants.COMMANDS_DELIMITER)\n\t\tif len(arguments) != 2 {\n\t\t\tlogger.Fatal(\"Wrong arguments format.Please correct.\")\n\t\t}\n\n\t\tchosenContainerName := arguments[0]\n\t\tenteredCommands := arguments[1]\n\n\t\t//Get requested container configuration\n\t\trequestedContainerConfig, requestedContainerState := utils.GetContainerConfigAndState(c.Config, chosenContainerName, true, false) //It must be in the config but not necessarily in the state(for new not daemonized containers)\n\t\tcommand := buildContainerCommand(requestedContainerConfig, chosenContainerName, enteredCommands)\n\n\t\trunCommandInContainer(c.Ui, requestedContainerConfig, requestedContainerState, chosenContainerName, command, options.ForceImage)\n\n\t\t//Freeze container into image if requested (requires updated state file)\n\t\tif options.Update {\n\t\t\tlogger.Debug(\"Overwriting existing image for container %q...\", chosenContainerName)\n\t\t\tfreezeCommand := FreezeCommand{Ui: c.Ui, Config: config.ReadConfig()}\n\t\t\tfreezeCommand.Run([]string{chosenContainerName})\n\t\t} else if imageQueue.Length() > 0 {\n\t\t\tnewImageName := imageQueue.Pop().Value\n\t\t\tfreezeCommand := FreezeCommand{Ui: c.Ui, Config: config.ReadConfig()}\n\t\t\tlogger.Debug(\"Existing container %q will be committed as an image %q\", chosenContainerName, newImageName)\n\t\t\tfreezeCommand.Run([]string{chosenContainerName + constants.FREEZE_DELIMITER + newImageName})\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "a16ee9d612da6b28d302164fbc45fe55", "score": "0.46648785", "text": "func (c *EC2Client) requestEC2Instances(filterKey string, chunk arn.ResourceNames, instances []*ec2.Instance) ([]*ec2.Instance, error) {\n\tparams := &ec2.DescribeInstancesInput{\n\t\tFilters: []*ec2.Filter{\n\t\t\t{Name: aws.String(filterKey), Values: chunk.AWSStringSlice()},\n\t\t},\n\t}\n\n\tfor {\n\t\tctx := aws.BackgroundContext()\n\t\tresp, err := c.DescribeInstancesWithContext(ctx, params)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"{\\\"error\\\": \\\"%s\\\"}\\n\", err)\n\t\t\treturn instances, err\n\t\t}\n\n\t\tfor _, reservation := range resp.Reservations {\n\t\t\tfor _, instance := range reservation.Instances {\n\t\t\t\tif !isInstanceTerminating(instance) {\n\t\t\t\t\tinstances = append(instances, instance)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif aws.StringValue(resp.NextToken) == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\tparams.NextToken = resp.NextToken\n\t}\n\n\treturn instances, nil\n}", "title": "" }, { "docid": "bcb716cda7edb7d19d1716001bb0c43e", "score": "0.466329", "text": "func (ctl *TcaCtl) CmdRollbackInstances() *cobra.Command {\n\n\tvar (\n\t\t_doBlock = false\n\t)\n\n\tvar cmdTerminate = &cobra.Command{\n\t\tUse: \"rollback [instance name or id]\",\n\t\tShort: \"Command rollback CNF or VNF instance\",\n\t\tLong: templates.LongDesc(\n\t\t\t`Rollback CNF instance, caller need to provide valid instance id or a name.`),\n\t\tArgs: cobra.MinimumNArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\n\t\t\tctl.checkDefaultsConfig()\n\n\t\t\terr := ctl.tca.RollbackCnf(context.Background(), args[0], _doBlock, true)\n\t\t\tCheckErrLogError(err)\n\n\t\t\tfmt.Println(\"Successfully rollback state.\")\n\t\t},\n\t}\n\n\t// blocking flag\n\tcmdTerminate.Flags().BoolVarP(&_doBlock, CliBlock, \"b\", false,\n\t\t\"Blocks and Pool the operations status.\")\n\n\treturn cmdTerminate\n}", "title": "" }, { "docid": "5e66b2812193b634b497bb84202c9345", "score": "0.46532506", "text": "func RunCmdTagList(c *CmdConfig) error {\n\tts := c.Tags()\n\ttags, err := ts.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.Display(&displayers.Tag{Tags: tags})\n}", "title": "" }, { "docid": "ef35d1d967cf37756105d1bf8ca6af8d", "score": "0.46464756", "text": "func (m *Main) Run(args ...string) error {\n\tname, args := cmd.ParseCommandName(args)\n\n\t// Extract name from args.\n\tswitch name {\n\tcase \"\", \"help\":\n\t\tif err := help.NewCommand().Run(args...); err != nil {\n\t\t\treturn fmt.Errorf(\"help failed: %s\", err)\n\t\t}\n\tcase \"compact-shard\":\n\t\tc := compact.NewCommand()\n\t\tif err := c.Run(args); err != nil {\n\t\t\treturn fmt.Errorf(\"compact-shard failed: %s\", err)\n\t\t}\n\tcase \"export\":\n\t\tc := export.NewCommand(&ossServer{logger: zap.NewNop()})\n\t\tif err := c.Run(args); err != nil {\n\t\t\treturn fmt.Errorf(\"export failed: %s\", err)\n\t\t}\n\tcase \"import\":\n\t\tc := importer.NewCommand(&ossServer{logger: zap.NewNop()})\n\t\tif err := c.Run(args); err != nil {\n\t\t\treturn fmt.Errorf(\"import failed: %s\", err)\n\t\t}\n\tcase \"gen-init\":\n\t\tc := geninit.NewCommand(&ossServer{logger: zap.NewNop()})\n\t\tif err := c.Run(args); err != nil {\n\t\t\treturn fmt.Errorf(\"gen-init failed: %s\", err)\n\t\t}\n\tcase \"gen-exec\":\n\t\tdeps := genexec.Dependencies{Server: &ossServer{logger: zap.NewNop()}}\n\t\tc := genexec.NewCommand(deps)\n\t\tif err := c.Run(args); err != nil {\n\t\t\treturn fmt.Errorf(\"gen-exec failed: %s\", err)\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(`unknown command \"%s\"`+\"\\n\"+`Run 'influx-tools help' for usage`+\"\\n\\n\", name)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2e5b8794497831c09234ab6a86ea83a5", "score": "0.46343786", "text": "func runWithAgentCmds(app provision.App) ([]string, error) {\n\trunCmd, err := config.GetString(\"docker:run-cmd:bin\")\n\tif err != nil {\n\t\trunCmd = \"/var/lib/tsuru/start\"\n\t}\n\thost, _ := config.GetString(\"host\")\n\ttoken := app.Envs()[\"TSURU_APP_TOKEN\"].Value\n\treturn []string{\"tsuru_unit_agent\", host, token, app.GetName(), runCmd}, nil\n}", "title": "" }, { "docid": "ff4e1971bef0de2bd0bc42c72b57a1ef", "score": "0.46342918", "text": "func CreateEc2Instance(d *CSIDriver, masterIP, volID string, volSizeInGB int64, sess *session.Session) (*ec2.Reservation, error) {\n\tdevName := \"/dev/xvdh\"\n\timageName := \"amzn-ami-hvm-2018.03.0.20180412-x86_64-ebs\" // ensure its in all regions\n\tll := d.log.WithFields(logrus.Fields{\n\t\t\"method\": \"CreateEc2Instance\",\n\t\t\"endpoint\": masterIP,\n\t\t\"volID\": volID,\n\t})\n\n\t// Create an EC2 service client.\n\tsvc := ec2.New(sess)\n\n\t// Check if already instance exists\n\tdescInstanceInput := &ec2.DescribeInstancesInput{\n\t\tFilters: []*ec2.Filter{\n\t\t\t{\n\t\t\t\tName: aws.String(\"tag:volID\"),\n\t\t\t\tValues: []*string{\n\t\t\t\t\taws.String(volID),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tdescInstanceOutput, err := svc.DescribeInstances(descInstanceInput)\n\tif len(descInstanceOutput.Reservations) > 0 {\n\t\tll.Info(\"Instance already exists, skipping creation\")\n\t\treturn descInstanceOutput.Reservations[0], nil\n\t}\n\t// Create SG\n\tsg, err := createSecurityGroup(volID+\"-ec2\", \"Created for moosefs-csi-ec2\", d.awsRegion, svc, masterIP)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Obtain the imageID\n\tll.Info(\"finding optimal Ec2 images\")\n\tdescInput := &ec2.DescribeImagesInput{\n\t\tFilters: []*ec2.Filter{\n\t\t\t&ec2.Filter{\n\t\t\t\tName: aws.String(\"name\"),\n\t\t\t\tValues: []*string{\n\t\t\t\t\taws.String(imageName),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tdescOutput, err := svc.DescribeImages(descInput)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(descOutput.Images) < 1 || descOutput.Images[0].ImageId == nil {\n\t\treturn nil, errors.New(\"Unable to fetch ImageID for ImageName: \" + imageName)\n\t}\n\timageID := descOutput.Images[0].ImageId\n\tuserDataEncoded := encodedUserData(volSizeInGB, devName, masterIP)\n\n\triInput := &ec2.RunInstancesInput{\n\t\tImageId: imageID,\n\t\tInstanceType: aws.String(ec2.InstanceTypeT2Nano),\n\t\tMinCount: aws.Int64(1),\n\t\tMaxCount: aws.Int64(1),\n\t\tUserData: aws.String(userDataEncoded),\n\t\tSecurityGroupIds: []*string{sg[0].GroupId},\n\t\tTagSpecifications: []*ec2.TagSpecification{\n\t\t\t{\n\t\t\t\tResourceType: aws.String(\"instance\"),\n\t\t\t\tTags: []*ec2.Tag{\n\t\t\t\t\t{\n\t\t\t\t\t\tKey: aws.String(\"volID\"),\n\t\t\t\t\t\tValue: aws.String(volID),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tBlockDeviceMappings: []*ec2.BlockDeviceMapping{\n\t\t\t{\n\t\t\t\tDeviceName: aws.String(\"/dev/xvdh\"),\n\t\t\t\tEbs: &ec2.EbsBlockDevice{\n\t\t\t\t\tVolumeSize: aws.Int64(volSizeInGB),\n\t\t\t\t\t//\t\t\t\t\tDeleteOnTermination: aws.Bool(true),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tll.Info(\"Creating Ec2instance\")\n\triOutput, err := svc.RunInstances(riInput)\n\tif err != nil {\n\t\tll.Error(\"Unable to RunInstances: \", volID)\n\t\treturn nil, err\n\t}\n\tll.Info(\"Ec2instance created\")\n\n\treturn riOutput, nil\n\n}", "title": "" }, { "docid": "f6faa23ff2c0215134bdc769cbbacaf8", "score": "0.46326244", "text": "func runCommand(cmd ...string) (string, error) {\n\toutput, err := exec.Command(cmd[0], cmd[1:]...).CombinedOutput()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to run %q: %s (%s)\", strings.Join(cmd, \" \"), err, output)\n\t}\n\treturn string(output), nil\n}", "title": "" }, { "docid": "f6faa23ff2c0215134bdc769cbbacaf8", "score": "0.46326244", "text": "func runCommand(cmd ...string) (string, error) {\n\toutput, err := exec.Command(cmd[0], cmd[1:]...).CombinedOutput()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to run %q: %s (%s)\", strings.Join(cmd, \" \"), err, output)\n\t}\n\treturn string(output), nil\n}", "title": "" }, { "docid": "948ea68a274401a8b03f01cbec9a50bc", "score": "0.4626488", "text": "func (v *virshCommand) Run() error {\n\tif err := v.processArgs(); err != nil {\n\t\treturn err\n\t}\n\tswitch {\n\tcase v.nodeName == \"\" && v.domainNodeName == \"\":\n\t\treturn v.runOnAllNodes()\n\tcase v.domainNodeName == \"\":\n\t\tvar err error\n\t\tv.virtletPodName, err = v.client.GetVirtletPodNameForNode(v.nodeName)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"couldn't get Virtlet pod name for node %q: %v\", v.nodeName, err)\n\t\t}\n\tcase v.nodeName != \"\" && v.domainNodeName != v.nodeName:\n\t\treturn errors.New(\"--node specifies a node other than one that runs the VM pod\")\n\t}\n\n\treturn v.runInVirtletPod(v.virtletPodName)\n}", "title": "" }, { "docid": "f3c930b82bd034bfecfbdb4182e86ea3", "score": "0.4616657", "text": "func runCommand(args, env []string) error {\n\tcmd := exec.Command(args[0], args[1:]...)\n\tcmd.Stdin = os.Stdin\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\tcmd.Env = env\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "be97df63e353b3284f9a03aee620f130", "score": "0.46125072", "text": "func (er *ExampleRunner) Run() error {\n\t// Called when action matches route.\n\tif er.Verbose {\n\t\tlogger.Printf(\"Going to execute %q at the following hosts: %v\", er.Command, er.Hosts)\n\t}\n\t// [..] Executing the SSH command is left to the reader.\n\treturn nil\n}", "title": "" }, { "docid": "82e547f175977dfb4cac48bc5fe69a39", "score": "0.46091992", "text": "func (t *InstructionExecutor) runCommand() {\n\n\tfor {\n\t\tselect {\n\t\tcase <-t.quit:\n\t\t\t// TODO: do clean work.\n\t\t\treturn\n\t\tdefault:\n\t\t\tdidSome := t.doBatchJob()\n\t\t\tif didSome {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttime.Sleep(t.Config.ErrorInterval)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6dafc302156d7325a692d068251c3fee", "score": "0.46083957", "text": "func (o *CommandOptions) Run() error {\n\tcorev1Client := o.clientset.CoreV1()\n\tmetricsv1Client := o.metricsClientset.MetricsV1beta1()\n\n\tfoundPods, err := findPods(o.userSpecifiedNamespace, corev1Client, metricsv1Client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tprintPods(foundPods)\n\treturn nil\n}", "title": "" }, { "docid": "59e72c0427c3ef62ce41f9d6e01aaac1", "score": "0.46060556", "text": "func (c *CommandLineClient) RunOcCommand(args ...string) (string, error) {\n\treturn c.CommandExecutor.RunWithArgs(args...)\n}", "title": "" }, { "docid": "173631b2096fc43341249c5d0b33584b", "score": "0.46058443", "text": "func (s *Server) Run(nInstances int) error {\n\ts.closed = new(int32)\n\tfor i := 0; i < nInstances; i++ {\n\t\tif err := s.run(i); err != nil {\n\t\t\t_ = s.Close()\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b1ce24c422d254cc4d950dfc34922f98", "score": "0.46032608", "text": "func (s *System) run(ctx context.Context, addr string, command string) io.Reader {\n\tr, w := io.Pipe()\n\tgo func() {\n\t\tvar err error\n\t\tfor retries := 0; ; retries++ {\n\t\t\terr = s.runSSH(addr, w, command)\n\t\t\tif err == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif strings.HasPrefix(err.Error(), \"ssh: unable to authenticate\") {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif _, ok := err.(*ssh.ExitError); ok {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif errRetry := retry.Wait(ctx, sshRetryPolicy, retries); errRetry != nil {\n\t\t\t\terr = errRetry\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlog.Debug.Printf(\"%v: running %q: %v; retrying\", addr, command, err)\n\t\t}\n\t\tw.CloseWithError(err)\n\t}()\n\treturn r\n}", "title": "" }, { "docid": "7ffd39b4627cb90a727219b5d3367feb", "score": "0.46025735", "text": "func (o *VolumesOptions) Run() error {\n\tcontexts := kubernetes.GetMatchingContexts(o.rawConfig, *o.configFlags.Context)\n\n\tif len(contexts) == 1 {\n\t\terr := o.runWithConfig(contexts[0])\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error listing volumes for %s: %v\\n\", o.rawConfig.CurrentContext, err)\n\t\t}\n\t\treturn nil\n\t}\n\n\t// multiple tenants\n\t// disable header here and print them once if required\n\tif !o.noHeader {\n\t\toutput, err := output.ConvertToTable(output.Table{strings.Split(o.columns, \",\"), [][]string{}, []int{0, 1}, o.output})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error creating output: %v\", err)\n\t\t}\n\t\tfmt.Printf(output)\n\t}\n\to.noHeader = true\n\tfor _, context := range contexts {\n\t\to.configFlags.Context = &context\n\t\terr := o.runWithConfig(context)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Error listing volumes for %s: %v\\n\", context, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "606bc5c453ae0f451659c8c3114f23b9", "score": "0.45949316", "text": "func (rd *EC2InstanceDeleter) RequestEC2Instances() ([]*ec2.Instance, error) {\n\tif len(rd.ResourceNames) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tsize, chunk := len(rd.ResourceNames), 200\n\tinstances := make([]*ec2.Instance, 0)\n\tvar err error\n\t// Can only filter in batches of 200\n\tfor i := 0; i < size; i += chunk {\n\t\tstop := CalcChunk(i, size, chunk)\n\t\tinstances, err = rd.GetClient().requestEC2Instances(instanceFilterKey, rd.ResourceNames[i:stop], instances)\n\t\tif err != nil {\n\t\t\treturn instances, err\n\t\t}\n\t}\n\n\treturn instances, nil\n}", "title": "" }, { "docid": "bacf87e9e73778b71c328b84444d846c", "score": "0.45943293", "text": "func (c *GetMachinesCmd) Run(app subcommands.Application, args []string, env subcommands.Env) int {\n\tctx := cli.GetContext(app, c, env)\n\tclient := getClient(ctx)\n\tresp, err := client.ListMachines(ctx, &c.req)\n\tif err != nil {\n\t\terrors.Log(ctx, err)\n\t\treturn 1\n\t}\n\tprintMachines(c.f.tsv, resp.Machines...)\n\treturn 0\n}", "title": "" }, { "docid": "5e90381c01dfd241cf55870dd89d0f78", "score": "0.45932633", "text": "func Run(cmd *cobra.Command, args []string) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\tif len(args) == 0 {\n\t\tlistBuckets(ctx, cmd)\n\t\treturn\n\t}\n\tif len(args) > 1 {\n\t\tcmd.PrintErrln(\"extra options: \" + strings.Join(args[1:], \" \"))\n\t\tos.Exit(1)\n\t}\n\tlistObjects(ctx, cmd, args[0])\n}", "title": "" }, { "docid": "d62d6ea63e8fd0a46b7765ec57abca62", "score": "0.45910293", "text": "func Run(name string, args []string, options ...Option) error {\n\tcmd := exec.Command(name, args...)\n\n\tcmd.Stdout = os.Stderr\n\tcmd.Stderr = os.Stderr\n\n\tfor _, opt := range options {\n\t\topt(cmd)\n\t}\n\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "f8c2ceaaf939db4780bb62fda42c6145", "score": "0.45901236", "text": "func (s SystemExecer) RunCommand(name string, arg ...string) ([]byte, error) {\n\treturn exec.Command(name, arg...).Output()\n}", "title": "" }, { "docid": "4b5339fd38928949483d2c3c5949ae98", "score": "0.45820755", "text": "func (a *Agent) Run(args []string, env Env) (err error) {\n\tif len(args) < 2 {\n\t\terr = ErrArgs\n\t\treturn\n\t}\n\n\tri, err := ParseResourceInstance(env.Get(\"OCF_RESOURCE_INSTANCE\"))\n\tif err != nil && err != ErrUnimplemented {\n\t\treturn\n\t}\n\n\tctx := &Context{\n\t\tResource: ri,\n\t\tKeys: env.Fields(\"OCF_RESKEY_\"),\n\t}\n\n\terr = a.run(strings.TrimSpace(args[1]), ctx)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9c76595bf2230f9ee6d94494dbc64516", "score": "0.4577156", "text": "func executeCommand(command *Command) {\n for i := 0; i < command.count; i++ {\n out, err := exec.Command(command.name, command.args...).Output()\n if err != nil {\n log.Fatal(err)\n }\n fmt.Printf(\"%s\\n\", out)\n }\n}", "title": "" }, { "docid": "d234b3ad6110dd773a3129287de2ea50", "score": "0.4576339", "text": "func main() {\r\n\tendPoint := flag.String(\"r\", \"\", \"amazon region (can use \\\"all\\\")\")\r\n\tlistRegionsOpt := flag.Bool(\"listregions\", false, \"list amazon regions\")\r\n\tflag.Parse()\r\n\t\t\r\n\terr := javabind.SetupJVM(os.Getenv(\"CLASSPATH\"))\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\r\n\t\r\n\tcredentials := ec2.NewAuthProfileProfileCredentialsProvider().GetCredentials()\r\n\tclient := ec2.NewServicesEc2AmazonEC2Client3(credentials)\r\n\r\n\tvar endPointList []string\r\n\tif *endPoint == \"all\" {\r\n\t\tendPointList, err = listRegions(client)\r\n\t\tif err != nil {\r\n\t\t\tlog.Fatal(err)\r\n\t\t}\r\n\t} else if *endPoint != \"\" {\r\n\t\tendPointList = append(endPointList, *endPoint)\r\n\t\t//client.SetEndpoint(*endPoint)\r\n\t} else {\r\n\t\tvar regions *ec2.RegionsRegions\r\n\t\tendPointList = append(endPointList, \"ec2.\" + regions.DEFAULT_REGION().GetName() + \".amazonaws.com\")\r\n\t}\r\n\r\n\tif *listRegionsOpt {\r\n\t\tl, err := listRegions(client)\r\n\t\tif err != nil {\r\n\t\t\tlog.Fatal(err)\r\n\t\t}\r\n\t\tfor _, r := range l {\r\n\t\t\tfmt.Printf(\"%s\\n\", r)\r\n\t\t}\r\n\t\treturn\r\n\t}\r\n\r\n\tfor _, s := range endPointList {\r\n\t\tclient.SetEndpoint(s)\r\n\t\tinstances := client.DescribeInstances()\r\n\r\n\t\tfor _, r := range instances.GetReservations() {\r\n\t\t\tfor _, i := range r.GetInstances() {\r\n\t\t\t\tfmt.Printf(\"%s %s %s %s\", i.GetInstanceId(), i.GetInstanceType(), i.GetPlacement().GetAvailabilityZone(), i.GetState().GetName())\r\n\t\t\t\tipAddr := i.GetPublicIpAddress()\r\n\t\t\t\tif ipAddr != \"\" {\r\n\t\t\t\t\tfmt.Printf(\" %s\", ipAddr)\r\n\t\t\t\t}\r\n\t\t\t\tfmt.Printf(\"\\n\")\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "0e338c804bb2634f9042531d99d79b83", "score": "0.45746157", "text": "func (s *sshProcessImpl) Run(hosts []string, cmd string, options Options) (SshResponses, error) {\n\t// find how many hosts to run concurrently\n\tconc := runConcurrency(options, len(hosts))\n\t// create ssh worker per host, send to pool\n\ttasks := createTasks(hosts, cmd, options)\n\tchanResults, err := s.pool.Run(tasks, MIN_POOL_SIZE, conc)\n\tif err != nil {\n\t\treturn SshResponses{}, err\n\t}\n\trsp := waitForCompletion(chanResults, len(hosts))\n\t// wait for completion\n\treturn rsp, nil\n}", "title": "" }, { "docid": "9a4785caf8a3eda11471990d784a987c", "score": "0.4572824", "text": "func (_m *EC2API) StartInstances(_a0 *ec2.StartInstancesInput) (output *ec2.StartInstancesOutput, err error) {\r\n\toutput = &ec2.StartInstancesOutput{}\r\n\tif err := _m.recorder.CheckError(\"StartInstances\"); err != nil {\r\n\t\treturn output, err\r\n\t}\r\n\t_m.recorder.Record(\"StartInstances\")\r\n\treturns, exist := _m.recorder.giveRecordedOutput(\"StartInstances\", _a0)\r\n\tif exist {\r\n\t\tassertedErr, _ := returns[1].(error)\r\n\t\treturn returns[0].(*ec2.StartInstancesOutput), assertedErr\r\n\t}\r\n\tfor _, instanceId := range _a0.InstanceIds {\r\n\t\tfor _, instance := range _m.createdEc2instances {\r\n\t\t\tif *instance.InstanceId == *instanceId {\r\n\t\t\t\tinstance.State.Code = proto.Int64(80)\r\n\t\t\t\tinstance.State.Name = proto.String(\"stopped\")\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "title": "" }, { "docid": "e9514471e910692e0da4b8becb7e069a", "score": "0.45702383", "text": "func (p *Provisioner) runCommand(\n\to terraform.UIOutput,\n\tcomm communicator.Communicator,\n\tcommand string) error {\n\tvar err error\n\n\tif p.useSudo {\n\t\tcommand = \"sudo \" + command\n\t}\n\n\toutR, outW := io.Pipe()\n\terrR, errW := io.Pipe()\n\toutDoneCh := make(chan struct{})\n\terrDoneCh := make(chan struct{})\n\tgo p.copyOutput(o, outR, outDoneCh)\n\tgo p.copyOutput(o, errR, errDoneCh)\n\n\tcmd := &remote.Cmd{\n\t\tCommand: command,\n\t\tStdout: outW,\n\t\tStderr: errW,\n\t}\n\n\tif err := comm.Start(cmd); err != nil {\n\t\treturn fmt.Errorf(\"Error executing command %q: %v\", cmd.Command, err)\n\t}\n\n\tcmd.Wait()\n\tif cmd.ExitStatus != 0 {\n\t\terr = fmt.Errorf(\n\t\t\t\"Command %q exited with non-zero exit status: %d\", cmd.Command, cmd.ExitStatus)\n\t}\n\n\t// Wait for output to clean up\n\toutW.Close()\n\terrW.Close()\n\t<-outDoneCh\n\t<-errDoneCh\n\n\t// If we have an error, return it out now that we've cleaned up\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "05de8663b6aafb7bdd77cc1d39854ef6", "score": "0.45649385", "text": "func RunCommand(args []string) error {\n\t// fmt.Printf(\"args %+v, c %v '%v'\\n\", os.Args, commands == nil, commands)\n\tcmd, err := commandFromArgs(os.Args)\n\t// fmt.Printf(\"cmd nil?? %v, args %+v, err='%v'\\n\", cmd == nil, os.Args, err)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcmd.parseFlags()\n\tif cmd.run == nil {\n\t\treturn nil\n\t}\n\treturn cmd.run(cmd.afs.Args())\n}", "title": "" }, { "docid": "e5735e0e5bf70c3fdec3dadb09931fde", "score": "0.4562817", "text": "func InitRunCommand() (*cobra.Command, error) {\n\trun := &cobra.Command{\n\t\tUse: \"run\",\n\t\tShort: \"Start deployment of AppController graph\",\n\t\tLong: \"Start deployment of AppController graph\",\n\t\tRun: deploy,\n\t}\n\n\tvar labelSelector string\n\trun.Flags().StringVarP(&labelSelector, \"label\", \"l\", \"\", \"Label selector. Overrides KUBERNETES_AC_LABEL_SELECTOR env variable in AppController pod.\")\n\n\tconcurrencyString := os.Getenv(\"KUBERNETES_AC_CONCURRENCY\")\n\n\tvar err error\n\tvar concurrencyDefault int\n\tif len(concurrencyString) > 0 {\n\t\tconcurrencyDefault, err = strconv.Atoi(concurrencyString)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"KUBERNETES_AC_CONCURRENCY is set to '%s' but it does not look like an integer: %v\",\n\t\t\t\tconcurrencyString, err)\n\t\t\tconcurrencyDefault = 0\n\t\t}\n\t}\n\tvar concurrency int\n\trun.Flags().IntVarP(&concurrency, \"concurrency\", \"c\", concurrencyDefault, \"concurrency\")\n\treturn run, err\n}", "title": "" }, { "docid": "5549603d1c431bbc346f16632190d89a", "score": "0.45614305", "text": "func (btc *BucketTagCommand) RunCommand() error {\n\tstrMethod, _ := GetString(OptionMethod, btc.command.options)\n\tif strMethod == \"\" {\n\t\treturn fmt.Errorf(\"--method value is empty\")\n\t}\n\n\tstrMethod = strings.ToLower(strMethod)\n\tif strMethod != \"put\" && strMethod != \"get\" && strMethod != \"delete\" {\n\t\treturn fmt.Errorf(\"--method value is not in the optional value:put|get|delete\")\n\t}\n\n\tsrcBucketUrL, err := GetCloudUrl(btc.command.args[0], \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbtc.bucketName = srcBucketUrL.bucket\n\n\tif strMethod == \"put\" {\n\t\terr = btc.PutBucketTag()\n\t} else if strMethod == \"get\" {\n\t\terr = btc.GetBucketTag()\n\t} else if strMethod == \"delete\" {\n\t\terr = btc.DeleteBucketTag()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "36e8cc8da39ea348767cd18b096d6df3", "score": "0.45566285", "text": "func (c *RunCommand) instance() (r CommandRunner) {\n\tif c.Category.IsJivaVolume() {\n\t\tr = &jivaVolumeCommand{cmd: c}\n\t} else {\n\t\tr = &notSupportedCategoryCommand{cmd: c}\n\t}\n\treturn\n}", "title": "" }, { "docid": "a5209c86d860dae1a25af577546a4458", "score": "0.45557103", "text": "func DescribeEC2Instances(ciMap ContainerInstanceMap, sess *session.Session) (map[string]*ec2.Instance, error) {\n if instanceIds := ciMap.GetEc2InstanceIds(); len(instanceIds) == 0 {\n instances := make(map[string]*ec2.Instance, 0)\n return instances, nil\n }\n\n ec2_svc := ec2.New(sess)\n params := &ec2.DescribeInstancesInput {\n DryRun: aws.Bool(false),\n InstanceIds: ciMap.GetEc2InstanceIds(),\n }\n instances := make(map[string]*ec2.Instance)\n resp, err := ec2_svc.DescribeInstances(params)\n if err == nil {\n for _, reservation := range resp.Reservations {\n for _, instance := range reservation.Instances {\n instances[*instance.InstanceId] = instance\n }\n }\n }\n return instances, err\n}", "title": "" }, { "docid": "f1db51af8d7e4e507852fd4bb1b751be", "score": "0.4551225", "text": "func Run(command string, arguments ...string) error {\n\t_, _, err := RunCommand(command, false, arguments...)\n\treturn err\n}", "title": "" } ]
9687449e959c6b507785d189539693a8
ABit returns from NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay the path struct for its child "abit".
[ { "docid": "08093d8aa81d1d1f0224a433fb2413ee", "score": "0.62403685", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" } ]
[ { "docid": "ffd66734ad693f560972fb9edf75f54c", "score": "0.69875294", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ffd66734ad693f560972fb9edf75f54c", "score": "0.69874126", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c7d8f9c6232096f9f84d748569e46a81", "score": "0.6977867", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) LinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c7d8f9c6232096f9f84d748569e46a81", "score": "0.6977115", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) LinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "899e2cf55e2bf452a168b35690a39c8a", "score": "0.6959668", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "899e2cf55e2bf452a168b35690a39c8a", "score": "0.6958535", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1e421a042503f7b7acc8d48db76c2e9d", "score": "0.69579166", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) LinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1e421a042503f7b7acc8d48db76c2e9d", "score": "0.6955781", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) LinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "245b869c035b1ddc749cb7e2716343bd", "score": "0.6936682", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) LinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "245b869c035b1ddc749cb7e2716343bd", "score": "0.69357556", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) LinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5a85bde3d043a7edde5ba210f827d289", "score": "0.6907852", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5a85bde3d043a7edde5ba210f827d289", "score": "0.690606", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ada9d2277c6cde58b6b1f2304eb4b394", "score": "0.68599045", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) LinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ada9d2277c6cde58b6b1f2304eb4b394", "score": "0.6859869", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) LinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4820f702baaf5e47e78eacc06611a0d0", "score": "0.68233675", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4820f702baaf5e47e78eacc06611a0d0", "score": "0.68225956", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "00bb29931d1100bba29c21bafbd30d02", "score": "0.6740816", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayAny) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_DelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_DelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "618ca87d5fdc1c722fd55feaebe11799", "score": "0.67182475", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayAny) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_DelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_DelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4c9e201f11f09969fc90a5f6e4ef76cb", "score": "0.66664034", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayAny) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay_DelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay_DelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ac1ed8ab89646b3b352ef2dd03cc67f6", "score": "0.662845", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ac1ed8ab89646b3b352ef2dd03cc67f6", "score": "0.6627127", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c9a7a15d6288b446a61bd549c5cd7985", "score": "0.6620587", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c9a7a15d6288b446a61bd549c5cd7985", "score": "0.6618712", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "40b35716aff58230aa1c46b72a708cb3", "score": "0.66085446", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_SubtlvAny) LinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ea0d216e179689ffad297f6208b3678c", "score": "0.6605426", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ea0d216e179689ffad297f6208b3678c", "score": "0.6604587", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6a4cad17c9afe93d97cce980006902a1", "score": "0.6602554", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6a4cad17c9afe93d97cce980006902a1", "score": "0.6602303", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9c8984255091800c4d4b7160b8b04159", "score": "0.6589676", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_SubtlvAny) LinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "cb46d544df9d69a958f2872977465960", "score": "0.6587298", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_SubtlvAny) LinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "3174393abed2dbc5db224bdc9ce8c95a", "score": "0.6571217", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayAny) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay_DelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay_DelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c0fbd64b2ed03519868655e30daef035", "score": "0.6566282", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) LinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay-variation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c0fbd64b2ed03519868655e30daef035", "score": "0.6565461", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) LinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay-variation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1116a86133e852d24a6f48980fe254fa", "score": "0.651565", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) LinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay-variation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1116a86133e852d24a6f48980fe254fa", "score": "0.651565", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) LinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay-variation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5d2530b92f8827d2b0acc74afc2c5ab5", "score": "0.651096", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) LinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay-variation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5d2530b92f8827d2b0acc74afc2c5ab5", "score": "0.6510797", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) LinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay-variation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4609e00309f39ae846190f190d4813fc", "score": "0.650554", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) LinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay-variation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4609e00309f39ae846190f190d4813fc", "score": "0.6504361", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) LinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay-variation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "bbd925eadeaeff07d852083aafeb6eab", "score": "0.64742595", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_SubtlvAny) LinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "370310f55def51556a8c31471ceb47e8", "score": "0.64224195", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariationAny) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation_DelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation_DelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e1a125af3abf12d58367ddb7ad9b99e5", "score": "0.6416716", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariationAny) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation_DelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation_DelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ff74090a8f38208031755f1dbcb074f8", "score": "0.6374745", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariationAny) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation_DelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation_DelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6d39d2fbbc56214c3ecc03676103fe7a", "score": "0.63584214", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariationAny) Delay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation_DelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation_DelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2cfda90fae6800cb1faf5074e7c721b7", "score": "0.62989604", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_LinkDelay) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_LinkDelay\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2d1ba6e76e4c1bc510054a0bc5b4c6f7", "score": "0.6276787", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Subtlv_LinkDelay) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Subtlv_LinkDelay\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f5d128b1fcfbd6d57b20863b4f59548", "score": "0.62424296", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "0f5d128b1fcfbd6d57b20863b4f59548", "score": "0.6241846", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6d8720b18f0865bce6e7722b7b3aad07", "score": "0.6202697", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6d8720b18f0865bce6e7722b7b3aad07", "score": "0.6202697", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e49c7a063e58824b4b4da5cd8aefde2d", "score": "0.618511", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e49c7a063e58824b4b4da5cd8aefde2d", "score": "0.61833835", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a88548e110c71dc5872480c210aef6d7", "score": "0.6173711", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_LinkDelay) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_LinkDelay\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6218e118623103a99008449297391d5e", "score": "0.6121961", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Subtlv_LinkDelay) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Subtlv_LinkDelay\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b9015eda67a44018f3da8c0e0d312191", "score": "0.6071286", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_SubtlvAny) LinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariationAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariationAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay-variation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7b26cf48c5838cd321f73a8b78da16e8", "score": "0.6057223", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_SubtlvAny) LinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariationAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariationAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay-variation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8c76d2fe000cc7a577ab226077b4a1be", "score": "0.6035004", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_SubtlvAny) LinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariationAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariationAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay-variation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "f2a93c05523707dab9fb3713c6df16bb", "score": "0.6021208", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_SubtlvAny) LinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariationAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariationAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-delay-variation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e2c14ae42bddac50537163e3f15c0b78", "score": "0.5944464", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Subtlv_LinkDelay) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Subtlv_LinkDelay\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1f89e1a61966b59d86b482f7a19173e5", "score": "0.5898509", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Subtlv_LinkDelay) IsYANGGoStruct() {}", "title": "" }, { "docid": "1f89e1a61966b59d86b482f7a19173e5", "score": "0.5896534", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Subtlv_LinkDelay) IsYANGGoStruct() {}", "title": "" }, { "docid": "e1358cb480bf620f81b078bb57ecb0ee", "score": "0.5886992", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e1358cb480bf620f81b078bb57ecb0ee", "score": "0.5886896", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e89f06424117d268ce933a32c73041b8", "score": "0.5852472", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e89f06424117d268ce933a32c73041b8", "score": "0.5851522", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9deb16dc3344ef11df9d5c3091cc1aa4", "score": "0.58514315", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9deb16dc3344ef11df9d5c3091cc1aa4", "score": "0.5849635", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "96405bdabbf9a8501b842a63141b24e3", "score": "0.58488655", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Subtlv_LinkDelay) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Subtlv_LinkDelay\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8e9c0170a3e3ec3bf3f6bec06ed78308", "score": "0.5799793", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8e9c0170a3e3ec3bf3f6bec06ed78308", "score": "0.57993734", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay_ABit{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b389d34dee3199c010e817f7353bb630", "score": "0.57469636", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Subtlv_LinkDelay) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Subtlv_LinkDelay\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ee05c115f24f3a5b2207515d89868587", "score": "0.569881", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor) DelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor_DelayMetric {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor_DelayMetric{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"delay-metric\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ee05c115f24f3a5b2207515d89868587", "score": "0.56974024", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor) DelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor_DelayMetric {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor_DelayMetric{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"delay-metric\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "841a3e22812515222b88dacf64eb4082", "score": "0.56786853", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Subtlv_LinkDelay) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Subtlv_LinkDelay\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6986ffe97871d3b383138973cb73bb11", "score": "0.56493694", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay) MaxDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"max-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6986ffe97871d3b383138973cb73bb11", "score": "0.5647135", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay) MaxDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"max-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "0b7ee8d9f44e6bcfba2622687683bdaf", "score": "0.5636828", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay) MaxDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"max-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "0b7ee8d9f44e6bcfba2622687683bdaf", "score": "0.5635297", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay) MaxDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"max-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "bf4d700854cb1a0263d583d83ac202ea", "score": "0.562042", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix) DelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix_DelayMetric {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix_DelayMetric{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"delay-metric\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "bf4d700854cb1a0263d583d83ac202ea", "score": "0.5619097", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix) DelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix_DelayMetric {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix_DelayMetric{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"delay-metric\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "95b2c2c3483869aef6e4354f69694f5b", "score": "0.56098807", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay) MaxDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"max-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "95b2c2c3483869aef6e4354f69694f5b", "score": "0.56098807", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay) MaxDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"max-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9d60049b967df3c5a43293c52c2cc448", "score": "0.55604285", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay) MaxDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"max-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9d60049b967df3c5a43293c52c2cc448", "score": "0.5559703", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay) MaxDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"max-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "663db557d2389549f786735bc88d2c28", "score": "0.55514514", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix) DelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DelayMetric {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DelayMetric{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"delay-metric\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "663db557d2389549f786735bc88d2c28", "score": "0.5549979", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix) DelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DelayMetric {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DelayMetric{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"delay-metric\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4ff0d2ef8001c78cda457b08b7945586", "score": "0.5540333", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_LinkDelayVariation) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_LinkDelayVariation\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e2719fc966b2f83e419c20da02abe677", "score": "0.5527109", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Subtlv_LinkDelayVariation) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Subtlv_LinkDelayVariation\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bd332c3a8a2932169184584685d89d4e", "score": "0.5499955", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Subtlv_LinkDelay) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "bd332c3a8a2932169184584685d89d4e", "score": "0.5497428", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Subtlv_LinkDelay) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "0c77a6f51775a7ad110d9cc34fe6504d", "score": "0.54767555", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_LinkDelay) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "0c77a6f51775a7ad110d9cc34fe6504d", "score": "0.5475412", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_LinkDelay) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "b62a2da4f8e38366f384989a68cc32cf", "score": "0.54611444", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_MinMaxLinkDelay) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_MinMaxLinkDelay\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f59367b2ec5534c7895e40e663bb0aed", "score": "0.5443943", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_LinkDelayVariation) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_LinkDelayVariation\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e457b815bf8967eea881dc343ba0f3c8", "score": "0.5424909", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Subtlv_LinkDelayVariation) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Subtlv_LinkDelayVariation\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4118394bc8d6332dd424d4daac84e8b", "score": "0.54238796", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelayAny) MaxDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"max-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7ddd66e4bae51afe7b7b9c19d681087e", "score": "0.54209733", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelayAny) MaxDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"max-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8ed7561e259b7606adf349a491f1dabf", "score": "0.54092145", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayAny) ABit() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_ABitAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay_ABitAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"a-bit\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1d532b9dbd7a3f7ed39101a00bbb23fa", "score": "0.538479", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelayAny) MaxDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MaxDelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"max-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" } ]
725235de82b68c2db7e5fb82edf42878
SetDiskSize uses the slider on the Installer options pane to set the disk size to the specified disk size. If targetSize is smaller/greater than the possible minimum/maximum size, use the extremum size if IsSoftExtremum=true, or return an error otherwise.
[ { "docid": "fc9c66fe7fe985d5624803a9cc49e420", "score": "0.79918116", "text": "func (p *Installer) SetDiskSize(ctx context.Context, cr *chrome.Chrome, targetSize uint64, IsSoftExtremum bool) (uint64, error) {\n\tradioGroup := nodewith.Role(role.RadioGroup).Ancestor(InstallWindow)\n\tcustomStaticText := nodewith.Name(\"Custom\").Role(role.StaticText).Ancestor(radioGroup)\n\tslider := nodewith.Role(role.Slider).Ancestor(InstallWindow)\n\tui := uiauto.New(p.tconn)\n\n\t// Hide virtual keyboard if it appears.\n\t// vkb.HideVirtualKeyboard invokes Chrome API to force hide virtual keyboard.\n\tif err := ui.WithTimeout(time.Second).WaitUntilExists(vkb.NodeFinder.First())(ctx); err == nil {\n\t\tif err := vkb.NewContext(nil, p.tconn).HideVirtualKeyboard()(ctx); err != nil {\n\t\t\treturn 0, errors.Wrap(err, \"failed to hide virtual keyboard\")\n\t\t}\n\n\t}\n\n\tif err := uiauto.Combine(\"click radio custom and display slider\",\n\t\tui.LeftClick(customStaticText),\n\t\tui.FocusAndWait(slider))(ctx); err != nil {\n\t\treturn 0, err\n\t}\n\n\tconst installerURL = \"chrome://crostini-installer/\"\n\tf := func(t *chrome.Target) bool { return strings.HasPrefix(t.URL, installerURL) }\n\tconn, err := cr.NewConnForTarget(ctx, f)\n\tif err != nil {\n\t\treturn 0, errors.Wrapf(err, \"failed to connect to installer page %s\", installerURL)\n\t}\n\tdefer conn.Close()\n\n\tconst crostiniInstaller = \"crostini-installer-app\"\n\treturn settings.UpdateDiskSizeSliderWithJS(ctx, conn, crostiniInstaller, targetSize, IsSoftExtremum)\n\n}", "title": "" } ]
[ { "docid": "f823716a9264b6f76ed634d9a7fce3b2", "score": "0.6374314", "text": "func (m *DriveItemVersion) SetSize(value *int64)() {\n err := m.GetBackingStore().Set(\"size\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c33df02cebb21ff29937412f13a71866", "score": "0.5923026", "text": "func (o MachineConfigV2HarvesterConfigOutput) DiskSize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v MachineConfigV2HarvesterConfig) *string { return v.DiskSize }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5c81840d0020426b0d16232f22413fdc", "score": "0.58751655", "text": "func (o MachineConfigV2VsphereConfigOutput) DiskSize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v MachineConfigV2VsphereConfig) *string { return v.DiskSize }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "02957bf0709f791682a7988fad9c4397", "score": "0.5852823", "text": "func (v *Volume) SetSize(size uint64) {\n\tv.lock.Lock()\n\tdefer v.lock.Unlock()\n\n\tv.size = size\n}", "title": "" }, { "docid": "ff355ea366dc1913fd46199c573479aa", "score": "0.57762146", "text": "func (m *WindowsDeliveryOptimizationConfiguration) SetMinimumDiskSizeAllowedToPeerInGigabytes(value *int32)() {\n err := m.GetBackingStore().Set(\"minimumDiskSizeAllowedToPeerInGigabytes\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d961135343b951a89a6f7d602362749d", "score": "0.5737252", "text": "func (m *File) SetSize(value *int64)() {\n err := m.GetBackingStore().Set(\"size\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "382e134122062358711d6d124ec841be", "score": "0.5703343", "text": "func (fs *FileSystem) setCurrentSize(size int64) {\n\tfs.currentSize = size\n\tif fs.diskUsageMetric != nil {\n\t\tfs.diskUsageMetric.Set(float64(size))\n\t}\n}", "title": "" }, { "docid": "4025e9041d09b62063a736e12cc20faa", "score": "0.56972843", "text": "func (cfg *Server) SetRamdiskSize(log logging.Logger, mi *common.MemInfo) error {\n\tif len(cfg.Engines) == 0 {\n\t\treturn nil // no engines\n\t}\n\n\t// Create the same size scm for each engine.\n\tscmCfgs := cfg.Engines[0].Storage.Tiers.ScmConfigs()\n\n\tif len(scmCfgs) == 0 || scmCfgs[0].Class != storage.ClassRam {\n\t\treturn nil // no ramdisk to size\n\t}\n\n\tmaxRamdiskSize, err := cfg.CalcRamdiskSize(log, mi.HugepageSizeKiB, mi.MemTotalKiB)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"calculate ramdisk size\")\n\t}\n\n\tmemTotBytes := uint64(mi.MemTotalKiB) * humanize.KiByte\n\n\tmsg := fmt.Sprintf(\"calculated max ram-disk size (%s) using MemTotal (%s)\",\n\t\thumanize.IBytes(maxRamdiskSize), humanize.IBytes(memTotBytes))\n\n\tif maxRamdiskSize < storage.MinRamdiskMem {\n\t\t// Total RAM is insufficient to meet minimum size.\n\t\tlog.Errorf(\"%s: insufficient total memory\", msg)\n\n\t\tminMem, err := cfg.CalcMemForRamdiskSize(log, mi.HugepageSizeKiB,\n\t\t\tstorage.MinRamdiskMem)\n\t\tif err != nil {\n\t\t\tlog.Error(err.Error())\n\t\t}\n\n\t\treturn storage.FaultRamdiskLowMem(\"Total\", storage.MinRamdiskMem, minMem,\n\t\t\tmemTotBytes)\n\t}\n\n\tfor idx, ec := range cfg.Engines {\n\t\tscs := ec.Storage.Tiers.ScmConfigs()\n\t\tif len(scs) != 1 {\n\t\t\treturn errors.Errorf(\"unexpected number of scm tiers, want 1 got %d\",\n\t\t\t\tlen(scs))\n\t\t}\n\n\t\t// Validate or set configured scm sizes based on calculated value.\n\t\tconfSize := uint64(scs[0].Scm.RamdiskSize) * humanize.GiByte\n\t\tif confSize == 0 {\n\t\t\t// Apply calculated size in config as not already set.\n\t\t\tlog.Debugf(\"%s: auto-sized ram-disk in engine-%d config\", msg, idx)\n\t\t\tscs[0].WithScmRamdiskSize(uint(maxRamdiskSize / humanize.GiByte))\n\t\t\tlog.Infof(\"engine-%d: ramdisk size automatically set to %s\", idx,\n\t\t\t\thumanize.IBytes(maxRamdiskSize))\n\t\t} else if confSize > maxRamdiskSize {\n\t\t\t// Total RAM is not enough to meet tmpfs size requested in config.\n\t\t\tlog.Errorf(\"%s: engine-%d config size too large for total memory\", msg,\n\t\t\t\tidx)\n\n\t\t\treturn FaultConfigRamdiskOverMaxMem(confSize, maxRamdiskSize,\n\t\t\t\tstorage.MinRamdiskMem)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "420c94b447deda4375aec1ba0ce78fdc", "score": "0.5684876", "text": "func UpdateOSDiskSize(ctx context.Context, vmName string) (d compute.Disk, err error) {\n\tvm, err := GetVM(ctx, vmName)\n\tif err != nil {\n\t\treturn d, fmt.Errorf(\"cannot get vm: %v\", err)\n\t}\n\n\tsize := vm.StorageProfile.OsDisk.DiskSizeGB\n\tif size == nil {\n\t\tsize = to.Int32Ptr(0)\n\t}\n\tif *size <= 0 {\n\t\t*size = 256\n\t}\n\t*size += 10\n\n\t_, err = Deallocate(ctx, vmName)\n\tif err != nil {\n\t\treturn d, fmt.Errorf(\"cannot deallocate vm: %v\", err)\n\t}\n\n\tdisksClient := getDisksClient()\n\tfuture, err := disksClient.Update(ctx, helpers.ResourceGroupName(), *vm.StorageProfile.OsDisk.Name, compute.DiskUpdate{\n\t\tDiskUpdateProperties: &compute.DiskUpdateProperties{\n\t\t\tDiskSizeGB: size,\n\t\t},\n\t})\n\n\terr = future.WaitForCompletion(ctx, disksClient.Client)\n\tif err != nil {\n\t\treturn d, fmt.Errorf(\"cannot get the disk update future response: %v\", err)\n\t}\n\n\treturn future.Result(disksClient)\n}", "title": "" }, { "docid": "2c0cdd7879a590fd3d7d2acf1db9b397", "score": "0.5669315", "text": "func (o NodeTemplateVsphereConfigOutput) DiskSize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NodeTemplateVsphereConfig) *string { return v.DiskSize }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7e8835b484be3d0c7cdd79a0576a0765", "score": "0.56546336", "text": "func (o NodeTemplateHarvesterConfigOutput) DiskSize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NodeTemplateHarvesterConfig) *string { return v.DiskSize }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1e846b91118d6a3ec06faae47856906e", "score": "0.56167954", "text": "func (o MachineConfigV2AzureConfigOutput) DiskSize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v MachineConfigV2AzureConfig) *string { return v.DiskSize }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f8997584db44bdac6384fedf521a8285", "score": "0.56140786", "text": "func (o MachineConfigV2HarvesterConfigPtrOutput) DiskSize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *MachineConfigV2HarvesterConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DiskSize\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6d888df154c7656f6bde0d4e6dd71dcc", "score": "0.55924326", "text": "func prepareDiskSize(\n\tclient *pxapi.Client,\n\tvmr *pxapi.VmRef,\n\tdiskConfMap pxapi.QemuDevices,\n) error {\n\tclonedConfig, err := pxapi.NewConfigQemuFromApi(vmr, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//log.Printf(\"%s\", clonedConfig)\n\tfor diskID, diskConf := range diskConfMap {\n\t\tdiskName := fmt.Sprintf(\"%v%v\", diskConf[\"type\"], diskID)\n\n\t\tdiskSize := diskSizeGB(diskConf[\"size\"])\n\n\t\tif _, diskExists := clonedConfig.QemuDisks[diskID]; !diskExists {\n\t\t\treturn err\n\t\t}\n\n\t\tclonedDiskSize := diskSizeGB(clonedConfig.QemuDisks[diskID][\"size\"])\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdiffSize := int(math.Ceil(diskSize - clonedDiskSize))\n\t\tif diskSize > clonedDiskSize {\n\t\t\tlog.Print(\"[DEBUG] resizing disk \" + diskName)\n\t\t\t_, err = client.ResizeQemuDisk(vmr, diskName, diffSize)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59a3fb52d9245544f62b37b0ffa3b939", "score": "0.55906457", "text": "func (o MachineConfigV2VsphereConfigPtrOutput) DiskSize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *MachineConfigV2VsphereConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DiskSize\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8260dc3baf838918fb5467597e6962ca", "score": "0.5570805", "text": "func (cli *HostWrapper) SetDisk(disk int64) error {\n\treturn cli.host.SetValue(fieldDisk, disk)\n}", "title": "" }, { "docid": "4a445967cbad33ac97a4bb3cb4716ea1", "score": "0.5542219", "text": "func (p *Preview) SetSize(sx, sy int) {\n\tpanic(\"set size not implemented\")\n}", "title": "" }, { "docid": "913025e2bf298e056ac0effc1dfe4e3b", "score": "0.54258704", "text": "func (o NodeTemplateAzureConfigOutput) DiskSize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NodeTemplateAzureConfig) *string { return v.DiskSize }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "10b755890fc064730011cafa46377ad4", "score": "0.53891236", "text": "func (o NodeTemplateHarvesterConfigPtrOutput) DiskSize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NodeTemplateHarvesterConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DiskSize\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "081ef943d121031d8f5c6eed288ab4ae", "score": "0.53846884", "text": "func (o NodeTemplateVsphereConfigPtrOutput) DiskSize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NodeTemplateVsphereConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DiskSize\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6b31fb81e4ba297244d43666181082b3", "score": "0.5376209", "text": "func (o ClusterEksConfigV2NodeGroupOutput) DiskSize() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v ClusterEksConfigV2NodeGroup) *int { return v.DiskSize }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "2d977a55e7da2349c3192ced19a61bc5", "score": "0.53668225", "text": "func (o MachineConfigV2AzureConfigPtrOutput) DiskSize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *MachineConfigV2AzureConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DiskSize\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5e1f578a774ffa39baeef948127dfd4b", "score": "0.5345237", "text": "func (mw *MagickWand) SetSize(width, heigh uint) error {\n\tok := C.MagickSetSize(mw.mw, C.ulong(width), C.ulong(heigh))\n\treturn mw.getLastErrorIfFailed(ok)\n}", "title": "" }, { "docid": "762f4e15e6401c8bd4ebbba223fcc36a", "score": "0.53266364", "text": "func (c *ClusterClient) SetSize(size int) error {\n\tresp := api.ClusterResponse{}\n\n\trequest := c.c.Get().Resource(clusterPath + \"/setsize\")\n\trequest.QueryOption(\"size\", strconv.FormatInt(int64(size), 16))\n\tif err := request.Do().Unmarshal(&resp); err != nil {\n\t\treturn err\n\t}\n\n\tif resp.Error != \"\" {\n\t\treturn errors.New(resp.Error)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f9d991037300e34f662375d9ca0ae537", "score": "0.529554", "text": "func (d *domainClient) SetVisibleSize(ctx context.Context, args *SetVisibleSizeArgs) (err error) {\n\tif args != nil {\n\t\terr = rpcc.Invoke(ctx, \"Emulation.setVisibleSize\", args, nil, d.conn)\n\t} else {\n\t\terr = rpcc.Invoke(ctx, \"Emulation.setVisibleSize\", nil, nil, d.conn)\n\t}\n\tif err != nil {\n\t\terr = &internal.OpError{Domain: \"Emulation\", Op: \"SetVisibleSize\", Err: err}\n\t}\n\treturn\n}", "title": "" }, { "docid": "fdb3970d98d0fa5e153e8062dbdc7001", "score": "0.5267724", "text": "func (machinedeployment *MachineDeployment) DecreaseTargetSize(delta int) error {\n\tif delta >= 0 {\n\t\treturn fmt.Errorf(\"size decrease size must be negative\")\n\t}\n\tsize, err := machinedeployment.mcmManager.GetMachineDeploymentSize(machinedeployment)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdecreaseAmount := int(size) + delta\n\tif decreaseAmount < machinedeployment.minSize {\n\t\tklog.Warningf(\"Cannot go below min size= %d for machineDeployment %s, requested target size= %d . Setting target size to min size\", machinedeployment.minSize, machinedeployment.Name, size+int64(delta))\n\t\tdecreaseAmount = machinedeployment.minSize\n\t}\n\treturn machinedeployment.mcmManager.retry(func(ctx context.Context) (bool, error) {\n\t\treturn machinedeployment.mcmManager.SetMachineDeploymentSize(ctx, machinedeployment, int64(decreaseAmount))\n\t}, \"MachineDeployment\", \"update\", machinedeployment.Name)\n}", "title": "" }, { "docid": "2d4a07a12037393cebd2f89b3856f535", "score": "0.52529484", "text": "func (m *WindowsDeliveryOptimizationConfiguration) SetMinimumFileSizeToCacheInMegabytes(value *int32)() {\n err := m.GetBackingStore().Set(\"minimumFileSizeToCacheInMegabytes\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d000dc7f9e031f8c9623cb791aa7e6f2", "score": "0.52300084", "text": "func (o NodeTemplateAzureConfigPtrOutput) DiskSize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NodeTemplateAzureConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DiskSize\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9ee4f8cfee69c45a7ec89e964593c593", "score": "0.5180296", "text": "func (mw *MagickWand) SetSize(cols, rows uint) error {\n\tok := C.MagickSetSize(mw.mw, C.size_t(cols), C.size_t(rows))\n\treturn mw.getLastErrorIfFailed(ok)\n}", "title": "" }, { "docid": "e5a582a3eafd57bc8f0d75ae3213ac4a", "score": "0.517623", "text": "func Maxsize(size int64) DiskOption {\n\treturn func(ds *Diskstore) error {\n\t\tds.maxsize = size\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "d5f1c27e43e3b86e4cf9dc3e5ed13718", "score": "0.5147649", "text": "func (p *Pagination) SetSize(size int) error {\n\tswitch size {\n\tcase 0:\n\t\tp.size = \"pagination-sm\"\n\tcase 1:\n\t\tp.size = \"\"\n\tcase 2:\n\t\tp.size = \"pagination-lg\"\n\tdefault:\n\t\treturn errors.New(\"value must be in 0-2 range\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dfc999804c068894846998e93f14a545", "score": "0.51248544", "text": "func (m NoMDEntries) SetMDEntrySize(value decimal.Decimal, scale int32) {\n\tm.Set(field.NewMDEntrySize(value, scale))\n}", "title": "" }, { "docid": "2b20d5c2006a729fdd550e1aa1de9bf2", "score": "0.5087431", "text": "func (o Command) SetSize(size uint16) {\n\tbinary.BigEndian.PutUint16(o[sizeOffset:], size)\n}", "title": "" }, { "docid": "57fe5050062d7b777066b2d1161659bf", "score": "0.50689036", "text": "func SetSizeGB(target SizeMB, size int) {\n\ttarget.SetSizeMB(size * 1024)\n}", "title": "" }, { "docid": "e7321c10da58d16601ab1b665140ecea", "score": "0.5067042", "text": "func (o LookupNodeGroupResultOutput) DiskSize() pulumi.IntOutput {\n\treturn o.ApplyT(func(v LookupNodeGroupResult) int { return v.DiskSize }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "eb1511a81f5293dc35883d53d7d035e9", "score": "0.50587857", "text": "func (r *ProjectsZonesClustersNodePoolsService) SetSize(projectId string, zone string, clusterId string, nodePoolId string, setnodepoolsizerequest *SetNodePoolSizeRequest) *ProjectsZonesClustersNodePoolsSetSizeCall {\n\tc := &ProjectsZonesClustersNodePoolsSetSizeCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.projectId = projectId\n\tc.zone = zone\n\tc.clusterId = clusterId\n\tc.nodePoolId = nodePoolId\n\tc.setnodepoolsizerequest = setnodepoolsizerequest\n\treturn c\n}", "title": "" }, { "docid": "9da42ab522f8468d61148ac8cb10c941", "score": "0.5054678", "text": "func (r *ProjectsLocationsClustersNodePoolsService) SetSize(name string, setnodepoolsizerequest *SetNodePoolSizeRequest) *ProjectsLocationsClustersNodePoolsSetSizeCall {\n\tc := &ProjectsLocationsClustersNodePoolsSetSizeCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\tc.setnodepoolsizerequest = setnodepoolsizerequest\n\treturn c\n}", "title": "" }, { "docid": "90dfa34aada7b8a7fb9c8c8881278393", "score": "0.5050926", "text": "func (e *Editor) SetSize(sx, sy int) {\n\te.box.SetSize(sx, sy)\n}", "title": "" }, { "docid": "0698c950a026c0cfc683fd3ad2735713", "score": "0.5017485", "text": "func SetMaxSizeMb(size int64) { megabyteSize = size * 1024 * 1024 }", "title": "" }, { "docid": "336066cdcd7c0ae4bf7fe92c46bf28ed", "score": "0.5001901", "text": "func (o V2FunctionOutput) DiskSize() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *V2Function) pulumi.IntPtrOutput { return v.DiskSize }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "2b9ce6f2b05597f52a780c7c00b67487", "score": "0.49905816", "text": "func (m *MessageTrace) SetSize(value *int32)() {\n err := m.GetBackingStore().Set(\"size\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "58546d31987fb3e76bd8831b4d8d82df", "score": "0.49808535", "text": "func (doNetwork Network) SetDataSizeLimitsForTest(maxTotalSize int64, maxResourceSize int64) (err error) {\n\tb := network.SetDataSizeLimitsForTest(maxTotalSize, maxResourceSize)\n\treturn b.Do(doNetwork.ctxWithExecutor)\n}", "title": "" }, { "docid": "09c421c6a5db771b8fedb8494d156c83", "score": "0.49729666", "text": "func (m *Win32LobApp) SetMinimumFreeDiskSpaceInMB(value *int32)() {\n m.minimumFreeDiskSpaceInMB = value\n}", "title": "" }, { "docid": "21ff93b6f954462b0e3abe5ea0a5a60a", "score": "0.49704716", "text": "func (p *Action) SetDisk(attr *Disk) {\n\tp.disk = attr\n}", "title": "" }, { "docid": "9b74894be89cc4d7c9ef887e0d266722", "score": "0.4965145", "text": "func (o LookupInstanceResultOutput) MaxDiskSize() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) string { return v.MaxDiskSize }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b2d1531b5ed1092e9ff770fe5c66b119", "score": "0.4946895", "text": "func (c *Cloud) ResizeDisk(\n\tdiskName KubernetesVolumeID,\n\toldSize resource.Quantity,\n\tnewSize resource.Quantity) (resource.Quantity, error) {\n\tawsDisk, err := newAWSDisk(c, diskName)\n\tif err != nil {\n\t\treturn oldSize, err\n\t}\n\n\tvolumeInfo, err := awsDisk.describeVolume()\n\tif err != nil {\n\t\tdescErr := fmt.Errorf(\"AWS.ResizeDisk Error describing volume %s with %v\", diskName, err)\n\t\treturn oldSize, descErr\n\t}\n\t// AWS resizes in chunks of GiB (not GB)\n\trequestGiB, err := volumehelpers.RoundUpToGiB(newSize)\n\tif err != nil {\n\t\treturn oldSize, err\n\t}\n\tnewSizeQuant := resource.MustParse(fmt.Sprintf(\"%dGi\", requestGiB))\n\n\t// If disk already if of greater or equal size than requested we return\n\tif aws.Int64Value(volumeInfo.Size) >= requestGiB {\n\t\treturn newSizeQuant, nil\n\t}\n\t_, err = awsDisk.modifyVolume(requestGiB)\n\n\tif err != nil {\n\t\treturn oldSize, err\n\t}\n\treturn newSizeQuant, nil\n}", "title": "" }, { "docid": "7af059e352850dfecf824a6e21fcdbd4", "score": "0.49419826", "text": "func (m *WindowsDeliveryOptimizationConfiguration) SetMinimumRamAllowedToPeerInGigabytes(value *int32)() {\n err := m.GetBackingStore().Set(\"minimumRamAllowedToPeerInGigabytes\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e45766dfa017cee99e307b61339e498a", "score": "0.49376604", "text": "func (upac *UnsavedPostAttachmentCreate) SetSize(u uint64) *UnsavedPostAttachmentCreate {\n\tupac.mutation.SetSize(u)\n\treturn upac\n}", "title": "" }, { "docid": "56f6da82c8336c264d603a76bd3bc8f9", "score": "0.49333838", "text": "func DiskSize(size string) (int, error) {\n\ti, err := strconv.Atoi(diskSizeRegexp.FindString(size))\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn i, nil\n}", "title": "" }, { "docid": "332fd92f390a75c81b41cf789fff6071", "score": "0.49129727", "text": "func (o NodeTemplateOpennebulaConfigOutput) DiskResize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NodeTemplateOpennebulaConfig) *string { return v.DiskResize }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fbf429c3598a21b7c82d3c5ec326f517", "score": "0.48995918", "text": "func (o AutoprovisioningNodePoolDefaultsOutput) DiskSizeGb() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v AutoprovisioningNodePoolDefaults) *int { return v.DiskSizeGb }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "c7db24c921f9181d4385dc7eeb0e587b", "score": "0.48884875", "text": "func (t *Tensor) SetSize(s []int) {\n\tt.size = make([]int, len(s))\n\tcopy(t.size, s)\n}", "title": "" }, { "docid": "f04416bfdd4511375e762c9aeee89db7", "score": "0.48503217", "text": "func (o InstanceGroupManagerVersionOutput) TargetSize() FixedOrPercentPtrOutput {\n\treturn o.ApplyT(func(v InstanceGroupManagerVersion) *FixedOrPercent { return v.TargetSize }).(FixedOrPercentPtrOutput)\n}", "title": "" }, { "docid": "36c7e07b999a124a49b2e5cb578898be", "score": "0.48502806", "text": "func (b *argWidthOverloadBase) SetVariableSize(target, value string) string {\n\treturn setVariableSize(b.CanonicalTypeFamily, target, value)\n}", "title": "" }, { "docid": "cda6fe258d566f6cbb48d8d89929b854", "score": "0.48459995", "text": "func (m *WindowsDeliveryOptimizationConfiguration) SetMaximumCacheSize(value DeliveryOptimizationMaxCacheSizeable)() {\n err := m.GetBackingStore().Set(\"maximumCacheSize\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0c664361454df1ffb4df049cb6f2056a", "score": "0.48336148", "text": "func (CafeRequestOption) Size(val int) CafeRequestOption {\n\treturn func(settings *CafeRequestSettings) {\n\t\tsettings.Size = val\n\t}\n}", "title": "" }, { "docid": "a11544fb96e453dfc78bf8ef45085571", "score": "0.48206255", "text": "func (disk qemuDiskResize) resize(vmr *VmRef, client *Client) (exitStatus string, err error) {\n\treturn client.PutWithTask(map[string]interface{}{\"disk\": disk.Id, \"size\": strconv.Itoa(int(disk.SizeInGigaBytes)) + \"G\"}, fmt.Sprintf(\"/nodes/%s/%s/%d/resize\", vmr.node, vmr.vmType, vmr.vmId))\n}", "title": "" }, { "docid": "8eb2e205965967c4e16c2f10b167fb46", "score": "0.4807134", "text": "func NegotiateSize(ctx context.Context, vimgBuilder *vimg.Builder, cfg *vcfg.VCFG, args *BuildArgs) error {\n\tsize := vimgBuilder.MinimumSize()\n\tif !cfg.VM.DiskSize.IsDelta() {\n\t\tif size > int64(cfg.VM.DiskSize.Units(vcfg.Byte)) {\n\t\t\tdelta := vcfg.Bytes(size) - cfg.VM.DiskSize\n\t\t\tdelta.Align(vcfg.MiB)\n\t\t\treturn fmt.Errorf(\"specified disk size %s insufficient to contain disk contents\", delta)\n\t\t}\n\t\tsize = int64(cfg.VM.DiskSize.Units(vcfg.Byte))\n\t}\n\n\talignment := args.SizeAlign\n\tif alignment == 0 {\n\t\talignment = 1\n\t}\n\talignment = lcm(args.Format.Alignment(), alignment)\n\tsize = ((size + alignment - 1) / alignment) * alignment\n\n\terr := vimgBuilder.Prebuild(ctx, size)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "f5ecc81f460fb43131f6f369fe598fca", "score": "0.47990277", "text": "func (cfg *Server) SetNrHugepages(log logging.Logger, mi *common.MemInfo) error {\n\tvar cfgTargetCount int\n\tvar sysXSCount int\n\tfor idx, ec := range cfg.Engines {\n\t\tmsg := fmt.Sprintf(\"engine %d fabric numa %d, storage numa %d\", idx,\n\t\t\tec.Fabric.NumaNodeIndex, ec.Storage.NumaNodeIndex)\n\n\t\t// Calculate overall target count if NVMe is enabled.\n\t\tif ec.Storage.Tiers.HaveBdevs() {\n\t\t\tcfgTargetCount += ec.TargetCount\n\t\t\tif ec.Storage.Tiers.HasBdevRoleMeta() {\n\t\t\t\tmsg = fmt.Sprintf(\"%s (MD-on-SSD)\", msg)\n\t\t\t\t// MD-on-SSD has extra sys-xstream for rdb.\n\t\t\t\tsysXSCount++\n\t\t\t}\n\t\t}\n\t\tlog.Debug(msg)\n\t}\n\n\tif cfgTargetCount <= 0 {\n\t\treturn nil // no nvme, no hugepages required\n\t}\n\n\tif cfg.DisableHugepages {\n\t\treturn FaultConfigHugepagesDisabled\n\t}\n\n\t// Calculate minimum number of hugepages for all configured engines.\n\tminHugepages, err := storage.CalcMinHugepages(mi.HugepageSizeKiB, cfgTargetCount+sysXSCount)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If the config doesn't specify hugepages, use the minimum. Otherwise, validate\n\t// that the configured amount is sufficient.\n\tif cfg.NrHugepages == 0 {\n\t\tvar msgSysXS string\n\t\tif sysXSCount > 0 {\n\t\t\tmsgSysXS = fmt.Sprintf(\" and %d sys-xstreams\", sysXSCount)\n\t\t}\n\t\tlog.Debugf(\"calculated nr_hugepages: %d for %d targets%s\", minHugepages,\n\t\t\tcfgTargetCount, msgSysXS)\n\t\tcfg.NrHugepages = minHugepages\n\t\tlog.Infof(\"hugepage count automatically set to %d (%s)\", minHugepages,\n\t\t\thumanize.IBytes(hugePageBytes(minHugepages, mi.HugepageSizeKiB)))\n\t}\n\n\tif cfg.NrHugepages < minHugepages {\n\t\tlog.Noticef(\"configured nr_hugepages %d is less than recommended %d, \"+\n\t\t\t\"if this is not intentional update the 'nr_hugepages' config \"+\n\t\t\t\"parameter or remove and it will be automatically calculated\",\n\t\t\tcfg.NrHugepages, minHugepages)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d5166fa6f8c0e531c60595fef7588193", "score": "0.47968155", "text": "func (md *RootMetadataV2) SetDiskUsage(diskUsage uint64) {\n\tmd.WriterMetadataV2.DiskUsage = diskUsage\n}", "title": "" }, { "docid": "5e3de1dfec5ea839da8d2bdaace90a40", "score": "0.47948214", "text": "func (vm *VM) ChangeMemorySize(size int) (Task, error) {\n\n\terr := vm.Refresh()\n\tif err != nil {\n\t\treturn Task{}, fmt.Errorf(\"error refreshing VM before running customization: %s\", err)\n\t}\n\n\tnewMem := &types.OVFItem{\n\t\tXmlnsRasd: types.XMLNamespaceRASD,\n\t\tXmlnsVCloud: types.XMLNamespaceVCloud,\n\t\tXmlnsXsi: types.XMLNamespaceXSI,\n\t\tVCloudHREF: vm.VM.HREF + \"/virtualHardwareSection/memory\",\n\t\tVCloudType: types.MimeRasdItem,\n\t\tAllocationUnits: \"byte * 2^20\",\n\t\tDescription: \"Memory SizeMb\",\n\t\tElementName: strconv.Itoa(size) + \" MB of memory\",\n\t\tInstanceID: 5,\n\t\tReservation: 0,\n\t\tResourceType: types.ResourceTypeMemory,\n\t\tVirtualQuantity: int64(size),\n\t\tWeight: 0,\n\t\tLink: &types.Link{\n\t\t\tHREF: vm.VM.HREF + \"/virtualHardwareSection/memory\",\n\t\t\tRel: \"edit\",\n\t\t\tType: types.MimeRasdItem,\n\t\t},\n\t}\n\n\tapiEndpoint := urlParseRequestURI(vm.VM.HREF)\n\tapiEndpoint.Path += \"/virtualHardwareSection/memory\"\n\n\t// Return the task\n\treturn vm.client.ExecuteTaskRequest(apiEndpoint.String(), http.MethodPut,\n\t\ttypes.MimeRasdItem, \"error changing memory size: %s\", newMem)\n}", "title": "" }, { "docid": "fa3f7fde55620d46639c2e4aef012ae5", "score": "0.4768609", "text": "func (machinedeployment *MachineDeployment) TargetSize() (int, error) {\n\tsize, err := machinedeployment.mcmManager.GetMachineDeploymentSize(machinedeployment)\n\treturn int(size), err\n}", "title": "" }, { "docid": "7e77a770edcc7fecd34371140621febe", "score": "0.47617537", "text": "func (m *Model) SetSize(width, height int) {\n\tm.setSize(width, height)\n}", "title": "" }, { "docid": "8ccc547f953c3ca0974fcde0106ec565", "score": "0.47508425", "text": "func (pac *PostAttachmentCreate) SetSize(u uint64) *PostAttachmentCreate {\n\tpac.mutation.SetSize(u)\n\treturn pac\n}", "title": "" }, { "docid": "62bfd7f9d70d82cc6db558f7206f1bcf", "score": "0.47470725", "text": "func (o *VolumeCreateAsyncRequest) SetSize(newValue int) *VolumeCreateAsyncRequest {\n\to.SizePtr = &newValue\n\treturn o\n}", "title": "" }, { "docid": "03b7c2ef605ad0892c6aeaba0ace18ae", "score": "0.47446704", "text": "func (o *LogFile4pg) SetSize(v int64) {\n\to.Size = &v\n}", "title": "" }, { "docid": "22df5009be3ca2de198bdd000ef4dc5c", "score": "0.47298345", "text": "func (md *RootMetadataV3) SetDiskUsage(diskUsage uint64) {\n\tmd.WriterMetadata.DiskUsage = diskUsage\n}", "title": "" }, { "docid": "c6819af7c29fd750dec8ce8a00f3fdcc", "score": "0.47281235", "text": "func (s *Scrollbar) SetSize(v wm.Size) { s.onSetSize.Handle(s.w, &s.size, v) }", "title": "" }, { "docid": "db44294025f023e46803efe788fe4c9a", "score": "0.4716446", "text": "func (a *Article) SetSize(new string) {\n\ta.Size = new\n}", "title": "" }, { "docid": "67ade6b2b326a8bfedbf0111e2e599c9", "score": "0.47136602", "text": "func (s *Size) Set(str string) error {\n\tn, err := strconv.ParseInt(str, 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*s = Size(n)\n\treturn nil\n}", "title": "" }, { "docid": "19c0ba2390ea001ebf891438248ad195", "score": "0.4712984", "text": "func (o *ReportsListResponse) SetSize(v int32) {\n\to.Size = v\n}", "title": "" }, { "docid": "bc9bd03593b04d2655fc5cfe012cbede", "score": "0.47112614", "text": "func (in *ActionPoolCreateInput) SetRecordsize(value int64) *ActionPoolCreateInput {\n\tin.Recordsize = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Recordsize\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "43d059616ef918222806dd135dd39a6d", "score": "0.470709", "text": "func (o *FlowFileSummaryDTO) SetSize(v int64) {\n\to.Size = &v\n}", "title": "" }, { "docid": "e926a1afcd8e51d33eeb8d3a0117653a", "score": "0.47055545", "text": "func (s *Tmpfs) SetSize(v int64) *Tmpfs {\n\ts.Size = &v\n\treturn s\n}", "title": "" }, { "docid": "3619c6fce5442b21090fc931de06c8a0", "score": "0.46971637", "text": "func (self *TraitFileInfo) SetSize(size int64) {\n\tC.g_file_info_set_size(self.CPointer, C.goffset(size))\n\treturn\n}", "title": "" }, { "docid": "680ba1cf44325c634e5e2445c5b15442", "score": "0.46880022", "text": "func (b *bucket) SetSize(size MemSize) {\n\ttmpsize := size\n\tb.size = &tmpsize\n}", "title": "" }, { "docid": "1b91213122642dd24883d924446f8499", "score": "0.46804482", "text": "func (self View) SetSize(x, y float32) {\n\tC.sfView_setSize(self.Cref, C.sfVector2f{\n\t\tC.float(x), C.float(y),\n\t})\n}", "title": "" }, { "docid": "3363cb0b0f3302ad20aed45db97c30cd", "score": "0.46754548", "text": "func (o *TermsRelativeParams) SetSize(size *int64) {\n\to.Size = size\n}", "title": "" }, { "docid": "940ac4115bf3e58e2d125e75541436fa", "score": "0.4673244", "text": "func (mt *MachineTarget) SetLimits(min, max int) {\n\tannotations := mt.GetAnnotations()\n\n\tif annotations == nil {\n\t\tannotations = make(map[string]string)\n\t}\n\n\tannotations[minSizeAnnotation] = strconv.Itoa(min)\n\tannotations[maxSizeAnnotation] = strconv.Itoa(max)\n\n\tmt.SetAnnotations(annotations)\n}", "title": "" }, { "docid": "311d04c92344302d130bc06be57da97a", "score": "0.4668965", "text": "func (ks *BitSize) SetInBytes(amountOfBytes uint16) {\n\t*ks = BitSize(amountOfBytes << 3)\n}", "title": "" }, { "docid": "0751631f6344203e1abb06d7e7318e44", "score": "0.466427", "text": "func (o ExtraDiskSizeOutput) ExtraDiskSize() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *ExtraDiskSize) pulumi.IntOutput { return v.ExtraDiskSize }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "530e72cefe5bcdd75ef9251686156471", "score": "0.46631402", "text": "func (pool *WorkerPool) SetSize(size uint) {\n\tpool.m.Lock()\n\tdefer pool.m.Unlock()\n\n\tif size == pool.size {\n\t\treturn\n\t}\n\tfor size < pool.size {\n\t\tpool.schedule <- nil\n\t\tpool.size--\n\t}\n\tfor size > pool.size {\n\t\tpool.waitGroup.Add(1)\n\t\tgo pool.worker()\n\t\tpool.size++\n\t}\n}", "title": "" }, { "docid": "f6fdcc5984e213e0708677dacf390503", "score": "0.46602643", "text": "func (machinedeployment *MachineDeployment) IncreaseSize(delta int) error {\n\tif delta <= 0 {\n\t\treturn fmt.Errorf(\"size increase must be positive\")\n\t}\n\tsize, err := machinedeployment.mcmManager.GetMachineDeploymentSize(machinedeployment)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttargetSize := int(size) + delta\n\tif targetSize > machinedeployment.MaxSize() {\n\t\treturn fmt.Errorf(\"size increase too large - desired:%d max:%d\", targetSize, machinedeployment.MaxSize())\n\t}\n\treturn machinedeployment.mcmManager.retry(func(ctx context.Context) (bool, error) {\n\t\treturn machinedeployment.mcmManager.SetMachineDeploymentSize(ctx, machinedeployment, int64(targetSize))\n\t}, \"MachineDeployment\", \"update\", machinedeployment.Name)\n}", "title": "" }, { "docid": "8b46ed3e0f729a7900085a1e930219d0", "score": "0.46551704", "text": "func (d *dir) setQuota(path string, volID int64, size string) error {\n\tif volID == 0 {\n\t\treturn fmt.Errorf(\"Missing volume ID\")\n\t}\n\n\t// If size not specified in volume config, then use pool's default volume.size setting.\n\tif size == \"\" || size == \"0\" {\n\t\tsize = d.config[\"volume.size\"]\n\t}\n\n\tsizeBytes, err := units.ParseByteSizeString(size)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tok, err := quota.Supported(path)\n\tif err != nil || !ok {\n\t\t// Skipping quota as underlying filesystem doesn't suppport project quotas.\n\t\td.logger.Warn(\"The backing filesystem doesn't support quotas, skipping quota\", log.Ctx{\"path\": path})\n\t\treturn nil\n\t}\n\n\terr = quota.SetProjectQuota(path, d.quotaProjectID(volID), sizeBytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "862ab6aa63a4c386a58fff38c7058b79", "score": "0.46462753", "text": "func (m *Windows10GeneralConfiguration) SetEnterpriseCloudPrintDiscoveryMaxLimit(value *int32)() {\n err := m.GetBackingStore().Set(\"enterpriseCloudPrintDiscoveryMaxLimit\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "89fb1326782ff5f8ca826fb635ca09a6", "score": "0.46344963", "text": "func (o NodeTemplateOpennebulaConfigPtrOutput) DiskResize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NodeTemplateOpennebulaConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DiskResize\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6fd2d14c93abd9e6d42ecc68dca68e8d", "score": "0.46300763", "text": "func (v *PixbufLoader) SetSize(width, height int) {\n\tC.gdk_pixbuf_loader_set_size(v.native(), C.int(width), C.int(height))\n}", "title": "" }, { "docid": "82ea2949eb8484051dfa6e61e17c663b", "score": "0.46289304", "text": "func (o *Options) SetTargetFileSizeMultiplier(value int) {\n\tC.rocksdb_options_set_target_file_size_multiplier(o.c, C.int(value))\n}", "title": "" }, { "docid": "a0102a6074b35f7e647304ca312d4562", "score": "0.46173897", "text": "func (o ClusterGkeConfigOutput) DiskSizeGb() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v ClusterGkeConfig) *int { return v.DiskSizeGb }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "83ba46412ffee91e50cf271d56b025e2", "score": "0.46079543", "text": "func (pool *Pool) SetSize(size int) {\n\tpool.workerMux.Lock()\n\tdefer pool.workerMux.Unlock()\n\n\tcurrent := len(pool.workers)\n\tif current == size {\n\t\treturn\n\t}\n\n\tif size > current {\n\t\t// Add extra workers if size > current\n\t\tfor i := current; i < size; i++ {\n\t\t\tworker := NewWorker(pool.reqChan)\n\t\t\tworker.Start()\n\t\t\tpool.workers = append(pool.workers, worker)\n\t\t}\n\n\t\treturn\n\t}\n\n\t// size < current\n\t// Asynchronously stop all workers (size ..(current))\n\tfor i := size; i < current; i++ {\n\t\tpool.workers[i].Terminate()\n\t}\n\n\t// Synchronously wait for the workers who requested to stop.\n\tfor i := 0; i < (current - size); i++ {\n\t\tpool.workers[i].WaitUntilTerminated()\n\t}\n}", "title": "" }, { "docid": "926edbc803e61d178d8078ca919313fc", "score": "0.46047944", "text": "func (o *NiatelemetryNiaInventory) SetDisk(v NiatelemetryDiskinfo) {\n\to.Disk.Set(&v)\n}", "title": "" }, { "docid": "3f8ba4a84a7ba58a8bdc39d063ff4053", "score": "0.46045762", "text": "func setupDisk(ctx context.Context, disk *types.Disk, diskIndex int, imageSize int64, tmpDirectory string) (err error) {\n\t// attempt to create the file, will leave already existing files alone.\n\t// os.Truncate requires the file to already exist\n\tvar (\n\t\tout *os.File\n\t\ttmp []byte\n\t)\n\tif out, err = os.Create(disk.ImageFile); err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\t// Delete the image file if this function exits with an error\n\t\tif err != nil {\n\t\t\tos.Remove(disk.ImageFile)\n\t\t}\n\t}()\n\tout.Close()\n\n\t// Truncate the file to the given size\n\tif err = os.Truncate(disk.ImageFile, imageSize); err != nil {\n\t\treturn err\n\t}\n\n\t// Attach the file to a loopback device\n\ttmp, err = run(ctx, \"losetup\", \"-Pf\", \"--show\", disk.ImageFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdisk.Device = strings.TrimSpace(string(tmp))\n\tloopdev := disk.Device\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t_ = destroyDevice(loopdev)\n\t\t}\n\t}()\n\n\t// Avoid race with kernel by waiting for loopDevice creation to complete\n\tif _, err = run(ctx, \"udevadm\", \"settle\"); err != nil {\n\t\treturn fmt.Errorf(\"settling devices: %v\", err)\n\t}\n\n\tif err = createPartitionTable(ctx, disk.Device, disk.Partitions); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, partition := range disk.Partitions {\n\t\tif partition.TypeCode == \"blank\" || partition.FilesystemType == \"\" || partition.FilesystemType == \"swap\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tpartition.MountPath = filepath.Join(tmpDirectory, fmt.Sprintf(\"hd%dp%d\", diskIndex, partition.Number))\n\t\tif err = os.Mkdir(partition.MountPath, 0777); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmountPath := partition.MountPath\n\t\tdefer func() {\n\t\t\t// Delete the mount path if this function exits with an error\n\t\t\tif err != nil {\n\t\t\t\tos.RemoveAll(mountPath)\n\t\t\t}\n\t\t}()\n\n\t\tpartition.Device = fmt.Sprintf(\"%sp%d\", disk.Device, partition.Number)\n\t\tif err = formatPartition(ctx, partition); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "814aa87e56f90abd599a8b9f23e0b35b", "score": "0.4600219", "text": "func (o *VolumeSpaceAttributesType) SetSize(newValue int) *VolumeSpaceAttributesType {\n\to.SizePtr = &newValue\n\treturn o\n}", "title": "" }, { "docid": "cffcd694a67990468d5f18e05fced728", "score": "0.45940864", "text": "func (m *Windows10GeneralConfiguration) SetStorageRestrictAppInstallToSystemVolume(value *bool)() {\n err := m.GetBackingStore().Set(\"storageRestrictAppInstallToSystemVolume\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d80368190146aafab37b01b864771e3f", "score": "0.459221", "text": "func (o ClusterGkeConfigV2NodePoolConfigOutput) DiskSizeGb() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v ClusterGkeConfigV2NodePoolConfig) *int { return v.DiskSizeGb }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "044184a490e605ffe7ec5434de43c77e", "score": "0.45886534", "text": "func (c *Connector) SetBulkSize(bulkSize int) error {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tif bulkSize < minBulkSize {\n\t\tbulkSize = minBulkSize\n\t}\n\tc.bulkSize = bulkSize\n\treturn nil\n}", "title": "" }, { "docid": "718a7daca6241c6b43c9aa9ccae76d08", "score": "0.45881194", "text": "func (c *cloud) ResizeOrModifyDisk(ctx context.Context, volumeID string, newSizeBytes int64, options *ModifyDiskOptions) (int64, error) {\n\tif newSizeBytes != 0 {\n\t\tklog.V(4).InfoS(\"Received Resize and/or Modify Disk request\", \"volumeID\", volumeID, \"newSizeBytes\", newSizeBytes, \"options\", options)\n\t} else {\n\t\tklog.V(4).InfoS(\"Received Modify Disk request\", \"volumeID\", volumeID, \"options\", options)\n\t}\n\n\tnewSizeGiB := util.RoundUpGiB(newSizeBytes)\n\tvar oldSizeGiB int64\n\tif newSizeBytes != 0 {\n\t\tvolumeSize, err := c.validateVolumeSize(ctx, volumeID, newSizeGiB)\n\t\tif err != nil || volumeSize != 0 {\n\t\t\treturn volumeSize, err\n\t\t}\n\t}\n\n\treq := &ec2.ModifyVolumeInput{\n\t\tVolumeId: aws.String(volumeID),\n\t}\n\t// Only set req.size for resizing volume\n\tif newSizeBytes != 0 {\n\t\treq.Size = aws.Int64(newSizeGiB)\n\t}\n\tif options.IOPS != 0 {\n\t\treq.Iops = aws.Int64(int64(options.IOPS))\n\t}\n\tif options.VolumeType != \"\" {\n\t\treq.VolumeType = aws.String(options.VolumeType)\n\t}\n\tif options.VolumeType == VolumeTypeGP3 {\n\t\treq.Throughput = aws.Int64(int64(options.Throughput))\n\t}\n\n\tresponse, err := c.ec2.ModifyVolumeWithContext(ctx, req)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"unable to modify AWS volume %q: %w\", volumeID, err)\n\t}\n\n\tmod := response.VolumeModification\n\tstate := aws.StringValue(mod.ModificationState)\n\n\tif volumeModificationDone(state) {\n\t\tif newSizeBytes != 0 {\n\t\t\treturn c.checkDesiredSize(ctx, volumeID, newSizeGiB)\n\t\t} else {\n\t\t\treturn 0, nil\n\t\t}\n\t}\n\n\terr = c.waitForVolumeSize(ctx, volumeID)\n\tif newSizeBytes != 0 {\n\t\tif err != nil {\n\t\t\treturn oldSizeGiB, err\n\t\t}\n\t\treturn c.checkDesiredSize(ctx, volumeID, newSizeGiB)\n\t} else {\n\t\treturn 0, c.waitForVolumeSize(ctx, volumeID)\n\t}\n}", "title": "" }, { "docid": "054724547ec413c0a69b6cb72579fd8e", "score": "0.4582586", "text": "func (o AllocationSpecificSKUAllocationAllocatedInstancePropertiesReservedDiskOutput) DiskSizeGb() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AllocationSpecificSKUAllocationAllocatedInstancePropertiesReservedDisk) *string {\n\t\treturn v.DiskSizeGb\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3a86e1de108a2cd049f591870309631f", "score": "0.4579597", "text": "func (o *SnapshotProperties) SetSize(v float32) {\n\n\to.Size = &v\n\n}", "title": "" }, { "docid": "f20d4b11e8030a8e0fdcec80f1f6b41a", "score": "0.4575211", "text": "func (self *Options) SetTargetFileSizeMultiplier(value int) {\n\tC.rocksdb_options_set_target_file_size_multiplier(self.c, C.int(value))\n}", "title": "" } ]
b65d05f7ebc556b3b6c49fb83c92a379
NewExcludedApps instantiates a new excludedApps and sets the default values.
[ { "docid": "b5e2354ad9169bac90e36654f8f3da6d", "score": "0.85696644", "text": "func NewExcludedApps()(*ExcludedApps) {\n m := &ExcludedApps{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" } ]
[ { "docid": "cd8071b995ce2a7e86d7fd6437fac716", "score": "0.68058753", "text": "func (c Classic) Exclude(apps ...string) Classic {\n\tc.excludedApps = apps\n\treturn c\n}", "title": "" }, { "docid": "68ae856f4c1fd734b851dc57a4f18bc0", "score": "0.6082744", "text": "func CreateExcludedAppsFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewExcludedApps(), nil\n}", "title": "" }, { "docid": "84027f7a166017c6e20b508bbc20c5a0", "score": "0.578996", "text": "func NewGetAppsForbidden() *GetAppsForbidden {\n\n\treturn &GetAppsForbidden{}\n}", "title": "" }, { "docid": "e8d15f58b9e657dfabf3160b55769ef6", "score": "0.55288404", "text": "func newApp(name, appLocation string, integrations []Integration) App {\n\tapp := &app{\n\t\tname: name,\n\t\tappLocation: appLocation,\n\t\tbuilds: make(map[string][]Build),\n\t\tbus: newAppBus(),\n\t\tintegrations: integrations,\n\t}\n\n\tfor _, integration := range integrations {\n\t\tintegration.AttachToApp(app)\n\t}\n\treturn app\n}", "title": "" }, { "docid": "b76ecc4e8182bd23c3a67a5a66dfbb2a", "score": "0.54710025", "text": "func NewApp() *App {\n\treturn &App{\n\t\tRoles: make([]AppRole, 0),\n\t\tUsers: make([]AppUser, 0),\n\t}\n}", "title": "" }, { "docid": "4a7ebe2290b2bb3bad10c6c29675df3f", "score": "0.5459909", "text": "func GetApps() []App {\n\tappsLocation, err := getAppsLocation()\n\tif err != nil {\n\t\treturn []App{}\n\t}\n\n\tperAppDirs, err := filepath.Glob(filepath.Join(appsLocation, \"*\"))\n\tif err != nil {\n\t\tlogcritf(\"Couldn't glob %s: %s\", appsLocation, err)\n\t\treturn []App{}\n\t}\n\n\tapps := []App{}\n\tfor _, appDir := range perAppDirs {\n\t\tsplitDirs := strings.Split(appDir, string(filepath.Separator))\n\t\tif len(splitDirs) < 2 {\n\t\t\tlogcritf(\"Could not deterimine app name for :%s\", appDir)\n\t\t\tcontinue\n\t\t}\n\t\tname := splitDirs[len(splitDirs)-1]\n\t\tenabledIntegrations := struct {\n\t\t\tEnabledIntegrations []string `mapstructure:\"enabledIntegrations\"`\n\t\t}{}\n\t\tapplyConfig(name, &enabledIntegrations)\n\n\t\tintegrations := GetIntegrations()\n\t\t// christ this code, will remove all but the 'enabledIntegrations' from our integrations list\n\t\tif len(enabledIntegrations.EnabledIntegrations) > 0 {\n\t\t\tfor finished := false; finished == false; {\n\t\t\t\tfinished = true\n\t\t\t\tfor i, integration := range integrations {\n\t\t\t\t\tfoundInEnabled := false\n\t\t\t\t\tfor _, enabledIntegration := range enabledIntegrations.EnabledIntegrations {\n\t\t\t\t\t\tif enabledIntegration == integration.Identifier() {\n\t\t\t\t\t\t\tfoundInEnabled = true\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif foundInEnabled == false {\n\t\t\t\t\t\tintegrations = append(integrations[:i], integrations[i+1:]...)\n\t\t\t\t\t\tfinished = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tapp := newApp(name, appDir, integrations)\n\n\t\tapps = append(apps, app)\n\t}\n\n\treturn apps\n}", "title": "" }, { "docid": "8eacd7bd6eee68323222138de2aa01d8", "score": "0.54037833", "text": "func newApplications(b *Backend, env string) *applications {\n\treturn &applications{\n\t\tb: b,\n\t\tenv: env,\n\t}\n}", "title": "" }, { "docid": "249a652b53e585f545b0c1c8b8be368b", "score": "0.53661", "text": "func New(ds store.DataStore, inv inventory.Client, wf workflows.Client, config ...Config) App {\n\tconf := Config{}\n\tfor _, cfgIn := range config {\n\t\tif cfgIn.HaveAuditLogs {\n\t\t\tconf.HaveAuditLogs = true\n\t\t}\n\t}\n\treturn &app{\n\t\tstore: ds,\n\t\tinventory: inv,\n\t\tworkflows: wf,\n\t\tConfig: conf,\n\t}\n}", "title": "" }, { "docid": "b6fd0fa2ca0784eba56bf338c7422939", "score": "0.528376", "text": "func (m *DefaultManagedAppProtectionItemRequestBuilder) Apps()(*ib58f8e07860703f9c02eb7bd9c28b3c1acc81af39864fcb1185d0ac405db866a.AppsRequestBuilder) {\n return ib58f8e07860703f9c02eb7bd9c28b3c1acc81af39864fcb1185d0ac405db866a.NewAppsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "a5bdb4c53d265a536644edb9fbe6d906", "score": "0.5207955", "text": "func NewApp() *App {\n\tapp := &App{}\n\tapp.Rating = make(map[string]int64, 5)\n\tapp.PlainDescription = map[string]string{}\n\tapp.HtmlDescription = map[string]string{}\n\tapp.Developer = Developer{}\n\treturn app\n}", "title": "" }, { "docid": "fb131cd536379d4f1ad7b325eb0e847f", "score": "0.52063626", "text": "func NewGetAppsUnauthorized() *GetAppsUnauthorized {\n\n\treturn &GetAppsUnauthorized{}\n}", "title": "" }, { "docid": "1aa3cc2b4489b2b9a913fe87c647e582", "score": "0.5200216", "text": "func NewRestrictApplicationsForbidden() *RestrictApplicationsForbidden {\n\treturn &RestrictApplicationsForbidden{}\n}", "title": "" }, { "docid": "f4125f0b50a96303b6935d98f35ad332", "score": "0.5191233", "text": "func PrepareSupportedApps(d *dict.Parser) []*SupportedApp {\n\tlocallySupportedApps := []*SupportedApp{}\n\tfor _, app := range d.Apps() {\n\t\tif app.ID == 0 {\n\t\t\tcontinue\n\t\t}\n\t\taddApp := new(SupportedApp)\n\t\taddApp.ID = app.ID\n\t\taddApp.AppType = app.Type\n\t\tfor _, vendor := range app.Vendor {\n\t\t\taddApp.Vendor = vendor.ID\n\t\t}\n\t\tlocallySupportedApps = append(locallySupportedApps, addApp)\n\t}\n\treturn locallySupportedApps\n}", "title": "" }, { "docid": "1ed9e3f47a6e6d8194d3a8d5f5bab106", "score": "0.51841795", "text": "func New(ds store.DataStore, wf workflows.Client, config ...Config) App {\n\tconf := Config{}\n\tfor _, cfgIn := range config {\n\t\tif cfgIn.HaveAuditLogs {\n\t\t\tconf.HaveAuditLogs = true\n\t\t}\n\t}\n\treturn &app{\n\t\tstore: ds,\n\t\tworkflows: wf,\n\t\tConfig: conf,\n\t}\n}", "title": "" }, { "docid": "1d0dd1a12803497387e0c2afbc7f0b50", "score": "0.51581705", "text": "func New(opts ...Option) (*Application, error) {\n\tvar a Application\n\n\tfor _, opt := range opts {\n\t\tif err := opt.Apply(&a); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\ta.PID = os.Getegid()\n\n\treturn &a, nil\n}", "title": "" }, { "docid": "d527f2b37639a77ec7f413daff202af4", "score": "0.51461947", "text": "func (m *IosManagedAppProtectionItemRequestBuilder) Apps()(*i0527cdc9fd204c09fc094d9f1e7b55f4ccd84d958a7e0489f836475992dd87bb.AppsRequestBuilder) {\n return i0527cdc9fd204c09fc094d9f1e7b55f4ccd84d958a7e0489f836475992dd87bb.NewAppsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "cfa67b950d6f7cbc0a1e2f23115a165b", "score": "0.5133442", "text": "func newAppMutation(c config, op Op, opts ...appOption) *AppMutation {\n\tm := &AppMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeApp,\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": "5a1bb3175e8263116c325a3adde1dd96", "score": "0.5122003", "text": "func New(a *config.AppConfig) {\n\tapp = a\n}", "title": "" }, { "docid": "b2b5addd215b671f135dde0a05758dcb", "score": "0.5118452", "text": "func NewApp(clientId string, description string, id string, name string, scopes string, type_ AppType, ) *App {\n\tthis := App{}\n\tthis.ClientId = clientId\n\tthis.Description = description\n\tthis.Id = id\n\tthis.Name = name\n\tthis.Scopes = scopes\n\tthis.Type = type_\n\treturn &this\n}", "title": "" }, { "docid": "b9c6a69c807fb7a0a7476db81f79ca10", "score": "0.5070719", "text": "func NoApp() App { return noApp{} }", "title": "" }, { "docid": "204242c63850ea47d1e7d476b1606022", "score": "0.50502086", "text": "func NewApp(opts ...Option) *App {\n\treturn &App{conf: NewConfig(opts...)}\n}", "title": "" }, { "docid": "519b3704a602bb6bdcc078d22a80d3dc", "score": "0.504816", "text": "func (m *AndroidManagedAppProtectionItemRequestBuilder) Apps()(*ia2adaa61d2d9dfc1ea21fc5d3349adfe3b71c17172eb0c5e0660260fd2c1d5ff.AppsRequestBuilder) {\n return ia2adaa61d2d9dfc1ea21fc5d3349adfe3b71c17172eb0c5e0660260fd2c1d5ff.NewAppsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "a045f84ce5dea3096c8d21b57c650d18", "score": "0.50459164", "text": "func (m *DefaultManagedAppProtection) SetApps(value []ManagedMobileAppable)() {\n m.apps = value\n}", "title": "" }, { "docid": "9105e76804bdedbd49d7258fdb30276c", "score": "0.49985212", "text": "func NewApp(ctx context.Context) *App {\n\ta := &App{\n\t\tlogger: log.FromContextWithPackageName(ctx, \"go-common/app\"),\n\t}\n\ta.ctx, a.ctxCancel = context.WithCancel(ctx)\n\n\treturn a\n}", "title": "" }, { "docid": "dec46c5260d522162504d5b9634d9b84", "score": "0.49637285", "text": "func NewAppData(data model.AppData) (AppData, error) {\n\t_, err := xid.FromString(data.ID())\n\tif err != nil {\n\t\tlog.Println(\"wrong AppID: \", data.ID())\n\t\treturn AppData{}, model.ErrorWrongDataFormat\n\t}\n\treturn AppData{appData: appData{\n\t\tID: data.ID(),\n\t\tSecret: data.Secret(),\n\t\tActive: data.Active(),\n\t\tDescription: data.Description(),\n\t\tScopes: data.Scopes(),\n\t\tOffline: data.Offline(),\n\t\tRedirectURL: data.RedirectURL(),\n\t\tRefreshTokenLifespan: data.RefreshTokenLifespan(),\n\t\tTokenLifespan: data.TokenLifespan(),\n\t}}, nil\n}", "title": "" }, { "docid": "e2b62ac285ea63387c325804a7c37d26", "score": "0.4944198", "text": "func NewCreateAppForbidden() *CreateAppForbidden {\n\treturn &CreateAppForbidden{}\n}", "title": "" }, { "docid": "7ff5835642b81b5bba19a96db863604b", "score": "0.49432594", "text": "func ForApps(cfg Config) Config {\n\tcfg.target = \"apps\"\n\tcfg.Watches = []types.WatchKind{\n\t\t{Kind: types.KindCertAuthority, LoadSecrets: false},\n\t\t{Kind: types.KindClusterName},\n\t\t{Kind: types.KindClusterAuditConfig},\n\t\t{Kind: types.KindClusterNetworkingConfig},\n\t\t{Kind: types.KindClusterAuthPreference},\n\t\t{Kind: types.KindSessionRecordingConfig},\n\t\t{Kind: types.KindUser},\n\t\t{Kind: types.KindRole},\n\t\t{Kind: types.KindProxy},\n\t\t// Applications only need to \"know\" about default namespace events to avoid\n\t\t// matching too much data about other namespaces or events.\n\t\t{Kind: types.KindNamespace, Name: apidefaults.Namespace},\n\t\t{Kind: types.KindApp},\n\t}\n\tcfg.QueueSize = defaults.AppsQueueSize\n\treturn cfg\n}", "title": "" }, { "docid": "576a5108231d614ae51413e0e4d7741d", "score": "0.4913212", "text": "func NewAppsData() *AppsData {\n\td := new(AppsData)\n\td.RunningAppsData = make(map[string][]*common.AppInstanceData)\n\td.NewAppInstancesData = []*common.AppInstanceData{}\n\treturn d\n}", "title": "" }, { "docid": "cfc4f2c1a9bee7b6e9c94833795c1c35", "score": "0.4909433", "text": "func (in *AppSpec) DeepCopy() *AppSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AppSpec)\n\tout.Key = in.Key\n\tout.Enabled = in.Enabled\n\tout.SpecList = make([]interface{}, 0)\n\tfor _, spec := range in.SpecList {\n\t\tout.SpecList = append(out.SpecList, spec)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "69e088c0b9c07b786b91ae13dfc54a39", "score": "0.4904464", "text": "func newApp(pkg *pack.PackageEnvelope, manifestBytes []byte, locator loc.Locator, apps *Applications) (*app.Application, error) {\n\tmanifest, err := apps.resolveManifest(manifestBytes)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tif manifest.Metadata.Namespace == \"\" {\n\t\tmanifest.Metadata.Namespace = app.DefaultNamespace\n\t}\n\treturn &app.Application{\n\t\tPackage: locator,\n\t\tPackageEnvelope: *pkg,\n\t\tManifest: *manifest,\n\t}, nil\n}", "title": "" }, { "docid": "60ab552e98cfd79f648125a70eb832d4", "score": "0.49015808", "text": "func (apps *AppsData) AppendAppsDataToDelete(apiClient *rancher.MasterClient, req common.GenericRequester) error {\n\t// Fetch data from the server\n\tcollection, err := apiClient.ProjectClient.App.List(rancher.DefaultListOpts())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar requestedVersion string\n\n\t// Iterate over the data\n\tfor _, item := range collection.Data {\n\t\t// All the application instances deployed by Controller\n\t\t// have appropriate annotation - \"apphc.app.basename\"\n\t\tif appName := gcommon.MapGet(item.Annotations, common.AppAnnotationBaseName); appName != \"\" {\n\t\t\tif req != nil {\n\t\t\t\t// Continue if the annotation value is no equal to the name in the request\n\t\t\t\tif req.GetName() != \"\" && req.GetName() != appName {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// If version appears in request use it for filtering\n\t\t\t\tif req.GetVersion() != \"\" &&\n\t\t\t\t\treq.GetVersion() != gcommon.MapGet(item.Annotations, common.AppInstanceAnnotationVersion) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Set the version to the version came with request\n\t\t\t\trequestedVersion = req.GetVersion()\n\n\t\t\t\t// If root group ID appears in request use it for filtering\n\t\t\t\tif req.GetRootGroupId() != \"\" &&\n\t\t\t\t\treq.GetRootGroupId() != gcommon.MapGet(item.Annotations, common.AppInstanceAnnotationRootGroupId) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Find Group ID\n\t\t\t\tgroupId := gcommon.MapGet(item.Annotations, common.AppInstanceAnnotationGroupId)\n\t\t\t\tif groupId == \"\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tfound := false\n\t\t\t\tif len(req.GetGroupIds()) > 0 {\n\t\t\t\t\t// if more that a single Group ID provided , iterate over the list\n\t\t\t\t\t// and find a particular Group ID\n\t\t\t\t\tfor _, gid := range req.GetGroupIds() {\n\t\t\t\t\t\tif gid == groupId {\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\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Create the new application instance data\n\t\t\tappInstance := &common.AppInstanceData{}\n\t\t\tappInstance.InstanceName = item.Name\n\t\t\tappInstance.CurrentVersion = gcommon.MapGet(item.Annotations, common.AppInstanceAnnotationVersion)\n\t\t\tappInstance.RequestedVersion = requestedVersion\n\t\t\tappInstance.TemplateAvailable = true\n\t\t\tappInstance.Annotations = item.Annotations\n\t\t\tappInstance.NextAction = common.AppInstanceDataNextActionDelete\n\t\t\tapps.RunningAppsData[appName] = append(apps.RunningAppsData[appName], appInstance)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "378f4f9873d6bf28cb2cff88a7804b35", "score": "0.48999155", "text": "func NewAppConfig(config *config.AppConfig) {\n\tappConfig = config\n}", "title": "" }, { "docid": "4cb5d7d93178f435ce6f7c4cb281b91f", "score": "0.48754314", "text": "func New() *Application {\n\treturn &Application{\n\t\twaitStopCh: make(chan os.Signal, 1),\n\t\tshutDownWaitSecs: defaultShutDownWaitTime}\n}", "title": "" }, { "docid": "c2d761cc580aa927050184a8baddef7b", "score": "0.48595047", "text": "func ValidateApps(dir string) (*config.AppConfig, string, error) {\n\trequirements, _, err := config.LoadRequirementsConfig(dir, config.DefaultFailOnValidationError)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tapps, appsFileName, err := config.LoadAppConfig(dir)\n\n\tmodified := false\n\tif requirements.Repository != config.RepositoryTypeNexus {\n\t\tif removeApp(apps, \"jenkins-x/nexus\") {\n\t\t\tmodified = true\n\t\t}\n\t}\n\tif requirements.Repository == config.RepositoryTypeBucketRepo {\n\t\tif removeApp(apps, \"jenkins-x/chartmuseum\") {\n\t\t\tmodified = true\n\t\t}\n\t\tif addApp(apps, \"jenkins-x/bucketrepo\", \"repositories\") {\n\t\t\tmodified = true\n\t\t}\n\t}\n\n\tif requirements.Ingress.Kind == config.IngressTypeIstio {\n\t\tif removeApp(apps, \"stable/nginx-ingress\") {\n\t\t\tmodified = true\n\t\t}\n\t\tif addApp(apps, \"jx-labs/istio\", \"jenkins-x/jxboot-helmfile-resources\") {\n\t\t\tmodified = true\n\t\t}\n\t}\n\n\tif requirements.Cluster.Provider == cloud.KUBERNETES {\n\t\tif addApp(apps, \"stable/docker-registry\", \"jenkins-x/jxboot-helmfile-resources\") {\n\t\t\tmodified = true\n\t\t}\n\t}\n\n\tif shouldHaveCertManager(requirements) {\n\t\tif addApp(apps, \"jetstack/cert-manager\", \"jenkins-x/jxboot-helmfile-resources\") {\n\t\t\tmodified = true\n\t\t}\n\t\tif addApp(apps, \"jenkins-x/acme\", \"jenkins-x/jxboot-helmfile-resources\") {\n\t\t\tmodified = true\n\t\t}\n\t}\n\tif modified {\n\t\terr = apps.SaveConfig(appsFileName)\n\t\tif err != nil {\n\t\t\treturn apps, appsFileName, errors.Wrapf(err, \"failed to save modified file %s\", appsFileName)\n\t\t}\n\t}\n\treturn apps, appsFileName, err\n}", "title": "" }, { "docid": "ee2e5ba17b9f6971ae759399408fcb4f", "score": "0.48506266", "text": "func New() App {\n\treturn App{}\n}", "title": "" }, { "docid": "c6a79b9be78873595af162a79027b1bd", "score": "0.48484123", "text": "func NewDeleteAppForbidden() *DeleteAppForbidden {\n\treturn &DeleteAppForbidden{}\n}", "title": "" }, { "docid": "37a13eb814492ac0bc26cfe2c5b5102c", "score": "0.48454508", "text": "func newApp(config *config.Config) (*options.AppOptions, error) {\n\to := &options.AppOptions{}\n\tapp := kingpin.New(\"beaker\", \"Beaker is a lab assistant to run and view experiments.\")\n\n\t// Set a usage template to print better help messages.\n\tapp.UsageTemplate(usageTemplate)\n\n\t// Disable interspersing flags with positional args.\n\tapp.Interspersed(false)\n\n\t// Add global flags. These flags will also be available to sub-commands.\n\tapp.HelpFlag.Short('h')\n\tapp.Version(makeVersion())\n\tapp.VersionFlag.Short('v')\n\tapp.Flag(\"debug\", \"Print verbose stack traces on error.\").BoolVar(&o.Debug)\n\n\t// Build out sub-command groups.\n\talpha.NewAlphaCmd(app, o, config)\n\tblueprint.NewBlueprintCmd(app, o, config)\n\tdataset.NewDatasetCmd(app, o, config)\n\texperiment.NewExperimentCmd(app, o, config)\n\tgroup.NewGroupCmd(app, o, config)\n\ttask.NewTaskCmd(app, o, config)\n\n\t// Attach sub-commands.\n\tNewConfigCmd(app)\n\tNewVersionCmd(app)\n\n\t// Parse command line input.\n\t_, err := app.Parse(os.Args[1:])\n\treturn o, err\n}", "title": "" }, { "docid": "d16b416d27fb75f43699a22e43a315ae", "score": "0.4840599", "text": "func New(logger *log.Logger, cfg *Flags, options ...func(a *App) error) (*App, error) {\n\ta := App{Config: cfg, Log: logger}\n\tfor _, option := range options {\n\t\terr := option(&a)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif a.Cryptor == nil {\n\t\ta.setDefaultCryptor()\n\t}\n\treturn &a, nil\n}", "title": "" }, { "docid": "c3f7b1a2f20f813a59adf861bc9849aa", "score": "0.4839657", "text": "func NewApp(name string) *App {\n\treturn &App{\n\t\tName: name,\n\t\tChangeSets: make(map[ImageIdentifier]*ChangeSet),\n\t}\n}", "title": "" }, { "docid": "cf37cf8feaa9af2fc89c463fb2438720", "score": "0.48258853", "text": "func NewApplication() *Application {\n\tglobalAppOnce.Do(func() {\n\t\tglobalApp = new(Application)\n\t\tglobalApp.IrisApp = iris.New()\n\t\tglobalApp.pool = newServicePool()\n\t\tglobalApp.rpool = newRepoPool()\n\t\tglobalApp.factoryPool = newFactoryPool()\n\t\tglobalApp.comPool = newInfraPool()\n\t\tglobalApp.msgsBus = newMessageBus()\n\t\tglobalApp.other = newOther()\n\t\tglobalApp.marshal = json.Marshal\n\t\tglobalApp.unmarshal = json.Unmarshal\n\t\tglobalApp.Prometheus = newPrometheus()\n\t\tglobalApp.IrisApp.Logger().SetTimeFormat(\"2006-01-02 15:04:05.000\")\n\t})\n\treturn globalApp\n}", "title": "" }, { "docid": "ddd00a98aef682a0c7cf4b6a18fd6519", "score": "0.48140416", "text": "func (m *ExcludedApps) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n {\n err := writer.WriteBoolValue(\"access\", m.GetAccess())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"bing\", m.GetBing())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"excel\", m.GetExcel())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"groove\", m.GetGroove())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"infoPath\", m.GetInfoPath())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"lync\", m.GetLync())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"@odata.type\", m.GetOdataType())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"oneDrive\", m.GetOneDrive())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"oneNote\", m.GetOneNote())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"outlook\", m.GetOutlook())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"powerPoint\", m.GetPowerPoint())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"publisher\", m.GetPublisher())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"sharePointDesigner\", m.GetSharePointDesigner())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"teams\", m.GetTeams())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"visio\", m.GetVisio())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"word\", m.GetWord())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteAdditionalData(m.GetAdditionalData())\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "6d30ef757dd696b5727e043332b4ab06", "score": "0.48117188", "text": "func NewRestrictApplicationsUnauthorized() *RestrictApplicationsUnauthorized {\n\treturn &RestrictApplicationsUnauthorized{}\n}", "title": "" }, { "docid": "31bbda7c53ce5f593c881f3edbd87715", "score": "0.48108616", "text": "func NewApplication(cfg *Config, s *Storage, r *RateLimit, redis *Redis) *Application {\n\treturn &Application{\n\t\tConfig: cfg,\n\t\tStorage: s,\n\t\tRateLimit: r,\n\t\tRedis: redis,\n\t}\n}", "title": "" }, { "docid": "f79b2bc3bfdacd494c15b3fb955c5e59", "score": "0.48020414", "text": "func Apps(exec boil.Executor, mods ...qm.QueryMod) appQuery {\n\tmods = append(mods, qm.From(\"`app`\"))\n\treturn appQuery{NewQuery(exec, mods...)}\n}", "title": "" }, { "docid": "19d91803db5d1138b52edd8d38c98062", "score": "0.4782051", "text": "func NewApp() App {\n\tsignalChan := make(chan os.Signal, maxConcurrentAbortSignals)\n\treturn &app{\n\t\tlogger: logging.NewLogger(),\n\t\tpgWhistleBlower: whistleblowers.NewPostgresConfig(signalChan),\n\t\tpublisher: publisher.New(signalChan, \"file\"),\n\t\tsignalChan: signalChan,\n\t\tstopping: false,\n\t\tstopMux: sync.Mutex{},\n\t}\n}", "title": "" }, { "docid": "3e76a2a580a5f4161643edbb3c3d75d6", "score": "0.4777789", "text": "func (w *Samurai) NewApp(ctx context.Context, app models.App) (int, error) {\n\treturn w.db.Insert(ctx, db.App{\n\t\tBundle: app.Bundle,\n\t\tCategory: app.Categories,\n\t\tDeveloperId: app.DeveloperId,\n\t\tDeveloper: app.Developer,\n\t\tGeo: w.Config.Lang,\n\t\tStartAt: time.Now(),\n\t\tPeriod: uint32(w.Config.Period),\n\t})\n}", "title": "" }, { "docid": "620ee7a8cbc77ab9a57bb54499b8b43b", "score": "0.47696158", "text": "func NewApplication(t testing.TB, flags ...string) (*TestApplication, func()) {\n\tt.Helper()\n\n\tc, cfgCleanup := NewConfig(t)\n\n\tapp, cleanup := NewApplicationWithConfig(t, c, flags...)\n\tkst := new(mocks.KeyStoreInterface)\n\tkst.On(\"Accounts\").Return([]accounts.Account{})\n\tapp.Store.KeyStore = kst\n\n\treturn app, func() {\n\t\tcleanup()\n\t\tcfgCleanup()\n\t}\n}", "title": "" }, { "docid": "230f137cd23e435c15a4c1fae274ff6d", "score": "0.47549492", "text": "func New() App {\n\tcfg := config.New()\n\treturn App{cfg}\n}", "title": "" }, { "docid": "1e2b2deac500acdf11e47aac203c8d40", "score": "0.47351822", "text": "func NewApp(dbID int64, id, store, region, ver string) *App {\n\treturn &App{DBID: dbID, ID: id, Store: store, Region: region, Ver: ver}\n}", "title": "" }, { "docid": "14bff322dbd1ee93f6ec5b21ab283e2c", "score": "0.47294104", "text": "func NewApp() *App {\n\treturn &App{}\n}", "title": "" }, { "docid": "7805a64ab25ada18dd26cd4e2f130ab8", "score": "0.47186303", "text": "func NewApp(opts ...AppOption) (*App, error) {\r\n\tcfg := DefaultConfig()\r\n\tif err := cfg.Apply(opts); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tengine, err := newEngine(cfg)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tstate := app.NewState(engine)\r\n\r\n\tapp := &App{\r\n\t\tconfig: cfg,\r\n\t\tstate: state,\r\n\t}\r\n\treturn app, nil\r\n}", "title": "" }, { "docid": "cae818446065783c7b4d87a256793db8", "score": "0.47179747", "text": "func NewApplication() *Application {\r\n\treturn &Application{\r\n\t\tEnvVars: []string{},\r\n\t}\r\n}", "title": "" }, { "docid": "b39873e1af59ec6f18f219c1bda5e83d", "score": "0.47033116", "text": "func NewApplication(v Variable, as []Atom) Application {\n\treturn Application{v, as}\n}", "title": "" }, { "docid": "b5730091d388adbcd7141dfc90fc2cf4", "score": "0.4702392", "text": "func NewDeleteAppRequestWithoutParam() *DeleteAppRequest {\n\n return &DeleteAppRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/app/{clientId}\",\n Method: \"DELETE\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "a097c97d8804658a0bdb25344fc56326", "score": "0.46827582", "text": "func NewApplication(conf config.AppConfiguration) (*app.Application, error) {\n\twire.Build(providerSet)\n\treturn new(app.Application), nil\n}", "title": "" }, { "docid": "af4d8dd9059658cdd2a0349ddde93cf5", "score": "0.46824494", "text": "func (apps *AppsData) AppendNewAppInstances(req common.GenericRequester, appCycle string,\n\tdescription string, state appmanager.AppStateAfterDeployment) {\n\t// Iterate over Group IDs\n\tfor _, gid := range req.GetGroupIds() {\n\t\t// Create annotation map\n\t\ta := gcommon.MakeMap()\n\n\t\t// Create labels map\n\t\tl := gcommon.MakeMap()\n\n\t\tappName := req.GetName()\n\n\t\t// Add \"apphc.app.basename\" annotation - required for all instances deployed by controller\n\t\ta.Add(common.AppAnnotationBaseName, appName)\n\n\t\tvar truncAppName string\n\t\tif len(appName) > common.AppNameStringLength {\n\t\t\ttruncAppName = appName[0 : common.AppNameStringLength-1]\n\t\t} else {\n\t\t\ttruncAppName = appName\n\t\t}\n\n\t\tvar truncAppGroupId string\n\t\tif len(gid) > common.AppGroupIdLength {\n\t\t\ttruncAppGroupId = gid[common.AppGroupIdLength-1:]\n\t\t} else {\n\t\t\ttruncAppGroupId = gid\n\t\t}\n\n\t\tvar appInstanceId string\n\t\tvar kubeConvName string\n\n\t\tif req.GetRootGroupId() == \"\" {\n\t\t\t// Instance ID consists of the application name and GroupID\n\t\t\tappInstanceId = strings.Join([]string{appName, gid}, \"-\")\n\t\t\t//\n\t\t\tkubeConvName = strings.ToLower(strings.Join([]string{truncAppName, truncAppGroupId}, \"-\"))\n\t\t} else {\n\t\t\t// Instance ID consists of the application name, RoodGroupID and GroupID\n\t\t\tappInstanceId = strings.Join([]string{appName, req.GetRootGroupId(), gid}, \"-\")\n\t\t\t// Add annotation \"apphc.app.instance.root_group_id\"\n\t\t\ta.Add(common.AppInstanceAnnotationRootGroupId, req.GetRootGroupId())\n\t\t\t// Add label \"apphc.app.instance.root_group_id\"\n\t\t\tl.Add(common.AppLabelRootGroupId, req.GetRootGroupId())\n\t\t\t//\n\t\t\t// Root Group ID\n\t\t\trootGroupId := req.GetRootGroupId()\n\t\t\tif len(rootGroupId) > common.AppRootGroupIdLength {\n\t\t\t\trootGroupId = req.GetRootGroupId()[0 : common.AppRootGroupIdLength-1]\n\t\t\t}\n\t\t\t//\n\t\t\tkubeConvName = strings.ToLower(strings.Join([]string{truncAppName, rootGroupId, truncAppGroupId}, \"-\"))\n\t\t}\n\n\t\ta.Add(common.AppInstanceAnnotationId, appInstanceId)\n\n\t\tkubeConvName = strings.ToLower(strings.Replace(kubeConvName, \"_\", \"-\", -1))\n\n\t\tappInstance := &common.AppInstanceData{}\n\t\tappInstance.InstanceName = kubeConvName\n\t\tappInstance.TargetNamespace = strings.Replace(strings.ToLower(appName),\"_\",\"-\", -1)\n\t\tappInstance.State = state\n\t\tappInstance.TemplateAvailable = false\n\t\tappInstance.NextAction = common.AppInstanceDataNextActionCreate\n\t\tappInstance.InstanceStorageSize = -1\n\n\t\t// In case description is empty - set default\n\t\tif description == \"\" {\n\t\t\tappInstance.Description = fmt.Sprintf(\"Application %s, instance ID %s\", appName, appInstanceId)\n\t\t} else {\n\t\t\tappInstance.Description = description\n\t\t}\n\n\t\tappInstance.RequestedVersion = req.GetVersion()\n\n\t\t// Since the list consists of the new app instance,\n\t\t// Set it as not deployed\n\t\t// Add annotation \"apphc.app.cycle\"\n\t\ta.Add(common.AppAnnotationCycle, appCycle)\n\n\t\t// Add annotation \"apphc.app.instance.group_id\"\n\t\ta.Add(common.AppInstanceAnnotationGroupId, gid)\n\n\t\t// Add annotation \"apphc.app.instance.version\"\n\t\ta.Add(common.AppInstanceAnnotationVersion, appInstance.RequestedVersion)\n\n\t\t// Add annotation \"apphc.app.instance.id\n\t\ta.Add(common.AppInstanceAnnotationId, appInstanceId)\n\n\t\t// Add annotation \"apphc.app.instance.template_name\"\n\t\ta.Add(common.AppInstanceAnnotationTemplateName, kubeConvName)\n\n\t\t// Add annotations\n\t\tappInstance.Annotations = a\n\n\t\t// Add label \"apphc.app.cycle\"\n\t\tl.Add(common.AppLabelCycle, appCycle)\n\n\t\t// Add label \"apphc.app.instance.group_id\"\n\t\tl.Add(common.AppLabelGroupId, gid)\n\n\t\t// Add labels\n\t\tappInstance.Labels = l\n\n\t\t// Append the app\n\t\tapps.NewAppInstancesData = append(apps.NewAppInstancesData, appInstance)\n\t}\n}", "title": "" }, { "docid": "395899b2b1b8f6a731a8af4d07a7388a", "score": "0.4679726", "text": "func New(configDir string) (*Application, error) {\n\tgeneralConfig, err := config.NewGeneralConfig(configDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdbConfig, err := config.NewDBConfig(generalConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tapp := &Application{}\n\tapp.Hostname = hostname\n\tapp.GeneralConfig = generalConfig\n\tapp.DBConfig = dbConfig\n\tapp.cookieStore = sessions.NewCookieStore([]byte(app.GeneralConfig.CookieSecret))\n\tapp.Mailers = make(map[string]*mailer.Mailer)\n\tapp.HandlerInstruments = app.NewHandlerInstruments()\n\tapp.LatencyGauges = make(map[string]metrics.Gauge)\n\tapp.MetricsRegistry = app.NewMetricsRegistry(app.HandlerInstruments, app.LatencyGauges)\n\tapp.Peers = gocache.New(1*time.Minute, 10*time.Minute)\n\tapp.RefetchChecksChan = make(chan bool)\n\n\tif app.GeneralConfig.Email != nil {\n\t\tmailer, err := mailer.New(app.GeneralConfig.Email)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tapp.Mailers[\"GeneralConfig\"] = mailer\n\t}\n\n\tif app.GeneralConfig.Checks.Email != nil {\n\t\tmailer, err := mailer.New(app.GeneralConfig.Checks.Email)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tapp.Mailers[\"GeneralConfig.Checks\"] = mailer\n\t}\n\n\t// Setup loggers\n\tapp.OutLogger = logrus.New()\n\tapp.OutLogger.Out = os.Stdout\n\n\tapp.ErrLogger = logrus.New()\n\tapp.ErrLogger.Out = os.Stderr\n\n\treturn app, err\n}", "title": "" }, { "docid": "191f96dd6efa8f944d31ebae8d67c206", "score": "0.4675889", "text": "func NewApp() *App {\n\tapp := &App{}\n\tapp.SettingsService = NewSettingsService(app)\n\tapp.PrinterService = NewPrinterService(app)\n\tapp.RecentCommandsService = NewRecentCommandsService(app)\n\tapp.TrackedValuesService = NewTrackedValuesService(app)\n\tapp.DiscoveryService = NewDiscoveryService(app)\n\tapp.HeatingService = NewHeatingService(app)\n\tapp.ManualMovementService = NewManualMovementService(app)\n\tapp.HTTPService = NewHTTPService(app)\n\tapp.DBService = NewDBService(app)\n\tapp.StartupCommandService = NewStartupCommandService(app)\n\tapp.DataDirectoryService = NewDataDirectoryService(app)\n\tapp.GcodeFileMetaRepositoryService = NewGcodeFileMetaRepositoryService(app)\n\treturn app\n}", "title": "" }, { "docid": "88daa87bb17adddb0140e6157351709f", "score": "0.46742514", "text": "func MustNew(ctx context.Context, adminPort string) *App {\n\tapp, err := New(ctx, adminPort)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn app\n}", "title": "" }, { "docid": "7c816c947950163c96a6ccbc7d387db2", "score": "0.46693736", "text": "func NewApp(f interface{}, args Arguments, info *debug.Info) App {\n\treturn App{f, args, info}\n}", "title": "" }, { "docid": "da9d4978e18c3bf07fad058bb9bb36ff", "score": "0.46686023", "text": "func New(cfg *Config) *App {\n\treturn &App{cfg}\n}", "title": "" }, { "docid": "8ea925a37f91972fea40c02ed3833d5a", "score": "0.4667134", "text": "func (srv *WxmpServer) DiscoverApps(appPluginDir string) map[string]app.IApp {\n\tapps := make(map[string]app.IApp)\n\n\tappPlugins, err := ListAllPlugins(appPluginDir)\n\tif err != nil {\n\t\tlog.Printf(\"Error list app plugins under %s: %s\\n\", appPluginDir, err)\n\t\t//return empty list, but not nil\n\t\treturn apps\n\t}\n\n\tfor name, path := range appPlugins {\n\t\tlog.Println(\"Found App Plugin:\", path)\n\n\t\tplug, err := plugin.Open(path)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error open app plugin[%s]: %s\\n\", name, err.Error())\n\t\t\tcontinue\n\t\t}\n\n\t\tsymbol, err := plug.Lookup(app.EXPORT_SYMBOL_NAME)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error find export symbol \\\"%s\\\" for %s\\n\", app.EXPORT_SYMBOL_NAME, name)\n\t\t\tcontinue\n\t\t}\n\n\t\tapp, ok := symbol.(app.IApp)\n\t\tif !ok {\n\t\t\tlog.Printf(\"%s does not implement IApp interface\\n\", name)\n\t\t\tcontinue\n\t\t}\n\n\t\t//init app\n\t\tif err:= app.Init(srv.Name, filepath.Dir(path), srv.cmdArg.EtcdUrl, srv.cmdArg.RabbitmqUrl); err != nil {\n\t\t\tlog.Println(\"%s Error init: %s\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tapps[app.GetAppInfo().Uuid] = app\n\t}\n\n\treturn apps\n}", "title": "" }, { "docid": "576f8b5cd3837a71cf00e36b14ca85d8", "score": "0.4663082", "text": "func NewApp(name string) *App {\n\tapp := &App{\n\t\tName: name,\n\t\tCommand: &Command{\n\t\t\tAction: helpAction(1),\n\t\t},\n\t}\n\tapp.Command.helpTemplate = AppHelpTemplate\n\tapp.Command.helpTemplateData = app\n\n\tapp.Command.Flags.Var((*helpValue)(app.Command), \"h\", \"print help and exit\")\n\n\treturn app\n}", "title": "" }, { "docid": "9bd62f8e11599632dfb52d8f54a62f6b", "score": "0.46601766", "text": "func NewApp(cfg *AppConfig, t clicore.TTY, sigs clicore.SignalSource) *App {\n\tcoreApp := clicore.NewApp(t, sigs)\n\tapp := &App{\n\t\tcore: coreApp,\n\t\tcfg: cfg,\n\t}\n\tcoreApp.Config = coreConfig{app}\n\n\tapp.Insert = newInsertMode(app)\n\tapp.Listing = &listing.Mode{}\n\tapp.Histlist = newHistlist(app)\n\tapp.Lastcmd = newLastcmd(app)\n\tapp.Location = newLocation(app)\n\n\treturn app\n}", "title": "" }, { "docid": "116e877112869f55f9e7c393c578acf2", "score": "0.46570575", "text": "func newAppCRToUpdate(current, desired *v1alpha1.App, allowedAnnotations map[string]bool) *v1alpha1.App {\n\tif current.Namespace != desired.Namespace {\n\t\treturn nil\n\t}\n\tif current.Name != desired.Name {\n\t\treturn nil\n\t}\n\n\tmerged := current.DeepCopy()\n\n\tmerged.Annotations = desired.Annotations\n\n\tif allowedAnnotations != nil {\n\t\tfor k, v := range current.Annotations {\n\t\t\tif _, exist := desired.Annotations[k]; exist {\n\t\t\t\t// if annotation is already in desired spec, skip it.\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif _, ok := allowedAnnotations[k]; ok {\n\t\t\t\tmerged.Annotations[k] = v\n\t\t\t}\n\t\t}\n\t}\n\n\tmerged.Labels = desired.Labels\n\n\tmerged.Spec = desired.Spec\n\n\tif reflect.DeepEqual(current, merged) {\n\t\treturn nil\n\t}\n\n\treturn merged\n}", "title": "" }, { "docid": "59c33c1efd5c034d62475af061a592ac", "score": "0.46542558", "text": "func NewApp(app *kingpin.Application) *App {\n\tapp.HelpFlag.Short('h')\n\tapp.UsageTemplate(UsageTemplate)\n\tapp.UsageFuncs(template.FuncMap{\n\t\t\"alphabeticalSort\": func(data []*kingpin.FlagModel) []*kingpin.FlagModel {\n\t\t\tsort.Slice(data, func(i, j int) bool { return data[i].Name < data[j].Name })\n\t\t\treturn data\n\t\t},\n\t})\n\treturn &App{\n\t\tapp: app,\n\t\tFlagClause: app,\n\t\tsetups: map[string]SetupFunc{},\n\t}\n}", "title": "" }, { "docid": "32caaaa734c054ef018b24545fdbe936", "score": "0.4653269", "text": "func NewApp(version string, c *Config) *App {\n\ta := &App{Version: version, Configuration: c}\n\ta.Init()\n\treturn a\n}", "title": "" }, { "docid": "e2b722369059651f48e69154ca6332b6", "score": "0.464902", "text": "func (m *DefaultManagedAppProtection) SetApps(value []ManagedMobileAppable)() {\n err := m.GetBackingStore().Set(\"apps\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8eb03964aca32c561839d1a11481ee70", "score": "0.46473932", "text": "func NewApp(name string) *App {\n\treturn &App{\n\t\tName: name,\n\t\tcommands: make(map[string]CommandInfo),\n\t}\n}", "title": "" }, { "docid": "3e57bbacd1a759dde3af3546c26364e1", "score": "0.46433765", "text": "func NewApp(name, brief string) *App {\n\tvar app App\n\n\tapp.Cmd = newCmd()\n\tapp.Name = name\n\tapp.Brief = brief\n\n\treturn &app\n}", "title": "" }, { "docid": "53a0085514dc4933c8a547035a3a141c", "score": "0.46390492", "text": "func NewApplication(name, vendor, version string) *ApiApplication {\n\tif name == \"\" {\n\t\tname = \"TempApp\"\n\t}\n\tif vendor == \"\" {\n\t\tvendor = \"TempVendor\"\n\t}\n\tif version == \"\" {\n\t\tversion = \"v1.0.1\"\n\t}\n\treturn &ApiApplication{\n\t\tName: name,\n\t\tVendor: vendor,\n\t\tVersion: version,\n\t}\n}", "title": "" }, { "docid": "9547db7ddbd215e8a1d544f28bf4efc0", "score": "0.46374607", "text": "func NewApp(config *Config, options ...Option) (*App, error) {\n\ta := &App{\n\t\tconfig: DefaultConfig,\n\t\tlogger: zap.NewNop(),\n\t\tspew: &spew.ConfigState{Indent: \" \", ContinueOnMethod: true},\n\t}\n\n\tif config != nil {\n\t\ta.config = *config\n\t}\n\n\tif err := a.config.Verify(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif a.config.AESKey != \"\" {\n\t\tkey, err := base64.StdEncoding.DecodeString(a.config.AESKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ta.aesKey = key\n\t}\n\n\tfor _, o := range options {\n\t\to(a)\n\t}\n\n\tswitch len(a.aesKey) {\n\tcase 0:\n\t\treturn nil, errors.New(\"zero-length aes key\")\n\tcase 16, 24, 32:\n\t\t// Do nothing.\n\tdefault:\n\t\treturn nil, errors.New(\"AES key must be of length 16, 24, or 32\")\n\t}\n\n\ta.route()\n\n\treturn a, nil\n}", "title": "" }, { "docid": "1a7e3cf10891307ddfaaaeadd65570bc", "score": "0.46330032", "text": "func NewApp(id int, name, intro, url string) *App {\n\treturn &App{\n\t\tID: id,\n\t\tName: name,\n\t\tIntro: template.HTML(intro),\n\t\tURL: url,\n\t}\n}", "title": "" }, { "docid": "127637f8c96ba914c625ef8f50c39e38", "score": "0.46274552", "text": "func NewApplication(controllers ...interface{}) app.Application {\n\tlog.SetLevel(\"error\") // set debug level to error first\n\ta := new(application)\n\tapp.Register(a)\n\ta.startUpTime = time.Now()\n\t_ = a.initialize(controllers...)\n\treturn a\n}", "title": "" }, { "docid": "6d47ed5f7d966de4e433478e60b2c23a", "score": "0.46137047", "text": "func NewCreateAppUnauthorized() *CreateAppUnauthorized {\n\treturn &CreateAppUnauthorized{}\n}", "title": "" }, { "docid": "457a114eb2fe140443215c7adf78ed12", "score": "0.46132663", "text": "func NewGetAppsDefault(code int) *GetAppsDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetAppsDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "712cffedf08a9c341cf9681f4e6f1c95", "score": "0.46106207", "text": "func NewApp(defaultCommand interface{}) AppInterface {\n\tapp := &App{\n\t\tcommands: map[string]Command{\n\t\t\t\"version\": &VersionCommand{},\n\t\t},\n\t}\n\tapp.AddCommand(\"default\", defaultCommand)\n\treturn app\n}", "title": "" }, { "docid": "a9925c4360a2edeaf0cf3db7b4f764f5", "score": "0.46070457", "text": "func NewApp(logger logrus.FieldLogger, store store.Store, config Config, userService UserService) *App {\n\treturn &App{\n\t\tconfig: config,\n\t\tstore: store,\n\t\tuser: userService,\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "a29a30953096182046b17091cfa27459", "score": "0.46067864", "text": "func NewApp(cfg *config.Config) *App {\n\ta := App{\n\t\tApp: ui.NewApp(cfg, cfg.K9s.CurrentContext),\n\t\tcmdHistory: model.NewHistory(model.MaxHistory),\n\t\tfilterHistory: model.NewHistory(model.MaxHistory),\n\t\tContent: NewPageStack(),\n\t}\n\n\ta.Views()[\"statusIndicator\"] = ui.NewStatusIndicator(a.App, a.Styles)\n\ta.Views()[\"clusterInfo\"] = NewClusterInfo(&a)\n\n\treturn &a\n}", "title": "" }, { "docid": "e1d8765c1ad64cf60dab030629596b14", "score": "0.46059176", "text": "func NewApp(conf *Config) *common.BaseApp {\n\treturn common.NewApp(conf, discordPluginName)\n}", "title": "" }, { "docid": "20467f9b82c263ef7fb90108783af923", "score": "0.45995575", "text": "func NewApp(cfg *config.ConfigSpec) (*App) {\n\tapp := App{\n\t\tconfig: cfg,\n\t\tprocessedMainTemplate: false,\n\t\tbackends: make(map[string]backend.Backend),\n\t}\n\n\t// register telegraf reload handler\n\tapp.telegrafReloader = utils.NewTelegrafReloader()\n\tlogrus.Infof(\"created reloader: %+v\", app.telegrafReloader)\n\n\tapp.loadTemplates()\n\tapp.loadBackends()\n\n\treturn &app\n}", "title": "" }, { "docid": "920636b26722f83c2eb7ae66175d401c", "score": "0.45927635", "text": "func NewAppFake(apps []entity.App) AppFake {\n\treturn AppFake{\n\t\tapps: apps,\n\t}\n}", "title": "" }, { "docid": "95d119ca548ca1ddc9449b250154b7e2", "score": "0.45923117", "text": "func Empty() *App {\n\treturn &App{}\n}", "title": "" }, { "docid": "c3b1d266c9cec6bac1ae0e372f31917f", "score": "0.4587725", "text": "func NewApp(opts ...AppOptions) *App {\n\toptions := AppOptions{}\n\tfor _, i := range opts {\n\t\toptions = i\n\t\tbreak\n\t}\n\n\toptions.init()\n\n\t// Parse config yaml string from ./conf.go\n\t// conf, err := appConfig.GetRawConfig()\n\tc, err := config.ParseYaml(confString)\n\tMust(err)\n\n\tappconf, err := appConfig.GetRawConfig()\n\tMust(err)\n\n\tconf, err := c.Extend(appconf)\n\tMust(err)\n\n\t// Set config variables delivered from main.go:11\n\t// Variables defined as ./conf.go:3\n\tconf.Set(\"debug\", debug)\n\tconf.Set(\"commitHash\", commitHash)\n\n\t// Parse environ variables for defined\n\t// in config constants\n\tconf.Env()\n\n\tawsKey, err := conf.String(\"AWSAccessKeyID\")\n\tawsSecret, err := conf.String(\"AWSSecretKey\")\n\tawsToken, err := conf.String(\"AWSToken\")\n\tbucketRegion, err := conf.String(\"BucketRegion\")\n\t// bucket, err := conf.String(\"Bucket\")\n\timageBucket, err := conf.String(\"Bucket\")\n\tfileDB, err := conf.String(\"FileDB\")\n\n\tif err != nil {\n\t\tlog.Fatalf(\"App failed to start: %s\", err)\n\t}\n\n\tawsCfg := &upload.AWSConfig{\n\t\tAWSSecretKey: awsSecret,\n\t\tAWSToken: awsToken,\n\t\tAWSAccessKeyID: awsKey,\n\t\tBucketRegion: bucketRegion,\n\t}\n\n\tclient, err := upload.CreateClient(awsCfg, imageBucket, fileDB)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// move serviceworker getting into own file\n\tb, err := ioutil.ReadFile(\"server/data/static/sw.js\")\n\tMust(err)\n\n\t// terms of service\n\tterms, err := ioutil.ReadFile(\"tos.md\")\n\tMust(err)\n\n\t// privacy policy\n\tprivacy, err := ioutil.ReadFile(\"privacy-policy.md\")\n\tMust(err)\n\n\t// Make an engine\n\tengine := echo.New()\n\n\t// Use precompiled embedded templates\n\tengine.Renderer = NewTemplate()\n\n\t// Set up echo debug level\n\t//engine.Debug = conf.UBool(\"debug\")\n\tengine.Debug = true\n\n\t// Regular middlewares\n\tengine.Use(middleware.Recover())\n\n\tengine.GET(\"/favicon.ico\", func(c echo.Context) error {\n\t\treturn c.Redirect(http.StatusMovedPermanently, \"/static/images/favicon.png\")\n\t})\n\n\tengine.GET(\"/sw.js\", func(c echo.Context) error {\n\t\tc.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJavaScript)\n\t\tc.Response().WriteHeader(http.StatusOK)\n\t\t_, err = c.Response().Write(b)\n\t\treturn err\n\t})\n\n\tengine.GET(\"/terms.md\", func(c echo.Context) error {\n\t\tc.Response().Header().Set(echo.HeaderContentType, echo.MIMETextPlain)\n\t\tc.Response().WriteHeader(http.StatusOK)\n\t\t_, err = c.Response().Write(terms)\n\t\treturn err\n\t})\n\n\tengine.GET(\"/privacy-policy.md\", func(c echo.Context) error {\n\t\tc.Response().Header().Set(echo.HeaderContentType, echo.MIMETextPlain)\n\t\tc.Response().WriteHeader(http.StatusOK)\n\t\t_, err = c.Response().Write(privacy)\n\t\treturn err\n\t})\n\n\tengine.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{\n\t\tFormat: `${method} | ${status} | ${uri} -> ${latency_human}` + \"\\n\",\n\t}))\n\n\tengine.Use(middleware.GzipWithConfig(middleware.GzipConfig{\n\t\tSkipper: middleware.Skipper(func(c echo.Context) bool {\n\t\t\tif _, err = Asset(c.Request().URL.Path[1:]); err == nil {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t}),\n\t\tLevel: -1,\n\t}))\n\n\tengine.Use(middlewares.UploadMiddleware(client))\n\n\t// Initialize the application\n\tapp := &App{\n\t\tConf: conf,\n\t\tEngine: engine,\n\t\tAPI: &api.API{Conf: conf, HandlerFunc: &handlers.Handlers{Conf: conf, S3Client: client}},\n\t\tReact: map[string]*React{\n\t\t\t\"client\": NewReact(\n\t\t\t\tconf.UString(\"duktape.path\"),\n\t\t\t\tconf.UBool(\"debug\"),\n\t\t\t\tengine,\n\t\t\t),\n\t\t\t\"admin\": NewReact(\n\t\t\t\tconf.UString(\"duktape.adminpath\"),\n\t\t\t\tconf.UBool(\"debug\"),\n\t\t\t\tengine,\n\t\t\t),\n\t\t},\n\t}\n\n\t// Map app and uuid for every requests\n\tapp.Engine.Use(func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) error {\n\t\t\tc.Set(\"app\", app)\n\t\t\tid, _ := uuid.NewV4()\n\t\t\tc.Set(\"uuid\", id)\n\t\t\treturn next(c)\n\t\t}\n\t})\n\n\t// Bind api handling for URL api.prefix\n\tapp.API.Bind(\n\t\tapp.Engine.Group(\n\t\t\tapp.Conf.UString(\"api.prefix\"),\n\t\t),\n\t)\n\n\tfileServerHandler := gziphandler.GzipHandler(http.FileServer(&assetfs.AssetFS{\n\t\tAsset: Asset,\n\t\tAssetDir: AssetDir,\n\t\tAssetInfo: AssetInfo,\n\t}))\n\n\t// start application dispatcher\n\t// dispatcher is separated from echo context\n\tnumworkers := conf.UString(\"NumWorkers\")\n\tNWorkers, err := strconv.Atoi(numworkers)\n\tMust(err)\n\tqueue.StartDispatcher(NWorkers)\n\n\t// start crawler\n\t// if os.Getenv(\"TALENTSINAFRICA_LOCAL_DEV\") != \"true\" {\n\t// go crawler.Crawl()\n\t// }\n\n\t// start application websocket handler\n\tsockets.SocketHub.Run()\n\tengine.GET(\"/ws\", sockets.SocketHandler)\n\n\t// Serve static via bindata and handle via react app\n\t// in case when static file was not found\n\tapp.Engine.Use(func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) error {\n\t\t\tstripSubdomain := func(rawurl string) string {\n\t\t\t\tcfg, _ := appConfig.GetConfig()\n\t\t\t\tparsedOrigHost, _ := url.Parse(cfg.AppURL)\n\n\t\t\t\t// clean loopback address\n\t\t\t\t//replace with app domain\n\t\t\t\tif strings.Contains(rawurl, \"localhost\") {\n\t\t\t\t\trawurl = strings.Replace(rawurl, \"localhost\", parsedOrigHost.Host, -1)\n\t\t\t\t}\n\n\t\t\t\tif strings.Contains(rawurl, \"127.0.0.1\") {\n\t\t\t\t\trawurl = strings.Replace(rawurl, \"127.0.0.1\", parsedOrigHost.Host, -1)\n\t\t\t\t}\n\n\t\t\t\tentities := strings.Join(strings.Split(rawurl, parsedOrigHost.Host), \"\")\n\t\t\t\tentitiesArray := strings.Split(strings.Split(entities, \":\")[0], \".\")\n\t\t\t\tif len(entitiesArray) > 0 {\n\t\t\t\t\treturn entitiesArray[0]\n\t\t\t\t}\n\n\t\t\t\treturn \"\"\n\t\t\t}\n\n\t\t\tsubdomain := stripSubdomain(c.Request().Host)\n\n\t\t\t// execute echo handlers chain\n\t\t\terr := next(c)\n\t\t\t// if page(handler) for url/method not found\n\t\t\tif err != nil {\n\t\t\t\thttpErr, ok := err.(*echo.HTTPError)\n\t\t\t\tif ok && httpErr.Code == http.StatusNotFound {\n\t\t\t\t\t// check if file exists\n\t\t\t\t\t// omit first `/`\n\t\t\t\t\tif _, err := Asset(c.Request().URL.Path[1:]); err == nil {\n\t\t\t\t\t\tfileServerHandler.ServeHTTP(\n\t\t\t\t\t\t\tc.Response().Writer,\n\t\t\t\t\t\t\tc.Request(),\n\t\t\t\t\t\t)\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\n\t\t\t\t\tua := c.Request().Header.Get(\"User-Agent\")\n\t\t\t\t\tisMobile := CheckIsMobile(ua)\n\n\t\t\t\t\tif isMobile {\n\t\t\t\t\t\tif subdomain != \"admin\" {\n\t\t\t\t\t\t\treturn app.React[\"client\"].Handle(c, \"mobile.html\")\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// if subdomain is admin for mobile//dont handle\n\t\t\t\t\t}\n\n\t\t\t\t\t// if static file not found handle request via react application\n\t\t\t\t\tif subdomain == \"admin\" {\n\t\t\t\t\t\treturn app.React[\"admin\"].Handle(c, \"admin.html\")\n\t\t\t\t\t}\n\n\t\t\t\t\treturn app.React[\"client\"].Handle(c, \"react.html\")\n\t\t\t\t\t// return c.HTML(200, \"Site is currently unavailable\")\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Move further if err is not `Not Found`\n\t\t\treturn err\n\t\t}\n\t})\n\n\treturn app\n}", "title": "" }, { "docid": "9788299bf8ded9589cf5f114919ca923", "score": "0.4575351", "text": "func NewApp(seedData *config.SeedData, status AppStatus) *App {\n\treturn &App{seedData: seedData, status: status}\n}", "title": "" }, { "docid": "3e822d82f446742afa81fc9f186b2361", "score": "0.45665413", "text": "func NewAppFromFiles(cfg *AppConfig, in, out *os.File) *App {\n\treturn NewApp(cfg, clicore.NewTTY(in, out), clicore.NewSignalSource())\n}", "title": "" }, { "docid": "28fc3cdb3c772e9c8c438784bd1ced38", "score": "0.45660433", "text": "func (room *RoomBase) BroadcastExcluded(msgType MessageType, message proto.Message, excludedUser User) {\n\tfor user := range room.Users {\n\t\tif user != excludedUser {\n\t\t\tuser.SendMessage(msgType, message)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5d6bb6994a01fbaeb89905904f525c10", "score": "0.4559162", "text": "func NewAppAppsResponseIncluded() *AppAppsResponseIncluded {\n\tthis := AppAppsResponseIncluded{}\n\treturn &this\n}", "title": "" }, { "docid": "1e55c7643ba52bd6f811f93a8c1c217e", "score": "0.45535842", "text": "func NewApp(stateDir string) (application App, err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"failed constructing app: %w\", err)\n\t\t}\n\t}()\n\ta := &app{}\n\n\t// ensure our state directory exists\n\tif err := os.MkdirAll(stateDir, 0770); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Instantiate all of the services.\n\t// Settings must be initialized first, as other services rely on derived\n\t// values from it\n\tif a.SettingsService, err = newSettingsService(stateDir); err != nil {\n\t\treturn nil, err\n\t}\n\tif a.ArborService, err = newArborService(a.SettingsService); err != nil {\n\t\treturn nil, err\n\t}\n\tif a.NotificationService, err = newNotificationService(a.SettingsService, a.ArborService); err != nil {\n\t\treturn nil, err\n\t}\n\tif a.SproutService, err = newSproutService(a.ArborService); err != nil {\n\t\treturn nil, err\n\t}\n\tif a.ThemeService, err = newThemeService(); err != nil {\n\t\treturn nil, err\n\t}\n\tif a.StatusService, err = newStatusService(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Connect services together\n\tif addr := a.Settings().Address(); addr != \"\" {\n\t\ta.Sprout().ConnectTo(addr)\n\t}\n\ta.Notifications().Register(a.Arbor().Store())\n\ta.Status().Register(a.Arbor().Store())\n\n\treturn a, nil\n}", "title": "" }, { "docid": "9ec11465ad6f3b738275bfeac0ff38cf", "score": "0.45411608", "text": "func New(fns ...func(app *App)) *App {\n\treturn NewApp(fns...)\n}", "title": "" }, { "docid": "5466e461f10d3131a6b04bb8f9f1b9e4", "score": "0.4531188", "text": "func New(opts ...Option) *App {\n\tdefaultConfig := config.DefaultConfig()\n\tapp := &App{\n\t\tConfig: &defaultConfig,\n\t\tlog: appLog,\n\t\tloggers: make(map[string]*zap.AtomicLevel),\n\t\tstarted: make(chan struct{}),\n\t\teg: &errgroup.Group{},\n\t}\n\tfor _, opt := range opts {\n\t\topt(app)\n\t}\n\t// TODO(mafa): this is a hack to suppress debugging logs on 0000.defaultLogger\n\t// to fix this we should get rid of the global logger and pass app.log to all\n\t// components that need it\n\tlvl := zap.NewAtomicLevelAt(zap.InfoLevel)\n\tlog.SetupGlobal(app.log.SetLevel(&lvl))\n\n\ttypes.SetNetworkHRP(app.Config.NetworkHRP)\n\treturn app\n}", "title": "" }, { "docid": "69afc6b508d7d55a92cc911f41197987", "score": "0.45227855", "text": "func AppsG(mods ...qm.QueryMod) appQuery {\n\treturn Apps(boil.GetDB(), mods...)\n}", "title": "" }, { "docid": "af8ebe18367737d0d909ceec6040c165", "score": "0.4518798", "text": "func New(opts ...Option) *App {\n\tapp := &App{}\n\tapp.opts = options{\n\t\tquitCh: []os.Signal{syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT},\n\t\tStopTimeout: time.Second * 5,\n\t}\n\tfor _, opt := range opts {\n\t\topt(&app.opts)\n\t}\n\tif app.opts.cnf == nil {\n\t\tapp.opts.cnf = &conf.AppConfiguration{Configuration: conf.New().Load()}\n\t}\n\tif app.opts.cnf.IsSet(\"log\") {\n\t\tlog.NewBuiltIn()\n\t}\n\tapp.ctx, app.cancel = context.WithCancel(context.Background())\n\treturn app\n}", "title": "" }, { "docid": "fabf88aa4f3bc972f830871fb0c8a34e", "score": "0.45143908", "text": "func NewApp(cfg *Config) (*App, error) {\n\tevents := make(chan []string, eventsChanSize)\n\trecorder, err := file.NewEventRecorder(events, cfg.NewFileInterval)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"failed to create event recorder\")\n\t}\n\tcache, err := redis.NewRedis(cfg.RedisAddress, cfg.RedisPassword)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"failed to create redis client\")\n\t}\n\treturn &App{\n\t\tRouter: fasthttprouter.New(),\n\t\tevents: events,\n\t\tredis: cache,\n\t\trecorder: recorder,\n\t\twp: workerpool.New(cfg.MaxWorkers),\n\t}, nil\n}", "title": "" }, { "docid": "13e71b736176a7d92e256439014c0777", "score": "0.45096672", "text": "func NewApplication(\n\tsettings *helper.Settings,\n\tname string,\n\tappType string,\n\treadAccess string,\n\twriteAccess string,\n\tdescription string) *Application {\n\tif name == \"\" {\n\t\tname = \"live\"\n\t}\n\tif appType == \"\" {\n\t\tappType = \"Live\"\n\t}\n\tif readAccess == \"\" {\n\t\treadAccess = \"*\"\n\t}\n\tif writeAccess == \"\" {\n\t\twriteAccess = \"*\"\n\t}\n\tif description == \"\" {\n\t\tdescription = \"*\"\n\t}\n\n\ta := new(Application)\n\ta.init(settings)\n\ta.props[\"name\"] = name\n\ta.props[\"appType\"] = appType\n\ta.props[\"clientStreamReadAccess\"] = readAccess\n\ta.props[\"clientStreamWriteAccess\"] = writeAccess\n\ta.props[\"description\"] = description\n\ta.baseURI = a.host() + \"/servers/\" + a.serverInstance() + \"/vhosts/\" + a.vHostInstance() + \"/applications/\" + name\n\treturn a\n}", "title": "" }, { "docid": "9634f19a14c1f7caff93f9df299d16a3", "score": "0.45092338", "text": "func NewApp(config *Config, router *Router) *App {\n\treturn &App{\n\t\tconfig,\n\t\trouter,\n\t}\n}", "title": "" }, { "docid": "3f8ffeab4560e99060fcdab56cbe7436", "score": "0.45084405", "text": "func NewApp(logger *zap.Logger) *App {\n\treturn &App{\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "30ba40f873c626ef8395afcceaa6adea", "score": "0.45081392", "text": "func NewApp(config AppConfig) *App {\n\tlogger := newLogger(config.Name)\n\n\tif !validateAppName(config.Name) {\n\t\tlogger.Fatal().Msg(\"Invalid app name\")\n\t}\n\n\tapp := &App{\n\t\tconfig: config,\n\t\twg: &sync.WaitGroup{},\n\t\tlogger: logger,\n\t}\n\n\tif _, err := os.Stat(\".env\"); err == nil {\n\t\tif err := godotenv.Load(); err != nil {\n\t\t\tlogger.Fatal().Err(err).Msg(\"Error loading .env file\")\n\t\t}\n\t}\n\n\tif err := app.ReadConfig(&app.config); err != nil {\n\t\tlogger.Fatal().Err(err).Msg(\"Error reading core app configuration\")\n\t}\n\n\tapp.logger = loggerForEnv(logger, app.config.Env)\n\tapp.Metrics = NewMetrics(app.config.Prometheus)\n\n\tif app.config.Prometheus.Enabled {\n\t\tapp.AddPrometheus(app.config.Prometheus.Path, app.config.Prometheus.Port)\n\t}\n\n\treturn app\n}", "title": "" }, { "docid": "d887a497ebe754d33b63324ee2593b71", "score": "0.4506699", "text": "func conflateConfigs(original *AppConfig, overrides *AppConfig) *AppConfig {\n\tnewConf := new(AppConfig)\n\n\tif overrides.CommentToken != \"\" {\n\t\tnewConf.CommentToken = overrides.CommentToken\n\t} else {\n\t\tnewConf.CommentToken = original.CommentToken\n\t}\n\n\tif overrides.AlterExt != \"\" {\n\t\tnewConf.AlterExt = overrides.AlterExt\n\t} else {\n\t\tnewConf.AlterExt = original.AlterExt\n\t}\n\n\treturn newConf\n}", "title": "" }, { "docid": "74536d79a0c1d84f5cbbc20c5ab1ac44", "score": "0.45063648", "text": "func (t *Tracker) NewApp(app *xdg.Application, launchId string) {\n\tt.start(launchId)\n\tgo func() {\n\t\ttime.Sleep(5 * time.Second)\n\t\tt.stop()\n\t}()\n}", "title": "" } ]
22f159a89fe864ceb33c6e024b7612b6
Resume causes a previously paused enumeration to resume execution.
[ { "docid": "8490ba34326a597786dd42afb7b12749", "score": "0.84687716", "text": "func (e *Enumeration) Resume() {\n\te.resume <- struct{}{}\n}", "title": "" } ]
[ { "docid": "d21a38e011237c829a7e7155b4a9bb63", "score": "0.73320305", "text": "func (r *PauseReader) Resume() {\n\tif atomic.CompareAndSwapUint32(&r.state, 0, 1) {\n\t\tr.wg.Done()\n\t}\n}", "title": "" }, { "docid": "0e4b0b9745c1522adc797809aae11fdd", "score": "0.72905606", "text": "func (pc *Periodic) Resume() {\n\tpc.mu.Lock()\n\tpc.paused = false\n\tpc.mu.Unlock()\n}", "title": "" }, { "docid": "f30b5789863b29e235cb3f1f93456347", "score": "0.72705495", "text": "func (s *SuspendableTicker) Resume() {\n\tatomic.StoreInt64(&s.suspended, 0)\n}", "title": "" }, { "docid": "cc6ecbce5f0e8e3718f2cb26200e45a5", "score": "0.7233471", "text": "func (d *Debugger) Resume() {\n\td.resume <- true\n}", "title": "" }, { "docid": "b6f03095951b14c1aff3c2786aa44102", "score": "0.7220649", "text": "func (p *peer) Resume() {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tp.paused = false\n\tp.msgAppReader.resume()\n\tp.msgAppV2Reader.resume()\n}", "title": "" }, { "docid": "b8898dfa24f18d22a713db7a4220b4d6", "score": "0.70367", "text": "func (container *container) Resume() error {\n\treturn convertSystemError(container.system.Resume(context.Background()), container)\n}", "title": "" }, { "docid": "0457e815489603340703c40ec03dc678", "score": "0.7025458", "text": "func (cd * CD) Resume() {\n if cd.cd != nil {\n CDResume(cd.cd)\n }\n}", "title": "" }, { "docid": "fcd5c182f4f5884ecbe6260f3d96d682", "score": "0.6989194", "text": "func (s *Source) Resume() {\n\tif s.isValid() && s.paused {\n\t\tpool.mutex.Lock()\n\t\tdefer pool.mutex.Unlock()\n\t\tal.PlaySources(s.source)\n\t\ts.paused = false\n\t}\n}", "title": "" }, { "docid": "f26f38dc776b1d96a6db017b6fc79796", "score": "0.69693524", "text": "func (r *Run) Resume(m *Model) error {\n\tlog.Printf(\"Resuming run (%d) freq_id: %d.\", r.Id, r.FreqId)\n\tr.ignoreErrors = true\n\tr.EndTime = nil\n\tr.Error = nil\n\tif err := m.UpdateRun(r); err != nil {\n\t\treturn err\n\t}\n\tgo monitorRun(r, m)\n\treturn nil\n}", "title": "" }, { "docid": "73d0aa2519ef1aa2b748abf31179893b", "score": "0.68844557", "text": "func (r *Runner) Resume(id bson.ObjectId) (err error) {\n\tt, err := r.load(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !t.done() {\n\t\tdebugf(\"Resuming %s from %q\", t, t.State)\n\t\tif err := flush(r, t); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif t.State == taborted {\n\t\treturn ErrAborted\n\t} else if t.State != tapplied {\n\t\tpanic(fmt.Errorf(\"invalid state for %s after flush: %q\", t, t.State))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f4a27c3b73c85a879aee3d707efc4cb", "score": "0.6863482", "text": "func (p *Plugin) Resume() {\n\tp.Dispatch(plugStateChanged, 0, 1, nil, 0)\n}", "title": "" }, { "docid": "a323d508392879a2f382cc02fbf4955b", "score": "0.68508023", "text": "func (r *TransferOperationsService) Resume(name string, resumetransferoperationrequest *ResumeTransferOperationRequest) *TransferOperationsResumeCall {\n\tc := &TransferOperationsResumeCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\tc.resumetransferoperationrequest = resumetransferoperationrequest\n\treturn c\n}", "title": "" }, { "docid": "bf2a0b0940a50ca3816957a55c0ac5b1", "score": "0.6809685", "text": "func Resume() {\n\tscriptAsyncExec(\"resume\")\n}", "title": "" }, { "docid": "9abbfc82be34919611e71e056218ce24", "score": "0.6761159", "text": "func (e *RealLeaderElectionManager) Resume() error {\n\terrorChan := make(chan error)\n\te.commandChannel <- &leaderElectionManagerResume{errorChan: errorChan}\n\treturn <-errorChan\n}", "title": "" }, { "docid": "52f88ed8ccd255574e197f415a956d99", "score": "0.6732578", "text": "func ResumeProgress() {\n\tif tracker != nil {\n\t\ttracker.Resume()\n\t}\n}", "title": "" }, { "docid": "d71019a29b43bc5a2bd5930295b26a35", "score": "0.67174035", "text": "func (s *Server) Resume() {\n\tif !s.Paused {\n\t\treturn\n\t}\n\tif err := s.Cmd.Process.Signal(syscall.SIGCONT); err != nil {\n\t\tpanic(err)\n\t}\n\ts.Paused = false\n}", "title": "" }, { "docid": "d71019a29b43bc5a2bd5930295b26a35", "score": "0.67174035", "text": "func (s *Server) Resume() {\n\tif !s.Paused {\n\t\treturn\n\t}\n\tif err := s.Cmd.Process.Signal(syscall.SIGCONT); err != nil {\n\t\tpanic(err)\n\t}\n\ts.Paused = false\n}", "title": "" }, { "docid": "07a4fd1c959e2ddcef261ab80d926c0c", "score": "0.67116636", "text": "func (p *Pipe) Resume() chan error {\n\tresumeEvent := eventMessage{\n\t\tevent: resume,\n\t\ttarget: target{\n\t\t\tstate: ready,\n\t\t\terrc: make(chan error, 1),\n\t\t},\n\t}\n\tp.events <- resumeEvent\n\treturn resumeEvent.target.errc\n}", "title": "" }, { "docid": "72ebaeeb0d9ce10df8511d8b60db73b0", "score": "0.66833913", "text": "func (a *Aria2) Resume(gid string) bool {\n\treturn bool(C.resume(a.hexToGid(gid)))\n}", "title": "" }, { "docid": "410a255b23f0e7a5facda80e810c9414", "score": "0.6637204", "text": "func Resume(listener func(*vecty.Event)) *vecty.EventListener {\n\treturn &vecty.EventListener{Name: \"resume\", Listener: listener}\n}", "title": "" }, { "docid": "2e8df1f9940ba61aad8d28abcaf4e4a5", "score": "0.663601", "text": "func Resume(channel int) {\n\t_channel := (C.int)(channel)\n\tC.Mix_Resume(_channel)\n}", "title": "" }, { "docid": "c887806e3f117f863e25c6a9b68e9b9c", "score": "0.658967", "text": "func (s *Server) Resume(username, name string) string {\n\tindex := s.sessionIndex(name)\n\tif index == -1 {\n\t\treturn session.NoSession(name)\n\t}\n\tcurrent := s.sessions[index]\n\tif !current.Authorize(username) {\n\t\treturn user.NotAuthorized(username)\n\t}\n\tif current.IsRunning {\n\t\treturn \"session \" + name + \" is already running\"\n\t}\n\tcurrent.Run()\n\n\treturn \"successfully resumed session \" + name\n}", "title": "" }, { "docid": "d020eda6128d42fd74c77d414cf8e432", "score": "0.65814316", "text": "func (s *service) Resume(ctx context.Context, symID, sgName, rdfGrpNo string, pmaxClient pmax.Pmax) error {\n\tinDesiredState, err := validateRDFState(ctx, symID, Resume, sgName, rdfGrpNo, pmaxClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !inDesiredState {\n\t\terr := pmaxClient.ExecuteReplicationActionOnSG(ctx, symID, Resume, sgName, rdfGrpNo, false, true, false)\n\t\tif err != nil {\n\t\t\tlog.Error(fmt.Sprintf(\"Resume: Failed to modify SG (%s) - Error (%s)\", sgName, err.Error()))\n\t\t\treturn status.Errorf(codes.Internal, \"Resume: Failed to modify SG (%s) - Error (%s)\", sgName, err.Error())\n\t\t}\n\t\tlog.Debugf(\"Action (%s) successful on SG(%s)\", Resume, sgName)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d020eda6128d42fd74c77d414cf8e432", "score": "0.65814316", "text": "func (s *service) Resume(ctx context.Context, symID, sgName, rdfGrpNo string, pmaxClient pmax.Pmax) error {\n\tinDesiredState, err := validateRDFState(ctx, symID, Resume, sgName, rdfGrpNo, pmaxClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !inDesiredState {\n\t\terr := pmaxClient.ExecuteReplicationActionOnSG(ctx, symID, Resume, sgName, rdfGrpNo, false, true, false)\n\t\tif err != nil {\n\t\t\tlog.Error(fmt.Sprintf(\"Resume: Failed to modify SG (%s) - Error (%s)\", sgName, err.Error()))\n\t\t\treturn status.Errorf(codes.Internal, \"Resume: Failed to modify SG (%s) - Error (%s)\", sgName, err.Error())\n\t\t}\n\t\tlog.Debugf(\"Action (%s) successful on SG(%s)\", Resume, sgName)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "982c13b2ae2d9a47097a6973596f1f72", "score": "0.655619", "text": "func (c *Client) Resume(ctx context.Context, p *ResumePayload) (res *ResumeResult, err error) {\n\tvar ires interface{}\n\tires, err = c.ResumeEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*ResumeResult), nil\n}", "title": "" }, { "docid": "12d6fb6e555a3fb76d12a40270d01bd8", "score": "0.65546346", "text": "func (eb *Bus) Resume() {\n\teb.Ticker.Reset(timing.FPSToFrameDelay(eb.framerate))\n}", "title": "" }, { "docid": "51a869ab23e806b0ae59834cef65c76f", "score": "0.6537051", "text": "func (s *Summarizer) Resume() {\n\t// generate and print the complete header\n\t// s.Label = s.Label\n\n\t// turn the ticker back on\n\ts.shutdown = false\n\tgo s.run()\n}", "title": "" }, { "docid": "5a3e6a1429e807d3579cfb1fb189b9b1", "score": "0.652941", "text": "func (self *Timer) Resume() {\n self.Object.Call(\"resume\")\n}", "title": "" }, { "docid": "98b7e043a9c1cb1f5c51d2ed99cc99b4", "score": "0.64248693", "text": "func Resume(names ...string) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\n\tnow := time.Now()\n\tfor _, name := range names {\n\t\tt := timers[name]\n\t\tif t == nil {\n\t\t\tt = &timer{}\n\t\t\ttimers[name] = t\n\t\t}\n\t\tt.start = now\n\t}\n}", "title": "" }, { "docid": "842908c4d4d5dc6fa90b14014a1a0762", "score": "0.63444203", "text": "func (self *Timer) _resumeI(args ...interface{}) {\n self.Object.Call(\"_resume\", args)\n}", "title": "" }, { "docid": "7ff14c7d0afd1f5915c19f56ea1f31ec", "score": "0.63403314", "text": "func (s *PublishScheduler) Resume(orderingKey string) {\n\ts.keysMu.Lock()\n\tdefer s.keysMu.Unlock()\n\tdelete(s.keysWithErrors, orderingKey)\n}", "title": "" }, { "docid": "7ff14c7d0afd1f5915c19f56ea1f31ec", "score": "0.63403314", "text": "func (s *PublishScheduler) Resume(orderingKey string) {\n\ts.keysMu.Lock()\n\tdefer s.keysMu.Unlock()\n\tdelete(s.keysWithErrors, orderingKey)\n}", "title": "" }, { "docid": "ebc56ea6cd640521e174341c257f5429", "score": "0.6326133", "text": "func (l *VirtualMachineScaleSetVMsClientRestartPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetVMsClient.Restart\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetVMsClientRestartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "dd6ec306dfd92a81f29e0430ad167c05", "score": "0.6246469", "text": "func (self *Timer) ResumeI(args ...interface{}) {\n self.Object.Call(\"resume\", args)\n}", "title": "" }, { "docid": "5065666cebd0eb113c6c7345bce4db0d", "score": "0.6213582", "text": "func (l *VirtualMachineScaleSetVMsClientStartPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetVMsClient.Start\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetVMsClientStartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "53ef02005ede0d90f59d8a17c2283d76", "score": "0.62125856", "text": "func (l *VirtualMachinesRestartPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.Restart\", token, client.pl, client.restartHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesRestartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "bfb6f42f43ad787d0ad81bf69baadd1d", "score": "0.61899364", "text": "func (l *VirtualMachinesStartPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.Start\", token, client.pl, client.startHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesStartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "65c57b890f29ea25aa1ad679ec28b403", "score": "0.61558104", "text": "func (l *VirtualMachineSchedulesExecutePollerResponse) Resume(ctx context.Context, client *VirtualMachineSchedulesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineSchedulesClient.Execute\", token, client.pl, client.executeHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineSchedulesExecutePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "829dc45da675f934d9e007b9bc6447b4", "score": "0.6151069", "text": "func (l *GlobalSchedulesExecutePollerResponse) Resume(ctx context.Context, client *GlobalSchedulesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"GlobalSchedulesClient.Execute\", token, client.pl, client.executeHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &GlobalSchedulesExecutePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ba4cf894f19e9435f304a8afd446df58", "score": "0.61469764", "text": "func (l *VirtualMachinesClientRestartPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.Restart\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesClientRestartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "37097dd80a5de3f523039aa241094fdf", "score": "0.6139368", "text": "func (l *VirtualMachinesStopPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.Stop\", token, client.pl, client.stopHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesStopPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "b078cef1991004e2def99f4ccf7506f5", "score": "0.6086661", "text": "func (l *VirtualMachineScaleSetVMsClientRunCommandPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetVMsClient.RunCommand\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetVMsClientRunCommandPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "2b7609c07fb75e93c7e2d72bc9390f43", "score": "0.6069064", "text": "func (l *VirtualMachinesClientStartPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.Start\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesClientStartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "33802fc5c5606f5be663e7cc5466ae7c", "score": "0.60500085", "text": "func (l *VirtualMachinesClientRunCommandPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.RunCommand\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesClientRunCommandPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "b2762ff242b5e33e243bf382b72f3cf6", "score": "0.6047969", "text": "func (l *LabsImportVirtualMachinePollerResponse) Resume(ctx context.Context, client *LabsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"LabsClient.ImportVirtualMachine\", token, client.pl, client.importVirtualMachineHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &LabsImportVirtualMachinePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "a76adc8c6ecf96dfd87885b8aba5557d", "score": "0.60424525", "text": "func (l *SchedulesExecutePollerResponse) Resume(ctx context.Context, client *SchedulesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"SchedulesClient.Execute\", token, client.pl, client.executeHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &SchedulesExecutePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "f61556a2f3074159bc8e3f6a3baeb8d5", "score": "0.6041692", "text": "func (l *VirtualMachineScaleSetsClientRestartPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetsClient.Restart\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetsClientRestartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "37f9a9a3fb23c24c93c90dfd8d0f1a1b", "score": "0.60308224", "text": "func (it *IntervalTimer) ResumeTimer() {\n\tit.timer.Resume()\n}", "title": "" }, { "docid": "6c2681a21b05f2ac833a9f3a31bcab99", "score": "0.60298854", "text": "func (h *RealLeaderHeartbeatController) Resume() error {\n\terrorChannel := make(chan error)\n\th.commandChannel <- &heartbeatControllerResume{errorChannel: errorChannel}\n\treturn <-errorChannel\n}", "title": "" }, { "docid": "8c1e20bf6bbbe9ea2af21aa093b5c2fa", "score": "0.60298645", "text": "func (t *TimerOperations) ResumeTimer() {\n\tt.timer.Resume()\n}", "title": "" }, { "docid": "c8dd931e4dab18bb9906a02bf037166c", "score": "0.6013712", "text": "func (l *GlobalSchedulesRetargetPollerResponse) Resume(ctx context.Context, client *GlobalSchedulesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"GlobalSchedulesClient.Retarget\", token, client.pl, client.retargetHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &GlobalSchedulesRetargetPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "c1c93c11fe0e7196d8cd483e38b9fa13", "score": "0.59911156", "text": "func Resume(args common.Command) {\n\tvalidateDeploymentArgs(args)\n\n\tapp := args.SecondPos\n\tenv := args.ThirdPos\n\n\tresumeUrl := fmt.Sprintf(exploudUrl(\"/applications/%s/%s/resume\"), app, env)\n\n\tfmt.Printf(\"Attempting to resume deployment of %s in %s\\n\", app, env)\n\n\tcommon.PostJson(resumeUrl, \"\")\n}", "title": "" }, { "docid": "16ddc019995344dfc905f523f39cd0d0", "score": "0.59895694", "text": "func (l *ExperimentsClientCancelPollerResponse) Resume(ctx context.Context, client *ExperimentsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ExperimentsClient.Cancel\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ExperimentsClientCancelPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "da190e450ff922ecfa7da9b10fd74962", "score": "0.5980781", "text": "func (l *VirtualMachinesTransferDisksPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.TransferDisks\", token, client.pl, client.transferDisksHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesTransferDisksPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "eef913bc50670f6c2171cb8752abcf4a", "score": "0.5977405", "text": "func (l *VirtualMachineScaleSetRollingUpgradesClientCancelPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetRollingUpgradesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetRollingUpgradesClient.Cancel\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetRollingUpgradesClientCancelPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "941fc5f37e596164ac6b4f8970f05f8b", "score": "0.59771454", "text": "func (self *Timer) _resume() {\n self.Object.Call(\"_resume\")\n}", "title": "" }, { "docid": "fa919c6260a25cea685079f83ce71512", "score": "0.5970497", "text": "func (l *VirtualMachineScaleSetVMsClientPowerOffPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetVMsClient.PowerOff\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetVMsClientPowerOffPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "c9b9d9d94fdee98dced60a09f552df6b", "score": "0.5939575", "text": "func (l *VirtualMachinesClientCapturePollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.Capture\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesClientCapturePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "f038f43f2434acdaca32950b3bc73bb0", "score": "0.5937283", "text": "func (client *XenClient) VMResume(vm string, start_paused bool, force bool) (err error) {\n\t_, err = client.APICall(\"VM.resume\", vm, start_paused, force)\n\tif err != nil {\n\t\treturn\n\t}\n\t// no return result\n\treturn\n}", "title": "" }, { "docid": "275508cf11ca809fef3d5c54d542ef6d", "score": "0.59351474", "text": "func (l *CloudServiceRoleInstancesClientRestartPollerResponse) Resume(ctx context.Context, client *CloudServiceRoleInstancesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"CloudServiceRoleInstancesClient.Restart\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &CloudServiceRoleInstancesClientRestartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "b5e0baa8c12494e2884a9ec8e69aa64e", "score": "0.5928451", "text": "func (l *ReplicationProtectedItemsClientFailoverCancelPollerResponse) Resume(ctx context.Context, client *ReplicationProtectedItemsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ReplicationProtectedItemsClient.FailoverCancel\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ReplicationProtectedItemsClientFailoverCancelPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "dbd8afc19664e22c397e8be4f717cf54", "score": "0.5907908", "text": "func (l *APIManagementServiceRestorePollerResponse) Resume(ctx context.Context, client *APIManagementServiceClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"APIManagementServiceClient.Restore\", token, client.pl, client.restoreHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &APIManagementServiceRestorePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "7268765c139e9ea763d63b8c4cb21dde", "score": "0.58937323", "text": "func (l *VirtualMachinesApplyArtifactsPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.ApplyArtifacts\", token, client.pl, client.applyArtifactsHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesApplyArtifactsPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "7ce0b127ddeaf191a30edd78f7dbacab", "score": "0.58827126", "text": "func (l *VirtualMachinesClientReapplyPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.Reapply\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesClientReapplyPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "afb9fb6cfcbb184bd43d380dbee59627", "score": "0.5874972", "text": "func (l *ReplicationMigrationItemsClientResyncPollerResponse) Resume(ctx context.Context, client *ReplicationMigrationItemsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ReplicationMigrationItemsClient.Resync\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ReplicationMigrationItemsClientResyncPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "d86f02a182ce2d0ab1e73024d7579eab", "score": "0.5864891", "text": "func (l *ServiceFabricSchedulesExecutePollerResponse) Resume(ctx context.Context, client *ServiceFabricSchedulesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ServiceFabricSchedulesClient.Execute\", token, client.pl, client.executeHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ServiceFabricSchedulesExecutePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "628a6968face05a6ce1e89ddbe50b059", "score": "0.58621436", "text": "func (l *ReplicationProtectedItemsClientUnplannedFailoverPollerResponse) Resume(ctx context.Context, client *ReplicationProtectedItemsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ReplicationProtectedItemsClient.UnplannedFailover\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ReplicationProtectedItemsClientUnplannedFailoverPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "49b9482a8cba24dec79b4b82d5e27945", "score": "0.5859724", "text": "func (l *VirtualMachineScaleSetVMsClientReimagePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetVMsClient.Reimage\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetVMsClientReimagePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "fcd65cc6bba3838267ba8a156ddc8647", "score": "0.585946", "text": "func (l *VirtualMachineScaleSetVMsClientUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetVMsClient.Update\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetVMsClientUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ab3f565b8ed22d77eb20dc0783afa3b7", "score": "0.5858909", "text": "func (l *CloudServicesClientRestartPollerResponse) Resume(ctx context.Context, client *CloudServicesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"CloudServicesClient.Restart\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &CloudServicesClientRestartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "a35b40f77dc6690bf246ea68342801cb", "score": "0.58586115", "text": "func (l *ReplicationRecoveryPlansClientFailoverCancelPollerResponse) Resume(ctx context.Context, client *ReplicationRecoveryPlansClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ReplicationRecoveryPlansClient.FailoverCancel\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ReplicationRecoveryPlansClientFailoverCancelPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "af68fa08bedd238770d652e6d593e95b", "score": "0.58579844", "text": "func (l *VirtualMachinesClaimPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.Claim\", token, client.pl, client.claimHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesClaimPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "d2f79b97639abb088625da9ff5feb613", "score": "0.5852842", "text": "func (e *Enumeration) Pause() {\n\te.pause <- struct{}{}\n}", "title": "" }, { "docid": "97289eac86b83b2a8a035a811adfa51a", "score": "0.58422357", "text": "func (l *VirtualMachineScaleSetsClientStartPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetsClient.Start\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetsClientStartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "537ce64988036f09d20e857ca06d17a6", "score": "0.5825935", "text": "func (l *ReplicationJobsClientResumePollerResponse) Resume(ctx context.Context, client *ReplicationJobsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ReplicationJobsClient.Resume\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ReplicationJobsClientResumePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "80630a4d86be2f704a7cb9f21245b31c", "score": "0.58036405", "text": "func (me *XElemResumeSession) Walk() (err error) {\n\tif fn := WalkHandlers.XElemResumeSession; 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 err = me.ResumeSession.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\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": "48b8c405bf80a444160ab4dfa704959e", "score": "0.5788674", "text": "func (l *ReplicationProtectedItemsClientPlannedFailoverPollerResponse) Resume(ctx context.Context, client *ReplicationProtectedItemsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ReplicationProtectedItemsClient.PlannedFailover\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ReplicationProtectedItemsClientPlannedFailoverPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "e4220db8b3b8fa1dfc1c953fd2bf751f", "score": "0.5780153", "text": "func (l *ReplicationJobsClientRestartPollerResponse) Resume(ctx context.Context, client *ReplicationJobsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ReplicationJobsClient.Restart\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ReplicationJobsClientRestartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "16e023613476a36c6d81a432c4bd4168", "score": "0.5772929", "text": "func (l *VirtualMachinesUnClaimPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.UnClaim\", token, client.pl, client.unClaimHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesUnClaimPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ac3427180c005c3a28bcbe3808aa023d", "score": "0.5772509", "text": "func (l *ReplicationRecoveryPlansClientUnplannedFailoverPollerResponse) Resume(ctx context.Context, client *ReplicationRecoveryPlansClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ReplicationRecoveryPlansClient.UnplannedFailover\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ReplicationRecoveryPlansClientUnplannedFailoverPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ccf49b59f75048c8aabeaa7bc92b8e73", "score": "0.57689434", "text": "func (l *ServiceFabricsStartPollerResponse) Resume(ctx context.Context, client *ServiceFabricsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ServiceFabricsClient.Start\", token, client.pl, client.startHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ServiceFabricsStartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "128b914565a0d5b899d297dc154c424f", "score": "0.57661", "text": "func (l *VirtualMachineScaleSetRollingUpgradesClientStartExtensionUpgradePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetRollingUpgradesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetRollingUpgradesClient.StartExtensionUpgrade\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetRollingUpgradesClientStartExtensionUpgradePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "4d9d51c8ff5a841aa45f9a0421c5272e", "score": "0.5765479", "text": "func (l *APIManagementClientPerformConnectivityCheckAsyncPollerResponse) Resume(ctx context.Context, client *APIManagementClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"APIManagementClient.PerformConnectivityCheckAsync\", token, client.pl, client.performConnectivityCheckAsyncHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &APIManagementClientPerformConnectivityCheckAsyncPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "77aeeb7ae2c8a3cac0de8f3cbb774e4f", "score": "0.5765345", "text": "func (l *VirtualMachinesClientPowerOffPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.PowerOff\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesClientPowerOffPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "b7dde1e0416965a2ed5b45388427c8f3", "score": "0.576445", "text": "func Resumes(exec boil.Executor, mods ...qm.QueryMod) resumeQuery {\n\tmods = append(mods, qm.From(\"\\\"resume\\\"\"))\n\treturn resumeQuery{NewQuery(exec, mods...)}\n}", "title": "" }, { "docid": "2dffb55114c4aa18c04608ca44b2edf3", "score": "0.57630384", "text": "func (l *VirtualMachineImageTemplatesClientRunPollerResponse) Resume(ctx context.Context, client *VirtualMachineImageTemplatesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineImageTemplatesClient.Run\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineImageTemplatesClientRunPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "225ea75124507d054f94d98132e208b1", "score": "0.5760981", "text": "func (l *LabsClaimAnyVMPollerResponse) Resume(ctx context.Context, client *LabsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"LabsClient.ClaimAnyVM\", token, client.pl, client.claimAnyVMHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &LabsClaimAnyVMPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "bf82959ca30dd2777c852625c0f9c921", "score": "0.57608646", "text": "func ResumeDownload(d string) {\n\tif dwnld, ok := downloadsList[d]; ok && dwnld.status == stop {\n\t\terr := dwnld.download()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\treturn\n\t}\n\tlog.Println(\"Not found download: \" + d)\n}", "title": "" }, { "docid": "b557901aa13af98d4ddfff5fa072048b", "score": "0.5756916", "text": "func (l *ReplicationProtectedItemsClientTestFailoverPollerResponse) Resume(ctx context.Context, client *ReplicationProtectedItemsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ReplicationProtectedItemsClient.TestFailover\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ReplicationProtectedItemsClientTestFailoverPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "4f1afabe33c1e5627114795eb690d863", "score": "0.5752588", "text": "func ResumeMusic() {\n\tC.Mix_ResumeMusic()\n}", "title": "" }, { "docid": "a27f8c67a7cf479621fc6928629da849", "score": "0.5752245", "text": "func (o *GetSnapshotPendingParams) SetResume(resume *string) {\n\to.Resume = resume\n}", "title": "" }, { "docid": "9335420b1cfabfde9d5a538858de3e56", "score": "0.57514894", "text": "func (l *VirtualMachineScaleSetsClientSetOrchestrationServiceStatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetsClient.SetOrchestrationServiceState\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetsClientSetOrchestrationServiceStatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ef5c1943ea36176ee085ae1cb6d5c3a8", "score": "0.5740739", "text": "func (c *Client) resumeSubscriptions(ctx context.Context) {\n\tselect {\n\tcase <-ctx.Done():\n\tcase c.resumech <- struct{}{}:\n\t}\n}", "title": "" }, { "docid": "128708283608633a42958813ea115eba", "score": "0.57405484", "text": "func (l *CloudServicesClientStartPollerResponse) Resume(ctx context.Context, client *CloudServicesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"CloudServicesClient.Start\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &CloudServicesClientStartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "da12fabb6995393422597531496b3777", "score": "0.5732604", "text": "func (l *VirtualMachineScaleSetVMsClientReimageAllPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetVMsClient.ReimageAll\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetVMsClientReimageAllPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "617173807b2da2ccf37d1859dd3a58d4", "score": "0.5732165", "text": "func (lsd *layerServiceDecorator) Resume(uuid string) (storage.LayerUpload, error) {\n\tdelegate, err := lsd.LayerService.Resume(uuid)\n\treturn decorateLayerUpload(lsd.decorator, delegate), err\n}", "title": "" }, { "docid": "fe1058a8ff6bb1b0241ac699c1ff274d", "score": "0.5731061", "text": "func (l *VirtualMachinesClientUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.Update\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesClientUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "09f4aa3cc27e0e11cbccc1f3cb7044c4", "score": "0.57246965", "text": "func (l *VirtualMachineScaleSetsClientUpdateInstancesPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetsClient.UpdateInstances\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetsClientUpdateInstancesPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "f18e1cd3bbb8b7bed7eaeaa9af491423", "score": "0.57194996", "text": "func (l *ServiceFabricsStopPollerResponse) Resume(ctx context.Context, client *ServiceFabricsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ServiceFabricsClient.Stop\", token, client.pl, client.stopHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ServiceFabricsStopPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "56da7b958dea28e9bfd4e2adee232016", "score": "0.57168853", "text": "func (l *VirtualMachineScaleSetRollingUpgradesClientStartOSUpgradePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetRollingUpgradesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachineScaleSetRollingUpgradesClient.StartOSUpgrade\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachineScaleSetRollingUpgradesClientStartOSUpgradePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" } ]
d7b249e22d3f8c0b33407726a01d6220
Response returns the raw server response from the last page request.
[ { "docid": "f59af880f792d59c8a8c5d1fd9ed72d8", "score": "0.0", "text": "func (iter SQLPoolUsageListResultIterator) Response() SQLPoolUsageListResult {\n\treturn iter.page.Response()\n}", "title": "" } ]
[ { "docid": "45f931925c4746936a668931f418381a", "score": "0.6205644", "text": "func (r *Response) Response() *http.Response { return r.res }", "title": "" }, { "docid": "1587c78f5bdafc4774e1c216db3a8bc8", "score": "0.60790557", "text": "func (p *WebhooksClientListEventsPager) PageResponse() WebhooksClientListEventsResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "a7c9c8941292fe9bc607ce63108f28b3", "score": "0.603672", "text": "func (iter USQLViewListIterator) Response() USQLViewList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "aa1762da5449a22e76398a65a38908cb", "score": "0.6023524", "text": "func (iter EntityQueryTemplateListIterator) Response() EntityQueryTemplateList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "906a2f60109b15af64f0a10c90a96562", "score": "0.597541", "text": "func (iter EntityListIterator) Response() EntityList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "b370ab73d18c9f0825b0ea8d3e6260fe", "score": "0.5956878", "text": "func (iter ThreatIntelligenceInformationListIterator) Response() ThreatIntelligenceInformationList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "d091d77049ca4011eaad56d83e4a4618", "score": "0.59437835", "text": "func (page LiveOutputListResultPage) Response() LiveOutputListResult {\n\treturn page.lolr\n}", "title": "" }, { "docid": "f54f0ab1532664202efbf3aa40d181ad", "score": "0.593461", "text": "func (rec *RoundTripRecorder) Response(n int) *http.Response {\n\trec.mtx.Lock()\n\tdefer rec.mtx.Unlock()\n\treturn rec.resps[n]\n}", "title": "" }, { "docid": "a629947f4686825327bb14961cecabd6", "score": "0.5931306", "text": "func (iter OperationsListIterator) Response() OperationsList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "a629947f4686825327bb14961cecabd6", "score": "0.5931306", "text": "func (iter OperationsListIterator) Response() OperationsList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "e5eb81766945160a248c0a96259ba735", "score": "0.59151655", "text": "func (p *ClientListPager) PageResponse() ClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "932b45dbead30ee6df1ff8f70c952809", "score": "0.5901132", "text": "func (iter OrderListIterator) Response() OrderList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "10d092eec2ab359862d746721017b53c", "score": "0.5899854", "text": "func (b *common) Response() *http.Response {\n\treturn b.resp\n}", "title": "" }, { "docid": "6b46b7c0ca1cff4891b3448343fe2c1e", "score": "0.58960074", "text": "func (iter RepoListIterator) Response() RepoList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "724084b573e32f14fdf145977d65d750", "score": "0.5893969", "text": "func (iter EdgeGatewayPoolListIterator) Response() EdgeGatewayPoolList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "c75ebdde076a8e5910365591909e41c1", "score": "0.5886254", "text": "func (p *SnapshotsListPager) PageResponse() SnapshotsListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "18a8412270148e69569b78bd80c5724b", "score": "0.5884147", "text": "func (iter EdgeGatewayListIterator) Response() EdgeGatewayList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "43da6d9ed1d58e87b5d8706c1fc9c427", "score": "0.5883597", "text": "func (p *ReportsClientListByTimePager) PageResponse() ReportsClientListByTimeResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "13a37c9b707d2f47eac303ee8a65e079", "score": "0.58788764", "text": "func (o *Response) Raw() http.ResponseWriter {\n\treturn o.raw\n}", "title": "" }, { "docid": "21fd72f2b3d9a6429d27dc4de995ca8b", "score": "0.58567226", "text": "func (iter EntityQueryListIterator) Response() EntityQueryList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "453a8a4fb0345ea382328cae64fc73b9", "score": "0.58459306", "text": "func (iter LiveOutputListResultIterator) Response() LiveOutputListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "f60efa5ba812a696dffc29912e830af7", "score": "0.58457243", "text": "func Response(w http.ResponseWriter, r *http.Request, data interface{}, httpCode int) {\n\tjsonByte, err := json.Marshal(data)\n\tif err != nil {\n\t\tglog.Errorf(\"marshal [%v] failed with err [%v]\", data, err)\n\t}\n\t_, err = r.Cookie(\"WriteHeader\")\n\t// if no WriteHeader\n\tif err != nil {\n\t\tw.Header().Set(\"Pragma\", \"no-cache\")\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(httpCode)\n\t\tw.Write(jsonByte)\n\t}\n}", "title": "" }, { "docid": "12efa1df41c71cecd1fcaba0a922ad8d", "score": "0.584416", "text": "func (iter ApplicationSiteListAPIModelIterator) Response() ApplicationSiteListAPIModel {\n return iter.page.Response()\n }", "title": "" }, { "docid": "0a085b492ac6896f64c75fd59c3a8fa5", "score": "0.5841622", "text": "func (ep *Endpoint) Response(r *Request) (*Response, error) {\n\treturn &Response{\"requests count: \" + fmt.Sprint(ep.M.GetRequestsCount()), \"\"}, nil\n}", "title": "" }, { "docid": "9889750449be9f0f82fa1a9e5085f0f9", "score": "0.5839143", "text": "func (iter IPPoolListIterator) Response() IPPoolList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "a34f2c01e023998c4bda2e2754b01d7f", "score": "0.5816675", "text": "func (r DownloadResponse) Response() *http.Response {\n\treturn r.r.Response()\n}", "title": "" }, { "docid": "34215f96ef856ddf639dd3a878069426", "score": "0.58119845", "text": "func (g *ResponseGin) Response(httpCode int, data interface{}) {\n\tg.Context.JSON(httpCode, Response{\n\t\tData: data,\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "7720a744acb3983016ee862e8a39161c", "score": "0.5799704", "text": "func (w *directResponseWriter) response() (*http.Response, error) {\n\tw.mutex.Lock()\n\tfor !w.wroteHeader {\n\t\tw.cond.Wait()\n\t}\n\n\tresponse := &http.Response{}\n\tresponse.Body = &responseReader{w: w}\n\tresponse.Header = w.header\n\tresponse.StatusCode = w.statusCode\n\tif response.StatusCode == 0 {\n\t\tresponse.StatusCode = 200\n\t}\n\n\tw.mutex.Unlock()\n\n\treturn response, nil\n}", "title": "" }, { "docid": "2f6a1b774d6b7ceef07d0cfdf0468ac9", "score": "0.5796201", "text": "func (iter RegionHealthListIterator) Response() RegionHealthList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "85199b01075f439e04f43cafaa0fd974", "score": "0.57945853", "text": "func (iter StoragePoolListIterator) Response() StoragePoolList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "74fc8182b8350813f9abe8e7bb3a5c4f", "score": "0.579184", "text": "func (o *GetMarketsRegionIDHistoryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.GetMarketsRegionIDHistoryOKBody, 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\n}", "title": "" }, { "docid": "5282f99e13cf407dbb17d2a64f4be210", "score": "0.57875514", "text": "func (response GetAlarmHistoryResponse) HTTPResponse() *http.Response {\n\treturn response.RawResponse\n}", "title": "" }, { "docid": "4e2ecc71a66e8a0821e6e6ba38d4be1b", "score": "0.57864386", "text": "func (di *Iterator) Response() *Response {\n\treturn di.response\n}", "title": "" }, { "docid": "4e2ecc71a66e8a0821e6e6ba38d4be1b", "score": "0.57864386", "text": "func (di *Iterator) Response() *Response {\n\treturn di.response\n}", "title": "" }, { "docid": "5426a3a0ffd7fff214f1124445a06749", "score": "0.5777205", "text": "func (iter ListIterator) Response() List {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "2fd837fcd94bb444404e19a2ef832f8e", "score": "0.57755685", "text": "func (iter BookmarkListIterator) Response() BookmarkList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "2fd837fcd94bb444404e19a2ef832f8e", "score": "0.57755685", "text": "func (iter BookmarkListIterator) Response() BookmarkList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "b2dd13b186177189b17ee82b9529721f", "score": "0.5774927", "text": "func (p *GatewayClientListByServicePager) PageResponse() GatewayClientListByServiceResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "e6906afcec2c6a7fd2b1957d149aa1a5", "score": "0.5770742", "text": "func (page StreamingEndpointListResultPage) Response() StreamingEndpointListResult {\n\treturn page.selr\n}", "title": "" }, { "docid": "272d054614010f2b12bcc02e291b969e", "score": "0.57665586", "text": "func (p *BackendClientListByServicePager) PageResponse() BackendClientListByServiceResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "fc36478016773d4f3150cfc77b80b241", "score": "0.5760295", "text": "func (c *BaseContext) Response() http.ResponseWriter {\n return c.response\n}", "title": "" }, { "docid": "b37f82d6faad77a4393a1cde605c0a32", "score": "0.5759389", "text": "func (p *NotificationHubsListPager) PageResponse() NotificationHubsListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1754e992c22b888f843b9543075447fe", "score": "0.5755251", "text": "func (page FrontendEndpointsListResultPage) Response() FrontendEndpointsListResult {\n\treturn page.felr\n}", "title": "" }, { "docid": "373b2f502f9d5dcb6f631c45395919ef", "score": "0.57527983", "text": "func (p *PortalRevisionClientListByServicePager) PageResponse() PortalRevisionClientListByServiceResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "776dc31bd23d01e03354fbd8b55bed32", "score": "0.5740297", "text": "func (o *GetVMInteraceDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c13f577fe221f660cdaae7996ea8beb8", "score": "0.5738672", "text": "func (page StreamingLocatorCollectionPage) Response() StreamingLocatorCollection {\n\treturn page.slc\n}", "title": "" }, { "docid": "3fd68f6e68c33727c4febb36c1204f35", "score": "0.573853", "text": "func (iter ResourceGuardResourceListIterator) Response() ResourceGuardResourceList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "94bc5f23696bf960e61c38f0bb944e61", "score": "0.57370555", "text": "func (p *OperationsListPager) PageResponse() OperationsListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "94bc5f23696bf960e61c38f0bb944e61", "score": "0.57370555", "text": "func (p *OperationsListPager) PageResponse() OperationsListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "50e6a3b304a264cb18248f89ec15014d", "score": "0.57369", "text": "func (iter OperationListIterator) Response() OperationList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "50e6a3b304a264cb18248f89ec15014d", "score": "0.57369", "text": "func (iter OperationListIterator) Response() OperationList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "50e6a3b304a264cb18248f89ec15014d", "score": "0.57369", "text": "func (iter OperationListIterator) Response() OperationList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "88389cf4dcb25411443e4f4eddd48346", "score": "0.57339245", "text": "func (response ListModuleStreamsResponse) HTTPResponse() *http.Response {\n\treturn response.RawResponse\n}", "title": "" }, { "docid": "7f6c8addfd050220383ee4238a6cf8d1", "score": "0.57276845", "text": "func (o *GetHistoryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cd1e0637d05e3d92cdeb98afc404c273", "score": "0.5724015", "text": "func (iter ActionsListIterator) Response() ActionsList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "cd1e0637d05e3d92cdeb98afc404c273", "score": "0.5724015", "text": "func (iter ActionsListIterator) Response() ActionsList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "684fa0fe39a4602f5f5b62f68d56c7fc", "score": "0.5721071", "text": "func (p *FrontDoorsClientListPager) PageResponse() FrontDoorsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "9e6314ebc8f5aa1ed984251dd43a4fcb", "score": "0.5717989", "text": "func (page RestorePointListResultPage) Response() RestorePointListResult {\n\treturn page.rplr\n}", "title": "" }, { "docid": "67b60268de91658fb5ea429e9b87ab09", "score": "0.571522", "text": "func (o *GetNextStepsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "13c3fb0d96ac85784cac659ad320bc4e", "score": "0.571136", "text": "func (o *StagingCompleteDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n}", "title": "" }, { "docid": "00357737bbe792be9e454334aa730bc7", "score": "0.5709917", "text": "func (iter ACLListIterator) Response() ACLList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "6200d613fb0cd294a8070605c6f48462", "score": "0.5709102", "text": "func (p *LoggerClientListByServicePager) PageResponse() LoggerClientListByServiceResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "398ab2ecc5c1d17ff92f22367400d86c", "score": "0.57066864", "text": "func (iter ApplicationInfoListAPIModelIterator) Response() ApplicationInfoListAPIModel {\n return iter.page.Response()\n }", "title": "" }, { "docid": "4c533c0e42e265e58fad75b06375df07", "score": "0.5706122", "text": "func (iter LocationListIterator) Response() LocationList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "144c527ac3d93ec6a7f5a07086116b80", "score": "0.5704365", "text": "func (iter SQLPoolInfoListResultIterator) Response() SQLPoolInfoListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "0d9de865aa371e455a2af8872918a31f", "score": "0.5703186", "text": "func (p *RestorePointCollectionsListAllPager) PageResponse() RestorePointCollectionsListAllResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "f17fa25d2751793ceb70c18283a8713d", "score": "0.5701756", "text": "func (p *ContentItemClientListByServicePager) PageResponse() ContentItemClientListByServiceResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "4614c11d854224a68b2ac833b097f1ff", "score": "0.569995", "text": "func (resp *RawResponse) Response() Responsor {\n\treturn resp.response\n}", "title": "" }, { "docid": "140c8888e043fcf473ca0faa898cdceb", "score": "0.5699485", "text": "func (p *ReportsClientListByGeoPager) PageResponse() ReportsClientListByGeoResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.56989336", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.56989336", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.56989336", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.56989336", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.56989336", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.56989336", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.56989336", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.56989336", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.56989336", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.56989336", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.56989336", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "5889af8d20b329dfeb9a36d179915b01", "score": "0.5696491", "text": "func (p *ReportsClientListByAPIPager) PageResponse() ReportsClientListByAPIResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "7c102329599caec6a68a08573474de6f", "score": "0.569465", "text": "func (p *RunsClientListPager) PageResponse() RunsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "ecd5eb8323acd4a9c27d84380bee4dc1", "score": "0.5692236", "text": "func (page JobStreamListResultPage) Response() JobStreamListResult {\n\treturn page.jslr\n}", "title": "" }, { "docid": "c1f9aedec003620e92fa2d93a9ee1f91", "score": "0.5690976", "text": "func (iter ExperimentListIterator) Response() ExperimentList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "8555611fe13991b018c7197e156a8ce1", "score": "0.568973", "text": "func (o *GetEventByIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n}", "title": "" }, { "docid": "2db0abc100be70b0120b670a0faa4703", "score": "0.5689508", "text": "func (response SummarizeApplicationsResponse) HTTPResponse() *http.Response {\n\treturn response.RawResponse\n}", "title": "" }, { "docid": "8d3f92857c56eda21cf856c13f36b389", "score": "0.5687799", "text": "func (p *ImagesListPager) PageResponse() ImagesListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "df168b933d8732f46a2ad0a73ee8f340", "score": "0.56867456", "text": "func (handler *Wrapper) WriteResponse(rw http.ResponseWriter, req *http.Request, code int, data []byte) error {\n\tcheckSum := fmt.Sprintf(\"W/%08x\", md5.Sum(data))\n\n\trw.Header().Set(\"ETag\", checkSum)\n\trw.Header().Set(\"Cache-Control\", \"no-cache, no-store, must-revalidate\")\n\n\treqETag := req.Header.Get(\"If-None-Match\")\n\tif reqETag != \"\" && reqETag == checkSum {\n\t\trw.Header().Del(\"ETag\")\n\t\trw.WriteHeader(http.StatusNotModified)\n\t\treturn nil\n\t}\n\trw.WriteHeader(code)\n\n\tif req.Method == \"HEAD\" {\n\t\treturn nil\n\t}\n\n\t_, err := rw.Write(data)\n\treturn err\n}", "title": "" }, { "docid": "a4bb6b274341490a1c591c2b6c798bf3", "score": "0.5685275", "text": "func (response ListModuleStreamProfilesResponse) HTTPResponse() *http.Response {\n\treturn response.RawResponse\n}", "title": "" }, { "docid": "7c4379555ce7a8ed3b80f4ab6e1f3b74", "score": "0.56823075", "text": "func (iter USQLAssemblyListIterator) Response() USQLAssemblyList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "78d9bf295b08d0cca257f2c72935c0fd", "score": "0.56813794", "text": "func (response ListPbfListingsResponse) HTTPResponse() *http.Response {\n\treturn response.RawResponse\n}", "title": "" }, { "docid": "857ea4e009d110d63dc037251be9c0d7", "score": "0.56738704", "text": "func (p *TasksClientListPager) PageResponse() TasksClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "88e50e764df1ba8c53d93a323ff33abb", "score": "0.56730735", "text": "func (iter BackupVaultResourceListIterator) Response() BackupVaultResourceList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "eb635dcc5e0510164e11cae047c056b8", "score": "0.56727916", "text": "func (p *SharesClientListByDataBoxEdgeDevicePager) PageResponse() SharesClientListByDataBoxEdgeDeviceResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "f364a4616d5e4ea6dceaf65e9df1235f", "score": "0.567084", "text": "func (iter ProductListIterator) Response() ProductList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "ca2334ea2dd31bea4f60e7f3189ed686", "score": "0.56706864", "text": "func (iter IncidentListIterator) Response() IncidentList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "ca2334ea2dd31bea4f60e7f3189ed686", "score": "0.56706864", "text": "func (iter IncidentListIterator) Response() IncidentList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "14f06c4b7b4f5744ce8805d81597e9b3", "score": "0.5670681", "text": "func (iter SlbMuxInstanceListIterator) Response() SlbMuxInstanceList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "89291404003ffbeb41b2efce41774d33", "score": "0.56653714", "text": "func (p *EmailTemplateClientListByServicePager) PageResponse() EmailTemplateClientListByServiceResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "fec05a4a8642eb3a5007a022e3444467", "score": "0.5664437", "text": "func (p *ReportsClientListByUserPager) PageResponse() ReportsClientListByUserResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "571d9eb5237058ebf365d0d5753cade8", "score": "0.56620574", "text": "func (page LiveEventListResultPage) Response() LiveEventListResult {\n\treturn page.lelr\n}", "title": "" } ]
39d513a61d7eac3d0c676f43b2ffab94
ListConfigurations : List configurations List the configurations that are available in your Secrets Manager instance.
[ { "docid": "1bb1f7f271ffb9e592e4c6ee3108c998", "score": "0.8071777", "text": "func (secretsManager *SecretsManagerV2) ListConfigurations(listConfigurationsOptions *ListConfigurationsOptions) (result *ConfigurationMetadataPaginatedCollection, response *core.DetailedResponse, err error) {\n\treturn secretsManager.ListConfigurationsWithContext(context.Background(), listConfigurationsOptions)\n}", "title": "" } ]
[ { "docid": "99843c594b4f070ef3759254268caedf", "score": "0.6964265", "text": "func (x *Rest) ConfigurationList(w http.ResponseWriter, r *http.Request,\n\tparams httprouter.Params) {\n\tdefer panicCatcher(w)\n\n\trequest := msg.New(r, params)\n\trequest.Section = msg.SectionConfiguration\n\trequest.Action = msg.ActionList\n\n\tif !x.isAuthorized(&request) {\n\t\tx.replyForbidden(&w, &request, nil)\n\t\treturn\n\t}\n\n\thandler := x.handlerMap.Get(`configuration_r`)\n\thandler.Intake() <- request\n\tresult := <-request.Reply\n\tx.respond(&w, &result)\n}", "title": "" }, { "docid": "14fc11a24d56534281c27081c017df24", "score": "0.67814386", "text": "func (secretsManager *SecretsManagerV2) ListConfigurationsWithContext(ctx context.Context, listConfigurationsOptions *ListConfigurationsOptions) (result *ConfigurationMetadataPaginatedCollection, response *core.DetailedResponse, err error) {\n\terr = core.ValidateStruct(listConfigurationsOptions, \"listConfigurationsOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = secretsManager.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(secretsManager.Service.Options.URL, `/api/v2/configurations`, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range listConfigurationsOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"secrets_manager\", \"V2\", \"ListConfigurations\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\tif listConfigurationsOptions.Offset != nil {\n\t\tbuilder.AddQuery(\"offset\", fmt.Sprint(*listConfigurationsOptions.Offset))\n\t}\n\tif listConfigurationsOptions.Limit != nil {\n\t\tbuilder.AddQuery(\"limit\", fmt.Sprint(*listConfigurationsOptions.Limit))\n\t}\n\tif listConfigurationsOptions.Sort != nil {\n\t\tbuilder.AddQuery(\"sort\", fmt.Sprint(*listConfigurationsOptions.Sort))\n\t}\n\tif listConfigurationsOptions.Search != nil {\n\t\tbuilder.AddQuery(\"search\", fmt.Sprint(*listConfigurationsOptions.Search))\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = secretsManager.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalConfigurationMetadataPaginatedCollection)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "fe7c52e929e001f2d03521f210cff6a6", "score": "0.67118233", "text": "func List(c *deis.Client, app string) (api.Config, error) {\n\tu := fmt.Sprintf(\"/v2/apps/%s/config/\", app)\n\n\tres, reqErr := c.Request(\"GET\", u, nil)\n\tif reqErr != nil {\n\t\treturn api.Config{}, reqErr\n\t}\n\tdefer res.Body.Close()\n\n\tconfig := api.Config{}\n\tif err := json.NewDecoder(res.Body).Decode(&config); err != nil {\n\t\treturn api.Config{}, err\n\t}\n\n\treturn config, reqErr\n}", "title": "" }, { "docid": "102bf73b9a19f269e549c15281fb8eb0", "score": "0.6666096", "text": "func (*SecretsManagerV2) NewListConfigurationsOptions() *ListConfigurationsOptions {\n\treturn &ListConfigurationsOptions{}\n}", "title": "" }, { "docid": "8d8caa1f2909f16c50c03246330f5242", "score": "0.65526074", "text": "func (api *API) ListConfigs(request *restful.Request, response *restful.Response) {\n\n\tparams := request.PathParameters()\n\tnamespace, kind := params[\"namespace\"], params[\"kind\"]\n\n\tif _, ok := model.IstioConfigTypes.GetByType(kind); !ok {\n\t\tapi.writeError(http.StatusBadRequest,\n\t\t\tfmt.Sprintf(\"unknown configuration type %s; use one of %v\", kind, model.IstioConfigTypes.Types()), response)\n\t\treturn\n\t}\n\tglog.V(2).Infof(\"Getting configs of kind %s in namespace %s\", kind, namespace)\n\tresult, err := api.registry.List(kind)\n\tif err != nil {\n\t\tapi.writeError(http.StatusInternalServerError, err.Error(), response)\n\t\treturn\n\t}\n\n\t// Parse back to config\n\tout := []Config{}\n\tvar schema model.ProtoSchema\n\tfor _, v := range result {\n\t\tretrieved, errLocal := schema.ToJSON(v.Content)\n\t\tif errLocal != nil {\n\t\t\tapi.writeError(http.StatusInternalServerError, errLocal.Error(), response)\n\t\t\treturn\n\t\t}\n\t\tvar retJSON interface{}\n\t\tif errLocal = json.Unmarshal([]byte(retrieved), &retJSON); errLocal != nil {\n\t\t\tapi.writeError(http.StatusInternalServerError, errLocal.Error(), response)\n\t\t\treturn\n\t\t}\n\t\tconfig := Config{\n\t\t\tName: v.Key,\n\t\t\tType: v.Type,\n\t\t\tSpec: retJSON,\n\t\t}\n\t\tglog.V(2).Infof(\"Retrieved config %+v\", config)\n\t\tout = append(out, config)\n\t}\n\tif err = response.WriteHeaderAndEntity(http.StatusOK, out); err != nil {\n\t\tapi.writeError(http.StatusInternalServerError, err.Error(), response)\n\t}\n}", "title": "" }, { "docid": "fabdc6098fd7dca88a40debd35c9395e", "score": "0.63802594", "text": "func (d *HephyCmd) ConfigList(appID string, format string) error {\n\ts, appID, err := load(d.ConfigFile, appID)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconfig, err := config.List(s.Client, appID)\n\tif d.checkAPICompatibility(s.Client, err) != nil {\n\t\treturn err\n\t}\n\n\tkeys := sortKeys(config.Values)\n\n\tvar configOutput *bytes.Buffer = new(bytes.Buffer)\n\n\tswitch format {\n\tcase \"oneline\":\n\t\tfor i, key := range keys {\n\t\t\tsep := \" \"\n\t\t\tif i == len(keys)-1 {\n\t\t\t\tsep = \"\\n\"\n\t\t\t}\n\t\t\tfmt.Fprintf(configOutput, \"%s=%s%s\", key, config.Values[key], sep)\n\t\t}\n\tcase \"diff\":\n\t\tfor _, key := range keys {\n\t\t\tfmt.Fprintf(configOutput, \"%s=%s\\n\", key, config.Values[key])\n\t\t}\n\tdefault:\n\t\tfmt.Fprintf(configOutput, \"=== %s Config\\n\", appID)\n\n\t\tconfigMap := make(map[string]string)\n\n\t\t// config.Values is type interface, so it needs to be converted to a string\n\t\tfor _, key := range keys {\n\t\t\tconfigMap[key] = fmt.Sprintf(\"%v\", config.Values[key])\n\t\t}\n\n\t\tfmt.Fprint(configOutput, prettyprint.PrettyTabs(configMap, 6))\n\t}\n\n\td.Print(configOutput)\n\treturn nil\n}", "title": "" }, { "docid": "a06119ac51dc33eb9b6400d717598b20", "score": "0.6298363", "text": "func (a *appsConfig) List() (apps []string, err error) {\n\tres, err := a.c.baseRequest(http.MethodGet, routes.appsConfig, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar r appConfigResponse\n\tres.JSON(&r)\n\treturn r.Ocs.Data.Data, nil\n}", "title": "" }, { "docid": "bd1a3308ff5a2dc418565c6f9afa8c18", "score": "0.62687266", "text": "func (c *Client) ListAvailabilityConfigurations(ctx context.Context, params *ListAvailabilityConfigurationsInput, optFns ...func(*Options)) (*ListAvailabilityConfigurationsOutput, error) {\n\tif params == nil {\n\t\tparams = &ListAvailabilityConfigurationsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListAvailabilityConfigurations\", params, optFns, c.addOperationListAvailabilityConfigurationsMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListAvailabilityConfigurationsOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "a3a50a0cb5045b68dfd7bf6410c99d35", "score": "0.6183436", "text": "func (c *ioTConfigs) List(opts v1.ListOptions) (result *v1alpha1.IoTConfigList, 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 = &v1alpha1.IoTConfigList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"iotconfigs\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "6af770eb43e325d5c5a11a21aadb4f34", "score": "0.61695457", "text": "func (c *Client) ListConfigs(ctx context.Context, params *ListConfigsInput, optFns ...func(*Options)) (*ListConfigsOutput, error) {\n\tif params == nil {\n\t\tparams = &ListConfigsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListConfigs\", params, optFns, addOperationListConfigsMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListConfigsOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "e8857a303bc395ae179b0f82887d4187", "score": "0.61680174", "text": "func (endpoint *HTTPEndpoint) ListConfigs() ConfigList {\n\tendpoint.Init()\n\n\tt0 := time.Now()\n\tendpoint.metrics.ListConfigs.Requests.Hit()\n\n\tlist := endpoint.Router.PullConfigs().List()\n\n\tendpoint.metrics.ListConfigs.Latency.RecordSince(t0)\n\treturn list\n}", "title": "" }, { "docid": "8004fdbed7c2b87560e102282a9f4014", "score": "0.6072756", "text": "func (api *configurationsnapshotAPI) List(ctx context.Context, opts *api.ListWatchOptions) ([]*ConfigurationSnapshot, error) {\n\tvar objlist []*ConfigurationSnapshot\n\tobjs, err := api.ct.List(\"ConfigurationSnapshot\", ctx, opts)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, obj := range objs {\n\t\tswitch tp := obj.(type) {\n\t\tcase *ConfigurationSnapshot:\n\t\t\teobj := obj.(*ConfigurationSnapshot)\n\t\t\tobjlist = append(objlist, eobj)\n\t\tdefault:\n\t\t\tlog.Fatalf(\"Got invalid object type %v while looking for ConfigurationSnapshot\", tp)\n\t\t}\n\t}\n\n\treturn objlist, nil\n}", "title": "" }, { "docid": "f6e21b5cb8c687d10a3ed2451b31b076", "score": "0.5993193", "text": "func (w *wireguardServerConfig) List() ([]api.WireguardServerConfig, error) {\n\tvar wgscList []api.WireguardServerConfig\n\treturn wgscList, w.store.Search(w.prefix, regexp.MustCompile(\".*\"), func(k, v []byte) error {\n\t\tvar obj api.WireguardServerConfig\n\t\tif err := json.Unmarshal(v, &obj); err != nil {\n\t\t\treturn err\n\t\t}\n\t\twgscList = append(wgscList, obj)\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "924666039e4b019ec5d37a456548a3a7", "score": "0.5985988", "text": "func List(params Params) (*models.RepositoryConfigs, error) {\n\tif err := params.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\trepo, err := params.V1API.PlatformConfigurationSnapshots.GetSnapshotRepositories(\n\t\tplatform_configuration_snapshots.NewGetSnapshotRepositoriesParams(),\n\t\tparams.AuthWriter,\n\t)\n\tif err != nil {\n\t\treturn nil, api.UnwrapError(err)\n\t}\n\n\treturn repo.Payload, nil\n}", "title": "" }, { "docid": "f7b1d07030e967ce9ad49f5c9b29fa52", "score": "0.59077024", "text": "func NewListConfigurationsOK() *ListConfigurationsOK {\n\treturn &ListConfigurationsOK{}\n}", "title": "" }, { "docid": "1212c30da343b0bcfdcae7c83eb9b35e", "score": "0.5866946", "text": "func (s *elasticBeanstalkConfigurationTemplateLister) List(selector labels.Selector) (ret []*v1alpha1.ElasticBeanstalkConfigurationTemplate, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.ElasticBeanstalkConfigurationTemplate))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "cc1032dc2bf50afb101338293b534d47", "score": "0.58589953", "text": "func (s *Server) ShowConfigurations(ctx context.Context, req *internalpb.ShowConfigurationsRequest) (*internalpb.ShowConfigurationsResponse, error) {\n\treturn s.querynode.ShowConfigurations(ctx, req)\n}", "title": "" }, { "docid": "ab0847fe150fcdf53505ba43c16b0052", "score": "0.58366376", "text": "func (c *restClient) ListKmsConfigs(ctx context.Context, req *netapppb.ListKmsConfigsRequest, opts ...gax.CallOption) *KmsConfigIterator {\n\tit := &KmsConfigIterator{}\n\treq = proto.Clone(req).(*netapppb.ListKmsConfigsRequest)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tit.InternalFetch = func(pageSize int, pageToken string) ([]*netapppb.KmsConfig, string, error) {\n\t\tresp := &netapppb.ListKmsConfigsResponse{}\n\t\tif pageToken != \"\" {\n\t\t\treq.PageToken = pageToken\n\t\t}\n\t\tif pageSize > math.MaxInt32 {\n\t\t\treq.PageSize = math.MaxInt32\n\t\t} else if pageSize != 0 {\n\t\t\treq.PageSize = int32(pageSize)\n\t\t}\n\t\tbaseUrl, err := url.Parse(c.endpoint)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\tbaseUrl.Path += fmt.Sprintf(\"/v1/%v/kmsConfigs\", req.GetParent())\n\n\t\tparams := url.Values{}\n\t\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\t\tif req.GetFilter() != \"\" {\n\t\t\tparams.Add(\"filter\", fmt.Sprintf(\"%v\", req.GetFilter()))\n\t\t}\n\t\tif req.GetOrderBy() != \"\" {\n\t\t\tparams.Add(\"orderBy\", fmt.Sprintf(\"%v\", req.GetOrderBy()))\n\t\t}\n\t\tif req.GetPageSize() != 0 {\n\t\t\tparams.Add(\"pageSize\", fmt.Sprintf(\"%v\", req.GetPageSize()))\n\t\t}\n\t\tif req.GetPageToken() != \"\" {\n\t\t\tparams.Add(\"pageToken\", fmt.Sprintf(\"%v\", req.GetPageToken()))\n\t\t}\n\n\t\tbaseUrl.RawQuery = params.Encode()\n\n\t\t// Build HTTP headers from client and context metadata.\n\t\thds := append(c.xGoogHeaders, \"Content-Type\", \"application/json\")\n\t\theaders := gax.BuildHeaders(ctx, hds...)\n\t\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\t\tif settings.Path != \"\" {\n\t\t\t\tbaseUrl.Path = settings.Path\n\t\t\t}\n\t\t\thttpReq, err := http.NewRequest(\"GET\", baseUrl.String(), nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\thttpReq.Header = headers\n\n\t\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer httpRsp.Body.Close()\n\n\t\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}, opts...)\n\t\tif e != nil {\n\t\t\treturn nil, \"\", e\n\t\t}\n\t\tit.Response = resp\n\t\treturn resp.GetKmsConfigs(), resp.GetNextPageToken(), nil\n\t}\n\n\tfetch := func(pageSize int, pageToken string) (string, error) {\n\t\titems, nextPageToken, err := it.InternalFetch(pageSize, pageToken)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tit.items = append(it.items, items...)\n\t\treturn nextPageToken, nil\n\t}\n\n\tit.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)\n\tit.pageInfo.MaxSize = int(req.GetPageSize())\n\tit.pageInfo.Token = req.GetPageToken()\n\n\treturn it\n}", "title": "" }, { "docid": "c415e5919a47d3200335ce3e44a96756", "score": "0.5832627", "text": "func (c *Client) ShowConfigurations(ctx context.Context, req *internalpb.ShowConfigurationsRequest) (*internalpb.ShowConfigurationsResponse, error) {\n\treq = typeutil.Clone(req)\n\tcommonpbutil.UpdateMsgBase(\n\t\treq.GetBase(),\n\t\tcommonpbutil.FillMsgBaseFromClient(paramtable.GetNodeID(), commonpbutil.WithTargetID(c.grpcClient.GetNodeID())),\n\t)\n\treturn wrapGrpcCall(ctx, c, func(client querypb.QueryCoordClient) (*internalpb.ShowConfigurationsResponse, error) {\n\t\treturn client.ShowConfigurations(ctx, req)\n\t})\n}", "title": "" }, { "docid": "9f44d13bbe591eceb03dab241332203c", "score": "0.5827753", "text": "func (pager *ConfigurationsPager) GetAll() (allItems []ConfigurationMetadataIntf, err error) {\n\treturn pager.GetAllWithContext(context.Background())\n}", "title": "" }, { "docid": "16fc424400ed6f5e4a2f5795ef3f471c", "score": "0.57249707", "text": "func listInstanceConfigOperations(w io.Writer, projectID string) error {\n\t// projectID := \"my-project-id\"\n\n\tctx := context.Background()\n\tadminClient, err := instance.NewInstanceAdminClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer adminClient.Close()\n\titer := adminClient.ListInstanceConfigOperations(ctx, &instancepb.ListInstanceConfigOperationsRequest{\n\t\tParent: fmt.Sprintf(\"projects/%s\", projectID),\n\t\tFilter: \"(metadata.@type=type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata)\",\n\t})\n\tfor {\n\t\tresp, err := iter.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tmetadata := &instancepb.CreateInstanceConfigMetadata{}\n\t\tif err := ptypes.UnmarshalAny(resp.Metadata, metadata); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Fprintf(w, \"List instance config operations %s is %d%% completed.\\n\",\n\t\t\tmetadata.InstanceConfig.Name,\n\t\t\tmetadata.Progress.ProgressPercent,\n\t\t)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "16d47ee1370b8e692e92c3ef4f94f7ee", "score": "0.57247", "text": "func (c *Client) ShowConfigurations(ctx context.Context, req *internalpb.ShowConfigurationsRequest) (*internalpb.ShowConfigurationsResponse, error) {\n\treq = typeutil.Clone(req)\n\tcommonpbutil.UpdateMsgBase(\n\t\treq.GetBase(),\n\t\tcommonpbutil.FillMsgBaseFromClient(paramtable.GetNodeID()))\n\treturn wrapGrpcCall(ctx, c, func(client querypb.QueryNodeClient) (*internalpb.ShowConfigurationsResponse, error) {\n\t\treturn client.ShowConfigurations(ctx, req)\n\t})\n}", "title": "" }, { "docid": "3ffd2527ff1c25c632ce6c3fa1b7b019", "score": "0.57186323", "text": "func (c *Controller) List(typ, namespace string) ([]model.Config, error) {\n\tvar configs []model.Config\n\tvar index int\n\n\tc.storage.RLock()\n\tswitch typ {\n\tcase model.VirtualService.Type:\n\t\tconfigs = make([]model.Config, len(c.storage.virtualServices))\n\t\tfor _, service := range c.storage.virtualServices {\n\t\t\tconfigs[index] = *service\n\t\t\tindex++\n\t\t}\n\n\tcase model.DestinationRule.Type:\n\t\tconfigs = make([]model.Config, len(c.storage.destinationRules))\n\t\tfor _, rule := range c.storage.destinationRules {\n\t\t\tconfigs[index] = *rule\n\t\t\tindex++\n\t\t}\n\tdefault:\n\t\tc.logger.Infof(\"list type not supported: %s\", typ)\n\t}\n\tc.storage.RUnlock()\n\n\treturn configs, nil\n}", "title": "" }, { "docid": "0d99fc104147b161776667a5a04efe6e", "score": "0.5709812", "text": "func (s *oIDCProviderConfigLister) List(selector labels.Selector) (ret []*v1alpha1.OIDCProviderConfig, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.OIDCProviderConfig))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "2088ab33b384db1fe70f2a2752b19a90", "score": "0.56484056", "text": "func ListConfigTemplates(ctx context.Context) api.ListResponse {\n\tonce.Do(\n\t\tfunc() {\n\t\t\tlog.Infof(\"read pipeline config templates from %s\", TemplatePath)\n\t\t\tresult, err := getConfigTemplates(TemplatePath)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"unmarshal yaml config template file %s error: %v\", TemplatePath, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttemplates = result\n\t\t\tlog.Info(\"read pipeline config templates succeed\")\n\t\t},\n\t)\n\n\treturn httputil.ResponseWithList(templates, len(templates))\n\n}", "title": "" }, { "docid": "e6b3d720a6693fbc3de62cd82f61bcd9", "score": "0.5618664", "text": "func (c *FakeKubeletConfigs) List(ctx context.Context, opts v1.ListOptions) (result *machineconfigurationopenshiftiov1.KubeletConfigList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewRootListAction(kubeletconfigsResource, kubeletconfigsKind, opts), &machineconfigurationopenshiftiov1.KubeletConfigList{})\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &machineconfigurationopenshiftiov1.KubeletConfigList{ListMeta: obj.(*machineconfigurationopenshiftiov1.KubeletConfigList).ListMeta}\n\tfor _, item := range obj.(*machineconfigurationopenshiftiov1.KubeletConfigList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "title": "" }, { "docid": "2ead5674b348c2e9c6aac6cb90ee4988", "score": "0.5612046", "text": "func GetConfigurations() *Configuration {\n\treturn globalConfig\n}", "title": "" }, { "docid": "5d3362b4a9388faef6a5801c10e1f04f", "score": "0.55968493", "text": "func (tdb *TyposDatasetBuilder) ListConfigurationOptions() []core.ConfigurationOption {\n\toptions := [...]core.ConfigurationOption{{\n\t\tName: ConfigTyposDatasetMaximumAllowedDistance,\n\t\tDescription: \"Maximum Levenshtein distance between two identifiers to consider them \" +\n\t\t\t\"a typo-fix pair.\",\n\t\tFlag: \"typos-max-distance\",\n\t\tType: core.IntConfigurationOption,\n\t\tDefault: DefaultMaximumAllowedTypoDistance},\n\t}\n\treturn options[:]\n}", "title": "" }, { "docid": "1199a0df779fb6ce87f41eeb1cca81c8", "score": "0.5572269", "text": "func (s *postgresqlConfigurationLister) List(selector labels.Selector) (ret []*v1alpha1.PostgresqlConfiguration, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.PostgresqlConfiguration))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "1ec9d52d4a220fd07328a33d356ef64e", "score": "0.55703384", "text": "func (cloud *CloudCtx) ListApplicationInstanceConfig() []*config.AppInstanceConfig {\n\treturn cloud.applicationInstances\n}", "title": "" }, { "docid": "27d9c6edd754b8bb1748399d62c9644c", "score": "0.55699784", "text": "func (c *secrets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.SecretList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\n\tresult = &v1.SecretList{}\n\terr = c.client.Get().\n\t\tResource(\"secrets\").\n\t\tVersionedParams(opts).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(result)\n\n\treturn\n}", "title": "" }, { "docid": "3fc0ffdc05aaa26999434e058d6f9b3e", "score": "0.55522686", "text": "func (c *Client) ListBucketMetricsConfigurations(ctx context.Context, params *ListBucketMetricsConfigurationsInput, optFns ...func(*Options)) (*ListBucketMetricsConfigurationsOutput, error) {\n\tif params == nil {\n\t\tparams = &ListBucketMetricsConfigurationsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListBucketMetricsConfigurations\", params, optFns, c.addOperationListBucketMetricsConfigurationsMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListBucketMetricsConfigurationsOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "177c1c864fefb7c209b099141e7cc6af", "score": "0.55505115", "text": "func (s Secrets) List(ctx context.Context, maxResults int32) ([]string, error) {\n\tvers, err := s.Ops.Secrets().List(ctx, maxResults)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout := make([]string, 0, len(vers))\n\tfor _, ver := range vers {\n\t\tout = append(out, ver.ID)\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "46db60d831654d2d713ecfbc5b0d6045", "score": "0.55495435", "text": "func ListDeploymentConfigs(namespace string, restConf *rest.Config, options v12.ListOptions) ([]AppItem, error) {\n\tapi, err := client.GetDeploymentConfigsInterface(namespace, restConf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlist, err := api.List(options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resultItems []AppItem\n\tfor _, it := range list.Items {\n\t\tresultItems = append(resultItems, items.NewOpDeploymentConfig(it))\n\t}\n\treturn resultItems, nil\n}", "title": "" }, { "docid": "655352cf5b24ebdc47d1b07a659afea2", "score": "0.55407214", "text": "func (h *ConnectionPoolsHandler) List(ctx context.Context, project, serviceName string) ([]*ConnectionPool, error) {\n\t// There's no API for listing connection pool entries. Need to get them from\n\t// service info instead\n\tservice, err := h.client.Services.Get(ctx, project, serviceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn service.ConnectionPools, nil\n}", "title": "" }, { "docid": "455b552674cd8a7bec61ad3f03fcdd7d", "score": "0.5532803", "text": "func (_e *MockDataCoord_Expecter) ShowConfigurations(ctx interface{}, req interface{}) *MockDataCoord_ShowConfigurations_Call {\n\treturn &MockDataCoord_ShowConfigurations_Call{Call: _e.mock.On(\"ShowConfigurations\", ctx, req)}\n}", "title": "" }, { "docid": "d36f57467b009f2dc5eccf1de178dc16", "score": "0.5531373", "text": "func (cc *CenterConfig) List() (interface{}, int64) {\n\tdb := cc.getDb()\n\tqs := db.QueryTable(cc.TableName())\n\tvar rows []*CenterConfig\n\tvar c int64\n\tqs = cc.filterSearch(qs, cc.q)\n\t_, err := qs.Limit(cc.limit, cc.start).All(&rows)\n\tif err == nil {\n\t\tc, _ = qs.Count()\n\t}\n\treturn rows, c\n}", "title": "" }, { "docid": "a0b7f9463192e556494ca5224a4933ea", "score": "0.5516254", "text": "func ExampleExportConfigurationsClient_List() {\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 := armapplicationinsights.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewExportConfigurationsClient().List(ctx, \"my-resource-group\", \"my-component\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.ComponentExportConfigurationArray = []*armapplicationinsights.ComponentExportConfiguration{\n\t// \t{\n\t// \t\tApplicationName: to.Ptr(\"my-component\"),\n\t// \t\tContainerName: to.Ptr(\"mystorageblob\"),\n\t// \t\tDestinationAccountID: to.Ptr(\"/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorageblob\"),\n\t// \t\tDestinationStorageLocationID: to.Ptr(\"eastasia\"),\n\t// \t\tDestinationStorageSubscriptionID: to.Ptr(\"subidc\"),\n\t// \t\tDestinationType: to.Ptr(\"Blob\"),\n\t// \t\tExportID: to.Ptr(\"uGOoki0jQsyEs3IdQ83Q4QsNr4=\"),\n\t// \t\tExportStatus: to.Ptr(\"Preparing\"),\n\t// \t\tInstrumentationKey: to.Ptr(\"8330b4a4-0b8e-40cf-a643-bbaf60d375c9\"),\n\t// \t\tIsUserEnabled: to.Ptr(\"False\"),\n\t// \t\tLastGapTime: to.Ptr(\"9999-12-31T23:59:59.999Z\"),\n\t// \t\tLastSuccessTime: to.Ptr(\"9999-12-31T23:59:59.999Z\"),\n\t// \t\tLastUserUpdate: to.Ptr(\"2017-06-05T06:34:26.957Z\"),\n\t// \t\tNotificationQueueEnabled: to.Ptr(\"False\"),\n\t// \t\tPermanentErrorReason: to.Ptr(\"None\"),\n\t// \t\tRecordTypes: to.Ptr(\"Requests, Event, Exceptions, Metrics, PageViews, PageViewPerformance, Rdd, PerformanceCounters, Availability\"),\n\t// \t\tResourceGroup: to.Ptr(\"2\"),\n\t// \t\tStorageName: to.Ptr(\"mystorageblob\"),\n\t// \t\tSubscriptionID: to.Ptr(\"subid\"),\n\t// }}\n}", "title": "" }, { "docid": "f0ab67f3c00d37a0a1a382227f8979b5", "score": "0.55081236", "text": "func (ra *RenameAnalysis) ListConfigurationOptions() []core.ConfigurationOption {\n\toptions := [...]core.ConfigurationOption{{\n\t\tName: ConfigRenameAnalysisSimilarityThreshold,\n\t\tDescription: \"The threshold on the similarity index used to detect renames.\",\n\t\tFlag: \"M\",\n\t\tType: core.IntConfigurationOption,\n\t\tDefault: RenameAnalysisDefaultThreshold}, {\n\t\tName: ConfigRenameAnalysisTimeout,\n\t\tDescription: \"The maximum time (milliseconds) allowed to spend computing \" +\n\t\t\t\"renames in a single commit. 0 sets the default.\",\n\t\tFlag: \"renames-timeout\",\n\t\tType: core.IntConfigurationOption,\n\t\tDefault: RenameAnalysisDefaultTimeout},\n\t}\n\treturn options[:]\n}", "title": "" }, { "docid": "de3882bb66b01e2827eda7dde07d9e78", "score": "0.5507448", "text": "func (ncr *NamespacedConfigMapReflector) List() ([]interface{}, error) {\n\treturn virtualkubelet.List[virtualkubelet.Lister[*corev1.ConfigMap], *corev1.ConfigMap](\n\t\tncr.localConfigMaps,\n\t\tncr.remoteConfigMaps,\n\t)\n}", "title": "" }, { "docid": "22b91578456e39848b88ceecc747b03d", "score": "0.5498235", "text": "func (as *AutoScaling) DescribeLaunchConfigurations(confnames []string) (\n\tresp *LaunchConfigurationResp, err error) {\n\tparams := makeParams(\"DescribeLaunchConfigurations\")\n\taddParamsList(params, \"LaunchConfigurationNames.member\", confnames)\n\tresp = &LaunchConfigurationResp{}\n\terr = as.query(params, resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "a356d4c071fa2fa47c777c1e48dfe474", "score": "0.54897034", "text": "func (s *addonsConfigurationLister) List(selector labels.Selector) (ret []*v1alpha1.AddonsConfiguration, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.AddonsConfiguration))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "e885098190308a4beea20d86aaae1b35", "score": "0.54886115", "text": "func (s *storeToConfigMapLister) List() (cfgm v1.ConfigMapList, err error) {\n\tfor _, m := range s.Store.List() {\n\t\tcfgm.Items = append(cfgm.Items, *(m.(*v1.ConfigMap)))\n\t}\n\treturn cfgm, nil\n}", "title": "" }, { "docid": "733712ba1f1ab866760e89f48e5f3d52", "score": "0.5481199", "text": "func (_e *MockQueryCoord_Expecter) ShowConfigurations(ctx interface{}, req interface{}) *MockQueryCoord_ShowConfigurations_Call {\n\treturn &MockQueryCoord_ShowConfigurations_Call{Call: _e.mock.On(\"ShowConfigurations\", ctx, req)}\n}", "title": "" }, { "docid": "ee3b995d92ae178b0f402d040395f7f6", "score": "0.5433084", "text": "func (m *RuleConfigManager) List(opts ...RequestOption) (r []*RuleConfig, err error) {\n\terr = m.Request(\"GET\", m.URI(\"rules-configs\"), &r, applyListDefaults(opts))\n\treturn\n}", "title": "" }, { "docid": "8572fb9cc4c3060189660f937cf1bc53", "score": "0.5432778", "text": "func ExampleLinkerClient_ListConfigurations() {\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 := armservicelinker.NewClientFactory(cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewLinkerClient().ListConfigurations(ctx, \"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app\", \"linkName\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.SourceConfigurationResult = armservicelinker.SourceConfigurationResult{\n\t// \tConfigurations: []*armservicelinker.SourceConfiguration{\n\t// \t\t{\n\t// \t\t\tName: to.Ptr(\"ASL_DocumentDb_ConnectionString\"),\n\t// \t\t\tValue: to.Ptr(\"ConnectionString\"),\n\t// \t}},\n\t// }\n}", "title": "" }, { "docid": "9e0ba573de17d5f510c9de069b72c9b8", "score": "0.54309005", "text": "func (r *FloodlightConfigurationsService) List(profileId int64) *FloodlightConfigurationsListCall {\n\tc := &FloodlightConfigurationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\treturn c\n}", "title": "" }, { "docid": "4c733e66b62c2d0a7e4c14dbda50a223", "score": "0.54164433", "text": "func (c *FakeKconfigs) List(opts v1.ListOptions) (result *v1alpha1.KconfigList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(kconfigsResource, kconfigsKind, c.ns, opts), &v1alpha1.KconfigList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.KconfigList{ListMeta: obj.(*v1alpha1.KconfigList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.KconfigList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "title": "" }, { "docid": "dd15417031ad12816a04cf2952acacf3", "score": "0.5405928", "text": "func (ds DataSource) List(scope scope.Scope) (map[string]string, error) {\n\treturn gitconfiglegacy.List(scope)\n}", "title": "" }, { "docid": "ea59fdea0656a61a8a49120182f28bc9", "score": "0.53929454", "text": "func (s elasticBeanstalkConfigurationTemplateNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ElasticBeanstalkConfigurationTemplate, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.ElasticBeanstalkConfigurationTemplate))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "d03f573b811692be15c2e088306cf373", "score": "0.5386106", "text": "func (a *Client) ListTableConfigs(params *ListTableConfigsParams) (*ListTableConfigsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListTableConfigsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"listTableConfigs\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/tables\",\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: &ListTableConfigsReader{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.(*ListTableConfigsOK)\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 listTableConfigs: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "36c85cb9427090b530913e68af139533", "score": "0.5359713", "text": "func (s oIDCProviderConfigNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.OIDCProviderConfig, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.OIDCProviderConfig))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "13b485bac499f25627535afd78d1e03d", "score": "0.53541255", "text": "func (client *WebAppsClient) listConfigurationsHandleResponse(resp *http.Response) (WebAppsListConfigurationsResponse, error) {\n\tresult := WebAppsListConfigurationsResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResourceCollection); err != nil {\n\t\treturn WebAppsListConfigurationsResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "46050c171ac28778922c7540a33cfe7a", "score": "0.5349326", "text": "func ListConfig() cli.Command {\n\tr := routesCmd{}\n\treturn cli.Command{\n\t\tName: \"route\",\n\t\tUsage: \"List configuration key/value pairs for this route\",\n\t\tDescription: \"This command returs a list of configurations for a route.\",\n\t\tAliases: []string{\"routes\", \"r\"},\n\t\tCategory: \"MANAGEMENT COMMAND\",\n\t\tBefore: func(c *cli.Context) error {\n\t\t\tvar err error\n\t\t\tr.provider, err = client.CurrentProvider()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tr.client = r.provider.APIClient()\n\t\t\treturn nil\n\t\t},\n\t\tArgsUsage: \"<app-name> </path>\",\n\t\tAction: r.listConfig,\n\t}\n}", "title": "" }, { "docid": "0deb9640700d7e9589928c87ebc431f7", "score": "0.53343755", "text": "func (c *Client) ListDeploymentConfigs(selector string) ([]appsv1.DeploymentConfig, error) {\n\tvar dcList *appsv1.DeploymentConfigList\n\tvar err error\n\n\tif selector != \"\" {\n\t\tdcList, err = c.appsClient.DeploymentConfigs(c.Namespace).List(context.TODO(), metav1.ListOptions{\n\t\t\tLabelSelector: selector,\n\t\t})\n\t} else {\n\t\tdcList, err = c.appsClient.DeploymentConfigs(c.Namespace).List(context.TODO(), metav1.ListOptions{\n\t\t\tFieldSelector: fields.Set{\"metadata.namespace\": c.Namespace}.AsSelector().String(),\n\t\t})\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to list DeploymentConfigs\")\n\t}\n\treturn dcList.Items, nil\n}", "title": "" }, { "docid": "d59b0f2b82fccc413a49b432b48d01e5", "score": "0.5329089", "text": "func (s postgresqlConfigurationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.PostgresqlConfiguration, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.PostgresqlConfiguration))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "86de27033ed4ee7e1789a6fa54221c67", "score": "0.5315439", "text": "func (s addonsConfigurationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.AddonsConfiguration, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.AddonsConfiguration))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "7bf2639a21fe9c4fbd930a58a028d70e", "score": "0.530437", "text": "func (s *baremetalMachineProviderConfigLister) List(selector labels.Selector) (ret []*v1alpha1.BaremetalMachineProviderConfig, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.BaremetalMachineProviderConfig))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "8d9280ed3336fb804bc0958ac218ed18", "score": "0.52990675", "text": "func (s *Split) Configurations() map[string]string {\n\treturn s.splitData.Configurations\n}", "title": "" }, { "docid": "12a1b5b54b43e271db185e7893d974e3", "score": "0.52961737", "text": "func (cfg *Config) ListConfigFiles() []string {\n\tobjects := cfg.Client.ListObjects(configBucket, \"\", true, make(chan struct{}, 1))\n\tresults := []string{}\n\tfor object := range objects {\n\t\tresults = append(results, object.Key)\n\t}\n\treturn results\n}", "title": "" }, { "docid": "f3189471de03b6ebea00a8f43b483ba8", "score": "0.5293135", "text": "func (h *handler) ListSettings(ctx context.Context) ([]string, error) {\n\treturn h.setting.SettingsList(ctx)\n}", "title": "" }, { "docid": "1a3f0a3b99bceeb0a072cda63d7120fb", "score": "0.5289513", "text": "func (s *backendConfigLister) List(selector labels.Selector) (ret []*v1.BackendConfig, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.BackendConfig))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "3410a00e30d8154b126851551b015ec5", "score": "0.5269061", "text": "func (project *ProjectV1) ListConfigsWithContext(ctx context.Context, listConfigsOptions *ListConfigsOptions) (result *ProjectConfigCollection, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(listConfigsOptions, \"listConfigsOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(listConfigsOptions, \"listConfigsOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"project_id\": *listConfigsOptions.ProjectID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = project.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects/{project_id}/configs`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range listConfigsOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"project\", \"V1\", \"ListConfigs\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\tif listConfigsOptions.Version != nil {\n\t\tbuilder.AddQuery(\"version\", fmt.Sprint(*listConfigsOptions.Version))\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = project.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalProjectConfigCollection)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "31ea56ca64d854074db490690e77c784", "score": "0.5268987", "text": "func (a *AdminClient) DescribeConfigs(ctx context.Context, resources []ConfigResource, options ...DescribeConfigsAdminOption) (result []ConfigResourceResult, err error) {\n\terr = a.verifyClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcRes := make([]*C.rd_kafka_ConfigResource_t, len(resources))\n\n\tcErrstrSize := C.size_t(512)\n\tcErrstr := (*C.char)(C.malloc(cErrstrSize))\n\tdefer C.free(unsafe.Pointer(cErrstr))\n\n\t// Convert Go ConfigResources to C ConfigResources\n\tfor i, res := range resources {\n\t\tcRes[i] = C.rd_kafka_ConfigResource_new(\n\t\t\tC.rd_kafka_ResourceType_t(res.Type), C.CString(res.Name))\n\t\tif cRes[i] == nil {\n\t\t\treturn nil, newErrorFromString(ErrInvalidArg,\n\t\t\t\tfmt.Sprintf(\"Invalid arguments for resource %v\", res))\n\t\t}\n\n\t\tdefer C.rd_kafka_ConfigResource_destroy(cRes[i])\n\t}\n\n\t// Convert Go AdminOptions (if any) to C AdminOptions\n\tgenericOptions := make([]AdminOption, len(options))\n\tfor i := range options {\n\t\tgenericOptions[i] = options[i]\n\t}\n\tcOptions, err := adminOptionsSetup(a.handle, C.RD_KAFKA_ADMIN_OP_DESCRIBECONFIGS, genericOptions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer C.rd_kafka_AdminOptions_destroy(cOptions)\n\n\t// Create temporary queue for async operation\n\tcQueue := C.rd_kafka_queue_new(a.handle.rk)\n\tdefer C.rd_kafka_queue_destroy(cQueue)\n\n\t// Asynchronous call\n\tC.rd_kafka_DescribeConfigs(\n\t\ta.handle.rk,\n\t\t(**C.rd_kafka_ConfigResource_t)(&cRes[0]),\n\t\tC.size_t(len(cRes)),\n\t\tcOptions,\n\t\tcQueue)\n\n\t// Wait for result, error or context timeout\n\trkev, err := a.waitResult(ctx, cQueue, C.RD_KAFKA_EVENT_DESCRIBECONFIGS_RESULT)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer C.rd_kafka_event_destroy(rkev)\n\n\tcResult := C.rd_kafka_event_DescribeConfigs_result(rkev)\n\n\t// Convert results from C to Go\n\tvar cCnt C.size_t\n\tcResults := C.rd_kafka_DescribeConfigs_result_resources(cResult, &cCnt)\n\n\treturn a.cConfigResourceToResult(cResults, cCnt)\n}", "title": "" }, { "docid": "01090ff40da2da07badd0fb699a12043", "score": "0.52672666", "text": "func (r *ECMResource) ListAll() (*ECMConfigList, error) {\n\tvar list ECMConfigList\n\tif err := r.c.ReadQuery(BasePath+ECMEndpoint, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &list, nil\n}", "title": "" }, { "docid": "358b6aedfcc8bc9bc7757e5afff0dbd4", "score": "0.5258411", "text": "func (s *Secrets) List(ctx context.Context, ns, labelSelector string) ([]v1.Secret, error) {\n\tsList, err := s.k8sClient.CoreV1().Secrets(ns).List(ctx, metav1.ListOptions{LabelSelector: labelSelector})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sList.Items, nil\n}", "title": "" }, { "docid": "35cf5846ab5347e2337224a36ec44935", "score": "0.5256131", "text": "func (opts ListConfigurationsOptions) toConfig() listConfigurationsConfig {\n\tcfg := listConfigurationsConfig{}\n\n\tfor _, v := range opts {\n\t\tv(&cfg)\n\t}\n\n\treturn cfg\n}", "title": "" }, { "docid": "405540e35debd8179d3507cd5eb501cd", "score": "0.5250558", "text": "func (s *ListConfigurationsOutput) SetConfigurations(v []map[string]*string) *ListConfigurationsOutput {\n\ts.Configurations = v\n\treturn s\n}", "title": "" }, { "docid": "fa487b7691ba496a95a88513ca05c04f", "score": "0.52473783", "text": "func (api *configurationsnapshotAPI) ApisrvList(ctx context.Context, opts *api.ListWatchOptions) ([]*cluster.ConfigurationSnapshot, error) {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn apicl.ClusterV1().ConfigurationSnapshot().List(context.Background(), opts)\n\t}\n\n\t// List from local cache\n\tctkitObjs, err := api.List(ctx, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar ret []*cluster.ConfigurationSnapshot\n\tfor _, obj := range ctkitObjs {\n\t\tret = append(ret, &obj.ConfigurationSnapshot)\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "57e38f576d6474064254e740af585688", "score": "0.5235864", "text": "func (hc *Hailconfig) ListConfigProperties(w io.Writer) {\n\tt := table.NewWriter()\n\tt.SetOutputMirror(w)\n\tt.AppendHeader(table.Row{\"Name\", \"Value\"})\n\tt.AppendRow([]interface{}{\"title\", hc.config.Title})\n\tt.AppendSeparator()\n\tt.AppendRow([]interface{}{\"interpreter\", hc.config.Interpreter})\n\tt.Render()\n}", "title": "" }, { "docid": "3153ff4957fa576ad966643074894912", "score": "0.5235326", "text": "func ListConfigurationStoreKeyValue(ctx *pulumi.Context, args *ListConfigurationStoreKeyValueArgs, opts ...pulumi.InvokeOption) (*ListConfigurationStoreKeyValueResult, error) {\n\tvar rv ListConfigurationStoreKeyValueResult\n\terr := ctx.Invoke(\"azure-native:appconfiguration/v20191101preview:listConfigurationStoreKeyValue\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "af58d6977765cdb01285cc67f8295ef3", "score": "0.52272105", "text": "func (operator *AccessOperator) ListConfigSetByApp(cxt context.Context, appName string) ([]*common.ConfigSet, error) {\n\t//query business and app first\n\tbusiness, app, err := getBusinessAndApp(operator, operator.Business, appName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trequest := &accessserver.QueryConfigSetListReq{\n\t\tSeq: pkgcommon.Sequence(),\n\t\tBid: business.Bid,\n\t\tAppid: app.Appid,\n\t\tIndex: operator.index,\n\t\tLimit: operator.limit,\n\t}\n\tgrpcOptions := []grpc.CallOption{\n\t\tgrpc.WaitForReady(true),\n\t}\n\tresponse, err := operator.Client.QueryConfigSetList(cxt, request, grpcOptions...)\n\tif err != nil {\n\t\tlogger.V(3).Infof(\"ListConfigSetByApp failed, %s\", err.Error())\n\t\treturn nil, err\n\t}\n\tif response.ErrCode != common.ErrCode_E_OK {\n\t\tlogger.V(3).Infof(\"ListConfigSetByApp all successfully, but response Err, %s\", response.ErrMsg)\n\t\treturn nil, fmt.Errorf(\"%s\", response.ErrMsg)\n\t}\n\treturn response.ConfigSets, nil\n}", "title": "" }, { "docid": "05f8c6e188e1e2d491d8017570501ffa", "score": "0.52170426", "text": "func (m *Manager) ListSettings(in *grpc_organization_go.OrganizationId) ([]entities.OrganizationSetting, derrors.Error) {\n\t// check if the organization exists\n\texists, err := m.Provider.Exists(in.OrganizationId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, derrors.NewNotFoundError(\"organization\").WithParams(in.OrganizationId)\n\t}\n\n\treturn m.SettingProvider.List(in.OrganizationId)\n}", "title": "" }, { "docid": "6b821469c007df7204e761ae957654fb", "score": "0.52150035", "text": "func (p *Provider) List() ([]string, error) {\n\treturn p.provider.ListClusters()\n}", "title": "" }, { "docid": "255bb7cbb216a8ffa970229dd4b8e277", "score": "0.51999974", "text": "func (s baremetalMachineProviderConfigNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.BaremetalMachineProviderConfig, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.BaremetalMachineProviderConfig))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "c2512eb8556722bf1c3c97bfc42e7bd4", "score": "0.5194051", "text": "func (c *Client) ListFirewallConfigs(ctx context.Context, params *ListFirewallConfigsInput, optFns ...func(*Options)) (*ListFirewallConfigsOutput, error) {\n\tif params == nil {\n\t\tparams = &ListFirewallConfigsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListFirewallConfigs\", params, optFns, addOperationListFirewallConfigsMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListFirewallConfigsOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "5d51d811b7b15fe9f7f87776d1420c32", "score": "0.518716", "text": "func (c *Config) List(name string) (keys []string, err error) {\n\tconfigDir, err := c.configDirectory()\n\tif err != nil {\n\t\treturn\n\t}\n\tdir := path.Join(configDir, name)\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor _, file := range files {\n\t\tkeys = append(keys, file.Name())\n\t}\n\tsort.Strings(keys)\n\treturn\n}", "title": "" }, { "docid": "6e8cec64c64964932d8b8b1138c81320", "score": "0.5184558", "text": "func (c *configHandler) getAllConfigs(w http.ResponseWriter, r *http.Request) {\n log.Printf(\"received /configs GET request from %v\", r.Host)\n configs := make([]Config, len(c.database))\n\n c.Lock()\n i :=0\n for _, config := range c.database {\n configs[i] = config\n i++\n }\n c.Unlock()\n\n responsejson, err := json.Marshal(configs)\n if err != nil {\n w.WriteHeader(http.StatusInternalServerError)\n w.Write([]byte(err.Error()))\n }\n\n w.Header().Add(\"content-type\", \"application/json\")\n w.WriteHeader(http.StatusOK)\n w.Write(responsejson)\n}", "title": "" }, { "docid": "ec931e79194b91e09926034f640f748c", "score": "0.51811117", "text": "func DisConfList(c *gin.Context) {\n\tsearchDir := disconfDir + \"\" + c.Query(\"path\")\n\tfileList := []string{}\n\terr := filepath.Walk(searchDir, func(path string, f os.FileInfo, err error) error {\n\t\tfileList = append(fileList, path)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlogrus.Error(\"error list file.\")\n\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, struct {\n\t\tFileList []string\n\t}{fileList})\n}", "title": "" }, { "docid": "460fafb6c166fa886a9cb98be0e7666d", "score": "0.5145789", "text": "func (s *federatedConfigMapLister) List(selector labels.Selector) (ret []*v1beta1.FederatedConfigMap, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1beta1.FederatedConfigMap))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "2c3e3f6680d04b39a8939aa5b4836f1f", "score": "0.514371", "text": "func (c *ThreeScaleClient) ListProxyConfig(svcId string, env string) (ProxyConfigList, error) {\n\tvar pc ProxyConfigList\n\n\tendpoint := fmt.Sprintf(proxyConfigList, svcId, env)\n\treq, err := c.buildGetReq(endpoint)\n\tif err != nil {\n\t\treturn pc, httpReqError\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\tvalues := url.Values{}\n\treq.URL.RawQuery = values.Encode()\n\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn pc, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\terr = handleJsonResp(resp, http.StatusOK, &pc)\n\treturn pc, err\n}", "title": "" }, { "docid": "5f9019dbfa7e0bc3b4980113a231ffe5", "score": "0.513909", "text": "func (c *client) List() ([]Buildpack, error) {\n\tcfg, err := c.fetchConfig()\n\tif err != nil || cfg == nil {\n\t\treturn nil, err\n\t}\n\n\tvar order struct {\n\t\tBuildpacks []Buildpack `json:\"buildpacks\"`\n\t}\n\tif err := json.NewDecoder(strings.NewReader(cfg.Config.Labels[metadataLabel])).Decode(&order); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn order.Buildpacks, nil\n}", "title": "" }, { "docid": "5e081c3b5c3cae69b78ea0bb2df462dd", "score": "0.51359653", "text": "func PoolConfigs() (map[string]interface{}, error) {\n\tcmd := &Cmd{}\n\tres := make(map[string]interface{})\n\terr := NvlistIoctl(zfsHandle.Fd(), ZFS_IOC_POOL_CONFIGS, \"\", cmd, nil, res, nil)\n\treturn res, err\n}", "title": "" }, { "docid": "74b75ca06dc014630595875493ad5289", "score": "0.5134123", "text": "func DCList(dcs ...appsapi.DeploymentConfig) appsapi.DeploymentConfigList {\n\treturn appsapi.DeploymentConfigList{\n\t\tItems: dcs,\n\t}\n}", "title": "" }, { "docid": "305a4bc838c032743ef58df251106ca5", "score": "0.51279116", "text": "func (c *FakeRBACSyncConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha.RBACSyncConfigList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(rbacsyncconfigsResource, rbacsyncconfigsKind, c.ns, opts), &v1alpha.RBACSyncConfigList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha.RBACSyncConfigList{ListMeta: obj.(*v1alpha.RBACSyncConfigList).ListMeta}\n\tfor _, item := range obj.(*v1alpha.RBACSyncConfigList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "title": "" }, { "docid": "0ffc1d2618e002e0f008f0b96403cf6c", "score": "0.5112132", "text": "func (a *MonitorsApi) ListMonitorConfigPolicies(ctx _context.Context) (MonitorConfigPolicyListResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarReturnValue MonitorConfigPolicyListResponse\n\t)\n\n\tlocalBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, \"v2.MonitorsApi.ListMonitorConfigPolicies\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v2/monitor/policy\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tlocalVarHeaderParams[\"Accept\"] = \"application/json\"\n\n\tdatadog.SetAuthKeys(\n\t\tctx,\n\t\t&localVarHeaderParams,\n\t\t[2]string{\"apiKeyAuth\", \"DD-API-KEY\"},\n\t\t[2]string{\"appKeyAuth\", \"DD-APPLICATION-KEY\"},\n\t)\n\treq, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)\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 := datadog.ReadBody(localVarHTTPResponse)\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := datadog.GenericOpenAPIError{\n\t\t\tErrorBody: localVarBody,\n\t\t\tErrorMessage: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.ErrorModel = 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 := datadog.GenericOpenAPIError{\n\t\t\tErrorBody: localVarBody,\n\t\t\tErrorMessage: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "681e254c3850ea5a09dfd7c7ade8bfe6", "score": "0.51085633", "text": "func (client *Client) DescribeScalingConfigurations(request *DescribeScalingConfigurationsRequest) (response *DescribeScalingConfigurationsResponse, err error) {\n\tresponse = CreateDescribeScalingConfigurationsResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "0da349b77dfff43f9dc665f53316cb43", "score": "0.50889933", "text": "func (s *kubeletConfigLister) List(selector labels.Selector) (ret []*v1.KubeletConfig, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.KubeletConfig))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "c628e3300e6337a5fdff0a262ce8d0eb", "score": "0.50852793", "text": "func (c *client) List(sType, org, name string, page, perPage int) ([]*library.Secret, error) {\n\tlogrus.Tracef(\"Listing native %s secrets for %s/%s\", sType, org, name)\n\n\t// capture the list of secrets from the native service\n\ts, err := c.Native.GetTypeSecretList(sType, org, name, page, perPage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "87970868da677807adc1772ad6d8c7f2", "score": "0.50718576", "text": "func NewExtensionMonitoringConfigurationsList(totalCount int64) *ExtensionMonitoringConfigurationsList {\n\tthis := ExtensionMonitoringConfigurationsList{}\n\tthis.TotalCount = totalCount\n\treturn &this\n}", "title": "" }, { "docid": "846c78a0ea258ececf0d33fac943b08a", "score": "0.5071405", "text": "func (a SecretAclsAPI) List(scope string) ([]ACLItem, error) {\n\tvar aclItem struct {\n\t\tItems []ACLItem `json:\"items,omitempty\"`\n\t}\n\terr := a.client.Get(\"/secrets/acls/list\", map[string]string{\n\t\t\"scope\": scope,\n\t}, &aclItem)\n\treturn aclItem.Items, err\n}", "title": "" }, { "docid": "ddc415b9bab16e1edfb33ff2f06726c5", "score": "0.5069524", "text": "func ConfigFileList() ([]string, error) {\n\tccm_path := os.Getenv(\"CCM_REPO_PATH\")\n\tconfig_file_path := ccm_path + \"/ccm_configs/\"\n\t//fmt.Println(config_file_path)\n\tfile_data, err := ioutil.ReadDir(config_file_path)\n\tERRHandler(err, \"read ccm_configs dir\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar ConfigFiles []string\n\tfor _, file_info := range file_data {\n\t\tconfig_file := file_info.Name()\n\t\tConfigFiles = append(ConfigFiles, config_file)\n\t}\n\n\treturn ConfigFiles, nil\n}", "title": "" }, { "docid": "178f4bc39f0ca01645f538e87e4fcda3", "score": "0.5058013", "text": "func (d *Dao) Configs(c context.Context) (res map[string]string, err error) {\n\tvar rows *sql.Rows\n\tif rows, err = d.db.Query(c, _getAllConfigSQL); err != nil {\n\t\tlog.Error(\"d.getAllConfigSQL.Query error(%v)\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tres = map[string]string{}\n\tfor rows.Next() {\n\t\tvar r model.Config\n\t\tif err = rows.Scan(&r.ID, &r.Property, &r.Name, &r.Val, &r.Ctime); err != nil {\n\t\t\tlog.Error(\"row.Scan() error(%v)\", err)\n\t\t\tres = nil\n\t\t\treturn\n\t\t}\n\t\tres[r.Property] = r.Val\n\t}\n\terr = rows.Err()\n\treturn\n}", "title": "" }, { "docid": "56d82083cfb59ad1bc919884b3812220", "score": "0.50475556", "text": "func (client *WebAppsClient) listConfigurationsSlotHandleResponse(resp *http.Response) (WebAppsListConfigurationsSlotResponse, error) {\n\tresult := WebAppsListConfigurationsSlotResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResourceCollection); err != nil {\n\t\treturn WebAppsListConfigurationsSlotResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "dc338a8155a77a16ae37aef06a373be3", "score": "0.5046851", "text": "func GetConfigs() map[string]interface{} {\n\treturn DefaultConf.ConfigFactory.GetConfigurations()\n}", "title": "" }, { "docid": "b56de16c192cb914d8f982eda473778e", "score": "0.5044829", "text": "func (hc *Hailconfig) List() error {\n\tcols, _ := consolesize.GetConsoleSize()\n\tmaxLenAlias := 25\n\tmaxLenCommand := 80\n\tmaxLenDescription := 25\n\tif cols > 10 {\n\t\tmaxLenAlias = cols/4 - 5\n\t\tmaxLenCommand = cols / 2\n\t\tmaxLenDescription = cols/4 - 5\n\t}\n\n\tt := table.NewWriter()\n\tt.SetOutputMirror(os.Stdout)\n\tt.AppendHeader(table.Row{\"Alias\", \"Command\", \"Description\"})\n\tt.SetColumnConfigs([]table.ColumnConfig{\n\t\t{\n\t\t\tName: \"Alias\",\n\t\t\tWidthMin: 5,\n\t\t\tWidthMax: maxLenAlias,\n\t\t},\n\t\t{\n\t\t\tName: \"Command\",\n\t\t\tWidthMin: 10,\n\t\t\tWidthMax: maxLenCommand,\n\t\t}, {\n\t\t\tName: \"Description\",\n\t\t\tWidthMin: 5,\n\t\t\tWidthMax: maxLenDescription,\n\t\t},\n\t})\n\t//t.SetAllowedRowLength(90)\n\tfor alias, script := range hc.Scripts {\n\t\tt.AppendRow([]interface{}{alias, script.Command, script.Description})\n\t\tt.AppendSeparator()\n\t}\n\tt.Render()\n\treturn nil\n}", "title": "" }, { "docid": "55dbe8ce1f3299de6160e30a7aecf1ae", "score": "0.50418764", "text": "func (c *FakeAddonConfigs) List(opts v1.ListOptions) (result *kubermaticv1.AddonConfigList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewRootListAction(addonconfigsResource, addonconfigsKind, opts), &kubermaticv1.AddonConfigList{})\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &kubermaticv1.AddonConfigList{ListMeta: obj.(*kubermaticv1.AddonConfigList).ListMeta}\n\tfor _, item := range obj.(*kubermaticv1.AddonConfigList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "title": "" }, { "docid": "20d4640ceade1396c85c701c9b9b1eda", "score": "0.50413513", "text": "func (in *ConfigurationList) DeepCopy() *ConfigurationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "73eef718b9d32e8f01f9ace466c79d1e", "score": "0.5018779", "text": "func (v *Vault) ListSecrets() {\n\tlog.Debugf(\"Listing secrets in Vault KV Path: %v\", s.VaultKVPath())\n\td, err := v.Client.Logical().List(s.VaultKVPath())\n\tif err != nil {\n\t\tlog.Fatalf(\"Vault error: %v\", err)\n\t}\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Key\"})\n\tfor _, l := range d.Data[\"keys\"].([]interface{}) {\n\t\ttable.Append([]string{l.(string)})\n\t}\n\ttable.Render()\n}", "title": "" }, { "docid": "3fdb0278ccfe108739a82a5c95a53737", "score": "0.5012064", "text": "func (r *VCMPResource) ListAll() (*VCMPConfigList, error) {\n\tvar list VCMPConfigList\n\tif err := r.c.ReadQuery(BasePath+VCMPEndpoint, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &list, nil\n}", "title": "" } ]
9647b873210526979d097a3177472b54
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
[ { "docid": "3bd110cdc80a2f3472ac8ef7274c6556", "score": "0.0", "text": "func (in *RouteSpec) DeepCopyInto(out *RouteSpec) {\n\t*out = *in\n\tin.Match.DeepCopyInto(&out.Match)\n\tif in.To != nil {\n\t\tin, out := &in.To, &out.To\n\t\t*out = make([]WeightedDestination, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Redirect != nil {\n\t\tin, out := &in.Redirect, &out.Redirect\n\t\t*out = new(Redirect)\n\t\t**out = **in\n\t}\n\tif in.Rewrite != nil {\n\t\tin, out := &in.Rewrite, &out.Rewrite\n\t\t*out = new(Rewrite)\n\t\t**out = **in\n\t}\n\tif in.Retry != nil {\n\t\tin, out := &in.Retry, &out.Retry\n\t\t*out = new(Retry)\n\t\t**out = **in\n\t}\n\tif in.Headers != nil {\n\t\tin, out := &in.Headers, &out.Headers\n\t\t*out = new(HeaderOperations)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.Fault != nil {\n\t\tin, out := &in.Fault, &out.Fault\n\t\t*out = new(Fault)\n\t\t**out = **in\n\t}\n\tif in.Mirror != nil {\n\t\tin, out := &in.Mirror, &out.Mirror\n\t\t*out = new(Destination)\n\t\t**out = **in\n\t}\n\tif in.TimeoutSeconds != nil {\n\t\tin, out := &in.TimeoutSeconds, &out.TimeoutSeconds\n\t\t*out = new(int)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "af1158730de2f0e70ad56fca78135468", "score": "0.8213356", "text": "func (r *RunInfo) DeepCopyInto(out *RunInfo) {\n\t*out = *r\n}", "title": "" }, { "docid": "cf52e209065280c6fd5fa28ba55d00fb", "score": "0.8126085", "text": "func (in *Base) DeepCopyInto(out *Base) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8f44d51096d32fdfe374fc95976e42e3", "score": "0.81016994", "text": "func (in *ForkObject) DeepCopyInto(out *ForkObject) {\n\t*out = *in\n}", "title": "" }, { "docid": "3bb218cf07f9cbcca9c1cc1e4f90557a", "score": "0.8084519", "text": "func (in *TargetObjectInfo) DeepCopyInto(out *TargetObjectInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "7b89e3d0936cf89677cab2ae359aa48f", "score": "0.808198", "text": "func (in *DebugObjectInfo) DeepCopyInto(out *DebugObjectInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "21a4dc0bd810e7ad7e5a1989d07e436c", "score": "0.80653447", "text": "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n}", "title": "" }, { "docid": "4aa05aeda5796a540bd75503655e4335", "score": "0.8062857", "text": "func (u *SSN) DeepCopyInto(out *SSN) {\n\t*out = *u\n}", "title": "" }, { "docid": "150dc262c7e80c0c5efc198e717bb672", "score": "0.80252475", "text": "func (in *ExistPvc) DeepCopyInto(out *ExistPvc) {\n\t*out = *in\n}", "title": "" }, { "docid": "c067d81aecf1209d2e46c570f838150f", "score": "0.80096555", "text": "func (in *DockerStep) DeepCopyInto(out *DockerStep) {\n\t*out = *in\n\tif in.Inline != nil {\n\t\tin, out := &in.Inline, &out.Inline\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tout.Auth = in.Auth\n\treturn\n}", "title": "" }, { "docid": "fcd73bcfed9455cd87601682e4ad29c0", "score": "0.79938054", "text": "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.Command != nil {\n\t\tin, out := &in.Command, &out.Command\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.LifeCycleScript != nil {\n\t\tin, out := &in.LifeCycleScript, &out.LifeCycleScript\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "710da614f56a1fb0eca6a6128897b83b", "score": "0.7990593", "text": "func (in *RuntimeRef) DeepCopyInto(out *RuntimeRef) {\n\t*out = *in\n}", "title": "" }, { "docid": "5b0ae3bc7e3bd108e7859ef8990e0473", "score": "0.79874957", "text": "func (in *Ibft2) DeepCopyInto(out *Ibft2) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "87cf7c6678a506b2791e1c30d1d4540c", "score": "0.7984788", "text": "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "87cf7c6678a506b2791e1c30d1d4540c", "score": "0.7984788", "text": "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "943731dcc5b0dd132eeb06116f982bdd", "score": "0.79846936", "text": "func (in *TestResult) DeepCopyInto(out *TestResult) {\n\t*out = *in\n}", "title": "" }, { "docid": "75f3168b26f729025d12f8916352eeec", "score": "0.7983698", "text": "func (in *Haproxy) DeepCopyInto(out *Haproxy) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "885731d95003e6f9b658d976bd38dfdc", "score": "0.79741865", "text": "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f02ca9d2b982235afe15ba0d467caec5", "score": "0.7970389", "text": "func (in *Runtime) DeepCopyInto(out *Runtime) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.79674816", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.79674816", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.79674816", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "7f7effc920f92688054d1b82f5296237", "score": "0.79669946", "text": "func (b *Base64) DeepCopyInto(out *Base64) {\n\t*out = *b\n}", "title": "" }, { "docid": "9821b63fb0f1d90e082fd6d5c30e67f5", "score": "0.79599875", "text": "func (in *EventDependencyTransformer) DeepCopyInto(out *EventDependencyTransformer) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "879dcea77d509081e8fcedbe90f595e8", "score": "0.795973", "text": "func (in *StageOutput) DeepCopyInto(out *StageOutput) {\n\t*out = *in\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7943344", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7943344", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3bca37b1bd60a60d3b9082d9dcfdc522", "score": "0.7942179", "text": "func (in *Dependent) DeepCopyInto(out *Dependent) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "39267c08938a4911205ad5cc84e6dd7a", "score": "0.79414415", "text": "func (in *GitFileGeneratorItem) DeepCopyInto(out *GitFileGeneratorItem) {\n\t*out = *in\n}", "title": "" }, { "docid": "92bd0f9f52c488e2823218fc03f28117", "score": "0.79397684", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "92bd0f9f52c488e2823218fc03f28117", "score": "0.79397684", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "bf51554e15947a4b199f2bc289c3d6ac", "score": "0.79372966", "text": "func (in *AnsibleStep) DeepCopyInto(out *AnsibleStep) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "dac9107221cae585112f952b85a6eae2", "score": "0.79358184", "text": "func (in *Forks) DeepCopyInto(out *Forks) {\n\t*out = *in\n\tif in.DAO != nil {\n\t\tin, out := &in.DAO, &out.DAO\n\t\t*out = new(uint)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "f254b9a7e0b67c245be45d8e4adaf4be", "score": "0.7935006", "text": "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "title": "" }, { "docid": "971bb082bf27f56370b25e2f49552a78", "score": "0.79276186", "text": "func (in *General) DeepCopyInto(out *General) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "4e012cd4b271b374007162be15072ad7", "score": "0.7922576", "text": "func (in *IsoContainer) DeepCopyInto(out *IsoContainer) {\n\t*out = *in\n}", "title": "" }, { "docid": "055aae38d2d7fc9fbd9c9cf0639142fe", "score": "0.79145026", "text": "func (in *Git) DeepCopyInto(out *Git) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9cebf74d08091032bbd51670d93f0a45", "score": "0.79108834", "text": "func (in *ConfigFile) DeepCopyInto(out *ConfigFile) {\n\t*out = *in\n}", "title": "" }, { "docid": "ca040e37b75301894d4e020357c94217", "score": "0.7909888", "text": "func (in *BackupProgress) DeepCopyInto(out *BackupProgress) {\n\t*out = *in\n}", "title": "" }, { "docid": "278b0099578018f680c5c5cde2a932e4", "score": "0.79079306", "text": "func (u *MAC) DeepCopyInto(out *MAC) {\n\t*out = *u\n}", "title": "" }, { "docid": "7a8e749b7a0b9845bb67a5f72049e1a5", "score": "0.7907861", "text": "func (in *DataDisk) DeepCopyInto(out *DataDisk) {\n\t*out = *in\n}", "title": "" }, { "docid": "9b532d431b3f33589b5f4ac91d132785", "score": "0.7906696", "text": "func (in *PhaseStep) DeepCopyInto(out *PhaseStep) {\n\t*out = *in\n}", "title": "" }, { "docid": "eae9a043ce1412b2407a7ae6b28a5fa1", "score": "0.7903708", "text": "func (in *Variable) DeepCopyInto(out *Variable) {\n\t*out = *in\n}", "title": "" }, { "docid": "663b7984e667455eca13bb2ce6cbc6d8", "score": "0.7903179", "text": "func (in *RestoreProgress) DeepCopyInto(out *RestoreProgress) {\n\t*out = *in\n}", "title": "" }, { "docid": "bcf09a71293c9cee0c34c2fa367e656b", "score": "0.7902649", "text": "func (in *Path) DeepCopyInto(out *Path) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "a7e5ae0f85566c0ffe05723461bfe630", "score": "0.7902327", "text": "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "a7e5ae0f85566c0ffe05723461bfe630", "score": "0.7902327", "text": "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f1b3ceb3a73df082502370d4536f56b3", "score": "0.7901929", "text": "func (in *NamespacedObjectReference) DeepCopyInto(out *NamespacedObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "ba66606acf4d3e4d73f3b8aa0a57fc16", "score": "0.79005504", "text": "func (in *GitDirectoryGeneratorItem) DeepCopyInto(out *GitDirectoryGeneratorItem) {\n\t*out = *in\n}", "title": "" }, { "docid": "af60d5ec0544d11ee9690f7efa32afaf", "score": "0.7897558", "text": "func (in *NamePath) DeepCopyInto(out *NamePath) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "1278f408cf2921c5a1408827ba5b2974", "score": "0.7895483", "text": "func (in *ConsoleCreateObj) DeepCopyInto(out *ConsoleCreateObj) {\n\t*out = *in\n}", "title": "" }, { "docid": "cc6567d23ec26fe179a078bfd443ef2c", "score": "0.7889539", "text": "func (in *UsedPipelineRun) DeepCopyInto(out *UsedPipelineRun) {\n\t*out = *in\n}", "title": "" }, { "docid": "8e6cd44cf22a86e44d327b252c26a32d", "score": "0.7888715", "text": "func (in *BuildTemplate) DeepCopyInto(out *BuildTemplate) {\n\t*out = *in\n\tif in.Cmd != nil {\n\t\tin, out := &in.Cmd, &out.Cmd\n\t\t*out = make([]BuildTemplateStep, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.7888293", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "32b00888211ff9ca3596125ceec6d7e7", "score": "0.7887502", "text": "func (in *ObjectInfo) DeepCopyInto(out *ObjectInfo) {\n\t*out = *in\n\tout.GroupVersionKind = in.GroupVersionKind\n\treturn\n}", "title": "" }, { "docid": "10dec41dc58994e25d9453a1d8f7ad21", "score": "0.78859216", "text": "func (in *Files) DeepCopyInto(out *Files) {\n\t*out = *in\n}", "title": "" }, { "docid": "2b0be71ab1164e9fb2820db9379c9305", "score": "0.78841585", "text": "func (in *Source) DeepCopyInto(out *Source) {\n\t*out = *in\n\tif in.Dependencies != nil {\n\t\tin, out := &in.Dependencies, &out.Dependencies\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MavenRepositories != nil {\n\t\tin, out := &in.MavenRepositories, &out.MavenRepositories\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "23db226639df1ec5bfce6ed220d55ed3", "score": "0.78836566", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "title": "" }, { "docid": "23db226639df1ec5bfce6ed220d55ed3", "score": "0.78836566", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "title": "" }, { "docid": "62c7419d1ac578ace62f5fa642ecc043", "score": "0.7882205", "text": "func (in *StackBuild) DeepCopyInto(out *StackBuild) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9dab74e557d1dbb5849857f762204168", "score": "0.787906", "text": "func (in *BuildTaskRef) DeepCopyInto(out *BuildTaskRef) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "fb1b1c23f90c3d83aa17368189a6a96c", "score": "0.78740764", "text": "func (in *PathInfo) DeepCopyInto(out *PathInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "dfd9b82d38c6fee08dd3cf0209bd1133", "score": "0.7873032", "text": "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "title": "" }, { "docid": "dfd9b82d38c6fee08dd3cf0209bd1133", "score": "0.7873032", "text": "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "title": "" }, { "docid": "6b8cc9ad5b8dc818b672eb6bf4bd944b", "score": "0.78708595", "text": "func (in *PoA) DeepCopyInto(out *PoA) {\n\t*out = *in\n}", "title": "" }, { "docid": "7c07976250a3e9b2c296a4afca67fd21", "score": "0.78696084", "text": "func (in *Section) DeepCopyInto(out *Section) {\n\t*out = *in\n\tif in.SecretRefs != nil {\n\t\tin, out := &in.SecretRefs, &out.SecretRefs\n\t\t*out = make([]SecretReference, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Files != nil {\n\t\tin, out := &in.Files, &out.Files\n\t\t*out = make([]FileMount, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" }, { "docid": "d04effc735adc59932f839adb9a5fcca", "score": "0.7869057", "text": "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "title": "" }, { "docid": "d02c4e245665db42aa7f449aedbc0217", "score": "0.78685385", "text": "func (in *DNSSelection) DeepCopyInto(out *DNSSelection) {\n\t*out = *in\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "cb984c73c4431bec89a8afbdfc556e69", "score": "0.7863212", "text": "func (in *ReleaseVersion) DeepCopyInto(out *ReleaseVersion) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5186b8d1bfd3abf2fb983694f27e4aed", "score": "0.7861394", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5186b8d1bfd3abf2fb983694f27e4aed", "score": "0.7861394", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5186b8d1bfd3abf2fb983694f27e4aed", "score": "0.7861394", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "65bb38f2dccf641027ebb99f4474f90d", "score": "0.7861163", "text": "func (in *PathRule) DeepCopyInto(out *PathRule) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "10baca6dfd622c5e40e8b794a851d6d3", "score": "0.78610516", "text": "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n\tif in.Flags != nil {\n\t\tin, out := &in.Flags, &out.Flags\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Value != nil {\n\t\tin, out := &in.Value, &out.Value\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "525a3c863697171a703a729224eaef7f", "score": "0.78584725", "text": "func (in *DockerLifecycleData) DeepCopyInto(out *DockerLifecycleData) {\n\t*out = *in\n}", "title": "" }, { "docid": "0fa3808d8d54265b095b04724cea6249", "score": "0.785615", "text": "func (in *RunScriptStepConfig) DeepCopyInto(out *RunScriptStepConfig) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "29e02c97b127087f995d6b0457b82abc", "score": "0.78555363", "text": "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "title": "" }, { "docid": "ce176c865d104baf77ca7c4291fc9f09", "score": "0.78546166", "text": "func (in *DomainNameOutput) DeepCopyInto(out *DomainNameOutput) {\n\t*out = *in\n}", "title": "" }, { "docid": "600681b5dce498f6a946514743145f67", "score": "0.78496337", "text": "func (in *InterfaceStruct) DeepCopyInto(out *InterfaceStruct) {\n\t*out = *in\n\tif in.val != nil {\n\t\tin, out := &in.val, &out.val\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" }, { "docid": "db1289a37e521177d35543e93aaa430a", "score": "0.784387", "text": "func (in *Ref) DeepCopyInto(out *Ref) {\n\t*out = *in\n}", "title": "" }, { "docid": "edd6c658e1a3b086682f942a63ac775e", "score": "0.7843478", "text": "func (in *MemorySpec) DeepCopyInto(out *MemorySpec) {\n\t*out = *in\n}", "title": "" }, { "docid": "e0d1dd39451b67a1f11ed52a331af2ed", "score": "0.78398615", "text": "func (in *BuildJenkinsInfo) DeepCopyInto(out *BuildJenkinsInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5696f71281f2bb9ad8b29e927ae7eab1", "score": "0.7835206", "text": "func (in *MaintenanceInfo) DeepCopyInto(out *MaintenanceInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "bd6157875cabfee84055615db9040fad", "score": "0.78349835", "text": "func (in *VirtualDatabaseBuildObject) DeepCopyInto(out *VirtualDatabaseBuildObject) {\n\t*out = *in\n\tif in.Incremental != nil {\n\t\tin, out := &in.Incremental, &out.Incremental\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tout.Git = in.Git\n\tin.Source.DeepCopyInto(&out.Source)\n\tif in.Webhooks != nil {\n\t\tin, out := &in.Webhooks, &out.Webhooks\n\t\t*out = make([]WebhookSecret, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a2e56fc0b4ad6ad31d7c15f058860708", "score": "0.7834799", "text": "func (in *KopsNode) DeepCopyInto(out *KopsNode) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "99ddb33db709798f629620e68a898683", "score": "0.78337663", "text": "func (in *FalconAPI) DeepCopyInto(out *FalconAPI) {\n\t*out = *in\n}", "title": "" }, { "docid": "bca37ffe0db98d0566f42347e84e664c", "score": "0.7830135", "text": "func (in *EBS) DeepCopyInto(out *EBS) {\n\t*out = *in\n}", "title": "" }, { "docid": "66d2580ffb856b04e5d00a44ee008ce0", "score": "0.7828457", "text": "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5be1425525b35b26aef12a26b2011c4c", "score": "0.7826969", "text": "func (in *Empty) DeepCopyInto(out *Empty) {\n\t*out = *in\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b04ae4761dcd0ef9878904a00e3dd8d0", "score": "0.78261864", "text": "func (in *ComponentDistGit) DeepCopyInto(out *ComponentDistGit) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "860706dd62a6169f37c407ae9e941366", "score": "0.7823209", "text": "func (in *Memory) DeepCopyInto(out *Memory) {\n\t*out = *in\n\tout.Required = in.Required.DeepCopy()\n}", "title": "" }, { "docid": "02fd4be53bdac24eb957e6384d4abd1d", "score": "0.78229225", "text": "func (in *Persistence) DeepCopyInto(out *Persistence) {\n\t*out = *in\n\tout.Size = in.Size.DeepCopy()\n\treturn\n}", "title": "" }, { "docid": "45b81ab5647ffc92a79777654a796ae7", "score": "0.7821229", "text": "func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) {\n\t*out = *in\n}", "title": "" }, { "docid": "ffab4debbb09338a2ccf02c14685c7bf", "score": "0.7818359", "text": "func (e *Email) DeepCopyInto(out *Email) {\n\t*out = *e\n}", "title": "" }, { "docid": "9701e8b6fac54b671a6f2c7568ba4725", "score": "0.7817294", "text": "func (in *ImageInfo) DeepCopyInto(out *ImageInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "1739ff65106bd91c3ff55f1dcf9372ba", "score": "0.7811081", "text": "func (in *ShootRef) DeepCopyInto(out *ShootRef) {\n\t*out = *in\n}", "title": "" }, { "docid": "6eff9c92ecd03b757d482820e5efaf3a", "score": "0.7810498", "text": "func (in *N3000Fpga) DeepCopyInto(out *N3000Fpga) {\n\t*out = *in\n}", "title": "" }, { "docid": "b4192aeae1c67719d8866db63b4cc639", "score": "0.7809535", "text": "func (in *NetflowType) DeepCopyInto(out *NetflowType) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5b1d1d53678b95e477d0ab43c5ee92ef", "score": "0.78090113", "text": "func (in *Node) DeepCopyInto(out *Node) {\n\t*out = *in\n\tif in.FailStatus != nil {\n\t\tin, out := &in.FailStatus, &out.FailStatus\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MigratingSlots != nil {\n\t\tin, out := &in.MigratingSlots, &out.MigratingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.ImportingSlots != nil {\n\t\tin, out := &in.ImportingSlots, &out.ImportingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n}", "title": "" }, { "docid": "95b78244325c626f34c61e7aac9fbad6", "score": "0.7808808", "text": "func (in *BuiltInAdapter) DeepCopyInto(out *BuiltInAdapter) {\n\t*out = *in\n}", "title": "" }, { "docid": "9a301aab0199bd7435142cc791905e48", "score": "0.78087187", "text": "func (in *CPUSpec) DeepCopyInto(out *CPUSpec) {\n\t*out = *in\n}", "title": "" }, { "docid": "0d141177e260c52daba3cc6c490e1548", "score": "0.7806432", "text": "func (in *LoopState) DeepCopyInto(out *LoopState) {\n\t*out = *in\n}", "title": "" } ]
64e5fb41c5680c1b7440839204096d05
Inspect the request body, which immediately follows the request headers. See `body` below for details.
[ { "docid": "96521dbf36133cc2f2a07a18826af1ee", "score": "0.0", "text": "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchPtrOutput) Body() WebAclRuleStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchBodyPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatch) *WebAclRuleStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchBody {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Body\n\t}).(WebAclRuleStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchBodyPtrOutput)\n}", "title": "" } ]
[ { "docid": "3444e0be5bbb6ea5968e5380cc4c4abc", "score": "0.6798407", "text": "func (ctx *FastHttpRequest) Body() []byte {\n\treturn ctx.Request.Body()\n}", "title": "" }, { "docid": "2f2292534faf436f0b3445826e9df61c", "score": "0.67597365", "text": "func (ctx *WebContext) Body() []byte {\n\treturn ctx.request.Body()\n}", "title": "" }, { "docid": "5a39ea5b038c5c3e558f33aa61c11aea", "score": "0.66968066", "text": "func (r *Request) Body() []byte {\n\treturn r.body\n}", "title": "" }, { "docid": "9ef3fa91f3b2138c91f556865bf20274", "score": "0.6661848", "text": "func (req *Request) GetBody() string {\n\treturn req.body\n}", "title": "" }, { "docid": "651f40e4fe7d21ab0af0307bfb7f36e8", "score": "0.6614196", "text": "func (req *Request) GetBody() string {\n\treturn req.Body\n}", "title": "" }, { "docid": "fe96489d6bc1d73fc5f3f62c10f1cf57", "score": "0.6544254", "text": "func (self Context) GetBody(v interface{}) (err error) {\n\tswitch v.(type) {\n\t\tcase *[]byte:\n\t\t\tbuf := v.(*[]byte)\n\t\t\t(*buf), err = ioutil.ReadAll(self.Req.Body)\n\t\t\t_ = buf\n\t\tcase io.Writer:\n\t\t\t_, err = io.Copy(v.(io.Writer), self.Req.Body)\n\t\tdefault:\n\t\t\terr = json.NewDecoder(self.Req.Body).Decode(v)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "10cccc663b240b26793293995086c4ab", "score": "0.6536431", "text": "func (r Request) Body() []byte {\n\treturn r.BodyFunc()\n}", "title": "" }, { "docid": "1d57fde1d9c0a78245dd59147d5f3b51", "score": "0.65060145", "text": "func (srv *Server) GetBody() []byte {\n\treturn srv.Ctx.Request.Body()\n}", "title": "" }, { "docid": "1941790c2bee4446d215a08ad174a31c", "score": "0.6459675", "text": "func (r *Request) GetBody() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "2ba0dbeaea7e271e65015fb3c94ea52c", "score": "0.64057726", "text": "func (ra *Args) Body() []byte {\n\tbody, err := ioutil.ReadAll(ra.request.Body)\n\tra.addError(err)\n\treturn body\n}", "title": "" }, { "docid": "a14bf201a0527a4f18fe13895417dd18", "score": "0.63201267", "text": "func (r *Request) GetBody() io.ReadSeeker {\n\treturn r.safeBody\n}", "title": "" }, { "docid": "470afb6abab7cc8ed2ca420f7fc38f70", "score": "0.6268059", "text": "func (c *BaseContext) RequestBody() ([]byte, error) {\n\treturn ioutil.ReadAll(c.Request().Body)\n}", "title": "" }, { "docid": "3b1fcfc8d78e155e860840fb7862e378", "score": "0.62613463", "text": "func DumpRequestOut(req *http.Request, body bool) ([]byte, error) {}", "title": "" }, { "docid": "370a4073c875f1925e3b05d9280955d5", "score": "0.6233777", "text": "func (r *SearchRequest) Body() (string, error) {\n\tswitch t := r.source.(type) {\n\tdefault:\n\t\tbody, err := json.Marshal(r.source)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn string(body), nil\n\tcase *SearchSource:\n\t\tsrc, err := t.Source()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tbody, err := json.Marshal(src)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn string(body), nil\n\tcase json.RawMessage:\n\t\treturn string(t), nil\n\tcase *json.RawMessage:\n\t\treturn string(*t), nil\n\tcase string:\n\t\treturn t, nil\n\tcase *string:\n\t\tif t != nil {\n\t\t\treturn *t, nil\n\t\t}\n\t\treturn \"{}\", nil\n\t}\n}", "title": "" }, { "docid": "514752087355853431d3bb25ee0b05b8", "score": "0.616426", "text": "func (req *request) Body() RequestBody {\n\treturn RequestBody{\n\t\treader: req.inner.Body,\n\t}\n}", "title": "" }, { "docid": "bca376dc280066993a7b6ac2d387133e", "score": "0.6130131", "text": "func (req *httpRequest) Body() []byte {\n\treq.bodyLoader.Do(func() {\n\t\tbody, _ := ioutil.ReadAll(req.r.Body)\n\t\t_ = req.r.Body.Close()\n\t\treq.r.Body = ioutil.NopCloser(bytes.NewBuffer(body))\n\n\t\treq.body = body\n\t})\n\n\treturn req.body\n}", "title": "" }, { "docid": "26ffe272df6293a11ce58e0ba13b41f6", "score": "0.6119609", "text": "func ReadBody(req *http.Request) ([]byte, error) {\n\tdefer req.Body.Close()\n\n\tvar res []byte\n\tswitch req.Header.Get(\"Content-Encoding\") {\n\tcase \"gzip\":\n\t\tr, err := gzip.NewReader(req.Body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"gzip.NewReader err: %w\", err)\n\t\t}\n\n\t\tdata, err := io.ReadAll(r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tres = data\n\tcase \"snappy\":\n\t\tdata, err := io.ReadAll(req.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// snappy block format is only supported by decode/encode not snappy reader/writer\n\t\tdata, err = snappy.Decode(nil, data)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"snappy.Decode err: %w\", err)\n\t\t}\n\t\tres = data\n\tdefault:\n\t\tdata, err := io.ReadAll(req.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tres = data\n\t}\n\n\tswitch req.Header.Get(\"Custom-Content-Encoding\") {\n\tcase \"base64\":\n\t\tdst := make([]byte, base64.StdEncoding.DecodedLen(len(res)))\n\t\t_, err := base64.StdEncoding.Decode(dst, res)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"base64 decode: %w\", err)\n\t\t}\n\t\tres = dst\n\tcase \"\":\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported custom-content-encoding\")\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "1a59ec998be8082a07047ca094eeedf2", "score": "0.6098954", "text": "func (c *WebContext) RequestBody() ([]byte, error) {\n\n\tif len(c.requestBody) > 0 {\n\t\treturn c.requestBody, nil\n\t}\n\n\tvar body []byte\n\tbodyString := c.QueryValue(\"body\")\n\tif bodyString != \"\" {\n\t\tbody = []byte(bodyString)\n\t\tc.requestBody = body\n\t} else {\n\n\t\tbody, bodyErr := ioutil.ReadAll(c.HttpRequest().Body)\n\n\t\tif bodyErr != nil {\n\t\t\treturn nil, bodyErr\n\t\t}\n\n\t\tc.requestBody = body\n\t}\n\treturn c.requestBody, nil\n}", "title": "" }, { "docid": "0c72311598d9d7ca88f7f5fc9f6fde49", "score": "0.60871613", "text": "func (r *Request) GetBody() []byte {\n\tif r == nil {\n\t\treturn nil\n\t}\n\tif r.body == nil && r.req != nil && (r.req.Method == \"POST\" || r.req.Method == \"PUT\") {\n\t\treturn []byte(r.getParamBody())\n\t}\n\treturn r.body\n}", "title": "" }, { "docid": "0b3e9f5b14d97bf8e347da359a17b041", "score": "0.60602236", "text": "func (r *Request) ReadBody() (body []byte, err error) {\n\tif !existBody(r.Body) {\n\t\treturn nil, nil\n\t}\n\treader := r.Body\n\tswitch r.headers.Get(\"Content-Encoding\") {\n\tcase \"gzip\":\n\t\treader, err = gzip.NewReader(r.Body)\n\tcase \"flate\":\n\t\treader = flate.NewReader(r.Body)\n\tcase \"zlib\":\n\t\treader, err = zlib.NewReader(r.Body)\n\tdefault:\n\t}\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ioutil.ReadAll(reader)\n}", "title": "" }, { "docid": "fe9110d1d669616d00dd6dde0914fd0f", "score": "0.60218376", "text": "func GetBody(r *http.Request) (body []byte, err error) {\n\tbuf := bytes.NewBuffer(nil)\n\tif _, err = io.CopyN(buf, r.Body, r.ContentLength); err != nil {\n\t\treturn\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "4418375777caa94e7184d3d3d7701d75", "score": "0.6016575", "text": "func (gbr *GetBrowserRequest) Body() io.Reader {\n\treturn nil\n}", "title": "" }, { "docid": "1ea8e2e51d4949069312c3f6695f2e2e", "score": "0.5998956", "text": "func (r *Request) GetBody() string {\n\tif r.body == \"\" {\n\t\tr.body = telesign.StructToURLValues(r.data).Encode()\n\t}\n\n\treturn r.body\n}", "title": "" }, { "docid": "fd7ab55247379becc645284b99898014", "score": "0.5997166", "text": "func (r *ABRequest) GetBody() []byte {\n\treturn r.GetBodyFunc(r)\n}", "title": "" }, { "docid": "623018b0f1da809939bc42c1f6c587d8", "score": "0.59781325", "text": "func GetBodyPayload(r *http.Request) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tvar b bytes.Buffer\n\tvar dest io.Writer = &b\n\n\tif r.Body != nil {\n\t\tif r.Header.Get(\"Content-Length\") == \"\" {\n\t\t\treturn []byte{}, nil\n\t\t}\n\t\tiContentLength, err := strconv.ParseUint(r.Header.Get(\"Content-Length\"), 10, 64)\n\n\t\tif err != nil {\n\t\t\treturn []byte{}, fmt.Errorf(\"request data not logged (failed to parse Content-Length as uint64 : %s)\", err)\n\t\t}\n\n\t\tif iContentLength > config.Cfg.MaxPOSTDataSize {\n\t\t\treturn []byte{}, fmt.Errorf(\"request data not logged (over %s : %s)\", datasize.ByteSize(config.Cfg.MaxPOSTDataSize).HumanReadable(), (datasize.ByteSize(iContentLength) * datasize.B).HumanReadable())\n\t\t}\n\n\t\tif _, err := buf.ReadFrom(r.Body); err != nil {\n\t\t\treturn []byte{}, fmt.Errorf(\"failed to parse request body : got error when reading from body [%s]\", err.Error())\n\t\t}\n\n\t\tif err := r.Body.Close(); err != nil {\n\t\t\t// Send read body in such case\n\t\t\treturn buf.Bytes(), fmt.Errorf(\"failed to parse request body : got error while closing body [%s]\", err.Error())\n\t\t}\n\n\t\tbodyReader := ioutil.NopCloser(bytes.NewReader(buf.Bytes()))\n\n\t\tchunked := len(r.TransferEncoding) > 0 && r.TransferEncoding[0] == \"chunked\"\n\n\t\tif chunked {\n\t\t\tdest = httputil.NewChunkedWriter(dest)\n\t\t}\n\n\t\tif _, err := io.Copy(dest, bodyReader); err != nil {\n\t\t\t// Send read body in such case\n\t\t\treturn buf.Bytes(), fmt.Errorf(\"failed to parse request body: got error while copying the read body [%s]\", err.Error())\n\t\t}\n\n\t\tif chunked {\n\t\t\t_ = dest.(io.Closer).Close()\n\t\t\t_, _ = io.WriteString(&b, \"\\r\\n\")\n\t\t}\n\t}\n\n\treturn b.Bytes(), nil\n}", "title": "" }, { "docid": "35ec68b2d9ef0a01f990698c51f3c03c", "score": "0.5976118", "text": "func (r *Request) String() string {\n\treturn string(r.body)\n}", "title": "" }, { "docid": "499d683c9ca1b61824208e6e6b1652f4", "score": "0.5921165", "text": "func (this *Request) Body(key string) string {\n\treturn this.Bodies()[key]\n}", "title": "" }, { "docid": "bb7b14101d4649e773e87f466036fce7", "score": "0.58976156", "text": "func TestRequestFingerprintBody(t *testing.T) {\n\treq, err := http.NewRequest(\"GET\", \"http://example.com\", nil)\n\texpect(t, err, nil)\n\n\tfp := getRequestFingerprint(req, []byte(\"some huge XML or JSON here\"))\n\n\texpect(t, fp, \"b3918a54eb6e42652e29e14c21ba8f81\")\n}", "title": "" }, { "docid": "26cceeaaf504ce559e4408f17fdab1d6", "score": "0.5896164", "text": "func body(resp *http.Response) ([]byte, error) {\n\tvar buf bytes.Buffer\n\t_, err := buf.ReadFrom(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "d58defd0221ff179f7680372d2717af6", "score": "0.58744186", "text": "func (r *Request) BodyToString() string {\n\tbody := make([]byte, r.ContentLength)\n\tr.Body.Read(body)\n\treturn string(body)\n}", "title": "" }, { "docid": "ccb651eeb74b130f11b430ebf2285d7a", "score": "0.5864662", "text": "func (hr Request) PostBody() []byte {\n\tif len(hr.Body) > 0 {\n\t\treturn hr.Body\n\t} else if len(hr.PostData) > 0 {\n\t\treturn []byte(hr.PostData.Encode())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0c1fe7a6b40a23b4007d3e2dc09dc127", "score": "0.58537287", "text": "func (g *GetHomeAzRequest) Body() (io.Reader, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "d4fdaa76dc5af5b3efa19dacf7d94a8b", "score": "0.58507586", "text": "func getRequestBody(request *http.Request) []byte {\n\tvar body []byte\n\tvar err error\n\n\t// No request body: return the empty byte array.\n\tif request.Body == nil {\n\t\treturn body\n\t}\n\n\t// Close the body stream at the end of the function.\n\tdefer request.Body.Close()\n\n\t// Read request body.\n\tbody, err = ioutil.ReadAll(request.Body)\n\t// TODO: Better error handling: Send back per http response?\n\tif err != nil {\n\t\treturn body\n\t}\n\n\treturn body\n}", "title": "" }, { "docid": "d4fdaa76dc5af5b3efa19dacf7d94a8b", "score": "0.58507586", "text": "func getRequestBody(request *http.Request) []byte {\n\tvar body []byte\n\tvar err error\n\n\t// No request body: return the empty byte array.\n\tif request.Body == nil {\n\t\treturn body\n\t}\n\n\t// Close the body stream at the end of the function.\n\tdefer request.Body.Close()\n\n\t// Read request body.\n\tbody, err = ioutil.ReadAll(request.Body)\n\t// TODO: Better error handling: Send back per http response?\n\tif err != nil {\n\t\treturn body\n\t}\n\n\treturn body\n}", "title": "" }, { "docid": "37853ab7ec6db218b424a29b39900a8c", "score": "0.5850455", "text": "func httpBody(r *http.Request) []byte {\n\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, 1048576))\n\tif err != nil || r.Body.Close() != nil {\n\t\tlog.WithFields(log.Fields{\"error\": err}).Warn(\"Can't read request body\")\n\t\treturn []byte(\"\")\n\t}\n\treturn body\n}", "title": "" }, { "docid": "fa56164f4d67e2efc3a318ddb0d3b8aa", "score": "0.5845067", "text": "func (o *CdnHttpVerificationDetails) GetBody() string {\n\tif o == nil || o.Body == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Body\n}", "title": "" }, { "docid": "91832ffe50a45b14fe2fde5c126722da", "score": "0.5825981", "text": "func (c *Context) GetBody() ([]byte, error) {\n\tbody, err := c.Context.GetRawData()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.Request.Body = io.NopCloser(bytes.NewReader(body))\n\treturn body, nil\n}", "title": "" }, { "docid": "78bf469bb353a276d2f090d85ec36876", "score": "0.5824232", "text": "func TestRequestBodyCaptured(t *testing.T) {\n\n\tserver, dbClient := testTools(200, `{'message': 'here'}`)\n\tdefer server.Close()\n\n\trequestBody := []byte(\"fizz=buzz\")\n\n\tbody := ioutil.NopCloser(bytes.NewBuffer(requestBody))\n\n\treq, err := http.NewRequest(\"POST\", \"http://capture_body.com\", body)\n\texpect(t, err, nil)\n\n\t_, err = dbClient.captureRequest(req)\n\texpect(t, err, nil)\n\n\tfp := getRequestFingerprint(req, requestBody)\n\n\tpayloadBts, err := dbClient.Cache.Get([]byte(fp))\n\texpect(t, err, nil)\n\n\tpayload, err := decodePayload(payloadBts)\n\texpect(t, err, nil)\n\texpect(t, payload.Request.Body, \"fizz=buzz\")\n}", "title": "" }, { "docid": "d5e103cde1bdcaae5441ac6a5c123068", "score": "0.58232415", "text": "func parseBody(r *http.Request, v interface{}) error {\n\tdefer r.Body.Close()\n\treturn json.NewDecoder(r.Body).Decode(v)\n}", "title": "" }, { "docid": "99de83cf79ad3bee7453dca7ebd7b4c6", "score": "0.5801895", "text": "func ExtractRequestBody(r *http.Request) ([]byte, error) {\n\tvar jsonData interface{}\n\terr := extractBody(r, &jsonData)\n\tif err == nil {\n\t\tresp, e := transform(jsonData)\n\t\tif e == nil {\n\t\t\treturn resp.Bytes(), nil\n\t\t}\n\t\terr = e\n\t}\n\treturn []byte{}, err\n}", "title": "" }, { "docid": "d9cf3a2c9878de1732f0ffebc66504f3", "score": "0.5775988", "text": "func (r *Request) Body(destination Validatable) *HTTPResponse {\n\n\t// If the body is not a map, we can't decode it\n\tcast, ok := r.HTTPRequest.Body.(map[string]interface{})\n\tif !ok {\n\t\treturn NewBadRequestError(\"Please supply an object body\")\n\t}\n\n\t// Decode the request body\n\terr := lingo.Map.Decode(cast, destination)\n\tif err != nil {\n\t\treturn NewBadRequestError(\"Failed to decode request\")\n\t}\n\n\t// Validate and return\n\treturn destination.Validate()\n}", "title": "" }, { "docid": "2e6940bf24b0f0d737cfc3bbb4673902", "score": "0.57756215", "text": "func (ctx *Ctx) Body(key ...string) string {\n\t// Return request body\n\tif len(key) == 0 {\n\t\treturn GetString(ctx.C.Request.Body())\n\t}\n\t// Return post value by key\n\tif len(key) > 0 {\n\t\treturn GetString(ctx.C.Request.PostArgs().Peek(key[0]))\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ad8094f174be1c215ee80083d5ed3387", "score": "0.5758004", "text": "func BodyDump(c echo.Context, reqBody, resBody []byte) {\n\tstatus := c.Response().Status\n\tif viper.GetBool(\"debug\") || ((status < 199 || status > 299) && status != 404) {\n\t\tresHeaders := c.Response().Header()\n\t\tv := bodyDump{\n\t\t\tTime: time.Now(),\n\t\t\tRequestID: c.Response().Header().Get(echo.HeaderXRequestID),\n\t\t\tRequestBody: string(reqBody),\n\t\t\tResponseBody: string(resBody),\n\t\t\tRequestHeaders: &c.Request().Header,\n\t\t\tResponseHeaders: &resHeaders,\n\t\t}\n\t\tbuf, _ := json.Marshal(v)\n\t\tfmt.Println(string(buf))\n\t}\n}", "title": "" }, { "docid": "bb6b29e8df958bd7c541cf2fc72eadaf", "score": "0.57366127", "text": "func (r *Request) BodyBytes() ([]byte, error) {\n\tif r.body == nil {\n\t\treturn nil, nil\n\t}\n\tbody, err := r.body()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbuf := new(bytes.Buffer)\n\t_, err = buf.ReadFrom(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "0a352704eb531f70219b669baa38d489", "score": "0.5735954", "text": "func (r Response) Body() string {\n\treturn r.Env.ResponseBody\n}", "title": "" }, { "docid": "736138f8a272e6675199602faefe8779", "score": "0.57079893", "text": "func getRequestBody(request *http.Request) (requestBody []byte, err error) {\n\tif request.Body != nil {\n\t\tdefer request.Body.Close()\n\n\t\trequestBody, err = ioutil.ReadAll(request.Body)\n\t\tif err != nil {\n\t\t\terr = errors.Wrapf(err, \"unexpected error reading request body\")\n\n\t\t\treturn\n\t\t}\n\n\t\tvar requestBodyReader io.Reader = bytes.NewReader(requestBody)\n\t\trequestBodyReadCloser, ok := requestBodyReader.(io.ReadCloser)\n\t\tif !ok {\n\t\t\trequestBodyReadCloser = ioutil.NopCloser(requestBodyReader)\n\t\t}\n\t\trequest.Body = requestBodyReadCloser\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9ff80eb605970844c312e3c2c2486656", "score": "0.56914407", "text": "func ReadRequestBody(req *http.Request) ([]byte, error) {\r\n\r\n\treqBody, err := ioutil.ReadAll(req.Body)\r\n\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\terr = req.Body.Close()\r\n\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn reqBody, nil\r\n}", "title": "" }, { "docid": "fa128bc6e655fbabdb621d611a540d76", "score": "0.5686612", "text": "func (o HttpCheckOutput) Body() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HttpCheck) *string { return v.Body }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "670f113ca088dd93efa316084a88ffac", "score": "0.5686254", "text": "func (req *Request) GetBodyAs(arg interface{}) error {\n\tdata := []byte(req.body)\n\treturn json.Unmarshal(data, arg)\n}", "title": "" }, { "docid": "4d797d15dfda77d07aac4ce8de1e9b38", "score": "0.5680571", "text": "func (detail RouteDetails) Body() map[string]interface{} {\n\treturn detail.body\n}", "title": "" }, { "docid": "633ea69776c823149ab3dbfee8f158cb", "score": "0.56758463", "text": "func (rm *responseModifier) RawBody() []byte {\n\treturn rm.body\n}", "title": "" }, { "docid": "869ed38eea13a839adaec61e447c78b2", "score": "0.56701976", "text": "func RequestBody(r *http.Request, item interface{}) *ErrResponse {\n\tif reflect.ValueOf(item).Kind() != reflect.Ptr {\n\t\treturn ErrInvalidRequest\n\n\t}\n\terr := json.NewDecoder(r.Body).Decode(&item)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\t///sentry.CaptureException(err)\n\t\treturn ErrInvalidRequest\n\t}\n\tdefer r.Body.Close()\n\treturn nil\n\n}", "title": "" }, { "docid": "3b09c8f742d873d3f94b5afe09e18b8b", "score": "0.5664227", "text": "func (req *Request) GetBodyAs(arg interface{}) error {\n\tdata := []byte(req.Body)\n\treturn json.Unmarshal(data, arg)\n}", "title": "" }, { "docid": "c41fdc4f334ddb509604f671f6ad54ca", "score": "0.5663852", "text": "func ReadRequestBody(request *http.Request) ([]byte, error) {\n\tdefer request.Body.Close()\n\treturn ioutil.ReadAll(request.Body)\n}", "title": "" }, { "docid": "8ae8fca07c7bc1c947b05e1988f96ee8", "score": "0.56610405", "text": "func (c *Connection) dumpBody(ctx context.Context, header http.Header, body []byte) {\n\tswitch header.Get(\"Content-Type\") {\n\tcase \"application/json\", \"\":\n\t\tc.dumpJSON(ctx, body)\n\tdefault:\n\t\tc.dumpBytes(ctx, body)\n\t}\n}", "title": "" }, { "docid": "68e061c09b92d19143e624d4d006aa0e", "score": "0.56299996", "text": "func (c *Connection) dumpRequest(ctx context.Context, request *http.Request, body []byte) {\n\tc.logger.Debug(ctx, \"Request method is %s\", request.Method)\n\tc.logger.Debug(ctx, \"Request URL is '%s'\", request.URL)\n\theader := request.Header\n\tnames := make([]string, len(header))\n\ti := 0\n\tfor name := range header {\n\t\tnames[i] = name\n\t\ti++\n\t}\n\tsort.Strings(names)\n\tfor _, name := range names {\n\t\tvalues := header[name]\n\t\tfor _, value := range values {\n\t\t\tif strings.ToLower(name) == \"authorization\" {\n\t\t\t\tc.logger.Debug(ctx, \"Request header '%s' is omitted\", name)\n\t\t\t} else {\n\t\t\t\tc.logger.Debug(ctx, \"Request header '%s' is '%s'\", name, value)\n\t\t\t}\n\t\t}\n\t}\n\tif body != nil {\n\t\tc.logger.Debug(ctx, \"Request body follows\")\n\t\tc.dumpBody(ctx, header, body)\n\t}\n}", "title": "" }, { "docid": "faafd9706d564dc639f09d661eec2195", "score": "0.5624621", "text": "func (r *Request) Body(body io.Reader) *Request {\n\tif body == nil {\n\t\treturn r\n\t}\n\treturn r.BodyProvider(&bodyProvider{body: body})\n}", "title": "" }, { "docid": "c3cf1f944a85f48648cbc630a80749b7", "score": "0.56025493", "text": "func (s *SupportedAPIsRequest) Body() (io.Reader, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "0db16f048e6782f4f64f103c5444b6a4", "score": "0.55953735", "text": "func (gar *GetAgencyRequest) Body() io.Reader {\n\treturn nil\n}", "title": "" }, { "docid": "0c80d2781ec141d772c0fa07835d1883", "score": "0.5593854", "text": "func getPostBody(r *http.Request) (map[string]string, error) {\n\traw_body, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar body map[string]string\n\terr = json.Unmarshal(raw_body, &body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn body, nil\n}", "title": "" }, { "docid": "be094e684726f1eaedc42bc4facd85a0", "score": "0.5591435", "text": "func (c ginContext) Body() luapi.RequestBody {\n\treq := luapi.RequestBody{\n\t\tScript: `respond(\"Invalid request body.\")`,\n\t}\n\t_ = c.original.BindJSON(&req)\n\treturn req\n}", "title": "" }, { "docid": "985144a01bfe77086be9654aefade46f", "score": "0.55781955", "text": "func (rqst *Request) RequestBodyS(cached ...bool) (s string) {\n\tif bf := rqst.RequestBody(cached...); bf != nil {\n\t\tvar rns = make([]rune, 1024)\n\t\tvar rnsi = 0\n\t\tfor {\n\t\t\tr, size, rerr := bf.ReadRune()\n\t\t\tif size > 0 {\n\t\t\t\trns[rnsi] = r\n\t\t\t\trnsi++\n\t\t\t\tif rnsi == len(rns) {\n\t\t\t\t\trnsi = 0\n\t\t\t\t\ts += string(rns)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif rerr != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif rnsi > 0 {\n\t\t\ts += string(rns[:rnsi])\n\t\t}\n\t}\n\treturn s\n}", "title": "" }, { "docid": "a1ee9688c004204e2f686140d3b5c8c5", "score": "0.5564195", "text": "func Debug() ExpectFunc {\n\treturn func(req *http.Request) error {\n\t\tbuf, err := ioutil.ReadAll(req.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treq.Body = ioutil.NopCloser(bytes.NewBuffer(buf))\n\t\t// log.Printf(\"[DEBUG] Request Body: %s\\n\", buf)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "dc80bacad3329bc852d056382aea46f1", "score": "0.5553552", "text": "func (t *HttpResponse) BodyIs(exp string, m, p string, opt ...interface{}) {\n\tt.Helper()\n\tt.BodyEquals([]byte(exp), m, p, opt...)\n}", "title": "" }, { "docid": "ded854f962a1c6262de04b625cad725e", "score": "0.55400795", "text": "func GetHTTPRequestBody(req *http.Request) (ret []byte, err error) {\n\tvar reader io.Reader = req.Body\n\tmaxFormSize := int64(1<<63 - 1)\n\tif _, ok := req.Body.(*maxBytesReader); !ok {\n\t\tmaxFormSize = int64(10 << 20) // 10 MB is a lot of text.\n\t\treader = io.LimitReader(req.Body, maxFormSize+1)\n\t}\n\n\tpayload, payloadErr := ioutil.ReadAll(reader)\n\tif payloadErr != nil {\n\t\terr = payloadErr\n\t\treturn\n\t}\n\n\tif int64(len(payload)) > maxFormSize {\n\t\terr = errors.New(\"http: request body too large\")\n\t\treturn\n\t}\n\n\tret = payload\n\treturn\n}", "title": "" }, { "docid": "dd2e3def8bd75801413f2b5595209d84", "score": "0.5511168", "text": "func (o *CdnHttpVerificationDetails) GetBodyOk() (*string, bool) {\n\tif o == nil || o.Body == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Body, true\n}", "title": "" }, { "docid": "855d5f381a9861bfeefc74ddc18d847a", "score": "0.55084753", "text": "func BodyToString(t *testing.T, requestBody io.ReadCloser) string {\n\tbody, err := ioutil.ReadAll(requestBody)\n\tassert.Nil(t, err, \"Unexpected error %s\", err)\n\treturn string(body)\n}", "title": "" }, { "docid": "71cb7bd9aac70698baa2a927f3fb1392", "score": "0.55015147", "text": "func parseBody(r *http.Request) (*RequestBody, error) {\n\tb, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar requestBody RequestBody\n\terr = json.Unmarshal(b, &requestBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trequestBody.JobType = strings.TrimSpace(requestBody.JobType)\n\tif len(requestBody.JobType) == 0 {\n\t\treturn nil, errors.New(\"Unable to parse body, missing jobType\")\n\t}\n\tpayloadBytes, err := json.Marshal(requestBody.PayloadMap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trequestBody.payloadJson = string(payloadBytes)\n\treturn &requestBody, nil\n}", "title": "" }, { "docid": "2bb0bd5b718c8438ec38a634b4cfb157", "score": "0.5499273", "text": "func (event *Event) Body() (body string, ok bool) {\n\tvalue, exists := event.Content[\"body\"]\n\tif !exists {\n\t\treturn\n\t}\n\tbody, ok = value.(string)\n\treturn\n}", "title": "" }, { "docid": "88cd944b259685f18737d67df3c05ee2", "score": "0.5498902", "text": "func (c *Context) ReadRequest(body interface{}) (req *Request, err error) {\n\tdefer c.Context.Request.Body.Close()\n\n\treq, err = RequestReader(c.Context.Request.Body, body)\n\treturn\n}", "title": "" }, { "docid": "f1079eca7e9a413b45791bcd1fa27d3f", "score": "0.54909915", "text": "func (n *NoneParser) Body() []byte {\n\treturn n.body.Bytes()\n}", "title": "" }, { "docid": "6f03dc89739193413284df70e6718369", "score": "0.54847866", "text": "func header_details(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"%s %s %s\\n\", r.Method, r.URL, r.Proto)\n\tfor k, v := range r.Header {\n\t\tfmt.Fprintf(w, \"Header[%q] = %q\\n\", k, v)\n\t}\n\tfmt.Fprintf(w, \"Host = %q\\n\", r.Host)\n\tfmt.Fprintf(w, \"RemoteAddr = %q\\n\", r.RemoteAddr)\n\t// ParseForm parses the raw query from the URL and updates r.Form.\n\t// It is also a compact way to check the error\n\tif err := r.ParseForm(); err != nil {\n\t\tlog.Print(err)\n\t}\n\tfor k, v := range r.Form {\n\t\tfmt.Fprintf(w, \"URL values - Form[%q] = %q\\n\", k, v)\n\t}\n}", "title": "" }, { "docid": "00675be7b4d34fde74709b7e134e264e", "score": "0.54823035", "text": "func ReadRequest(b *bufio.ReadWriter) (req *Request, err error) {\n\ttp := textproto.NewReader(b.Reader)\n\treq = new(Request)\n\n\t// Read first line.\n\tvar s string\n\ts, err = tp.ReadLine()\n\tif err != nil {\n\t\tif err == io.EOF {\n\t\t\terr = io.ErrUnexpectedEOF\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tf := strings.SplitN(s, \" \", 3)\n\tif len(f) < 3 {\n\t\treturn nil, &badStringError{\"malformed ICAP request\", s}\n\t}\n\treq.Method, req.RawURL, req.Proto = f[0], f[1], f[2]\n\n\treq.URL, err = url.ParseRequestURI(req.RawURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header, err = tp.ReadMIMEHeader()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts = req.Header.Get(\"Encapsulated\")\n\tif s == \"\" {\n\t\treturn req, nil // No HTTP headers or body.\n\t}\n\teList := strings.Split(s, \", \")\n\tvar initialOffset, reqHdrLen, respHdrLen int\n\tvar hasBody bool\n\tvar prevKey string\n\tvar prevValue int\n\tfor _, item := range eList {\n\t\teq := strings.Index(item, \"=\")\n\t\tif eq == -1 {\n\t\t\treturn nil, &badStringError{\"malformed Encapsulated: header\", s}\n\t\t}\n\t\tkey := item[:eq]\n\t\tvalue, err := strconv.Atoi(item[eq+1:])\n\t\tif err != nil {\n\t\t\treturn nil, &badStringError{\"malformed Encapsulated: header\", s}\n\t\t}\n\n\t\t// Calculate the length of the previous section.\n\t\tswitch prevKey {\n\t\tcase \"\":\n\t\t\tinitialOffset = value\n\t\tcase \"req-hdr\":\n\t\t\treqHdrLen = value - prevValue\n\t\tcase \"res-hdr\":\n\t\t\trespHdrLen = value - prevValue\n\t\tcase \"req-body\", \"opt-body\", \"res-body\", \"null-body\":\n\t\t\treturn nil, fmt.Errorf(\"%s must be the last section\", prevKey)\n\t\t}\n\n\t\tswitch key {\n\t\tcase \"req-hdr\", \"res-hdr\", \"null-body\":\n\t\tcase \"req-body\", \"res-body\", \"opt-body\":\n\t\t\thasBody = true\n\t\tdefault:\n\t\t\treturn nil, &badStringError{\"invalid key for Encapsulated: header\", key}\n\t\t}\n\n\t\tprevValue = value\n\t\tprevKey = key\n\t}\n\n\t// Read the HTTP headers.\n\tvar rawReqHdr, rawRespHdr []byte\n\tif initialOffset > 0 {\n\t\tjunk := make([]byte, initialOffset)\n\t\t_, err = io.ReadFull(b, junk)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif reqHdrLen > 0 {\n\t\trawReqHdr = make([]byte, reqHdrLen)\n\t\t_, err = io.ReadFull(b, rawReqHdr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif respHdrLen > 0 {\n\t\trawRespHdr = make([]byte, respHdrLen)\n\t\t_, err = io.ReadFull(b, rawRespHdr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar bodyReader io.ReadCloser = emptyReader(0)\n\tif hasBody {\n\t\tif p := req.Header.Get(\"Preview\"); p != \"\" {\n\t\t\tmoreBody := true\n\t\t\treq.Preview, err = ioutil.ReadAll(newChunkedReader(b))\n\t\t\tif err != nil {\n\t\t\t\tif strings.Contains(err.Error(), \"ieof\") {\n\t\t\t\t\t// The data ended with \"0; ieof\", which the HTTP chunked reader doesn't understand.\n\t\t\t\t\tmoreBody = false\n\t\t\t\t\terr = nil\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar r io.Reader = bytes.NewBuffer(req.Preview)\n\t\t\tif moreBody {\n\t\t\t\tr = io.MultiReader(r, &continueReader{buf: b})\n\t\t\t}\n\t\t\tbodyReader = ioutil.NopCloser(r)\n\t\t} else {\n\t\t\tbodyReader = ioutil.NopCloser(newChunkedReader(b))\n\t\t}\n\t}\n\n\t// Construct the http.Request.\n\tif rawReqHdr != nil {\n\t\tinvalidURLEscapeFixed := false\n\t\treq.Request, err = http.ReadRequest(bufio.NewReader(bytes.NewBuffer(rawReqHdr)))\n\t\tif err != nil && strings.Contains(err.Error(), \"invalid URL escape\") {\n\t\t\t//Fix the request url\n\t\t\t// Convert the rawReqHdr to string\n\t\t\t// find the url\\path start and end(sould be in the status line\n\t\t\t// convert the percents into %25\n\t\t\t// Then reparse the whole request\n\t\t\trawReqHdrStr := string(rawReqHdr)\n\t\t\tresult := strings.Split(rawReqHdrStr, \"\\n\")\n\t\t\tresult[0] = strings.Replace(result[0], \"%\", \"%25\", -1)\n\t\t\t// The next is a compromise since when adding \"\\r\\n\" it causes the request parsing to fail\n\t\t\tnewReq := strings.Join(result, \"\\n\")\n\t\t\treq.Request, err = http.ReadRequest(bufio.NewReader(bytes.NewBuffer([]byte(newReq))))\n\t\t\tif err != nil {\n\t\t\t\treturn req, fmt.Errorf(\"error while parsing HTTP request: %v\", err)\n\t\t\t}\n\t\t\tinvalidURLEscapeFixed = true\n\t\t}\n\t\tif err != nil && !invalidURLEscapeFixed {\n\t\t\treturn req, fmt.Errorf(\"error while parsing HTTP request: %v\", err)\n\t\t}\n\n\t\tif req.Method == \"REQMOD\" {\n\t\t\treq.Request.Body = bodyReader\n\t\t} else {\n\t\t\treq.Request.Body = emptyReader(0)\n\t\t}\n\t}\n\n\t// Construct the http.Response.\n\tif rawRespHdr != nil {\n\t\trequest := req.Request\n\t\tif request == nil {\n\t\t\trequest, _ = http.NewRequest(\"GET\", \"/\", nil)\n\t\t}\n\t\treq.Response, err = http.ReadResponse(bufio.NewReader(bytes.NewBuffer(rawRespHdr)), request)\n\t\tif err != nil {\n\t\t\treturn req, fmt.Errorf(\"error while parsing HTTP response: %v\", err)\n\t\t}\n\n\t\tif req.Method == \"RESPMOD\" {\n\t\t\treq.Response.Body = bodyReader\n\t\t} else {\n\t\t\treq.Response.Body = emptyReader(0)\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2e49733df945bcd469271966b2952874", "score": "0.54767364", "text": "func read(body io.Reader) ([]byte, error) {\n\tb, err := ioutil.ReadAll(body)\n\tif err != nil {\n\t\treturn nil, &Error{\n\t\t\tID: \"e006\",\n\t\t\tMessage: fmt.Errorf(\"Unable to read http body: %w\", err).Error(),\n\t\t\tOrigin: Internal,\n\t\t\tTemporary: false,\n\t\t}\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "ef54ca32c1ab9473d3b2e0bdd3c0bb1f", "score": "0.54742944", "text": "func testReadBody(response *http.Response) []byte {\n\tbody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\tlog.Println(\"main_test.go: testReadBody(): ioutil.ReadAll: error: %v\", err)\n\t}\n\treturn body\n}", "title": "" }, { "docid": "92205f0c20eb36d48cd171e055c9e4ef", "score": "0.5470505", "text": "func roBody(inOp *grequests.RequestOptions, inRq *tRequests) (rErr error) {\n\t// Is this a POST?\n\tif inRq.Method != \"POST\" {\n\t\trErr = errors.New(\"ERROR: Fn roBody - expecting a POST but received a GET request\")\n\t\treturn\n\t}\n\n\t// Configure a JSON or XML request body\n\tswitch inRq.Typebody {\n\tcase \"application/json\":\n\t\tinOp.Headers = contJSON\n\t\tinOp.JSON = inRq.Body\n\tcase \"application/xml\":\n\t\tinOp.Headers = contXML\n\t\tinOp.XML = inRq.Body\n\tdefault:\n\t\trErr = errors.New(\"ERROR: Fn roBody - did not receive an XML or JSON request object\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "225e1d1174db7502dd6dfc706f24a0b4", "score": "0.54656965", "text": "func (r *Response) RawBody() io.Reader {\n\treturn bytes.NewReader(r.body)\n}", "title": "" }, { "docid": "e7b2da6cd8d0eee9d303b433c9c6337f", "score": "0.5459658", "text": "func (r *sortShardReader) body() []byte {\n\treturn r.parser.body()\n}", "title": "" }, { "docid": "0f5c320e6d2b3aed34f07a3af40df88d", "score": "0.54594636", "text": "func (r *Response) ReadBody() ([]byte, error) {\n\t// Calls 2+ to this function for the same http.Response will now DWIM\n\tif r.Body != nil {\n\t\treturn r.Body, nil\n\t}\n\n\tdefer r.HTTP.Body.Close()\n\tbodyBytes, err := ioutil.ReadAll(r.HTTP.Body)\n\tr.Body = bodyBytes\n\treturn bodyBytes, err\n}", "title": "" }, { "docid": "96eb7bd168b9bbdb55c2681f5a006eb5", "score": "0.54592896", "text": "func CollectHTTPBody(r *http.Request, rw http.ResponseWriter) *HTTPRequestPacket {\n\tcontent, ok := r.Header[\"Content-Type\"]\n\tmuxcontent := strings.Join(content, \";\")\n\twind := strings.Index(muxcontent, \"application/x-www-form-urlencode\")\n\tmind := strings.Index(muxcontent, \"multipart/form-data\")\n\n\tvar reqtype string\n\tvar buff []byte\n\tvar rerr error\n\n\tif ok {\n\n\t\tjsn := strings.Index(muxcontent, \"application/json\")\n\n\t\tif ok {\n\n\t\t\tif jsn != -1 {\n\t\t\t\treqtype = \"json\"\n\t\t\t}\n\n\t\t\tif wind != -1 {\n\t\t\t\tif err := r.ParseForm(); err != nil {\n\t\t\t\t\tlog.Println(\"Request Read Form Error\", err)\n\t\t\t\t\trerr = err\n\t\t\t\t} else {\n\t\t\t\t\treqtype = \"form\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif mind != -1 {\n\t\t\t\tif err := r.ParseMultipartForm(32 << 20); err != nil {\n\t\t\t\t\tlog.Println(\"Request Read MultipartForm Error\", err)\n\t\t\t\t\trerr = err\n\t\t\t\t} else {\n\t\t\t\t\treqtype = \"multipart\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif mind == -1 && wind == -1 && r.Body != nil {\n\n\t\t\t\tbuff = make([]byte, r.ContentLength)\n\t\t\t\t_, err := r.Body.Read(buff)\n\n\t\t\t\tif reqtype == \"\" {\n\t\t\t\t\treqtype = \"binary\"\n\t\t\t\t}\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tif err != io.EOF {\n\t\t\t\t\t\tlog.Println(\"Request Read Body Error\", err)\n\t\t\t\t\t\trerr = err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn &HTTPRequestPacket{\n\t\tr,\n\t\trw,\n\t\tbuff,\n\t\trerr,\n\t\treqtype,\n\t}\n}", "title": "" }, { "docid": "26fa617730ce929990a3458473d406e1", "score": "0.5456599", "text": "func ReadBody(resp *http.Response) []byte {\n\tif resp == nil {\n\t\treturn []byte{}\n\t}\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tresp.Body.Close()\n\treturn body\n}", "title": "" }, { "docid": "976d53e8c309cfb9d525559c70ab0d45", "score": "0.54473287", "text": "func (r *Response) Body() []byte {\n\treturn r.body\n}", "title": "" }, { "docid": "340b990a01a24575d5444e34781de96f", "score": "0.54457814", "text": "func LogRequest(r *http.Request) {\n var sb strings.Builder\n sb.WriteString(\"\\n>>>> REQUEST: \" + r.RequestURI + \"\\n\\nHEADER:\\n\")\n for keyHeader, valueHeader := range r.Header {\n sb.WriteString(keyHeader + \": \" + valueHeader[0] + \"\\n\")\n }\n\n rBody, _ := ioutil.ReadAll(r.Body)\n sb.WriteString(\"\\nBODY:\\n\")\n if r.Header.Get(\"Content-Encoding\") == \"gzip\" {\n // TODO: should react on errors here?\n rNewReader := strings.NewReader(string(rBody[:]))\n gzipReader, _ := gzip.NewReader(rNewReader)\n rUncompressedBody, _ := ioutil.ReadAll(gzipReader)\n sb.WriteString(\"(uncompressed body)\\n\" + string(rUncompressedBody[:]))\n } else {\n sb.WriteString(string(rBody[:]))\n }\n sb.WriteString(\"\\n\")\n r.Body = ioutil.NopCloser(strings.NewReader(string(rBody[:])))\n\n log.Print(sb.String())\n}", "title": "" }, { "docid": "3930f12053331e45e27532dc01c0bea2", "score": "0.5438253", "text": "func (g GetNetworkConfigRequest) Body() (io.Reader, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "c1bc1b8fe8bf0cad198ff50b7a0ddc12", "score": "0.5425413", "text": "func (o *CdnHttpVerificationDetails) HasBody() bool {\n\tif o != nil && o.Body != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e1ed089f444ca3250d1135a715d76545", "score": "0.5425359", "text": "func (req StatsRequest) Body(res tarantool.SchemaResolver, enc *msgpack.Encoder) error {\n\tif value, ok := req.space.Get(); ok {\n\t\treq.impl = req.impl.Args([]interface{}{value})\n\t} else {\n\t\treq.impl = req.impl.Args([]interface{}{})\n\t}\n\n\treturn req.impl.Body(res, enc)\n}", "title": "" }, { "docid": "9f2887dd949a0a4c2a0280dd91b5dd52", "score": "0.54207736", "text": "func (o HttpCheckResponseOutput) Body() pulumi.StringOutput {\n\treturn o.ApplyT(func(v HttpCheckResponse) string { return v.Body }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d6a7821e48aa35cf0ce07cbe31db86af", "score": "0.5417662", "text": "func MatchBody(wantBody string) RequestMatcher {\n\treturn matcherFunc(func(req *http.Request, requestCount int) bool {\n\t\tclone, err := cloneRequestWithBody(req)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tvar body string\n\t\tif clone.Body != nil {\n\t\t\tb, err := ioutil.ReadAll(clone.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tbody = string(b)\n\t\t}\n\t\treturn body == wantBody\n\t})\n}", "title": "" }, { "docid": "05c8165d88a0b7a134bf5b09891f9b38", "score": "0.5403187", "text": "func readBody(body *io.ReadCloser) []byte {\n\tbytes, err := ioutil.ReadAll(*body)\n\tif err != nil {\n\t\tpanic(err)\n\t} else {\n\t\treturn bytes\n\t}\n}", "title": "" }, { "docid": "0e36407df84dda5175d8e33325154070", "score": "0.5392977", "text": "func (r *RedirectResponse) Body() []byte {\n\treturn nil\n}", "title": "" }, { "docid": "5561246074c64a96997a84c5cbaa3d8d", "score": "0.53909326", "text": "func (o *HttpEntity) GetBody() map[string]interface{} {\n\tif o == nil || o.Body == nil {\n\t\tvar ret map[string]interface{}\n\t\treturn ret\n\t}\n\treturn *o.Body\n}", "title": "" }, { "docid": "4eae793a25a8b9c32ac7867030513c34", "score": "0.5387423", "text": "func ReadBody(resp *http.Response) (result []byte, err error) {\n\tdefer fs.CheckClose(resp.Body, &err)\n\treturn io.ReadAll(resp.Body)\n}", "title": "" }, { "docid": "f6bcde8b45da0e2e41442a9dfe245c4e", "score": "0.53848016", "text": "func unmarshalBody(r *http.Request, v interface{}) interface{} {\n\tb := body(r)\n\terr := json.Unmarshal(b, v)\n\tif err != nil {\n\t\t// fixme\n\t\tfmt.Println(\"error unmarshalling: \", err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "67cc258c2ebbb081538f66569af53d03", "score": "0.53844917", "text": "func (c *Context) ParseBody(item interface{}) error {\n\treturn binding.JSON.Bind(c.Request, item)\n}", "title": "" }, { "docid": "98706cf5bdce231dd4afa9bff9c6031a", "score": "0.5373721", "text": "func (ctx *FastHttpResponse) Body() []byte {\n\treturn ctx.Response.Body()\n}", "title": "" }, { "docid": "3dab690d7334c6a4d581b97d1ee7a975", "score": "0.53726584", "text": "func (r *NormalResponse) Body() []byte {\n\treturn r.body\n}", "title": "" }, { "docid": "72e3ddf30ad8d059001d546d97db6d6e", "score": "0.5359977", "text": "func (self *HttpClient) GetBody(requestUrl string) ([]byte, error) {\n\tfmt.Printf(\"%s %s\\n\", http.MethodGet, requestUrl)\n\n\tu, err := url.Parse(requestUrl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif u == nil {\n\t\treturn nil, nil\n\t}\n\tq := u.Query()\n\tu.RawQuery = q.Encode() //urlencode\n\n\treq, err := http.NewRequest(http.MethodGet, u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tself.copyRequestHeader(req)\n\n\tresp, err := self.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer self.closeRespBody(requestUrl, resp)\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(resp.Status)\n\t}\n\n\treturn ioutil.ReadAll(resp.Body)\n}", "title": "" }, { "docid": "d8862174e32e2948ac21340eb54cfb8f", "score": "0.5356464", "text": "func GetBodyBytes(req *http.Request) ([]byte, error) {\n\tif req.Body == nil || req.Body == http.NoBody {\n\t\treturn nil, nil\n\t}\n\n\toriginalBody := req.Body\n\tdefer SafeClose(originalBody)\n\n\tbuf, err := io.ReadAll(originalBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Body = io.NopCloser(bytes.NewReader(buf))\n\n\treturn buf, nil\n}", "title": "" }, { "docid": "91bafaca38bc1d68eb53aa5b0e84cce5", "score": "0.534879", "text": "func getRequestBody(url string) (string, error) {\n\tr, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tclient, err := http.DefaultClient.Do(r)\n\tdefer client.Body.Close()\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tbody, err := ioutil.ReadAll(client.Body)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(body), nil\n}", "title": "" }, { "docid": "ad87fa5116672b01951c7c19b5dcd1ee", "score": "0.5347954", "text": "func (r *Request) Body(body []byte) (*Response, error) {\n\tr.body = body\n\treturn r.Do()\n}", "title": "" }, { "docid": "3872bfbc27c9745fc553cd84733cf108", "score": "0.5347817", "text": "func (e Entries) ReqBody() *String {\n\tm := NewString()\n\tfor _, v := range e {\n\t\tm.Add(string(v.ReqBody()))\n\t}\n\treturn m\n}", "title": "" } ]
6b0f86b8b5e41ec71d4dbabfb1aace5d
Size returns the amount of lambdas found TODO add tests
[ { "docid": "903a89950674321ebfbdb6b4395309cd", "score": "0.8796139", "text": "func (lambdas Lambdas) Size() int {\n\treturn len(lambdas.lambdas)\n}", "title": "" } ]
[ { "docid": "2810c3f0611a04a210cbabe727ea5844", "score": "0.63529336", "text": "func (c closure) Len() int {\n\treturn len(c)\n}", "title": "" }, { "docid": "2a8d4da1fe2a4c3306274f909884862b", "score": "0.63488823", "text": "func Size() int {\n\treturn len(table.Handlers)\n}", "title": "" }, { "docid": "fa72365a887575f407ea34eb8802f423", "score": "0.58074236", "text": "func (c Count) Size() int { return size(c.Args) }", "title": "" }, { "docid": "b72665d2bb9ec212dd8cdf6ab32739eb", "score": "0.57749647", "text": "func (f *Fanout) Len() int {\n\tf.mu.Lock()\n\tdefer f.mu.Unlock()\n\tvar count int\n\tfor key := range f.watchers {\n\t\tcount += len(f.watchers[key])\n\t}\n\treturn count\n}", "title": "" }, { "docid": "f10e81487d511be55319a963381d3a25", "score": "0.57187086", "text": "func (p *planImpl) Size() int {\n\treturn len(p.stages)\n}", "title": "" }, { "docid": "a40c0abd48c0a5575e7361664d30ef39", "score": "0.5698996", "text": "func SizeOf(v interface{}) int {\n\trv, ok := v.(reflect.Value)\n\tif !ok {\n\t\trv = reflect.ValueOf(v)\n\t}\n\n\tsoc := sizeOfCalculator{\n\t\tptrTraversal: make(map[uintptr]struct{}),\n\t}\n\n\tsize, _ := soc.sizeOf(rv, nil)\n\n\treturn size\n}", "title": "" }, { "docid": "ce3ede9db1c2c1ecc8df3317174ad86c", "score": "0.5692039", "text": "func (e *Executor) SizeOf(t Type) int {\n\treturn int(e.llvm.TargetData().TypeAllocSize(t.llvmTy()))\n}", "title": "" }, { "docid": "0268842b6dd6183d2bacacff250b1e03", "score": "0.5648742", "text": "func (True) Size() int { return 0 }", "title": "" }, { "docid": "7578c13c1e9290921e057c3459cb9296", "score": "0.5637827", "text": "func interpolationFuncLength() ast.Function {\n\treturn ast.Function{\n\t\tArgTypes: []ast.Type{ast.TypeAny},\n\t\tReturnType: ast.TypeInt,\n\t\tCallback: func(inputs []interface{}) (interface{}, error) {\n\t\t\tswitch input := inputs[0].(type) {\n\t\t\tcase string:\n\t\t\t\treturn len(input), nil\n\t\t\tcase []ast.Variable:\n\t\t\t\treturn len(input), nil\n\t\t\tcase map[string]ast.Variable:\n\t\t\t\treturn len(input), nil\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"must provide either a list, map or string, got %T\", input)\n\t\t\t}\n\t\t},\n\t}\n}", "title": "" }, { "docid": "a36fe2bec0adce51278a05f495886c18", "score": "0.5621358", "text": "func (cu *Cleanup) Len() int {\n\tif cu == nil {\n\t\treturn 0\n\t}\n\tcu.mu.Lock()\n\tdefer cu.mu.Unlock()\n\n\treturn len(cu.fns)\n}", "title": "" }, { "docid": "fad2f777b1f76ad2ff1cc8840a08aa82", "score": "0.56118983", "text": "func (o Or) Size() int { return size(o.Args) }", "title": "" }, { "docid": "66e8f2f7c1e269326a1dcf36efa3ce6f", "score": "0.56073606", "text": "func (operators *Operators) Len() int {\n\treturn len(operators.Matchers) + len(operators.Extractors)\n}", "title": "" }, { "docid": "2d0ff4fee9e8eeb8dae9faa73af13f92", "score": "0.5593603", "text": "func (stack *Stack[T]) Size() uint {\n\tstack.key.RLock()\n\tdefer stack.key.RUnlock()\n\tif stack.underlyer == nil {\n\t\treturn 0\n\t}\n\treturn stack.underlyer.Length()\n}", "title": "" }, { "docid": "3fc164d97f3aacfd6defea0d6d057b72", "score": "0.55907595", "text": "func (a And) Size() int { return size(a.Args) }", "title": "" }, { "docid": "0ff2158641c3d9aa7a3faa62ebed8fab", "score": "0.55775136", "text": "func (False) Size() int { return 0 }", "title": "" }, { "docid": "ecb492970dd9374988550605d84e1a2e", "score": "0.55616134", "text": "func Len(get func(*, byte)(*), list *) (count int) {\n\te := get(list, Next)\n\tfor e != list {\n\t\te = get(e, Next)\n\t\tcount++;\n\t}\n\treturn count\n}", "title": "" }, { "docid": "e7ba5b4bdbca8d54f2081bc251bdd839", "score": "0.55596125", "text": "func (savedStates *stateStack) size() int {\n\treturn len(*savedStates)\n}", "title": "" }, { "docid": "c0ce44282efe6ce84e296d42546ef522", "score": "0.5559189", "text": "func length(list **, link func(*) *[2]*) (count int) {\n\n\tif nil == *list {\n\t\treturn 0\n\t}\n\n\tvar e *;\n\te = (*link(*list))[Next]\n\n\tfor e != *list {\n\t\te = (*link(e))[Next]\n\t\tcount++;\n\t}\n\tcount++\n\treturn count\n}", "title": "" }, { "docid": "641a0c9780cc0b3a13931859020f11ce", "score": "0.5523444", "text": "func (cc chunkSelectors) size() int {\n\tsum := 0\n\tfor _, c := range cc {\n\t\tif c.selected {\n\t\t\tsum += c.Len\n\t\t}\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "d8fcf42c63f41d857419b3f87a1a715b", "score": "0.5522693", "text": "func (receiver *SineList) Size() int {\n if receiver != nil {\n return len(*receiver)\n }\n return -1\n}", "title": "" }, { "docid": "fc8d10983ded24864e20b8f7962fc9c1", "score": "0.54909426", "text": "func lambdaCapturesInOneLambdaExpression(count string) string {\n\tcontent := iostream\n\trequiredCount, _ := strconv.Atoi(count)\n\tcontent += \"int main() {\\n\"\n\n\tfor i := 0; i < requiredCount; i++ {\n\t\tcontent += \"\\t int v\" + strconv.Itoa(i) + \" = 1;\\n\"\n\t}\n\n\tcontent += \"\\t auto lambda_ref = [\"\n\tfor i := 0; i < requiredCount; i++ {\n\t\tcontent += \"&v\" + strconv.Itoa(i)\n\t\tif i < requiredCount-1 {\n\t\t\tcontent += \", \"\n\t\t} else {\n\t\t\tcontent += \"]() -> int {\\n\"\n\t\t}\n\t}\n\tcontent += \"\\t\\treturn \"\n\tfor i := 0; i < requiredCount; i++ {\n\t\tcontent += \"v\" + strconv.Itoa(i)\n\t\tif i < requiredCount-1 {\n\t\t\tcontent += \" + \"\n\t\t} else {\n\t\t\tcontent += \";\\n\\t};\\n\"\n\t\t}\n\t}\n\tcontent += \"\\tint v_ref = lambda_ref();\\n\"\n\tcontent += \"\\tstd::cout << v_ref << std::endl;\\n}\\n\"\n\treturn writeTestFile(trace(), count, content)\n}", "title": "" }, { "docid": "aa32fc3436bd208eea4fd053bf9a4e91", "score": "0.5477024", "text": "func (s *Stack[T]) Size() int {\n\treturn s.list.Size()\n}", "title": "" }, { "docid": "821aa78072b445b71b203f20962d7035", "score": "0.5472567", "text": "func (fb *functionBuilder) emitLen(s, l int8, t reflect.Type) {\n\ta := stringRegister\n\tif t.Kind() != reflect.String {\n\t\ta = generalRegister\n\t}\n\tfb.fn.Body = append(fb.fn.Body, runtime.Instruction{Op: runtime.OpLen, A: int8(a), B: s, C: l})\n}", "title": "" }, { "docid": "4d89e1a38b485bb1a719191bceef8a20", "score": "0.54679954", "text": "func (p Pipeline) Len() int { return len(p.operations) }", "title": "" }, { "docid": "d1a7829a012920e5868e1465ac93d763", "score": "0.5454798", "text": "func (l List) Length() int {\n\tlength := 0\n\tl.ForEach(func(val interface{}) {\n\t\tlength++\n\t})\n\treturn length\n}", "title": "" }, { "docid": "f6ebe23ec57b0464bf951e4ef3f03fca", "score": "0.5454458", "text": "func (a anyTypeS) Size() Cardinality { return Cardinal(len(a)) }", "title": "" }, { "docid": "3643fe8ac536eb93e43b6e2702de1b60", "score": "0.54452425", "text": "func (n Not) Size() int { return 1 + n.Arg.Size() }", "title": "" }, { "docid": "45f55d3e99d14f04e9df01da4da08b26", "score": "0.5427275", "text": "func (s *stack) Size() int {\n\treturn len(s.items)\n}", "title": "" }, { "docid": "477b35c71992fa66fd917b2cef5aad95", "score": "0.5410771", "text": "func (body *FuncStart) BodySize() int {\n\treturn 2 + 4 + 2 + 4 + 4 + 4 + 1 + int(body.PathLen) + 1 + int(body.NameLen)\n}", "title": "" }, { "docid": "4b7f47484bfa2a685a04ae241c3486e3", "score": "0.541002", "text": "func (s *Promises) Size() int {\n\treturn len(s.values)\n}", "title": "" }, { "docid": "3c32b597a75091f045c52c42f3b48852", "score": "0.5407469", "text": "func (s *Stack) Size() int {\r\n return len(s.data)\r\n}", "title": "" }, { "docid": "deacb79f4f9cdb4443f9f5772f4463be", "score": "0.54025716", "text": "func (c *simple) Size() int {\n\tc.RLock()\n\tdefer c.RUnlock()\n\n\treturn len(c.accessMap)\n}", "title": "" }, { "docid": "9ea65dd0e4a00194d1463ba8c03c8d8c", "score": "0.5401372", "text": "func (s *arrayStack[T]) Size() int {\n\treturn s.listSize\n}", "title": "" }, { "docid": "fdcc9692ae9985e50aa14af86b0dfc1d", "score": "0.53989214", "text": "func (RunTestStatusNeq) Size() int { return 1 }", "title": "" }, { "docid": "d749588d66a4669563e6a6bb7c78b00d", "score": "0.53916353", "text": "func (l *staticLayer) Size() (int64, error) {\n\treturn int64(len(l.b)), nil\n}", "title": "" }, { "docid": "d749588d66a4669563e6a6bb7c78b00d", "score": "0.53916353", "text": "func (l *staticLayer) Size() (int64, error) {\n\treturn int64(len(l.b)), nil\n}", "title": "" }, { "docid": "241c91e75624690efc11735992aa8109", "score": "0.5380758", "text": "func (s *Stack[T]) Size() uint {\n\treturn s.container.Size()\n}", "title": "" }, { "docid": "45ddbab2b0e89190b87a3c5a77bf4d43", "score": "0.5369577", "text": "func (p *Pipeline) Size() int {\n\treturn len(p.stages)\n}", "title": "" }, { "docid": "153374ea514078db28274fd38c4d0c5f", "score": "0.53641415", "text": "func (TestNamePattern) Size() int { return 1 }", "title": "" }, { "docid": "5edd47938e3efd860a7f75a1972a7c8f", "score": "0.53555596", "text": "func (Triaged) Size() int { return 1 }", "title": "" }, { "docid": "906fb1d782879f01c1ac14c00b8ab7c2", "score": "0.5342641", "text": "func (s Stack) Size() int {\n return s.list.Len()\n}", "title": "" }, { "docid": "8b7c6e73858b0083e95606a9cb816b77", "score": "0.53418154", "text": "func _1609sqlite3ExprVectorSize(tls *crt.TLS, _pExpr uintptr /* *TExpr */) (r int32) {\n\tvar _op Tu8\n\n\t_op = *(*Tu8)(unsafe.Pointer(_pExpr))\n\tif int32(_op) != int32(150) {\n\t\tgoto _1\n\t}\n\n\t_op = *(*Tu8)(unsafe.Pointer(_pExpr + 38))\n_1:\n\tif int32(_op) != int32(151) {\n\t\tgoto _2\n\t}\n\n\treturn *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(_pExpr + 20))))\n\n\tgoto _3\n\n_2:\n\tif int32(_op) != int32(119) {\n\t\tgoto _4\n\t}\n\n\treturn *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(_pExpr + 20))))))\n\n\tgoto _5\n\n_4:\n\treturn int32(1)\n\n_5:\n_3:\n\treturn r\n}", "title": "" }, { "docid": "ba443acf709d06ca6b75c516024bde4d", "score": "0.5341802", "text": "func (n *StackList) Size() int {\n\tcount := 0\n\tcurrent := n.head\n\tfor current != nil {\n\t\tcount += 1\n\t\tcurrent = current.nextNode\n\t}\n\treturn count\n}", "title": "" }, { "docid": "40c6731a9996c6e5a0b1e7e00eff36f8", "score": "0.53339875", "text": "func payloadSizeGenerator() func() uint64 {\n\tnextPayloadSize := uint64(1024)\n\n\treturn func() uint64 {\n\t\tthisPayloadSize := nextPayloadSize\n\t\tnextPayloadSize *= 2\n\t\treturn thisPayloadSize\n\t}\n}", "title": "" }, { "docid": "1e0bc8b2736534ef1cf98b9bf2590d3e", "score": "0.5333104", "text": "func (s *Stack) Len() int {\n s.mutex.Lock()\n defer s.mutex.Unlock()\n return s.size\n}", "title": "" }, { "docid": "687406424e25cd1e250142d3b1ea1ce7", "score": "0.5331117", "text": "func Size(x string) int {\n\ti := 0\n\tfor _ = range x {\n\t\ti++\n\t}\n\treturn i\n}", "title": "" }, { "docid": "3d38d691caa5d1921e47255088b25355", "score": "0.5330766", "text": "func (s Generic[T]) Size() int { return len(s.m) }", "title": "" }, { "docid": "fb1d933737209c399599b6e2ec7de1b0", "score": "0.532299", "text": "func (RunTestStatusEq) Size() int { return 1 }", "title": "" }, { "docid": "67b4dfb955c670c878a37c0381b169db", "score": "0.5305753", "text": "func (s *Stack) Size() int {\n\treturn len(s.items)\n}", "title": "" }, { "docid": "155841de7670cd39ed1e277320a321d5", "score": "0.52983737", "text": "func (s *Stack) Size() int {\n\treturn len(s.frames)\n}", "title": "" }, { "docid": "30ec52aaef54b37766d7cbd7e16d3053", "score": "0.52943254", "text": "func (c *lru) Size() int {\n\tc.mut.Lock()\n\tdefer c.mut.Unlock()\n\n\treturn len(c.byKey)\n}", "title": "" }, { "docid": "d9fdcd260d12b2b3a048072f444b6a8d", "score": "0.5281682", "text": "func (t *HashTreap) Size() int {\n\treturn t.size\n}", "title": "" }, { "docid": "d867a6f235dc57a4afe1cbb24ccd41dd", "score": "0.5279527", "text": "func (d *digest) Size() int { return Size }", "title": "" }, { "docid": "63adf7afbf3a81ec81cd9df60d1e5004", "score": "0.52793044", "text": "func (list *SinglyLinkedList) Size() int { return list.count }", "title": "" }, { "docid": "73ff2448612899b8a0edb8cec40122a2", "score": "0.5271813", "text": "func (w *Watcher) Size() int {\n\tw.Lock()\n\tdefer w.Unlock()\n\treturn len(w.depViewMap)\n}", "title": "" }, { "docid": "d7575f4656656840249e86d4caa54a8e", "score": "0.52508163", "text": "func (s *stack) len() int {\n\treturn len(*s)\n}", "title": "" }, { "docid": "cce1706ce1f767303dfdf5276f95d7ae", "score": "0.5242325", "text": "func (cf *Filter64S) Len() (n int) {\n\tfor _, b := range cf.buckets {\n\t\tfor ; b > 0; b >>= fpBitsNumS {\n\t\t\tif b&fpMaskS > 0 {\n\t\t\t\tn++\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "a65282440aabb46fc7b6bf1750b1649a", "score": "0.5237783", "text": "func (g *Grammar) Size() int {\n\treturn len(g.rules)\n}", "title": "" }, { "docid": "c86211fa518a194c19adea20cd142924", "score": "0.52321154", "text": "func (a Resolver) Len() int {\n\treturn len(a)\n}", "title": "" }, { "docid": "7bc5e86d91306cc810484ee7a6d73ecb", "score": "0.52288616", "text": "func (node *Node[K, V]) Size() int {\n\tif node == nil {\n\t\treturn 0\n\t}\n\n\treturn node.size\n}", "title": "" }, { "docid": "af0d9f8a66d7c049220935948e7ecdc4", "score": "0.52146447", "text": "func (s *Storage) SizeOf(txType blockchain.TxType) (count int) {\n\ts.mx.RLock()\n\tdefer s.mx.RUnlock()\n\tfor _, tx := range s.txs {\n\t\tif tx.Type == txType {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "8d70f0251fb893348c09bd60fb02d9f8", "score": "0.5214557", "text": "func (c *ContextStack) Size() int {\n\treturn len(c.contexts)\n}", "title": "" }, { "docid": "900383dc3895a7fd953885e86a73544f", "score": "0.52126056", "text": "func (node *CallGraphStage) ArrayLength() int {\n\tif node.split != nil {\n\t\treturn node.split.Source.ArrayLength()\n\t}\n\treturn node.call.ArrayLength()\n}", "title": "" }, { "docid": "9f9ced8e2b4aec44bc7cea66ed15948b", "score": "0.521038", "text": "func (m Twalk) Len() int { return 4 + 4 + nlen(m.Names) }", "title": "" }, { "docid": "a79051eb8b8396b69794ab87e5228ece", "score": "0.5202726", "text": "func (p *HashStartStop) Size() uint32 { return 0 }", "title": "" }, { "docid": "e62ea7f2fb49b5e99aec37da427f9fa9", "score": "0.5201678", "text": "func (s *Stack) Length() {\n\tfmt.Println(len(s.data))\n}", "title": "" }, { "docid": "23ccd8b4ff570a4d6c9d6edc8878553c", "score": "0.51986945", "text": "func (e *ExtensionNode) Size() int {\n\treturn io.GetVarSize(len(e.key)) + len(e.key) +\n\t\t1 + util.Uint256Size // e.next is never empty\n}", "title": "" }, { "docid": "80b5cda3b1f11bcad324767962314773", "score": "0.51982933", "text": "func (tm *TimedMap) Size() int {\n\treturn len(tm.container)\n}", "title": "" }, { "docid": "e87d34afe939bd9d5601bb1294c1feb5", "score": "0.51964396", "text": "func (cg CallGraph) Size() (int, int, int) {\n\treturn len(cg.nodes), len(cg.calls), len(cg.flows)\n}", "title": "" }, { "docid": "b6bdf77e709c8ba68c38d4e85095866e", "score": "0.5195728", "text": "func (xx *XXHash64) Size() int {\n\treturn 8\n}", "title": "" }, { "docid": "aa26467621999552fcb289065fad4b48", "score": "0.5189046", "text": "func _1874dupedExprSize(tls *crt.TLS, _p uintptr /* *TExpr */, _flags int32) (r int32) {\n\tvar _nByte int32\n\n\t_nByte = int32(0)\n\tif _p == 0 {\n\t\tgoto _1\n\t}\n\n\t_nByte = _1877dupedExprNodeSize(tls, _p, _flags)\n\tif (_flags & int32(0x1)) == 0 {\n\t\tgoto _2\n\t}\n\n\t_nByte = int32(_nByte + (_1874dupedExprSize(tls, *(*uintptr)(unsafe.Pointer(_p + 12)), _flags) + _1874dupedExprSize(tls, *(*uintptr)(unsafe.Pointer(_p + 16)), _flags)))\n_2:\n_1:\n\treturn _nByte\n}", "title": "" }, { "docid": "94f4f65e47de510eb8184131807d514f", "score": "0.5188429", "text": "func Size() (int, error) {\n\treturn activeStore.Size()\n}", "title": "" }, { "docid": "8b76a3309d0556aa25f5155e7013f314", "score": "0.5182727", "text": "func _1876exprStructSize(tls *crt.TLS, _p uintptr /* *TExpr */) (r int32) {\n\tif ((*(*Tu32)(unsafe.Pointer(_p + 4))) & Tu32(0x4000)) == Tu32(0) {\n\t\tgoto _1\n\t}\n\n\treturn int32(12)\n\n_1:\n\tif ((*(*Tu32)(unsafe.Pointer(_p + 4))) & Tu32(0x2000)) == Tu32(0) {\n\t\tgoto _2\n\t}\n\n\treturn int32(28)\n\n_2:\n\treturn int32(48)\n}", "title": "" }, { "docid": "3e8065cb8b2f83b88de5752cc14c2deb", "score": "0.518214", "text": "func (s *Stack) Size() int {\n\treturn len(s.s)\n}", "title": "" }, { "docid": "8157f806a3f2ec28596726cd364d9c4f", "score": "0.5180704", "text": "func (l *Listener) countInObjSize(className string) {\n\tif l.isInClassAttributes {\n\t\tl.classTable[l.scopeStack.Top()].Objects = append(l.classTable[l.scopeStack.Top()].Objects, className)\n\t} else {\n\t\tl.getCurrentFunctionTable()[l.currentFunction].Objects = append(l.getCurrentFunctionTable()[l.currentFunction].Objects, className)\n\t}\n}", "title": "" }, { "docid": "68f4935d6bd258fedecf1299b6e7ae60", "score": "0.5168309", "text": "func (b ImportBlock) Size() int {\n\tvar n int\n\tfor _, g := range b {\n\t\tn += len(g)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "dae9d08a91908920f77fefa1d933921e", "score": "0.5165019", "text": "func (s *arrayStack) Size() int {\n\treturn s.listSize\n}", "title": "" }, { "docid": "42aa6c5c96cd29bb250895e0646a470b", "score": "0.5164369", "text": "func (batch *Batch) Size() int {\n\treturn len(batch.events)\n}", "title": "" }, { "docid": "402c8d7e094112596ad800bb74549d25", "score": "0.51640624", "text": "func (l *ListArr) Size() int { return l.count }", "title": "" }, { "docid": "5d66ee166388b810aef6b08356fcd853", "score": "0.5159919", "text": "func (l *sourcelist) Size() int {\n\treturn int(atomic.LoadInt32(&l.size))\n}", "title": "" }, { "docid": "920c66e970b1c6a4266033a62f521a47", "score": "0.5159271", "text": "func (s *Stack) Size() int {\n\treturn s.count\n}", "title": "" }, { "docid": "bd66a83fe9b8966caec6b99fe4af3467", "score": "0.5158884", "text": "func l(params ...interface{}) {\n\tfmt.Println(len(params))\n}", "title": "" }, { "docid": "94c3414cb703dcde765ec4813640a3f5", "score": "0.5155449", "text": "func (s *Stack) Size() int {\n\treturn len(*s)\n}", "title": "" }, { "docid": "94c3414cb703dcde765ec4813640a3f5", "score": "0.5155449", "text": "func (s *Stack) Size() int {\n\treturn len(*s)\n}", "title": "" }, { "docid": "94c3414cb703dcde765ec4813640a3f5", "score": "0.5155449", "text": "func (s *Stack) Size() int {\n\treturn len(*s)\n}", "title": "" }, { "docid": "3d5a9a51c7619afdc7209ac4009f048d", "score": "0.51553464", "text": "func (s *Skein) Size() int {\n\ti := s.getHashSize()\n\tif (i & 0x7) != 0 {\n\t\treturn 0\n\t}\n\treturn i / 8\n}", "title": "" }, { "docid": "e58823d59c785a9fd5a20553eeb41128", "score": "0.5154294", "text": "func (a *Analytics) Size() (int, error) {\n\tevents, err := a.Events()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"reading events\")\n\t}\n\n\treturn len(events), nil\n}", "title": "" }, { "docid": "9723c8e089dd8d9229ad2589bb850b47", "score": "0.51527524", "text": "func (s *Stack) Size() int {\n\treturn len(s.elements)\n}", "title": "" }, { "docid": "695529416c316e50de3bdb1c77d13579", "score": "0.5150943", "text": "func (a ArgTypes) Length() int {\n\treturn len(a)\n}", "title": "" }, { "docid": "a2286acf8d71678b8c13046e9cbb417d", "score": "0.5150476", "text": "func (body SourceBody) Size() uint {\n\treturn uint(len(body))\n}", "title": "" }, { "docid": "a186e0fac90c192f3ae17df405161a1b", "score": "0.5138085", "text": "func (h *hashRing) Size() int {\n\th.RLock()\n\tdefer h.RUnlock()\n\treturn len(h.nodes)\n}", "title": "" }, { "docid": "bbeda5402a02f42325b8b1188ca05d25", "score": "0.51357704", "text": "func (s *Stack) Size() int {\n\treturn s.list.Size()\n}", "title": "" }, { "docid": "d010e4c28f30115e0675ea0856b0ab1c", "score": "0.51349324", "text": "func (s *Stack) Size() int {\n\treturn s.list.Len()\n}", "title": "" }, { "docid": "130d8eaabfa8e081fbc7e2552b3a63f9", "score": "0.5134013", "text": "func (p *QueryProof) Size() (bytes int) {\n\tbytes = len(p.Key) + len(p.Value)\n\tfor i := 0; i < len(p.Nodes); i++ {\n\t\tbytes += len(p.Nodes[i].Hash) + len(p.Nodes[i].Key) + len(p.Nodes[i].Value)\n\t}\n\treturn\n}", "title": "" }, { "docid": "224f38d4987cdb0da61a509aad44a528", "score": "0.51297826", "text": "func Len(data interface{}) int {\n\tv := reflect.Indirect(reflect.ValueOf(data))\n\th := getTypeHandler(v.Type())\n\n\treturn handleVariableLength(h, v)\n}", "title": "" }, { "docid": "c656e0d213ba407983fd9183475617c5", "score": "0.5121929", "text": "func (s Stack) Size() uint32 {\n\treturn s.list.Length()\n}", "title": "" }, { "docid": "587a71a9ca792c0c7fc681d5cc2c4a43", "score": "0.5120496", "text": "func (kvmsg *Kvmsg) Size() int {\n\tif kvmsg.present[frame_BODY] {\n\t\treturn len(kvmsg.frame[frame_BODY])\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "12d719c7a4b110fdb566b72246b34569", "score": "0.511832", "text": "func testLambda(predefinded int) func() int {\n\ti := predefinded\n\treturn func() int {\n\t\ti += 1\n\t\treturn i\n\t}\n}", "title": "" }, { "docid": "691cd3f080054b89366c6496afe04a98", "score": "0.5115553", "text": "func (b *BlockReference) Size() int {\n\treturn len(b.Hash) + 100\n}", "title": "" }, { "docid": "72707086b1d92660ff59142b2be1bf04", "score": "0.51043046", "text": "func (d *Dense[_]) Size() int {\n\treturn len(d.data)\n}", "title": "" } ]
612e17753c97ff57b53d28a1c52a591c
Content returns the data
[ { "docid": "7f67333c556f82e05c492efbcea1c6ef", "score": "0.5892646", "text": "func (x XML) Content() []byte {\n\treturn x\n}", "title": "" } ]
[ { "docid": "cd1e475af5c8d2639d5dd9e6ea793464", "score": "0.73701715", "text": "func (this *httpResult) Content() (httpContent) {\n\treturn this.content\n}", "title": "" }, { "docid": "1ec4cb11c5186c0feb9e13d0ace90530", "score": "0.7113976", "text": "func (c *wrapper) Content() []byte {\n\treturn c.content\n}", "title": "" }, { "docid": "520e7c8f6420174016a2cd79c64716f3", "score": "0.706753", "text": "func (c *Cfgo) Content() []byte {\n\tc.lc.RLock()\n\tdefer c.lc.RUnlock()\n\treturn c.content\n}", "title": "" }, { "docid": "458e3cfa2eacb3d318c0dc88a20c2ade", "score": "0.7024844", "text": "func (result *Result) Content() interface{} {\n\treturn result.content\n}", "title": "" }, { "docid": "e6e639ab79cb9695662e69d87fb3004d", "score": "0.68993497", "text": "func (o FileContentBufferResponseOutput) Content() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FileContentBufferResponse) string { return v.Content }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b3ba82e6508a6788df26f0dc7b00251a", "score": "0.6837173", "text": "func GetContent(w http.ResponseWriter, r *http.Request) {\r\n\tresp := NewResponse()\r\n\terr := r.ParseForm()\r\n\tif err != nil {\r\n\t\tresp.Errors = append(resp.Errors, err.Error())\r\n\t\tWriteJSON(w, resp)\r\n\t\treturn\r\n\t}\r\n\r\n\tvalue := r.FormValue(\"text\")\r\n\tif value == \"\" {\r\n\t\tresp.Errors = append(resp.Errors, \"No text supplied.\")\r\n\t\tWriteJSON(w, resp)\r\n\t\treturn\r\n\t}\r\n\tresponseChannel := make(chan Message, 1) // we use a buffered channel so we don't block the StoreManager untill our call gets some cpu time to read the value\r\n\tact := Action{\r\n\t\tActionGet,\r\n\t\tMessage{value, map[string]int{}},\r\n\t\tresponseChannel,\r\n\t\t0,\r\n\t}\r\n\tStoreChannel <- act // sending request for our data to the store manager\r\n\tresponse := <-responseChannel // waiting for a reply\r\n\tif response.Text == \"\" {\r\n\t\tresp.Errors = append(resp.Errors, \"Error, no result for supplied text\")\r\n\t\tWriteJSON(w, resp)\r\n\t\treturn\r\n\t}\r\n\tresp.Response = response\r\n\tWriteJSON(w, resp)\r\n}", "title": "" }, { "docid": "0374f7a96b1ba51b819c2901e3e9aaa7", "score": "0.6663847", "text": "func Content() []byte {\n\treturn Default().Content()\n}", "title": "" }, { "docid": "a81b922458c6a6c921781c92b77a84d0", "score": "0.66616714", "text": "func (m *Report) GetContent()([]byte) {\n return m.content\n}", "title": "" }, { "docid": "9df750e49f55042f590eba7bc228f58e", "score": "0.66039294", "text": "func (s *Source) Content() []byte {\n\treturn s.content\n}", "title": "" }, { "docid": "84b6c025ba7ae228279fab42d31e94c3", "score": "0.6545989", "text": "func GetContent(url string, data ...interface{}) string {\n\treturn RequestContent(\"GET\", url, data...)\n}", "title": "" }, { "docid": "b5613b82087366cbab4f4339aecf6c55", "score": "0.6519907", "text": "func (f *file) Content() []byte {\n\treturn f.c\n}", "title": "" }, { "docid": "b3867bd17d52d8b91e87600abfc766d0", "score": "0.6486193", "text": "func (obj *trade) Content() Content {\n\treturn obj.content\n}", "title": "" }, { "docid": "57f36707c57d3769f3d34ad16fe82b33", "score": "0.6481061", "text": "func getContent(resp *http.Response) ([]byte, error) {\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn body, nil\n}", "title": "" }, { "docid": "90c0269ce4cc65229f65304bf93056ed", "score": "0.6435092", "text": "func (p *Post) Content() []byte {\n\treturn p.contentBytes\n}", "title": "" }, { "docid": "a9565cd40bed4a971c180114b8d179dc", "score": "0.63962406", "text": "func Content(path string) ([]byte, error) {\n\treturn Open(path).Bytes()\n}", "title": "" }, { "docid": "ed842b504ef71e675612d23425a37671", "score": "0.6368248", "text": "func content(w http.ResponseWriter, _ *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\ttext, err := ioutil.ReadFile(\"/data/content.txt\")\n\tif err != nil {\n\t\tw.Write([]byte(fmt.Sprintf(\"Unable to load file %v\", err)))\n\t} else {\n\t\tw.Write([]byte(text))\n\t}\n}", "title": "" }, { "docid": "17eca9159bfe4e49b0edecdc0ea646bb", "score": "0.6356765", "text": "func (_DNSResolverContract *DNSResolverContractCaller) Content(opts *bind.CallOpts, node [32]byte) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _DNSResolverContract.contract.Call(opts, out, \"content\", node)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "ce1bc9455edcb69e51ead2d2ea360e63", "score": "0.6339026", "text": "func (_ResolverContract *ResolverContractCallerSession) Content(node [32]byte) ([32]byte, error) {\n\treturn _ResolverContract.Contract.Content(&_ResolverContract.CallOpts, node)\n}", "title": "" }, { "docid": "ce1bc9455edcb69e51ead2d2ea360e63", "score": "0.6339026", "text": "func (_ResolverContract *ResolverContractCallerSession) Content(node [32]byte) ([32]byte, error) {\n\treturn _ResolverContract.Contract.Content(&_ResolverContract.CallOpts, node)\n}", "title": "" }, { "docid": "238b444ef538a9ee5f79154df491361f", "score": "0.63234955", "text": "func (client httpClient) getContent(endpoint string) (bytes []byte, err error) {\n\thttpClient := &http.Client{Timeout: client.timeoutPeriod}\n\tresp, err := httpClient.Get(apiBaseUrl + endpoint)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\tclosingErr := resp.Body.Close()\n\t\tif err == nil {\n\t\t\terr = closingErr\n\t\t}\n\t}()\n\treturn ioutil.ReadAll(resp.Body)\n}", "title": "" }, { "docid": "70a7fbc31495d628e9bed597fd817e79", "score": "0.63172054", "text": "func (j JSON) Content() []byte {\n\treturn j\n}", "title": "" }, { "docid": "1f188dfe148141e5c7b69bc501ab2a93", "score": "0.6304165", "text": "func (o *O365) GetContent(urlStr string) ([]byte, error) {\n\tquery := map[string]string{\n\t\t\"PublisherIdentifier\": o.config.DirectoryID,\n\t}\n\tres, err := o.apiRequest(\"GET\", urlStr, nil, query, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\treturn ioutil.ReadAll(res.Body)\n}", "title": "" }, { "docid": "96d48a0bfea5a8e628a8b47437315020", "score": "0.6298969", "text": "func (b *Body) Content() string {\n\tif b.content == \"\" {\n\t\tcontent, err := ioutil.ReadAll(b)\n\t\tif err != nil {\n\t\t\treturn \"\"\n\t\t}\n\t\tb.content = string(content)\n\t}\n\treturn b.content\n}", "title": "" }, { "docid": "dad0ad8b9339045a961cf11223d4d047", "score": "0.6289313", "text": "func (m *EmailFileAssessmentRequest) GetContentData()(*string) {\n val, err := m.GetBackingStore().Get(\"contentData\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "6a267b44e1150c57ffd56fb1ea85100a", "score": "0.6282977", "text": "func (h *handler) getContent(digest string) []byte {\n\th.locker.RLock()\n\tdefer h.locker.RUnlock()\n\treturn h.content[digest]\n}", "title": "" }, { "docid": "bc29facf9d599e0cd35df877382c3676", "score": "0.6278102", "text": "func (_ResolverContract *ResolverContractSession) Content(node [32]byte) ([32]byte, error) {\n\treturn _ResolverContract.Contract.Content(&_ResolverContract.CallOpts, node)\n}", "title": "" }, { "docid": "bc29facf9d599e0cd35df877382c3676", "score": "0.6278102", "text": "func (_ResolverContract *ResolverContractSession) Content(node [32]byte) ([32]byte, error) {\n\treturn _ResolverContract.Contract.Content(&_ResolverContract.CallOpts, node)\n}", "title": "" }, { "docid": "d9b74cdad86d5d3a5ec7039fe62c3105", "score": "0.62652266", "text": "func (_DNSResolverContract *DNSResolverContractCallerSession) Content(node [32]byte) ([32]byte, error) {\n\treturn _DNSResolverContract.Contract.Content(&_DNSResolverContract.CallOpts, node)\n}", "title": "" }, { "docid": "ca8d0741df0bb9b0ed5020a9a47a0f54", "score": "0.62553847", "text": "func getContent(uri string) (body string, err error) {\n\tscrapeError = 0\n\n\thttpClient := &http.Client{\n\t\tTimeout: 10 * time.Second,\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\tInsecureSkipVerify: *insecure,\n\t\t\t},\n\t\t},\n\t}\n\n\treq, err := http.NewRequest(http.MethodGet, uri, nil)\n\n\tif err != nil {\n\t\tscrapeError = 1\n\t\tlog.Error(err)\n\t\treturn \"\", err\n\t}\n\n\treq.Header.Add(\"X-WSSE\", getWSSE())\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, err := httpClient.Do(req)\n\n\tif err != nil {\n\t\tscrapeError = 1\n\t\tlog.Error(err)\n\t\treturn \"\", err\n\t}\n\n\tif res.StatusCode < 200 || res.StatusCode >= 400 {\n\t\tlog.Error(res.Status)\n\t\tscrapeError = 1\n\t\treturn \"\", errors.New(\"HTTP return code: \" + strconv.Itoa(res.StatusCode))\n\t}\n\n\tcontent, err := ioutil.ReadAll(res.Body)\n\n\tif err != nil {\n\t\tscrapeError = 1\n\t\tlog.Error(err)\n\t\treturn \"\", errors.New(\"Error while getting HTTP content / reading body.\")\n\t}\n\n\tdefer res.Body.Close()\n\n\treturn string(content), err\n}", "title": "" }, { "docid": "3e69031f66aacf76abb5ecadd1cf793c", "score": "0.62547433", "text": "func RequestContent(method string, url string, data ...interface{}) string {\n\treturn NewClient().RequestContent(method, url, data...)\n}", "title": "" }, { "docid": "878de2845b4bc6ebddcf8bf248f7960b", "score": "0.62475663", "text": "func (d *driver) GetContent(ctx context.Context, path string) ([]byte, error) {\n\n\trc, err := d.ReadStream(ctx, path, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rc.Close()\n\n\tbody, err := ioutil.ReadAll(rc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn body, nil\n}", "title": "" }, { "docid": "e4372ce3e0fbe10f8fa5d48ed03ac0b4", "score": "0.62322384", "text": "func (_ResolverContract *ResolverContractCaller) Content(opts *bind.CallOpts, node [32]byte) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _ResolverContract.contract.Call(opts, out, \"content\", node)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e4372ce3e0fbe10f8fa5d48ed03ac0b4", "score": "0.62322384", "text": "func (_ResolverContract *ResolverContractCaller) Content(opts *bind.CallOpts, node [32]byte) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _ResolverContract.contract.Call(opts, out, \"content\", node)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "be0ed8c78777434b795b71b5a352379f", "score": "0.62309426", "text": "func getContent(url string) string {\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn string(body)\n}", "title": "" }, { "docid": "7a2aff2620292ddc4bbc2f889a8ecec6", "score": "0.6226644", "text": "func (e *Echo) Content(contextInterface interface{}, getPanelFn types.GetPanelFn) {\n\n\tvar (\n\t\tctx echo.Context\n\t\tok bool\n\t)\n\tif ctx, ok = contextInterface.(echo.Context); !ok {\n\t\tpanic(\"wrong parameter\")\n\t}\n\n\tsesKey, err := ctx.Cookie(e.CookieKey())\n\n\tif err != nil || sesKey == nil {\n\t\t_ = ctx.Redirect(http.StatusFound, config.Get().Url(\"/login\"))\n\t\treturn\n\t}\n\n\tbody, authSuccess, err := e.GetContent(sesKey.Value, ctx.Path(),\n\t\tctx.Request().Method, ctx.Request().Header.Get(constant.PjaxHeader), getPanelFn, ctx)\n\n\tif !authSuccess {\n\t\t_ = ctx.Redirect(http.StatusFound, config.Get().Url(\"/login\"))\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\tlogger.Error(\"Echo Content\", err)\n\t}\n\n\t_ = ctx.Blob(http.StatusOK, e.HTMLContentType(), body)\n}", "title": "" }, { "docid": "026424f7f7434c57e23f2383c7b0af22", "score": "0.6161328", "text": "func (c *Controller) GetContent(v interface{}, r *http.Request) error {\n\tdecoder := json.NewDecoder(r.Body)\n\terr := decoder.Decode(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3c1aab8b4f451bdc483ab3d5aef00a8a", "score": "0.61592674", "text": "func (_DNSResolverContract *DNSResolverContractSession) Content(node [32]byte) ([32]byte, error) {\n\treturn _DNSResolverContract.Contract.Content(&_DNSResolverContract.CallOpts, node)\n}", "title": "" }, { "docid": "d835b864f0fd56d3c52b44a2c946da75", "score": "0.61567444", "text": "func (o EventResponseMessageResponseOutput) Content() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EventResponseMessageResponse) *string { return v.Content }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "20780dbad7c32851279e87c78fc97d52", "score": "0.6147898", "text": "func (o FileContentBufferOutput) Content() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FileContentBuffer) *string { return v.Content }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "709cede0ba37374ba3da297f2f228360", "score": "0.61459273", "text": "func (m *EducationItemBody) GetContent()(*string) {\n return m.content\n}", "title": "" }, { "docid": "a07ce7b42ebae2bbe9a59adc998f1840", "score": "0.61216444", "text": "func (log *BufferLogger) Content() (string, error) {\n\treturn log.out.(*bufferWriteCloser).String(), nil\n}", "title": "" }, { "docid": "3a3101baf43d883364bd0c5c2700b470", "score": "0.61185765", "text": "func Content(id int) (tables.Content, error) {\n\trows, err := mysqlBus.DB.Query(\"SELECT * FROM Content WHERE id=?\", id)\n\tif err != nil {\n\t\treturn tables.Content{}, err\n\t}\n\tdefer rows.Close()\n\n\tc := tables.Content{}\n\n\tfor rows.Next() {\n\t\tif err := rows.Scan(&c.ID, &c.Username, &c.Timestamp, &c.FilePath, &c.ContentName, &c.Public); err != nil {\n\t\t\treturn tables.Content{}, err\n\t\t}\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "c8178e6ce721ffb3169b4301c2ba47b5", "score": "0.61055905", "text": "func (p *Page) Content() []byte {\n\treturn p.contentBytes\n}", "title": "" }, { "docid": "c8178e6ce721ffb3169b4301c2ba47b5", "score": "0.61055905", "text": "func (p *Page) Content() []byte {\n\treturn p.contentBytes\n}", "title": "" }, { "docid": "5707c584db5bc1c8b244662521fb3816", "score": "0.6089091", "text": "func (c *Client) RequestDataContent(params []string) ([]byte, error) {\n\tfilingURL := c.baseURL + dataURL\n\tfor _, param := range params {\n\t\tfilingURL += \"/\" + param\n\t}\n\n\tresp, err := http.Get(filingURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn body, nil\n}", "title": "" }, { "docid": "c63e17ed7afccfa641a0ea91df156cbe", "score": "0.6086393", "text": "func (h HTML) Content() []byte {\n\treturn h\n}", "title": "" }, { "docid": "999dc292a516a8046c6e7dc4e04a6cdc", "score": "0.60826236", "text": "func (ch *Chi) Content(contextInterface interface{}, getPanelFn types.GetPanelFn) {\n\n\tvar (\n\t\tctx Context\n\t\tok bool\n\t)\n\tif ctx, ok = contextInterface.(Context); !ok {\n\t\tpanic(\"wrong parameter\")\n\t}\n\n\tsesKey, err := ctx.Request.Cookie(ch.CookieKey())\n\n\tif err != nil || sesKey == nil {\n\t\thttp.Redirect(ctx.Response, ctx.Request, cfg.Get().Url(\"/login\"), http.StatusFound)\n\t\treturn\n\t}\n\n\tbody, authSuccess, err := ch.GetContent(sesKey.Value, ctx.Request.URL.Path,\n\t\tctx.Request.Method, ctx.Request.Header.Get(constant.PjaxHeader), getPanelFn, ctx)\n\n\tif !authSuccess {\n\t\thttp.Redirect(ctx.Response, ctx.Request, cfg.Get().Url(\"/login\"), http.StatusFound)\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\tlogger.Error(\"Chi Content\", err)\n\t}\n\n\tctx.Response.Header().Set(\"Content-Type\", ch.HTMLContentType())\n\tctx.Response.WriteHeader(http.StatusOK)\n\t_, _ = ctx.Response.Write(body)\n}", "title": "" }, { "docid": "3dcb4f17a7fee18f45a33108994ab2f4", "score": "0.6073331", "text": "func (t CSV) Content() []byte {\n\treturn t\n}", "title": "" }, { "docid": "7007693eff39d03c044b152d6247d8e6", "score": "0.6073265", "text": "func (c *Client) DoRequestContent(urlStr string, form url.Values) (*http.Response, error) {\n\tvar resp *http.Response\n\tvar err error\n\n\tendpoint := strings.Join([]string{c.resourcesUrl, urlStr}, \"/\")\n\n\tresp, err = c.session.Get(endpoint, form, c.httpClient)\n\n\tif err != nil || resp == nil {\n\t\treturn nil, errors.New(\"Error making the request\")\n\t}\n\n\t// Don't close the body is a chunked HTTP response\n\t//defer resp.Body.Close()\n\n\tif resp.StatusCode >= 400 { // 400s and 500s\n\t\treturn resp, errors.New(fmt.Sprintf(\"Client response: %d\", resp.StatusCode))\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "aa7b954a36b9bda0cd9389e45de89722", "score": "0.6071829", "text": "func (c *ContentResult) Execute(ctx *HttpContext) error {\n\tif c.ContentType != \"\" {\n\t\tif ctype := ctx.ReqHeader(\"Content-Type\"); ctype != \"\" {\n\t\t\tctx.SetHeader(\"Content-Type\", c.ContentType)\n\t\t}\n\t}\n\n\tif w, ok := c.Data.(io.WriterTo); ok {\n\t\tw.WriteTo(ctx.Resonse)\n\t\treturn nil\n\t}\n\n\tif r, ok := c.Data.(io.Reader); ok {\n\t\tio.Copy(ctx.Resonse, r)\n\t\treturn nil\n\t}\n\n\tif b, ok := c.Data.([]byte); ok {\n\t\t// Write([]byte) (int, error)\n\t\tctx.Resonse.Write(b)\n\t\treturn nil\n\t}\n\n\tif s, ok := c.Data.(string); ok {\n\t\tio.WriteString(ctx.Resonse, s)\n\t\treturn nil\n\t}\n\n\tfmt.Fprintln(ctx.Resonse, c.Data)\n\treturn nil\n}", "title": "" }, { "docid": "65bf337e3484079bdec9c17943e026b9", "score": "0.6067754", "text": "func (msg ClientMessage) Content() string {\n\treturn msg.Text\n}", "title": "" }, { "docid": "2388023773e54770c6004b3a242a4c19", "score": "0.60618013", "text": "func (obj *content) Content() contents.Transaction {\n\treturn obj.content\n}", "title": "" }, { "docid": "a349dc551886e4c8887dce7cfb06a068", "score": "0.60468847", "text": "func (d *driver) GetContent(ctx context.Context, path string) ([]byte, error) {\n\treader, err := d.Reader(ctx, path, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ioutil.ReadAll(reader)\n}", "title": "" }, { "docid": "3d08e8820be5990f1ef99cdb9323ba12", "score": "0.60467637", "text": "func (m *GroupPolicyUploadedDefinitionFile) GetContent()([]byte) {\n val, err := m.GetBackingStore().Get(\"content\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]byte)\n }\n return nil\n}", "title": "" }, { "docid": "95c1fcc6cfa811dbf1bf8b8161c59c56", "score": "0.6045128", "text": "func (d *driver) GetContent(ctx context.Context, path string) ([]byte, error) {\n\tcontent, err := d.Conn.ObjectGetBytes(d.Container, d.swiftPath(path))\n\tif err != nil {\n\t\treturn nil, parseError(path, err)\n\t}\n\treturn content, nil\n}", "title": "" }, { "docid": "95c1fcc6cfa811dbf1bf8b8161c59c56", "score": "0.6045128", "text": "func (d *driver) GetContent(ctx context.Context, path string) ([]byte, error) {\n\tcontent, err := d.Conn.ObjectGetBytes(d.Container, d.swiftPath(path))\n\tif err != nil {\n\t\treturn nil, parseError(path, err)\n\t}\n\treturn content, nil\n}", "title": "" }, { "docid": "93ad815d8f840ecade5c84c921e567a8", "score": "0.60417753", "text": "func (j JPEG) Content() []byte {\n\treturn j\n}", "title": "" }, { "docid": "21143e7c661407b6a3aeaa00c2a3151a", "score": "0.6039169", "text": "func (t PlainText) Content() []byte {\n\treturn t\n}", "title": "" }, { "docid": "fc13f96d89807f19ea812f6c42b26988", "score": "0.6016275", "text": "func (o KeyOperationAttestationResponseOutput) Content() pulumi.StringOutput {\n\treturn o.ApplyT(func(v KeyOperationAttestationResponse) string { return v.Content }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "39c1a5a08bbfc9612639276216328e2a", "score": "0.60047305", "text": "func (statics AssestStruct) GetContent(name string) string {\n\ts, err := statics.GetAssestFile(name)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn s.Content\n}", "title": "" }, { "docid": "4cb2f900360db1baf93fe71414e54a97", "score": "0.59955376", "text": "func (fsys *FileSystem) ServeContent(w http.ResponseWriter, r *http.Request, name string) {\n\tif o, ok := fsys.objs[name]; ok {\n\t\tvar reader io.ReadSeeker\n\t\tif o.setHeaders(w, r) {\n\t\t\treader = strings.NewReader(o.data)\n\t\t} else {\n\t\t\treader = &zfile{object: o}\n\t\t}\n\t\thttp.ServeContent(w, r, o.name, o.time, reader)\n\t} else {\n\t\thttp.NotFound(w, r)\n\t}\n}", "title": "" }, { "docid": "8c20a7d90ef6237ad01aa28c2dfdf7b0", "score": "0.5995353", "text": "func (conn *Connection) do_request_content(rurl string, method string, params map[string][]string) ([]byte, error) {\n\tresp, err := conn.do_request(rurl, method, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create buffer\n\tcontent := make([]byte, 0)\n\tbuf := make([]byte, 1024)\n\tfor {\n\t\tn, err := resp.Body.Read(buf)\n\t\tif err != nil && err != io.EOF {\n\t\t\tpanic(err)\n\t\t}\n\t\tif n == 0 {\n\t\t\tbreak\n\t\t}\n\t\tcontent = append(content, buf[:n]...)\n\t}\n\treturn content, nil\n}", "title": "" }, { "docid": "a2b6caf11f3e539aabe99d388fc059f1", "score": "0.5990703", "text": "func (f *fileInMemory) GetContent() []byte {\n\treturn f.content\n}", "title": "" }, { "docid": "e8b815669595977fcba4b02b1d6aa8b3", "score": "0.5988977", "text": "func getPageContent(ctx context.Context, url string) ([]byte, error) {\n\tclient := http.DefaultClient\n\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)\n\tif err != nil {\n\t\tlog.Printf(\"Error creating request: %v\\n\", err)\n\t\treturn nil, err\n\t}\n\n\trsp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Printf(\"Error making request to RightMove: %v\\n\", err)\n\t\treturn nil, err\n\t}\n\tdefer rsp.Body.Close()\n\tcontent, err := ioutil.ReadAll(rsp.Body)\n\n\tif err != nil {\n\t\tlog.Printf(\"Error reading request body: %v\\n\", err)\n\t\treturn nil, err\n\t}\n\n\treturn content, nil\n}", "title": "" }, { "docid": "bd207d7f1f6b3193e344a969773f680a", "score": "0.5969315", "text": "func (r *Response) GetContent() string {\n\treturn r.content\n}", "title": "" }, { "docid": "8c99b8ff25f5039a54844b3e113f5e9e", "score": "0.59648883", "text": "func (i *InviteV2StrippedState) Content() RawJSON {\n\treturn i.fields.Content\n}", "title": "" }, { "docid": "826c6959482b19e60f57b0342051e3f9", "score": "0.5952604", "text": "func (c CharData) GetContent() []Contenter {\n\treturn nil\n}", "title": "" }, { "docid": "6e93b5b84723c0d54a07039d6f8e69f6", "score": "0.594993", "text": "func (this *FileInfo) GetContent() []byte {\n\treturn this.content\n}", "title": "" }, { "docid": "63692d8d7ef8c1bab12403d10b71317c", "score": "0.5922424", "text": "func getContent(targetUrl string) ([]byte,error) {\n\treq, err := GetRnvApiHttpRequest(targetUrl)\n\tlog.Println(targetUrl)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\tu,errU:=url.Parse(os.Getenv(\"https_proxy\"))\n\tif errU != nil {\n\t\tlog.Println(errU)\n\t\treturn nil, errU\n\t}\n tr:=&http.Transport{}\n if (u.String()!=\"\"){\n tr = &http.Transport{\n \t\tDial: (&net.Dialer{\n Timeout: 5 * time.Second,\n \t}).Dial,\n \t\tTLSHandshakeTimeout: 5 * time.Second,\n \t Proxy: http.ProxyURL(u),\n \t}\n } else {\n tr = &http.Transport{\n \t\tDial: (&net.Dialer{\n Timeout: 5 * time.Second,\n \t}).Dial,\n \t\tTLSHandshakeTimeout: 5 * time.Second,\n \t}\n }\n\n\tclient := &http.Client{\n\t\tTimeout: time.Second * 10,\n\t\tTransport: tr,\n\t}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n // log.Println(\"RES: \"+resp.Status+\" \"+resp.Proto)\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\treturn body, nil\n}", "title": "" }, { "docid": "c739ee781bedd1518cc2f4a3aa792140", "score": "0.59184515", "text": "func (*UserController) Content(ctx *gomvc.HttpContext) string {\n\treturn fmt.Sprintln(\"request\", ctx.RequestPath)\n}", "title": "" }, { "docid": "d6d8dedee78d021ee923ba0f3869ed91", "score": "0.5917478", "text": "func (f *File) Content() (string, error) {\n\treturn f.importer.content(f)\n}", "title": "" }, { "docid": "0d0a65fa7c41b63b09d23cf8164145ff", "score": "0.5896099", "text": "func (o EventRequestMessageResponseOutput) Content() EventContentResponsePtrOutput {\n\treturn o.ApplyT(func(v EventRequestMessageResponse) *EventContentResponse { return v.Content }).(EventContentResponsePtrOutput)\n}", "title": "" }, { "docid": "c67500c29d63c1986488df0a01b93239", "score": "0.58906823", "text": "func (m *MockWorkItem) Content() (string, error) {\n\treturn m.content, nil\n}", "title": "" }, { "docid": "688681ac1abad10ef2b25b57f1559460", "score": "0.5877422", "text": "func (i *Importer) content(f *File) (string, error) {\n\tfile, err := i.client.Open(f.path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tinfo, err := file.Stat()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tbytes := make([]byte, info.Size())\n\n\tfile.Read(bytes)\n\tstr := string(bytes)\n\treturn str, nil\n}", "title": "" }, { "docid": "1ab102f9dda9fa1a338e6b94dffcca51", "score": "0.587079", "text": "func (program Program) GetContent() string {\n\treturn program.content\n}", "title": "" }, { "docid": "285c3e7f156b440f90a2cbd473306815", "score": "0.58687013", "text": "func (o ServiceVclResponseObjectOutput) Content() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceVclResponseObject) *string { return v.Content }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1228ac3fc430712a29d7c3880ef4a004", "score": "0.5865529", "text": "func (m *LoginPage) GetContent()(*string) {\n val, err := m.GetBackingStore().Get(\"content\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "c7d6ff2d53d361221854ac84e01dfbdf", "score": "0.5856894", "text": "func (f *FakeFile) GetContent() []byte {\n\treturn f.content\n}", "title": "" }, { "docid": "5fa026df908a424b590180be43876648", "score": "0.5854171", "text": "func (r *Resolver) Content() generated.ContentResolver { return &contentResolver{r} }", "title": "" }, { "docid": "0d964c528eb25369c2ff121d9182f457", "score": "0.585063", "text": "func (p *Parsed) Content() (string, error) {\n\teb := errBuffer{\n\t\tb: &bytes.Buffer{},\n\t}\n\n\tvar buf bytes.Buffer\n\n\tif err := parser.InterfaceToFrontMatter(p.frontMatter, p.frontMatterFormat, &buf); err != nil {\n\t\treturn \"\", errors.Wrap(eb.err, \"article: marshal frontMatter to YAML\")\n\t}\n\n\teb.Write(buf.Bytes())\n\teb.Write(p.content)\n\n\tif eb.err != nil {\n\t\treturn \"\", errors.Wrap(eb.err, \"article: output parsed content\")\n\t}\n\n\treturn eb.b.String(), nil\n}", "title": "" }, { "docid": "6b32707c75905672efe3d193a64a0c89", "score": "0.5846804", "text": "func (res *ThemedResource) Content() []byte {\n\tclr := fyne.CurrentApp().Settings().Theme().IconColor()\n\treturn colorizeResource(res.source, clr)\n}", "title": "" }, { "docid": "2a9d9af8b003151714ceed582cc943e1", "score": "0.5843361", "text": "func ServeContent(name string, modtime time.Time, content io.ReadSeeker) internal.HttpResponse {\n\treturn respondContent{name, modtime, content}\n}", "title": "" }, { "docid": "caa1470eea5d79f50d81c43909be5a7d", "score": "0.5836227", "text": "func (m *DriveItemVersion) GetContent()([]byte) {\n return m.content\n}", "title": "" }, { "docid": "e24268fd0a3d24185fd3a7983d9f9fef", "score": "0.58338815", "text": "func (m *ServiceAnnouncementAttachment) GetContent()([]byte) {\n val, err := m.GetBackingStore().Get(\"content\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]byte)\n }\n return nil\n}", "title": "" }, { "docid": "9a8b586f3f9c8326b0498bfee1397148", "score": "0.58222234", "text": "func (this httpContent) String() (s string) {\n\tif err := this.Decode(&s); err != nil {\n\t\treturn string(this)\n\t} else {\n\t\treturn s\n\t}\n}", "title": "" }, { "docid": "2ae696929b615b73a72246cdbcf8b52b", "score": "0.58210266", "text": "func ContentByURL(w http.ResponseWriter, req *http.Request) {\n\tstream(req.URL.RawQuery, w, req)\n}", "title": "" }, { "docid": "646673ce23cf2bc5e7810e787a12f625", "score": "0.58158344", "text": "func (msg ServerMessage) Content() string {\n\treturn msg.Text\n}", "title": "" }, { "docid": "d8e362a6ae49e279ed61a3212129fc62", "score": "0.58065015", "text": "func (p *Parser) Content() string {\n\tdat, err := ioutil.ReadFile(string(p.FileMeta))\n\tif err != nil {\n\t\tQuickPanic(ElaborateError{\n\t\t\tName: ParserError,\n\t\t\tMessage: err.Error(),\n\t\t\tParser: nil,\n\t\t\tChild: err,\n\t\t})\n\t}\n\treturn string(dat)\n}", "title": "" }, { "docid": "f5758af14d8460432d3142ffc44613b1", "score": "0.5801739", "text": "func (jbobject *JavaNetURLConnection) GetContent() (*JavaLangObject, error) {\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"getContent\", \"java/lang/Object\")\n\tif err != nil {\n\t\tvar zero *JavaLangObject\n\t\treturn zero, err\n\t}\n\tretconv := javabind.NewJavaToGoCallable()\n\tdst := &javabind.Callable{}\n\tretconv.Dest(dst)\n\tif err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {\n\t\tpanic(err)\n\t}\n\tretconv.CleanUp()\n\tunique_x := &JavaLangObject{}\n\tunique_x.Callable = dst\n\treturn unique_x, nil\n}", "title": "" }, { "docid": "6045cb2da63353105c8054c4e8a809d1", "score": "0.5798309", "text": "func (s RoomServer) GetContent(ctx context.Context, req *pb.ContentRequest) (*pb.ContentResponse, error) {\n\tuserID := ctx.Value(grpcmiddleware.StringKey).(string)\n\terr := s.getter.Call(ctx, s.db, userID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tret := pb.ContentResponse{\n\t\tTable: &pb.Table{\n\t\t\tId: uint64(23),\n\t\t\tName: \"HIKARI table\",\n\t\t},\n\t}\n\treturn &ret, nil\n}", "title": "" }, { "docid": "268f757f5d4e566a3699dca71edd4477", "score": "0.5772532", "text": "func (h *MediaHandlers) GetContent(c *gin.Context) {\n\tid, err := strconv.ParseUint(c.Param(\"id\"), 10, 0)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"id is not a valid integer\"})\n\t\treturn\n\t}\n\n\tpageIndex, err := strconv.Atoi(c.Query(\"page\"))\n\tif err != nil {\n\t\tpageIndex = 0\n\t}\n\n\terr = h.media.StreamMediaPage(uint(id), pageIndex, c.Writer)\n\tif err != nil {\n\t\tc.JSON(http.StatusNotFound, gin.H{\"error\": \"media not found\"})\n\t\treturn\n\t}\n\n\tc.Header(\"Content-type\", \"image/jpg\")\n\tc.Header(\"Content-Disposition\", \"inline\")\n\tc.Writer.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "c88ac126b71f3264962465bbb8e342d4", "score": "0.5769574", "text": "func GetContent(c *gin.Context) {\n\tstart := time.Now()\n\thashtag := c.Param(\"hashtag\")\n\n\tinstagram, instagramStories, twitter := getShit(hashtag)\n\n\tc.JSON(200, gin.H{\n\t\t\"result\": []NetworkResponse{\n\t\t\t{Name: \"instagram\", Posts: instagram},\n\t\t\t{Name: \"instagram_stories\", Posts: instagramStories},\n\t\t\t{Name: \"twitter\", Posts: twitter},\n\t\t},\n\t})\n\telapsed := time.Since(start)\n\tlog.Printf(\"Scrapping took %s\", elapsed)\n\n}", "title": "" }, { "docid": "552cda7963fa3608afce6a6a8f535895", "score": "0.5767133", "text": "func (c *Context) ServeContent(name string, modtime time.Time, content io.ReadSeeker) error {\n\thttp.ServeContent(c.Response, c.Request, name, modtime, content)\n\treturn nil\n}", "title": "" }, { "docid": "91f6ee5c34d0f1fe2add7080a1595ee7", "score": "0.57396173", "text": "func (c *control) Body(data interface{}) {\n\tvar content []byte\n\n\tif str, ok := data.(string); ok {\n\t\tcontent = []byte(str)\n\t\tif c.w.Header().Get(\"Content-type\") == \"\" {\n\t\t\tc.w.Header().Add(\"Content-type\", \"text/plain; charset=utf-8\")\n\t\t}\n\t} else {\n\t\tvar err error\n\t\tcontent, err = json.Marshal(data)\n\t\tif err != nil {\n\t\t\tc.w.WriteHeader(http.StatusInternalServerError)\n\t\t\tc.w.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\t\tif c.w.Header().Get(\"Content-type\") == \"\" {\n\t\t\tc.w.Header().Add(\"Content-type\", \"application/json\")\n\t\t}\n\t}\n\tif strings.Contains(c.req.Header.Get(\"Accept-Encoding\"), \"gzip\") {\n\t\tc.w.Header().Add(\"Content-Encoding\", \"gzip\")\n\t\tif c.code > 0 {\n\t\t\tc.w.WriteHeader(c.code)\n\t\t}\n\t\tgz := gzip.NewWriter(c.w)\n\t\tgz.Write(content)\n\t\tgz.Close()\n\t} else {\n\t\tif c.code > 0 {\n\t\t\tc.w.WriteHeader(c.code)\n\t\t}\n\t\tc.w.Write(content)\n\t}\n}", "title": "" }, { "docid": "492702b8a74eff3a61eb2b1c269c5a5e", "score": "0.5736022", "text": "func (c *CharterIPFSScraper) ScrapeContent(uri string) (*model.ScraperContent, error) {\n\tbys, err := utils.RetrieveIPFSLink(uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(bys) == 0 {\n\t\treturn nil, fmt.Errorf(\"No []byte returned\")\n\t}\n\n\tvar data map[string]interface{}\n\terr = json.Unmarshal(bys, &data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn model.NewScraperContent(\"\", \"\", uri, \"\", data), nil\n}", "title": "" }, { "docid": "d7ed651116897822c9162f93b5157600", "score": "0.5728835", "text": "func (c *Client) Bytes() ([]byte, error) {\n\tif _, err := c.Execute(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.res.Content()\n}", "title": "" }, { "docid": "40bbf7580e44d2b695e3b635769d3e08", "score": "0.57257867", "text": "func handle_content(res http.ResponseWriter, req *http.Request) {\n\tc, found := weeb.ContentByPath[req.URL.Path]\n\n\tif !found {\n\t\thttp.NotFound(res, req)\n\t\treturn\n\t}\n\n\tres.Header().Set(\"Content-Type\", c.ContentType)\n\tif len(c.ContentEncoding) != 0 {\n\t\tres.Header().Set(\"Content-Encoding\", c.ContentEncoding)\n\t}\n\tvar r io.ReadSeeker\n\tif len(c.Data) > 0 {\n\t\tr = bytes.NewReader(c.Data)\n\t} else {\n\t\tvar err error\n\t\tr, err = os.Open(c.FilePath)\n\t\tif err != nil {\n\t\t\thttp.NotFound(res, req)\n\t\t\treturn\n\t\t}\n\t}\n\thttp.ServeContent(res, req, \"\", time.Unix(c.UnixTimeLastModified, 0), r)\n}", "title": "" }, { "docid": "94d47af46291cb8965e16362e4163454", "score": "0.57221097", "text": "func (api *API) GetContentRaw(author, permlink string) (*json.RawMessage, error) {\n\treturn call.Raw(api.caller, \"get_content\", []string{author, permlink})\n}", "title": "" }, { "docid": "01dcb11846c85f731a63c58b0a978111", "score": "0.5721347", "text": "func (repocl *Client) GetContent(filepaths []string) error {\n\tdefer CleanUpTemp()\n\tutil.LogWrite(\"GetContent\")\n\n\terr := repocl.Connect()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = AnnexGet(filepaths)\n\treturn err\n}", "title": "" }, { "docid": "482dd89efbffff4074d28877dc894d4c", "score": "0.5721027", "text": "func (n *fsNode) GetContent() []byte {\n\treturn n.content\n}", "title": "" } ]
7532533cd6dee955a446345f4fd121ac
ValidateAndFixCNIResult verifies that netConfig contains proper list of ips, routes, interfaces and if something is missing it tries to complement that using patch for Weave or for plugins which return their netConfig in v0.2.0 version of CNI SPEC
[ { "docid": "5c01447e0ccd981bef28fe66d11341f3", "score": "0.7839053", "text": "func ValidateAndFixCNIResult(netConfig *cnicurrent.Result, nsPath string, allLinks []netlink.Link) (*cnicurrent.Result, error) {\n\t// If there are no routes provided, we consider it a broken\n\t// config and extract interface config instead. That's the\n\t// case with Weave CNI plugin. We don't do this for multiple CNI\n\t// at this point.\n\tif len(netConfig.IPs) == 1 && (cni.GetPodIP(netConfig) == \"\" || len(netConfig.Routes) == 0) {\n\t\tdnsInfo := netConfig.DNS\n\n\t\tveth, err := FindVeth(allLinks)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif netConfig, err = ExtractLinkInfo(veth, nsPath); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// extracted netConfig doesn't have DNS information, so\n\t\t// still try to extract it from CNI-provided data\n\t\tnetConfig.DNS = dnsInfo\n\n\t\treturn netConfig, nil\n\t}\n\n\tif len(netConfig.IPs) == 0 {\n\t\treturn nil, fmt.Errorf(\"cni result does not have any IP addresses\")\n\t}\n\n\t// Interfaces contain broken info more often than not, so we\n\t// replace them here with what we can deduce from the network\n\t// links in the container netns\n\tfor _, ipConfig := range netConfig.IPs {\n\t\tlink, err := findLinkByAddress(allLinks, ipConfig.Address)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfound := false\n\t\tfor i, iface := range netConfig.Interfaces {\n\t\t\tif iface.Name == link.Attrs().Name {\n\t\t\t\tipConfig.Interface = i\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\tipConfig.Interface = len(netConfig.Interfaces)\n\t\t\tnetConfig.Interfaces = append(netConfig.Interfaces, &cnicurrent.Interface{\n\t\t\t\tName: link.Attrs().Name,\n\t\t\t\tMac: link.Attrs().HardwareAddr.String(),\n\t\t\t\tSandbox: nsPath,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn netConfig, nil\n}", "title": "" } ]
[ { "docid": "e04b7db244a1ad5289b86ec5edb4fcda", "score": "0.655335", "text": "func (r *Runtime) configureNetNS(ctr *Container, ctrNS ns.NetNS) ([]*cnitypes.Result, error) {\n\tvar requestedIP net.IP\n\tif ctr.requestedIP != nil {\n\t\trequestedIP = ctr.requestedIP\n\t\t// cancel request for a specific IP in case the container is reused later\n\t\tctr.requestedIP = nil\n\t} else {\n\t\trequestedIP = ctr.config.StaticIP\n\t}\n\n\tvar requestedMAC net.HardwareAddr\n\tif ctr.requestedMAC != nil {\n\t\trequestedMAC = ctr.requestedMAC\n\t\t// cancel request for a specific MAC in case the container is reused later\n\t\tctr.requestedMAC = nil\n\t} else {\n\t\trequestedMAC = ctr.config.StaticMAC\n\t}\n\n\tpodName := getCNIPodName(ctr)\n\tnetworks, _, err := ctr.networks()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// All networks have been removed from the container.\n\t// This is effectively forcing net=none.\n\tif len(networks) == 0 {\n\t\treturn nil, nil\n\t}\n\n\t// Update container map of interface descriptions\n\tif err := ctr.setupNetworkDescriptions(networks); err != nil {\n\t\treturn nil, err\n\t}\n\tpodNetwork := r.getPodNetwork(ctr.ID(), podName, ctrNS.Path(), networks, ctr.config.PortMappings, requestedIP, requestedMAC, ctr.state.NetInterfaceDescriptions)\n\taliases, err := ctr.runtime.state.GetAllNetworkAliases(ctr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(aliases) > 0 {\n\t\tpodNetwork.Aliases = aliases\n\t}\n\n\tresults, err := r.setUpOCICNIPod(podNetwork)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnetworkStatus := make([]*cnitypes.Result, 0)\n\tfor idx, r := range results {\n\t\tlogrus.Debugf(\"[%d] CNI result: %v\", idx, r.Result)\n\t\tresultCurrent, err := cnitypes.GetResult(r.Result)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"error parsing CNI plugin result %q: %v\", r.Result, err)\n\t\t}\n\t\tnetworkStatus = append(networkStatus, resultCurrent)\n\t}\n\n\treturn networkStatus, nil\n}", "title": "" }, { "docid": "2aea54f1bcf5bbf20b521579de5f7ba7", "score": "0.6277527", "text": "func verifyNetworkingConfig(nwConfig *networktypes.NetworkingConfig) error {\n\tif nwConfig == nil || len(nwConfig.EndpointsConfig) == 0 {\n\t\treturn nil\n\t}\n\tif len(nwConfig.EndpointsConfig) == 1 {\n\t\tfor _, v := range nwConfig.EndpointsConfig {\n\t\t\tif v != nil && v.IPAMConfig != nil {\n\t\t\t\tif v.IPAMConfig.IPv4Address != \"\" && net.ParseIP(v.IPAMConfig.IPv4Address).To4() == nil {\n\t\t\t\t\treturn errors.Errorf(\"invalid IPv4 address: %s\", v.IPAMConfig.IPv4Address)\n\t\t\t\t}\n\t\t\t\tif v.IPAMConfig.IPv6Address != \"\" {\n\t\t\t\t\tn := net.ParseIP(v.IPAMConfig.IPv6Address)\n\t\t\t\t\t// if the address is an invalid network address (ParseIP == nil) or if it is\n\t\t\t\t\t// an IPv4 address (To4() != nil), then it is an invalid IPv6 address\n\t\t\t\t\tif n == nil || n.To4() != nil {\n\t\t\t\t\t\treturn errors.Errorf(\"invalid IPv6 address: %s\", v.IPAMConfig.IPv6Address)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\tl := make([]string, 0, len(nwConfig.EndpointsConfig))\n\tfor k := range nwConfig.EndpointsConfig {\n\t\tl = append(l, k)\n\t}\n\treturn errors.Errorf(\"Container cannot be connected to network endpoints: %s\", strings.Join(l, \", \"))\n}", "title": "" }, { "docid": "f872deae7e5540ee7a3899af74ac76ec", "score": "0.62498784", "text": "func configureAllBridgeCNIs(r Runner, cidr string) error {\n\t// non-podman bridge configs:\n\tout, err := r.RunCmd(exec.Command(\n\t\t\"sudo\", \"find\", DefaultConfDir, \"-maxdepth\", \"1\", \"-type\", \"f\", \"-name\", \"*bridge*\", \"-not\", \"-name\", \"*podman*\", \"-not\", \"-name\", \"*.mk_disabled\", \"-printf\", \"%p, \", \"-exec\", \"sh\", \"-c\",\n\t\t// remove ipv6 entries to avoid \"failed to set bridge addr: could not add IP address to \\\"cni0\\\": permission denied\"\n\t\t// ref: https://github.com/cri-o/cri-o/issues/3555\n\t\t// then also remove trailing comma after ipv4 elements, if any\n\t\t// ie, this will transform from, eg:\n\t\t// from: \"ranges\": [ [{ \"subnet\": \"10.85.0.0/16\" }], [{ \"subnet\": \"1100:200::/24\" }] ]\n\t\t// to: \"ranges\": [ [{ \"subnet\": \"10.244.0.0/16\" }] ]\n\t\t// getting something similar to https://github.com/cri-o/cri-o/blob/main/contrib/cni/11-crio-ipv4-bridge.conflist\n\t\tfmt.Sprintf(`sudo sed -i -r -e '/\"dst\": \".*:.*\"/d' -e 's|^(.*)\"dst\": (.*)[,*]$|\\1\"dst\": \\2|g' -e '/\"subnet\": \".*:.*\"/d' -e 's|^(.*)\"subnet\": \".*\"(.*)[,*]$|\\1\"subnet\": \"%s\"\\2|g' {}`, cidr), \";\"))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to configure non-podman bridge cni configs in %q: %v\", DefaultConfDir, err)\n\t}\n\tconfigs := out.Stdout.String()\n\n\t// podman bridge config(s):\n\t// could be eg, 87-podman-bridge.conflist or 87-podman.conflist\n\t// ref: https://github.com/containers/podman/blob/main/cni/87-podman-bridge.conflist\n\tip, ipnet, err := net.ParseCIDR(cidr)\n\tif err != nil || ip.To4() == nil {\n\t\treturn fmt.Errorf(\"cidr %q is not valid ipv4 address: %v\", cidr, err)\n\t}\n\tgateway := ip.Mask(ipnet.Mask)\n\tgateway[3]++\n\tout, err = r.RunCmd(exec.Command(\n\t\t\"sudo\", \"find\", DefaultConfDir, \"-maxdepth\", \"1\", \"-type\", \"f\", \"-name\", \"*podman*\", \"-not\", \"-name\", \"*.mk_disabled\", \"-printf\", \"%p, \", \"-exec\", \"sh\", \"-c\",\n\t\tfmt.Sprintf(`sudo sed -i -r -e 's|^(.*)\"subnet\": \".*\"(.*)$|\\1\"subnet\": \"%s\"\\2|g' -e 's|^(.*)\"gateway\": \".*\"(.*)$|\\1\"gateway\": \"%s\"\\2|g' {}`, cidr, gateway), \";\"))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to configure podman bridge cni configs in %q: %v\", DefaultConfDir, err)\n\t}\n\tconfigs += out.Stdout.String()\n\n\tconfigs = strings.Trim(configs, \", \")\n\tif len(configs) == 0 {\n\t\tklog.Infof(\"no active bridge cni configs found in %q - nothing to configure\", DefaultConfDir)\n\t\treturn nil\n\t}\n\tklog.Infof(\"configured [%s] bridge cni config(s)\", configs)\n\treturn nil\n}", "title": "" }, { "docid": "63d5efbe7461e5c5a16722151df026de", "score": "0.61517185", "text": "func validateCNIConfig(config []byte) error {\n\tvar c map[string]interface{}\n\tif err := json.Unmarshal(config, &c); err != nil {\n\t\treturn err\n\t}\n\n\t// Identify target is single CNI config or plugins\n\tif p, ok := c[\"plugins\"]; ok {\n\t\t// CNI conflist\n\t\t// check 'type' field for each plugin in 'plugins'\n\t\tplugins := p.([]interface{})\n\t\tfor _, v := range plugins {\n\t\t\tplugin := v.(map[string]interface{})\n\t\t\tif _, ok := plugin[\"type\"]; !ok {\n\t\t\t\treturn fmt.Errorf(\"missing 'type' in plugins\")\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// single CNI config\n\t\tif _, ok := c[\"type\"]; !ok {\n\t\t\treturn fmt.Errorf(\"missing 'type' in cni config\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3a1ee82f0ea85e0bed0462b2cf16480d", "score": "0.6109368", "text": "func resultToBasicNetworkConfig(result *cnitypes.Result) (define.InspectBasicNetworkConfig, error) {\n\tconfig := define.InspectBasicNetworkConfig{}\n\n\tfor _, ctrIP := range result.IPs {\n\t\tsize, _ := ctrIP.Address.Mask.Size()\n\t\tswitch {\n\t\tcase ctrIP.Version == \"4\" && config.IPAddress == \"\":\n\t\t\tconfig.IPAddress = ctrIP.Address.IP.String()\n\t\t\tconfig.IPPrefixLen = size\n\t\t\tconfig.Gateway = ctrIP.Gateway.String()\n\t\t\tif ctrIP.Interface != nil && *ctrIP.Interface < len(result.Interfaces) && *ctrIP.Interface >= 0 {\n\t\t\t\tconfig.MacAddress = result.Interfaces[*ctrIP.Interface].Mac\n\t\t\t}\n\t\tcase ctrIP.Version == \"4\" && config.IPAddress != \"\":\n\t\t\tconfig.SecondaryIPAddresses = append(config.SecondaryIPAddresses, ctrIP.Address.String())\n\t\t\tif ctrIP.Interface != nil && *ctrIP.Interface < len(result.Interfaces) && *ctrIP.Interface >= 0 {\n\t\t\t\tconfig.AdditionalMacAddresses = append(config.AdditionalMacAddresses, result.Interfaces[*ctrIP.Interface].Mac)\n\t\t\t}\n\t\tcase ctrIP.Version == \"6\" && config.IPAddress == \"\":\n\t\t\tconfig.GlobalIPv6Address = ctrIP.Address.IP.String()\n\t\t\tconfig.GlobalIPv6PrefixLen = size\n\t\t\tconfig.IPv6Gateway = ctrIP.Gateway.String()\n\t\tcase ctrIP.Version == \"6\" && config.IPAddress != \"\":\n\t\t\tconfig.SecondaryIPv6Addresses = append(config.SecondaryIPv6Addresses, ctrIP.Address.String())\n\t\tdefault:\n\t\t\treturn config, errors.Wrapf(define.ErrInternal, \"unrecognized IP version %q\", ctrIP.Version)\n\t\t}\n\t}\n\n\treturn config, nil\n}", "title": "" }, { "docid": "e32707859c6a77435eec015246be6a8f", "score": "0.60929734", "text": "func TestValidateNetworkConfig(t *testing.T) {\n\tnetCtx, err := Init(context.Background())\n\tdefer CleanUp(netCtx)\n\tAssertEqual(t, err, nil, \"Failed to initialize NetDetectContext\")\n\n\tprovider := \"\" // an empty provider string is a search for 'all'\n\tresults, err := ScanFabric(netCtx, provider)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(results) == 0 {\n\t\tt.Fatal(err)\n\t}\n\n\tfor _, sf := range results {\n\t\terr := ValidateProviderConfig(netCtx, sf.DeviceName, sf.Provider)\n\t\tAssertEqual(t, err, nil, \"Network device configuration is invalid - provider not supported\")\n\n\t\t_, err = GetIfaceNumaNode(netCtx, sf.DeviceName)\n\t\tAssertEqual(t, err, nil, \"Network device configuration is invalid - NUMA node does not match\")\n\t}\n}", "title": "" }, { "docid": "794eec434a968ea189f79de677163283", "score": "0.60705185", "text": "func (n *cniNetwork) Setup(namespacePath string, options types.SetupOptions) (map[string]types.StatusBlock, error) {\n\tn.lock.Lock()\n\tdefer n.lock.Unlock()\n\terr := n.loadNetworks()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = util.ValidateSetupOptions(n, namespacePath, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = setupLoopback(namespacePath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to set the loopback adapter up: %w\", err)\n\t}\n\n\tvar retErr error\n\tteardownOpts := options\n\tteardownOpts.Networks = map[string]types.PerNetworkOptions{}\n\t// make sure to teardown the already connected networks on error\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tif len(teardownOpts.Networks) > 0 {\n\t\t\t\terr := n.teardown(namespacePath, types.TeardownOptions(teardownOpts))\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Warn(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tports, err := convertSpecgenPortsToCNIPorts(options.PortMappings)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresults := make(map[string]types.StatusBlock, len(options.Networks))\n\tfor name, netOpts := range options.Networks {\n\t\tnetOpts := netOpts\n\t\tnetwork := n.networks[name]\n\t\trt := getRuntimeConfig(namespacePath, options.ContainerName, options.ContainerID, name, ports, &netOpts)\n\n\t\t// If we have more than one static ip we need parse the ips via runtime config,\n\t\t// make sure to add the ips capability to the first plugin otherwise it doesn't get the ips\n\t\tif len(netOpts.StaticIPs) > 0 && !network.cniNet.Plugins[0].Network.Capabilities[\"ips\"] {\n\t\t\tcaps := make(map[string]interface{})\n\t\t\tcaps[\"capabilities\"] = map[string]bool{\"ips\": true}\n\t\t\tnetwork.cniNet.Plugins[0], retErr = libcni.InjectConf(network.cniNet.Plugins[0], caps)\n\t\t\tif retErr != nil {\n\t\t\t\treturn nil, retErr\n\t\t\t}\n\t\t}\n\n\t\tvar res cnitypes.Result\n\t\tres, retErr = n.cniConf.AddNetworkList(context.Background(), network.cniNet, rt)\n\t\t// Add this network to teardown opts since it is now connected.\n\t\t// Also add this if an errors was returned since we want to call teardown on this regardless.\n\t\tteardownOpts.Networks[name] = netOpts\n\t\tif retErr != nil {\n\t\t\treturn nil, retErr\n\t\t}\n\n\t\tlogrus.Debugf(\"cni result for container %s network %s: %v\", options.ContainerID, name, res)\n\t\tvar status types.StatusBlock\n\t\tstatus, retErr = CNIResultToStatus(res)\n\t\tif retErr != nil {\n\t\t\treturn nil, retErr\n\t\t}\n\t\tresults[name] = status\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "d51cab46217b24784d87413de2be86c5", "score": "0.60037506", "text": "func CNIResultToStatus(res cnitypes.Result) (types.StatusBlock, error) {\n\tresult := types.StatusBlock{}\n\tcniResult, err := types040.GetResult(res)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tnameservers := make([]net.IP, 0, len(cniResult.DNS.Nameservers))\n\tfor _, nameserver := range cniResult.DNS.Nameservers {\n\t\tip := net.ParseIP(nameserver)\n\t\tif ip == nil {\n\t\t\treturn result, fmt.Errorf(\"failed to parse cni nameserver ip %s\", nameserver)\n\t\t}\n\t\tnameservers = append(nameservers, ip)\n\t}\n\tresult.DNSServerIPs = nameservers\n\tresult.DNSSearchDomains = cniResult.DNS.Search\n\n\tinterfaces := make(map[string]types.NetInterface)\n\tfor intIndex, netInterface := range cniResult.Interfaces {\n\t\t// we are only interested about interfaces in the container namespace\n\t\tif netInterface.Sandbox == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tmac, err := net.ParseMAC(netInterface.Mac)\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\t\tsubnets := make([]types.NetAddress, 0, len(cniResult.IPs))\n\t\tfor _, ip := range cniResult.IPs {\n\t\t\tif ip.Interface == nil {\n\t\t\t\t// we do no expect ips without an interface\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif len(cniResult.Interfaces) <= *ip.Interface {\n\t\t\t\treturn result, fmt.Errorf(\"invalid cni result, interface index %d out of range\", *ip.Interface)\n\t\t\t}\n\n\t\t\t// when we have a ip for this interface add it to the subnets\n\t\t\tif *ip.Interface == intIndex {\n\t\t\t\tsubnets = append(subnets, types.NetAddress{\n\t\t\t\t\tIPNet: types.IPNet{IPNet: ip.Address},\n\t\t\t\t\tGateway: ip.Gateway,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tinterfaces[netInterface.Name] = types.NetInterface{\n\t\t\tMacAddress: types.HardwareAddr(mac),\n\t\t\tSubnets: subnets,\n\t\t}\n\t}\n\tresult.Interfaces = interfaces\n\treturn result, nil\n}", "title": "" }, { "docid": "c56e90c041c0f2b71ff5bc31f371c80d", "score": "0.5996283", "text": "func (c *NetworkConfig) Validate(onExecution bool) error {\n\tif onExecution {\n\t\terr := utils.IsDirectory(c.NetworkDir)\n\t\tif err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\tif err = os.MkdirAll(c.NetworkDir, 0o755); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"cannot create network_dir: %s: %w\", c.NetworkDir, err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"invalid network_dir: %s: %w\", c.NetworkDir, err)\n\t\t\t}\n\t\t}\n\n\t\tfor _, pluginDir := range c.PluginDirs {\n\t\t\tif err := os.MkdirAll(pluginDir, 0o755); err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid plugin_dirs entry: %w\", err)\n\t\t\t}\n\t\t}\n\t\t// While the plugin_dir option is being deprecated, we need this check\n\t\tif c.PluginDir != \"\" {\n\t\t\tlogrus.Warnf(\"The config field plugin_dir is being deprecated. Please use plugin_dirs instead\")\n\t\t\tif err := os.MkdirAll(c.PluginDir, 0o755); err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid plugin_dir entry: %w\", err)\n\t\t\t}\n\t\t\t// Append PluginDir to PluginDirs, so from now on we can operate in terms of PluginDirs and not worry\n\t\t\t// about missing cases.\n\t\t\tc.PluginDirs = append(c.PluginDirs, c.PluginDir)\n\n\t\t\t// Empty the pluginDir so on future config calls we don't print it out\n\t\t\t// thus seamlessly transitioning and depreciating the option\n\t\t\tc.PluginDir = \"\"\n\t\t}\n\n\t\t// Init CNI plugin\n\t\tcniManager, err := cnimgr.New(\n\t\t\tc.CNIDefaultNetwork, c.NetworkDir, c.PluginDirs...,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"initialize CNI plugin: %w\", err)\n\t\t}\n\t\tc.cniManager = cniManager\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ef2f02ae3eb350e9fc2d7cb033125fe1", "score": "0.598767", "text": "func (d *nicIPVLAN) validateConfig(instConf instance.ConfigReader) error {\n\tif !instanceSupported(instConf.Type(), instancetype.Container) {\n\t\treturn ErrUnsupportedDevType\n\t}\n\n\trequiredFields := []string{\"parent\"}\n\toptionalFields := []string{\n\t\t\"name\",\n\t\t\"mtu\",\n\t\t\"hwaddr\",\n\t\t\"vlan\",\n\t\t\"ipv4.gateway\",\n\t\t\"ipv6.gateway\",\n\t\t\"ipv4.host_table\",\n\t\t\"ipv6.host_table\",\n\t\t\"gvrp\",\n\t}\n\n\trules := nicValidationRules(requiredFields, optionalFields, instConf)\n\trules[\"gvrp\"] = validate.Optional(validate.IsBool)\n\trules[\"ipv4.address\"] = func(value string) error {\n\t\tif value == \"\" {\n\t\t\treturn nil\n\t\t}\n\n\t\tif d.config[\"mode\"] == ipvlanModeL2 {\n\t\t\tfor _, v := range strings.Split(value, \",\") {\n\t\t\t\tv = strings.TrimSpace(v)\n\n\t\t\t\t// If valid non-CIDR address specified, append a /24 subnet.\n\t\t\t\tif validate.IsNetworkAddressV4(v) == nil {\n\t\t\t\t\tv = fmt.Sprintf(\"%s/24\", v)\n\t\t\t\t}\n\n\t\t\t\tip, _, err := net.ParseCIDR(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tif ip.To4() == nil {\n\t\t\t\t\treturn fmt.Errorf(\"Not an IPv4 CIDR address: %s\", v)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}\n\n\t\treturn validate.IsListOf(validate.IsNetworkAddressV4)(value)\n\t}\n\n\trules[\"ipv6.address\"] = func(value string) error {\n\t\tif value == \"\" {\n\t\t\treturn nil\n\t\t}\n\n\t\tif d.config[\"mode\"] == ipvlanModeL2 {\n\t\t\tfor _, v := range strings.Split(value, \",\") {\n\t\t\t\tv = strings.TrimSpace(v)\n\n\t\t\t\t// If valid non-CIDR address specified, append a /64 subnet.\n\t\t\t\tif validate.IsNetworkAddressV6(v) == nil {\n\t\t\t\t\tv = fmt.Sprintf(\"%s/64\", v)\n\t\t\t\t}\n\n\t\t\t\tip, _, err := net.ParseCIDR(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tif ip == nil || ip.To4() != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Not an IPv6 CIDR address: %s\", v)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}\n\n\t\treturn validate.IsListOf(validate.IsNetworkAddressV6)(value)\n\t}\n\n\trules[\"mode\"] = func(value string) error {\n\t\tif value == \"\" {\n\t\t\treturn nil\n\t\t}\n\n\t\tvalidModes := []string{ipvlanModeL3S, ipvlanModeL2}\n\t\tif !shared.StringInSlice(value, validModes) {\n\t\t\treturn fmt.Errorf(\"Must be one of: %v\", strings.Join(validModes, \", \"))\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tif d.config[\"mode\"] == ipvlanModeL2 {\n\t\trules[\"ipv4.gateway\"] = validate.Optional(validate.IsNetworkAddressV4)\n\t\trules[\"ipv6.gateway\"] = validate.Optional(validate.IsNetworkAddressV6)\n\t}\n\n\terr := d.config.Validate(rules)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif d.config[\"mode\"] == ipvlanModeL2 && d.config[\"host_table\"] != \"\" {\n\t\treturn fmt.Errorf(\"host_table option cannot be used in l2 mode\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cdbd899003f0950dc2e13cf68c4927bf", "score": "0.59607196", "text": "func Parse(cniConfig string) (NetworkComponents, error) {\n\tc := NetworkComponents{}\n\n\tconflist, err := unmarshalCNIConfList(cniConfig)\n\tif err != nil {\n\t\treturn c, fmt.Errorf(\"failed to parse CNI config: %w\", err)\n\t}\n\n\tc.ConfigName = conflist.Name\n\n\t// convert to a map for simpler checks\n\tplugins := map[string]*libcni.NetworkConfig{}\n\tfor _, plugin := range conflist.Plugins {\n\t\tif plugin.Network.Type == \"calico\" {\n\t\t\tif err := json.Unmarshal(plugin.Bytes, &c.CalicoConfig); err != nil {\n\t\t\t\treturn c, fmt.Errorf(\"failed to parse calico cni config: %w\", err)\n\t\t\t}\n\t\t\tif plugin.Network.IPAM.Type == \"host-local\" {\n\t\t\t\t// First load the IPAM json section so we can Unmarshal it below.\n\t\t\t\t// We load the IPAM as raw json so we can isolate it from the rest of the\n\t\t\t\t// CNI config.\n\t\t\t\tvar raw struct {\n\t\t\t\t\tIPAM json.RawMessage `json:\"ipam\"`\n\t\t\t\t}\n\t\t\t\tif err := json.Unmarshal(plugin.Bytes, &raw); err != nil {\n\t\t\t\t\treturn c, fmt.Errorf(\"failed to parse cni config for raw IPAM: %w\", err)\n\t\t\t\t}\n\n\t\t\t\t// Use a Decoder so we can set DisallowUnknownFields so if there are\n\t\t\t\t// any unknown fields we will detect that.\n\t\t\t\tx := HostLocalIPAMConfig{}\n\t\t\t\tdec := json.NewDecoder(bytes.NewReader(raw.IPAM))\n\t\t\t\tdec.DisallowUnknownFields()\n\t\t\t\tif err := dec.Decode(&x); err != nil && err != io.EOF {\n\t\t\t\t\treturn c, fmt.Errorf(\"failed to parse HostLocal IPAM config: %w\", err)\n\t\t\t\t}\n\t\t\t\tc.HostLocalIPAMConfig = &x\n\t\t\t}\n\t\t} else {\n\t\t\tplugins[plugin.Network.Type] = plugin\n\t\t}\n\t}\n\tc.Plugins = plugins\n\n\treturn c, nil\n}", "title": "" }, { "docid": "debcf53305f61ba2f58371115f253047", "score": "0.5956792", "text": "func (invoker *CNSIPAMInvoker) Add(nwCfg *cni.NetworkConfig, hostSubnetPrefix *net.IPNet, options map[string]interface{}) (*cniTypesCurr.Result, *cniTypesCurr.Result, error) {\r\n\r\n\t// Parse Pod arguments.\r\n\tpodInfo := cns.KubernetesPodInfo{PodName: invoker.podName, PodNamespace: invoker.podNamespace}\r\n\torchestratorContext, err := json.Marshal(podInfo)\r\n\r\n\tlog.Printf(\"Requesting IP for pod %v\", podInfo)\r\n\tresponse, err := invoker.cnsClient.RequestIPAddress(orchestratorContext)\r\n\tif err != nil {\r\n\t\tlog.Printf(\"Failed to get IP address from CNS with error %v, response: %v\", err, response)\r\n\t\treturn nil, nil, err\r\n\t}\r\n\r\n\tinfo := IPv4ResultInfo{\r\n\t\tpodIPAddress: response.PodIpInfo.PodIPConfig.IPAddress,\r\n\t\tncSubnetPrefix: response.PodIpInfo.NetworkContainerPrimaryIPConfig.IPSubnet.PrefixLength,\r\n\t\tncPrimaryIP: response.PodIpInfo.NetworkContainerPrimaryIPConfig.IPSubnet.IPAddress,\r\n\t\tncGatewayIPAddress: response.PodIpInfo.NetworkContainerPrimaryIPConfig.GatewayIPAddress,\r\n\t\thostSubnet: response.PodIpInfo.HostPrimaryIPInfo.Subnet,\r\n\t\thostPrimaryIP: response.PodIpInfo.HostPrimaryIPInfo.PrimaryIP,\r\n\t\thostGateway: response.PodIpInfo.HostPrimaryIPInfo.Gateway,\r\n\t}\r\n\r\n\t// set the NC Primary IP in options\r\n\toptions[network.SNATIPKey] = info.ncPrimaryIP\r\n\r\n\tlog.Printf(\"[cni-invoker-cns] Received info %v for pod %v\", info, podInfo)\r\n\r\n\tncgw := net.ParseIP(info.ncGatewayIPAddress)\r\n\tif ncgw == nil {\r\n\t\treturn nil, nil, fmt.Errorf(\"Gateway address %v from response is invalid\", info.ncGatewayIPAddress)\r\n\t}\r\n\r\n\t// set result ipconfig from CNS Response Body\r\n\tip, ncipnet, err := net.ParseCIDR(info.podIPAddress + \"/\" + fmt.Sprint(info.ncSubnetPrefix))\r\n\tif ip == nil {\r\n\t\treturn nil, nil, fmt.Errorf(\"Unable to parse IP from response: %v with err %v\", info.podIPAddress, err)\r\n\t}\r\n\r\n\t// construct ipnet for result\r\n\tresultIPnet := net.IPNet{\r\n\t\tIP: ip,\r\n\t\tMask: ncipnet.Mask,\r\n\t}\r\n\r\n\tresult := &cniTypesCurr.Result{\r\n\t\tIPs: []*cniTypesCurr.IPConfig{\r\n\t\t\t{\r\n\t\t\t\tVersion: \"4\",\r\n\t\t\t\tAddress: resultIPnet,\r\n\t\t\t\tGateway: ncgw,\r\n\t\t\t},\r\n\t\t},\r\n\t\tRoutes: []*cniTypes.Route{\r\n\t\t\t{\r\n\t\t\t\tDst: network.Ipv4DefaultRouteDstPrefix,\r\n\t\t\t\tGW: ncgw,\r\n\t\t\t},\r\n\t\t},\r\n\t}\r\n\r\n\t// set subnet prefix for host vm\r\n\terr = setHostOptions(nwCfg, hostSubnetPrefix, ncipnet, options, info)\r\n\tif err != nil {\r\n\t\treturn nil, nil, err\r\n\t}\r\n\r\n\t// first result is ipv4, second is ipv6, SWIFT doesn't currently support IPv6\r\n\treturn result, nil, nil\r\n}", "title": "" }, { "docid": "8c85ecce4da01f6c97a04fdbc79f0f44", "score": "0.5905309", "text": "func TestNetworkConfigurationValidate(t *testing.T) {\n\tvar tests = []struct {\n\t\tname string\n\t\tnetworkType string\n\t\tnetworkPatch []byte\n\t\terrorMessage string\n\t}{\n\t\t{\"ovnKubernetesConfig not defined\", \"OVNKubernetes\", nil, \"cluster is not configured for OVN hybrid networking\"},\n\t\t{\"hybridOverlayConfig not defined\", \"OVNKubernetes\", []byte(`{\"spec\":{\"defaultNetwork\":{\"ovnKubernetesConfig\":{} }}}`), \"cluster is not configured for OVN hybrid networking\"},\n\t\t{\"invalid OVN hybrid networking configuration\", \"OVNKubernetes\", []byte(`{\"spec\":{\"defaultNetwork\":{\"ovnKubernetesConfig\":{\"hybridOverlayConfig\":` +\n\t\t\t`{\"hybridClusterNetwork\":[]}}}}}`), \"invalid OVN hybrid networking configuration\"},\n\t\t{\"valid OVN hybrid networking configuration\", \"OVNKubernetes\", []byte(`{\"spec\":{\"defaultNetwork\":{\"ovnKubernetesConfig\":{\"hybridOverlayConfig\":` +\n\t\t\t`{\"hybridClusterNetwork\":[{\"cidr\":\"10.132.0.0/14\",\"hostPrefix\":23}]}}}}}`), \"\"},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tfakeConfigClient, fakeOperatorClient := createFakeClients(tt.networkType)\n\t\t\tif tt.networkPatch != nil {\n\t\t\t\t_, err := fakeOperatorClient.Networks().Patch(context.TODO(), \"cluster\", k8stypes.MergePatchType, tt.networkPatch, meta.PatchOptions{})\n\t\t\t\trequire.Nil(t, err, \"network patch should not throw error\")\n\t\t\t}\n\n\t\t\tnetwork, err := networkConfigurationFactory(fakeConfigClient, fakeOperatorClient)\n\t\t\trequire.Nil(t, err, \"networkConfigurationFactory should not throw error\")\n\t\t\terr = network.Validate()\n\n\t\t\tif tt.errorMessage == \"\" {\n\t\t\t\trequire.Nil(t, err, \"Successful check for valid network type\")\n\t\t\t} else {\n\t\t\t\trequire.Error(t, err, \"Function networkConfigurationFactory did not throw an error \"+\n\t\t\t\t\t\"when it was expected to\")\n\t\t\t\tassert.Equal(t, err.Error(), tt.errorMessage)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "2bda78a5965ea6b5099c38a43db228ae", "score": "0.58635026", "text": "func (e *ENI) CNIAdd(args *skel.CmdArgs) error {\n\tnetConf, cniVersion, err := loadConf(args.StdinData, args.Args)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"load config stdindata %s, args %s failed, err %s\",\n\t\t\tstring(args.StdinData), args.Args, err.Error())\n\t}\n\t// init inner log tool\n\t// ! pay more attention, CNI command line can not output log\n\t// ! to stderr or stdout according to cni specification\n\tblog.InitLogs(conf.LogConfig{\n\t\tLogDir: netConf.LogDir,\n\t\t// never log to stderr\n\t\tStdErrThreshold: \"6\",\n\t\tLogMaxSize: 20,\n\t\tLogMaxNum: 100,\n\t})\n\tdefer blog.CloseLogs()\n\n\t// get ip address from ipam plugin\n\tresultFromIPAM, err := ipam.ExecAdd(netConf.IPAM.Type, args.StdinData)\n\tif err != nil {\n\t\treturn err\n\t}\n\tblog.Infof(\"get result from ipam %s\", resultFromIPAM.String())\n\n\tresult, err := current.NewResultFromResult(resultFromIPAM)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(result.IPs) == 0 {\n\t\tblog.Errorf(\"IPAM plugin %s returned missing IP config\", result.String())\n\t\treturn fmt.Errorf(\"IPAM plugin %s returned missing IP config\", result.String())\n\t}\n\tif len(result.Interfaces) == 0 {\n\t\tblog.Errorf(\"IPAM plugin %s returned missing mac addr info\", result.String())\n\t\treturn fmt.Errorf(\"IPAM plugin %s returned missing mac addr info\", result.String())\n\t}\n\n\tipNet := &net.IPNet{\n\t\tIP: result.IPs[0].Address.IP,\n\t\tMask: net.IPv4Mask(255, 255, 255, 255),\n\t}\n\teniMac := result.Interfaces[0].Mac\n\n\t// find eni id according to eniMac\n\trouteTableID, err := getRouteTableIDByMac(eniMac, e.eniPrefix)\n\tif err != nil {\n\t\tblog.Errorf(\"get route table id by mac %s with eni prefix %s failed, err %s\",\n\t\t\teniMac, e.eniPrefix, err.Error())\n\t\treturn fmt.Errorf(\"get route table id by mac %s with eni prefix %s failed, err %s\",\n\t\t\teniMac, e.eniPrefix, err.Error())\n\t}\n\n\t// get container namespace\n\tnetns, err := ns.GetNS(args.Netns)\n\tif err != nil {\n\t\tblog.Errorf(\"failed to get netns %q, err %s\", netns, err.Error())\n\t\treturn fmt.Errorf(\"failed to get netns %q, err %s\", netns, err.Error())\n\t}\n\t// create veth pair,\n\thostVethInfo, containerVethInfo, err := createVethPair(netns.Path(), args.IfName, netConf.MTU)\n\tif err != nil {\n\t\tblog.Errorf(\"create veth pair failed, err %s\", err.Error())\n\t\treturn fmt.Errorf(\"create veth pair failed, err %s\", err.Error())\n\t}\n\tblog.Infof(\"get hostVeth %v, containerVeth %v\", hostVethInfo, containerVethInfo)\n\n\terr = configureContainerNS(hostVethInfo.Mac, netns.Path(), args.IfName, ipNet, result.IPs[0].Gateway)\n\tif err != nil {\n\t\tblog.Errorf(\"configure container ns network failed, err %s\", err.Error())\n\t\treturn fmt.Errorf(\"configure container ns network failed, err %s\", err.Error())\n\t}\n\n\terr = configureHostNS(hostVethInfo.Name, ipNet, routeTableID, netConf.RouteRulePriority)\n\tif err != nil {\n\t\tblog.Errorf(\"configure host ns network failed, err %s\", err.Error())\n\t\treturn fmt.Errorf(\"configure host ns network failed, err %s\", err.Error())\n\t}\n\n\tcontIndex := 1\n\tips := []*current.IPConfig{\n\t\t{\n\t\t\tVersion: \"4\",\n\t\t\tAddress: *ipNet,\n\t\t\tInterface: &contIndex,\n\t\t},\n\t}\n\n\tresult = &current.Result{\n\t\tIPs: ips,\n\t\tInterfaces: []*current.Interface{hostVethInfo, containerVethInfo},\n\t}\n\n\treturn types.PrintResult(result, cniVersion)\n}", "title": "" }, { "docid": "40941dc36b3b1ad7400fbfbe866cf0b0", "score": "0.5841966", "text": "func ValidateNetworks(nwConfig *types.NetworkingConfig) error {\n\tif nwConfig == nil || len(nwConfig.EndpointsConfig) == 0 {\n\t\treturn nil\n\t}\n\n\t// FIXME(ziren): this limitation may be removed in future\n\t// Now not create more then one interface for container is not allowed\n\tif len(nwConfig.EndpointsConfig) > 1 {\n\t\tl := make([]string, 0, len(nwConfig.EndpointsConfig))\n\t\tfor k := range nwConfig.EndpointsConfig {\n\t\t\tl = append(l, k)\n\t\t}\n\n\t\treturn fmt.Errorf(\"Container cannot be connected to network endpoints: %s\", strings.Join(l, \", \"))\n\t}\n\n\t// len(nwConfig.EndpointsConfig) == 1\n\tfor k, v := range nwConfig.EndpointsConfig {\n\t\tif v == nil {\n\t\t\treturn fmt.Errorf(\"no EndpointSettings for %s\", k)\n\t\t}\n\t\tif v.IPAMConfig != nil {\n\t\t\tif v.IPAMConfig.IPV4Address != \"\" && net.ParseIP(v.IPAMConfig.IPV4Address).To4() == nil {\n\t\t\t\treturn fmt.Errorf(\"invalid IPv4 address: %s\", v.IPAMConfig.IPV4Address)\n\t\t\t}\n\t\t\t// TODO: check IPv6Address\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "420bfd0313015fc14921de747290121f", "score": "0.58339566", "text": "func ConfigureLoopbackCNI(r Runner, disable bool) error {\n\tloopback := \"/etc/cni/net.d/*loopback.conf*\" // usually: 200-loopback.conf\n\t// turn { \"cniVersion\": \"0.3.1\", \"type\": \"loopback\" }\n\t// into { \"cniVersion\": \"0.3.1\", \"name\": \"loopback\", \"type\": \"loopback\" }\n\tif _, err := r.RunCmd(exec.Command(\"sh\", \"-c\", fmt.Sprintf(\"stat %s\", loopback))); err != nil {\n\t\tklog.Warningf(\"loopback cni configuration skipped: %q not found\", loopback)\n\t\treturn nil\n\t}\n\n\tfindExec := []string{\"find\", filepath.Dir(loopback), \"-maxdepth\", \"1\", \"-type\", \"f\", \"-name\", filepath.Base(loopback), \"-not\", \"-name\", \"*.mk_disabled\", \"-exec\", \"sh\", \"-c\"}\n\n\tif disable {\n\t\tif _, err := r.RunCmd(exec.Command(\n\t\t\t\"sudo\", append(findExec,\n\t\t\t\t`sudo mv {} {}.mk_disabled`, \";\")...)); err != nil {\n\t\t\treturn fmt.Errorf(\"unable to disable loopback cni %q: %v\", loopback, err)\n\t\t}\n\t\tklog.Infof(\"loopback cni configuration disabled: %q found\", loopback)\n\t\treturn nil\n\t}\n\n\tif _, err := r.RunCmd(exec.Command(\n\t\t\"sudo\", append(findExec,\n\t\t\t`grep -q loopback {} && ( grep -q name {} || sudo sed -i '/\"type\": \"loopback\"/i \\ \\ \\ \\ \"name\": \"loopback\",' {} ) && sudo sed -i 's|\"cniVersion\": \".*\"|\"cniVersion\": \"1.0.0\"|g' {}`, \";\")...)); err != nil {\n\t\treturn fmt.Errorf(\"unable to patch loopback cni config %q: %v\", loopback, err)\n\t}\n\tklog.Infof(\"loopback cni configuration patched: %q found\", loopback)\n\treturn nil\n}", "title": "" }, { "docid": "2dbb2fae3577b656a0953950db2ff83c", "score": "0.5833811", "text": "func UpdateNetworkConfig(stage *yipSchema.Stage, networks map[string]Network, run bool) error {\n\tvar staticDNSServers []string\n\n\tmgmtNetwork, ok := networks[MgmtInterfaceName]\n\tif !ok {\n\t\treturn errors.New(\"no management network defined\")\n\t}\n\tif len(mgmtNetwork.Interfaces) == 0 {\n\t\treturn errors.New(\"no slave defined for management network bond\")\n\t}\n\n\t// Check if we have the only one default route.\n\t// If not, set mgmtNetwork as the default route.\n\tdefaultRoute := \"\"\n\tfor name, network := range networks {\n\t\tif network.DefaultRoute {\n\t\t\tif defaultRoute != \"\" {\n\t\t\t\treturn fmt.Errorf(\"multi default route found: %s and %s\", defaultRoute, name)\n\t\t\t}\n\t\t\tdefaultRoute = name\n\t\t}\n\t}\n\tif defaultRoute == \"\" {\n\t\tmgmtNetwork.DefaultRoute = true\n\t\tnetworks[MgmtInterfaceName] = mgmtNetwork\n\t}\n\n\tfor name, network := range networks {\n\t\tif network.Method != NetworkMethodDHCP && network.Method != NetworkMethodStatic {\n\t\t\treturn fmt.Errorf(\"unsupported network method %s\", network.Method)\n\t\t}\n\n\t\tvar err error\n\t\tif len(network.Interfaces) > 0 {\n\t\t\terr = updateBond(stage, name, &network)\n\t\t} else {\n\t\t\terr = updateNIC(stage, name, &network)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// default gateway for static mode\n\t\tif network.Method == NetworkMethodStatic {\n\t\t\tstage.Files = append(stage.Files, yipSchema.File{\n\t\t\t\tPath: fmt.Sprintf(\"/etc/sysconfig/network/ifroute-%s\", name),\n\t\t\t\tContent: fmt.Sprintf(\"default %s - %s\\n\", network.Gateway, name),\n\t\t\t\tPermissions: 0600,\n\t\t\t\tOwner: 0,\n\t\t\t\tGroup: 0,\n\t\t\t})\n\t\t}\n\n\t\tif network.Method == NetworkMethodDHCP {\n\t\t\tstage.Commands = append(stage.Commands, fmt.Sprintf(\"rm -f /etc/sysconfig/network/ifroute-%s\", name))\n\t\t}\n\n\t\tfor _, nameServer := range network.DNSNameservers {\n\t\t\tif util.StringSliceContains(staticDNSServers, nameServer) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tstaticDNSServers = append(staticDNSServers, nameServer)\n\t\t}\n\t}\n\n\t// Set static DNS servers before wicked reload\n\tif len(staticDNSServers) > 0 {\n\t\t// Not using stage.Environment because it's run after stage.Commands in Yip\n\t\tstage.Commands = append(stage.Commands, getAddStaticDNSServersCmd(staticDNSServers))\n\t}\n\n\tif run {\n\t\tstage.Commands = append(stage.Commands, fmt.Sprintf(\"wicked ifreload all\"))\n\n\t\t// in case wicked config is not changed and netconfig is not called\n\t\tstage.Commands = append(stage.Commands, \"netconfig update\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "10eb01d6ea9d75de41c40ef74001e010", "score": "0.5764644", "text": "func cfgNet(cfg *ini.IniCfg, changeCount int) {\n\tnetCfgLock.Lock()\n\tdefer netCfgLock.Unlock()\n\n\tif !runCfg.InitSrvCmd && runMode != RUN_SVC {\n\t\treturn\n\t}\n\n\tif !runCfg.InitSrvSvc && runMode == RUN_SVC {\n\t\treturn\n\t}\n\n\tsec := cfg.GetSection(\"net\")\n\n\tval := sec.GetFirstVal(\"PrivateHttpPort\")\n\tprivatePort := val.GetValInt(0, DefaultPrivateHttpPort)\n\tsrvLog.Info(\"PrivateHttpPort: %d\", privatePort)\n\n\tval = sec.GetFirstVal(\"PrivateStaticDir\")\n\tprivateStaticDir := val.GetValStr(0, DefaultPrivateStaticDir)\n\tprivateStaticAccessLevel := parseAccessLevel(val.GetValStr(1, DefaultPrivateStaticAccessLevel))\n\tsrvLog.Info(\"PrivateStaticDir: %s\", privateStaticDir)\n\n\tval = sec.GetFirstVal(\"PublicHttpPort\")\n\tpublicPort := val.GetValInt(0, DefaultPublicHttpPort)\n\tsrvLog.Info(\"PublicHttpPort: %d\", publicPort)\n\n\tval = sec.GetFirstVal(\"PublicStaticDir\")\n\tpublicStaticDir := val.GetValStr(0, DefaultPublicStaticDir)\n\tpublicStaticAccessLevel := parseAccessLevel(val.GetValStr(1, DefaultPublicStaticAccessLevel))\n\tsrvLog.Info(\"PUblicStaticDir: %s\", publicStaticDir)\n\n\t// TLS\n\tval = sec.GetFirstVal(\"TLSRedirect\")\n\ttlsRedirect := val.GetValBool(0, DefaultTLSRedirect)\n\tsrvLog.Info(\"TLSRedirect: %t\", tlsRedirect)\n\n\t// XForwardedFor\n\tval = sec.GetFirstVal(\"HonorXForwardedFor\")\n\thonorXForwardedFor := val.GetValBool(0, DefaultHonorXForwardedFor)\n\tsrvLog.Info(\"HonorXForwardedFor: %t\", honorXForwardedFor)\n\n\tval = sec.GetFirstVal(\"PrivateTLSPort\")\n\tprivateTLSPort := val.GetValInt(0, DefaultPrivateTLSPort)\n\tsrvLog.Info(\"PrivateTLSPort: %d\", privateTLSPort)\n\n\tval = sec.GetFirstVal(\"PublicTLSPort\")\n\tpublicTLSPort := val.GetValInt(0, DefaultPublicTLSPort)\n\tsrvLog.Info(\"PrivateTLSPort: %d\", publicTLSPort)\n\n\tcertMap := make(map[string]*tls.Certificate)\n\tvals := sec.GetVals(\"CertMap\")\n\tfor i := range vals {\n\t\tdomain := vals[i].GetValStr(0, \"\")\n\t\tcert := vals[i].GetValStr(1, \"\")\n\t\tkey := vals[i].GetValStr(2, \"\")\n\n\t\tif len(domain) < 1 || len(cert) < 1 || len(key) < 1 {\n\t\t\tcontinue\n\t\t}\n\n\t\tcertPath := filepath.Join(configDir, cert)\n\t\tkeyPath := filepath.Join(configDir, key)\n\n\t\tkp, err := tls.LoadX509KeyPair(certPath, keyPath)\n\t\tif err != nil {\n\t\t\tsrvLog.Error(\"%s\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tcertMap[domain] = &kp\n\n\t\tsrvLog.Info(\"CertMap defined: %s -> Cert: %s, Key: %s\", domain, cert, key)\n\t}\n\n\t// Access control\n\tnetAccessList = make([]*AccessNet, 0)\n\tvals = sec.GetVals(\"AccessRights\")\n\tfor i := range vals {\n\t\tip, ipNet, err := net.ParseCIDR(vals[i].GetValStr(0, \"\"))\n\t\tif err != nil {\n\t\t\tsrvLog.Info(\"%v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tlevel := parseAccessLevel(vals[i].GetValStr(1, \"none\"))\n\t\tnewNet := true\n\t\tfor i := range netAccessList {\n\t\t\tif netAccessList[i].Subnet.Contains(ip) {\n\t\t\t\tnewNet = false\n\t\t\t\tif level < netAccessList[i].Level {\n\t\t\t\t\tnetAccessList[i].Level = level\n\t\t\t\t\tsrvLog.Info(\n\t\t\t\t\t\t\"Updating net %s access level: %d\",\n\t\t\t\t\t\tip.String(),\n\t\t\t\t\t\tlevel,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif newNet {\n\t\t\tnetAccessList = append(netAccessList, &AccessNet{\n\t\t\t\tLevel: level,\n\t\t\t\tSubnet: ipNet,\n\t\t\t})\n\t\t\tsrvLog.Info(\n\t\t\t\t\"Registered network %s with access level %d\",\n\t\t\t\tip.String(),\n\t\t\t\tlevel,\n\t\t\t)\n\t\t}\n\t}\n\n\t// ignore addresses for listen binding\n\tignoreAddrs := make([]string, 0)\n\tvals = sec.GetVals(\"BindIgnore\")\n\tfor i := range vals {\n\t\taddr := vals[i].GetValStr(0, \"\")\n\t\tif len(addr) > 0 {\n\t\t\tignoreAddrs = append(ignoreAddrs, addr)\n\t\t}\n\t}\n\n\t// force \"restart\" on first config parse. This ensures that\n\t// that the http listeners are intialized if a user starts the\n\t// server with all default vaules.\n\tforceRestart := (changeCount == 0)\n\n\thttpSrv.Configure(\n\t\tprivatePort,\n\t\tprivateTLSPort,\n\t\tprivateStaticDir,\n\t\tprivateStaticAccessLevel,\n\t\tpublicPort,\n\t\tpublicTLSPort,\n\t\tpublicStaticDir,\n\t\tpublicStaticAccessLevel,\n\t\tignoreAddrs,\n\t\ttlsRedirect,\n\t\thonorXForwardedFor,\n\t\tcertMap,\n\t\tforceRestart,\n\t)\n\n\tnetId = cfg.ConfigVer\n\tsrvLog.Info(\"NetId: %s\", netId)\n}", "title": "" }, { "docid": "d82ec1da2fccaf836530509ec959aca3", "score": "0.5736074", "text": "func GenerateConfigList(e *CNIEnv, id int, name, cidr string) (*NetworkConfigList, error) {\n\tif e == nil || id < 0 || name == \"\" || cidr == \"\" {\n\t\treturn nil, errdefs.ErrInvalidArgument\n\t}\n\tfor _, f := range basicPlugins {\n\t\tp := filepath.Join(e.Path, f)\n\t\tif _, err := exec.LookPath(p); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"needs CNI plugin %q to be installed in CNI_PATH (%q), see https://github.com/containernetworking/plugins/releases\",\n\t\t\t\tf, e.Path)\n\t\t}\n\t}\n\tvar extraPlugins string\n\tif _, err := exec.LookPath(filepath.Join(e.Path, \"isolation\")); err == nil {\n\t\tlogrus.Debug(\"found CNI isolation plugin\")\n\t\textraPlugins = \",\\n {\\n \\\"type\\\":\\\"isolation\\\"\\n }\"\n\t} else if name != DefaultNetworkName {\n\t\t// the warning is suppressed for DefaultNetworkName\n\t\tlogrus.Warnf(\"To isolate bridge networks, CNI plugin \\\"isolation\\\" needs to be installed in CNI_PATH (%q), see https://github.com/AkihiroSuda/cni-isolation\",\n\t\t\te.Path)\n\t}\n\n\tsubnetIP, subnet, err := net.ParseCIDR(cidr)\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"failed to parse CIDR %q\", cidr)\n\t}\n\tif !subnet.IP.Equal(subnetIP) {\n\t\treturn nil, errors.Errorf(\"unexpected CIDR %q, maybe you meant %q?\", cidr, subnet.String())\n\t}\n\tgateway := make(net.IP, len(subnet.IP))\n\tcopy(gateway, subnet.IP)\n\tgateway[3] += 1\n\topts := &ConfigListTemplateOpts{\n\t\tID: id,\n\t\tName: name,\n\t\tSubnet: subnet.String(),\n\t\tGateway: gateway.String(),\n\t\tExtraPlugins: extraPlugins,\n\t}\n\ttmpl, err := template.New(\"\").Parse(ConfigListTemplate)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar buf bytes.Buffer\n\tif err := tmpl.Execute(&buf, opts); err != nil {\n\t\treturn nil, err\n\t}\n\n\tl, err := libcni.ConfListFromBytes(buf.Bytes())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &NetworkConfigList{\n\t\tNetworkConfigList: l,\n\t\tNerdctlID: &id,\n\t\tFile: \"\",\n\t}, nil\n}", "title": "" }, { "docid": "0e2eaf48d77049b3b14b8197c7f1d98e", "score": "0.56062937", "text": "func (invoker *CNSIPAMInvoker) Add(nwCfg *cni.NetworkConfig, subnetPrefix *net.IPNet, options map[string]interface{}) (*cniTypesCurr.Result, *cniTypesCurr.Result, error) {\r\n\r\n\t// Parse Pod arguments.\r\n\tpodInfo := cns.KubernetesPodInfo{PodName: invoker.podName, PodNamespace: invoker.podNamespace}\r\n\torchestratorContext, err := json.Marshal(podInfo)\r\n\r\n\tlog.Printf(\"Requesting IP for pod %v\", podInfo)\r\n\tresponse, err := invoker.cnsClient.RequestIPAddress(orchestratorContext)\r\n\tif err != nil {\r\n\t\tlog.Printf(\"Failed to get IP address from CNS with error %v, response: %v\", err, response)\r\n\t\treturn nil, nil, err\r\n\t}\r\n\r\n\tresultIPv4 := IPv4ResultInfo{\r\n\t\tpodIPAddress: response.PodIpInfo.PodIPConfig.IPAddress,\r\n\t\tncSubnetPrefix: response.PodIpInfo.NetworkContainerPrimaryIPConfig.IPSubnet.PrefixLength,\r\n\t\tncPrimaryIP: response.PodIpInfo.NetworkContainerPrimaryIPConfig.IPSubnet.IPAddress,\r\n\t\tgwIPAddress: response.PodIpInfo.NetworkContainerPrimaryIPConfig.GatewayIPAddress,\r\n\t\thostSubnet: response.PodIpInfo.HostPrimaryIPInfo.Subnet,\r\n\t\thostPrimaryIP: response.PodIpInfo.HostPrimaryIPInfo.PrimaryIP,\r\n\t}\r\n\r\n\t// set the NC Primary IP in options\r\n\toptions[network.SNATIPKey] = resultIPv4.ncPrimaryIP\r\n\r\n\tlog.Printf(\"Received IP %v for pod %v\", resultIPv4.podIPAddress, podInfo)\r\n\r\n\tresult, err := getCNIIPv4Result(resultIPv4, subnetPrefix)\r\n\tif err != nil {\r\n\t\treturn nil, nil, err\r\n\t}\r\n\r\n\t// first result is ipv4, second is ipv6, SWIFT doesn't currently support IPv6\r\n\treturn result, nil, nil\r\n}", "title": "" }, { "docid": "098d0cc80246d0589142fa88827bbc9c", "score": "0.5560262", "text": "func (d *common) validateConfig(info *api.NetworkACLPut) error {\n\tfor k := range info.Config {\n\t\tif !shared.IsUserConfig(k) {\n\t\t\treturn fmt.Errorf(\"Only user config keys supported\")\n\t\t}\n\t}\n\n\t// Normalise rules before validation for duplicate detection.\n\tfor i := range info.Ingress {\n\t\tinfo.Ingress[i].Normalise()\n\t}\n\n\tfor i := range info.Egress {\n\t\tinfo.Egress[i].Normalise()\n\t}\n\n\t// Validate each ingress rule.\n\tfor i, ingressRule := range info.Ingress {\n\t\terr := d.validateRule(ruleDirectionIngress, ingressRule)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"Invalid ingress rule %d\", i)\n\t\t}\n\n\t\t// Check for duplicates.\n\t\tfor ri, r := range info.Ingress {\n\t\t\tif ri == i {\n\t\t\t\tcontinue // Skip ourselves.\n\t\t\t}\n\n\t\t\tif r == ingressRule {\n\t\t\t\treturn fmt.Errorf(\"Duplicate of ingress rule %d\", i)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate each egress rule.\n\tfor i, egressRule := range info.Egress {\n\t\terr := d.validateRule(ruleDirectionEgress, egressRule)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"Invalid egress rule %d\", i)\n\t\t}\n\n\t\t// Check for duplicates.\n\t\tfor ri, r := range info.Egress {\n\t\t\tif ri == i {\n\t\t\t\tcontinue // Skip ourselves.\n\t\t\t}\n\n\t\t\tif r == egressRule {\n\t\t\t\treturn fmt.Errorf(\"Duplicate of egress rule %d\", i)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7ca0f750256446eea5777427d13731e3", "score": "0.5549487", "text": "func (nc *nodeConfig) configureCNI() error {\n\t// set the hostSubnet value in the network struct\n\tif err := nc.network.setHostSubnet(nc.node.Annotations[HybridOverlaySubnet]); err != nil {\n\t\treturn errors.Wrapf(err, \"error populating host subnet in node network\")\n\t}\n\t// populate the CNI config file with the host subnet and the service network CIDR\n\tconfigFile, err := nc.network.populateCniConfig(nc.clusterServiceCIDR, wkl.CNIConfigTemplatePath)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error populating CNI config file %s\", configFile)\n\t}\n\t// configure CNI in the Windows VM\n\tif err = nc.Windows.ConfigureCNI(configFile); err != nil {\n\t\treturn errors.Wrapf(err, \"error configuring CNI for %s\", nc.node.GetName())\n\t}\n\tif err = nc.network.cleanupTempConfig(configFile); err != nil {\n\t\tlog.Error(err, \" could not delete temp CNI config file\", \"configFile\",\n\t\t\tconfigFile)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6325e04cfb88b4f2441b4a9b1fdf8ff3", "score": "0.5508635", "text": "func TestValidateClusterNetwork(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tcn *networkapi.ClusterNetwork\n\t\texpectedErrors int\n\t}{\n\t\t{\n\t\t\tname: \"Good one\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 0,\n\t\t},\n\t\t{\n\t\t\tname: \"Good one old network and hostsubnetlength set\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tNetwork: \"10.20.0.0/16\",\n\t\t\t\tHostSubnetLength: 8,\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 0,\n\t\t},\n\t\t{\n\t\t\tname: \"old network set incorrectly\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tNetwork: \"10.30.0.0/16\",\n\t\t\t\tHostSubnetLength: 8,\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"old hostsubnetlength set incorrectly\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tNetwork: \"10.20.0.0/16\",\n\t\t\t\tHostSubnetLength: 9,\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"only old network set\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tNetwork: \"10.20.0.0/16\",\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"only old hostsubnetlength set\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tHostSubnetLength: 8,\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Good one multiple addresses\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0/16\", HostSubnetLength: 8}, {CIDR: \"10.128.0.0/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 0,\n\t\t},\n\t\t{\n\t\t\tname: \"Bad network\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0.0/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Bad network CIDR\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.1/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Empty network ClusterNetworks\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Subnet length too large for network\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.30.0/24\", HostSubnetLength: 16}},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Subnet length too small\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0/16\", HostSubnetLength: 1}},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Bad service network\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"1172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Bad service network CIDR\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"172.30.1.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Service network overlaps with cluster network\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"10.20.1.0/24\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Cluster network overlaps with service network\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"10.0.0.0/8\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Cluster networks overlap with each other\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.128.0.0/14\", HostSubnetLength: 8}, {CIDR: \"10.0.0.0/8\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"IPv6 ClusterNetwork\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"fe80:1234::/64\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"172.30.0.0/16\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"IPv6 ServiceNetwork\",\n\t\t\tcn: &networkapi.ClusterNetwork{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"any\"},\n\t\t\t\tClusterNetworks: []networkapi.ClusterNetworkEntry{{CIDR: \"10.20.0.0/16\", HostSubnetLength: 8}},\n\t\t\t\tServiceNetwork: \"fe80:1234::/64\",\n\t\t\t},\n\t\t\texpectedErrors: 1,\n\t\t},\n\t}\n\n\tfor _, tc := range tests {\n\t\terrs := ValidateClusterNetwork(tc.cn)\n\n\t\tif len(errs) != tc.expectedErrors {\n\t\t\tt.Errorf(\"Test case %s expected %d error(s), got %d. %v\", tc.name, tc.expectedErrors, len(errs), errs)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6f4b304c841e0708995a5da5745fc98c", "score": "0.55033225", "text": "func parseConfig(stdin []byte) (*PluginConf, error) {\n\tconf := PluginConf{}\n\n\tif err := json.Unmarshal(stdin, &conf); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse network configuration: %v\", err)\n\t}\n\n\t// Parse previous result. Remove this if your plugin is not chained.\n\tif conf.RawPrevResult != nil {\n\t\tresultBytes, err := json.Marshal(conf.RawPrevResult)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not serialize prevResult: %v\", err)\n\t\t}\n\t\tres, err := version.NewResult(conf.CNIVersion, resultBytes)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not parse prevResult: %v\", err)\n\t\t}\n\t\tconf.RawPrevResult = nil\n\t\tconf.PrevResult, err = current.NewResultFromResult(res)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not convert result to current version: %v\", err)\n\t\t}\n\t}\n\t// End previous result parsing\n\n\tif conf.Delegate == nil {\n\t\treturn nil, fmt.Errorf(`\"delegate\" is a required field in config, it should be the config of the main plugin to use`)\n\t}\n\t// Do any validation here\n\tif conf.ParentIF == \"\" {\n\t\treturn nil, fmt.Errorf(\"ParentIF must be specified\")\n\t}\n\tif len(conf.InterfaceNames) == 0 {\n\t\treturn nil, fmt.Errorf(\"interfaceNames must be specified\")\n\t}\n\tif conf.VtepIP == \"\" {\n\t\treturn nil, fmt.Errorf(\"VtepIP must be specified\")\n\t}\n\tif conf.ControllerURI == \"\" {\n\t\treturn nil, fmt.Errorf(\"ControllerURI must be specified\")\n\t}\n\t/*\n\tif conf.MgmtNetwork == nil {\n\t\treturn nil, fmt.Errorf(\"MgmtNetwork: Err in delegate conf\")\n\t}\n\t*/\n\t//XXX: Add more\n\n\treturn &conf, nil\n}", "title": "" }, { "docid": "d86b5b213031f8fe2eb7e38ed62a61d5", "score": "0.54706085", "text": "func inferIPVersionFromInstallConfig(n *types.Networking) (hasIPv4, hasIPv6 bool, presence ipAddressTypeByField, addresses ipNetByField) {\n\tif n == nil {\n\t\treturn\n\t}\n\taddresses = make(ipNetByField)\n\tfor _, network := range n.MachineNetwork {\n\t\taddresses[\"machineNetwork\"] = append(addresses[\"machineNetwork\"], network.CIDR)\n\t}\n\tfor _, network := range n.ServiceNetwork {\n\t\taddresses[\"serviceNetwork\"] = append(addresses[\"serviceNetwork\"], network)\n\t}\n\tfor _, network := range n.ClusterNetwork {\n\t\taddresses[\"clusterNetwork\"] = append(addresses[\"clusterNetwork\"], network.CIDR)\n\t}\n\tpresence = make(ipAddressTypeByField)\n\tfor k, ipnets := range addresses {\n\t\tfor i, ipnet := range ipnets {\n\t\t\thas := presence[k]\n\t\t\tif ipnet.IP.To4() != nil {\n\t\t\t\thas.IPv4 = true\n\t\t\t\tif i == 0 {\n\t\t\t\t\thas.Primary = corev1.IPv4Protocol\n\t\t\t\t}\n\t\t\t\tif k == \"serviceNetwork\" {\n\t\t\t\t\thasIPv4 = true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thas.IPv6 = true\n\t\t\t\tif i == 0 {\n\t\t\t\t\thas.Primary = corev1.IPv6Protocol\n\t\t\t\t}\n\t\t\t\tif k == \"serviceNetwork\" {\n\t\t\t\t\thasIPv6 = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tpresence[k] = has\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9f57bc3aea596e0c5266f59f0a3615cc", "score": "0.5459033", "text": "func convertConfigNotation(subnetCIDR string, networkPrefixLen uint8, hostID uint8) (subnetIPPrefix net.IPNet, networkIPPrefix net.IPNet, err error) {\n\t// convert subnetCIDR to net.IPNet\n\t_, pSubnet, err := net.ParseCIDR(subnetCIDR)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Can't parse SubnetCIDR \\\"%v\\\" : %v\", subnetCIDR, err)\n\t\treturn\n\t}\n\tsubnetIPPrefix = *pSubnet\n\n\t// checking correct prefix sizes\n\tsubnetPrefixLen, _ := subnetIPPrefix.Mask.Size()\n\tif networkPrefixLen <= uint8(subnetPrefixLen) {\n\t\terr = fmt.Errorf(\"Network prefix length (%v) must be higher than subnet prefix length (%v) \", networkPrefixLen, subnetPrefixLen)\n\t\treturn\n\t}\n\n\tnetworkIPPrefix, err = applyHostID(subnetIPPrefix, hostID, networkPrefixLen)\n\treturn\n}", "title": "" }, { "docid": "a9275cb9d1ea6b50f3568a4aee4ce61b", "score": "0.542756", "text": "func ValidateNetMode(c *Config, hc *HostConfig) error {\n\t// We may not be passed a host config, such as in the case of docker commit\n\tif hc == nil {\n\t\treturn nil\n\t}\n\tparts := strings.Split(string(hc.NetworkMode), \":\")\n\tif parts[0] == \"container\" {\n\t\tif len(parts) < 2 || parts[1] == \"\" {\n\t\t\treturn fmt.Errorf(\"--net: invalid net mode: invalid container format container:<name|id>\")\n\t\t}\n\t}\n\n\tif (hc.NetworkMode.IsHost() || hc.NetworkMode.IsContainer()) && c.Hostname != \"\" {\n\t\treturn ErrConflictNetworkHostname\n\t}\n\n\tif hc.NetworkMode.IsHost() && len(hc.Links) > 0 {\n\t\treturn ErrConflictHostNetworkAndLinks\n\t}\n\n\tif hc.NetworkMode.IsContainer() && len(hc.Links) > 0 {\n\t\treturn ErrConflictContainerNetworkAndLinks\n\t}\n\n\tif hc.NetworkMode.IsUserDefined() && len(hc.Links) > 0 {\n\t\treturn ErrConflictUserDefinedNetworkAndLinks\n\t}\n\n\tif (hc.NetworkMode.IsHost() || hc.NetworkMode.IsContainer()) && len(hc.DNS) > 0 {\n\t\treturn ErrConflictNetworkAndDNS\n\t}\n\n\tif (hc.NetworkMode.IsContainer() || hc.NetworkMode.IsHost()) && len(hc.ExtraHosts) > 0 {\n\t\treturn ErrConflictNetworkHosts\n\t}\n\n\tif (hc.NetworkMode.IsContainer() || hc.NetworkMode.IsHost()) && c.MacAddress != \"\" {\n\t\treturn ErrConflictContainerNetworkAndMac\n\t}\n\n\tif hc.NetworkMode.IsContainer() && (len(hc.PortBindings) > 0 || hc.PublishAllPorts == true) {\n\t\treturn ErrConflictNetworkPublishPorts\n\t}\n\n\tif hc.NetworkMode.IsContainer() && len(c.ExposedPorts) > 0 {\n\t\treturn ErrConflictNetworkExposePorts\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f8f2c771e6ba166080d976ef06dc6cf", "score": "0.5427143", "text": "func New(args *cniSkel.CmdArgs) (*NetConfig, error) {\n\t// Parse network configuration.\n\tvar config netConfigJSON\n\terr := json.Unmarshal(args.StdinData, &config)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse network config: %v\", err)\n\t}\n\n\t// Parse optional per-container arguments.\n\tif args.Args != \"\" {\n\t\tvar pca pcArgs\n\t\tpca.IgnoreUnknown = ignoreUnknown\n\n\t\tif err := cniTypes.LoadArgs(args.Args, &pca); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse per-container args: %v\", err)\n\t\t}\n\n\t\t// Per-container arguments override the ones from network configuration.\n\t\tif pca.BranchVlanID != \"\" {\n\t\t\tconfig.BranchVlanID = string(pca.BranchVlanID)\n\t\t}\n\t\tif pca.BranchMACAddress != \"\" {\n\t\t\tconfig.BranchMACAddress = string(pca.BranchMACAddress)\n\t\t}\n\t\tif pca.IPAddresses != \"\" {\n\t\t\tconfig.IPAddresses = strings.Split(string(pca.IPAddresses), \",\")\n\t\t}\n\t\tif pca.GatewayIPAddresses != \"\" {\n\t\t\tconfig.GatewayIPAddresses = strings.Split(string(pca.GatewayIPAddresses), \",\")\n\t\t}\n\t}\n\n\t// Set defaults.\n\tif config.InterfaceType == \"\" {\n\t\tconfig.InterfaceType = IfTypeTAP\n\t}\n\n\t// Validate if all the required fields are present.\n\tif config.TrunkName == \"\" && config.TrunkMACAddress == \"\" {\n\t\treturn nil, fmt.Errorf(\"missing required parameter trunkName or trunkMACAddress\")\n\t}\n\tif config.BranchVlanID == \"\" {\n\t\treturn nil, fmt.Errorf(\"missing required parameter branchVlanID\")\n\t}\n\tif config.BranchMACAddress == \"\" {\n\t\treturn nil, fmt.Errorf(\"missing required parameter branchMACAddress\")\n\t}\n\n\t// Under TAP mode, UID and GID are required to set TAP ownership.\n\tif config.InterfaceType == IfTypeTAP {\n\t\tif config.Uid == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"missing required parameter uid\")\n\t\t}\n\t\tif config.Gid == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"missing required parameter gid\")\n\t\t}\n\t}\n\n\t// Populate NetConfig.\n\tnetConfig := NetConfig{\n\t\tNetConf: config.NetConf,\n\t\tTrunkName: config.TrunkName,\n\t\tBlockIMDS: config.BlockIMDS,\n\t\tInterfaceType: config.InterfaceType,\n\t}\n\n\t// Parse the trunk MAC address.\n\tif config.TrunkMACAddress != \"\" {\n\t\tnetConfig.TrunkMACAddress, err = net.ParseMAC(config.TrunkMACAddress)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid trunkMACAddress %s\", config.TrunkMACAddress)\n\t\t}\n\t}\n\n\t// Parse the branch VLAN ID.\n\tnetConfig.BranchVlanID, err = strconv.Atoi(config.BranchVlanID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid branchVlanID %s\", config.BranchVlanID)\n\t}\n\n\t// Parse the branch MAC address.\n\tnetConfig.BranchMACAddress, err = net.ParseMAC(config.BranchMACAddress)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid branchMACAddress %s\", config.BranchMACAddress)\n\t}\n\n\t// Parse branch IP addresses. These can be IPv4 or IPv6 addresses and are optional for some\n\t// setups like TAP interfaces where the IP addresses are assigned through other means.\n\tfor _, s := range config.IPAddresses {\n\t\taddr, err := vpc.GetIPAddressFromString(s)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid ipAddress %s\", s)\n\t\t}\n\t\tnetConfig.IPAddresses = append(netConfig.IPAddresses, *addr)\n\t}\n\n\t// Parse optional gateway IP addresses.\n\tfor _, s := range config.GatewayIPAddresses {\n\t\taddr := net.ParseIP(s)\n\t\tif addr == nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid gatewayIPAddress %s\", s)\n\t\t}\n\t\tnetConfig.GatewayIPAddresses = append(netConfig.GatewayIPAddresses, addr)\n\t}\n\n\t// Parse the TAP interface owner UID and GID.\n\tif config.InterfaceType == IfTypeTAP {\n\t\tnetConfig.Tap = &TAPConfig{\n\t\t\tQueues: defaultTapQueues,\n\t\t}\n\n\t\tif config.Uid != \"\" {\n\t\t\tnetConfig.Tap.Uid, err = strconv.Atoi(config.Uid)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid uid %s\", config.Uid)\n\t\t\t}\n\t\t}\n\n\t\tif config.Gid != \"\" {\n\t\t\tnetConfig.Tap.Gid, err = strconv.Atoi(config.Gid)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid gid %s\", config.Gid)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validation complete. Return the parsed NetConfig object.\n\tlog.Debugf(\"Created NetConfig: %+v\", netConfig)\n\treturn &netConfig, nil\n}", "title": "" }, { "docid": "3698603808b3ea791c1cf95ed1651dff", "score": "0.5423026", "text": "func checkSubnet(APIstub shim.ChaincodeStubInterface, prefix string, ipType int) (bool, bool) {\n\tresultsIterator, _ := APIstub.GetStateByPartialCompositeKey(\"MASK\", []string{})\n\t//100.10.10.10/24 = 100.10.10.0/24\n\t//100.10.10.30/25 = 100.10.10.0/25\n\t//Loop to go through every IP prefix stored\n\tfor resultsIterator.HasNext() {\n\t\tqueryResponse, _ := resultsIterator.Next()\n\n\t\t_, compositeKeyParts, _ := APIstub.SplitCompositeKey(queryResponse.GetKey())\n\n\t\t//Reconstruct according to the IP type that is stored\n\t\tvar reconstructedPrefix string\n\t\tif len(compositeKeyParts) == 5 {\n\t\t\treconstructedPrefix = reconstructPrefix(compositeKeyParts, 0)\n\t\t} else if len(compositeKeyParts) == 9 {\n\t\t\treconstructedPrefix = reconstructPrefix(compositeKeyParts, 1)\n\t\t}\n\n\t\t//reconstructedPrefix := reconstructPrefix(compositeKeyParts, ipType)\n\t\tfoundIP, foundPrefix, _ := net.ParseCIDR(reconstructedPrefix)\n\t\tfoundMask, _ := strconv.Atoi(strings.Split(foundPrefix.String(), \"/\")[1])\n\t\tgivenIP, givenPrefix, _ := net.ParseCIDR(prefix)\n\t\tgivenMask, _ := strconv.Atoi(strings.Split(givenPrefix.String(), \"/\")[1])\n\n\t\tfmt.Println(\"found prefix: \" + foundPrefix.String())\n\t\tfmt.Println(\"given prefix: \" + givenPrefix.String())\n\n\t\t//Given prefix and found prefix are the same - WON'T BE INSERTED BUT AS PATH CAN BE UPDATED\n\t\tif givenPrefix.String() == foundPrefix.String() {\n\t\t\treturn true, true\n\t\t}\n\n\t\t//Given prefix is a supernet of one already in the blockchain - CAN'T BE INSERTED\n\t\tif givenPrefix.Contains(foundIP) && givenMask < foundMask {\n\t\t\treturn true, false\n\t\t}\n\n\t\t//Given prefix is a subtnet of one already in the blockchain - CAN BE INSERTED IN THE BLOCKCHAIN (IP LIST ONLY)\n\t\tif foundPrefix.Contains(givenIP) {\n\t\t\treturn false, true\n\t\t}\n\t}\n\t//Given prefix isn't a subnet or a supernet of a stored one - CAN BE INSERTED IN THE BLOCKCHAIN (BOTH IP AND MASK LISTS)\n\treturn false, false\n}", "title": "" }, { "docid": "b39e1823abe86b85bd530c06aec22702", "score": "0.5393441", "text": "func (nni *NodeNetworkInspector) Init() error {\n\t// get node address\n\tifacesStr := strings.Replace(nni.option.Ifaces, \";\", \",\", -1)\n\tifaces := strings.Split(ifacesStr, \",\")\n\tinstanceIP, _, err := nni.netUtil.GetAvailableHostIP(ifaces)\n\tif err != nil {\n\t\tblog.Errorf(\"get node ip failed, err %s\", err.Error())\n\t\treturn fmt.Errorf(\"get node ip failed, err %s\", err.Error())\n\t}\n\tnni.address = instanceIP\n\n\tif err = nni.initIPCache(nni.address); err != nil {\n\t\treturn err\n\t}\n\n\t// start reconcile loop for ready eni\n\tgo nni.reconcileLoop()\n\tblog.Infof(\"start reconcile loop for ready eni\")\n\n\tvar config *rest.Config\n\t// when out-of-cluster, kubeconfig must be\n\tif len(nni.kubeconfig) != 0 {\n\t\tconfig, err = clientcmd.BuildConfigFromFlags(\"\", nni.kubeconfig)\n\t\tif err != nil {\n\t\t\tblog.Errorf(\"build config from kubeconfig %s failed, err %s\", nni.kubeconfig, err.Error())\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tconfig, err = rest.InClusterConfig()\n\t\tif err != nil {\n\t\t\tblog.Errorf(\"build incluster config failed, err %s\", err.Error())\n\t\t\treturn err\n\t\t}\n\t}\n\tclientset, err := clientset.NewForConfig(config)\n\tif err != nil {\n\t\tblog.Errorf(\"build clientset failed, err %s\", err.Error())\n\t\treturn err\n\t}\n\n\tnni.client = clientset.CloudV1()\n\tnni.factory = factory.NewSharedInformerFactory(clientset, time.Duration(nni.kubeResyncPeriod)*time.Second)\n\tnni.informer = nni.factory.Cloud().V1().NodeNetworks()\n\tnni.informer.Informer().AddEventHandler(nni)\n\tnni.lister = nni.factory.Cloud().V1().NodeNetworks().Lister()\n\n\tnni.ipInformer = nni.factory.Cloud().V1().CloudIPs()\n\tnni.ipLister = nni.factory.Cloud().V1().CloudIPs().Lister()\n\n\t// start informers\n\tnni.factory.Start(nni.stopCh)\n\tsyncFlag := make(chan struct{})\n\tgo func() {\n\t\tblog.Infof(\"wait for informer factory cache sync\")\n\t\tnni.factory.WaitForCacheSync(nni.stopCh)\n\t\tclose(syncFlag)\n\t}()\n\tselect {\n\tcase <-time.After(time.Duration(nni.kubeCacheSyncTimeout) * time.Second):\n\t\treturn fmt.Errorf(\"wait for cache sync timeout after %d seconds\", nni.kubeCacheSyncTimeout)\n\tcase <-syncFlag:\n\t\tbreak\n\t}\n\tblog.Infof(\"wait informer factory cache sync done\")\n\n\tif nni.nodeNetwork != nil {\n\t\t// do dirty ip check\n\t\tif err := nni.DirtyCheck(nni.nodeNetwork); err != nil {\n\t\t\tblog.Warnf(\"do dirty ip check failed, err %s\", err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cc8d858b3907aca3a22309dbe1bdfa58", "score": "0.53228545", "text": "func loadConf(bytes []byte, args string) (*NetConf, string, error) {\n\tconf := &NetConf{}\n\tif err := json.Unmarshal(bytes, conf); err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"failed to load cni conf, err %s\", err.Error())\n\t}\n\tif conf.MTU < 68 || conf.MTU > 65535 {\n\t\tblog.Errorf(\"invalid mtu %d\", conf.MTU)\n\t\treturn nil, \"\", fmt.Errorf(\"invalid mtu %d\", conf.MTU)\n\t}\n\tif len(conf.LogDir) == 0 {\n\t\tblog.Errorf(\"log dir is empty, use default log dir './logs'\")\n\t\tconf.LogDir = defaultLogDir\n\t}\n\tif conf.RouteRulePriority < 256 && conf.RouteRulePriority != 0 {\n\t\treturn nil, \"\", fmt.Errorf(\"invalid route rule priority %d\", conf.RouteRulePriority)\n\t}\n\tif conf.RouteRulePriority == 0 {\n\t\tconf.RouteRulePriority = DefaultRouteRulePriority\n\t}\n\tif args != \"\" {\n\t\tconf.Args = &CNIArgs{}\n\t\terr := types.LoadArgs(args, conf.Args)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t}\n\treturn conf, conf.CNIVersion, nil\n}", "title": "" }, { "docid": "2c96291ab5084e61efae6c74ad6acc1e", "score": "0.5318683", "text": "func Test_VMupdateNicParameters_multiNIC(t *testing.T) {\n\n\t// Mock VM struct\n\tc := Client{}\n\tvm := NewVM(&c)\n\n\t// Sample config which is rendered by .tf schema parsed\n\ttfCfg := []map[string]interface{}{\n\t\tmap[string]interface{}{\n\t\t\t\"network_name\": \"multinic-net\",\n\t\t\t\"ip_allocation_mode\": \"POOL\",\n\t\t\t\"ip\": \"\",\n\t\t\t\"is_primary\": false,\n\t\t},\n\t\tmap[string]interface{}{\n\t\t\t\"network_name\": \"multinic-net\",\n\t\t\t\"ip_allocation_mode\": \"DHCP\",\n\t\t\t\"ip\": \"\",\n\t\t\t\"is_primary\": true,\n\t\t},\n\t\tmap[string]interface{}{\n\t\t\t\"ip_allocation_mode\": \"NONE\",\n\t\t},\n\t\tmap[string]interface{}{\n\t\t\t\"network_name\": \"multinic-net2\",\n\t\t\t\"ip_allocation_mode\": \"MANUAL\",\n\t\t\t\"ip\": \"1.1.1.1\",\n\t\t\t\"is_primary\": false,\n\t\t},\n\t}\n\n\t// A sample NetworkConnectionSection object simulating API returning ordered list\n\tvcdConfig := types.NetworkConnectionSection{\n\t\tPrimaryNetworkConnectionIndex: 0,\n\t\tNetworkConnection: []*types.NetworkConnection{\n\t\t\t&types.NetworkConnection{\n\t\t\t\tNetwork: \"multinic-net\",\n\t\t\t\tNetworkConnectionIndex: 0,\n\t\t\t\tIPAddress: \"\",\n\t\t\t\tIsConnected: true,\n\t\t\t\tMACAddress: \"00:00:00:00:00:00\",\n\t\t\t\tIPAddressAllocationMode: \"POOL\",\n\t\t\t\tNetworkAdapterType: \"VMXNET3\",\n\t\t\t},\n\t\t\t&types.NetworkConnection{\n\t\t\t\tNetwork: \"multinic-net\",\n\t\t\t\tNetworkConnectionIndex: 1,\n\t\t\t\tIPAddress: \"\",\n\t\t\t\tIsConnected: true,\n\t\t\t\tMACAddress: \"00:00:00:00:00:01\",\n\t\t\t\tIPAddressAllocationMode: \"POOL\",\n\t\t\t\tNetworkAdapterType: \"VMXNET3\",\n\t\t\t},\n\t\t\t&types.NetworkConnection{\n\t\t\t\tNetwork: \"multinic-net\",\n\t\t\t\tNetworkConnectionIndex: 2,\n\t\t\t\tIPAddress: \"\",\n\t\t\t\tIsConnected: true,\n\t\t\t\tMACAddress: \"00:00:00:00:00:02\",\n\t\t\t\tIPAddressAllocationMode: \"POOL\",\n\t\t\t\tNetworkAdapterType: \"VMXNET3\",\n\t\t\t},\n\t\t\t&types.NetworkConnection{\n\t\t\t\tNetwork: \"multinic-net\",\n\t\t\t\tNetworkConnectionIndex: 3,\n\t\t\t\tIPAddress: \"\",\n\t\t\t\tIsConnected: true,\n\t\t\t\tMACAddress: \"00:00:00:00:00:03\",\n\t\t\t\tIPAddressAllocationMode: \"POOL\",\n\t\t\t\tNetworkAdapterType: \"VMXNET3\",\n\t\t\t},\n\t\t},\n\t}\n\n\t// NIC configuration when API returns an ordered list\n\tvcdCfg := &vcdConfig\n\terr := vm.updateNicParameters(tfCfg, vcdCfg)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Test NIC updates when API returns an unordered list\n\t// Swap two &types.NetworkConnection so that it is not ordered correctly\n\tvcdConfig2 := vcdConfig\n\tvcdConfig2.NetworkConnection[2], vcdConfig2.NetworkConnection[0] = vcdConfig2.NetworkConnection[0], vcdConfig2.NetworkConnection[2]\n\tvcdCfg2 := &vcdConfig2\n\terr = vm.updateNicParameters(tfCfg, vcdCfg2)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tvar tableTests = []struct {\n\t\ttitle string\n\t\ttfConfig []map[string]interface{}\n\t\tvcdConfig *types.NetworkConnectionSection\n\t}{\n\t\t{\"Ordered NICs list\", tfCfg, vcdCfg},\n\t\t{\"Unordered NIC list\", tfCfg, vcdCfg2},\n\t}\n\n\tfor _, tableTest := range tableTests {\n\t\tt.Run(tableTest.title, func(t *testing.T) {\n\t\t\t// Check that primary interface is reset to 1 as hardcoded in tfCfg \"is_primary\" parameter\n\t\t\tif vcdCfg.PrimaryNetworkConnectionIndex != 1 {\n\t\t\t\tt.Errorf(\"PrimaryNetworkConnectionIndex expected: 1, got: %d\", vcdCfg.PrimaryNetworkConnectionIndex)\n\t\t\t}\n\n\t\t\tfor loopIndex := range tableTest.vcdConfig.NetworkConnection {\n\t\t\t\tvcdNic := tableTest.vcdConfig.NetworkConnection[loopIndex]\n\t\t\t\tvcdNicSlot := vcdNic.NetworkConnectionIndex\n\t\t\t\ttfNic := tableTest.tfConfig[vcdNicSlot]\n\n\t\t\t\tif vcdNic.IPAddressAllocationMode != tfNic[\"ip_allocation_mode\"].(string) {\n\t\t\t\t\tt.Errorf(\"IPAddressAllocationMode expected: %s, got: %s\", tfNic[\"ip_allocation_mode\"].(string), vcdNic.IPAddressAllocationMode)\n\t\t\t\t}\n\n\t\t\t\tif vcdNic.IPAddressAllocationMode != tfNic[\"ip_allocation_mode\"].(string) {\n\t\t\t\t\tt.Errorf(\"IPAddressAllocationMode expected: %s, got: %s\", tfNic[\"ip_allocation_mode\"].(string), vcdNic.IPAddressAllocationMode)\n\t\t\t\t}\n\n\t\t\t\tif vcdNic.IsConnected != true {\n\t\t\t\t\tt.Errorf(\"IsConnected expected: true, got: %t\", vcdNic.IsConnected)\n\t\t\t\t}\n\n\t\t\t\tif vcdNic.NeedsCustomization != true {\n\t\t\t\t\tt.Errorf(\"NeedsCustomization expected: true, got: %t\", vcdNic.NeedsCustomization)\n\t\t\t\t}\n\n\t\t\t\tif vcdNic.IPAddressAllocationMode != types.IPAllocationModeNone {\n\t\t\t\t\tif vcdNic.Network != tfNic[\"network_name\"].(string) {\n\t\t\t\t\t\tt.Errorf(\"Network expected: %s, got: %s\", tfNic[\"network_name\"].(string), vcdNic.Network)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif vcdNic.Network != \"none\" {\n\t\t\t\t\t\tt.Errorf(\"Network expected: none, got: %s\", vcdNic.Network)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "2ab69f8f4cbc7ba704cb611fa85b7a48", "score": "0.5306617", "text": "func validateNetworkingIPVersion(n *types.Networking, p *types.Platform) field.ErrorList {\n\tvar allErrs field.ErrorList\n\n\thasIPv4, hasIPv6, presence, addresses := inferIPVersionFromInstallConfig(n)\n\n\tswitch {\n\tcase hasIPv4 && hasIPv6:\n\t\tif n.NetworkType == string(operv1.NetworkTypeOpenShiftSDN) {\n\t\t\tallErrs = append(allErrs, field.Invalid(field.NewPath(\"networking\", \"networkType\"), n.NetworkType, \"dual-stack IPv4/IPv6 is not supported for this networking plugin\"))\n\t\t}\n\n\t\tif len(n.ServiceNetwork) != 2 {\n\t\t\tallErrs = append(allErrs, field.Invalid(field.NewPath(\"networking\", \"serviceNetwork\"), strings.Join(ipnetworksToStrings(n.ServiceNetwork), \", \"), \"when installing dual-stack IPv4/IPv6 you must provide two service networks, one for each IP address type\"))\n\t\t}\n\n\t\tallowV6Primary := false\n\t\texperimentalDualStackEnabled, _ := strconv.ParseBool(os.Getenv(\"OPENSHIFT_INSTALL_EXPERIMENTAL_DUAL_STACK\"))\n\t\tswitch {\n\t\tcase p.Azure != nil && experimentalDualStackEnabled:\n\t\t\tlogrus.Warnf(\"Using experimental Azure dual-stack support\")\n\t\tcase p.BareMetal != nil:\n\t\t\t// We now support ipv6-primary dual stack on baremetal\n\t\t\tallowV6Primary = true\n\t\tcase p.VSphere != nil:\n\t\t\t// as well as on vSphere\n\t\t\tallowV6Primary = true\n\t\tcase p.OpenStack != nil:\n\t\tcase p.Ovirt != nil:\n\t\tcase p.Nutanix != nil:\n\t\tcase p.None != nil:\n\t\tcase p.External != nil:\n\t\tdefault:\n\t\t\tallErrs = append(allErrs, field.Invalid(field.NewPath(\"networking\"), \"DualStack\", \"dual-stack IPv4/IPv6 is not supported for this platform, specify only one type of address\"))\n\t\t}\n\t\tfor k, v := range presence {\n\t\t\tswitch {\n\t\t\tcase v.IPv4 && !v.IPv6:\n\t\t\t\tallErrs = append(allErrs, field.Invalid(field.NewPath(\"networking\", k), strings.Join(ipnetworksToStrings(addresses[k]), \", \"), \"dual-stack IPv4/IPv6 requires an IPv6 network in this list\"))\n\t\t\tcase !v.IPv4 && v.IPv6:\n\t\t\t\tallErrs = append(allErrs, field.Invalid(field.NewPath(\"networking\", k), strings.Join(ipnetworksToStrings(addresses[k]), \", \"), \"dual-stack IPv4/IPv6 requires an IPv4 network in this list\"))\n\t\t\t}\n\n\t\t\t// FIXME: we should allow either all-networks-IPv4Primary or\n\t\t\t// all-networks-IPv6Primary, but the latter currently causes\n\t\t\t// confusing install failures, so block it.\n\t\t\tif !allowV6Primary && v.IPv4 && v.IPv6 && v.Primary != corev1.IPv4Protocol {\n\t\t\t\tallErrs = append(allErrs, field.Invalid(field.NewPath(\"networking\", k), strings.Join(ipnetworksToStrings(addresses[k]), \", \"), \"IPv4 addresses must be listed before IPv6 addresses\"))\n\t\t\t}\n\t\t}\n\n\tcase hasIPv6:\n\t\tif n.NetworkType == string(operv1.NetworkTypeOpenShiftSDN) {\n\t\t\tallErrs = append(allErrs, field.Invalid(field.NewPath(\"networking\", \"networkType\"), n.NetworkType, \"IPv6 is not supported for this networking plugin\"))\n\t\t}\n\n\t\tswitch {\n\t\tcase p.BareMetal != nil:\n\t\tcase p.VSphere != nil:\n\t\tcase p.OpenStack != nil:\n\t\tcase p.Ovirt != nil:\n\t\tcase p.Nutanix != nil:\n\t\tcase p.None != nil:\n\t\tcase p.External != nil:\n\t\tcase p.Azure != nil && p.Azure.CloudName == azure.StackCloud:\n\t\t\tallErrs = append(allErrs, field.Invalid(field.NewPath(\"networking\"), \"IPv6\", \"Azure Stack does not support IPv6\"))\n\t\tdefault:\n\t\t\tallErrs = append(allErrs, field.Invalid(field.NewPath(\"networking\"), \"IPv6\", \"single-stack IPv6 is not supported for this platform\"))\n\t\t}\n\n\tcase hasIPv4:\n\t\tif len(n.ServiceNetwork) > 1 {\n\t\t\tallErrs = append(allErrs, field.Invalid(field.NewPath(\"networking\", \"serviceNetwork\"), strings.Join(ipnetworksToStrings(n.ServiceNetwork), \", \"), \"only one service network can be specified\"))\n\t\t}\n\n\tdefault:\n\t\t// we should have a validation error for no specified machineNetwork, serviceNetwork, or clusterNetwork\n\t}\n\n\treturn allErrs\n}", "title": "" }, { "docid": "40393e2e8ee48933936150ac1e9b25a5", "score": "0.5297095", "text": "func (c ConfigState) Run(nics []podNIC, preRunFunc func([]podNIC) ([]podNIC, error), discoverFunc func(*podNIC) error, configFunc func(*podNIC) error) error {\n\tvar pendingNICs []podNIC\n\tfor _, nic := range nics {\n\t\tstate, err := c.cache.Read(nic.vmiSpecNetwork.Name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tswitch state {\n\t\tcase cache.PodIfaceNetworkPreparationPending:\n\t\t\tpendingNICs = append(pendingNICs, nic)\n\t\tcase cache.PodIfaceNetworkPreparationStarted:\n\t\t\treturn neterrors.CreateCriticalNetworkError(\n\t\t\t\tfmt.Errorf(\"network %s preparation cannot be restarted\", nic.vmiSpecNetwork.Name),\n\t\t\t)\n\t\t}\n\t}\n\tnics = pendingNICs\n\n\tif len(pendingNICs) == 0 {\n\t\treturn nil\n\t}\n\n\terr := c.ns.Do(func() error {\n\t\tvar preErr error\n\t\tnics, preErr = preRunFunc(nics)\n\t\tif preErr != nil {\n\t\t\treturn preErr\n\t\t}\n\t\treturn c.plug(nics, discoverFunc, configFunc)\n\t})\n\treturn err\n}", "title": "" }, { "docid": "f63bd6379c2f0970274652be3455ab25", "score": "0.52875984", "text": "func Test_VMupdateNicParameters_singleNIC(t *testing.T) {\n\t// Mock VM struct\n\tc := Client{}\n\tvm := NewVM(&c)\n\n\ttfCfgDHCP := []map[string]interface{}{\n\t\tmap[string]interface{}{\n\t\t\t\"network_name\": \"multinic-net\",\n\t\t\t\"ip\": \"dhcp\",\n\t\t},\n\t}\n\n\ttfCfgAllocated := []map[string]interface{}{\n\t\tmap[string]interface{}{\n\t\t\t\"network_name\": \"multinic-net\",\n\t\t\t\"ip\": \"allocated\",\n\t\t},\n\t}\n\n\ttfCfgNone := []map[string]interface{}{\n\t\tmap[string]interface{}{\n\t\t\t\"network_name\": \"multinic-net\",\n\t\t\t\"ip\": \"none\",\n\t\t},\n\t}\n\n\ttfCfgManual := []map[string]interface{}{\n\t\tmap[string]interface{}{\n\t\t\t\"network_name\": \"multinic-net\",\n\t\t\t\"ip\": \"1.1.1.1\",\n\t\t},\n\t}\n\n\ttfCfgInvalidIp := []map[string]interface{}{\n\t\tmap[string]interface{}{\n\t\t\t\"network_name\": \"multinic-net\",\n\t\t\t\"ip\": \"invalidIp\",\n\t\t},\n\t}\n\n\ttfCfgNoNetworkName := []map[string]interface{}{\n\t\tmap[string]interface{}{\n\t\t\t\"ip\": \"invalidIp\",\n\t\t},\n\t}\n\n\tvcdConfig := types.NetworkConnectionSection{\n\t\tPrimaryNetworkConnectionIndex: 1,\n\t\tNetworkConnection: []*types.NetworkConnection{\n\t\t\t&types.NetworkConnection{\n\t\t\t\tNetwork: \"singlenic-net\",\n\t\t\t\tNetworkConnectionIndex: 0,\n\t\t\t\tIPAddress: \"\",\n\t\t\t\tIsConnected: true,\n\t\t\t\tMACAddress: \"00:00:00:00:00:00\",\n\t\t\t\tIPAddressAllocationMode: \"POOL\",\n\t\t\t\tNetworkAdapterType: \"VMXNET3\",\n\t\t\t},\n\t\t},\n\t}\n\n\tvar tableTests = []struct {\n\t\ttitle string\n\t\ttfConfig []map[string]interface{}\n\t\texpectedIPAddressAllocationMode string\n\t\texpectedIPAddress string\n\t\tmustNotError bool\n\t}{\n\t\t{\"IPAllocationModeDHCP\", tfCfgDHCP, types.IPAllocationModeDHCP, \"Any\", true},\n\t\t{\"IPAllocationModePool\", tfCfgAllocated, types.IPAllocationModePool, \"Any\", true},\n\t\t{\"IPAllocationModeNone\", tfCfgNone, types.IPAllocationModeNone, \"Any\", true},\n\t\t{\"IPAllocationModeManual\", tfCfgManual, types.IPAllocationModeManual, tfCfgManual[0][\"ip\"].(string), true},\n\t\t{\"IPAllocationModeDHCPInvalidIP\", tfCfgInvalidIp, types.IPAllocationModeDHCP, \"Any\", true},\n\t\t{\"ErrNoNetworkName\", tfCfgNoNetworkName, types.IPAllocationModeDHCP, \"Any\", false},\n\t}\n\n\tfor _, tableTest := range tableTests {\n\n\t\tt.Run(tableTest.title, func(t *testing.T) {\n\t\t\tvcdCfg := &vcdConfig\n\t\t\terr := vm.updateNicParameters(tableTest.tfConfig, vcdCfg) // Execute parsing procedure\n\n\t\t\t// if we got an error which was expected abandon the subtest\n\t\t\tif err != nil && tableTest.mustNotError {\n\t\t\t\tt.Errorf(\"unexpected error got: %s\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif vcdCfg.PrimaryNetworkConnectionIndex != 0 {\n\t\t\t\tt.Errorf(\"PrimaryNetworkConnectionIndex expected: 0, got: %d\", vcdCfg.PrimaryNetworkConnectionIndex)\n\t\t\t}\n\n\t\t\tif vcdCfg.NetworkConnection[0].IPAddressAllocationMode != tableTest.expectedIPAddressAllocationMode {\n\t\t\t\tt.Errorf(\"IPAddressAllocationMode expected: %s, got: %s\", tableTest.expectedIPAddressAllocationMode, vcdCfg.NetworkConnection[0].IPAddressAllocationMode)\n\t\t\t}\n\n\t\t\tif vcdCfg.NetworkConnection[0].IPAddress != tableTest.expectedIPAddress {\n\t\t\t\tt.Errorf(\"IPAddress expected: %s, got: %s\", tableTest.expectedIPAddress, vcdCfg.NetworkConnection[0].IPAddress)\n\t\t\t}\n\t\t})\n\n\t}\n}", "title": "" }, { "docid": "6160a75de6048dbe6ce98fd9f6386cc8", "score": "0.5281203", "text": "func validatePerNetworkOpts(network *types.Network, netOpts *types.PerNetworkOptions) error {\n\tif netOpts.InterfaceName == \"\" {\n\t\treturn fmt.Errorf(\"interface name on network %s is empty\", network.Name)\n\t}\n\tif network.IPAMOptions[types.Driver] == types.HostLocalIPAMDriver {\n\touter:\n\t\tfor _, ip := range netOpts.StaticIPs {\n\t\t\tfor _, s := range network.Subnets {\n\t\t\t\tif s.Subnet.Contains(ip) {\n\t\t\t\t\tcontinue outer\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"requested static ip %s not in any subnet on network %s\", ip.String(), network.Name)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d1e7a403f533314dbfd8d11c99f38ee2", "score": "0.5280331", "text": "func (c *config) checkValidConfig() hcl.Diagnostics {\n\tvar diagnostics hcl.Diagnostics\n\n\tif c.InstallToSmallestDisk && c.InstallDisk != \"\" {\n\t\tdiagnostics = append(diagnostics, &hcl.Diagnostic{\n\t\t\tSeverity: hcl.DiagError,\n\t\t\tSummary: \"`install_disk` and `install_to_smallest_disk` are mutually exclusive\",\n\t\t\tDetail: \"Provide either `install_disk` or `install_to_smallest_disk` or none, but not both\",\n\t\t})\n\t}\n\n\tif c.DownloadProtocol != \"http\" && c.DownloadProtocol != \"https\" {\n\t\tdiagnostics = append(diagnostics, &hcl.Diagnostic{\n\t\t\tSeverity: hcl.DiagError,\n\t\t\tSummary: \"Invalid value for `download_protocol`\",\n\t\t\tDetail: fmt.Sprintf(\"expected 'http' or 'https', got: %q\", c.DownloadProtocol),\n\t\t})\n\t}\n\n\tif c.ConntrackMaxPerCore < 0 {\n\t\tdiagnostics = append(diagnostics, &hcl.Diagnostic{\n\t\t\tSeverity: hcl.DiagError,\n\t\t\tSummary: \"conntrack_max_per_core can't be negative value\",\n\t\t\tDetail: fmt.Sprintf(\"'conntrack_max_per_core' value is %d\", c.ConntrackMaxPerCore),\n\t\t})\n\t}\n\n\tif c.OIDC != nil {\n\t\t_, diags := c.OIDC.ToKubeAPIServerFlags(c.K8sDomainName)\n\t\tdiagnostics = append(diagnostics, diags...)\n\t}\n\n\tfor key, list := range c.CLCSnippets {\n\t\tif key == \"\" || len(list) == 0 {\n\t\t\tdiagnostics = append(diagnostics, &hcl.Diagnostic{\n\t\t\t\tSeverity: hcl.DiagError,\n\t\t\t\tSummary: \"key/value for clc_snippets map can't be empty\",\n\t\t\t\tDetail: fmt.Sprintf(\"either key or value for clc_snippets is empty: %q : %v\", key, list),\n\t\t\t})\n\t\t}\n\n\t\tfor _, data := range list {\n\t\t\tif data == \"\" {\n\t\t\t\tdiagnostics = append(diagnostics, &hcl.Diagnostic{\n\t\t\t\t\tSeverity: hcl.DiagError,\n\t\t\t\t\tSummary: \"Values list for clc_snippets cannot contain an empty element\",\n\t\t\t\t\tDetail: fmt.Sprintf(\"found empty element in the key value pair: %q : %v\", key, list),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn diagnostics\n}", "title": "" }, { "docid": "43278b1d28690d96b2a9a4a466fa45ff", "score": "0.5277569", "text": "func Connect(w http.ResponseWriter, r *http.Request) {\n\truntime := r.Context().Value(api.RuntimeKey).(*libpod.Runtime)\n\n\tvar netConnect types.NetworkConnect\n\tif err := json.NewDecoder(r.Body).Decode(&netConnect); err != nil {\n\t\tutils.Error(w, http.StatusInternalServerError, fmt.Errorf(\"Decode(): %w\", err))\n\t\treturn\n\t}\n\n\tnetOpts := nettypes.PerNetworkOptions{}\n\n\tname, _ := normalizeNetworkName(runtime, utils.GetName(r))\n\tif netConnect.EndpointConfig != nil {\n\t\tif netConnect.EndpointConfig.Aliases != nil {\n\t\t\tnetOpts.Aliases = netConnect.EndpointConfig.Aliases\n\t\t}\n\n\t\t// if IP address is provided\n\t\tif len(netConnect.EndpointConfig.IPAddress) > 0 {\n\t\t\tstaticIP := net.ParseIP(netConnect.EndpointConfig.IPAddress)\n\t\t\tif staticIP == nil {\n\t\t\t\tutils.Error(w, http.StatusInternalServerError,\n\t\t\t\t\tfmt.Errorf(\"failed to parse the ip address %q\", netConnect.EndpointConfig.IPAddress))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tnetOpts.StaticIPs = append(netOpts.StaticIPs, staticIP)\n\t\t}\n\n\t\tif netConnect.EndpointConfig.IPAMConfig != nil {\n\t\t\t// if IPAMConfig.IPv4Address is provided\n\t\t\tif len(netConnect.EndpointConfig.IPAMConfig.IPv4Address) > 0 {\n\t\t\t\tstaticIP := net.ParseIP(netConnect.EndpointConfig.IPAMConfig.IPv4Address)\n\t\t\t\tif staticIP == nil {\n\t\t\t\t\tutils.Error(w, http.StatusInternalServerError,\n\t\t\t\t\t\tfmt.Errorf(\"failed to parse the ipv4 address %q\", netConnect.EndpointConfig.IPAMConfig.IPv4Address))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tnetOpts.StaticIPs = append(netOpts.StaticIPs, staticIP)\n\t\t\t}\n\t\t\t// if IPAMConfig.IPv6Address is provided\n\t\t\tif len(netConnect.EndpointConfig.IPAMConfig.IPv6Address) > 0 {\n\t\t\t\tstaticIP := net.ParseIP(netConnect.EndpointConfig.IPAMConfig.IPv6Address)\n\t\t\t\tif staticIP == nil {\n\t\t\t\t\tutils.Error(w, http.StatusInternalServerError,\n\t\t\t\t\t\tfmt.Errorf(\"failed to parse the ipv6 address %q\", netConnect.EndpointConfig.IPAMConfig.IPv6Address))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tnetOpts.StaticIPs = append(netOpts.StaticIPs, staticIP)\n\t\t\t}\n\t\t}\n\t\t// If MAC address is provided\n\t\tif len(netConnect.EndpointConfig.MacAddress) > 0 {\n\t\t\tstaticMac, err := net.ParseMAC(netConnect.EndpointConfig.MacAddress)\n\t\t\tif err != nil {\n\t\t\t\tutils.Error(w, http.StatusInternalServerError,\n\t\t\t\t\tfmt.Errorf(\"failed to parse the mac address %q\", netConnect.EndpointConfig.IPAMConfig.IPv6Address))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tnetOpts.StaticMAC = nettypes.HardwareAddr(staticMac)\n\t\t}\n\t}\n\terr := runtime.ConnectContainerToNetwork(netConnect.Container, name, netOpts)\n\tif err != nil {\n\t\tif errors.Is(err, define.ErrNoSuchCtr) {\n\t\t\tutils.ContainerNotFound(w, netConnect.Container, err)\n\t\t\treturn\n\t\t}\n\t\tif errors.Is(err, define.ErrNoSuchNetwork) {\n\t\t\tutils.Error(w, http.StatusNotFound, err)\n\t\t\treturn\n\t\t}\n\t\tutils.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tutils.WriteResponse(w, http.StatusOK, \"OK\")\n}", "title": "" }, { "docid": "bfa84663522e8a0d29ef7a7908347952", "score": "0.5251054", "text": "func (s *CIDRLabelsSuite) TestGetCIDRLabels(c *C) {\n\toption.Config.EnableIPv6 = false\n\tprefix := netip.MustParsePrefix(\"192.0.2.3/32\")\n\texpected := labels.ParseLabelArray(\n\t\t\"cidr:0.0.0.0/0\",\n\t\t\"cidr:128.0.0.0/1\",\n\t\t\"cidr:192.0.0.0/8\",\n\t\t\"cidr:192.0.2.0/24\",\n\t\t\"cidr:192.0.2.3/32\",\n\t\t\"reserved:world\",\n\t)\n\n\tlbls := GetCIDRLabels(prefix)\n\tlblArray := lbls.LabelArray()\n\tc.Assert(lblArray.Lacks(expected), checker.DeepEquals, labels.LabelArray{})\n\t// IPs should be masked as the labels are generated\n\tc.Assert(lblArray.Has(\"cidr:192.0.2.3/24\"), Equals, false)\n\n\tprefix = netip.MustParsePrefix(\"192.0.2.0/24\")\n\texpected = labels.ParseLabelArray(\n\t\t\"cidr:0.0.0.0/0\",\n\t\t\"cidr:192.0.2.0/24\",\n\t\t\"reserved:world\",\n\t)\n\n\tlbls = GetCIDRLabels(prefix)\n\tlblArray = lbls.LabelArray()\n\tc.Assert(lblArray.Lacks(expected), checker.DeepEquals, labels.LabelArray{})\n\t// CIDRs that are covered by the prefix should not be in the labels\n\tc.Assert(lblArray.Has(\"cidr.192.0.2.3/32\"), Equals, false)\n\n\t// Zero-length prefix / default route should become reserved:world.\n\tprefix = netip.MustParsePrefix(\"0.0.0.0/0\")\n\texpected = labels.ParseLabelArray(\n\t\t\"reserved:world\",\n\t)\n\n\tlbls = GetCIDRLabels(prefix)\n\tlblArray = lbls.LabelArray()\n\tc.Assert(lblArray.Lacks(expected), checker.DeepEquals, labels.LabelArray{})\n\tc.Assert(lblArray.Has(\"cidr.0.0.0.0/0\"), Equals, false)\n\n\t// Note that we convert the colons in IPv6 addresses into dashes when\n\t// translating into labels, because endpointSelectors don't support\n\t// colons.\n\toption.Config.EnableIPv6 = true\n\toption.Config.EnableIPv4 = false\n\tprefix = netip.MustParsePrefix(\"2001:DB8::1/128\")\n\texpected = labels.ParseLabelArray(\n\t\t\"cidr:0--0/0\",\n\t\t\"cidr:2000--0/3\",\n\t\t\"cidr:2001--0/16\",\n\t\t\"cidr:2001-d00--0/24\",\n\t\t\"cidr:2001-db8--0/32\",\n\t\t\"cidr:2001-db8--1/128\",\n\t\t\"reserved:world\",\n\t)\n\n\tlbls = GetCIDRLabels(prefix)\n\tlblArray = lbls.LabelArray()\n\tc.Assert(lblArray.Lacks(expected), checker.DeepEquals, labels.LabelArray{})\n\t// IPs should be masked as the labels are generated\n\tc.Assert(lblArray.Has(\"cidr.2001-db8--1/24\"), Equals, false)\n\toption.Config.EnableIPv4 = true\n}", "title": "" }, { "docid": "c601aece67085ff3374e6d9ffd95b8db", "score": "0.5229217", "text": "func ProcessIPConfigResp(resp *cns.IPConfigResponse) (*netip.Prefix, error) {\n\tpodCIDR := fmt.Sprintf(\n\t\t\"%s/%d\",\n\t\tresp.PodIpInfo.PodIPConfig.IPAddress,\n\t\tresp.PodIpInfo.NetworkContainerPrimaryIPConfig.IPSubnet.PrefixLength,\n\t)\n\tpodIPNet, err := netip.ParsePrefix(podCIDR)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"cns returned invalid pod CIDR %q\", podCIDR)\n\t}\n\n\treturn &podIPNet, nil\n}", "title": "" }, { "docid": "16a0a3ce54b151a7f25fae2392ff2e35", "score": "0.5227772", "text": "func Canonicalize(conf *operv1.NetworkSpec) {\n\tswitch strings.ToLower(string(conf.DefaultNetwork.Type)) {\n\tcase strings.ToLower(string(operv1.NetworkTypeOpenShiftSDN)):\n\t\tconf.DefaultNetwork.Type = operv1.NetworkTypeOpenShiftSDN\n\tcase strings.ToLower(string(operv1.NetworkTypeOVNKubernetes)):\n\t\tconf.DefaultNetwork.Type = operv1.NetworkTypeOVNKubernetes\n\t}\n\n\tif conf.DefaultNetwork.Type == operv1.NetworkTypeOpenShiftSDN &&\n\t\tconf.DefaultNetwork.OpenShiftSDNConfig != nil {\n\t\tsdnc := conf.DefaultNetwork.OpenShiftSDNConfig\n\t\tswitch strings.ToLower(string(sdnc.Mode)) {\n\t\tcase strings.ToLower(string(operv1.SDNModeMultitenant)):\n\t\t\tsdnc.Mode = operv1.SDNModeMultitenant\n\t\tcase strings.ToLower(string(operv1.SDNModeNetworkPolicy)):\n\t\t\tsdnc.Mode = operv1.SDNModeNetworkPolicy\n\t\tcase strings.ToLower(string(operv1.SDNModeSubnet)):\n\t\t\tsdnc.Mode = operv1.SDNModeSubnet\n\t\t}\n\t}\n\n\tfor idx, an := range conf.AdditionalNetworks {\n\t\tswitch strings.ToLower(string(an.Type)) {\n\t\tcase strings.ToLower(string(operv1.NetworkTypeRaw)):\n\t\t\tconf.AdditionalNetworks[idx].Type = operv1.NetworkTypeRaw\n\t\tcase strings.ToLower(string(operv1.NetworkTypeSimpleMacvlan)):\n\t\t\tconf.AdditionalNetworks[idx].Type = operv1.NetworkTypeSimpleMacvlan\n\t\t}\n\n\t\tif an.Type == operv1.NetworkTypeSimpleMacvlan && an.SimpleMacvlanConfig != nil {\n\t\t\tCanonicalizeSimpleMacvlanConfig(conf.AdditionalNetworks[idx].SimpleMacvlanConfig)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5254600f6248e0b23066b453113bf097", "score": "0.5227364", "text": "func handleNonCalicoCNI(c *components, install *operatorv1.Installation) error {\n\tplugin, err := getCNIPlugin(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif plugin == operatorv1.PluginCalico {\n\t\treturn nil\n\t}\n\n\tif icc := getContainer(c.node.Spec.Template.Spec, containerInstallCNI); icc != nil {\n\t\t// the install-cni container is unnecessary when not using calico cni.\n\t\t// however, it can still be present when calico-cni is not in use if another cni configuration is present with\n\t\t// an alphanumerically higher filename. as such, just log a warning.\n\t\tlog.V(1).Info(\"found unexpected install-cni container. ignoring\", \"container\", containerInstallCNI, \"plugin\", plugin)\n\t}\n\n\t// CALICO_NETWORKING_BACKEND\n\tif err := c.node.assertEnvIsSet(ctx, c.client, containerCalicoNode, \"CALICO_NETWORKING_BACKEND\", \"none\"); err != nil {\n\t\treturn err\n\t}\n\n\tif install.Spec.CNI == nil {\n\t\tinstall.Spec.CNI = &operatorv1.CNISpec{}\n\t}\n\n\tswitch plugin {\n\tcase operatorv1.PluginAmazonVPC:\n\t\tinstall.Spec.CNI.Type = plugin\n\t\t// Verify FELIX_IPTABLESMANGLEALLOWACTION is set to Return because the operator will set it to Return\n\t\t// when configured with PluginAmazonVPC. The value is also expected to be necessary for Calico policy\n\t\t// to correctly function with the AmazonVPC plugin.\n\t\tif err := c.node.assertEnvIsSet(ctx, c.client, containerCalicoNode, \"FELIX_IPTABLESMANGLEALLOWACTION\", \"return\"); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase operatorv1.PluginAzureVNET:\n\t\tinstall.Spec.CNI.Type = plugin\n\tcase operatorv1.PluginGKE:\n\t\tinstall.Spec.CNI.Type = plugin\n\t\t// Verify FELIX_IPTABLESMANGLEALLOWACTION is set to Return because the operator will set it to Return\n\t\t// when configured with PluginGKE. The value is also expected to be necessary for Calico policy\n\t\t// to correctly function with the GKE plugin.\n\t\tif err := c.node.assertEnvIsSet(ctx, c.client, containerCalicoNode, \"FELIX_IPTABLESMANGLEALLOWACTION\", \"return\"); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Verify FELIX_IPTABLESFILTERALLOWACTION is set to Return because the operator will set it to Return\n\t\t// when configured with PluginGKE. The value is also expected to be necessary for Calico policy\n\t\t// to correctly function with the GKE plugin.\n\t\tif err := c.node.assertEnvIsSet(ctx, c.client, containerCalicoNode, \"FELIX_IPTABLESFILTERALLOWACTION\", \"return\"); err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\treturn ErrIncompatibleCluster{\n\t\t\terr: fmt.Sprintf(\"unable to migrate plugin '%s': unsupported.\", plugin),\n\t\t\tcomponent: ComponentCNIConfig,\n\t\t}\n\t}\n\n\tif err := c.node.assertEnv(ctx, c.client, containerCalicoNode, \"IP\", \"\"); err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.node.assertEnv(ctx, c.client, containerCalicoNode, \"NO_DEFAULT_POOLS\", \"true\"); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "214a8da2c59ae801764c6c9cb752beab", "score": "0.52143145", "text": "func networkConfig(ni metadata.NetworkInfo) error {\n\t// rename interfaces to match what the metadata calls them\n\tlinks, err := netlink.LinkList()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to list links: %v\", err)\n\t}\n\tfor _, link := range links {\n\t\tattrs := link.Attrs()\n\t\tmac := attrs.HardwareAddr.String()\n\t\tfor _, iface := range ni.Interfaces {\n\t\t\tif iface.MAC == mac {\n\t\t\t\t// remove existing addresses from link\n\t\t\t\taddresses, err := netlink.AddrList(link, netlink.FAMILY_ALL)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Cannot list addresses on interface: %v\", err)\n\t\t\t\t}\n\t\t\t\tfor _, addr := range addresses {\n\t\t\t\t\tif err := netlink.AddrDel(link, &addr); err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"Cannot remove address from interface: %v\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// links need to be down to be bonded\n\t\t\t\tif err := netlink.LinkSetDown(link); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Cannot down link: %v\", err)\n\t\t\t\t}\n\t\t\t\t// see if we need to rename interface\n\t\t\t\tif iface.Name != attrs.Name {\n\t\t\t\t\tif err := netlink.LinkSetName(link, iface.Name); err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"Interface rename failed: %v\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// set up bonding\n\tla := netlink.LinkAttrs{Name: \"bond0\"}\n\tbond := &netlink.GenericLink{la, \"bond\"}\n\tif err := netlink.LinkAdd(bond); err != nil {\n\t\t// weirdly creating a bind always seems to return EEXIST\n\t\tfmt.Fprintf(os.Stderr, \"Error adding bond0: %v (ignoring)\", err)\n\t}\n\tif err := os.WriteFile(\"/sys/class/net/bond0/bonding/mode\", []byte(strconv.Itoa(int(ni.Bonding.Mode))), 0); err != nil {\n\t\treturn fmt.Errorf(\"Cannot write to /sys/class/net/bond0/bonding/mode: %v\", err)\n\t}\n\tif err := netlink.LinkSetUp(bond); err != nil {\n\t\treturn fmt.Errorf(\"Failed to bring bond0 up: %v\", err)\n\t}\n\tfor _, iface := range ni.Interfaces {\n\t\tlink, err := netlink.LinkByName(iface.Name)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Cannot find interface %s: %v\", iface.Name, err)\n\t\t}\n\t\tif err := netlink.LinkSetMasterByIndex(link, bond.Attrs().Index); err != nil {\n\t\t\treturn fmt.Errorf(\"Cannot join %s to bond0: %v\", iface.Name, err)\n\t\t}\n\t}\n\n\t// set up addresses and routes\n\tfor _, address := range ni.Addresses {\n\t\tcidr := \"/\" + strconv.Itoa(address.NetworkBits)\n\t\taddr, err := netlink.ParseAddr(address.Address.String() + cidr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := netlink.AddrAdd(bond, addr); err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to add address to bonded interface: %v\", err)\n\t\t}\n\t\tvar additionalNet string\n\t\tswitch {\n\t\tcase address.Public && address.Family == metadata.IPv4:\n\t\t\tadditionalNet = \"0.0.0.0/0\"\n\t\tcase address.Public && address.Family == metadata.IPv6:\n\t\t\tadditionalNet = \"::/0\"\n\t\tcase !address.Public && address.Family == metadata.IPv4:\n\t\t\t// add a gateway for eg 10.0.0.0/8\n\t\t\tmask := address.Address.DefaultMask()\n\t\t\tmasked := address.Address.Mask(mask)\n\t\t\tnetwork := &net.IPNet{IP: masked, Mask: mask}\n\t\t\tadditionalNet = network.String()\n\t\t}\n\t\tif additionalNet != \"\" {\n\t\t\t_, network, err := net.ParseCIDR(additionalNet)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\troute := netlink.Route{\n\t\t\t\tLinkIndex: bond.Attrs().Index,\n\t\t\t\tGw: address.Gateway,\n\t\t\t\tDst: network,\n\t\t\t}\n\t\t\tif err := netlink.RouteAdd(&route); err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to add route: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "11287cd86def346b0e010429d34c321e", "score": "0.5207831", "text": "func checkInspectNetwork(t *testing.T, expError bool, tenant, network, allocedIPs string, pktTag, addrCount int) {\n\tinsp, err := contivClient.NetworkInspect(tenant, network)\n\tif err != nil && !expError {\n\t\tt.Fatalf(\"Error inspecting network {%s.%s}. Err: %v\", network, tenant, err)\n\t} else if err == nil && expError {\n\t\tt.Fatalf(\"Inspect network {%s.%s} succeeded while expecting error\", network, tenant)\n\t} else if err == nil {\n\t\tif insp.Oper.AllocatedAddressesCount != addrCount || insp.Oper.PktTag != pktTag ||\n\t\t\tinsp.Oper.AllocatedIPAddresses != allocedIPs {\n\t\t\tlog.Printf(\"Inspect network {%+v}\", insp)\n\t\t\tt.Fatalf(\"addrCount exp: %d got: %d pktTag exp: %d got: %d, allocedIPs exp: %s got: %s\",\n\t\t\t\taddrCount, insp.Oper.AllocatedAddressesCount, pktTag, insp.Oper.PktTag,\n\t\t\t\tallocedIPs, insp.Oper.AllocatedIPAddresses)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3c1af57f56555feab6f0e8df875a03ab", "score": "0.5197095", "text": "func scanAIConfigs(ctx *wstunnelclientContext) {\n\n\tisTunnelRequired := false\n\tsub := ctx.subAppInstanceConfig\n\titems := sub.GetAll()\n\tfor _, c := range items {\n\t\tconfig := c.(types.AppInstanceConfig)\n\t\tlog.Tracef(\"Remote console status for app-instance: %s: %t\\n\",\n\t\t\tconfig.DisplayName, config.RemoteConsole)\n\t\tisTunnelRequired = config.RemoteConsole || isTunnelRequired\n\t}\n\tlog.Functionf(\"Tunnel check status after checking app-instance configs: %t\\n\",\n\t\tisTunnelRequired)\n\n\tif !isTunnelRequired {\n\t\tif ctx.wstunnelclient != nil {\n\t\t\tctx.wstunnelclient.Stop()\n\t\t\tctx.wstunnelclient = nil\n\t\t}\n\t\treturn\n\t}\n\tif ctx.wstunnelclient != nil {\n\t\treturn\n\t}\n\tdeviceNetworkStatus := ctx.dnsContext.deviceNetworkStatus\n\tfor _, port := range deviceNetworkStatus.Ports {\n\t\tifname := port.IfName\n\t\tif !types.IsMgmtPort(*deviceNetworkStatus, ifname) {\n\t\t\tlog.Tracef(\"Skipping connection using non-mangement intf %s\\n\",\n\t\t\t\tifname)\n\t\t\tcontinue\n\t\t}\n\t\twstunnelclient := zedcloud.InitializeTunnelClient(log, ctx.serverNameAndPort, \"localhost:4822\")\n\t\tdestURL := wstunnelclient.Tunnel\n\n\t\taddrCount, err := types.CountLocalAddrAnyNoLinkLocalIf(*deviceNetworkStatus,\n\t\t\tifname)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"CountLocalIPv4AddrAnyNoLinkLocalIf failed for %s: %v\",\n\t\t\t\tifname, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Functionf(\"Connecting to %s using intf %s #sources %d\\n\",\n\t\t\tdestURL, ifname, addrCount)\n\n\t\tif addrCount == 0 {\n\t\t\terrStr := fmt.Sprintf(\"No IP addresses to connect to %s using intf %s\",\n\t\t\t\tdestURL, ifname)\n\t\t\tlog.Functionln(errStr)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar connected bool\n\t\tfor retryCount := 0; retryCount < addrCount; retryCount++ {\n\t\t\tlocalAddr, err := types.GetLocalAddrAnyNoLinkLocal(*deviceNetworkStatus,\n\t\t\t\tretryCount, ifname)\n\t\t\tif err != nil {\n\t\t\t\tlog.Function(err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tproxyURL, _ := zedcloud.LookupProxy(log, deviceNetworkStatus,\n\t\t\t\tifname, destURL)\n\t\t\tif err := wstunnelclient.TestConnection(deviceNetworkStatus, proxyURL, localAddr, ctx.devUUID); err != nil {\n\t\t\t\tlog.Function(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconnected = true\n\t\t\tbreak\n\t\t}\n\t\tif connected == true {\n\t\t\twstunnelclient.Start()\n\t\t\tctx.wstunnelclient = wstunnelclient\n\t\t\tbreak\n\t\t}\n\t\tlog.Functionf(\"Could not connect to %s using intf %s\\n\", destURL, ifname)\n\t}\n}", "title": "" }, { "docid": "efb8abe5e2cf3d0e8fc1c56c4f54612c", "score": "0.51962626", "text": "func RecoverContainerSideNetwork(csn *network.ContainerSideNetwork, nsPath string, allLinks []netlink.Link, hostNS ns.NetNS) error {\n\tif len(csn.Result.Interfaces) == 0 {\n\t\treturn fmt.Errorf(\"wrong cni configuration: no interfaces defined: %s\", spew.Sdump(csn.Result))\n\t}\n\n\tcontLinks, err := getContainerLinks(csn.Result)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toldDescs := map[string]*network.InterfaceDescription{}\n\tfor _, desc := range csn.Interfaces {\n\t\toldDescs[desc.Name] = desc\n\t}\n\n\tfor _, link := range contLinks {\n\t\t// Skip missing link which is already used by running VM\n\t\tif link == nil {\n\t\t\tcontinue\n\t\t}\n\t\tifaceName := link.Attrs().Name\n\t\tdesc, found := oldDescs[ifaceName]\n\t\tif !found {\n\t\t\tglog.Warningf(\"Recovering container side network: missing description for interface %q\", ifaceName)\n\t\t}\n\t\tdelete(oldDescs, ifaceName)\n\t\tvar ifaceType network.InterfaceType\n\n\t\tif isSriovVf(link) {\n\t\t\tifaceType = network.InterfaceTypeVF\n\n\t\t\t// device should be already unbound, but after machine reboot that can be necessary\n\t\t\tunbindDriverFromDevice(desc.PCIAddress)\n\n\t\t\tdevIdentifier, err := getDeviceIdentifier(desc.PCIAddress)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// this can be problematic in case of machine reboot - we are trying to use the same\n\t\t\t// devices as was used before reboot, but in meantime there is small chance that they\n\t\t\t// were used already by sriov cni plugin (for which reboot means it's starting everything\n\t\t\t// from clean situation) for some other pods, before even virtlet was started\n\t\t\t// also in case of virtlet pod restart - device can be already bound to vfio-pci, so we\n\t\t\t// are ignoring any error there)\n\t\t\tbindDeviceToVFIO(devIdentifier)\n\t\t} else {\n\t\t\tifaceType = network.InterfaceTypeTap\n\t\t\t// It's OK if OpenTAP failed as the device is busy and used by running VM\n\t\t\tif fo, err := OpenTAP(link.Attrs().Name); err == nil {\n\t\t\t\tdesc.Fo = fo\n\t\t\t}\n\t\t}\n\t\tif desc.Type != ifaceType {\n\t\t\treturn fmt.Errorf(\"bad interface type for %q\", desc.Name)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1ea72c1f3d2cb311071f57a923e20e1c", "score": "0.5177632", "text": "func parseConfig(stdin []byte) (*PluginConf, error) {\n\tconf := PluginConf{}\n\n\tif err := json.Unmarshal(stdin, &conf); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse network configuration: %v\", err)\n\t}\n\n\t// Parse previous result.\n\tif conf.RawPrevResult != nil {\n\t\tresultBytes, err := json.Marshal(conf.RawPrevResult)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not serialize prevResult: %v\", err)\n\t\t}\n\t\tres, err := version.NewResult(conf.CNIVersion, resultBytes)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not parse prevResult: %v\", err)\n\t\t}\n\t\tconf.RawPrevResult = nil\n\t\tconf.PrevResult, err = current.NewResultFromResult(res)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not convert result to current version: %v\", err)\n\t\t}\n\t}\n\t// End previous result parsing\n\n\tif conf.HostInterface == \"\" {\n\t\treturn nil, fmt.Errorf(\"hostInterface must be specified\")\n\t}\n\n\tif conf.ContainerInterface == \"\" {\n\t\treturn nil, fmt.Errorf(\"containerInterface must be specified\")\n\t}\n\n\treturn &conf, nil\n}", "title": "" }, { "docid": "f20cfc36530da5984becc0f852752d8f", "score": "0.51627135", "text": "func (m *ClusterNetworkingConfig) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateIpvs(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePods(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateServices(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": "42a2791cd587c71772c1dd0736cc570c", "score": "0.5162549", "text": "func cmdAdd(args *skel.CmdArgs) error {\n\tconf, err := parseConfig(args.StdinData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif conf.PrevResult == nil {\n\t\treturn fmt.Errorf(\"must be called as chained plugin\")\n\t}\n\n\t// This is some sample code to generate the list of container-side IPs.\n\t// We're casting the prevResult to a 0.3.0 response, which can also include\n\t// host-side IPs (but doesn't when converted from a 0.2.0 response).\n\tcontainerIPs := make([]net.IP, 0, len(conf.PrevResult.IPs))\n\tif conf.CNIVersion != \"0.3.0\" {\n\t\tfor _, ip := range conf.PrevResult.IPs {\n\t\t\tcontainerIPs = append(containerIPs, ip.Address.IP)\n\t\t}\n\t} else {\n\t\tfor _, ip := range conf.PrevResult.IPs {\n\t\t\tif ip.Interface == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tintIdx := *ip.Interface\n\t\t\t// Every IP is indexed in to the interfaces array, with \"-1\" standing\n\t\t\t// for an unknown interface (which we'll assume to be Container-side\n\t\t\t// Skip all IPs we know belong to an interface with the wrong name.\n\t\t\tif intIdx >= 0 && intIdx < len(conf.PrevResult.Interfaces) && conf.PrevResult.Interfaces[intIdx].Name != args.IfName {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcontainerIPs = append(containerIPs, ip.Address.IP)\n\t\t}\n\t}\n\tif len(containerIPs) == 0 {\n\t\treturn fmt.Errorf(\"got no container IPs\")\n\t}\n\n\tiface, err := netlink.LinkByName(conf.HostInterface)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to lookup %q: %v\", conf.HostInterface, err)\n\t}\n\n\thostAddrs, err := netlink.AddrList(iface, netlink.FAMILY_ALL)\n\tif err != nil || len(hostAddrs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get host IP addresses for %q: %v\", iface, err)\n\t}\n\n\tnetns, err := ns.GetNS(args.Netns)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to open netns %q: %v\", args.Netns, err)\n\t}\n\tdefer netns.Close()\n\n\thostInterface, _, err := setupContainerVeth(netns, conf.ContainerInterface, conf.MTU, hostAddrs, conf.PrevResult)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = setupHostVeth(hostInterface.Name, hostAddrs, conf.PrevResult); err != nil {\n\t\treturn err\n\t}\n\n\tif conf.IPMasq {\n\t\tipv4 := false\n\t\tipv6 := false\n\t\t// only enable forwarding if masq is enabled\n\t\tfor _, ipc := range containerIPs {\n\t\t\tif ipc.To4() != nil {\n\t\t\t\tipv4 = true\n\t\t\t} else {\n\t\t\t\tipv6 = true\n\t\t\t}\n\t\t}\n\t\tif ipv4 {\n\t\t\terr := ip.EnableIP4Forward()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Could not enable IPv6 forwarding: %v\", err)\n\t\t\t}\n\t\t}\n\t\tif ipv6 {\n\t\t\terr := ip.EnableIP6Forward()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Could not enable IPv6 forwarding: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\tchain := utils.FormatChainName(conf.Name, args.ContainerID)\n\t\tcomment := utils.FormatComment(conf.Name, args.ContainerID)\n\t\tfor _, ipc := range containerIPs {\n\t\t\taddrBits := 128\n\t\t\tif ipc.To4() != nil {\n\t\t\t\taddrBits = 32\n\t\t\t}\n\n\t\t\tif err = ip.SetupIPMasq(&net.IPNet{IP: ipc, Mask: net.CIDRMask(addrBits, addrBits)}, chain, comment); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Pass through the result for the next plugin\n\treturn types.PrintResult(conf.PrevResult, conf.CNIVersion)\n}", "title": "" }, { "docid": "dc64fa331c763b2eeb3292699e44ea37", "score": "0.5161257", "text": "func validateIPs(openStackCluster *infrav1.OpenStackCluster, definedCIDRs []string) []string {\n\tmarshaledCIDRs := []string{}\n\n\tfor _, v := range definedCIDRs {\n\t\tswitch {\n\t\tcase net.IsIPv4String(v):\n\t\t\tmarshaledCIDRs = append(marshaledCIDRs, v+\"/32\")\n\t\tcase net.IsIPv4CIDRString(v):\n\t\t\tmarshaledCIDRs = append(marshaledCIDRs, v)\n\t\tdefault:\n\t\t\trecord.Warnf(openStackCluster, \"FailedIPAddressValidation\", \"%s is not a valid IPv4 nor CIDR address and will not get applied to allowed_cidrs\", v)\n\t\t}\n\t}\n\n\treturn marshaledCIDRs\n}", "title": "" }, { "docid": "b6af106d51a2d0627f8a964360a8e7f5", "score": "0.5144721", "text": "func (t *CustomValidation) ValidateIpv4UnnumIntf(vc *CustValidationCtxt) CVLErrorInfo {\n\n\tif (vc.CurCfg.VOp == OP_DELETE) {\n\t\t return CVLErrorInfo{ErrCode: CVL_SUCCESS}\n\t}\n\n\tif (vc.YNodeVal == \"\") {\n\t\treturn CVLErrorInfo{ErrCode: CVL_SUCCESS} //Allow empty value\n\t}\n\n\ttableKeys, err:= vc.RClient.Keys(\"LOOPBACK_INTERFACE|*\").Result()\n\n\tif (err != nil) {\n\t\tutil.TRACE_LEVEL_LOG(util.TRACE_SEMANTIC, \"LOOPBACK_INTERFACE is empty or invalid argument\")\n\t\treturn CVLErrorInfo{ErrCode: CVL_SUCCESS}\n\t}\n\n\tcount := 0\n\tfor _, dbKey := range tableKeys {\n\t\tif (strings.Contains(dbKey, \".\")) {\n\t\t\tcount++\n\t\t}\n\t}\n\n\tif (count > 1) {\n\t\tutil.TRACE_LEVEL_LOG(util.TRACE_SEMANTIC, \"Donor interface has multiple IPv4 address\")\n\t\treturn CVLErrorInfo{\n\t\t\tErrCode: CVL_SEMANTIC_ERROR,\n\t\t\tTableName: \"LOOPBACK_INTERFACE\",\n\t\t\tKeys: strings.Split(vc.CurCfg.Key, \"|\"),\n\t\t\tConstraintErrMsg: fmt.Sprintf(\"Multiple IPv4 address configured on Donor interface. Cannot configure IP Unnumbered\"),\n\t\t\tCVLErrDetails: \"Config Validation Error\",\n\t\t\tErrAppTag: \"donor-multi-ipv4-addr\",\n\t\t}\n\t}\n\n\treturn CVLErrorInfo{ErrCode: CVL_SUCCESS}\n}", "title": "" }, { "docid": "593da736688c15350ebea11861b81f65", "score": "0.5140791", "text": "func (subnet HTTPProxyCIDRCheck) Check() (warnings, errorList []error) {\n\tklog.V(1).Infoln(\"validating http connectivity to first IP address in the CIDR\")\n\tif len(subnet.CIDR) == 0 {\n\t\treturn nil, nil\n\t}\n\n\t_, cidr, err := netutils.ParseCIDRSloppy(subnet.CIDR)\n\tif err != nil {\n\t\treturn nil, []error{errors.Wrapf(err, \"error parsing CIDR %q\", subnet.CIDR)}\n\t}\n\n\ttestIP, err := netutils.GetIndexedIP(cidr, 1)\n\tif err != nil {\n\t\treturn nil, []error{errors.Wrapf(err, \"unable to get first IP address from the given CIDR (%s)\", cidr.String())}\n\t}\n\n\ttestIPstring := testIP.String()\n\tif len(testIP) == net.IPv6len {\n\t\ttestIPstring = fmt.Sprintf(\"[%s]:1234\", testIP)\n\t}\n\turl := fmt.Sprintf(\"%s://%s/\", subnet.Proto, testIPstring)\n\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, []error{err}\n\t}\n\n\t// Utilize same transport defaults as it will be used by API server\n\tproxy, err := netutil.SetOldTransportDefaults(&http.Transport{}).Proxy(req)\n\tif err != nil {\n\t\treturn nil, []error{err}\n\t}\n\tif proxy != nil {\n\t\treturn []error{errors.Errorf(\"connection to %q uses proxy %q. This may lead to malfunctional cluster setup. Make sure that Pod and Services IP ranges specified correctly as exceptions in proxy configuration\", subnet.CIDR, proxy)}, nil\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "b289f2bf30e34aa0fb7ab84c609534ea", "score": "0.5130292", "text": "func TestProcessNeighborRes(t *testing.T) {\n\n\t//Build some ip addresses\n\tpayload := []byte{\n\t\t127, 0, 0, 1, 31, 64,\n\t\t23, 24, 122, 66, 31, 69,\n\t\t0, 0, 0, 0, 0, 0,\n\t\t255, 255, 255, 255, 156, 64,\n\t}\n\n\tipportList := _processNeighborRes(payload)\n\n\tif ipportList[0] != \"127.0.0.1:8000\" {\n\t\tt.Errorf(\"Parsing IP address failed: %v\\n\", ipportList[0])\n\t}\n\tif ipportList[1] != \"23.24.122.66:8005\" {\n\t\tt.Errorf(\"Parsing IP address failed: %v\\n\", ipportList[1])\n\t}\n\tif ipportList[2] != \"0.0.0.0:0\" {\n\t\tt.Errorf(\"Parsing IP address failed: %v\\n\", ipportList[2])\n\t}\n\tif ipportList[3] != \"255.255.255.255:40000\" {\n\t\tt.Errorf(\"Parsing IP address failed: %v\\n\", ipportList[3])\n\t}\n}", "title": "" }, { "docid": "455be861e011a1278d0fc1ff98d97e6d", "score": "0.5108823", "text": "func (o *HyperflexHxapDvUplinkAllOf) GetNetInterfacesOk() (*[]string, bool) {\n\tif o == nil || o.NetInterfaces == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.NetInterfaces, true\n}", "title": "" }, { "docid": "43eac27d984de3789177f6f46b97fa97", "score": "0.50941795", "text": "func TestVerifyNetworkingConfig(t *testing.T) {\n\tname := \"mynet\"\n\tendpoints := make(map[string]*network.EndpointSettings, 1)\n\tendpoints[name] = nil\n\tnwConfig := &network.NetworkingConfig{\n\t\tEndpointsConfig: endpoints,\n\t}\n\terr := verifyNetworkingConfig(nwConfig)\n\tassert.Check(t, is.Error(err, \"no EndpointSettings for mynet\"), \"should produce an error because no EndpointSettings were passed\")\n}", "title": "" }, { "docid": "7e95ec4adc7a6c9076f9761217708bfc", "score": "0.5092687", "text": "func GetNacosConfig(url *common.URL) ([]nacosConstant.ServerConfig, nacosConstant.ClientConfig, error) {\n\tif url == nil {\n\t\treturn []nacosConstant.ServerConfig{}, nacosConstant.ClientConfig{}, perrors.New(\"url is empty!\")\n\t}\n\n\tif len(url.Location) == 0 {\n\t\treturn []nacosConstant.ServerConfig{}, nacosConstant.ClientConfig{},\n\t\t\tperrors.New(\"url.location is empty!\")\n\t}\n\n\taddresses := strings.Split(url.Location, \",\")\n\tserverConfigs := make([]nacosConstant.ServerConfig, 0, len(addresses))\n\tfor _, addr := range addresses {\n\t\tip, portStr, err := net.SplitHostPort(addr)\n\t\tif err != nil {\n\t\t\treturn []nacosConstant.ServerConfig{}, nacosConstant.ClientConfig{},\n\t\t\t\tperrors.WithMessagef(err, \"split [%s] \", addr)\n\t\t}\n\t\tport, _ := strconv.Atoi(portStr)\n\t\tserverConfigs = append(serverConfigs, nacosConstant.ServerConfig{IpAddr: ip, Port: uint64(port)})\n\t}\n\n\ttimeout := url.GetParamDuration(constant.CONFIG_TIMEOUT_KEY, constant.DEFAULT_REG_TIMEOUT)\n\n\tclientConfig := nacosConstant.ClientConfig{\n\t\tTimeoutMs: uint64(int32(timeout / time.Millisecond)),\n\t\tBeatInterval: url.GetParamInt(constant.NACOS_BEAT_INTERVAL_KEY, 5000),\n\t\tNamespaceId: url.GetParam(constant.NACOS_NAMESPACE_ID, \"\"),\n\t\tAppName: url.GetParam(constant.NACOS_APP_NAME_KEY, \"\"),\n\t\tEndpoint: url.GetParam(constant.NACOS_ENDPOINT, \"\"),\n\t\tRegionId: url.GetParam(constant.NACOS_REGION_ID_KEY, \"\"),\n\t\tAccessKey: url.GetParam(constant.NACOS_ACCESS_KEY, \"\"),\n\t\tSecretKey: url.GetParam(constant.NACOS_SECRET_KEY, \"\"),\n\t\tOpenKMS: url.GetParamBool(constant.NACOS_OPEN_KMS_KEY, false),\n\t\tCacheDir: url.GetParam(constant.NACOS_CACHE_DIR_KEY, \"\"),\n\t\tUpdateThreadNum: url.GetParamByIntValue(constant.NACOS_UPDATE_THREAD_NUM_KEY, 20),\n\t\tNotLoadCacheAtStart: url.GetParamBool(constant.NACOS_NOT_LOAD_LOCAL_CACHE, true),\n\t\tUsername: url.GetParam(constant.NACOS_USERNAME, \"\"),\n\t\tPassword: url.GetParam(constant.NACOS_PASSWORD, \"\"),\n\t\tLogDir: url.GetParam(constant.NACOS_LOG_DIR_KEY, \"\"),\n\t\tLogLevel: url.GetParam(constant.NACOS_LOG_LEVEL_KEY, \"info\"),\n\t}\n\treturn serverConfigs, clientConfig, nil\n}", "title": "" }, { "docid": "a7f2a63aac4c9e1d7ae1fcbbf0376c0f", "score": "0.50849473", "text": "func (e *podEnv) netPluginAdd(n *activeNet, netns string) error {\n\toutput, err := e.execNetPlugin(\"ADD\", n, netns)\n\tif err != nil {\n\t\treturn pluginErr(err, output)\n\t}\n\n\tpr := cnitypes.Result{}\n\tif err = json.Unmarshal(output, &pr); err != nil {\n\t\terr = errwrap.Wrap(fmt.Errorf(\"parsing %q\", string(output)), err)\n\t\treturn errwrap.Wrap(fmt.Errorf(\"error parsing %q result\", n.conf.Name), err)\n\t}\n\n\tif pr.IP4 == nil {\n\t\treturn nil // TODO(casey) should this be an error?\n\t}\n\n\t// All is well - mutate the runtime\n\tn.runtime.MergeCNIResult(pr)\n\treturn nil\n}", "title": "" }, { "docid": "3e22ad319d7ebce177ad36ec7a2203e3", "score": "0.5083184", "text": "func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, error) {\n\tif c.config.NetNsCtr != \"\" {\n\t\tnetNsCtr, err := c.runtime.GetContainer(c.config.NetNsCtr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// see https://github.com/containers/podman/issues/10090\n\t\t// the container has to be locked for syncContainer()\n\t\tnetNsCtr.lock.Lock()\n\t\tdefer netNsCtr.lock.Unlock()\n\t\t// Have to sync to ensure that state is populated\n\t\tif err := netNsCtr.syncContainer(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlogrus.Debugf(\"Container %s shares network namespace, retrieving network info of container %s\", c.ID(), c.config.NetNsCtr)\n\n\t\treturn netNsCtr.getContainerNetworkInfo()\n\t}\n\n\tsettings := new(define.InspectNetworkSettings)\n\tsettings.Ports = makeInspectPortBindings(c.config.PortMappings, c.config.ExposedPorts)\n\n\tnetworks, isDefault, err := c.networks()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// We can't do more if the network is down.\n\tif c.state.NetNS == nil {\n\t\t// We still want to make dummy configurations for each CNI net\n\t\t// the container joined.\n\t\tif len(networks) > 0 {\n\t\t\tsettings.Networks = make(map[string]*define.InspectAdditionalNetwork, len(networks))\n\t\t\tfor _, net := range networks {\n\t\t\t\tcniNet := new(define.InspectAdditionalNetwork)\n\t\t\t\tcniNet.NetworkID = net\n\t\t\t\tsettings.Networks[net] = cniNet\n\t\t\t}\n\t\t}\n\n\t\treturn settings, nil\n\t}\n\n\t// Set network namespace path\n\tsettings.SandboxKey = c.state.NetNS.Path()\n\n\t// If this is empty, we're probably slirp4netns\n\tif len(c.state.NetworkStatus) == 0 {\n\t\treturn settings, nil\n\t}\n\n\t// If we have CNI networks - handle that here\n\tif len(networks) > 0 {\n\t\tif len(networks) != len(c.state.NetworkStatus) {\n\t\t\treturn nil, errors.Wrapf(define.ErrInternal, \"network inspection mismatch: asked to join %d CNI network(s) %v, but have information on %d network(s)\", len(networks), networks, len(c.state.NetworkStatus))\n\t\t}\n\n\t\tsettings.Networks = make(map[string]*define.InspectAdditionalNetwork)\n\n\t\t// CNI results should be in the same order as the list of\n\t\t// networks we pass into CNI.\n\t\tfor index, name := range networks {\n\t\t\tcniResult := c.state.NetworkStatus[index]\n\t\t\taddedNet := new(define.InspectAdditionalNetwork)\n\t\t\taddedNet.NetworkID = name\n\n\t\t\tbasicConfig, err := resultToBasicNetworkConfig(cniResult)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\taliases, err := c.runtime.state.GetNetworkAliases(c, name)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\taddedNet.Aliases = aliases\n\n\t\t\taddedNet.InspectBasicNetworkConfig = basicConfig\n\n\t\t\tsettings.Networks[name] = addedNet\n\t\t}\n\n\t\tif !isDefault {\n\t\t\treturn settings, nil\n\t\t}\n\t}\n\n\t// If not joining networks, we should have at most 1 result\n\tif len(c.state.NetworkStatus) > 1 {\n\t\treturn nil, errors.Wrapf(define.ErrInternal, \"should have at most 1 CNI result if not joining networks, instead got %d\", len(c.state.NetworkStatus))\n\t}\n\n\tif len(c.state.NetworkStatus) == 1 {\n\t\tbasicConfig, err := resultToBasicNetworkConfig(c.state.NetworkStatus[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tsettings.InspectBasicNetworkConfig = basicConfig\n\t}\n\n\treturn settings, nil\n}", "title": "" }, { "docid": "fdda000fbbf07284bba37c0ea3d99a93", "score": "0.50814146", "text": "func Validate(conf *operv1.NetworkSpec) error {\n\terrs := []error{}\n\n\terrs = append(errs, ValidateIPPools(conf)...)\n\terrs = append(errs, ValidateDefaultNetwork(conf)...)\n\terrs = append(errs, ValidateMultus(conf)...)\n\terrs = append(errs, ValidateStandaloneKubeProxy(conf)...)\n\n\tif len(errs) > 0 {\n\t\treturn errors.Errorf(\"invalid configuration: %v\", errs)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9854c51d292f86ab0539f4de55e31a63", "score": "0.5071978", "text": "func (config *Config) UpdateInterfacesConfigs(selectinterface string) error {\n\t//var tlsConfig *tls.Config\n\tif config.IfConfigs == nil {\n\t\tconfig.IfConfigs = make(map[string]interfaceconfig, 2)\n\t}\n\tfor _, v := range config.BindAddress {\n\t\tif selectinterface != \"\" && selectinterface != v {\n\t\t\tcontinue // update only a selected interface\n\t\t}\n\t\tipS1 := strings.Split(v, \":\")[0]\n\t\tif !existPemFiles(config.Configdir, ipS1) {\n\n\t\t\t// allow go routine to exit\n\t\t\treturn os.ErrNotExist\n\t\t}\n\t\tcertFile := filepath.Join(config.Configdir, ipS1+\".pem\")\n\t\tkeyFile := filepath.Join(config.Configdir, ipS1+\"-key.pem\")\n\t\tconfig.IfConfigs[v] = interfaceconfig{\n\t\t\tListenon: v,\n\t\t\tCertFile: certFile,\n\t\t\tKeyFile: keyFile,\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1741dae69bb0c864a53880edc1107fd6", "score": "0.5064803", "text": "func (n *ovn) ovnNetworkExternalSubnets(ovnProjectNetworksWithOurUplink map[string][]*api.Network) ([]externalSubnetUsage, error) {\n\texternalSubnets := make([]externalSubnetUsage, 0)\n\tfor netProject, networks := range ovnProjectNetworksWithOurUplink {\n\t\tfor _, netInfo := range networks {\n\t\t\tfor _, keyPrefix := range []string{\"ipv4\", \"ipv6\"} {\n\t\t\t\t// If NAT is disabled, then network subnet is an external subnet.\n\t\t\t\tif shared.IsFalseOrEmpty(netInfo.Config[fmt.Sprintf(\"%s.nat\", keyPrefix)]) {\n\t\t\t\t\tkey := fmt.Sprintf(\"%s.address\", keyPrefix)\n\n\t\t\t\t\t_, ipNet, err := net.ParseCIDR(netInfo.Config[key])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tcontinue // Skip invalid/unspecified network addresses.\n\t\t\t\t\t}\n\n\t\t\t\t\texternalSubnets = append(externalSubnets, externalSubnetUsage{\n\t\t\t\t\t\tsubnet: *ipNet,\n\t\t\t\t\t\tnetworkProject: netProject,\n\t\t\t\t\t\tnetworkName: netInfo.Name,\n\t\t\t\t\t\tusageType: subnetUsageNetwork,\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\t// Find any external subnets used for network SNAT.\n\t\t\t\tif netInfo.Config[fmt.Sprintf(\"%s.nat.address\", keyPrefix)] != \"\" {\n\t\t\t\t\tkey := fmt.Sprintf(\"%s.nat.address\", keyPrefix)\n\n\t\t\t\t\tsubnetSize := 128\n\t\t\t\t\tif keyPrefix == \"ipv4\" {\n\t\t\t\t\t\tsubnetSize = 32\n\t\t\t\t\t}\n\n\t\t\t\t\t_, ipNet, err := net.ParseCIDR(fmt.Sprintf(\"%s/%d\", netInfo.Config[key], subnetSize))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"Failed parsing %q of %q in project %q: %w\", key, netInfo.Name, netProject, err)\n\t\t\t\t\t}\n\n\t\t\t\t\texternalSubnets = append(externalSubnets, externalSubnetUsage{\n\t\t\t\t\t\tsubnet: *ipNet,\n\t\t\t\t\t\tnetworkProject: netProject,\n\t\t\t\t\t\tnetworkName: netInfo.Name,\n\t\t\t\t\t\tusageType: subnetUsageNetworkSNAT,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn externalSubnets, nil\n}", "title": "" }, { "docid": "8f219548fafcc799d2173130c5edd0e1", "score": "0.50637156", "text": "func (s *CIDRLabelsSuite) TestGetCIDRLabelsInCluster(c *C) {\n\toption.Config.EnableIPv6 = false\n\tprefix := netip.MustParsePrefix(\"10.0.0.0/16\")\n\texpected := labels.ParseLabelArray(\n\t\t\"cidr:0.0.0.0/0\",\n\t\t\"cidr:10.0.0.0/16\",\n\t\t\"reserved:world\",\n\t)\n\tlbls := GetCIDRLabels(prefix)\n\tlblArray := lbls.LabelArray()\n\tc.Assert(lblArray.Lacks(expected), checker.DeepEquals, labels.LabelArray{})\n\n\toption.Config.EnableIPv6 = true\n\toption.Config.EnableIPv4 = false\n\t// This case is firmly within the cluster range\n\tprefix = netip.MustParsePrefix(\"2001:db8:cafe::cab:4:b0b:0/112\")\n\texpected = labels.ParseLabelArray(\n\t\t\"cidr:0--0/0\",\n\t\t\"cidr:2001-db8-cafe--0/64\",\n\t\t\"cidr:2001-db8-cafe-0-cab-4--0/96\",\n\t\t\"cidr:2001-db8-cafe-0-cab-4-b0b-0/112\",\n\t\t\"reserved:world\",\n\t)\n\tlbls = GetCIDRLabels(prefix)\n\tlblArray = lbls.LabelArray()\n\tc.Assert(lblArray.Lacks(expected), checker.DeepEquals, labels.LabelArray{})\n\toption.Config.EnableIPv4 = true\n}", "title": "" }, { "docid": "8aeba1d8772863fd518e440a733936c5", "score": "0.5061863", "text": "func ValidateInfrastructureConfig(infra *apisazure.InfrastructureConfig, nodesCIDR, podsCIDR, servicesCIDR *string, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\n\tvar (\n\t\tnodes cidrvalidation.CIDR\n\t\tpods cidrvalidation.CIDR\n\t\tservices cidrvalidation.CIDR\n\t)\n\n\tif nodesCIDR != nil {\n\t\tnodes = cidrvalidation.NewCIDR(*nodesCIDR, nil)\n\t}\n\tif podsCIDR != nil {\n\t\tpods = cidrvalidation.NewCIDR(*podsCIDR, nil)\n\t}\n\tif servicesCIDR != nil {\n\t\tservices = cidrvalidation.NewCIDR(*servicesCIDR, nil)\n\t}\n\n\t// Currently, we will not allow deployments into existing resource groups or VNets although this functionality\n\t// is already implemented, because the Azure cloud provider is not cleaning up self-created resources properly.\n\t// This resources would be orphaned when the cluster will be deleted. We block these cases thereby that the Azure shoot\n\t// validation here will fail for those cases.\n\t// TODO: remove the following block and uncomment below blocks once deployment into existing resource groups works properly.\n\tif infra.ResourceGroup != nil {\n\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"resourceGroup\"), infra.ResourceGroup, \"specifying an existing resource group is not supported yet\"))\n\t}\n\n\tnetworksPath := fldPath.Child(\"networks\")\n\n\t// Validate workers subnet cidr\n\tworkerCIDR := cidrvalidation.NewCIDR(infra.Networks.Workers, networksPath.Child(\"workers\"))\n\tallErrs = append(allErrs, cidrvalidation.ValidateCIDRParse(workerCIDR)...)\n\tallErrs = append(allErrs, cidrvalidation.ValidateCIDRIsCanonical(networksPath.Child(\"workers\"), infra.Networks.Workers)...)\n\n\t// Validate vnet config\n\tallErrs = append(allErrs, validateVnetConfig(infra.Networks.VNet, infra.ResourceGroup, workerCIDR, nodes, pods, services, networksPath.Child(\"vnet\"))...)\n\n\t// TODO(dkistner) Remove once we proceed with multiple AvailabilitySet support.\n\t// Currently we will not offer Nat Gateway for non zoned/AvailabilitySet based\n\t// clusters as the NatGateway is not compatible with Basic LoadBalancer and\n\t// we would need Standard LoadBalancers also in combination with AvailabilitySets.\n\t// For the multiple AvailabilitySet approach we would always need\n\t// a Standard LoadBalancer and a NatGateway.\n\tif !infra.Zoned && infra.Networks.NatGateway != nil {\n\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"networks\", \"natGateway\"), infra.Networks.NatGateway, \"NatGateway is currently only supported for zoned cluster\"))\n\t}\n\n\tif infra.Networks.NatGateway != nil &&\n\t\tinfra.Networks.NatGateway.IdleConnectionTimeoutMinutes != nil &&\n\t\t(*infra.Networks.NatGateway.IdleConnectionTimeoutMinutes < natGatewayMinTimeoutInMinutes || *infra.Networks.NatGateway.IdleConnectionTimeoutMinutes > natGatewayMaxTimeoutInMinutes) {\n\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"networks\", \"natGateway\", \"idleConnectionTimeoutMinutes\"), *infra.Networks.NatGateway.IdleConnectionTimeoutMinutes, \"idleConnectionTimeoutMinutes values must range between 4 and 120\"))\n\t}\n\n\tif infra.Identity != nil && (infra.Identity.Name == \"\" || infra.Identity.ResourceGroup == \"\") {\n\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"identity\"), infra.Identity, \"specifying an identity requires the name of the identity and the resource group which hosts the identity\"))\n\t}\n\n\tif nodes != nil {\n\t\tallErrs = append(allErrs, nodes.ValidateSubset(workerCIDR)...)\n\t}\n\n\treturn allErrs\n}", "title": "" }, { "docid": "6abd81f6769899e1d60c5a9c66c83fd1", "score": "0.506027", "text": "func checkNetwork(log logging.Logger, reqClass uint32, numPmem int, hfs *HostFabricSet) ([]*HostFabricInterface, error) {\n\tswitch reqClass {\n\tcase NetDevAny, nd.Ether, nd.Infiniband:\n\tdefault:\n\t\treturn nil, errors.Errorf(errUnsupNetDevClass, nd.DevClassName(reqClass))\n\t}\n\n\tfabric := hfs.HostFabric\n\thostSet := hfs.HostSet\n\n\tif numPmem == 0 {\n\t\t// the number of network interfaces and pmem namespaces should\n\t\t// be equal to the number of NUMA nodes for optimal\n\t\tif hfs.HostFabric.NumaCount == 0 {\n\t\t\treturn nil, errors.Errorf(errNoNuma, hostSet)\n\t\t}\n\t\tnumPmem = int(fabric.NumaCount)\n\t\tlog.Debugf(\"minimum pmem/hfi devices required set to numa count %d\", numPmem)\n\t}\n\n\tmsg := fmt.Sprintf(\n\t\t\"Network hardware consistent on hosts %s (%d NUMA nodes and %d cores per node):\",\n\t\thostSet.String(), fabric.NumaCount, fabric.CoresPerNuma)\n\tfor _, iface := range fabric.Interfaces {\n\t\tmsg = fmt.Sprintf(\"%s\\n\\t%+v\", msg, iface)\n\t}\n\tlog.Debugf(msg)\n\n\tmatchIfaces, complete := parseInterfaces(log, reqClass, numPmem, fabric.Interfaces)\n\tif !complete {\n\t\tclass := \"best-available\"\n\t\tif reqClass != NetDevAny {\n\t\t\tclass = nd.DevClassName(reqClass)\n\t\t}\n\t\treturn nil, errors.Errorf(errInsufNumIfaces, class, numPmem, len(matchIfaces),\n\t\t\tmatchIfaces)\n\t}\n\n\tlog.Debugf(\"selected network interfaces: %v\", matchIfaces)\n\n\treturn matchIfaces, nil\n}", "title": "" }, { "docid": "37dc04185c13bf7a0012daf88ec87fe1", "score": "0.5058511", "text": "func (d *nicIPVLAN) validateEnvironment() error {\n\tif d.inst.Type() == instancetype.Container && d.config[\"name\"] == \"\" {\n\t\treturn fmt.Errorf(\"Requires name property to start\")\n\t}\n\n\textensions := d.state.OS.LXCFeatures\n\tif !extensions[\"network_ipvlan\"] || !extensions[\"network_l2proxy\"] || !extensions[\"network_gateway_device_route\"] {\n\t\treturn fmt.Errorf(\"Requires liblxc has following API extensions: network_ipvlan, network_l2proxy, network_gateway_device_route\")\n\t}\n\n\tif !network.InterfaceExists(d.config[\"parent\"]) {\n\t\treturn fmt.Errorf(\"Parent device '%s' doesn't exist\", d.config[\"parent\"])\n\t}\n\n\tif d.config[\"parent\"] == \"\" && d.config[\"vlan\"] != \"\" {\n\t\treturn fmt.Errorf(\"The vlan setting can only be used when combined with a parent interface\")\n\t}\n\n\t// Only check sysctls for l2proxy if mode is l3s.\n\tif d.mode() != ipvlanModeL3S {\n\t\treturn nil\n\t}\n\n\t// Generate effective parent name, including the VLAN part if option used.\n\teffectiveParentName := network.GetHostDevice(d.config[\"parent\"], d.config[\"vlan\"])\n\n\t// If the effective parent doesn't exist and the vlan option is specified, it means we are going to create\n\t// the VLAN parent at start, and we will configure the needed sysctls so don't need to check them yet.\n\tif d.config[\"vlan\"] != \"\" && !network.InterfaceExists(effectiveParentName) {\n\t\treturn nil\n\t}\n\n\tif d.config[\"ipv4.address\"] != \"\" {\n\t\t// Check necessary sysctls are configured for use with l2proxy parent in IPVLAN l3s mode.\n\t\tipv4FwdPath := fmt.Sprintf(\"net/ipv4/conf/%s/forwarding\", effectiveParentName)\n\t\tsysctlVal, err := util.SysctlGet(ipv4FwdPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error reading net sysctl %s: %w\", ipv4FwdPath, err)\n\t\t}\n\n\t\tif sysctlVal != \"1\\n\" {\n\t\t\t// Replace . in parent name with / for sysctl formatting.\n\t\t\treturn fmt.Errorf(\"IPVLAN in L3S mode requires sysctl net.ipv4.conf.%s.forwarding=1\", strings.Replace(effectiveParentName, \".\", \"/\", -1))\n\t\t}\n\t}\n\n\tif d.config[\"ipv6.address\"] != \"\" {\n\t\t// Check necessary sysctls are configured for use with l2proxy parent in IPVLAN l3s mode.\n\t\tipv6FwdPath := fmt.Sprintf(\"net/ipv6/conf/%s/forwarding\", effectiveParentName)\n\t\tsysctlVal, err := util.SysctlGet(ipv6FwdPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error reading net sysctl %s: %w\", ipv6FwdPath, err)\n\t\t}\n\n\t\tif sysctlVal != \"1\\n\" {\n\t\t\t// Replace . in parent name with / for sysctl formatting.\n\t\t\treturn fmt.Errorf(\"IPVLAN in L3S mode requires sysctl net.ipv6.conf.%s.forwarding=1\", strings.Replace(effectiveParentName, \".\", \"/\", -1))\n\t\t}\n\n\t\tipv6ProxyNdpPath := fmt.Sprintf(\"net/ipv6/conf/%s/proxy_ndp\", effectiveParentName)\n\t\tsysctlVal, err = util.SysctlGet(ipv6ProxyNdpPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error reading net sysctl %s: %w\", ipv6ProxyNdpPath, err)\n\t\t}\n\n\t\tif sysctlVal != \"1\\n\" {\n\t\t\t// Replace . in parent name with / for sysctl formatting.\n\t\t\treturn fmt.Errorf(\"IPVLAN in L3S mode requires sysctl net.ipv6.conf.%s.proxy_ndp=1\", strings.Replace(effectiveParentName, \".\", \"/\", -1))\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3faf09d1f1ee19516d6c42ded743a8db", "score": "0.5055015", "text": "func generateIPConfig(ip net.IP, prefixLength int, gwIP net.IP) (*current.IPConfig, *cnitypes.Route) {\n\tipVersion := \"4\"\n\tipAddrBits := 32\n\tdstNet := net.IPNet{\n\t\tIP: net.ParseIP(\"0.0.0.0\"),\n\t\tMask: net.CIDRMask(0, ipAddrBits),\n\t}\n\n\tif ip.To4() == nil {\n\t\tipVersion = \"6\"\n\t\tipAddrBits = 128\n\n\t\tdstNet = net.IPNet{\n\t\t\tIP: net.ParseIP(\"::0\"),\n\t\t\tMask: net.CIDRMask(0, ipAddrBits),\n\t\t}\n\t}\n\n\tdefaultRoute := cnitypes.Route{\n\t\tDst: dstNet,\n\t\tGW: gwIP,\n\t}\n\tipConfig := current.IPConfig{\n\t\tVersion: ipVersion,\n\t\tAddress: net.IPNet{IP: ip, Mask: net.CIDRMask(int(prefixLength), ipAddrBits)},\n\t\tGateway: gwIP,\n\t}\n\n\treturn &ipConfig, &defaultRoute\n}", "title": "" }, { "docid": "566e00bcced8658cd634479c8711b737", "score": "0.50474584", "text": "func validateNoIPCollisions(hif HostInterfaces, hostOnlyNet *net.IPNet, currHostOnlyNets map[string]*hostOnlyNetwork) error {\n\thostOnlyByCIDR := map[string]*hostOnlyNetwork{}\n\t//listHostOnlyAdapters returns a map w/ virtualbox net names as key. Rekey to CIDRs\n\tfor _, n := range currHostOnlyNets {\n\t\tipnet := net.IPNet{IP: n.IPv4.IP, Mask: n.IPv4.Mask}\n\t\thostOnlyByCIDR[ipnet.String()] = n\n\t}\n\n\tm, err := listHostInterfaces(hif, hostOnlyByCIDR)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcollision, err := checkIPNetCollision(hostOnlyNet, m)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif collision {\n\t\treturn ErrNetworkAddrCollision\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f69578a622b88aa6273b57d17d0e451", "score": "0.5041148", "text": "func createNCRequestFromStaticNCHelper(nc v1alpha.NetworkContainer, primaryIPPrefix netip.Prefix, subnet cns.IPSubnet) (*cns.CreateNetworkContainerRequest, error) {\n\tsecondaryIPConfigs := map[string]cns.SecondaryIPConfig{}\n\n\t// iterate through all IP addresses in the subnet described by primaryPrefix and\n\t// add them to the request as secondary IPConfigs.\n\tfor addr := primaryIPPrefix.Masked().Addr(); primaryIPPrefix.Contains(addr); addr = addr.Next() {\n\t\tsecondaryIPConfigs[addr.String()] = cns.SecondaryIPConfig{\n\t\t\tIPAddress: addr.String(),\n\t\t\tNCVersion: int(nc.Version),\n\t\t}\n\t}\n\n\t// Add IPs from CIDR block to the secondary IPConfigs\n\tif nc.Type == v1alpha.VNETBlock {\n\t\t// Delete primary IP reserved for Primary IP for NC\n\t\tdelete(secondaryIPConfigs, primaryIPPrefix.Addr().String())\n\n\t\tfor _, ipAssignment := range nc.IPAssignments {\n\t\t\tcidrPrefix, err := netip.ParsePrefix(ipAssignment.IP)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err, \"invalid CIDR block: %s\", ipAssignment.IP)\n\t\t\t}\n\n\t\t\t// iterate through all IP addresses in the CIDR block described by cidrPrefix and\n\t\t\t// add them to the request as secondary IPConfigs.\n\t\t\tfor addr := cidrPrefix.Masked().Addr(); cidrPrefix.Contains(addr); addr = addr.Next() {\n\t\t\t\tsecondaryIPConfigs[addr.String()] = cns.SecondaryIPConfig{\n\t\t\t\t\tIPAddress: addr.String(),\n\t\t\t\t\tNCVersion: int(nc.Version),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &cns.CreateNetworkContainerRequest{\n\t\tSecondaryIPConfigs: secondaryIPConfigs,\n\t\tNetworkContainerid: nc.ID,\n\t\tNetworkContainerType: cns.Docker,\n\t\tVersion: strconv.FormatInt(nc.Version, 10), //nolint:gomnd // it's decimal\n\t\tIPConfiguration: cns.IPConfiguration{\n\t\t\tIPSubnet: subnet,\n\t\t\tGatewayIPAddress: nc.DefaultGateway,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "f3225eee59e30ea1496ddb3d0e7763c5", "score": "0.5028416", "text": "func CalculateNICSufix(ip net.IP) (string, error) {\n\tif ip.To4() == nil {\n\t\treturn \"\", fmt.Errorf(\"ip is not v4\")\n\t}\n\n\tsplit := strings.Split(ip.String(), \".\")\n\n\tn := make(map[int]int, 3)\n\tfor i := 1; i <= 3; i++ {\n\t\tnum, err := strconv.Atoi(split[i])\n\t\tn[i] = num\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\t// since we can generate 2^24 addresses\n\t// we can map all addresses we can generate to\n\t// all addresses of the /8 net of the given IP address, which fits perfectly !\n\t// so we just need to multiply the 2nd 3rd and 4th byte to get the actuall number\n\t// inside of our 2^24 possible addresses\n\t// we actually need to generate the (n[1]+1)*(n[2]+1)*(n[3]+1)-1 mac address\n\t// why the +1, simply because we do count X.0.0.0 as the first address which is\n\t// 1*1*1 and X.255.255.255 the last which is 256*256*256 = 16^8 = 2^24\n\t// but now we have to subtract by one since we count from 0 to (2^24)-1 and not from\n\t// 1 to 2^24\n\n\thex := fmt.Sprintf(\"%06x\\n\", (n[1]+1)*(n[2]+1)*(n[3]+1)-1)\n\n\treturn fmt.Sprintf(\"%s:%s:%s\", hex[0:2], hex[2:4], hex[4:6]), nil\n}", "title": "" }, { "docid": "ec0f42554dd56d5644b078b8852db6cf", "score": "0.50277585", "text": "func (d *common) Update(config *api.NetworkACLPut) error {\n\terr := d.validateConfig(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trevert := revert.New()\n\tdefer revert.Fail()\n\n\toldConfig := d.info.NetworkACLPut\n\n\t// Update database. Its important this occurs before we attempt to apply to networks using the ACL.\n\terr = d.state.Cluster.UpdateNetworkACL(d.id, config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Apply changes internally and reinitialise.\n\td.info.NetworkACLPut = *config\n\td.init(d.state, d.id, d.projectName, d.info)\n\n\trevert.Add(func() {\n\t\td.state.Cluster.UpdateNetworkACL(d.id, &oldConfig)\n\t\td.info.NetworkACLPut = oldConfig\n\t\td.init(d.state, d.id, d.projectName, d.info)\n\t})\n\n\t// OVN networks share ACL port group definitions so we only need to apply changes once for all OVN nets.\n\tapplyToOVN := false\n\n\t// Find all networks and instance NICs that use this Network ACL and check if any are OVN.\n\terr = UsedBy(d.state, d.projectName, func(_ []string, usageType interface{}, _ string, nicConfig map[string]string) error {\n\t\tswitch u := usageType.(type) {\n\t\tcase db.Instance, db.Profile:\n\t\t\t_, network, _, err := d.state.Cluster.GetNetworkInAnyState(d.projectName, nicConfig[\"network\"])\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"Failed to load network %q\", nicConfig[\"network\"])\n\t\t\t}\n\n\t\t\tif network.Type == \"ovn\" {\n\t\t\t\tapplyToOVN = true\n\n\t\t\t\t// Only OVN networks support ACLs at this time so no need to search further.\n\t\t\t\treturn db.ErrInstanceListStop\n\t\t\t}\n\t\tcase *api.Network:\n\t\t\tif u.Type == \"ovn\" {\n\t\t\t\tapplyToOVN = true\n\n\t\t\t\t// Only OVN networks support ACLs at this time so no need to search further.\n\t\t\t\treturn db.ErrInstanceListStop\n\t\t\t}\n\t\tcase *api.NetworkACL:\n\t\t\treturn nil // Nothing to do for ACL rules referencing us.\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"Unrecognised usage type %T\", u)\n\t\t}\n\n\t\treturn nil\n\t}, d.Info().Name)\n\tif err != nil && err != db.ErrInstanceListStop {\n\t\treturn errors.Wrapf(err, \"Failed getting ACL usage\")\n\t}\n\n\tif applyToOVN {\n\t\td.logger.Debug(\"Applying ACL rules to OVN\")\n\t\tclient, err := openvswitch.NewOVN(d.state)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"Failed to get OVN client\")\n\t\t}\n\n\t\t// Get map of ACL names to DB IDs (used for generating OVN port group names).\n\t\taclNameIDs, err := d.state.Cluster.GetNetworkACLIDsByNames(d.Project())\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"Failed getting network ACL IDs for security ACL update\")\n\t\t}\n\n\t\t// Request that the ACL and any referenced ACLs in the ruleset are created in OVN.\n\t\tr, err := OVNEnsureACLs(d.state, d.logger, client, d.projectName, aclNameIDs, []string{d.info.Name}, true)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"Failed ensuring ACL is configured in OVN\")\n\t\t}\n\t\trevert.Add(r.Fail)\n\n\t\terr = OVNPortGroupDeleteIfUnused(d.state, d.logger, client, d.projectName, nil, \"\", d.info.Name)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"Failed removing unused OVN port groups\")\n\t\t}\n\t}\n\n\trevert.Success()\n\treturn nil\n}", "title": "" }, { "docid": "268f132194d6f25c3b6b9c54632ebbf7", "score": "0.50252855", "text": "func (o VpcCniOptionsOutput) CniCustomNetworkCfg() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v VpcCniOptions) *bool { return v.CniCustomNetworkCfg }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "9b05840efa72a991efbf218cfd0da9bc", "score": "0.50052994", "text": "func ConfigureLink(link netlink.Link, info *cnicurrent.Result) error {\n\tifaceNo := -1\n\tlinkMAC := link.Attrs().HardwareAddr.String()\n\tfor i, iface := range info.Interfaces {\n\t\tif iface.Mac == linkMAC {\n\t\t\tifaceNo = i\n\t\t\tbreak\n\t\t}\n\t}\n\tif ifaceNo == -1 {\n\t\treturn fmt.Errorf(\"can't find link with MAC %q in saved cni result: %s\", linkMAC, spew.Sdump(info))\n\t}\n\n\tfor _, addr := range info.IPs {\n\t\tif addr.Interface == ifaceNo {\n\t\t\tlinkAddr := &netlink.Addr{IPNet: &addr.Address}\n\t\t\tif err := netlink.AddrAdd(link, linkAddr); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error adding address %v to link %q: %v\", addr.Address, link.Attrs().Name, err)\n\t\t\t}\n\n\t\t\tfor _, route := range info.Routes {\n\t\t\t\t// TODO: that's too naive - if there are more than one interfaces which have this gw address\n\t\t\t\t// in their subnet - same gw will be added on both of them\n\t\t\t\t// in theory this should be ok, but there is can lead to configuration other than prepared\n\t\t\t\t// by cni plugins\n\t\t\t\tif linkAddr.Contains(route.GW) {\n\t\t\t\t\terr := netlink.RouteAdd(&netlink.Route{\n\t\t\t\t\t\tLinkIndex: link.Attrs().Index,\n\t\t\t\t\t\tScope: SCOPE_UNIVERSE,\n\t\t\t\t\t\tDst: &route.Dst,\n\t\t\t\t\t\tGw: route.GW,\n\t\t\t\t\t})\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"error adding route (dst %v gw %v): %v\", route.Dst, route.GW, err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "94de2d2906d08d91365a31e609cce1e4", "score": "0.500334", "text": "func (az *AzureProvider) getInfoFromNIC(ctx context.Context, nicName string) (network.Interface, []network.InterfaceIPConfiguration, error) {\n\tinterfaceStruct, err := az.nicClient.Get(ctx, az.resourceGroupName, nicName, \"\")\n\tif err != nil {\n\t\treturn network.Interface{}, []network.InterfaceIPConfiguration{},\n\t\t\tfmt.Errorf(\"cannot fetch the network interface data of NIC %s: %v\", nicName, err)\n\t}\n\n\tif interfaceStruct.InterfacePropertiesFormat == nil {\n\t\treturn network.Interface{}, []network.InterfaceIPConfiguration{},\n\t\t\tfmt.Errorf(\"ip configuration for NIC %s cannot be nil\", nicName)\n\t}\n\tinterfacePropFormat := *interfaceStruct.InterfacePropertiesFormat\n\n\tif interfacePropFormat.IPConfigurations == nil {\n\t\treturn network.Interface{}, []network.InterfaceIPConfiguration{},\n\t\t\tfmt.Errorf(\"ip configuration for NIC %s cannot be nil\", nicName)\n\t}\n\tinterfaceIPConfigs := *interfacePropFormat.IPConfigurations\n\n\tif len(interfaceIPConfigs) < 1 {\n\t\treturn network.Interface{}, []network.InterfaceIPConfiguration{},\n\t\t\tfmt.Errorf(\"ip configuration properties for NIC %s cannot be 0\", nicName)\n\t}\n\t// we assume that all worker nodes have only one IP config.\n\t// if the worker nodes have more than one IP config, throw an error\n\tif len(interfaceIPConfigs) > 1 {\n\t\treturn network.Interface{}, []network.InterfaceIPConfiguration{},\n\t\t\tfmt.Errorf(\" NIC %s has multiple ip configurations. This is not supported by WNI\", nicName)\n\t}\n\n\treturn interfaceStruct, interfaceIPConfigs, nil\n}", "title": "" }, { "docid": "e9d66df81900f4943b6fc10cf201fd8c", "score": "0.50017136", "text": "func checkBridgeNetFiltering(config *networkConfiguration) error {\n\tipVer := getIPVersion(config)\n\tiface := config.BridgeName\n\tdoEnable := func(ipVer ipVersion) error {\n\t\tenabled, err := isPacketForwardingEnabled(ipVer, iface)\n\t\tif err != nil {\n\t\t\tvar ipVerName string\n\t\t\tif ipVer == ipv4 {\n\t\t\t\tipVerName = \"IPv4\"\n\t\t\t} else {\n\t\t\t\tipVerName = \"IPv6\"\n\t\t\t}\n\t\t\tlog.G(context.TODO()).Warnf(\"failed to check %s forwarding: %v\", ipVerName, err)\n\t\t} else if enabled {\n\t\t\tenabled, err := getKernelBoolParam(getBridgeNFKernelParam(ipVer))\n\t\t\tif err != nil || enabled {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn setKernelBoolParam(getBridgeNFKernelParam(ipVer), true)\n\t\t}\n\t\treturn nil\n\t}\n\n\tswitch ipVer {\n\tcase ipv4, ipv6:\n\t\treturn doEnable(ipVer)\n\tcase ipvboth:\n\t\tv4err := doEnable(ipv4)\n\t\tv6err := doEnable(ipv6)\n\t\tif v4err == nil {\n\t\t\treturn v6err\n\t\t}\n\t\treturn v4err\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "4e199c48a4090a49dafab429c9c6d0aa", "score": "0.49966717", "text": "func TestNetworkConfigurationFactory(t *testing.T) {\n\tvar tests = []struct {\n\t\tname string\n\t\tnetworkType string\n\t\tnetworkPatch []byte\n\t\terrorMessage string\n\t}{\n\t\t{\"invalid network type\", \"OpenShiftSDN\", nil, \"OpenShiftSDN : network type not supported\"},\n\t\t{\"valid network type\", \"OVNKubernetes\", []byte(`{\"spec\":{\"defaultNetwork\":{\"ovnKubernetesConfig\":{\"hybridOverlayConfig\": ` +\n\t\t\t`{\"hybridClusterNetwork\":[{\"cidr\":\"10.132.0.0/14\",\"hostPrefix\":23}],\"` +\n\t\t\t`hybridOverlayVXLANPort\": 4800}}}}}`), \"\"},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tfakeConfigClient, fakeOperatorClient := createFakeClients(tt.networkType)\n\t\t\tif tt.networkPatch != nil {\n\t\t\t\t_, err := fakeOperatorClient.Networks().Patch(context.TODO(), \"cluster\", k8stypes.MergePatchType, tt.networkPatch, meta.PatchOptions{})\n\t\t\t\trequire.Nil(t, err, \"network patch should not throw error\")\n\t\t\t}\n\t\t\t_, err := networkConfigurationFactory(fakeConfigClient, fakeOperatorClient)\n\t\t\tif tt.errorMessage == \"\" {\n\t\t\t\trequire.Nil(t, err, \"Successful check for valid network type\")\n\t\t\t} else {\n\t\t\t\trequire.Error(t, err, \"Function networkConfigurationFactory did not throw an error \"+\n\t\t\t\t\t\"when it was expected to\")\n\t\t\t\tassert.Contains(t, err.Error(), tt.errorMessage)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "90d518a4eb75c0f0671c9f139c6b38d4", "score": "0.49943054", "text": "func (cnsClient *CNSClient) RequestIPAddress(orchestratorContext []byte) (*cns.GetIPConfigResponse, error) {\n\tvar (\n\t\terr error\n\t\tres *http.Response\n\t\tresponse *cns.GetIPConfigResponse\n\t)\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tcnsClient.ReleaseIPAddress(orchestratorContext)\n\t\t}\n\t}()\n\n\tvar body bytes.Buffer\n\n\thttpc := &http.Client{}\n\turl := cnsClient.connectionURL + cns.RequestIPConfig\n\n\tpayload := &cns.GetIPConfigRequest{\n\t\tOrchestratorContext: orchestratorContext,\n\t}\n\n\terr = json.NewEncoder(&body).Encode(payload)\n\tif err != nil {\n\t\tlog.Errorf(\"encoding json failed with %v\", err)\n\t\treturn response, err\n\t}\n\n\tres, err = httpc.Post(url, contentTypeJSON, &body)\n\tif err != nil {\n\t\tlog.Errorf(\"[Azure CNSClient] HTTP Post returned error %v\", err.Error())\n\t\treturn response, err\n\t}\n\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != http.StatusOK {\n\t\terrMsg := fmt.Sprintf(\"[Azure CNSClient] RequestIPAddress invalid http status code: %v\", res.StatusCode)\n\t\tlog.Errorf(errMsg)\n\t\treturn response, fmt.Errorf(errMsg)\n\t}\n\n\terr = json.NewDecoder(res.Body).Decode(&response)\n\tif err != nil {\n\t\tlog.Errorf(\"[Azure CNSClient] Error received while parsing RequestIPAddress response resp:%v err:%v\", res.Body, err.Error())\n\t\treturn response, err\n\t}\n\n\tif response.Response.ReturnCode != 0 {\n\t\tlog.Errorf(\"[Azure CNSClient] RequestIPAddress received error response :%v\", response.Response.Message)\n\t\treturn response, fmt.Errorf(response.Response.Message)\n\t}\n\n\treturn response, err\n}", "title": "" }, { "docid": "39faf90265eac128ea44359218e1bb72", "score": "0.49912143", "text": "func parseConfig(stdin []byte) (*PluginConf, error) {\n\tconf := PluginConf{}\n\n\tif err := json.Unmarshal(stdin, &conf); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"could not parse network configuration\")\n\t}\n\n\tif conf.RawPrevResult != nil {\n\t\tresultBytes, err := json.Marshal(conf.RawPrevResult)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"could not serialize prevResult\")\n\t\t}\n\t\tres, err := version.NewResult(conf.CNIVersion, resultBytes)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"could not parse prevResult\")\n\t\t}\n\t\tconf.RawPrevResult = nil\n\t\tconf.PrevResult, err = current.NewResultFromResult(res)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"could not convert result to current version\")\n\t\t}\n\t}\n\n\treturn &conf, nil\n}", "title": "" }, { "docid": "7907e998a0e15d6e6af091961fc25307", "score": "0.49907562", "text": "func IgnParseWrapper(rawIgn []byte) (interface{}, error) {\n\t// ParseCompatibleVersion will parse any config <= N to version N\n\tignCfgV3, rptV3, errV3 := ign3_4.ParseCompatibleVersion(rawIgn)\n\tif errV3 == nil && !rptV3.IsFatal() {\n\t\treturn ignCfgV3, nil\n\t}\n\n\t// ParseCompatibleVersion differentiates between ErrUnknownVersion (\"I know what it is and we don't support it\") and\n\t// ErrInvalidVersion (\"I can't parse it to find out what it is\"), but our old 3.2 logic didn't, so this is here to make sure\n\t// our error message for invalid version is still helpful.\n\tif errV3.Error() == ign3error.ErrInvalidVersion.Error() {\n\t\treturn ign3types.Config{}, fmt.Errorf(\"parsing Ignition config failed: invalid version. Supported spec versions: 2.2, 3.0, 3.1, 3.2, 3.3, 3.4\")\n\t}\n\n\tif errV3.Error() == ign3error.ErrUnknownVersion.Error() {\n\t\tignCfgV2, rptV2, errV2 := ign2.Parse(rawIgn)\n\t\tif errV2 == nil && !rptV2.IsFatal() {\n\t\t\treturn ignCfgV2, nil\n\t\t}\n\n\t\t// If the error is still UnknownVersion it's not a 3.3/3.2/3.1/3.0 or 2.x config, thus unsupported\n\t\tif errV2.Error() == ign2error.ErrUnknownVersion.Error() {\n\t\t\treturn ign3types.Config{}, fmt.Errorf(\"parsing Ignition config failed: unknown version. Supported spec versions: 2.2, 3.0, 3.1, 3.2, 3.3, 3.4\")\n\t\t}\n\t\treturn ign3types.Config{}, fmt.Errorf(\"parsing Ignition spec v2 failed with error: %v\\nReport: %v\", errV2, rptV2)\n\t}\n\n\treturn ign3types.Config{}, fmt.Errorf(\"parsing Ignition config spec v3 failed with error: %v\\nReport: %v\", errV3, rptV3)\n}", "title": "" }, { "docid": "4e4079e58770763241b911eb3db2cd72", "score": "0.49846536", "text": "func getIPs(networkID uint32) []string {\n\tswitch networkID {\n\tcase constants.MainnetID:\n\t\treturn nil // Remove this line, should you activate public IP beacons in production mainnet\n\t\t/*\n\t\t\treturn []string{\n\t\t\t\t\"127.0.0.1:9651\",//replace with public ip in production mainnet\n\t\t\t}\n\t\t*/\n\tcase constants.FujiID:\n\t\treturn []string{\n\t\t\t\"18.188.121.35:21001\",\n\t\t\t\"3.133.83.66:21001\",\n\t\t\t\"3.15.206.239:21001\",\n\t\t\t\"18.224.140.156:21001\",\n\t\t\t\"3.133.131.39:21001\",\n\t\t\t\"18.191.29.54:21001\",\n\t\t\t\"18.224.172.110:21001\",\n\t\t\t\"18.223.211.203:21001\",\n\t\t\t\"18.216.130.143:21001\",\n\t\t\t\"18.223.184.147:21001\",\n\t\t\t\"52.15.48.84:21001\",\n\t\t\t\"18.189.194.220:21001\",\n\t\t\t\"18.223.119.104:21001\",\n\t\t\t\"3.133.155.41:21001\",\n\t\t\t\"13.58.170.174:21001\",\n\t\t\t\"3.21.245.246:21001\",\n\t\t\t\"52.15.190.149:21001\",\n\t\t\t\"18.188.95.241:21001\",\n\t\t\t\"3.12.197.248:21001\",\n\t\t\t\"3.17.39.236:21001\",\n\t\t}\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "ca567c6b2926edab19e15fa69e12e6ab", "score": "0.49779752", "text": "func (ns *NetworkService) validateConnections() error {\n\n\t// traverse the connections and for each NetworkPod/interface, it must be in the\n\t// list of NetworkPod's\n\n\tfor _, conn := range ns.Spec.Connections {\n\n\t\tswitch conn.ConnType {\n\t\tcase controller.ConnTypeL2PP:\n\t\t\tif len(conn.PodInterfaces)+len(conn.NodeInterfaces)+len(conn.NodeInterfaceLabels) != 2 {\n\t\t\t\treturn fmt.Errorf(\"network-service: %s conn: l2 p2p must have 2 interfaces only\",\n\t\t\t\t\tns.Metadata.Name)\n\t\t\t}\n\t\tcase controller.ConnTypeL2MP:\n\t\t\tif len(conn.PodInterfaces)+len(conn.NodeInterfaces) == 0 {\n\t\t\t\treturn fmt.Errorf(\"network-service: %s conn: l2 p2mp must have at least one interface\",\n\t\t\t\t\tns.Metadata.Name)\n\t\t\t}\n\t\t\tif conn.UseNodeL2Bd != \"\" && conn.L2Bd != nil {\n\t\t\t\treturn fmt.Errorf(\"network-service: %s conn: cannot refer to a node bd AND provide l2bd parameters\",\n\t\t\t\t\tns.Metadata.Name)\n\t\t\t}\n\t\t\tif conn.L2Bd != nil {\n\t\t\t\tif conn.L2Bd.L2BdTemplate != \"\" && conn.L2Bd.BdParms != nil {\n\t\t\t\t\treturn fmt.Errorf(\"network-service: %s conn: l2bd: %s cannot refer to temmplate and provide l2bd parameters\",\n\t\t\t\t\t\tns.Metadata.Name, conn.L2Bd.Name)\n\t\t\t\t}\n\t\t\t\tif conn.L2Bd.L2BdTemplate != \"\" {\n\t\t\t\t\tif l2bdt := ctlrPlugin.SysParametersMgr.FindL2BDTemplate(conn.L2Bd.L2BdTemplate); l2bdt == nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"network-service: %s, conn: l2bd: %s has invalid reference to non-existant l2bd template '%s'\",\n\t\t\t\t\t\t\tns.Metadata.Name, conn.L2Bd.Name, conn.L2Bd.L2BdTemplate)\n\t\t\t\t\t}\n\t\t\t\t} else if conn.L2Bd.BdParms == nil {\n\t\t\t\t\treturn fmt.Errorf(\"network-service: %s, conn: l2bd: %s has no DB parms nor refer to a template\",\n\t\t\t\t\t\tns.Metadata.Name, conn.L2Bd.Name)\n\t\t\t\t}\n\t\t\t}\n\t\tcase controller.ConnTypeL3PP:\n\t\t\tif len(conn.PodInterfaces)+len(conn.NodeInterfaces)+len(conn.NodeInterfaceLabels) != 2 {\n\t\t\t\treturn fmt.Errorf(\"network-service: %s conn: l3 p2p must have 2 interfaces only\",\n\t\t\t\t\tns.Metadata.Name)\n\t\t\t}\n\t\tcase controller.ConnTypeL3MP:\n\t\t\tif len(conn.PodInterfaces)+len(conn.NodeInterfaces) == 0 {\n\t\t\t\treturn fmt.Errorf(\"network-service: %s conn: l3 p2mp must have at least one interface\",\n\t\t\t\t\tns.Metadata.Name)\n\t\t\t}\n\t\t\t//if conn.UseNodeL2Bd != \"\" || conn.L2Bd != nil {\n\t\t\t//\treturn fmt.Errorf(\"network-service: %s conn: cannot refer to a node bd OR provide l2bd parameters\",\n\t\t\t//\t\tns.Metadata.Name)\n\t\t\t//}\n\t\t\tif conn.UseNodeL2Bd != \"\" && conn.L2Bd != nil {\n\t\t\t\treturn fmt.Errorf(\"network-service: %s conn: cannot refer to a node bd AND provide l2bd parameters\",\n\t\t\t\t\tns.Metadata.Name)\n\t\t\t}\n\t\t\tif conn.L2Bd != nil {\n\t\t\t\tif conn.L2Bd.L2BdTemplate != \"\" && conn.L2Bd.BdParms != nil {\n\t\t\t\t\treturn fmt.Errorf(\"network-service: %s conn: l2bd: %s cannot refer to temmplate and provide l2bd parameters\",\n\t\t\t\t\t\tns.Metadata.Name, conn.L2Bd.Name)\n\t\t\t\t}\n\t\t\t\tif conn.L2Bd.L2BdTemplate != \"\" {\n\t\t\t\t\tif l2bdt := ctlrPlugin.SysParametersMgr.FindL2BDTemplate(conn.L2Bd.L2BdTemplate); l2bdt == nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"network-service: %s, conn: l2bd: %s has invalid reference to non-existant l2bd template '%s'\",\n\t\t\t\t\t\t\tns.Metadata.Name, conn.L2Bd.Name, conn.L2Bd.L2BdTemplate)\n\t\t\t\t\t}\n\t\t\t\t} else if conn.L2Bd.BdParms == nil {\n\t\t\t\t\treturn fmt.Errorf(\"network-service: %s, conn: l2bd: %s has no DB parms nor refer to a template\",\n\t\t\t\t\t\tns.Metadata.Name, conn.L2Bd.Name)\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"network-service: %s, connection has invalid conn type '%s'\",\n\t\t\t\tns.Metadata.Name, conn.ConnType)\n\t\t}\n\n\t\tfor _, connPodInterface := range conn.PodInterfaces {\n\t\t\tconnPodName, connInterfaceName := ConnPodInterfaceNames(connPodInterface)\n\t\t\tif connPodName == \"\" || connInterfaceName == \"\" {\n\t\t\t\treturn fmt.Errorf(\"network-service: %s conn: pod/port: %s must be of pod/interface format\",\n\t\t\t\t\tns.Metadata.Name, connPodInterface)\n\t\t\t}\n\t\t\tif iface, _ := ns.findNetworkPodAndInterfaceInList(ConnPodName(connPodInterface),\n\t\t\t\tConnInterfaceName(connPodInterface), ns.Spec.NetworkPods); iface == nil {\n\t\t\t\treturn fmt.Errorf(\"network-service: %s conn: pod/port: %s not found in NetworkPod interfaces\",\n\t\t\t\t\tns.Metadata.Name, connPodInterface)\n\t\t\t}\n\t\t}\n\n\t\tif conn.ConnMethod != \"\" {\n\t\t\tswitch conn.ConnMethod {\n\t\t\tcase controller.ConnMethodDirect:\n\t\t\tcase controller.ConnMethodVswitch:\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"network-service: %s, connection has invalid conn method '%s'\",\n\t\t\t\t\tns.Metadata.Name, conn.ConnMethod)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "66ccfb10f0e28a2bdd5b2b5b28a74a31", "score": "0.49582076", "text": "func (l *leader) ValidateAviInfraSetting(key string, infraSetting *akov1alpha1.AviInfraSetting) error {\n\n\tif ((infraSetting.Spec.Network.EnableRhi != nil && !*infraSetting.Spec.Network.EnableRhi) || infraSetting.Spec.Network.EnableRhi == nil) &&\n\t\tlen(infraSetting.Spec.Network.BgpPeerLabels) > 0 {\n\t\terr := fmt.Errorf(\"BGPPeerLabels cannot be set if EnableRhi is false.\")\n\t\tstatus.UpdateAviInfraSettingStatus(key, infraSetting, status.UpdateCRDStatusOptions{\n\t\t\tStatus: lib.StatusRejected,\n\t\t\tError: err.Error(),\n\t\t})\n\t\treturn err\n\t}\n\n\trefData := make(map[string]string)\n\tfor _, vipNetwork := range infraSetting.Spec.Network.VipNetworks {\n\t\tif vipNetwork.Cidr != \"\" {\n\t\t\tre := regexp.MustCompile(lib.IPCIDRRegex)\n\t\t\tif !re.MatchString(vipNetwork.Cidr) {\n\t\t\t\terr := fmt.Errorf(\"invalid CIDR configuration %s detected for networkName %s in vipNetworkList\", vipNetwork.Cidr, vipNetwork.NetworkName)\n\t\t\t\tstatus.UpdateAviInfraSettingStatus(key, infraSetting, status.UpdateCRDStatusOptions{\n\t\t\t\t\tStatus: lib.StatusRejected,\n\t\t\t\t\tError: err.Error(),\n\t\t\t\t})\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif vipNetwork.V6Cidr != \"\" {\n\t\t\tre := regexp.MustCompile(lib.IPV6CIDRRegex)\n\t\t\tif !re.MatchString(vipNetwork.V6Cidr) {\n\t\t\t\terr := fmt.Errorf(\"invalid IPv6 CIDR configuration %s detected for networkName %s in vipNetworkList\", vipNetwork.V6Cidr, vipNetwork.NetworkName)\n\t\t\t\tstatus.UpdateAviInfraSettingStatus(key, infraSetting, status.UpdateCRDStatusOptions{\n\t\t\t\t\tStatus: lib.StatusRejected,\n\t\t\t\t\tError: err.Error(),\n\t\t\t\t})\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\trefData[vipNetwork.NetworkName] = \"Network\"\n\t}\n\n\tif infraSetting.Spec.SeGroup.Name != \"\" {\n\t\trefData[infraSetting.Spec.SeGroup.Name] = \"ServiceEngineGroup\"\n\t}\n\tif len(infraSetting.Spec.Network.Listeners) > 0 {\n\t\tsslEnabled := false\n\t\tfor _, listener := range infraSetting.Spec.Network.Listeners {\n\t\t\tif listener.EnableSSL != nil && *listener.EnableSSL {\n\t\t\t\tsslEnabled = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !sslEnabled {\n\t\t\terr := fmt.Errorf(\"One of the port in aviInfraSetting must have SSL enabled\")\n\t\t\tstatus.UpdateAviInfraSettingStatus(key, infraSetting, status.UpdateCRDStatusOptions{\n\t\t\t\tStatus: lib.StatusRejected,\n\t\t\t\tError: err.Error(),\n\t\t\t})\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := checkRefsOnController(key, refData); err != nil {\n\t\tstatus.UpdateAviInfraSettingStatus(key, infraSetting, status.UpdateCRDStatusOptions{\n\t\t\tStatus: lib.StatusRejected,\n\t\t\tError: err.Error(),\n\t\t})\n\t\treturn err\n\t}\n\n\t// This would add SEG labels only if they are not configured yet. In case there is a label mismatch\n\t// to any pre-existing SEG labels, the AviInfraSettig CR will get Rejected from the checkRefsOnController\n\t// step before this.\n\tif infraSetting.Spec.SeGroup.Name != \"\" {\n\t\taddSeGroupLabel(key, infraSetting.Spec.SeGroup.Name)\n\t}\n\n\t// No need to update status of infra setting object as accepted since it was accepted before.\n\tif infraSetting.Status.Status == lib.StatusAccepted {\n\t\treturn nil\n\t}\n\n\tstatus.UpdateAviInfraSettingStatus(key, infraSetting, status.UpdateCRDStatusOptions{\n\t\tStatus: lib.StatusAccepted,\n\t\tError: \"\",\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "672f0f5484f607d2b4b672a0e318b8c3", "score": "0.49356475", "text": "func (nc *nodeConfig) configureNetwork() error {\n\t// Wait until the node object has the hybrid overlay subnet annotation. Otherwise the hybrid-overlay will fail to\n\t// start\n\tif err := nc.waitForNodeAnnotation(HybridOverlaySubnet); err != nil {\n\t\treturn errors.Wrapf(err, \"error waiting for %s node annotation for %s\", HybridOverlaySubnet,\n\t\t\tnc.node.GetName())\n\t}\n\n\t// NOTE: Investigate if we need to introduce a interface wrt to the VM's networking configuration. This will\n\t// become more clear with the outcome of https://issues.redhat.com/browse/WINC-343\n\n\t// Configure the hybrid overlay in the Windows VM\n\tif err := nc.Windows.ConfigureHybridOverlay(nc.node.GetName()); err != nil {\n\t\treturn errors.Wrapf(err, \"error configuring hybrid overlay for %s\", nc.node.GetName())\n\t}\n\n\t// Wait until the node object has the hybrid overlay MAC annotation. This is required for the CNI configuration to\n\t// start.\n\tif err := nc.waitForNodeAnnotation(HybridOverlayMac); err != nil {\n\t\treturn errors.Wrapf(err, \"error waiting for %s node annotation for %s\", HybridOverlayMac,\n\t\t\tnc.node.GetName())\n\t}\n\n\t// Configure CNI in the Windows VM\n\tif err := nc.configureCNI(); err != nil {\n\t\treturn errors.Wrapf(err, \"error configuring CNI for %s\", nc.node.GetName())\n\t}\n\t// Start the kube-proxy service\n\tif err := nc.Windows.ConfigureKubeProxy(nc.node.GetName(), nc.node.Annotations[HybridOverlaySubnet]); err != nil {\n\t\treturn errors.Wrapf(err, \"error starting kube-proxy for %s\", nc.node.GetName())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "146a472a8e360153f558f66488fbba9a", "score": "0.4932492", "text": "func Add(args *skel.CmdArgs) error {\n\tvar success bool\n\n\tconf := new(PluginConf)\n\terr := json.Unmarshal(args.StdinData, conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcoildURL, err := url.Parse(conf.CoildURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnetns, err := ns.GetNS(args.Netns)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer netns.Close()\n\n\thostInterface, containerInterface, err := setupVeth(netns, args.IfName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tkv := parseArgs(args.Args)\n\tpodNS, podName, err := getPodInfo(kv)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tip, gw, err := getIPFromCoild(coildURL, podNS, podName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif !success {\n\t\t\treturnIPToCoild(coildURL, podNS, podName)\n\t\t}\n\t}()\n\n\terr = addRouteInHost(ip, hostInterface.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresult := &current.Result{}\n\tresult.Interfaces = []*current.Interface{hostInterface, containerInterface}\n\tresult.IPs = []*current.IPConfig{\n\t\t{\n\t\t\tVersion: \"4\",\n\t\t\tInterface: current.Int(1),\n\t\t\tAddress: *ipToIPNet(ip),\n\t\t},\n\t}\n\n\terr = configureInterface(netns, gw, args.IfName, result)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsuccess = true\n\treturn types.PrintResult(result, conf.CNIVersion)\n}", "title": "" }, { "docid": "be9dd38c39f0af0354b7830a243c2325", "score": "0.49291694", "text": "func handleCalicoCNI(c *components, install *operatorv1.Installation) error {\n\tplugin, err := getCNIPlugin(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif plugin != operatorv1.PluginCalico {\n\t\treturn nil\n\t}\n\n\tif c.cni.CalicoConfig == nil {\n\t\treturn ErrIncompatibleCluster{\n\t\t\terr: \"detected Calico CNI but couldn't find any CNI plugin with type=calico\",\n\t\t\tcomponent: ComponentCNIConfig,\n\t\t\tfix: \"ensure CNI config contains a plugin with type=calico, or if not using Calico CNI, ensure FELIX_INTERFACEPREFIX is set correctly on calico-node\",\n\t\t}\n\t}\n\n\tif install.Spec.CNI == nil {\n\t\tinstall.Spec.CNI = &operatorv1.CNISpec{}\n\t}\n\tinstall.Spec.CNI.Type = plugin\n\n\tif install.Spec.CNI.IPAM == nil {\n\t\tinstall.Spec.CNI.IPAM = &operatorv1.IPAMSpec{}\n\t}\n\n\tif install.Spec.CalicoNetwork == nil {\n\t\tinstall.Spec.CalicoNetwork = &operatorv1.CalicoNetworkSpec{}\n\t}\n\n\tnetBackend, err := getNetworkingBackend(c.node, c.client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch c.cni.CalicoConfig.IPAM.Type {\n\tcase \"calico-ipam\":\n\t\tinstall.Spec.CNI.IPAM.Type = operatorv1.IPAMPluginCalico\n\n\t\tif err := subhandleCalicoIPAM(netBackend, *c.cni.CalicoConfig, install); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \"host-local\":\n\t\tinstall.Spec.CNI.IPAM.Type = operatorv1.IPAMPluginHostLocal\n\n\t\tif c.cni.HostLocalIPAMConfig == nil {\n\t\t\treturn ErrIncompatibleCluster{\n\t\t\t\terr: \"detected Calico CNI with host-local IPAM, but failed to load host-local config\",\n\t\t\t\tcomponent: ComponentCNIConfig,\n\t\t\t}\n\t\t}\n\n\t\tif err := subhandleHostLocalIPAM(netBackend, *c.cni.HostLocalIPAMConfig, install); err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\treturn ErrIncompatibleCluster{\n\t\t\terr: fmt.Sprintf(\"unrecognized IPAM plugin '%s'\", c.cni.CalicoConfig.IPAM.Type),\n\t\t\tcomponent: ComponentCNIConfig,\n\t\t\tfix: \"update cluster to supported type 'calico-ipam' or 'host-local'\",\n\t\t}\n\t}\n\n\t// IP\n\tif err := c.node.assertEnv(ctx, c.client, containerCalicoNode, \"IP\", \"autodetect\"); err != nil {\n\t\treturn err\n\t}\n\n\t// IP_AUTODETECTION_METHOD\n\tif err := handleAutoDetectionMethod(c, install); err != nil {\n\t\treturn err\n\t}\n\n\t// CNI portmap plugin\n\tif _, ok := c.cni.Plugins[\"portmap\"]; ok {\n\t\thp := v1.HostPortsEnabled\n\t\tinstall.Spec.CalicoNetwork.HostPorts = &hp\n\t} else {\n\t\thp := v1.HostPortsDisabled\n\t\tinstall.Spec.CalicoNetwork.HostPorts = &hp\n\t}\n\n\tif c.cni.ConfigName != \"k8s-pod-network\" {\n\t\treturn ErrIncompatibleCluster{\n\t\t\terr: fmt.Sprintf(\"only 'k8s-pod-network' is supported as CNI name, found %s\", c.cni.ConfigName),\n\t\t\tcomponent: ComponentCNIConfig,\n\t\t\tfix: \"set CNI config name to 'k8s-pod-network'\",\n\t\t}\n\t}\n\n\t// Other CNI features\n\tif c.cni.CalicoConfig.FeatureControl.FloatingIPs {\n\t\treturn ErrIncompatibleCluster{\n\t\t\terr: \"floating IPs not supported\",\n\t\t\tcomponent: ComponentCNIConfig,\n\t\t\tfix: \"disable 'floating_ips' in the CNI configuration\",\n\t\t}\n\t}\n\tif c.cni.CalicoConfig.FeatureControl.IPAddrsNoIpam {\n\t\treturn ErrIncompatibleCluster{\n\t\t\terr: \"IpAddrsNoIpam not supported\",\n\t\t\tcomponent: ComponentCNIConfig,\n\t\t\tfix: \"disable 'IpAddrsNoIpam' in the CNI configuration\",\n\t\t}\n\t}\n\tif c.cni.CalicoConfig.ContainerSettings.AllowIPForwarding {\n\t\treturn ErrIncompatibleCluster{\n\t\t\terr: \"AllowIPForwarding not supported\",\n\t\t\tcomponent: ComponentCNIConfig,\n\t\t\tfix: \"disable 'AllowIPForwarding' in the CNI configuration\",\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "aa92ff809fe8e39ae4de171f7fc48592", "score": "0.4926871", "text": "func checkNetInterface(ctx context.Context, ifname, arcIP, bridgeIP string) error {\n\t// Starts a ping command to \"arcIP\".\n\tping := testexec.CommandContext(ctx, \"ping\", \"-i0.3\", arcIP)\n\tif err := ping.Start(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to start ping\")\n\t}\n\tdefer ping.Wait()\n\tdefer ping.Kill()\n\n\t// Starts a tcpdump process that writes messages to stdout on new network messages.\n\ttcpdump := arc.BootstrapCommand(ctx, \"/system/xbin/tcpdump\", \"-i\", ifname)\n\n\tstdout, err := tcpdump.StdoutPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := tcpdump.Start(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to start tcpdump\")\n\t}\n\n\t// sc.Scan() below might block. Release bufio.Scanner by killing tcpdump if the\n\t// process execution time exceeds context deadline.\n\tgo func() {\n\t\tdefer tcpdump.Wait()\n\t\tdefer tcpdump.Kill()\n\n\t\t// Blocks until deadline is passed.\n\t\t<-ctx.Done()\n\t}()\n\n\t// Watch and wait until tcpdump output \"bridgeIP\".\n\tsc := bufio.NewScanner(stdout)\n\tfor {\n\t\tif err := ctx.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif sc.Scan() && strings.Contains(sc.Text(), bridgeIP) {\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5a8486dc83836b4962bd3b4efcbd1e71", "score": "0.49263957", "text": "func LoadIPAMConfig(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\tif n.IPAM == nil {\n\t\treturn nil, \"\", fmt.Errorf(\"IPAM config missing 'ipam' key\")\n\t}\n\n\t// Validate all ranges\n\tnumV4 := 0\n\tnumV6 := 0\n\n\tfor i := range n.IPAM.Addresses {\n\t\tip, addr, err := net.ParseCIDR(n.IPAM.Addresses[i].AddressStr)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", fmt.Errorf(\"invalid CIDR %s: %s\", n.IPAM.Addresses[i].AddressStr, err)\n\t\t}\n\t\tn.IPAM.Addresses[i].Address = *addr\n\t\tn.IPAM.Addresses[i].Address.IP = ip\n\n\t\tif err := canonicalizeIP(&n.IPAM.Addresses[i].Address.IP); err != nil {\n\t\t\treturn nil, \"\", fmt.Errorf(\"invalid address %d: %s\", i, err)\n\t\t}\n\n\t\tif n.IPAM.Addresses[i].Address.IP.To4() != nil {\n\t\t\tn.IPAM.Addresses[i].Version = \"4\"\n\t\t\tnumV4++\n\t\t} else {\n\t\t\tn.IPAM.Addresses[i].Version = \"6\"\n\t\t\tnumV6++\n\t\t}\n\t}\n\n\tif envArgs != \"\" {\n\t\te := IPAMEnvArgs{}\n\t\terr := types.LoadArgs(envArgs, &e)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\n\t\tif e.IP != \"\" {\n\t\t\tfor _, item := range strings.Split(string(e.IP), \",\") {\n\t\t\t\tipstr := strings.TrimSpace(item)\n\n\t\t\t\tip, subnet, err := net.ParseCIDR(ipstr)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, \"\", fmt.Errorf(\"invalid CIDR %s: %s\", ipstr, err)\n\t\t\t\t}\n\n\t\t\t\taddr := Address{Address: net.IPNet{IP: ip, Mask: subnet.Mask}}\n\t\t\t\tif addr.Address.IP.To4() != nil {\n\t\t\t\t\taddr.Version = \"4\"\n\t\t\t\t\tnumV4++\n\t\t\t\t} else {\n\t\t\t\t\taddr.Version = \"6\"\n\t\t\t\t\tnumV6++\n\t\t\t\t}\n\t\t\t\tn.IPAM.Addresses = append(n.IPAM.Addresses, addr)\n\t\t\t}\n\t\t}\n\n\t\tif e.GATEWAY != \"\" {\n\t\t\tfor _, item := range strings.Split(string(e.GATEWAY), \",\") {\n\t\t\t\tgwip := net.ParseIP(strings.TrimSpace(item))\n\t\t\t\tif gwip == nil {\n\t\t\t\t\treturn nil, \"\", fmt.Errorf(\"invalid gateway address: %s\", item)\n\t\t\t\t}\n\n\t\t\t\tfor i := range n.IPAM.Addresses {\n\t\t\t\t\tif n.IPAM.Addresses[i].Address.Contains(gwip) {\n\t\t\t\t\t\tn.IPAM.Addresses[i].Gateway = gwip\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// CNI spec 0.2.0 and below supported only one v4 and v6 address\n\tif numV4 > 1 || numV6 > 1 {\n\t\tfor _, v := range types020.SupportedVersions {\n\t\t\tif n.CNIVersion == v {\n\t\t\t\treturn nil, \"\", fmt.Errorf(\"CNI version %v does not support more than 1 address per family\", n.CNIVersion)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Copy net name into IPAM so not to drag Net struct around\n\tn.IPAM.Name = n.Name\n\n\treturn n.IPAM, n.CNIVersion, nil\n}", "title": "" }, { "docid": "91482e12953c8ebe155d8fac71ce4928", "score": "0.4925877", "text": "func (c *Config) Validate(onExecution bool) error {\n\tswitch c.ImageVolumes {\n\tcase ImageVolumesMkdir:\n\tcase ImageVolumesIgnore:\n\tcase ImageVolumesBind:\n\tdefault:\n\t\treturn fmt.Errorf(\"unrecognized image volume type specified\")\n\t}\n\n\tif onExecution {\n\t\tif err := node.ValidateConfig(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := c.RootConfig.Validate(onExecution); err != nil {\n\t\treturn fmt.Errorf(\"validating root config: %w\", err)\n\t}\n\n\tif err := c.RuntimeConfig.Validate(c.SystemContext, onExecution); err != nil {\n\t\treturn fmt.Errorf(\"validating runtime config: %w\", err)\n\t}\n\n\tc.RuntimeConfig.seccompConfig.SetNotifierPath(\n\t\tfilepath.Join(filepath.Dir(c.Listen), \"seccomp\"),\n\t)\n\n\tif err := c.ImageConfig.Validate(onExecution); err != nil {\n\t\treturn fmt.Errorf(\"validating image config: %w\", err)\n\t}\n\n\tif err := c.NetworkConfig.Validate(onExecution); err != nil {\n\t\treturn fmt.Errorf(\"validating network config: %w\", err)\n\t}\n\n\tif err := c.APIConfig.Validate(onExecution); err != nil {\n\t\treturn fmt.Errorf(\"validating api config: %w\", err)\n\t}\n\n\tif !c.SELinux {\n\t\tselinux.SetDisabled()\n\t}\n\n\tif err := c.NRI.Validate(onExecution); err != nil {\n\t\treturn fmt.Errorf(\"validating NRI config: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cb0df3d30309b327cacea7142b119ce2", "score": "0.4914601", "text": "func TestIPVSMerge(t *testing.T) {\n\n\tipvsConfigured := []string{\n\t\t\"-A -t 10.131.153.120:71 -s wrr\",\n\t\t\"-a -t 10.131.153.120:71 -r 10.131.153.75:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.120:71 -r 10.131.153.76:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.120:71 -r 10.131.153.77:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.120:71 -r 10.131.153.78:71 -g -w 1\",\n\t\t\"-a -t 10.131.153.120:71 -r 10.131.153.79:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.120:71 -r 10.131.153.81:71 -g -w 0\",\n\t\t\"-A -t 10.131.153.120:8889 -s mh\",\n\t\t\"-a -t 10.131.153.120:8889 -r 10.131.153.75:8889 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.120:8889 -r 10.131.153.76:8889 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.120:8889 -r 10.131.153.77:8889 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.120:8889 -r 10.131.153.78:8889 -i -w 1 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.120:8889 -r 10.131.153.79:8889 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.120:8889 -r 10.131.153.81:8889 -i -w 0 --tun-type ipip\",\n\t\t\"-A -t 10.131.153.121:71 -s wrr\",\n\t\t\"-a -t 10.131.153.121:71 -r 10.131.153.75:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.121:71 -r 10.131.153.76:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.121:71 -r 10.131.153.77:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.121:71 -r 10.131.153.78:71 -g -w 1\",\n\t\t\"-a -t 10.131.153.121:71 -r 10.131.153.79:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.121:71 -r 10.131.153.81:71 -g -w 0\",\n\t\t\"-A -t 10.131.153.122:71 -s wrr\",\n\t\t\"-a -t 10.131.153.122:71 -r 10.131.153.75:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.122:71 -r 10.131.153.76:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.122:71 -r 10.131.153.77:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.122:71 -r 10.131.153.78:71 -g -w 1\",\n\t\t\"-a -t 10.131.153.122:71 -r 10.131.153.79:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.122:71 -r 10.131.153.81:71 -g -w 0\",\n\t\t\"-A -t 10.131.153.122:80 -s mh\",\n\t\t\"-a -t 10.131.153.122:80 -r 10.131.153.75:80 -i -w 1 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.122:80 -r 10.131.153.76:80 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.122:80 -r 10.131.153.77:80 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.122:80 -r 10.131.153.78:80 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.122:80 -r 10.131.153.79:80 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.122:80 -r 10.131.153.81:80 -i -w 0 --tun-type ipip\",\n\t\t\"-A -t 10.131.153.122:8081 -s wrr\",\n\t\t\"-a -t 10.131.153.122:8081 -r 10.131.153.75:8081 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.122:8081 -r 10.131.153.76:8081 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.122:8081 -r 10.131.153.77:8081 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.122:8081 -r 10.131.153.78:8081 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.122:8081 -r 10.131.153.79:8081 -i -w 1 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.122:8081 -r 10.131.153.81:8081 -i -w 0 --tun-type ipip\",\n\t\t\"-A -t 10.131.153.123:71 -s wrr\",\n\t\t\"-a -t 10.131.153.123:71 -r 10.131.153.75:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.123:71 -r 10.131.153.76:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.123:71 -r 10.131.153.77:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.123:71 -r 10.131.153.78:71 -g -w 1\",\n\t\t\"-a -t 10.131.153.123:71 -r 10.131.153.79:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.123:71 -r 10.131.153.81:71 -g -w 0\",\n\t\t\"-A -t 10.131.153.123:8080 -s mh -b mh-fallback,mh-port\",\n\t\t\"-a -t 10.131.153.123:8080 -r 10.131.153.75:8080 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.123:8080 -r 10.131.153.76:8080 -i -w 1 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.123:8080 -r 10.131.153.77:8080 -i -w 1 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.123:8080 -r 10.131.153.78:8080 -i -w 1 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.123:8080 -r 10.131.153.79:8080 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.123:8080 -r 10.131.153.81:8080 -i -w 0 --tun-type ipip\",\n\t\t\"-A -t 10.131.153.124:71 -s wrr\",\n\t\t\"-a -t 10.131.153.124:71 -r 10.131.153.75:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.124:71 -r 10.131.153.76:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.124:71 -r 10.131.153.77:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.124:71 -r 10.131.153.78:71 -g -w 1\",\n\t\t\"-a -t 10.131.153.124:71 -r 10.131.153.79:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.124:71 -r 10.131.153.81:71 -g -w 0\",\n\t\t\"-A -t 10.131.153.124:8080 -s mh\",\n\t\t\"-a -t 10.131.153.124:8080 -r 10.131.153.75:8080 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.124:8080 -r 10.131.153.76:8080 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.124:8080 -r 10.131.153.77:8080 -i -w 1 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.124:8080 -r 10.131.153.78:8080 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.124:8080 -r 10.131.153.79:8080 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.124:8080 -r 10.131.153.81:8080 -i -w 1 --tun-type ipip\",\n\t\t\"-A -t 10.131.153.125:71 -s wrr\",\n\t\t\"-a -t 10.131.153.125:71 -r 10.131.153.75:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.125:71 -r 10.131.153.76:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.125:71 -r 10.131.153.77:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.125:71 -r 10.131.153.78:71 -g -w 1\",\n\t\t\"-a -t 10.131.153.125:71 -r 10.131.153.79:71 -g -w 0\",\n\t\t\"-a -t 10.131.153.125:71 -r 10.131.153.81:71 -g -w 0\",\n\t\t\"-A -t 10.131.153.125:8080 -s mh -b mh-fallback,mh-port\",\n\t\t\"-a -t 10.131.153.125:8080 -r 10.131.153.75:8080 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.125:8080 -r 10.131.153.76:8080 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.125:8080 -r 10.131.153.77:8080 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.125:8080 -r 10.131.153.78:8080 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.125:8080 -r 10.131.153.79:8080 -i -w 1 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.125:8080 -r 10.131.153.81:8080 -i -w 0 --tun-type ipip\",\n\t\t\"-A -t 10.131.153.125:8081 -s wrr\",\n\t\t\"-a -t 10.131.153.125:8081 -r 10.131.153.75:8081 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.125:8081 -r 10.131.153.76:8081 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.125:8081 -r 10.131.153.77:8081 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.125:8081 -r 10.131.153.78:8081 -i -w 0 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.125:8081 -r 10.131.153.79:8081 -i -w 1 --tun-type ipip\",\n\t\t\"-a -t 10.131.153.125:8081 -r 10.131.153.81:8081 -i -w 0 --tun-type ipip\",\n\t}\n\n\tgeneratedRules := []string{\n\t\t\"-A -t 10.131.153.120:71 -s wrr\",\n\t\t\"-a -t 10.131.153.120:71 -r 10.131.153.75:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.120:71 -r 10.131.153.76:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.120:71 -r 10.131.153.77:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.120:71 -r 10.131.153.78:71 -g -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.120:71 -r 10.131.153.79:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.120:71 -r 10.131.153.81:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-A -t 10.131.153.120:8889 -s mh -b flag-1,flag-2\",\n\t\t\"-a -t 10.131.153.120:8889 -r 10.131.153.75:8889 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.120:8889 -r 10.131.153.76:8889 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.120:8889 -r 10.131.153.77:8889 -i -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.120:8889 -r 10.131.153.78:8889 -i -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.120:8889 -r 10.131.153.79:8889 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.120:8889 -r 10.131.153.81:8889 -i -w 0 -x 0 -y 0\",\n\t\t\"-A -t 10.131.153.121:71 -s wrr\",\n\t\t\"-a -t 10.131.153.121:71 -r 10.131.153.75:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.121:71 -r 10.131.153.76:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.121:71 -r 10.131.153.77:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.121:71 -r 10.131.153.78:71 -g -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.121:71 -r 10.131.153.79:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.121:71 -r 10.131.153.81:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-A -t 10.131.153.122:71 -s wrr\",\n\t\t\"-a -t 10.131.153.122:71 -r 10.131.153.75:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:71 -r 10.131.153.76:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:71 -r 10.131.153.77:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:71 -r 10.131.153.78:71 -g -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:71 -r 10.131.153.79:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:71 -r 10.131.153.81:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-A -t 10.131.153.122:80 -s mh -b flag-1,flag-2\",\n\t\t\"-a -t 10.131.153.122:80 -r 10.131.153.75:80 -i -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:80 -r 10.131.153.76:80 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:80 -r 10.131.153.77:80 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:80 -r 10.131.153.78:80 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:80 -r 10.131.153.79:80 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:80 -r 10.131.153.81:80 -i -w 0 -x 0 -y 0\",\n\t\t\"-A -t 10.131.153.122:8081 -s wrr\",\n\t\t\"-a -t 10.131.153.122:8081 -r 10.131.153.75:8081 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:8081 -r 10.131.153.76:8081 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:8081 -r 10.131.153.77:8081 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:8081 -r 10.131.153.78:8081 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:8081 -r 10.131.153.79:8081 -i -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.122:8081 -r 10.131.153.81:8081 -i -w 0 -x 0 -y 0\",\n\t\t\"-A -t 10.131.153.123:71 -s wrr\",\n\t\t\"-a -t 10.131.153.123:71 -r 10.131.153.75:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.123:71 -r 10.131.153.76:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.123:71 -r 10.131.153.77:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.123:71 -r 10.131.153.78:71 -g -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.123:71 -r 10.131.153.79:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.123:71 -r 10.131.153.81:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-A -t 10.131.153.123:8080 -s mh -b flag-1,flag-2\",\n\t\t\"-a -t 10.131.153.123:8080 -r 10.131.153.75:8080 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.123:8080 -r 10.131.153.76:8080 -i -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.123:8080 -r 10.131.153.77:8080 -i -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.123:8080 -r 10.131.153.78:8080 -i -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.123:8080 -r 10.131.153.79:8080 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.123:8080 -r 10.131.153.81:8080 -i -w 0 -x 0 -y 0\",\n\t\t\"-A -t 10.131.153.124:71 -s wrr\",\n\t\t\"-a -t 10.131.153.124:71 -r 10.131.153.75:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.124:71 -r 10.131.153.76:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.124:71 -r 10.131.153.77:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.124:71 -r 10.131.153.78:71 -g -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.124:71 -r 10.131.153.79:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.124:71 -r 10.131.153.81:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-A -t 10.131.153.124:8080 -s mh -b flag-1,flag-2\",\n\t\t\"-a -t 10.131.153.124:8080 -r 10.131.153.75:8080 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.124:8080 -r 10.131.153.76:8080 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.124:8080 -r 10.131.153.77:8080 -i -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.124:8080 -r 10.131.153.78:8080 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.124:8080 -r 10.131.153.79:8080 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.124:8080 -r 10.131.153.81:8080 -i -w 1 -x 0 -y 0\",\n\t\t\"-A -t 10.131.153.125:71 -s wrr\",\n\t\t\"-a -t 10.131.153.125:71 -r 10.131.153.75:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:71 -r 10.131.153.76:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:71 -r 10.131.153.77:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:71 -r 10.131.153.78:71 -g -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:71 -r 10.131.153.79:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:71 -r 10.131.153.81:71 -g -w 0 -x 0 -y 0\",\n\t\t\"-A -t 10.131.153.125:8080 -s mh -b flag-1,flag-2\",\n\t\t\"-a -t 10.131.153.125:8080 -r 10.131.153.75:8080 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:8080 -r 10.131.153.76:8080 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:8080 -r 10.131.153.77:8080 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:8080 -r 10.131.153.78:8080 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:8080 -r 10.131.153.79:8080 -i -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:8080 -r 10.131.153.81:8080 -i -w 0 -x 0 -y 0\",\n\t\t\"-A -t 10.131.153.125:8081 -s wrr\",\n\t\t\"-a -t 10.131.153.125:8081 -r 10.131.153.75:8081 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:8081 -r 10.131.153.76:8081 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:8081 -r 10.131.153.77:8081 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:8081 -r 10.131.153.78:8081 -i -w 0 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:8081 -r 10.131.153.79:8081 -i -w 1 -x 0 -y 0\",\n\t\t\"-a -t 10.131.153.125:8081 -r 10.131.153.81:8081 -i -w 0 -x 0 -y 0\",\n\t}\n\n\tipvsManager := IPVS{\n\t\tlogger: logrus.New(),\n\t}\n\trules := ipvsManager.merge(ipvsConfigured, generatedRules)\n\tt.Log(\"Final rules:\")\n\tfor _, r := range rules {\n\t\tt.Log(\"ipvsadm \" + r)\n\t}\n\n}", "title": "" }, { "docid": "54dd771b30fbae54582fb331cfbc1b22", "score": "0.49136084", "text": "func (c *CNIService) applyENIConfigs(subnets []CNISubnet, securityGroupID string) error {\n\tctx := context.TODO()\n\n\tfor _, s := range subnets {\n\t\teniConfig := &v1alpha1.ENIConfig{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tAPIVersion: v1alpha1.SchemeGroupVersion.String(),\n\t\t\t\tKind: \"ENIConfig\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tAnnotations: map[string]string{\n\t\t\t\t\t\"giantswarm.io/docs\": \"https://godoc.org/github.com/aws/amazon-vpc-cni-k8s/pkg/apis/crd/v1alpha1#ENIConfig\",\n\t\t\t\t},\n\t\t\t\tName: s.AZ,\n\t\t\t\tNamespace: corev1.NamespaceDefault,\n\t\t\t},\n\t\t\tSpec: v1alpha1.ENIConfigSpec{\n\t\t\t\tSecurityGroups: []string{\n\t\t\t\t\tsecurityGroupID,\n\t\t\t\t},\n\t\t\t\tSubnet: s.SubnetID,\n\t\t\t},\n\t\t}\n\n\t\terr := c.ctrlClient.Create(ctx, eniConfig)\n\t\t// check if wc k8s api is up yet\n\t\tif IsApiNotReadyYet(err) {\n\t\t\tc.log.Info(\"WC k8s api is not read yet\")\n\t\t\treturn errors.New(\"WC k8s api is not read yet\")\n\t\t} else if IsENIConfigNotRegistered(err) {\n\t\t\tc.log.Info(\"WC k8s api do not have ENIConfig CRD yet\")\n\t\t\treturn errors.New(\"WC k8s api do not have ENIConfig CRD yet\")\n\t\t} else if k8serrors.IsAlreadyExists(err) {\n\t\t\tvar latest v1alpha1.ENIConfig\n\n\t\t\terr := c.ctrlClient.Get(ctx, types.NamespacedName{Name: eniConfig.GetName(), Namespace: eniConfig.GetNamespace()}, &latest)\n\t\t\tif err != nil {\n\t\t\t\tc.log.Error(err, \"failed to get eni configs\")\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\teniConfig.ResourceVersion = latest.GetResourceVersion()\n\n\t\t\terr = c.ctrlClient.Update(ctx, eniConfig)\n\t\t\tif err != nil {\n\t\t\t\tc.log.Error(err, \"failed to update eni config\")\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\tc.log.Error(err, \"failed to create eni config\")\n\t\t\treturn err\n\t\t}\n\t}\n\tc.log.Info(\"applied ENIConfigs for aws cni\")\n\n\treturn nil\n}", "title": "" }, { "docid": "fe83c6070e58c6537d58d483d3907683", "score": "0.49063128", "text": "func TestSyncClusterCIDRCreate(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tccc *networkingv1alpha1.ClusterCIDR\n\t\twantErr bool\n\t}{\n\t\t{\n\t\t\tname: \"valid IPv4 ClusterCIDR with no NodeSelector\",\n\t\t\tccc: makeClusterCIDR(\"ipv4-ccc\", \"10.2.0.0/16\", \"\", 8, nil),\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"valid IPv4 ClusterCIDR with NodeSelector\",\n\t\t\tccc: makeClusterCIDR(\"ipv4-ccc-label\", \"10.3.0.0/16\", \"\", 8, makeNodeSelector(\"foo\", v1.NodeSelectorOpIn, []string{\"bar\"})),\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"valid IPv4 ClusterCIDR with overlapping CIDRs\",\n\t\t\tccc: makeClusterCIDR(\"ipv4-ccc-overlap\", \"10.2.0.0/24\", \"\", 8, makeNodeSelector(\"foo\", v1.NodeSelectorOpIn, []string{\"bar\"})),\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"valid IPv6 ClusterCIDR with no NodeSelector\",\n\t\t\tccc: makeClusterCIDR(\"ipv6-ccc\", \"\", \"fd00:1::/112\", 8, nil),\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"valid IPv6 ClusterCIDR with NodeSelector\",\n\t\t\tccc: makeClusterCIDR(\"ipv6-ccc-label\", \"\", \"fd00:2::/112\", 8, makeNodeSelector(\"foo\", v1.NodeSelectorOpIn, []string{\"bar\"})),\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"valid IPv6 ClusterCIDR with overlapping CIDRs\",\n\t\t\tccc: makeClusterCIDR(\"ipv6-ccc-overlap\", \"\", \"fd00:1:1::/112\", 8, makeNodeSelector(\"foo\", v1.NodeSelectorOpIn, []string{\"bar\"})),\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"valid Dualstack ClusterCIDR with no NodeSelector\",\n\t\t\tccc: makeClusterCIDR(\"dual-ccc\", \"10.2.0.0/16\", \"fd00:1::/112\", 8, nil),\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"valid DualStack ClusterCIDR with NodeSelector\",\n\t\t\tccc: makeClusterCIDR(\"dual-ccc-label\", \"10.3.0.0/16\", \"fd00:2::/112\", 8, makeNodeSelector(\"foo\", v1.NodeSelectorOpIn, []string{\"bar\"})),\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"valid Dualstack ClusterCIDR with overlapping CIDRs\",\n\t\t\tccc: makeClusterCIDR(\"dual-ccc-overlap\", \"10.2.0.0/16\", \"fd00:1:1::/112\", 8, makeNodeSelector(\"foo\", v1.NodeSelectorOpIn, []string{\"bar\"})),\n\t\t\twantErr: false,\n\t\t},\n\t\t// invalid ClusterCIDRs.\n\t\t{\n\t\t\tname: \"invalid ClusterCIDR with both IPv4 and IPv6 CIDRs nil\",\n\t\t\tccc: makeClusterCIDR(\"invalid-ccc\", \"\", \"\", 0, nil),\n\t\t\twantErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"invalid IPv4 ClusterCIDR\",\n\t\t\tccc: makeClusterCIDR(\"invalid-ipv4-ccc\", \"1000.2.0.0/16\", \"\", 8, nil),\n\t\t\twantErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"invalid IPv6 ClusterCIDR\",\n\t\t\tccc: makeClusterCIDR(\"invalid-ipv6-ccc\", \"\", \"aaaaa:1:1::/112\", 8, nil),\n\t\t\twantErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"invalid dualstack ClusterCIDR\",\n\t\t\tccc: makeClusterCIDR(\"invalid-dual-ccc\", \"10.2.0.0/16\", \"aaaaa:1:1::/112\", 8, makeNodeSelector(\"foo\", v1.NodeSelectorOpIn, []string{\"bar\"})),\n\t\t\twantErr: true,\n\t\t},\n\t}\n\t_, ctx := ktesting.NewTestContext(t)\n\tclient, cccController := newController(ctx)\n\tfor _, tc := range tests {\n\t\tcccController.clusterCIDRStore.Add(tc.ccc)\n\t\terr := cccController.syncClusterCIDR(ctx, tc.ccc.Name)\n\t\tif tc.wantErr {\n\t\t\tassert.Error(t, err)\n\t\t\tcontinue\n\t\t}\n\t\tassert.NoError(t, err)\n\t\texpectActions(t, client.Actions(), 1, \"create\", \"clustercidrs\")\n\n\t\tcreatedCCC, err := client.NetworkingV1alpha1().ClusterCIDRs().Get(context.TODO(), tc.ccc.Name, metav1.GetOptions{})\n\t\tassert.Nil(t, err, \"Expected no error getting clustercidr object\")\n\t\tassert.Equal(t, tc.ccc.Spec, createdCCC.Spec)\n\t\tassert.Equal(t, []string{clusterCIDRFinalizer}, createdCCC.Finalizers)\n\t}\n}", "title": "" }, { "docid": "5919c27e51925cc85d4db08955724570", "score": "0.49028456", "text": "func (ap *auxNetDeviceProvider) ValidConfig(rc *types.ResourceConfig) bool {\n\tfor _, selector := range rc.SelectorObjs {\n\t\tnf, ok := selector.(*types.AuxNetDeviceSelectors)\n\t\tif !ok {\n\t\t\tglog.Errorf(\"unable to convert SelectorObj to AuxNetDeviceSelectors\")\n\t\t\treturn false\n\t\t}\n\t\tif len(nf.AuxTypes) == 0 {\n\t\t\tglog.Errorf(\"AuxTypes are not specified\")\n\t\t\treturn false\n\t\t}\n\t\t// Check that only supported auxiliary device types are specified\n\t\t// TODO ATM only SFs are supported; review this in the future if new types are added\n\t\tfor _, auxType := range nf.AuxTypes {\n\t\t\tif auxType != \"sf\" {\n\t\t\t\tglog.Errorf(\"Only \\\"sf\\\" auxiliary device type currently supported\")\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "230756cb141a6ffa4041265e94650bd1", "score": "0.49021405", "text": "func getNetInfo(addrList []*localIPv4Info, proto, configuredIPv4s, port string) (netInfo cluster.NetInfo, err error) {\n\tvar ip net.IP\n\tif configuredIPv4s == \"\" {\n\t\tip, err = detectLocalIPv4(addrList)\n\t\tif err != nil {\n\t\t\treturn netInfo, err\n\t\t}\n\t\tnetInfo = *cluster.NewNetInfo(proto, ip.String(), port)\n\t\treturn\n\t}\n\n\tconfiguredList := strings.Split(configuredIPv4s, \",\")\n\tselHostname, err := selectConfiguredHostname(addrList, configuredList)\n\tif err != nil {\n\t\treturn netInfo, err\n\t}\n\n\tnetInfo = *cluster.NewNetInfo(proto, selHostname, port)\n\treturn\n}", "title": "" }, { "docid": "259ce4688406342146bd6196cf9d2e97", "score": "0.49016598", "text": "func updateNetworkInfo() {\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\tlog.Error(\"unable to get hostname: %v\", err)\n\t}\n\n\tclient.Hostname = hostname\n\tclient.IPs = nil\n\tclient.MACs = nil\n\n\tnics, err := net.Interfaces()\n\tif err != nil {\n\t\tlog.Error(\"unable to get interfaces: %v\", err)\n\t}\n\n\tfor _, nic := range nics {\n\t\tif nic.HardwareAddr.String() == \"\" {\n\t\t\t// skip localhost and other weird interfaces\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Debug(\"found mac: %v\", nic.HardwareAddr)\n\t\tclient.MACs = append(client.MACs, nic.HardwareAddr.String())\n\n\t\taddrs, err := nic.Addrs()\n\t\tif err != nil {\n\t\t\tlog.Error(\"unable to get addrs for %v: %v\", nic.HardwareAddr, err)\n\t\t}\n\n\t\tfor _, addr := range addrs {\n\t\t\tswitch addr := addr.(type) {\n\t\t\tcase *net.IPNet:\n\t\t\t\tclient.IPs = append(client.IPs, addr.IP.String())\n\t\t\tdefault:\n\t\t\t\tlog.Debug(\"unknown network type: %v\", addr)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1a798aec1180c671c79dd18efcb611f1", "score": "0.48985347", "text": "func (o PrivatePoolV1ConfigResponseOutput) NetworkConfig() NetworkConfigResponseOutput {\n\treturn o.ApplyT(func(v PrivatePoolV1ConfigResponse) NetworkConfigResponse { return v.NetworkConfig }).(NetworkConfigResponseOutput)\n}", "title": "" }, { "docid": "6e79f7b6b7bc32ae9aeeafa176e29043", "score": "0.48977727", "text": "func (s) TestParseConfigFailureCases(t *testing.T) {\n\ttests := []struct {\n\t\tdesc string\n\t\tinputConfig json.RawMessage\n\t\twantErr string\n\t}{\n\t\t{\n\t\t\tdesc: \"invalid JSON\",\n\t\t\tinputConfig: json.RawMessage(`bad bad json`),\n\t\t\twantErr: \"failed to unmarshal config\",\n\t\t},\n\t\t{\n\t\t\tdesc: \"bad apiType\",\n\t\t\tinputConfig: json.RawMessage(`\n\t\t\t{\n\t\t\t\t\"server\": {\n\t\t\t\t\t\"api_type\": 1\n\t\t\t\t}\n\t\t\t}`),\n\t\t\twantErr: \"server has apiType REST, want GRPC\",\n\t\t},\n\t\t{\n\t\t\tdesc: \"no grpc services\",\n\t\t\tinputConfig: json.RawMessage(`\n\t\t\t{\n\t\t\t\t\"server\": {\n\t\t\t\t\t\"api_type\": 2\n\t\t\t\t}\n\t\t\t}`),\n\t\t\twantErr: \"number of gRPC services in config is 0, expected 1\",\n\t\t},\n\t\t{\n\t\t\tdesc: \"too many grpc services\",\n\t\t\tinputConfig: json.RawMessage(`\n\t\t\t{\n\t\t\t\t\"server\": {\n\t\t\t\t\t\"api_type\": 2,\n\t\t\t\t\t\"grpc_services\": [{}, {}]\n\t\t\t\t}\n\t\t\t}`),\n\t\t\twantErr: \"number of gRPC services in config is 2, expected 1\",\n\t\t},\n\t\t{\n\t\t\tdesc: \"missing google grpc service\",\n\t\t\tinputConfig: json.RawMessage(`\n\t\t\t{\n\t\t\t\t\"server\": {\n\t\t\t\t\t\"api_type\": 2,\n\t\t\t\t\t\"grpc_services\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"envoyGrpc\": {}\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\twantErr: \"missing google gRPC service in config\",\n\t\t},\n\t\t{\n\t\t\tdesc: \"missing call credentials\",\n\t\t\tinputConfig: json.RawMessage(`\n\t\t\t{\n\t\t\t\t\"server\": {\n\t\t\t\t\t\"api_type\": 2,\n\t\t\t\t\t\"grpc_services\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"googleGrpc\": {\n\t\t\t\t\t\t\t\t\"target_uri\": \"foo\"\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\twantErr: \"missing call credentials in config\",\n\t\t},\n\t\t{\n\t\t\tdesc: \"missing STS call credentials\",\n\t\t\tinputConfig: json.RawMessage(`\n\t\t\t{\n\t\t\t\t\"server\": {\n\t\t\t\t\t\"api_type\": 2,\n\t\t\t\t\t\"grpc_services\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"googleGrpc\": {\n\t\t\t\t\t\t\t\t\"target_uri\": \"foo\",\n\t\t\t\t\t\t\t\t\"call_credentials\": [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\"access_token\": \"foo\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t}`),\n\t\t\twantErr: \"missing STS call credentials in config\",\n\t\t},\n\t\t{\n\t\t\tdesc: \"with no defaults\",\n\t\t\tinputConfig: json.RawMessage(`\n\t\t\t{\n\t\t\t\t\"server\": {\n\t\t\t\t\t\"api_type\": 2,\n\t\t\t\t\t\"grpc_services\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"googleGrpc\": {\n\t\t\t\t\t\t\t\t\"target_uri\": \"foo\",\n\t\t\t\t\t\t\t\t\"call_credentials\": [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\"sts_service\": {}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t}`),\n\t\t\twantErr: \"missing subjectTokenPath in STS call credentials config\",\n\t\t},\n\t}\n\n\tfor _, test := range tests {\n\t\tt.Run(test.desc, func(t *testing.T) {\n\t\t\tcfg, err := pluginConfigFromJSON(test.inputConfig)\n\t\t\tif err == nil {\n\t\t\t\tt.Fatalf(\"pluginConfigFromJSON(%q) = %v, expected to return error (%v)\", test.inputConfig, string(cfg.canonical()), test.wantErr)\n\n\t\t\t}\n\t\t\tif !strings.Contains(err.Error(), test.wantErr) {\n\t\t\t\tt.Fatalf(\"builder.ParseConfig(%q) = (%v), want error (%v)\", test.inputConfig, err, test.wantErr)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "4f5489aac5ea5c35ec61381ae95db874", "score": "0.48904037", "text": "func (n *ovn) ovnNICExternalRoutes(ovnProjectNetworksWithOurUplink map[string][]*api.Network) ([]externalSubnetUsage, error) {\n\texternalRoutes := make([]externalSubnetUsage, 0)\n\n\terr := n.state.DB.Cluster.InstanceList(context.TODO(), func(inst db.InstanceArgs, p api.Project) error {\n\t\t// Get the instance's effective network project name.\n\t\tinstNetworkProject := project.NetworkProjectFromRecord(&p)\n\t\tdevices := db.ExpandInstanceDevices(inst.Devices.Clone(), inst.Profiles)\n\n\t\t// Iterate through each of the instance's devices, looking for OVN NICs that are linked to networks\n\t\t// that use our uplink.\n\t\tfor devName, devConfig := range devices {\n\t\t\tif devConfig[\"type\"] != \"nic\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Check whether the NIC device references one of the OVN networks supplied.\n\t\t\tif !NICUsesNetwork(devConfig, ovnProjectNetworksWithOurUplink[instNetworkProject]...) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// For OVN NICs that are connected to networks that use the same uplink as we do, check\n\t\t\t// if they have any external routes configured, and if so add them to the list to return.\n\t\t\tfor _, key := range []string{\"ipv4.routes.external\", \"ipv6.routes.external\"} {\n\t\t\t\tfor _, cidr := range shared.SplitNTrimSpace(devConfig[key], \",\", -1, true) {\n\t\t\t\t\t_, ipNet, _ := net.ParseCIDR(cidr)\n\t\t\t\t\tif ipNet == nil {\n\t\t\t\t\t\t// Sip if NIC device doesn't have a valid route.\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\texternalRoutes = append(externalRoutes, externalSubnetUsage{\n\t\t\t\t\t\tsubnet: *ipNet,\n\t\t\t\t\t\tnetworkProject: instNetworkProject,\n\t\t\t\t\t\tnetworkName: devConfig[\"network\"],\n\t\t\t\t\t\tinstanceProject: inst.Project,\n\t\t\t\t\t\tinstanceName: inst.Name,\n\t\t\t\t\t\tinstanceDevice: devName,\n\t\t\t\t\t\tusageType: subnetUsageInstance,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn externalRoutes, nil\n}", "title": "" }, { "docid": "e83b61921def09bed4e6e88d1059ad5b", "score": "0.488674", "text": "func MaybeAddAppNetworkConfig(ctx *zedmanagerContext,\n\taiConfig types.AppInstanceConfig, aiStatus *types.AppInstanceStatus) {\n\n\tkey := aiConfig.Key()\n\tdisplayName := aiConfig.DisplayName\n\tlog.Functionf(\"MaybeAddAppNetworkConfig for %s displayName %s\", key,\n\t\tdisplayName)\n\n\teffectiveActivate := effectiveActivateCurrentProfile(aiConfig, ctx.currentProfile)\n\n\tchanged := false\n\tm := lookupAppNetworkConfig(ctx, key)\n\tif m != nil {\n\t\tlog.Functionf(\"appNetwork config already exists for %s\", key)\n\t\tif len(aiConfig.UnderlayNetworkList) != len(m.UnderlayNetworkList) {\n\t\t\tlog.Errorln(\"Unsupported: Changed number of underlays for \",\n\t\t\t\taiConfig.UUIDandVersion)\n\t\t\treturn\n\t\t}\n\t\tif m.Activate != effectiveActivate {\n\t\t\tlog.Functionf(\"MaybeAddAppNetworkConfig Activate changed from %v to %v\",\n\t\t\t\tm.Activate, effectiveActivate)\n\t\t\tchanged = true\n\t\t}\n\t\tif !m.GetStatsIPAddr.Equal(aiConfig.CollectStatsIPAddr) {\n\t\t\tlog.Functionf(\"MaybeAddAppNetworkConfig: stats ip changed from %s to %s\",\n\t\t\t\tm.GetStatsIPAddr.String(), aiConfig.CollectStatsIPAddr.String())\n\t\t\tchanged = true\n\t\t}\n\t\tif m.MetaDataType != aiConfig.MetaDataType {\n\t\t\tlog.Functionf(\"MaybeAddAppNetworkConfig: MetaDataType changed from %s to %s\",\n\t\t\t\tm.MetaDataType.String(), aiConfig.MetaDataType.String())\n\t\t\tchanged = true\n\t\t}\n\t\tif m.CloudInitUserData != aiConfig.CloudInitUserData {\n\t\t\tlog.Functionf(\"MaybeAddAppNetworkConfig: CloudInitUserData changed\")\n\t\t\tchanged = true\n\t\t}\n\t\tif bytes.Compare(m.CipherBlockStatus.CipherData, aiConfig.CipherBlockStatus.CipherData) != 0 {\n\t\t\tlog.Functionf(\"MaybeAddAppNetworkConfig: CipherBlockStatus.CipherData changed\")\n\t\t\tchanged = true\n\t\t}\n\t\tfor i, new := range aiConfig.UnderlayNetworkList {\n\t\t\told := m.UnderlayNetworkList[i]\n\t\t\tif !reflect.DeepEqual(new.ACLs, old.ACLs) {\n\t\t\t\tlog.Functionf(\"Under ACLs changed from %v to %v\",\n\t\t\t\t\told.ACLs, new.ACLs)\n\t\t\t\tchanged = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t} else {\n\t\tlog.Tracef(\"appNetwork config add for %s\", key)\n\t\tchanged = true\n\t}\n\tif changed {\n\t\tnc := types.AppNetworkConfig{\n\t\t\tUUIDandVersion: aiConfig.UUIDandVersion,\n\t\t\tDisplayName: aiConfig.DisplayName,\n\t\t\tActivate: effectiveActivate,\n\t\t\tGetStatsIPAddr: aiConfig.CollectStatsIPAddr,\n\t\t\tCloudInitUserData: aiConfig.CloudInitUserData,\n\t\t\tCipherBlockStatus: aiConfig.CipherBlockStatus,\n\t\t\tMetaDataType: aiConfig.MetaDataType,\n\t\t}\n\t\tnc.UnderlayNetworkList = make([]types.UnderlayNetworkConfig,\n\t\t\tlen(aiConfig.UnderlayNetworkList))\n\t\tfor i, ulc := range aiConfig.UnderlayNetworkList {\n\t\t\tul := &nc.UnderlayNetworkList[i]\n\t\t\t*ul = ulc\n\t\t}\n\t\tpublishAppNetworkConfig(ctx, &nc)\n\t}\n\tlog.Functionf(\"MaybeAddAppNetworkConfig done for %s\", key)\n}", "title": "" }, { "docid": "18007d9be9b3a5ee2ebd85ebeb1d1490", "score": "0.48866025", "text": "func getAllPossiblePrefixesIPv6(APIstub shim.ChaincodeStubInterface, prefix string) []pairKeyValue {\n\n\tip, _, _ := net.ParseCIDR(prefix) //se não for usar tenho de remover o ip\n\n\tipAndMask := strings.Split(prefix, \"/\") //[10.10.220.0] [17]\n\toctets := strings.Split(ipAndMask[0], \":\") //[10] [10] [220] [0]\n\t//compositePrefix := append(octets, ipAndMask[1]) ////[10] [10] [220] [0] / [7]\n\t//finalCompositeKey, _ := APIstub.CreateCompositeKey(\"IP\", compositePrefix)\n\n\t//TODO: check if ip is ipv4 or ipv6\n\tmask, _ := strconv.Atoi(ipAndMask[1])\n\tvar zero []string = []string{\"0\"} //TODO: mudar esta porcaria para não tar a criar um array sem razão nenhuma\n\tvar bestMatches []pairKeyValue\n\n\t//TODO: test this for the last two ifs (first two are right, so it's probably all right, but you never know)\n\tif mask < 16 {\n\t\t//Verification for combinations of the first octet\n\t\tintCombos := octetCombinationsIPv6(octets[0])\n\t\tvar combos []string\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\t//combos, _ := sliceItoa(intCombos)\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn bestMatches\n\t} else if mask >= 16 && mask < 32 {\n\t\t//Verification for combinations of the second octet\n\t\tintCombos := octetCombinationsIPv6(octets[1])\n\t\tvar combos []string\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the first octet\n\t\tintCombos = octetCombinationsIPv6(octets[0])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn bestMatches\n\t} else if mask >= 32 && mask < 48 {\n\t\t//Verification for combinations of the third octet\n\t\tintCombos := octetCombinationsIPv6(octets[2])\n\t\tvar combos []string\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], combos[i], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the second octet\n\t\tintCombos = octetCombinationsIPv6(octets[1])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the first octet\n\t\tintCombos = octetCombinationsIPv6(octets[0])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn bestMatches\n\t} else if mask >= 48 && mask < 64 {\n\t\t//Verification for combinations of the fourth octet\n\t\tintCombos := octetCombinationsIPv6(octets[3])\n\t\tvar combos []string\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], combos[i], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the third octet\n\t\tintCombos = octetCombinationsIPv6(octets[2])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], combos[i], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the second octet\n\t\tintCombos = octetCombinationsIPv6(octets[1])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the first octet\n\t\tintCombos = octetCombinationsIPv6(octets[0])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn bestMatches\n\t} else if mask >= 64 && mask < 80 {\n\t\t//Verification for combinations of the fifth octet\n\t\tintCombos := octetCombinationsIPv6(octets[4])\n\t\tvar combos []string\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], octets[3], combos[i], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the fourth octet\n\t\tintCombos = octetCombinationsIPv6(octets[3])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], combos[i], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the third octet\n\t\tintCombos = octetCombinationsIPv6(octets[2])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], combos[i], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the second octet\n\t\tintCombos = octetCombinationsIPv6(octets[1])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the first octet\n\t\tintCombos = octetCombinationsIPv6(octets[0])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn bestMatches\n\t} else if mask >= 80 && mask < 96 {\n\t\t//Verification for combinations of the sixth octet\n\t\tintCombos := octetCombinationsIPv6(octets[5])\n\t\tvar combos []string\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], octets[3], octets[4], combos[i], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the fifth octet\n\t\tintCombos = octetCombinationsIPv6(octets[4])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], octets[3], combos[i], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the fourth octet\n\t\tintCombos = octetCombinationsIPv6(octets[3])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], combos[i], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the third octet\n\t\tintCombos = octetCombinationsIPv6(octets[2])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], combos[i], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the second octet\n\t\tintCombos = octetCombinationsIPv6(octets[1])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the first octet\n\t\tintCombos = octetCombinationsIPv6(octets[0])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn bestMatches\n\t} else if mask >= 96 && mask < 112 {\n\t\t//Verification for combinations of the seventh octet\n\t\tintCombos := octetCombinationsIPv6(octets[6])\n\t\tvar combos []string\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], octets[3], octets[4], octets[5], combos[i], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the sixth octet\n\t\tintCombos = octetCombinationsIPv6(octets[5])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], octets[3], octets[4], combos[i], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the fifth octet\n\t\tintCombos = octetCombinationsIPv6(octets[4])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], octets[3], combos[i], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the fourth octet\n\t\tintCombos = octetCombinationsIPv6(octets[3])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], combos[i], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the third octet\n\t\tintCombos = octetCombinationsIPv6(octets[2])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], combos[i], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the second octet\n\t\tintCombos = octetCombinationsIPv6(octets[1])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the first octet\n\t\tintCombos = octetCombinationsIPv6(octets[0])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn bestMatches\n\t} else if mask >= 112 && mask <= 128 {\n\t\t//Verification for combinations of the eighth octet\n\t\tintCombos := octetCombinationsIPv6(octets[7])\n\t\tvar combos []string\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], octets[3], octets[4], octets[5], octets[6], combos[i]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the seventh octet\n\t\tintCombos = octetCombinationsIPv6(octets[7])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], octets[3], octets[4], octets[5], octets[6], combos[i]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the sixth octet\n\t\tintCombos = octetCombinationsIPv6(octets[5])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], octets[3], octets[4], combos[i], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the fifth octet\n\t\tintCombos = octetCombinationsIPv6(octets[4])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], octets[3], combos[i], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the fourth octet\n\t\tintCombos = octetCombinationsIPv6(octets[3])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], octets[2], combos[i], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the third octet\n\t\tintCombos = octetCombinationsIPv6(octets[2])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], octets[1], combos[i], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the second octet\n\t\tintCombos = octetCombinationsIPv6(octets[1])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{octets[0], combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Verification for combinations of the first octet\n\t\tintCombos = octetCombinationsIPv6(octets[0])\n\t\tfor c := 0; c < len(intCombos); c++ {\n\t\t\tcombos = append(combos, fmt.Sprintf(\"%x\", intCombos[c]))\n\t\t}\n\t\tfor i := 0; i < len(combos); i++ {\n\t\t\titer, err := APIstub.GetStateByPartialCompositeKey(\"IP\", []string{combos[i], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0], zero[0]})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in GetState: \" + err.Error())\n\t\t\t}\n\n\t\t\t//Copies the iterator to a more manageable structure\n\t\t\tvar kvArray []pairKeyValue\n\t\t\tfor iter.HasNext() {\n\t\t\t\taux, _ := iter.Next()\n\t\t\t\tkvAux := pairKeyValue{aux.GetKey(), aux.GetValue()}\n\t\t\t\tkvArray = append(kvArray, kvAux)\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(kvArray); j++ {\n\t\t\t\tfmt.Println(\"dentro do for do hasNext\")\n\t\t\t\tnext := kvArray[j]\n\t\t\t\tkey := next.Key\n\t\t\t\t_, splitPrefix, _ := APIstub.SplitCompositeKey(key)\n\t\t\t\trecoveredPrefix := reconstructPrefix(splitPrefix, checkIPAddressType(ip.String()))\n\t\t\t\t_, bcIP, _ := net.ParseCIDR(recoveredPrefix)\n\t\t\t\tmaskBC, _ := strconv.Atoi(strings.Split(recoveredPrefix, \"/\")[1])\n\t\t\t\tfmt.Println(\"maskBC: \" + strconv.Itoa(maskBC))\n\t\t\t\tfmt.Println(\"mask: \" + strconv.Itoa(mask))\n\n\t\t\t\tif maskBC <= mask && bcIP.Contains(ip) { // /7 /3 | /7\n\t\t\t\t\tbestMatches = append(bestMatches, next)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn bestMatches\n\t}\n\treturn bestMatches\n}", "title": "" }, { "docid": "ebbf83fb30064a458c9878ee2e64b4d2", "score": "0.4885836", "text": "func TestCNIReachability(t *testing.T) {\n\tframework.NewTest(t).\n\t\tRun(func(ctx framework.TestContext) {\n\t\t\tkenv := ctx.Environment().(*kube.Environment)\n\t\t\tcluster := kenv.KubeClusters[0]\n\t\t\t_, err := cluster.WaitUntilPodsAreReady(kube2.NewSinglePodFetch(cluster.Accessor, \"kube-system\", \"k8s-app=istio-cni-node\"))\n\t\t\tif err != nil {\n\t\t\t\tctx.Fatal(err)\n\t\t\t}\n\t\t\trctx := reachability.CreateContext(ctx, pilot.NewOrFail(t, ctx, pilot.Config{}))\n\t\t\tsystemNM := namespace.ClaimSystemNamespaceOrFail(ctx, ctx)\n\n\t\t\ttestCases := []reachability.TestCase{\n\t\t\t\t{\n\t\t\t\t\tConfigFile: \"global-mtls-on.yaml\",\n\t\t\t\t\tNamespace: systemNM,\n\t\t\t\t\tInclude: func(src echo.Instance, opts echo.CallOptions) bool {\n\t\t\t\t\t\t// Exclude calls to the headless TCP port.\n\t\t\t\t\t\tif opts.Target == rctx.Headless && opts.PortName == \"tcp\" {\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true\n\t\t\t\t\t},\n\t\t\t\t\tExpectSuccess: func(src echo.Instance, opts echo.CallOptions) bool {\n\t\t\t\t\t\tif src == rctx.Naked && opts.Target == rctx.Naked {\n\t\t\t\t\t\t\t// naked->naked should always succeed.\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If one of the two endpoints is naked, expect failure.\n\t\t\t\t\t\treturn src != rctx.Naked && opts.Target != rctx.Naked\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t\trctx.Run(testCases)\n\t\t})\n}", "title": "" }, { "docid": "e2f9a768aead7642e7d82efed33e294a", "score": "0.4878172", "text": "func (c Client) InterfaceConvertFromNetbox(nbIf models.DeviceInterface) (*types.NetworkInterface, error) {\n\tnetIf := types.NewNetworkInterface()\n\tnetIf.SetNetboxEntity(nbIf.ID, nbIf)\n\n\tif nbIf.Type != nil {\n\t\tnetIf.Type = types.InterfaceType(*nbIf.Type.Value)\n\t}\n\n\tnetIf.Enabled = nbIf.Enabled\n\n\tif nbIf.Name != nil {\n\t\tnetIf.Name = *nbIf.Name\n\t}\n\n\tif nbIf.MacAddress != nil {\n\t\tmac, err := net.ParseMAC(*nbIf.MacAddress)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tnetIf.MACAddress = mac\n\t}\n\n\tif nbIf.UntaggedVlan != nil {\n\t\tvlan, err := netboxIpam.VlanConvertFromNetbox(*nbIf.UntaggedVlan)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tnetIf.UntaggedVlan = vlan\n\t}\n\n\tif len(nbIf.TaggedVlans) > 0 {\n\t\tfor _, taggedVlan := range nbIf.TaggedVlans {\n\t\t\tvlan, err := netboxIpam.VlanConvertFromNetbox(*taggedVlan)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tnetIf.TaggedVlans = append(netIf.TaggedVlans, *vlan)\n\t\t}\n\t}\n\n\tnetIf.Tags = nbIf.Tags\n\n\tipamClient := netboxIpam.NewClient(c.client)\n\tnetboxAddresses, err := ipamClient.IPAddressFindByInterfaceID(nbIf.ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, netboxAddress := range netboxAddresses {\n\t\tvar addr types.IPAddress\n\t\tip, cidr, err := utils.SplitCidrFromIP(*netboxAddress.Address)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\taddr.Address = ip\n\t\taddr.CIDR = cidr\n\n\t\taddr.Family = types.IPAddressFamilyIPv4\n\t\tif strings.Contains(ip, \":\") {\n\t\t\taddr.Family = types.IPAddressFamilyIPv6\n\t\t}\n\n\t\tnetIf.IPAddresses = append(netIf.IPAddresses, addr)\n\t}\n\n\tnetIf.SetOriginalEntity(*netIf)\n\n\treturn netIf, nil\n}", "title": "" } ]
d54553ac74517fc6f2312ceae7e65c61
length of each side of rhombus with diagonals given
[ { "docid": "4360d755e10aac65a7738066abeda138", "score": "0.78845435", "text": "func (q *RhombusDiagonals) LengthOfRhombusSides() float64 {\n\treturn 0.5 * math.Sqrt(math.Pow(q.Diagonal1, 2) + math.Pow(q.Diagonal2, 2))\n}", "title": "" } ]
[ { "docid": "eb0beec68748dbec51e40eb5a9cfaa48", "score": "0.63381326", "text": "func (q *RhombusDiagonals) AreaOfRhombus() float64 {\n\treturn 0.5 * q.Diagonal1 * q.Diagonal2\n}", "title": "" }, { "docid": "5edcfd63a4281061a8a8d180b5e6ad97", "score": "0.6241472", "text": "func (h *Hmtx) Length() uint32 {\n\treturn uint32(4*len(h.HMetrics) + 2*len(h.LeftSideBearings))\n}", "title": "" }, { "docid": "f4f81ed2f075cfb00dbdcd8527e2a939", "score": "0.5924971", "text": "func (q *RhombusSides) AreaOfRhombus() float64 {\n\treturn q.Side * q.Height\n}", "title": "" }, { "docid": "c523b885e9ea841993d78ea78c57ffcd", "score": "0.5858444", "text": "func length(n int, w uint8) int {\n\treturn (n*int(w) + 7) / 8\n}", "title": "" }, { "docid": "ee9a968559c47e407fc225bec5973be1", "score": "0.5848509", "text": "func (q *RhombusDiagonals) PerimeterOfRhombus() float64 {\n\treturn 4 * q.LengthOfRhombusSides()\n}", "title": "" }, { "docid": "a4c0265bfac49bf28ccf56792f9a4d10", "score": "0.58383316", "text": "func Diagonal(len, wid float64) float64 {\n\tdiagonal := math.Sqrt((len * len) + (wid * wid))\n\treturn diagonal\n}", "title": "" }, { "docid": "4e375fb0a61acd553df4bbab6afd4dbe", "score": "0.5832427", "text": "func (hcube conwayHypercube) width() int {\n\tif hcube.height() == 0 {\n\t\treturn 0\n\t}\n\treturn len(hcube[0][0][0])\n}", "title": "" }, { "docid": "58063e380b2300e4168438f66f79a0c3", "score": "0.5635128", "text": "func calcRowsCols(l int) (r, c int) {\n\tr, c = int(math.Sqrt(float64(l))), 0\n\tif (r * r) == l {\n\t\tc = r\n\t} else if r*(r+1) > l {\n\t\tc = r + 1\n\t} else {\n\t\tr, c = r+1, r+1\n\t}\n\treturn r, c\n}", "title": "" }, { "docid": "52212731e07a9ac39dcd821d0464838b", "score": "0.5573493", "text": "func (hcube conwayHypercube) height() int {\n\tif hcube.depth() == 0 {\n\t\treturn 0\n\t}\n\treturn len(hcube[0][0])\n}", "title": "" }, { "docid": "2d2942ee87b68bec9dfe3c7edd5bf2c5", "score": "0.5539641", "text": "func (trk *GPXTrack) Length2D() float64 {\n\tvar l float64\n\tfor _, seg := range trk.Segments {\n\t\td := seg.Length2D()\n\t\tl += d\n\t}\n\treturn l\n}", "title": "" }, { "docid": "26b177197e14ab705f3a02bae909e688", "score": "0.55306435", "text": "func (j *Cell) Length() int {\n\tn := 0\n\tfor j != Nil {\n\t\tn, j = n+1, j.Cdr.(*Cell)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "fd4c95cf9d14c19da76270a8f9dfa8b0", "score": "0.54537696", "text": "func numIslands(grid [][]byte) int {\n\tif len(grid) == 0 {\n\t\treturn 0\n\t}\n\tm := len(grid)\n\tn := len(grid[0])\n\tf := make([]int, (m+1)*(n+1)+1)\n\ttotal := 0\n\t// islandNum := 0\n\t// tag relation\n\tfor i := 0; i < m; i++ {\n\t\tfor j := 0; j < n; j++ {\n\t\t\t// fmt.Println(grid[i][j] == '1')\n\t\t\tif grid[i][j] == '1' {\n\t\t\t\ttotal++\n\t\t\t\tf[n*i+j+1] = n*i + j + 1 // tag the 1 coordinates\n\t\t\t}\n\t\t}\n\t}\n\t// unity and find the parent\n\tfor i := 0; i < m; i++ {\n\t\tfor j := 0; j < n; j++ {\n\t\t\tif grid[i][j] == '1' {\n\t\t\t\t// check the condition of unity, it's the adjcent of 1\n\t\t\t\tif i > 0 && grid[i-1][j] == '1' {\n\t\t\t\t\tunity(f[n*i+j+1], f[n*(i-1)+j+1], f)\n\t\t\t\t}\n\t\t\t\tif i < m-1 && grid[i+1][j] == '1' {\n\t\t\t\t\tunity(f[n*i+j+1], f[n*(i+1)+j+1], f)\n\t\t\t\t}\n\t\t\t\tif j > 0 && grid[i][j-1] == '1' {\n\t\t\t\t\tunity(f[n*i+j+1], f[n*i+j-1+1], f)\n\t\t\t\t}\n\t\t\t\tif j < n-1 && grid[i][j+1] == '1' {\n\t\t\t\t\tunity(f[n*i+j+1], f[n*i+j+1+1], f)\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\t// check the set number\n\tsetCnt := 0\n\tfor i := 0; i < m; i++ {\n\t\tfor j := 0; j < n; j++ {\n\t\t\tif grid[i][j] == '1' && f[n*i+j+1] == n*i+j+1 {\n\t\t\t\tsetCnt++\n\t\t\t}\n\t\t}\n\t}\n\treturn setCnt\n\n}", "title": "" }, { "docid": "bcd263e2fbba0beeefe6825c4d4190b5", "score": "0.5432324", "text": "func (q *SquareSides) DiagonalOfSquare() float64 {\n\treturn math.Sqrt(2) * q.Side\n}", "title": "" }, { "docid": "973fa89b94b796d80346ab11a8f4189e", "score": "0.54059076", "text": "func (q *RhombusSides) PerimeterOfRhombus() float64 {\n\treturn 4 * q.Side\n}", "title": "" }, { "docid": "b230a421e91d8b68597a63ca6dcd02f3", "score": "0.5380015", "text": "func numIslands2(grid [][]byte) int {\n\tif grid == nil || len(grid) == 0 {\n\t\treturn 0\n\t}\n\n\tcount := 0\n\tm := len(grid)\n\tn := len(grid[0])\n\tvisited := make([][]bool, m)\n\tqueue := make([][2]int, 0, n)\n\tdirections := [][]int{{1, 0}, {0, 1}, {-1, 0}, {0, -1}}\n\n\tfor i := range visited {\n\t\tvisited[i] = make([]bool, n)\n\t}\n\n\tfor i := 0; i < m; i++ {\n\t\tfor j := 0; j < n; j++ {\n\t\t\tif grid[i][j] == 1 && !visited[i][j] {\n\t\t\t\tcount += 1\n\t\t\t\tvisited[i][j] = true\n\t\t\t\tqueue = append(queue, [2]int{i, j})\n\n\t\t\t\tfor len(queue) > 0 {\n\t\t\t\t\trow, column := queue[0][0], queue[0][1]\n\t\t\t\t\tqueue = queue[1:]\n\n\t\t\t\t\tfor _, direction := range directions {\n\t\t\t\t\t\tnextRow, nextColumn := row+direction[0], column+direction[1]\n\n\t\t\t\t\t\tif !isValid(grid, nextRow, nextColumn, visited) {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tqueue = append(queue, [2]int{nextRow, nextColumn})\n\t\t\t\t\t\tvisited[nextRow][nextColumn] = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn count\n}", "title": "" }, { "docid": "23db042adace9cbe4622df84c784f7e5", "score": "0.5375841", "text": "func CountSidesConc(in []string) int {\n\tvertices := parseVertices(in)\n\n\tvar count int\n\tx := drawHorizontalLine(in)\n\ty := drawVerticalLine(in)\n\tfor a := 0; a < len(vertices); a++ {\n\t\tfor b := a + 1; b < len(vertices); b++ {\n\t\t\tif !sameX(vertices[a], vertices[b]) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor c := b + 1; c < len(vertices); c++ {\n\t\t\t\tif !sameY(vertices[a], vertices[c]) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tnextVert:\n\t\t\t\tfor d := c + 1; d < len(vertices); d++ {\n\t\t\t\t\tif !sameY(vertices[b], vertices[d]) || !sameX(vertices[c], vertices[d]) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tcheckChan := make(chan bool)\n\t\t\t\t\teA, eB, eC, eD := vertices[a], vertices[b], vertices[c], vertices[d]\n\t\t\t\t\tgo func() { checkChan <- !checkLineFilling(x(eA, eB)) }()\n\t\t\t\t\tgo func() { checkChan <- !checkLineFilling(x(eC, eD)) }()\n\t\t\t\t\tgo func() { checkChan <- !checkLineFilling(y(eA, eC)) }()\n\t\t\t\t\tgo func() { checkChan <- !checkLineFilling(y(eB, eD)) }()\n\n\t\t\t\t\tfor i := 0; i < 4; i++ {\n\t\t\t\t\t\tif <-checkChan {\n\t\t\t\t\t\t\tcontinue nextVert\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcount++\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "7aeba9351339f48a5b2382c9cafaad9e", "score": "0.53292006", "text": "func printDiag(len int) {\n\tif len > 0 {\n\t\tfor row := 0; row < len; row++ {\n\t\t\tfor col := 0; col < len; col++ {\n\t\t\t\tif row == col {\n\t\t\t\t\tfmt.Print(\"\\\\\")\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Print(\" \")\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.Println()\n\t\t}\n\t} else {\n\t\tfmt.Println()\n\t}\n}", "title": "" }, { "docid": "fa93b6ad6002d3630b25808ef3135dd9", "score": "0.5324686", "text": "func (g *Grid) diag() [3]int {\n\treturn [3]int{\n\t\tg.squareAt(0, 0),\n\t\tg.squareAt(1, 1),\n\t\tg.squareAt(2, 2),\n\t}\n}", "title": "" }, { "docid": "886b1331a0315eb8c6e58565a93d634e", "score": "0.5298806", "text": "func (b Board) checkDiagonalLineCircles() bool{\n\tvar countLeft int\n\tfor xAxis:=0; xAxis < len(b.board); xAxis++{\n\t\tfor yAxis:=0; yAxis < len(b.board); yAxis++ {\n\t\t\tif xAxis == yAxis{\n\t\t\t\tif b.board[xAxis][yAxis] == \" O \"{\n\t\t\t\t\tcountLeft++\n\t\t\t\t}\n\t\t\t\tif countLeft == len(b.board) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tvar countRight int\n\tfor xAxis:=0; xAxis < len(b.board); xAxis++{\n\t\tfor yAxis:=0; yAxis < len(b.board); yAxis++ {\n\t\t\tif xAxis+yAxis == len(b.board)-1{\n\t\t\t\tif b.board[xAxis][yAxis] == \" O \"{\n\t\t\t\t\tcountRight++\n\t\t\t\t}\n\t\t\t\tif countRight == len(b.board) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0bd9b88b0cac2b6867e621a447cf8dc7", "score": "0.5277771", "text": "func PathLength(points [][]float64) float64 {\n\tvar cur_len float64 = 0\n\tfor i := 0; i < len(points) - 1; i++ {\n\t\tcur_len += Dist(points[i], points[i+1])\n\t}\n\treturn cur_len\n}", "title": "" }, { "docid": "1752ae78c9f71c9c4dcbf96cbd468df6", "score": "0.52357566", "text": "func collatz(n uint32) uint32 {\n var count uint32 = 1\n for n > 1 {\n if n % 2 == 0 {\n n = n >> 1\n } else { n = n * 3 + 1 }\n count++\n }\n return count\n}", "title": "" }, { "docid": "8831e33fbce16c3f96f2f4854774c486", "score": "0.5228723", "text": "func Problem200() {\n\n\ttest1 := [][]byte{\n\t\t{1,1,1,1,0},\n\t\t{1,1,0,1,0},\n\t\t{1,1,0,0,0},\n\t\t{0,0,0,0,0}} // 1\n\tfmt.Println(numIslands(test1))\n\n\ttest2 := [][]byte{\n\t\t{1,1,0,0,0},\n\t\t{1,1,0,0,0},\n\t\t{0,0,1,0,0},\n\t\t{0,0,0,1,1}} // 3\n\tfmt.Println(numIslands(test2))\n\n\ttest3 := [][]byte{\n\t\t{1,0,1,0,0},\n\t\t{1,1,1,0,0},\n\t\t{0,0,1,0,1},\n\t\t{0,0,0,1,1}} // 2\n\tfmt.Println(numIslands(test3))\n\n}", "title": "" }, { "docid": "b1d42f5db45820377fac28ad3710f272", "score": "0.5200839", "text": "func (ch *Cholesky) Dims() (r, c int) {\n\tif !ch.valid() {\n\t\tpanic(badCholesky)\n\t}\n\tr, c = ch.chol.Dims()\n\treturn r, c\n}", "title": "" }, { "docid": "4f39e084b0323914c64fe8824fac97f4", "score": "0.5193554", "text": "func (g *Grid) adiag() [3]int {\n\treturn [3]int{\n\t\tg.squareAt(2, 0),\n\t\tg.squareAt(1, 1),\n\t\tg.squareAt(0, 2),\n\t}\n}", "title": "" }, { "docid": "957372a16408457a7fd4f695fc5960a4", "score": "0.51799804", "text": "func (h *Grid) horizontalSpacing() float64 {\n return 2 * h.radius * math.Cos(hexTriangleAngle)\n}", "title": "" }, { "docid": "beef3253943c722625d3b95dde1ff790", "score": "0.51752716", "text": "func (h *Hexagon) Perimeter() float64 {\n\treturn 3 * math.Sqrt(3) / 2 * math.Pow(h.side, 2)\n}", "title": "" }, { "docid": "7bdc69c72f3a3f4c439b815c800cd476", "score": "0.51526713", "text": "func (v *Vector2D) Length() (float64, error) {\n\tx, y := v.GetComponents()\n\tr := numeric.Nrm2(x, y)\n\n\tif numeric.IsOverflow(r) {\n\t\treturn 0, numeric.ErrOverflow\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "74a8d44ea35ee6e7557e93af87324afa", "score": "0.5148135", "text": "func (ch *BandCholesky) Dims() (r, c int) {\n\tif !ch.valid() {\n\t\tpanic(badCholesky)\n\t}\n\tr, c = ch.chol.Dims()\n\treturn r, c\n}", "title": "" }, { "docid": "fbd3a8a6bdcb6cef2889cfa27a26672e", "score": "0.51171297", "text": "func count_area(n uint) float64 {\n//\tif n_line == 3 {\n//\t\treturn math.Sqrt(1 - 0.5 * 0.5) * 0.5 * 3\n\t//\t}\n\tc1 := math.Sqrt(1 - 0.5 * 0.5) * 2\n\th1 := 0.5\n//\tvar a, b float64\n\tvar s float64 = math.Sqrt(1 - 0.5 * 0.5) * 0.5 * 3\n\tvar n_add float64 = 3\n\tfor i := uint(1); i < n; i++ {\n\t\ta := c1\n\t\tb := 1 - h1\n\t\tc1 = math.Sqrt(0.25*a*a + b*b)\n\t\th1 = math.Sqrt(1 - c1*c1*0.25)\n\t\ts = s + 0.5 * a * b * n_add\n\t\tn_add = n_add * 2\n\t\tfmt.Printf(\"s = %.10f, a = %.10f b = %.10f, c1 = %.10f, h1 = %.10f, n_add = %.0f\\n\", s, a, b, c1, h1, n_add)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "fa7ea61407ed036fb6a3c590e6d00f7d", "score": "0.51160926", "text": "func rhombusInRectangle() *Statement {\n\tproblem := geom.NewBoard()\n\tpt1 := geom.NewPoint(0, 0)\n\tpt2 := geom.NewPoint(3, 0)\n\tpt3 := geom.NewPoint(3, math.Sqrt(3))\n\tpt4 := geom.NewPoint(0, math.Sqrt(3))\n\ts1 := geom.NewSegment(pt1, pt2)\n\ts2 := geom.NewSegment(pt2, pt3)\n\ts3 := geom.NewSegment(pt3, pt4)\n\ts4 := geom.NewSegment(pt4, pt1)\n\tproblem.AddPoint(pt1)\n\tproblem.AddPoint(pt2)\n\tproblem.AddPoint(pt3)\n\tproblem.AddPoint(pt4)\n\tproblem.AddSegment(s1)\n\tproblem.AddSegment(s2)\n\tproblem.AddSegment(s3)\n\tproblem.AddSegment(s4)\n\n\ttarget := NewTarget()\n\tpt5 := geom.NewPoint(2, 0)\n\tpt6 := geom.NewPoint(1, math.Sqrt(3))\n\tl1 := geom.NewLineFromTwoPoints(pt1, pt6)\n\tl2 := geom.NewLineFromTwoPoints(pt5, pt3)\n\ttarget.Lines.Add(l1)\n\ttarget.Lines.Add(l2)\n\n\tsequences := map[string]string{\"E\": \"+II\"}\n\treturn NewStatement(problem, target, sequences, \"1.5 Rhombus in Rectangle\")\n}", "title": "" }, { "docid": "6b91ad8fb672405fb2326ae90e0650a5", "score": "0.5093661", "text": "func (q *SquareDiagonals) SideOfSquare() float64 {\n\treturn q.Diagonal / math.Sqrt(2)\n}", "title": "" }, { "docid": "bc8d4f717ea988cb91aefe3407f6ac2c", "score": "0.5064567", "text": "func (l Length) Hectometers() float64 {\n\treturn float64(l / Hectometer)\n}", "title": "" }, { "docid": "89749456563145eb1b113698ccecbe06", "score": "0.50626534", "text": "func (sym *SymmetricMatrix) Length() int {\n\treturn sym.length\n}", "title": "" }, { "docid": "2aa8189ba9f126c6fbfd5ca0105170b7", "score": "0.5032148", "text": "func (ch *PivotedCholesky) Dims() (r, c int) {\n\tif ch.chol == nil {\n\t\tpanic(badCholesky)\n\t}\n\tr, c = ch.chol.Dims()\n\treturn r, c\n}", "title": "" }, { "docid": "d0ee235b5754fa6fe903daded0c3b1a1", "score": "0.5020599", "text": "func (t *Tree) Length() float64 {\n\tvar length float64\n\tfor _, e := range t.edges {\n\t\tlength = length + e.Length()\n\t}\n\treturn length\n}", "title": "" }, { "docid": "044f63d4f060c3673e6bcb2540f2795e", "score": "0.5015183", "text": "func (board *Board) countNeighbors(row, col int) int {\n\tvar kern = [][]bool{{true, true, true},\n\t\t{true, false, true}, // kernal for convolution\n\t\t{true, true, true}}\n\n\tcount := 0 // innitalize a var to count living neighbors\n\n\tfor i := -1; i <= 1; i++ { // check above and below\n\t\tfor j := -1; j <= 1; j++ { // check left and right\n\t\t\tif kern[i+1][j+1] && board.isAlive(row+i, col+j) {\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "1b0a2b1634d8bab834013d60deb18cf9", "score": "0.499879", "text": "func bitlength512Vartime(a *[8]uint64) int {\n\tm := -(a[7] >> 63)\n\tfor i := 7; i >= 0; i -- {\n\t\taw := a[i] ^ m\n\t\tif aw != 0 {\n\t\t\treturn (i << 6) + 64 - bits.LeadingZeros64(aw)\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "aaacec0d71b92e0970e8c4e1cf29e54f", "score": "0.49969113", "text": "func routeSegmentLength ( startNode, endNode NodeInstance ) ( length float64 ) {\n\n//\tIt doesn't matter which NOde is considered the Start / End\n\n\tendLength := endNode.ToLeftEndNode\n\tstartLength := startNode.ToLeftEndNode\n\n\tlength = math.Abs ( endLength - startLength )\n\n\treturn\n}", "title": "" }, { "docid": "e7a7f272fc3a3ad5a9dcd41fd2136d7e", "score": "0.49967864", "text": "func (q *SquareDiagonals) PerimeterOfSquare() float64 {\n\treturn 4 * q.SideOfSquare()\n}", "title": "" }, { "docid": "7f2be8e48bb04c99d383cea5267def71", "score": "0.498403", "text": "func maxAreaOfIsland(grid [][]int) int {\n\tR, C := len(grid), len(grid[0])\n\tres := 0\n\n\tfor r := 0; r < R; r++ {\n\t\tfor c := 0; c < C; c++ {\n\t\t\tif grid[r][c] == 1 {\n\t\t\t\tres = max(res, dfs(grid, r, c, R, C)+1)\n\t\t\t}\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "5492f98027b58d84c01817d9dac50051", "score": "0.49738616", "text": "func generateSegments() []segment {\n\tvar segments []segment\n\t// generate vertical segments\n\tfor c := uint(0); c < numCols; c++ {\n\t\tfor r := uint(0); r < numRows-segmentLength+1; r++ {\n\t\t\ts := segment{{c, r}, {c, r + 1}, {c, r + 2}, {c, r + 3}}\n\t\t\tsegments = append(segments, s)\n\t\t}\n\t}\n\t// generate horizontal segments\n\tfor c := uint(0); c < numCols-segmentLength+1; c++ {\n\t\tfor r := uint(0); r < numRows; r++ {\n\t\t\ts := segment{{c, r}, {c + 1, r}, {c + 2, r}, {c + 3, r}}\n\t\t\tsegments = append(segments, s)\n\t\t}\n\t}\n\t// generate the bottom left to top right diagonal segments\n\tfor c := uint(0); c < numCols-segmentLength+1; c++ {\n\t\tfor r := uint(0); r < numRows-segmentLength+1; r++ {\n\t\t\ts := segment{{c, r}, {c + 1, r + 1}, {c + 2, r + 2}, {c + 3, r + 3}}\n\t\t\tsegments = append(segments, s)\n\t\t}\n\t}\n\t// generate the top left to bottom right diagonal segments\n\tfor c := uint(0); c < numCols-segmentLength+1; c++ {\n\t\tfor r := segmentLength - 1; r < numRows; r++ {\n\t\t\ts := segment{{c, r}, {c + 1, r - 1}, {c + 2, r - 2}, {c + 3, r - 3}}\n\t\t\tsegments = append(segments, s)\n\t\t}\n\t}\n\treturn segments\n}", "title": "" }, { "docid": "8f814b5e1dc8528c3e3045ed8a3c75a4", "score": "0.4964877", "text": "func shortestPathBinaryMatrix(grid [][]int) int {\n\n}", "title": "" }, { "docid": "19f484450c1b6c163f1898e42b38f77d", "score": "0.49645054", "text": "func (l Length) Cables() float64 {\n\treturn float64(l / Cable)\n}", "title": "" }, { "docid": "ea085d9050158f5e848d3825699690eb", "score": "0.49627295", "text": "func length(v []feature) int {\n\tvecs := make(map[string]*step.Vector)\n\tfor _, f := range v {\n\t\tvec, ok := vecs[f.Chr]\n\t\tif !ok {\n\t\t\tvar err error\n\t\t\tvec, err = step.New(f.Start, f.End, stepBool(false))\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tvec.Relaxed = true\n\t\t\tvecs[f.Chr] = vec\n\t\t}\n\t\tvec.SetRange(f.Start, f.End, stepBool(true))\n\t}\n\tvar len int\n\tfor _, vec := range vecs {\n\t\tvec.Do(func(start, end int, e step.Equaler) {\n\t\t\tif e.(stepBool) {\n\t\t\t\tlen += end - start\n\t\t\t}\n\t\t})\n\t}\n\treturn len\n}", "title": "" }, { "docid": "c3458135336d2b87f4be7d55a8418983", "score": "0.4960995", "text": "func (vec Vec3) len() float64 {\n\treturn math.Sqrt(float64(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]))\n}", "title": "" }, { "docid": "c12ebe2f06c1dfe39f95a162cb4e46ba", "score": "0.49600184", "text": "func (hcube conwayHypercube) depth() int {\n\tif hcube.hyperdepth() == 0 {\n\t\treturn 0\n\t}\n\treturn len(hcube[0])\n}", "title": "" }, { "docid": "6c45bb9f23defd670e2f56e472743fe8", "score": "0.49561596", "text": "func (seg *GPXTrackSegment) Length2D() float64 {\n\t// TODO: There should be a better way to do this:\n\tpoints := make([]Point, len(seg.Points))\n\tfor pointNo, point := range seg.Points {\n\t\tpoints[pointNo] = point.Point\n\t}\n\treturn Length2D(points)\n}", "title": "" }, { "docid": "e26c39d2a0ac2e5b67c4f294fb875433", "score": "0.49556002", "text": "func totalNQueens(n int) int {\n\tcolUsed := make([]bool, n) // colUsed[i]==true 表示第i列已经有皇后了,下同\n\tmainDiagUsed := make([]bool, 2*n-1)\n\tsubDiagUsed := make([]bool, 2*n-1)\n\tcount := 0\n\tvar dfs func(row int)\n\tdfs = func(row int) {\n\t\t// 边界条件,遍历到最后一行\n\t\tif row == n {\n\t\t\tcount++\n\t\t\treturn\n\t\t}\n\t\tfor col := 0; col < n; col++ {\n\t\t\tif !colUsed[col] && !mainDiagUsed[row-col+n-1] && !subDiagUsed[row+col] {\n\t\t\t\t// 把\"Q\"放在(row,col)处\n\t\t\t\tcolUsed[col] = true\n\t\t\t\tmainDiagUsed[row-col+n-1] = true\n\t\t\t\tsubDiagUsed[row+col] = true\n\t\t\t\t// 进入下一层\n\t\t\t\tdfs(row + 1)\n\t\t\t\t// 回溯\n\t\t\t\tcolUsed[col] = false\n\t\t\t\tmainDiagUsed[row-col+n-1] = false\n\t\t\t\tsubDiagUsed[row+col] = false\n\t\t\t}\n\t\t}\n\t}\n\tdfs(0)\n\treturn count\n}", "title": "" }, { "docid": "5f124bf783003c5f8af077a92ed50503", "score": "0.49513838", "text": "func (b board) countNeighbors(rNum int, cNum int) (count uint) {\n\tfor r := -1; r <= 1; r++ {\n\t\tfor c := -1; c <= 1; c++ {\n\t\t\tif r == 0 && c == 0 {\n\t\t\t\tcontinue // don't count yourself\n\t\t\t}\n\t\t\tif b.isAlive(rNum+r, cNum+c) {\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "838d6856ab6d61af8c879de58856c20f", "score": "0.49423662", "text": "func diagonalDifference(arr [][]int32) int32 {\r\n // Write your code here\r\n var d1, d2 int32 = 0, 0\r\n n := len(arr)\r\n var diff float64\r\n \r\n for i, _ := range arr {\r\n d1 += arr[i][i]\r\n d2 += arr[i][n - i -1]\r\n diff = math.Abs(float64(d1 - d2))\r\n }\r\n return int32(diff)\r\n}", "title": "" }, { "docid": "64f04e025b136732276ff96eb5ee67f3", "score": "0.49366495", "text": "func (q *SquareDiagonals) AreaOfSquare() float64 {\n\treturn math.Pow(q.SideOfSquare(), 2)\n}", "title": "" }, { "docid": "b21e8c499bea7f2edfc6699fd984147f", "score": "0.4935529", "text": "func (hcube conwayHypercube) surrounds(x, y, z, w int) int {\n\tresult := 0\n\toffsets := []int{-1, 0, 1}\n\tboolToInt := func(b bool) int {\n\t\tif b {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}\n\n\tfor _, ox := range offsets {\n\t\tfor _, oy := range offsets {\n\t\t\tfor _, oz := range offsets {\n\t\t\t\tfor _, ow := range offsets {\n\t\t\t\t\tif ox == 0 && oy == 0 && oz == 0 && ow == 0 {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tresult = result + boolToInt(hcube.at(x+ox, y+oy, z+oz, w+ow))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "36a29558f35dcd897b81c88c9d42024a", "score": "0.49133757", "text": "func formingMagicSquare(s [][]int32) int32 {\n\n}", "title": "" }, { "docid": "0d3a2ccc4a78682d3f256aac9203e292", "score": "0.4900789", "text": "func rightTriangleCount(p int, channel chan rightTriangleCountHolder) {\n\tbuffer := make([]rightTriangle, 0)\n\tfor a := 1; a < p; a++ {\n\t\tfor b := a + 1; b < p; b++ {\n\t\t\tif a+b >= p {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfor c := b + 1; c < p; c++ {\n\t\t\t\tif sum := a + b + c; sum > p {\n\t\t\t\t\tbreak\n\t\t\t\t} else if sum < p {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tt := rightTriangle{a, b, c}\n\t\t\t\tif t.isValid() {\n\t\t\t\t\tbuffer = append(buffer, t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tchannel <- rightTriangleCountHolder{len(buffer), p}\n}", "title": "" }, { "docid": "fffabf1cf9b471db8efa23971759331c", "score": "0.48943597", "text": "func (b *Board) NumCols() int {\n return len(b.cell[0])\n}", "title": "" }, { "docid": "5c29516b4303ee6f73c0dc8d04d0a9ce", "score": "0.48911744", "text": "func (hcube conwayHypercube) hyperdepth() int {\n\treturn len(hcube)\n}", "title": "" }, { "docid": "f89acae7eabf82dcedd0e31e01033302", "score": "0.48905578", "text": "func (r Rectangle) size() float64 {\n\tn1, n2 := r.neighbors(r.P1)\n\treturn distance(r.P1, n1) * distance(r.P1, n2)\n}", "title": "" }, { "docid": "6b3acf2251f356c5268efcb8eab82b45", "score": "0.4884162", "text": "func CollatzConjecture(n int) (int, error) {\n\tif n <= 0 {\n\t\treturn 0, errors.New(\"Not able to calculate the number of steps for n <= 0\")\n\t}\n\n\tcount := 0\n\tdummyVar := n\n\n\tfor dummyVar > 1 {\n\t\tif dummyVar%2 == 0 {\n\t\t\tdummyVar /= 2\n\t\t} else {\n\t\t\tdummyVar = 3*dummyVar + 1\n\t\t}\n\t\tcount++\n\t}\n\n\treturn count, nil\n}", "title": "" }, { "docid": "36d650ba30c3e6b0cd73110576d44530", "score": "0.48836887", "text": "func (s sequence) Length() int {\n\ttotal := 0\n\tfor _, segment := range s.data {\n\t\ttotal += segment.Length()\n\t}\n\treturn total\n}", "title": "" }, { "docid": "a6db799c8114ae91efda578ed4e0ec36", "score": "0.48756838", "text": "func stepsCount(n int, m int) int {\n\tarr := make([]int, n+1)\n\tarr[0] = 1\n\tarr[1] = 1\n\tfor i := 2; i <= n; i++ {\n\t\tarr[i] = 0\n\t\tj := 1\n\t\tfor j <= m && j <= i {\n\t\t\tarr[i] += arr[i-j]\n\t\t\tj++\n\t\t}\n\t}\n\treturn arr[n]\n}", "title": "" }, { "docid": "df28df3c607b2e2004b17fd41a40a1e2", "score": "0.48705578", "text": "func (mat General64) Dims() (r, c int) {\n\treturn mat.Rows, mat.Cols\n}", "title": "" }, { "docid": "8e9fab91221109f46fd4284aaa1c3a1e", "score": "0.486933", "text": "func (h *Grid) NumTiles() int {\n return len(h.t)\n}", "title": "" }, { "docid": "27e1a98373220bfbe2853e985aa6a5ac", "score": "0.48672256", "text": "func quad_length(a, b int) int {\n\tfor i := 0; ; i++ {\n\t\tv := i*i + a*i + b\n\t\tif primes[v] == 0 {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "8bf86d2129b4e908cbd611f76e15341e", "score": "0.4864526", "text": "func (array sparseDiagF64Matrix) Cols() int {\n\treturn array.shape[1]\n}", "title": "" }, { "docid": "e4a3f7b16993da775283ffff94fc254e", "score": "0.48635998", "text": "func (sd *SegmentationDescriptor) length() int {\n\tlength := 32 // identifier\n\tlength += 32 // segmentation_event_id\n\tlength++ // segmentation_event_cancel_indicator\n\tlength += 7 // reserved\n\n\t// if segmentation_event_cancel_indicator == 0\n\tif !sd.SegmentationEventCancelIndicator {\n\t\tlength++ // program_segmentation_flag\n\t\tlength++ // segmentation_duration_flag\n\t\tlength++ // delivery_not_restricted_flag\n\t\tlength += 5 // delivery restriction flags or reserved\n\n\t\t// if program_segmentation_flag == 0\n\t\tif !sd.ProgramSegmentationFlag() {\n\t\t\tlength += 8 // component_count\n\n\t\t\t// for i=0 to component_count\n\t\t\tfor range sd.Components {\n\t\t\t\tlength += 8 // component_tag\n\t\t\t\tlength += 7 // reserved\n\t\t\t\tlength += 33 // pts_offset\n\t\t\t}\n\t\t}\n\t\tif sd.SegmentationDurationFlag() {\n\t\t\tlength += 40 // segmentation_duration\n\t\t}\n\t\tlength += 8 // segmentation_upid_type\n\t\tlength += 8 // segmentation_upid_length\n\t\tlength += sd.SegmentationUpidLength() * 8 // segmentation_upid() (bytes -> bits)\n\t\tlength += 8 // segmentation_type_id\n\t\tlength += 8 // segment_num\n\t\tlength += 8 // segments_expected\n\n\t\tif sd.SubSegmentNum != nil {\n\t\t\tlength += 8 // sub_segment_num\n\t\t}\n\t\tif sd.SubSegmentsExpected != nil {\n\t\t\tlength += 8 // sub_segments_expected\n\t\t}\n\t}\n\n\treturn length / 8\n}", "title": "" }, { "docid": "5c1ea1260a4edb2e24d436443e29f36f", "score": "0.48625445", "text": "func fourConnected(symbol rune) bool {\n\t// check horizontal\n\tfor row := 0; row < gridSize; row++ {\n\t\tcontiguousCount := 0\n\t\tfor col := 0; col < gridSize && contiguousCount < 4; col++ {\n\t\t\tcontiguousCount = handleMatch(contiguousCount, grid[row][col].val, symbol)\n\t\t}\n\t\tif contiguousCount == 4 {\n\t\t\treturn true\n\t\t}\n\t}\n\n\t// check vertical\n\tfor col := 0; col < gridSize; col++ {\n\t\tcontiguousCount := 0\n\t\tfor row := 0; row < gridSize && contiguousCount < 4; row++ {\n\t\t\tcontiguousCount = handleMatch(contiguousCount, grid[row][col].val, symbol)\n\t\t}\n\t\tif contiguousCount == 4 {\n\t\t\treturn true\n\t\t}\n\t}\n\n\t// check down-right angle\n\t// 0,0 1,1 2,2 3,3 4,4, etc.\n\tcontiguousCount := 0\n\tfor col, row := 0, 0; col < gridSize && contiguousCount < 4; col, row = col+1, row+1 {\n\t\tcontiguousCount = handleMatch(contiguousCount, grid[row][col].val, symbol)\n\t\tif contiguousCount == 4 {\n\t\t\treturn true\n\t\t}\n\t}\n\n\t//check down-left angles\n\t// 0,4 1,3 2,2 3,1 4,0, etc.\n\tcontiguousCount = 0\n\tfor col, row := 4, 0; col >= 0 && contiguousCount < 4; col, row = col-1, row+1 {\n\t\tcontiguousCount = handleMatch(contiguousCount, grid[row][col].val, symbol)\n\t\tif contiguousCount == 4 {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f12f62e57a1c523849201ff3a8762d3a", "score": "0.48623052", "text": "func (bm Bitmap64) Length() uint {\n\treturn uint(64*len(bm)) - uint(bits.LeadingZeros64(bm[len(bm)-1]) - 1)\n}", "title": "" }, { "docid": "7f7bb94f62af4b4b7468b42b384dc93e", "score": "0.48619863", "text": "func generateH(parameters Parameters) [][]int {\n\tvar H [][]int\n\tvar hSeed int64\n\tvar colOrder []int\n\n\thSeed = int64(parameters.seed)\n\tk := parameters.m / parameters.wc\n\n\tH = make([][]int, parameters.m)\n\tfor i := range H {\n\t\tH[i] = make([]int, parameters.n)\n\t}\n\n\tfor i := 0; i < k; i++ {\n\t\tfor j := i * parameters.wr; j < (i+1)*parameters.wr; j++ {\n\t\t\tH[i][j] = 1\n\t\t}\n\t}\n\n\tfor i := 1; i < parameters.wc; i++ {\n\t\tcolOrder = nil\n\t\tfor j := 0; j < parameters.n; j++ {\n\t\t\tcolOrder = append(colOrder, j)\n\t\t}\n\n\t\trand.Seed(hSeed)\n\t\trand.Shuffle(len(colOrder), func(i, j int) {\n\t\t\tcolOrder[i], colOrder[j] = colOrder[j], colOrder[i]\n\t\t})\n\t\thSeed--\n\n\t\tfor j := 0; j < parameters.n; j++ {\n\t\t\tindex := (colOrder[j]/parameters.wr + k*i)\n\t\t\tH[index][j] = 1\n\t\t}\n\t}\n\n\treturn H\n}", "title": "" }, { "docid": "0ddfd8daaafaa8c33097d65e25a19b5f", "score": "0.48618788", "text": "func Len(n uint) int {\n\t// amd64/v1,amd64/v2:\"BSRQ\"\n\t// amd64/v3: \"LZCNTQ\"\n\t// s390x:\"FLOGR\"\n\t// arm:\"CLZ\" arm64:\"CLZ\"\n\t// mips:\"CLZ\"\n\t// wasm:\"I64Clz\"\n\t// ppc64x:\"SUBC\",\"CNTLZD\"\n\treturn bits.Len(n)\n}", "title": "" }, { "docid": "d8de7e4fcc35843f7545d0166d3fb22f", "score": "0.48560536", "text": "func CollatzSteps(n int) int {\n\tvar s int\n\tfor s = 0; n != 1; s++ {\n\t\tif n % 2 == 0 {\n\t\t\tn = n / 2\n\t\t} else {\n\t\t\tn = (3 * n) + 1\n\t\t}\n\t}\n\treturn s\n}", "title": "" }, { "docid": "675cb9236da189c05fa44c089f0e556e", "score": "0.48455817", "text": "func totalNQueens(n int) int {\n\tcol := make([]int, n)\n\tdiag := make([]int, n*2)\n\tdiag2 := make([]int, n*2)\n\tvar count int\n\tvar search func(y int)\n\tsearch = func(y int) {\n\t\tif y == n {\n\t\t\tcount++\n\t\t\treturn\n\t\t}\n\n\t\tfor x := 0; x < n; x++ {\n\t\t\tif col[x] != 0 || diag[x+y] != 0 || diag2[x-y+n-1] != 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcol[x], diag[x+y], diag2[x-y+n-1] = 1, 1, 1\n\t\t\tsearch(y + 1)\n\t\t\tcol[x], diag[x+y], diag2[x-y+n-1] = 0, 0, 0\n\t\t}\n\t}\n\n\tsearch(0)\n\treturn count\n}", "title": "" }, { "docid": "867bf5e4db353296307e32877ed5704e", "score": "0.4840037", "text": "func getColAndRow(size int) (c int, r int) {\n\tc = int(math.Sqrt(float64(size)))\n\tr = c\n\tif r*c < size {\n\t\tc++\n\t}\n\tif r*c < size {\n\t\tr++\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e247ac0e90bc214e41d39c5fd6f2204d", "score": "0.4838511", "text": "func Solution(H []int) int {\n\t// write your code in Go 1.4\n\tvar wall wallStack\n\tbricks := 0\n\tfor _, v := range H {\n\t\tif wall.empty() {\n\t\t\twall.push(v)\n\t\t} else {\n\t\t\tfor !wall.empty() && v < wall.peek() {\n\t\t\t\tbricks++\n\t\t\t\twall.pop()\n\t\t\t}\n\t\t\tif wall.empty() {\n\t\t\t\twall.push(v)\n\t\t\t}\n\t\t\tif !wall.empty() && v > wall.peek() {\n\t\t\t\twall.push(v)\n\t\t\t}\n\t\t}\n\t}\n\treturn bricks + wall.len()\n}", "title": "" }, { "docid": "159104a72730383f984c857920a5c74f", "score": "0.48310104", "text": "func row(square int) int {\n\treturn square >> 3\n}", "title": "" }, { "docid": "4215dcbccb9da13b664ad65f6a577d05", "score": "0.48279795", "text": "func diagonalDifference(arr [][]int32) int32 {\n\t// Write your code here\n\tvar sum1, sum2 int32\n\tarrLen := len(arr[0])\n\n\tfor idx, innerArr := range arr {\n\t\tsum1 = sum1 + innerArr[idx]\n\t\tsum2 = sum2 + innerArr[arrLen-idx-1]\n\t}\n\n\treturn int32(math.Abs(float64(sum1 - sum2)))\n}", "title": "" }, { "docid": "546a59265d02068a8892553c3845af87", "score": "0.48251918", "text": "func findLength(A []int, B []int) int {\n\t// Bottom up approach, Dynamic Programming\n\t// tabulation method\n\t// for every A that matches a B, we need to know the count at the previous pair.\n\t// if A[3] == B[2], we are going to set lcs[3][2] = 1 + lcs[2][1]\n\t// if A[2] == B[1] then that would be 2\n\t// check every A against every B\n\t// if a pair match, set the value at that match to 1 + the value at the previous pair\n\tm := len(A)\n\tn := len(B)\n\tlcs := make([][]int, m+1)\n\tfor i := range lcs {\n\t\tlcs[i] = make([]int, n+1)\n\t}\n\tmax := 0\n\tfor i := 1; i <= m; i++ {\n\t\tfor j := 1; j <= n; j++ {\n\t\t\tif A[i-1] == B[j-1] {\n\t\t\t\tlcs[i][j] = lcs[i-1][j-1] + 1\n\t\t\t\tif lcs[i][j] > max {\n\t\t\t\t\tmax = lcs[i][j]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn max\n}", "title": "" }, { "docid": "2d5c5bdaf6f2369f6f3712121ed1fb93", "score": "0.48225355", "text": "func col(square int) int {\n\treturn square & 7\n}", "title": "" }, { "docid": "7131b9e751138d5c6c58bf029aa071a0", "score": "0.48179117", "text": "func maxAreaOfIsland2(grid [][]int) int {\n\tR, C := len(grid), len(grid[0])\n\tres := 0\n\n\tfor r := 0; r < R; r++ {\n\t\tfor c := 0; c < C; c++ {\n\t\t\tif grid[r][c] == 1 {\n\t\t\t\tres = max(res, bfs(grid, r, c, R, C))\n\t\t\t}\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "6c4c224d8cd0495aa7f484fd804b3662", "score": "0.48085833", "text": "func BenchmarkNumIslands(b *testing.B) {\n\ttype bench struct {\n\t\tname string\n\t\tinput [][]byte\n\t}\n\tbenches := []bench{\n\t\t{\n\t\t\tname: \"5x5\",\n\t\t\tinput: [][]byte{\n\t\t\t\t{'1', '1', '1', '1', '0'},\n\t\t\t\t{'0', '0', '0', '0', '0'},\n\t\t\t\t{'1', '1', '0', '1', '0'},\n\t\t\t\t{'1', '1', '0', '0', '1'},\n\t\t\t\t{'0', '0', '0', '0', '0'},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"10x10\",\n\t\t\tinput: [][]byte{\n\t\t\t\t{'1', '1', '1', '1', '0', '1', '1', '1', '1', '0'},\n\t\t\t\t{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0'},\n\t\t\t\t{'1', '1', '0', '1', '0', '1', '1', '1', '1', '0'},\n\t\t\t\t{'1', '1', '0', '0', '1', '1', '1', '0', '0', '1'},\n\t\t\t\t{'0', '0', '0', '0', '0', '1', '1', '0', '0', '1'},\n\t\t\t\t{'1', '1', '1', '1', '0', '1', '1', '1', '1', '0'},\n\t\t\t\t{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0'},\n\t\t\t\t{'1', '1', '0', '1', '0', '1', '1', '1', '1', '0'},\n\t\t\t\t{'1', '1', '0', '0', '1', '1', '1', '0', '0', '1'},\n\t\t\t\t{'0', '0', '0', '0', '0', '1', '1', '0', '0', '1'},\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, bc := range benches {\n\t\tb.Run(\"numIslandsA/\"+bc.name, func(b *testing.B) {\n\t\t\tfor n := 0; n < b.N; n++ {\n\t\t\t\t_ = numIslands(bc.input)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "40e1c96b5f0ad4b08b7937e2a61102cd", "score": "0.48071846", "text": "func segmentSize(ar image.Rectangle) int {\n\t// widthPerc is the relative width of a segment to the width of the canvas.\n\tconst widthPerc = 9\n\ts := int(math.Round(float64(ar.Dx()) * widthPerc / 100))\n\tif s > 3 && s%2 == 0 {\n\t\t// Segments with odd number of pixels in their width/height look\n\t\t// better, since the spike at the top of their slopes has only one\n\t\t// pixel.\n\t\ts++\n\t}\n\treturn s\n}", "title": "" }, { "docid": "0ab721430205f2507fc4250ab96ff10b", "score": "0.47966266", "text": "func (g *GPX) Length2D() float64 {\n\tvar length2d float64\n\tfor _, trk := range g.Tracks {\n\t\tlength2d += trk.Length2D()\n\t}\n\treturn length2d\n}", "title": "" }, { "docid": "d7aa8fc874d77d86cafbafa63b92c319", "score": "0.47963408", "text": "func (h *HIPMAC2) Len() int {\r\n\treturn 4 + len(h.HMAC) + len(h.Padding)\r\n}", "title": "" }, { "docid": "dcf7f654104cafe7fe79039600adddaa", "score": "0.47940102", "text": "func borderHashes(image []string) []uint16 {\n borders := make([]uint16, 4)\n north := image[0]\n borders[0] = borderToBinary(north)\n east := \"\"\n for _, s := range image {\n east = east + string(s[9])\n }\n borders[1] = borderToBinary(east)\n south := \"\"\n west := \"\"\n for i:=9; i>=0; i-- {\n south = south + string(image[9][i])\n west = west + string(image[i][0])\n }\n borders[2] = borderToBinary(south)\n borders[3] = borderToBinary(west)\n return borders\n}", "title": "" }, { "docid": "311667ef6cd3eef0450a4c83ea31159b", "score": "0.47861275", "text": "func main(){\n\t//n is equal to total number of steps (length + width of grid)\n\tn:=40\n\t//This tracks the previous level of pascal's triangle - needed to calculate the next level.\n\tvar lastLine []int\n\tfor i:=0;i<n;i++{\n\t\tvar pascSlice []int\n\t\tpascSlice=append(pascSlice,1)\n\t\tfor j:=0;j<len(lastLine)-1;j++{\n\t\t\tcalc:=lastLine[j]+lastLine[j+1]\n\t\t\tpascSlice= append(pascSlice,calc)\n\t\t}\n\t\tpascSlice=append(pascSlice,1)\n\t\tlastLine=pascSlice\n\t\tfmt.Println(lastLine)\n\t}\n mid:=lastLine[len(lastLine)/2]\n fmt.Println(mid)\n}", "title": "" }, { "docid": "8dbb0b4fc0864f28b5d9f67151ae15f1", "score": "0.47854456", "text": "func (trk *GPXTrack) Length3D() float64 {\n\tvar l float64\n\tfor _, seg := range trk.Segments {\n\t\td := seg.Length3D()\n\t\tl += d\n\t}\n\treturn l\n}", "title": "" }, { "docid": "a7106e909fe87b1cc442c878c1c73a98", "score": "0.47806922", "text": "func (t Triangle) Perimeter() float64 {\n\treturn 0\n}", "title": "" }, { "docid": "a7106e909fe87b1cc442c878c1c73a98", "score": "0.47806922", "text": "func (t Triangle) Perimeter() float64 {\n\treturn 0\n}", "title": "" }, { "docid": "579cf9530907973ae4823eba9cf50a4a", "score": "0.4780592", "text": "func UniquePaths(m int, n int) int {\n\tif m <= 0 || n <= 0 {\n\t\treturn 0\n\t}\n\tdp := make([][]int, m)\n\t// 边缘路线只有1条\n\tfor i := 0; i < m; i++ {\n\t\tif len(dp[i]) == 0 {\n\t\t\tdp[i] = make([]int, n)\n\t\t}\n\t\tdp[i][0] = 1\n\t}\n\tfor i := 0; i < n; i++ {\n\t\tdp[0][i] = 1\n\t}\n\t// 逐一计算\n\tfor i := 1; i < m; i++ {\n\t\tfor j := 1; j < n; j++ {\n\t\t\tdp[i][j] = dp[i][j-1] + dp[i-1][j]\n\t\t}\n\t}\n\treturn dp[m-1][n-1]\n}", "title": "" }, { "docid": "fa817106d5f80f2b159642b6f4b942fc", "score": "0.4777435", "text": "func hammingDistance(x int, y int) int {\n\tcount := 0\n\tfor{\n\t\tif x % 2 != y % 2{\n\t\t\tcount++\n\t\t}\n\t\ty /= 2\n\t\tx /= 2\n\t\tif y == 0 && x == 0{\n\t\t\tbreak\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "fc17d221337929ef44be9c7199103d4a", "score": "0.4773213", "text": "func (mat General32) Dims() (r, c int) {\n\treturn mat.Rows, mat.Cols\n}", "title": "" }, { "docid": "44d6c2d6d7739079960c84d6e2041301", "score": "0.4769863", "text": "func (l Length) Hands() float64 {\n\treturn float64(l / Hand)\n}", "title": "" }, { "docid": "84fbd0c29b0190f54feadb8c46471d71", "score": "0.47690716", "text": "func (p Vector) Dim() int {\n\treturn len(p.Coords)\n}", "title": "" }, { "docid": "4a08c807aeac425eca970c7bd8bac780", "score": "0.47690567", "text": "func h2(goal, now [][]int) int {\n\tsumDistance := 0\n\tfor i := 0; i < 3; i++ {\n\t\tfor j := 0; j < 3; j++ {\n\t\t\tif distance, err := manhattanDistance(goal[i][j], i, j, now); err == nil {\n\t\t\t\tsumDistance += distance\n\t\t\t} else {\n\t\t\t\tlog.Println(\"Something Wrong!!!\")\n\t\t\t}\n\t\t}\n\t}\n\treturn sumDistance\n}", "title": "" }, { "docid": "1c74b784ee43cedb74b241308e835116", "score": "0.4765987", "text": "func (a *AdjacencyMatrix) Dims() (r, c int) {\n\treturn a.mat.N, a.mat.N\n}", "title": "" }, { "docid": "58ba1a3fe9591f1c2b928a86fa714b9c", "score": "0.4765325", "text": "func (b Board) checkDiagonalLineCrosses() bool{\n\tvar count int\n\tfor xAxis:=0; xAxis < len(b.board); xAxis++{\n\t\tfor yAxis:=0; yAxis < len(b.board); yAxis++ {\n\t\t\tif xAxis == yAxis{\n\t\t\t\tif b.board[xAxis][yAxis] == \" X \"{\n\t\t\t\t\tcount++\n\t\t\t\t}\n\t\t\t\tif count == len(b.board) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tcount=0\n\tfor xAxis:=0; xAxis < len(b.board); xAxis++{\n\t\tfor yAxis:=0; yAxis < len(b.board); yAxis++ {\n\t\t\tif xAxis+yAxis == len(b.board)-1{\n\t\t\t\tif b.board[xAxis][yAxis] == \" X \"{\n\t\t\t\t\tcount++\n\t\t\t\t}\n\t\t\t\tif count == len(b.board) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1cfddbbef2928a75d6fe4fb3ca6fdbcd", "score": "0.47651494", "text": "func (rte *GPXRoute) Length() float64 {\n\t// TODO: npe check\n\tpoints := make([]Point, len(rte.Points))\n\tfor pointNo, point := range rte.Points {\n\t\tpoints[pointNo] = point.Point\n\t}\n\treturn Length2D(points)\n}", "title": "" }, { "docid": "1ce0bc129db2dc73ecb1dd62b91aef3c", "score": "0.47568503", "text": "func (q *Q) Len() float64 { return math.Sqrt(q.Dot(q)) }", "title": "" }, { "docid": "3af7ef5c1077c2ce21a03ddab4aec277", "score": "0.47564158", "text": "func LeafCount(l int32) int { return int((((l) & 0xf) + 1)) }", "title": "" }, { "docid": "0bf328468dd4ad348972902753b42e98", "score": "0.47523832", "text": "func (p *Packet) Len() int {\n\tl := 4\n\tfor _, r := range p.Routes {\n\t\tif r.Route1 != nil {\n\t\t\tl += r.Route1.len()\n\t\t\tcontinue\n\t\t}\n\t\tif r.Route2 != nil {\n\t\t\tl += r.Route2.len()\n\t\t}\n\t}\n\treturn l\n}", "title": "" }, { "docid": "c117c7f83dd9f8172e10631d72a85eb2", "score": "0.47510436", "text": "func (ch *BandCholesky) SymmetricDim() int {\n\tn, _ := ch.chol.Triangle()\n\treturn n\n}", "title": "" } ]
60bd27b5a47d6bbc0ea4c5f22597e426
var itemPattern = regexp.MustCompile("(?s)(.?)")
[ { "docid": "64a8700366b8150a0eb9596a44430c69", "score": "0.0", "text": "func DownloadContent(source string) ([]byte, error) {\n\tresult, err := http.Get(source)\n\tif err != nil {\n\t\treturn nil, errors.New(\"downloading content error: \" + err.Error())\n\t}\n\tdefer result.Body.Close()\n\tcontent, err := ioutil.ReadAll(result.Body)\n\tif err != nil {\n\t\treturn nil, errors.New(\"downloading content error: \" + err.Error())\n\t}\n\treturn content, nil\n}", "title": "" } ]
[ { "docid": "c092c496afe1e56166d8de924b430d20", "score": "0.5512467", "text": "func init() {\n\tr, _ := regexp.Compile(`\\s{2,}`)\n\tstripSpacesRegex = r\n}", "title": "" }, { "docid": "7e9838e7780eea85d53ae41c0e1e819d", "score": "0.5214718", "text": "func findRegex(pattern string, s string) string {\n matched, err := regexp.MatchString(pattern, s)\n checkError(err, \"Issue checking text for \" + pattern)\n if matched {\n a := regexp.MustCompile(pattern)\n toreturn := strings.TrimSpace(a.Split(s, -1)[1])\n return toreturn\n }\n return \"||\"\n}", "title": "" }, { "docid": "2c3b0d10793b53a70b3b8f6ed6d4b0b4", "score": "0.5212276", "text": "func init() {\n\teasylistRegexp = regexp.MustCompile(\"^\\\\|\\\\|((\\\\w+\\\\.)+[[:alpha:]]+)[^[:alpha:]]\")\n}", "title": "" }, { "docid": "f0f402ed50f7bcdc4c553547cb6e2ac9", "score": "0.5117661", "text": "func re(exps ...string) *regexp.Regexp {\n\texp := strings.Join(exps, spaces)\n\treturn regexp.MustCompile(\"^\" + exp + \"$\")\n}", "title": "" }, { "docid": "1a1bec21d1e5a7009c61fed6cb0d16e0", "score": "0.5107606", "text": "func TestAnyParserPerfs(t *testing.T){\n any_re := \"(?P<any>.*) trailing stuff\"\n any, _ := AnyFactory([]string{\"\", \" trailing stuff\"})\n ratio := BenchParserPerfs(any, \"some stuff trailing stuff\", any_re)\n // I benched it as ~70x faster than regexp\n if ratio < 30{\n t.Errorf(\"Parser too slow. only %d× faster than regexp.\", ratio)\n }\n}", "title": "" }, { "docid": "011a1322c16f5424bbb01b0ef8ca27ff", "score": "0.4923718", "text": "func parseMatch(input string, exps []ggdb.Expander) string {\n\tvar expansion string\n\tfor _, exp := range exps {\n\t\tif comp := strings.Compare(input, exp.Phrase); comp == 0 {\n\t\t\texpansion = string(exp.Expansion)\n\t\t}\n\t}\n\treturn expansion\n}", "title": "" }, { "docid": "4c921ebc394403552f3b40085c87368b", "score": "0.49049145", "text": "func parsePattern(pattern string) []string {\n vs := strings.Split(pattern, \"/\")\n\n parts := make([]string, 0)\n for _, item := range vs {\n if item != \"\" {\n parts = append(parts, item)\n if item[0] == '*' {\n break\n }\n }\n }\n return parts\n}", "title": "" }, { "docid": "e34f5b4a12bbf703099c15dd8d05f746", "score": "0.4897251", "text": "func extractFieldName(s string) string {\n\tre := regexp.MustCompile(`\\{\\{\\s*[^\\.]*\\.([^\\.\"]+).*\\s*\\}\\}`)\n\tmatch := re.FindStringSubmatch(s)\n\tif (0 < len(match)) {\n\t\treturn SpaceMap(match[1])\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "f664ebabf2df0b239d662b12e1d3e35e", "score": "0.48962513", "text": "func pickupWord(word string) string {\n\tre, _ := regexp.Compile(\"^[\\\\s]+\")\n\ttrimWord := re.ReplaceAllString(word, \"\")\n\tre, _ = regexp.Compile(\"[\\\\s]+$\")\n\ttrimWord = re.ReplaceAllString(trimWord, \"\")\n\treturn trimWord\n}", "title": "" }, { "docid": "b0828ad60ba9cc0726920d0167102066", "score": "0.4889705", "text": "func TestParseItemWithDoubleQuotes(t *testing.T) {}", "title": "" }, { "docid": "8afbcfe6061687f608c8423dea7b1be3", "score": "0.48700982", "text": "func filterMatch(match string) string {\n\tlines := strings.Split(match, \"\\n\")\n\tregex := regexp.MustCompile(`^ *[a-z_]+(?: \\([^)]+\\))?:`)\n\tfor i, line := range lines {\n\t\tif regex.MatchString(line) {\n\t\t\treturn strings.Join(lines[:i], \" \")\n\t\t}\n\t\tlines[i] = strings.TrimSpace(line)\n\t}\n\treturn strings.TrimSpace(match)\n}", "title": "" }, { "docid": "1d9f0c8a23f031d55c78f89573d23795", "score": "0.47874576", "text": "func parseItem(s string) (int, int, string, string) {\n\t// Variables to return\n\tvar num1, num2 int\n\tvar char, code string\n\n\t// Variables for use in function\n\tvar dashPos, spacePos int\n\tfoundSpace := false\n\n\t// Find ints and strings\n\tfor pos, c := range s {\n\t\tsc := string(c)\n\t\tif sc == \"-\" {\n\t\t\tdashPos = pos\n\t\t\tnum1, _ = strconv.Atoi(s[0:dashPos]) // num1 will always be before the dash\n\t\t}\n\t\tif sc == \" \" {\n\t\t\tif foundSpace == false {\n\t\t\t\tspacePos = pos\n\t\t\t\tnum2, _ = strconv.Atoi(s[dashPos+1 : spacePos]) //num2 will always be before the space and after the dash\n\t\t\t\tchar = string(s[spacePos+1]) // char will always be after the space\n\t\t\t\tfoundSpace = true\n\t\t\t}\n\t\t}\n\t\tif sc == \":\" {\n\t\t\tcode = s[pos+2 : len(s)] // code will always be 2 spaces after the colon because of the space\n\t\t}\n\t}\n\n\t// Return the values\n\treturn num1, num2, char, code\n}", "title": "" }, { "docid": "849cea4fcc71ca0cb588a41deac20604", "score": "0.4742374", "text": "func main() {\n\ts := \"\"\n\tp := \".\"\n\tfmt.Println(isMatch2(s, p))\n}", "title": "" }, { "docid": "1e019de5bfcbf4263e03b05cb15af3e2", "score": "0.46268559", "text": "func variable(s string) bool {\n\tm, e := regexp.MatchString(\"[a-zA-Z][0-9a-zA-Z_]*\", s)\n\treturn e == nil && m\n}", "title": "" }, { "docid": "7ab235fc783350fbaa8e5833ddbad9e5", "score": "0.46254885", "text": "func extractType(s string) string {\n\tfor i := len(s) - 1; i >= 0; i-- {\n\t\tif unicode.IsSpace(rune(s[i])) ||\n\t\t\ts[i] == '*' {\n\t\t\treturn s[i+1:]\n\t\t}\n\t}\n\treturn s\n}", "title": "" }, { "docid": "4900f8c28c8c7b5327978d113c6ecbc0", "score": "0.4623634", "text": "func matcher(text, pat string, leadingPercent bool) (res string, match bool) {\n\tif !leadingPercent {\n\t\tres = strings.TrimPrefix(text, pat)\n\t\tif len(text) == len(res) {\n\t\t\treturn \"\", false\n\t\t}\n\t} else {\n\t\tparts := strings.SplitN(text, pat, 2)\n\t\tif len(parts) == 1 {\n\t\t\treturn \"\", false\n\t\t}\n\t\tres = parts[1]\n\t}\n\treturn res, true\n}", "title": "" }, { "docid": "6027f1cf74b994f2886c678cce2ba0a0", "score": "0.46234155", "text": "func prepareNameMatch(name string) string {\n\tname = strings.ToLower(name) // lowercase it\n\n\t// anchor it\n\tout := make([]string, 0, 3)\n\tif !strings.HasPrefix(name, \"^\") {\n\t\tout = append(out, \"^\")\n\t}\n\tout = append(out, name)\n\tif !strings.HasSuffix(name, \"$\") {\n\t\tout = append(out, \"$\")\n\t}\n\treturn strings.Join(out, \"\")\n}", "title": "" }, { "docid": "e94c71abe2589bee3b972ce88e727530", "score": "0.46177676", "text": "func wordPattern(pattern string, s string) bool {\r\n\tstringArr := strings.Fields(s)\r\n\tstore := make(map[rune]string)\r\n\tappearance := make(map[string]bool)\r\n\tif len(stringArr) != len(pattern) {\r\n\t\treturn false\r\n\t}\r\n\tfor index, char := range pattern {\r\n\t\t_, exist := store[char]\r\n\t\tif !exist {\r\n\t\t\tif _, appear := appearance[stringArr[index]]; appear {\r\n\t\t\t\treturn false\r\n\t\t\t} else {\r\n\t\t\t\tstore[char] = stringArr[index]\r\n\t\t\t\tappearance[stringArr[index]] = true\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif store[char] != stringArr[index] {\r\n\t\t\t\treturn false\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn true\r\n}", "title": "" }, { "docid": "d4dd92a7f29f554992308c892a809591", "score": "0.46176606", "text": "func firstSpace(s string) int {\n\treturn strings.IndexAny(s, \" \\t\")\n}", "title": "" }, { "docid": "32f348d74876785a1a7f3be8989d0f2d", "score": "0.461711", "text": "func preparePattern(template string) (string, error) {\n\t// Check if it is well-formed.\n\tidxs, errBraces := braceIndices(template)\n\tif errBraces != nil {\n\t\treturn \"\", errBraces\n\t}\n\n\tdefaultPattern := \"[^.]+\"\n\tpattern := bytes.NewBufferString(\"\")\n\n\t// Host SNI matching is case-insensitive\n\tfmt.Fprint(pattern, \"(?i)\")\n\n\tpattern.WriteByte('^')\n\tvar end int\n\tvar err error\n\tfor i := 0; i < len(idxs); i += 2 {\n\t\t// Set all values we are interested in.\n\t\traw := template[end:idxs[i]]\n\t\tend = idxs[i+1]\n\t\tparts := strings.SplitN(template[idxs[i]+1:end-1], \":\", 2)\n\t\tname := parts[0]\n\t\tpatt := defaultPattern\n\t\tif len(parts) == 2 {\n\t\t\tpatt = parts[1]\n\t\t}\n\t\t// Name or pattern can't be empty.\n\t\tif name == \"\" || patt == \"\" {\n\t\t\treturn \"\", fmt.Errorf(\"mux: missing name or pattern in %q\",\n\t\t\t\ttemplate[idxs[i]:end])\n\t\t}\n\t\t// Build the regexp pattern.\n\t\tfmt.Fprintf(pattern, \"%s(?P<%s>%s)\", regexp.QuoteMeta(raw), varGroupName(i/2), patt)\n\n\t\t// Append variable name and compiled pattern.\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\t// Add the remaining.\n\traw := template[end:]\n\tpattern.WriteString(regexp.QuoteMeta(raw))\n\tpattern.WriteByte('$')\n\n\treturn pattern.String(), nil\n}", "title": "" }, { "docid": "f150d93b48dbc9f16c7b0e774ab7f1d5", "score": "0.46077162", "text": "func Pattern(d Dict, s string) (string, error) {\n\tm, err := d.Matcher(s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tp, err := m.Pattern()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "52768f5238911e4cb0e76dfacded3524", "score": "0.45993873", "text": "func isMatch(s string, p string) bool {\n\tif len(p) == 0 {\n\t\treturn len(s) == 0\n\t}\n\n\tfirstMatch := (len(s) != 0) && (s[0] == p[0] || p[0] == '.')\n\n\tif len(p) >= 2 && p[1] == '*' {\n\t\treturn isMatch(s, p[2:]) ||\n\t\t\t(firstMatch && isMatch(s[1:], p))\n\t} else {\n\t\treturn firstMatch && isMatch(s[1:], p[1:])\n\t}\n}", "title": "" }, { "docid": "7658181cd5c0b902995c9dae773d676f", "score": "0.45717445", "text": "func parse(s string) (lit, pat []string, _ error) {\n\tconst (\n\t\tfree = iota // in literal text\n\t\tdollar // saw a $, looking for $ or {\n\t\tword // in a pattern word\n\t)\n\n\tstart := 0 // start of most recent pattern word ($)\n\tst := free // lexer state\n\tvar buf bytes.Buffer // current token\n\tfor i, c := range s {\n\t\tswitch st {\n\t\tcase free:\n\t\t\tif c == '$' {\n\t\t\t\tstart = i\n\t\t\t\tst = dollar\n\t\t\t} else {\n\t\t\t\tbuf.WriteRune(c)\n\t\t\t}\n\n\t\tcase dollar:\n\t\t\tif c == '$' {\n\t\t\t\tbuf.WriteRune(c)\n\t\t\t\tst = free // escaped $\n\t\t\t} else if c == '{' {\n\t\t\t\tlit = append(lit, buf.String())\n\t\t\t\tbuf.Reset()\n\t\t\t\tst = word\n\t\t\t} else {\n\t\t\t\treturn nil, nil, perrorf(i, \"wanted $ or { but found '%c'\", c)\n\t\t\t}\n\n\t\tcase word:\n\t\t\tif c == '}' {\n\t\t\t\tif buf.Len() == 0 {\n\t\t\t\t\treturn nil, nil, perrorf(start, \"empty pattern word\")\n\t\t\t\t}\n\t\t\t\tpat = append(pat, buf.String())\n\t\t\t\tbuf.Reset()\n\t\t\t\tst = free\n\t\t\t} else if !isWordRune(c) {\n\t\t\t\treturn nil, nil, perrorf(i, \"invalid name letter '%c'\", c)\n\t\t\t} else {\n\t\t\t\tbuf.WriteRune(c)\n\t\t\t}\n\t\t}\n\t}\n\tif buf.Len() > 0 {\n\t\tlit = append(lit, buf.String())\n\t}\n\tswitch st {\n\tcase dollar:\n\t\treturn nil, nil, perrorf(start, \"incomplete $ escape\")\n\tcase word:\n\t\treturn nil, nil, perrorf(start, \"incomplete pattern word\")\n\t}\n\treturn lit, pat, nil\n}", "title": "" }, { "docid": "d0b5b46851f0a2bab8b2de2fd6a92836", "score": "0.45063275", "text": "func isMatch(s string, p string) bool {\n\tif p == \"\" {\n\t\treturn s == \"\"\n\t}\n\n\tif len(p) == 1 {\n\t\treturn len(s) == 1 && (s == p || p[0] == '.')\n\t}\n\n\tif p[1] != '*' {\n\t\tif s == \"\" || (p[0] != s[0] && p[0] != '.') {\n\t\t\treturn false\n\t\t}\n\t\treturn isMatch(s[1:], p[1:])\n\t}\n\n\tfor {\n\t\tif s == \"\" || (p[0] != s[0] && p[0] != '.') {\n\t\t\tbreak\n\t\t}\n\n\t\tif isMatch(s, p[2:]) {\n\t\t\treturn true\n\t\t}\n\n\t\ts = s[1:]\n\t}\n\treturn isMatch(s, p[2:])\n}", "title": "" }, { "docid": "5330554e8677f7664d9902ac03010693", "score": "0.4449779", "text": "func ExtractRegexSave(src string) string {\n\tr := regexp.MustCompile(`\\w+`)\n\treturn strings.Join(r.FindAllString(src, -1), \"\")\n}", "title": "" }, { "docid": "f90bc2fd37f2cf3ce79851eaeb3b787c", "score": "0.44293135", "text": "func regexStringLow(v string) string {\n\tif emptyFields(v) {\n\t\treturn v\n\t}\n\treString := []string{}\n\tsv := strings.Fields(v)\n\treString = append(reString, \"^\")\n\tfor _, s := range sv {\n\t\treString = append(reString, \"[0 ]*\")\n\t\treString = append(reString, s)\n\t}\n\treString = append(reString, \"$\")\n\treturn strings.Join(reString, \"\")\n}", "title": "" }, { "docid": "b7a346c261eedc97f40e1948b8d257be", "score": "0.4428434", "text": "func firstNonEmptyString(ss ...string) string {\n\tfor _, s := range ss {\n\t\tif s != \"\" {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "24f77d53f044339570b757da01066da0", "score": "0.4382856", "text": "func ParsePattern(patternStr string) (args PatternArgs, pattern string) {\n patternStr = escapeRegexp.ReplaceAllString(patternStr, \"\\\\$1\")\n patternStr = singleRegexp.ReplaceAllStringFunc(patternStr, func (match string) string {\n args = append(args, ArgData{Type: Single, Name: match[1:len(match) - 1]})\n return \"(?P<\" + match[1:len(match) - 1] + \">[^\\\\/]+?)\"\n })\n pattern = multiRegexp.ReplaceAllStringFunc(patternStr, func (match string) string {\n args = append(args, ArgData{Type: Multi, Name: match[2:len(match) - 2]})\n return \"(?P<\" + match[2:len(match) - 2] + \">[^]+?)\"\n })\n sort.Sort(args)\n return\n}", "title": "" }, { "docid": "1c0c05623b5b7b59a6182a78444df40b", "score": "0.43798563", "text": "func regexStringHigh(v string) string {\n\tif emptyFields(v) {\n\t\treturn v\n\t}\n\treString := []string{}\n\tsv := strings.Fields(v)\n\treString = append(reString, \"^[0 ]*\")\n\tfor _, s := range sv {\n\t\treString = append(reString, s)\n\t\treString = append(reString, \"[0 ]*\")\n\t}\n\treString = append(reString, \"$\")\n\treturn strings.Join(reString, \"\")\n}", "title": "" }, { "docid": "5520accdb66634e4ed40838d622c9cbc", "score": "0.43792453", "text": "func TestMultipartSuffix(t *testing.T) {\n\tpattern := constants.MultipartSuffix\n\tassert.True(t, pattern.MatchString(\"bag.b02.of04\"), errShouldMatch)\n\tassert.False(t, pattern.MatchString(\"bag.bag02of04\"), errShouldNotMatch)\n}", "title": "" }, { "docid": "c4d3361972276bb55c278fe66fbf8348", "score": "0.43637258", "text": "func validate(w io.Writer, lines []string) {\n\n\tre := regexp.MustCompile(`^[_.][0-9]+[a-zA-Z]*_?$`)\n\n\tfor i := 0; i < len(lines); i++ {\n\t\tif re.MatchString(lines[i]) {\n\t\t\t_, _ = fmt.Fprintln(w, \"VALID\")\n\t\t} else {\n\t\t\t_, _ = fmt.Fprintln(w, \"INVALID\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "75da40ffbed4ec72017527244c86aad5", "score": "0.43612152", "text": "func isItemMatched(item item, searchTerm string) (bool,string, error) {\n\t//log.Printf(\"isItemMatched [%s]\", item.Title)\n\tisTitleMatched, err := regexp.MatchString(searchTerm, item.Title)\n\tif err != nil {\n\t\treturn false,\"\", err\n\t}\n\tisDescriptionMatched, err := regexp.MatchString(searchTerm, item.Description)\n\tif err != nil {\n\t\treturn false,\"\", err\n\t}\n\n\tif isTitleMatched || isDescriptionMatched {\n\t\tif isTitleMatched {\n\t\t\treturn true,\"Title\",nil\n\t\t}else {\n\t\t\treturn true,\"Description\",nil\n\t\t}\n\n\t} else {\n\t\treturn false,\"\",nil\n\t}\n}", "title": "" }, { "docid": "1c98c3f8f27d26aa337eb4975f384f5a", "score": "0.43381637", "text": "func matchPattern(pattern string) func(name string) bool {\n\tre := regexp.QuoteMeta(pattern)\n\tre = strings.Replace(re, `\\.\\.\\.`, `.*`, -1)\n\t// Special case: foo/... matches foo too.\n\tif strings.HasSuffix(re, `/.*`) {\n\t\tre = re[:len(re)-len(`/.*`)] + `(/.*)?`\n\t}\n\treg := regexp.MustCompile(`^` + re + `$`)\n\treturn func(name string) bool {\n\t\treturn reg.MatchString(name)\n\t}\n}", "title": "" }, { "docid": "1c98c3f8f27d26aa337eb4975f384f5a", "score": "0.43381637", "text": "func matchPattern(pattern string) func(name string) bool {\n\tre := regexp.QuoteMeta(pattern)\n\tre = strings.Replace(re, `\\.\\.\\.`, `.*`, -1)\n\t// Special case: foo/... matches foo too.\n\tif strings.HasSuffix(re, `/.*`) {\n\t\tre = re[:len(re)-len(`/.*`)] + `(/.*)?`\n\t}\n\treg := regexp.MustCompile(`^` + re + `$`)\n\treturn func(name string) bool {\n\t\treturn reg.MatchString(name)\n\t}\n}", "title": "" }, { "docid": "fc2bb73f8f2c3d93fff7dcaa51750228", "score": "0.43380895", "text": "func checkForUselessSpaces(id string, s *spec.Spec) []Alert {\n\tif len(s.Data) == 0 {\n\t\treturn nil\n\t}\n\n\tvar result []Alert\n\n\tfor _, line := range s.Data {\n\t\tif contains(line, \" \") {\n\t\t\tif strings.TrimSpace(line.Text) == \"\" {\n\t\t\t\timpLine := spec.Line{line.Index, strings.Replace(line.Text, \" \", \"░\", -1), line.Ignore}\n\t\t\t\tresult = append(result, NewAlert(id, LEVEL_NOTICE, \"Line contains useless spaces\", impLine))\n\t\t\t} else if strings.TrimRight(line.Text, \" \") != line.Text {\n\t\t\t\tcleanLine := strings.TrimRight(line.Text, \" \")\n\t\t\t\tspaces := len(line.Text) - len(cleanLine)\n\t\t\t\timpLine := spec.Line{line.Index, cleanLine + strings.Repeat(\"░\", spaces), line.Ignore}\n\t\t\t\tresult = append(result, NewAlert(id, LEVEL_NOTICE, \"Line contains spaces at the end of line\", impLine))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "5371c030f3b2b444f88e922d1a0e61eb", "score": "0.4333094", "text": "func ValidateInput(i string) bool {\n if len(strings.ReplaceAll(i, \" \", \"\")) == 0{\n return false\n }\n return true\n}", "title": "" }, { "docid": "681482ef3548e8396f1bec6801d1c179", "score": "0.432393", "text": "func cleanName(name string) string {\n if (strings.Contains(name, \"\\n\")) {\n return strings.Replace(name, \"\\n\", \" \", -1);\n }\n return name;\n}", "title": "" }, { "docid": "e141ea2b5b1d90a7ee6751a7448df920", "score": "0.43186828", "text": "func prepLine(line string) (string) {\n return strings.ToLower(reg.ReplaceAllString(line, \"\"))\n}", "title": "" }, { "docid": "f30633ecf191eb6b8e29f1f48e053b28", "score": "0.4315916", "text": "func isMatch(s string, p string) bool {\n\tif len(p) == 0 { return 0 == len(s) }\n\n\tif len(p) == 1 {\n\t\treturn len(s) == 1 && (s[0] == p[0] || p[0] == '.')\n\t}\n\n\tif p[1] != '*' {\n\t\tif 0 == len(s) { return false }\n\t\treturn (s[0] == p[0] || p[0] == '.') && isMatch(s[1:], p[1:])\n\t}\n\n\t// p[1] == '*', match one or more\n\tfor len(s) != 0 && (s[0] == p[0] || p[0] == '.') {\n\t\tif isMatch(s, p[2:]) { return true }\n\t\ts = s[1:]\n\t}\n\n\t// match zero\n\treturn isMatch(s, p[2:])\n}", "title": "" }, { "docid": "62aaa211deeca5601a960bbbd861f8a1", "score": "0.43138131", "text": "func TrimWildcard(pattern string) (trimmed string, hasWildcard bool) {\n var chars []byte\nPattern:\n for i := 0; i < len(pattern); i++ {\n switch pattern[i] {\n case '\\\\':\n if i == len(pattern)-1 {\n break Pattern\n }\n i++\n case '?', '*', '[', '{':\n hasWildcard = true\n break Pattern\n }\n chars = append(chars, pattern[i])\n }\n return string(chars), hasWildcard\n}", "title": "" }, { "docid": "d92fcbc0f32279f8ebde400305d15035", "score": "0.43026882", "text": "func stringRegex(text string, reg string) []string {\n\tgroups := regexp.MustCompile(reg).FindAllStringSubmatch(text, -1)\n\tvar output []string\n\tfor _, word := range groups {\n\t\tfor i, w := range word {\n\t\t\tif i == 0 || w == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\toutput = append(output, w)\n\t\t}\n\t}\n\treturn output\n}", "title": "" }, { "docid": "d68621158d93e77caa6ac26414e111fe", "score": "0.42998523", "text": "func extractFirstWord(in string, separators string, flags SplitFlags) (string, string, bool, error) {\n\tvar s strings.Builder\n\tvar quote byte // 0 or ' or \"\n\tbackslash := false // whether we've just seen a backslash\n\n\t// The string handling in this function is a bit weird, using\n\t// 0 bytes to mark end-of-string. This is because it is a direct\n\t// conversion of the C in systemd, and w want to ensure\n\t// exactly the same behaviour of some complex code\n\n\tp := 0\n\tend := len(in)\n\tvar c byte\n\n\tnextChar := func() byte {\n\t\tp++\n\t\tif p >= end {\n\t\t\treturn 0\n\t\t}\n\t\treturn in[p]\n\t}\n\n\t/* Bail early if called after last value or with no input */\n\tif len(in) == 0 {\n\t\tgoto finish\n\t}\n\n\t// Parses the first word of a string, and returns it and the\n\t// remainder. Removes all quotes in the process. When parsing\n\t// fails (because of an uneven number of quotes or similar),\n\t// the rest is at the first invalid character. */\n\nloop1:\n\tfor c = in[0]; ; c = nextChar() {\n\t\tswitch {\n\t\tcase c == 0:\n\t\t\tgoto finishForceTerminate\n\t\tcase strings.ContainsRune(separators, rune(c)):\n\t\t\tif flags&SplitDontCoalesceSeparators != 0 {\n\t\t\t\tif !(flags&SplitRetainSeparators != 0) {\n\t\t\t\t\tp++\n\t\t\t\t}\n\t\t\t\tgoto finishForceNext\n\t\t\t}\n\t\tdefault:\n\t\t\t// We found a non-blank character, so we will always\n\t\t\t// want to return a string (even if it is empty),\n\t\t\t// allocate it here.\n\t\t\tbreak loop1\n\t\t}\n\t}\n\n\tfor ; ; c = nextChar() {\n\t\tswitch {\n\t\tcase backslash:\n\t\t\tif c == 0 {\n\t\t\t\tif flags&SplitUnescapeRelax != 0 &&\n\t\t\t\t\t(quote == 0 || flags&SplitRelax != 0) {\n\t\t\t\t\t// If we find an unquoted trailing backslash and we're in\n\t\t\t\t\t// SplitUnescapeRelax mode, keep it verbatim in the\n\t\t\t\t\t// output.\n\t\t\t\t\t//\n\t\t\t\t\t// Unbalanced quotes will only be allowed in SplitRelax\n\t\t\t\t\t// mode, SplitUnescapeRelax mode does not allow them.\n\t\t\t\t\ts.WriteString(\"\\\\\")\n\t\t\t\t\tgoto finishForceTerminate\n\t\t\t\t}\n\t\t\t\tif flags&SplitRelax != 0 {\n\t\t\t\t\tgoto finishForceTerminate\n\t\t\t\t}\n\t\t\t\treturn \"\", \"\", false, fmt.Errorf(\"unbalanced escape\")\n\t\t\t}\n\n\t\t\tif flags&(SplitCUnescape|SplitUnescapeSeparators) != 0 {\n\t\t\t\tvar r = -1\n\t\t\t\tvar u rune\n\n\t\t\t\tif flags&SplitCUnescape != 0 {\n\t\t\t\t\tr, u, _ = cUnescapeOne(in[p:], false)\n\t\t\t\t}\n\n\t\t\t\tswitch {\n\t\t\t\tcase r > 0:\n\t\t\t\t\tp += r - 1\n\t\t\t\t\ts.WriteRune(u)\n\t\t\t\tcase (flags&SplitUnescapeSeparators != 0) &&\n\t\t\t\t\t(strings.ContainsRune(separators, rune(c)) || c == '\\\\'):\n\t\t\t\t\t/* An escaped separator char or the escape char itself */\n\t\t\t\t\ts.WriteByte(c)\n\t\t\t\tcase flags&SplitUnescapeRelax != 0:\n\t\t\t\t\ts.WriteByte('\\\\')\n\t\t\t\t\ts.WriteByte(c)\n\t\t\t\tdefault:\n\t\t\t\t\treturn \"\", \"\", false, fmt.Errorf(\"unsupported escape char\")\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ts.WriteByte(c)\n\t\t\t}\n\n\t\t\tbackslash = false\n\t\tcase quote != 0:\n\t\t\t/* inside either single or double quotes */\n\t\tquoteloop:\n\t\t\tfor ; ; c = nextChar() {\n\t\t\t\tswitch {\n\t\t\t\tcase c == 0:\n\t\t\t\t\tif flags&SplitRelax != 0 {\n\t\t\t\t\t\tgoto finishForceTerminate\n\t\t\t\t\t}\n\t\t\t\t\treturn \"\", \"\", false, fmt.Errorf(\"unbalanced quotes\")\n\t\t\t\tcase c == quote:\n\t\t\t\t\t/* found the end quote */\n\t\t\t\t\tquote = 0\n\t\t\t\t\tif flags&SplitUnquote != 0 {\n\t\t\t\t\t\tbreak quoteloop\n\t\t\t\t\t}\n\t\t\t\tcase c == '\\\\' && !(flags&SplitRetainEscape != 0):\n\t\t\t\t\tbackslash = true\n\t\t\t\t\tbreak quoteloop\n\t\t\t\t}\n\n\t\t\t\ts.WriteByte(c)\n\n\t\t\t\tif quote == 0 {\n\t\t\t\t\tbreak quoteloop\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\tnonquoteloop:\n\t\t\tfor ; ; c = nextChar() {\n\t\t\t\tswitch {\n\t\t\t\tcase c == 0:\n\t\t\t\t\tgoto finishForceTerminate\n\t\t\t\tcase (c == '\\'' || c == '\"') && (flags&(SplitKeepQuote|SplitUnquote) != 0):\n\t\t\t\t\tquote = c\n\t\t\t\t\tif flags&SplitUnquote != 0 {\n\t\t\t\t\t\tbreak nonquoteloop\n\t\t\t\t\t}\n\t\t\t\tcase c == '\\\\' && !(flags&SplitRetainEscape != 0):\n\t\t\t\t\tbackslash = true\n\t\t\t\t\tbreak nonquoteloop\n\t\t\t\tcase strings.ContainsRune(separators, rune(c)):\n\t\t\t\t\tif flags&SplitDontCoalesceSeparators != 0 {\n\t\t\t\t\t\tif !(flags&SplitRetainSeparators != 0) {\n\t\t\t\t\t\t\tp++\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgoto finishForceNext\n\t\t\t\t\t}\n\n\t\t\t\t\tif !(flags&SplitRetainSeparators != 0) {\n\t\t\t\t\t\t/* Skip additional coalesced separators. */\n\t\t\t\t\t\tfor ; ; c = nextChar() {\n\t\t\t\t\t\t\tif c == 0 {\n\t\t\t\t\t\t\t\tgoto finishForceTerminate\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif !strings.ContainsRune(separators, rune(c)) {\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tgoto finish\n\t\t\t\t}\n\n\t\t\t\ts.WriteByte(c)\n\n\t\t\t\tif quote != 0 {\n\t\t\t\t\tbreak nonquoteloop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\nfinishForceTerminate:\n\tp = end\n\nfinish:\n\tif s.Len() == 0 {\n\t\treturn \"\", \"\", false, nil\n\t}\n\nfinishForceNext:\n\treturn s.String(), in[p:], true, nil\n}", "title": "" }, { "docid": "c007d0474d38a43bdc7c1745431ac6df", "score": "0.4298404", "text": "func isValidMy(s string) bool {\n\tif len(s)%2 != 0 {\n\t\treturn false\n\t}\n\tch := make([]string, len(s))\n\ti := 0\n\tfor _, c := range s {\n\t\tif c == int32([]byte(\"(\")[0]) {\n\t\t\tch[i] = \")\"\n\t\t\ti++\n\t\t} else if c == int32([]byte(\"[\")[0]) {\n\t\t\tch[i] = \"]\"\n\t\t\ti++\n\t\t} else if c == int32([]byte(\"{\")[0]) {\n\t\t\tch[i] = \"}\"\n\t\t\ti++\n\t\t} else {\n\t\t\tif i == 0 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\ti--\n\t\t\tv := int32([]byte(ch[i])[0])\n\t\t\tif len(ch) > 1 {\n\t\t\t\tch = append(ch[:i], ch[i+1:]...)\n\t\t\t}\n\t\t\tif v != c {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn len(ch) == 0 || ch[0] == \"\"\n}", "title": "" }, { "docid": "02616c847ec547b3df2708623305f91c", "score": "0.42856148", "text": "func emptyOrWildcard(s string) string {\n\tif s == \"\" {\n\t\treturn fmt.Sprintf(\"'%s'\", types.Wildcard)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "f6cf54f196864087413a29449d89813c", "score": "0.42856088", "text": "func (l *patternLexer) lexVariable() (stateFn, error) {\n\t// Content scanned so far\n\tvar content string\n\n\tl.newItem = PatternItem{Type: terminalsToTypes[l.terminal]}\n\n\t// Scan until EOF, checking each token\n\tfor l.s.Scan() {\n\t\ttoken := l.s.Text()\n\t\tswitch token {\n\t\tcase \",\":\n\t\t\t// Found a comma, should switch to lexMulti state\n\t\t\tl.newItem.Options = []string{content}\n\t\t\tcontent += token\n\t\t\tl.newItem.Text = content\n\t\t\treturn l.lexMulti, nil\n\t\tcase \"<\", \"[\", \"(\":\n\t\t\t// Pattern seems to be trying to use nesting which is not allowed\n\t\t\treturn nil, errors.New(\"cannot nest items\")\n\t\tcase `\"`, `'`:\n\t\t\treturn nil, errors.New(\"single and double quotes are not allowed\")\n\t\tcase l.terminal:\n\t\t\t// Found terminal token, prepare to emit item\n\t\t\tl.newItem.Key = content\n\t\t\tl.newItem.Text = content\n\n\t\t\t// Check for ... if terminal != \")\"\n\t\t\tif l.terminal == \">\" || l.terminal == \"]\" {\n\t\t\t\tif list, err := l.checkList(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else if list {\n\t\t\t\t\tl.newItem.Type = listItem\n\t\t\t\t\tif l.terminal == \"]\" {\n\t\t\t\t\t\tl.newItem.Type |= optionalItem\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Make sure we're at EOF if we need to be\n\t\t\tif err := l.enforceEOF(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// Emit Item\n\t\t\tl.items = append(l.items, l.newItem)\n\t\t\treturn l.lexOutside, nil\n\t\tdefault:\n\t\t\t// If there's a space, we've found the end of the key\n\t\t\tr, _ := utf8.DecodeRuneInString(token)\n\t\t\tif unicode.IsSpace(r) {\n\t\t\t\tl.newItem.Key = content\n\t\t\t\tcontent += token\n\t\t\t\tl.newItem.Text = content\n\t\t\t\treturn l.lexComment, nil\n\t\t\t}\n\n\t\t\tcontent += token\n\t\t}\n\t}\n\n\t// We must have hit EOF before changing state\n\treturn nil, fmt.Errorf(\"missing terminal %s\", l.terminal)\n}", "title": "" }, { "docid": "b8570b84013b6980b8ac902d62301967", "score": "0.42805293", "text": "func cleanup(ast string) string {\n\tr := regexp.MustCompile(`\\n *Pos: .*\\n`)\n\tast = r.ReplaceAllString(ast, \"\\n\")\n\tr = regexp.MustCompile(`String: \"\\\\\"(.*)\\\\\"\",`)\n\treturn r.ReplaceAllString(ast, `String: \"$1\",`)\n}", "title": "" }, { "docid": "a777f9b0cc78696e989d3cc233bc70c3", "score": "0.4277769", "text": "func ensureRegex(t *testing.T, got, pattern string) {\n\tt.Helper()\n\tre := regexp.MustCompile(\"^\" + pattern + \"$\")\n\tif !re.MatchString(got) {\n\t\tt.Fatalf(\"got %q, expected match to %q\", got, pattern)\n\t}\n}", "title": "" }, { "docid": "db4544d5e833055ca5600eef61c70d75", "score": "0.4269904", "text": "func pattern(p string) *regexp.Regexp {\n\tq := regexp.QuoteMeta(p)\n\tq = \"^\" + strings.Replace(q, `\\*`, `.*`, -1) + \"$\"\n\t// q must be a legal regexp.\n\treturn regexp.MustCompile(q)\n}", "title": "" }, { "docid": "f36d3ff322f2c0705de8be566a7d9566", "score": "0.4244132", "text": "func (o Readability) Pattern() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "fce4beee897f1156478f7135a1b3d179", "score": "0.42429706", "text": "func SingularPhrase(i Ingredient) string {\n\tvar out string\n\tif i.Unit == \"\" {\n\t\tout = strings.Title(i.Item)\n\t} else {\n\t\tp, err := plural(i.Item)\n\t\tif err != nil {\n\t\t\tl(err, i.Item)\n\t\t}\n\t\tout = fmt.Sprintf(\n\t\t\t\"%s of %s\",\n\t\t\tstrings.Title(i.Unit), strings.Title(p),\n\t\t)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "a4bb6102e0e2829977f3266cc71cb647", "score": "0.42411557", "text": "func FirstNotEmpty(strings ...string) string {\n\tfor _, str := range strings {\n\t\tif str != \"\" {\n\t\t\treturn str\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "29f95c02c0ad256793bceae2259c0081", "score": "0.42400923", "text": "func (s Sequence) Pattern() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "9f917e798859d2b101873ac9897e636b", "score": "0.42349562", "text": "func prepare(lines []string) []string {\n\tnewLines := make([]string, len(lines))\n\tfor i, l := range lines {\n\t\tnewLines[i] = strings.Replace(l, \" \", \"\", -1)\n\t}\n\treturn newLines\n}", "title": "" }, { "docid": "9f917e798859d2b101873ac9897e636b", "score": "0.42349562", "text": "func prepare(lines []string) []string {\n\tnewLines := make([]string, len(lines))\n\tfor i, l := range lines {\n\t\tnewLines[i] = strings.Replace(l, \" \", \"\", -1)\n\t}\n\treturn newLines\n}", "title": "" }, { "docid": "5d101cb756bfb510c6af2623f029c651", "score": "0.42260945", "text": "func ClassNameRegex(r *regexp.Regexp) *Finder {\n\treturn newFinder().ClassNameRegex(r)\n}", "title": "" }, { "docid": "5ec3f7913444291652e735a2bc768dd6", "score": "0.42124793", "text": "func ssp(s *string) string {\n\tif s == nil {\n\t\treturn \"\"\n\t}\n\treturn *s\n}", "title": "" }, { "docid": "79899316899396190020f1e54b2680cb", "score": "0.42121404", "text": "func DupCheck(s []string) (sOut []string) {\n\tsStr := \" \" + strings.Join(s, \" \") + \" \" //join with spaces, add initial and final space\n\tnumStr := len(s)\n\tfor i := 0; i < numStr; i++ {\n\t\tdup := strings.Count(sStr, \" \"+s[i]+\" \") //look for exact match not submatch\n\t\tif dup > 1 {\n\t\t\tsStr = strings.Replace(sStr, \" \"+s[i]+\" \", \" \", dup-1) //replace all but one.\n\t\t}\n\t}\n\tsOut = strings.Fields(sStr) //convert back to []string\n\treturn\n}", "title": "" }, { "docid": "3c8bd729f5513f5e1f51927f3f402a55", "score": "0.42120203", "text": "func Regex(s string) ValueString {\n\treturn ValueString(s).Regex()\n}", "title": "" }, { "docid": "49bf2612d61bc4ca3cb8d696ec999c99", "score": "0.42114484", "text": "func parsePackage(p string) (Pack, error) {\n\tre := r.FindStringSubmatch(p)\n\tif len(re) != 5 {\n\t\treturn Pack{}, errors.New(\"Failed to parse package: \" + p)\n\t}\n\n\treturn Pack{\n\t\tre[1],\n\t\tre[2],\n\t\tre[3],\n\t\tre[4],\n\t}, nil\n}", "title": "" }, { "docid": "27b2bdbe19345835cf321ba210a9daeb", "score": "0.41989845", "text": "func FirstNonEmpty(strs ...string) string {\n\tfor _, str := range strs {\n\t\tif len(str) > 0 {\n\t\t\treturn str\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "64d30fe102354c753b7ddb78e6925739", "score": "0.41858602", "text": "func ReplaceMultispace(s string) string {\n\tstripper := regexp.MustCompile(`\\s{2,}`)\n\treturn strings.TrimSpace(stripper.ReplaceAllString(s, \" \"))\n}", "title": "" }, { "docid": "2c3b4e0dec40f544cec078d48421aefb", "score": "0.4173844", "text": "func processWord(s string) []string {\n\ts = strings.TrimFunc(s, unicode.IsPunct)\n\tif s == \"\" {\n\t\treturn nil\n\t}\n\tif rs, ok := summaryReplacements[s]; ok {\n\t\treturn rs\n\t}\n\tif !hyphenSplit(s) {\n\t\treturn []string{s}\n\t}\n\t// Apply replacements to parts of hyphenated words.\n\tws := strings.Split(s, \"-\")\n\tif len(ws) == 1 {\n\t\treturn ws\n\t}\n\tresult := []string{s} // Include the full hyphenated word.\n\tfor _, w := range ws {\n\t\tif rs, ok := summaryReplacements[w]; ok {\n\t\t\tresult = append(result, rs...)\n\t\t}\n\t\t// We don't need to include the parts; the Postgres text-search processor will do that.\n\t}\n\treturn result\n}", "title": "" }, { "docid": "9168674a1a4b314d9175da4316ad3226", "score": "0.4168961", "text": "func isMatch(s string, p string) bool {\n\n}", "title": "" }, { "docid": "d9b9e513d78861890d88d6dd913c5c5a", "score": "0.41689226", "text": "func WhitespaceTokenize(s string) (tokens []Token){\n tokens = make([]Token, 0, 30) // guess as to typical length\n tokens = append(tokens, Token{isStart:true})\n for _, strTok := range strings.Fields(s){\n tokens = append(tokens, Token{value:strTok})\n }\n tokens = append(tokens, Token{isEnd:true})\n\n return\n}", "title": "" }, { "docid": "49c26e239f1ae9189a7c1d5d2112d33c", "score": "0.41676888", "text": "func extraparams(s []string) string {\n\tep := \"\"\n\tfor i := 0; i < len(s); i++ {\n\t\tif strings.Index(s[i], \"=\") > 0 {\n\t\t\tep += (s[i]) + \" \"\n\t\t} else if len(s[i]) > 0 {\n\t\t\tep += fmt.Sprintf(\"style='%s' \", s[i])\n\t\t}\n\t}\n\treturn ep\n}", "title": "" }, { "docid": "de387ba34b8a3d44536b3062f6120050", "score": "0.41661093", "text": "func isMatch(s string, p string) bool {\n \n}", "title": "" }, { "docid": "99c968a66eb8a07c42e21c2584b6b418", "score": "0.41591704", "text": "func tidyOutput(str string) string {\n\t// replacing the full stop with a question mark\n\tstr = strings.Replace(str, \".\", \"?\", 1)\n\t// reflecting the pronouns in the captured groups\n\tstr = strings.Replace(str, \"( |)my( |)\", \" Your \", 1)\n\tstr = strings.Replace(str, \"( |)your( |)\", \" my \", 1)\n\tstr = strings.Replace(str, \"( |)yours( |)\", \" mine \", 1)\n\tstr = strings.Replace(str, \"( |)mine( |)\", \" Yours \", 1)\n\tstr = strings.Replace(str, \"( |)am( |)\", \" Are \", 1)\n\tstr = strings.Replace(str, \"( |)are( |)\", \" am \", 1)\n\tstr = strings.Replace(str, \"( |)myself( |)\", \" Yourself \", 1)\n\tstr = strings.Replace(str, \"( |)yourself( |)\", \" myself \", 1)\n\tstr = strings.Replace(str, \"( |)you( |)\", \" I \", 1)\n\tstr = strings.Replace(str, \"( |)You( |)\", \" I \", 1)\n\tstr = strings.Replace(str, \"( |)i( |)\", \"you\", 1)\n\tstr = strings.Replace(str, \"( |)you’re( |)\", \" I'm \", 1)\n\tstr = strings.Replace(str, \"( |)i'm( |)\", \" you’re \", 1)\n\tstr = strings.Replace(str, \"( |)me( |)\", \" you \", 1)\n\tstr = strings.Replace(str, \"( |)same( |)\", \" alike\", 1)\n\tstr = strings.Replace(str, \"( |)were( |)\", \" was\", 1)\n\treturn strings.ToLower(str)\n}", "title": "" }, { "docid": "361d021bbb5307dbf681a34e489f3feb", "score": "0.41583058", "text": "func toRegexp(pattern string) string {\n\ttmp := strings.Split(pattern, \".\")\n\tfor i, t := range tmp {\n\t\ts := strings.Replace(t, \"*\", \".*\", -1)\n\t\ttmp[i] = strings.Replace(s, \"?\", \".\", -1)\n\t}\n\treturn strings.Join(tmp, \"\\\\.\")\n}", "title": "" }, { "docid": "9547cbfad7288bb5d392d4cee97c4378", "score": "0.41526172", "text": "func priceClean(s string) string {\n\tprice := \"\"\n\tfields := strings.Fields(strings.TrimSpace(s))\n\tfor i, v := range fields {\n\t\tif i == 0 {\n\t\t\tprice = \"Normal Price: \" + v\n\t\t} else if i == 1 {\n\t\t\tprice = price + \"\\n**Sales Price**: \" + v\n\t\t} else {\n\t\t\tfmt.Println(\"[\" + time.Now().String() + \"] [WARN] Found more product price lines then expected.\")\n\t\t}\n\t}\n\treturn strings.TrimSpace(price)\n}", "title": "" }, { "docid": "ed84f729d88c070f82e7486a3c7b9cfc", "score": "0.41456974", "text": "func Words(s string) (tokens []string) {\n\tvar (\n\t\tsym string = `(\"|\\.\\.\\.|\\.|,|:|;|\\(|\\)|\\[|]|{|}|¿|\\?|¡|!|[0-9]+\\.[0-9]+)`\n\t\treS = regexp.MustCompile(`\\s|\\t`)\n\t\treD = regexp.MustCompile(sym)\n\t\tws = reS.Split(s, -1)\n\t)\n\n\tfor _, w := range ws {\n\t\tif reD.MatchString(w) {\n\t\t\tprocessed := reD.ReplaceAllString(w, ` $1 `)\n\t\t\ttemps := reS.Split(processed, -1)\n\n\t\t\tfor _, t := range temps {\n\t\t\t\tif len(t) > 0 {\n\t\t\t\t\ttokens = append(tokens, t)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if len(w) > 0 {\n\t\t\ttokens = append(tokens, w)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "245a1e47587c1d1dc2b09f712605e4ef", "score": "0.41434786", "text": "func First(ss ...string) string {\n\tfor _, s := range ss {\n\t\tif s != \"\" {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "b3903276b986fdf453fc2d9e45ebcaf8", "score": "0.4139757", "text": "func TestMono_Basics(t *testing.T) {\n\trunRegexTrial(t, `abc`, 0, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `abc`, 0, \"xbc\", \"Fail.\")\n\trunRegexTrial(t, `abc`, 0, \"axc\", \"Fail.\")\n\trunRegexTrial(t, `abc`, 0, \"abx\", \"Fail.\")\n\trunRegexTrial(t, `abc`, 0, \"xabcy\", \"Pass. Group[0]=(1,3)\")\n\trunRegexTrial(t, `abc`, 0, \"ababc\", \"Pass. Group[0]=(2,3)\")\n\trunRegexTrial(t, `ab*c`, 0, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab*bc`, 0, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab*bc`, 0, \"abbc\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `ab*bc`, 0, \"abbbbc\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `.{1}`, 0, \"abbbbc\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `.{3,4}`, 0, \"abbbbc\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `ab{0,}bc`, 0, \"abbbbc\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab+bc`, 0, \"abbc\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `ab+bc`, 0, \"abc\", \"Fail.\")\n\trunRegexTrial(t, `ab+bc`, 0, \"abq\", \"Fail.\")\n\trunRegexTrial(t, `ab{1,}bc`, 0, \"abq\", \"Fail.\")\n\trunRegexTrial(t, `ab+bc`, 0, \"abbbbc\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab{1,}bc`, 0, \"abbbbc\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab{1,3}bc`, 0, \"abbbbc\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab{3,4}bc`, 0, \"abbbbc\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab{4,5}bc`, 0, \"abbbbc\", \"Fail.\")\n\trunRegexTrial(t, `ab?bc`, 0, \"abbc\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `ab?bc`, 0, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab{0,1}bc`, 0, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab?bc`, 0, \"abbbbc\", \"Fail.\")\n\trunRegexTrial(t, `ab?c`, 0, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab{0,1}c`, 0, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `^abc$`, 0, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `^abc$`, 0, \"abcc\", \"Fail.\")\n\trunRegexTrial(t, `^abc`, 0, \"abcc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `^abc$`, 0, \"aabc\", \"Fail.\")\n\trunRegexTrial(t, `abc$`, 0, \"aabc\", \"Pass. Group[0]=(1,3)\")\n\trunRegexTrial(t, `abc$`, 0, \"aabcd\", \"Fail.\")\n\trunRegexTrial(t, `^`, 0, \"abc\", \"Pass. Group[0]=(0,0)\")\n\trunRegexTrial(t, `$`, 0, \"abc\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `a.c`, 0, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a.c`, 0, \"axc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a.*c`, 0, \"axyzc\", \"Pass. Group[0]=(0,5)\")\n\trunRegexTrial(t, `a.*c`, 0, \"axyzd\", \"Fail.\")\n\trunRegexTrial(t, `a[bc]d`, 0, \"abc\", \"Fail.\")\n\trunRegexTrial(t, `a[bc]d`, 0, \"abd\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[b-d]e`, 0, \"abd\", \"Fail.\")\n\trunRegexTrial(t, `a[b-d]e`, 0, \"ace\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[b-d]`, 0, \"aac\", \"Pass. Group[0]=(1,2)\")\n\trunRegexTrial(t, `a[-b]`, 0, \"a-\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `a[b-]`, 0, \"a-\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `a[b-a]`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `a[]b`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `a[`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `a]`, 0, \"a]\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `a[]]b`, 0, \"a]b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[^bc]d`, 0, \"aed\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[^bc]d`, 0, \"abd\", \"Fail.\")\n\trunRegexTrial(t, `a[^-b]c`, 0, \"adc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[^-b]c`, 0, \"a-c\", \"Fail.\")\n\trunRegexTrial(t, `a[^]b]c`, 0, \"a]c\", \"Fail.\")\n\trunRegexTrial(t, `a[^]b]c`, 0, \"adc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `\\ba\\b`, 0, \"a-\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `\\ba\\b`, 0, \"-a\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `\\ba\\b`, 0, \"-a-\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `\\by\\b`, 0, \"xy\", \"Fail.\")\n\trunRegexTrial(t, `\\by\\b`, 0, \"yz\", \"Fail.\")\n\trunRegexTrial(t, `\\by\\b`, 0, \"xyz\", \"Fail.\")\n\trunRegexTrial(t, `\\Ba\\B`, 0, \"a-\", \"Fail.\")\n\trunRegexTrial(t, `\\Ba\\B`, 0, \"-a\", \"Fail.\")\n\trunRegexTrial(t, `\\Ba\\B`, 0, \"-a-\", \"Fail.\")\n\trunRegexTrial(t, `\\By\\b`, 0, \"xy\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `\\by\\B`, 0, \"yz\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `\\By\\B`, 0, \"xyz\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `\\w`, 0, \"a\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `\\w`, 0, \"-\", \"Fail.\")\n\trunRegexTrial(t, `\\W`, 0, \"a\", \"Fail.\")\n\trunRegexTrial(t, `\\W`, 0, \"-\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `a\\sb`, 0, \"a b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a\\sb`, 0, \"a-b\", \"Fail.\")\n\trunRegexTrial(t, `a\\Sb`, 0, \"a b\", \"Fail.\")\n\trunRegexTrial(t, `a\\Sb`, 0, \"a-b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `\\d`, 0, \"1\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `\\d`, 0, \"-\", \"Fail.\")\n\trunRegexTrial(t, `\\D`, 0, \"1\", \"Fail.\")\n\trunRegexTrial(t, `\\D`, 0, \"-\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `[\\w]`, 0, \"a\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `[\\w]`, 0, \"-\", \"Fail.\")\n\trunRegexTrial(t, `[\\W]`, 0, \"a\", \"Fail.\")\n\trunRegexTrial(t, `[\\W]`, 0, \"-\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `a[\\s]b`, 0, \"a b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[\\s]b`, 0, \"a-b\", \"Fail.\")\n\trunRegexTrial(t, `a[\\S]b`, 0, \"a b\", \"Fail.\")\n\trunRegexTrial(t, `a[\\S]b`, 0, \"a-b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `[\\d]`, 0, \"1\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `[\\d]`, 0, \"-\", \"Fail.\")\n\trunRegexTrial(t, `[\\D]`, 0, \"1\", \"Fail.\")\n\trunRegexTrial(t, `[\\D]`, 0, \"-\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `ab|cd`, 0, \"abc\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `ab|cd`, 0, \"abcd\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `()ef`, 0, \"def\", \"Pass. Group[0]=(1,2) Group[1]=(1,0)\")\n\trunRegexTrial(t, `*a`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `(*)b`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `$b`, 0, \"b\", \"Fail.\")\n\trunRegexTrial(t, `a\\`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `a\\(b`, 0, \"a(b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a\\(*b`, 0, \"ab\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `a\\(*b`, 0, \"a((b\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `a\\\\b`, 0, \"a\\\\b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `abc)`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `(abc`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `((a))`, 0, \"abc\", \"Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1)\")\n\trunRegexTrial(t, `(a)b(c)`, 0, \"abc\", \"Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(2,1)\")\n\trunRegexTrial(t, `a+b+c`, 0, \"aabbabc\", \"Pass. Group[0]=(4,3)\")\n\trunRegexTrial(t, `a{1,}b{1,}c`, 0, \"aabbabc\", \"Pass. Group[0]=(4,3)\")\n\trunRegexTrial(t, `a**`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `a.+?c`, 0, \"abcabc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `(a+|b)*`, 0, \"ab\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)\")\n\trunRegexTrial(t, `(a+|b){0,}`, 0, \"ab\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)\")\n\trunRegexTrial(t, `(a+|b)+`, 0, \"ab\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)\")\n\trunRegexTrial(t, `(a+|b){1,}`, 0, \"ab\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)\")\n\trunRegexTrial(t, `(a+|b)?`, 0, \"ab\", \"Pass. Group[0]=(0,1) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(a+|b){0,1}`, 0, \"ab\", \"Pass. Group[0]=(0,1) Group[1]=(0,1)\")\n\trunRegexTrial(t, `)(`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `[^ab]*`, 0, \"cde\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `abc`, 0, \"\", \"Fail.\")\n\trunRegexTrial(t, `a*`, 0, \"\", \"Pass. Group[0]=(0,0)\")\n\trunRegexTrial(t, `([abc])*d`, 0, \"abbbcd\", \"Pass. Group[0]=(0,6) Group[1]=(0,1)(1,1)(2,1)(3,1)(4,1)\")\n\trunRegexTrial(t, `([abc])*bcd`, 0, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]=(0,1)\")\n\trunRegexTrial(t, `a|b|c|d|e`, 0, \"e\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `(a|b|c|d|e)f`, 0, \"ef\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `abcd*efg`, 0, \"abcdefg\", \"Pass. Group[0]=(0,7)\")\n\trunRegexTrial(t, `ab*`, 0, \"xabyabbbz\", \"Pass. Group[0]=(1,2)\")\n\trunRegexTrial(t, `ab*`, 0, \"xayabbbz\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `(ab|cd)e`, 0, \"abcde\", \"Pass. Group[0]=(2,3) Group[1]=(2,2)\")\n\trunRegexTrial(t, `[abhgefdc]ij`, 0, \"hij\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `^(ab|cd)e`, 0, \"abcde\", \"Fail.\")\n\trunRegexTrial(t, `(abc|)ef`, 0, \"abcdef\", \"Pass. Group[0]=(4,2) Group[1]=(4,0)\")\n\trunRegexTrial(t, `(a|b)c*d`, 0, \"abcd\", \"Pass. Group[0]=(1,3) Group[1]=(1,1)\")\n\trunRegexTrial(t, `(ab|ab*)bc`, 0, \"abc\", \"Pass. Group[0]=(0,3) Group[1]=(0,1)\")\n\trunRegexTrial(t, `a([bc]*)c*`, 0, \"abc\", \"Pass. Group[0]=(0,3) Group[1]=(1,2)\")\n\trunRegexTrial(t, `a([bc]*)(c*d)`, 0, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)\")\n\trunRegexTrial(t, `a([bc]+)(c*d)`, 0, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)\")\n\trunRegexTrial(t, `a([bc]*)(c+d)`, 0, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]=(1,1) Group[2]=(2,2)\")\n\trunRegexTrial(t, `a[bcd]*dcdcde`, 0, \"adcdcde\", \"Pass. Group[0]=(0,7)\")\n\trunRegexTrial(t, `a[bcd]+dcdcde`, 0, \"adcdcde\", \"Fail.\")\n\trunRegexTrial(t, `(ab|a)b*c`, 0, \"abc\", \"Pass. Group[0]=(0,3) Group[1]=(0,2)\")\n\trunRegexTrial(t, `((a)(b)c)(d)`, 0, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]=(0,3) Group[2]=(0,1) Group[3]=(1,1) Group[4]=(3,1)\")\n\trunRegexTrial(t, `[a-zA-Z_][a-zA-Z0-9_]*`, 0, \"alpha\", \"Pass. Group[0]=(0,5)\")\n\trunRegexTrial(t, `^a(bc+|b[eh])g|.h$`, 0, \"abh\", \"Pass. Group[0]=(1,2) Group[1]=\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, 0, \"effgz\", \"Pass. Group[0]=(0,5) Group[1]=(0,5) Group[2]=\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, 0, \"ij\", \"Pass. Group[0]=(0,2) Group[1]=(0,2) Group[2]=(1,1)\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, 0, \"effg\", \"Fail.\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, 0, \"bcdd\", \"Fail.\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, 0, \"reffgz\", \"Pass. Group[0]=(1,5) Group[1]=(1,5) Group[2]=\")\n\trunRegexTrial(t, `((((((((((a))))))))))`, 0, \"a\", \"Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)\")\n\trunRegexTrial(t, `((((((((((a))))))))))\\10`, 0, \"aa\", \"Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)\")\n\trunRegexTrial(t, `((((((((((a))))))))))!`, 0, \"aa\", \"Fail.\")\n\trunRegexTrial(t, `((((((((((a))))))))))!`, 0, \"a!\", \"Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)\")\n\trunRegexTrial(t, `(((((((((a)))))))))`, 0, \"a\", \"Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1)\")\n\trunRegexTrial(t, `multiple words of text`, 0, \"uh-uh\", \"Fail.\")\n\trunRegexTrial(t, `multiple words`, 0, \"multiple words, yeah\", \"Pass. Group[0]=(0,14)\")\n\trunRegexTrial(t, `(.*)c(.*)`, 0, \"abcde\", \"Pass. Group[0]=(0,5) Group[1]=(0,2) Group[2]=(3,2)\")\n\trunRegexTrial(t, `\\((.*), (.*)\\)`, 0, \"(a, b)\", \"Pass. Group[0]=(0,6) Group[1]=(1,1) Group[2]=(4,1)\")\n\trunRegexTrial(t, `[k]`, 0, \"ab\", \"Fail.\")\n\trunRegexTrial(t, `abcd`, 0, \"abcd\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `a(bc)d`, 0, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]=(1,2)\")\n\trunRegexTrial(t, `a[-]?c`, 0, \"ac\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `(abc)\\1`, 0, \"abcabc\", \"Pass. Group[0]=(0,6) Group[1]=(0,3)\")\n\trunRegexTrial(t, `([a-c]*)\\1`, 0, \"abcabc\", \"Pass. Group[0]=(0,6) Group[1]=(0,3)\")\n\trunRegexTrial(t, `\\1`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `\\2`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `(a)|\\1`, 0, \"a\", \"Pass. Group[0]=(0,1) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(a)|\\1`, 0, \"x\", \"Fail.\")\n\trunRegexTrial(t, `(a)|\\2`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `(([a-c])b*?\\2)*`, 0, \"ababbbcbc\", \"Pass. Group[0]=(0,5) Group[1]=(0,3)(3,2) Group[2]=(0,1)(3,1)\")\n\trunRegexTrial(t, `(([a-c])b*?\\2){3}`, 0, \"ababbbcbc\", \"Pass. Group[0]=(0,9) Group[1]=(0,3)(3,3)(6,3) Group[2]=(0,1)(3,1)(6,1)\")\n\trunRegexTrial(t, `((\\3|b)\\2(a)x)+`, 0, \"aaxabxbaxbbx\", \"Fail.\")\n\trunRegexTrial(t, `((\\3|b)\\2(a)x)+`, 0, \"aaaxabaxbaaxbbax\", \"Pass. Group[0]=(12,4) Group[1]=(12,4) Group[2]=(12,1) Group[3]=(14,1)\")\n\trunRegexTrial(t, `((\\3|b)\\2(a)){2,}`, 0, \"bbaababbabaaaaabbaaaabba\", \"Pass. Group[0]=(15,9) Group[1]=(15,3)(18,3)(21,3) Group[2]=(15,1)(18,1)(21,1) Group[3]=(17,1)(20,1)(23,1)\")\n\trunRegexTrial(t, `abc`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `abc`, IgnoreCase, \"XBC\", \"Fail.\")\n\trunRegexTrial(t, `abc`, IgnoreCase, \"AXC\", \"Fail.\")\n\trunRegexTrial(t, `abc`, IgnoreCase, \"ABX\", \"Fail.\")\n\trunRegexTrial(t, `abc`, IgnoreCase, \"XABCY\", \"Pass. Group[0]=(1,3)\")\n\trunRegexTrial(t, `abc`, IgnoreCase, \"ABABC\", \"Pass. Group[0]=(2,3)\")\n\trunRegexTrial(t, `ab*c`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab*bc`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab*bc`, IgnoreCase, \"ABBC\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `ab*?bc`, IgnoreCase, \"ABBBBC\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab{0,}?bc`, IgnoreCase, \"ABBBBC\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab+?bc`, IgnoreCase, \"ABBC\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `ab+bc`, IgnoreCase, \"ABC\", \"Fail.\")\n\trunRegexTrial(t, `ab+bc`, IgnoreCase, \"ABQ\", \"Fail.\")\n\trunRegexTrial(t, `ab{1,}bc`, IgnoreCase, \"ABQ\", \"Fail.\")\n\trunRegexTrial(t, `ab+bc`, IgnoreCase, \"ABBBBC\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab{1,}?bc`, IgnoreCase, \"ABBBBC\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab{1,3}?bc`, IgnoreCase, \"ABBBBC\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab{3,4}?bc`, IgnoreCase, \"ABBBBC\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab{4,5}?bc`, IgnoreCase, \"ABBBBC\", \"Fail.\")\n\trunRegexTrial(t, `ab??bc`, IgnoreCase, \"ABBC\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `ab??bc`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab{0,1}?bc`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab??bc`, IgnoreCase, \"ABBBBC\", \"Fail.\")\n\trunRegexTrial(t, `ab??c`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab{0,1}?c`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `^abc$`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `^abc$`, IgnoreCase, \"ABCC\", \"Fail.\")\n\trunRegexTrial(t, `^abc`, IgnoreCase, \"ABCC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `^abc$`, IgnoreCase, \"AABC\", \"Fail.\")\n\trunRegexTrial(t, `abc$`, IgnoreCase, \"AABC\", \"Pass. Group[0]=(1,3)\")\n\trunRegexTrial(t, `^`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,0)\")\n\trunRegexTrial(t, `$`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `a.c`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a.c`, IgnoreCase, \"AXC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a.*?c`, IgnoreCase, \"AXYZC\", \"Pass. Group[0]=(0,5)\")\n\trunRegexTrial(t, `a.*c`, IgnoreCase, \"AXYZD\", \"Fail.\")\n\trunRegexTrial(t, `a[bc]d`, IgnoreCase, \"ABC\", \"Fail.\")\n\trunRegexTrial(t, `a[bc]d`, IgnoreCase, \"ABD\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[b-d]e`, IgnoreCase, \"ABD\", \"Fail.\")\n\trunRegexTrial(t, `a[b-d]e`, IgnoreCase, \"ACE\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[b-d]`, IgnoreCase, \"AAC\", \"Pass. Group[0]=(1,2)\")\n\trunRegexTrial(t, `a[-b]`, IgnoreCase, \"A-\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `a[b-]`, IgnoreCase, \"A-\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `a[b-a]`, IgnoreCase, \"-\", \"Error.\")\n\trunRegexTrial(t, `a[]b`, IgnoreCase, \"-\", \"Error.\")\n\trunRegexTrial(t, `a[`, IgnoreCase, \"-\", \"Error.\")\n\trunRegexTrial(t, `a]`, IgnoreCase, \"A]\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `a[]]b`, IgnoreCase, \"A]B\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[^bc]d`, IgnoreCase, \"AED\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[^bc]d`, IgnoreCase, \"ABD\", \"Fail.\")\n\trunRegexTrial(t, `a[^-b]c`, IgnoreCase, \"ADC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[^-b]c`, IgnoreCase, \"A-C\", \"Fail.\")\n\trunRegexTrial(t, `a[^]b]c`, IgnoreCase, \"A]C\", \"Fail.\")\n\trunRegexTrial(t, `a[^]b]c`, IgnoreCase, \"ADC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab|cd`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `ab|cd`, IgnoreCase, \"ABCD\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `()ef`, IgnoreCase, \"DEF\", \"Pass. Group[0]=(1,2) Group[1]=(1,0)\")\n\trunRegexTrial(t, `*a`, IgnoreCase, \"-\", \"Error.\")\n\trunRegexTrial(t, `(*)b`, IgnoreCase, \"-\", \"Error.\")\n\trunRegexTrial(t, `$b`, IgnoreCase, \"B\", \"Fail.\")\n\trunRegexTrial(t, `a\\`, IgnoreCase, \"-\", \"Error.\")\n\trunRegexTrial(t, `a\\(b`, IgnoreCase, \"A(B\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a\\(*b`, IgnoreCase, \"AB\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `a\\(*b`, IgnoreCase, \"A((B\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `a\\\\b`, IgnoreCase, \"A\\\\B\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `abc)`, IgnoreCase, \"-\", \"Error.\")\n\trunRegexTrial(t, `(abc`, IgnoreCase, \"-\", \"Error.\")\n\trunRegexTrial(t, `((a))`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1)\")\n\trunRegexTrial(t, `(a)b(c)`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(2,1)\")\n\trunRegexTrial(t, `a+b+c`, IgnoreCase, \"AABBABC\", \"Pass. Group[0]=(4,3)\")\n\trunRegexTrial(t, `a{1,}b{1,}c`, IgnoreCase, \"AABBABC\", \"Pass. Group[0]=(4,3)\")\n\trunRegexTrial(t, `a**`, IgnoreCase, \"-\", \"Error.\")\n\trunRegexTrial(t, `a.+?c`, IgnoreCase, \"ABCABC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a.*?c`, IgnoreCase, \"ABCABC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a.{0,5}?c`, IgnoreCase, \"ABCABC\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `(a+|b)*`, IgnoreCase, \"AB\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)\")\n\trunRegexTrial(t, `(a+|b){0,}`, IgnoreCase, \"AB\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)\")\n\trunRegexTrial(t, `(a+|b)+`, IgnoreCase, \"AB\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)\")\n\trunRegexTrial(t, `(a+|b){1,}`, IgnoreCase, \"AB\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)\")\n\trunRegexTrial(t, `(a+|b)?`, IgnoreCase, \"AB\", \"Pass. Group[0]=(0,1) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(a+|b){0,1}`, IgnoreCase, \"AB\", \"Pass. Group[0]=(0,1) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(a+|b){0,1}?`, IgnoreCase, \"AB\", \"Pass. Group[0]=(0,0) Group[1]=\")\n\trunRegexTrial(t, `)(`, IgnoreCase, \"-\", \"Error.\")\n\trunRegexTrial(t, `[^ab]*`, IgnoreCase, \"CDE\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `abc`, IgnoreCase, \"\", \"Fail.\")\n\trunRegexTrial(t, `a*`, IgnoreCase, \"\", \"Pass. Group[0]=(0,0)\")\n\trunRegexTrial(t, `([abc])*d`, IgnoreCase, \"ABBBCD\", \"Pass. Group[0]=(0,6) Group[1]=(0,1)(1,1)(2,1)(3,1)(4,1)\")\n\trunRegexTrial(t, `([abc])*bcd`, IgnoreCase, \"ABCD\", \"Pass. Group[0]=(0,4) Group[1]=(0,1)\")\n\trunRegexTrial(t, `a|b|c|d|e`, IgnoreCase, \"E\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `(a|b|c|d|e)f`, IgnoreCase, \"EF\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `abcd*efg`, IgnoreCase, \"ABCDEFG\", \"Pass. Group[0]=(0,7)\")\n\trunRegexTrial(t, `ab*`, IgnoreCase, \"XABYABBBZ\", \"Pass. Group[0]=(1,2)\")\n\trunRegexTrial(t, `ab*`, IgnoreCase, \"XAYABBBZ\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `(ab|cd)e`, IgnoreCase, \"ABCDE\", \"Pass. Group[0]=(2,3) Group[1]=(2,2)\")\n\trunRegexTrial(t, `[abhgefdc]ij`, IgnoreCase, \"HIJ\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `^(ab|cd)e`, IgnoreCase, \"ABCDE\", \"Fail.\")\n\trunRegexTrial(t, `(abc|)ef`, IgnoreCase, \"ABCDEF\", \"Pass. Group[0]=(4,2) Group[1]=(4,0)\")\n\trunRegexTrial(t, `(a|b)c*d`, IgnoreCase, \"ABCD\", \"Pass. Group[0]=(1,3) Group[1]=(1,1)\")\n\trunRegexTrial(t, `(ab|ab*)bc`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,3) Group[1]=(0,1)\")\n\trunRegexTrial(t, `a([bc]*)c*`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,3) Group[1]=(1,2)\")\n\trunRegexTrial(t, `a([bc]*)(c*d)`, IgnoreCase, \"ABCD\", \"Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)\")\n\trunRegexTrial(t, `a([bc]+)(c*d)`, IgnoreCase, \"ABCD\", \"Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)\")\n\trunRegexTrial(t, `a([bc]*)(c+d)`, IgnoreCase, \"ABCD\", \"Pass. Group[0]=(0,4) Group[1]=(1,1) Group[2]=(2,2)\")\n\trunRegexTrial(t, `a[bcd]*dcdcde`, IgnoreCase, \"ADCDCDE\", \"Pass. Group[0]=(0,7)\")\n\trunRegexTrial(t, `a[bcd]+dcdcde`, IgnoreCase, \"ADCDCDE\", \"Fail.\")\n\trunRegexTrial(t, `(ab|a)b*c`, IgnoreCase, \"ABC\", \"Pass. Group[0]=(0,3) Group[1]=(0,2)\")\n\trunRegexTrial(t, `((a)(b)c)(d)`, IgnoreCase, \"ABCD\", \"Pass. Group[0]=(0,4) Group[1]=(0,3) Group[2]=(0,1) Group[3]=(1,1) Group[4]=(3,1)\")\n\trunRegexTrial(t, `[a-zA-Z_][a-zA-Z0-9_]*`, IgnoreCase, \"ALPHA\", \"Pass. Group[0]=(0,5)\")\n\trunRegexTrial(t, `^a(bc+|b[eh])g|.h$`, IgnoreCase, \"ABH\", \"Pass. Group[0]=(1,2) Group[1]=\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, IgnoreCase, \"EFFGZ\", \"Pass. Group[0]=(0,5) Group[1]=(0,5) Group[2]=\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, IgnoreCase, \"IJ\", \"Pass. Group[0]=(0,2) Group[1]=(0,2) Group[2]=(1,1)\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, IgnoreCase, \"EFFG\", \"Fail.\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, IgnoreCase, \"BCDD\", \"Fail.\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, IgnoreCase, \"REFFGZ\", \"Pass. Group[0]=(1,5) Group[1]=(1,5) Group[2]=\")\n\trunRegexTrial(t, `((((((((((a))))))))))`, IgnoreCase, \"A\", \"Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)\")\n\trunRegexTrial(t, `((((((((((a))))))))))\\10`, IgnoreCase, \"AA\", \"Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)\")\n\trunRegexTrial(t, `((((((((((a))))))))))!`, IgnoreCase, \"AA\", \"Fail.\")\n\trunRegexTrial(t, `((((((((((a))))))))))!`, IgnoreCase, \"A!\", \"Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)\")\n\trunRegexTrial(t, `(((((((((a)))))))))`, IgnoreCase, \"A\", \"Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1)\")\n\trunRegexTrial(t, `(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))`, IgnoreCase, \"A\", \"Pass. Group[0]=(0,1) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))`, IgnoreCase, \"C\", \"Pass. Group[0]=(0,1) Group[1]=(0,1)\")\n\trunRegexTrial(t, `multiple words of text`, IgnoreCase, \"UH-UH\", \"Fail.\")\n\trunRegexTrial(t, `multiple words`, IgnoreCase, \"MULTIPLE WORDS, YEAH\", \"Pass. Group[0]=(0,14)\")\n\trunRegexTrial(t, `(.*)c(.*)`, IgnoreCase, \"ABCDE\", \"Pass. Group[0]=(0,5) Group[1]=(0,2) Group[2]=(3,2)\")\n\trunRegexTrial(t, `\\((.*), (.*)\\)`, IgnoreCase, \"(A, B)\", \"Pass. Group[0]=(0,6) Group[1]=(1,1) Group[2]=(4,1)\")\n\trunRegexTrial(t, `[k]`, IgnoreCase, \"AB\", \"Fail.\")\n\trunRegexTrial(t, `abcd`, IgnoreCase, \"ABCD\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `a(bc)d`, IgnoreCase, \"ABCD\", \"Pass. Group[0]=(0,4) Group[1]=(1,2)\")\n\trunRegexTrial(t, `a[-]?c`, IgnoreCase, \"AC\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `(abc)\\1`, IgnoreCase, \"ABCABC\", \"Pass. Group[0]=(0,6) Group[1]=(0,3)\")\n\trunRegexTrial(t, `([a-c]*)\\1`, IgnoreCase, \"ABCABC\", \"Pass. Group[0]=(0,6) Group[1]=(0,3)\")\n\trunRegexTrial(t, `a(?!b).`, 0, \"abad\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `a(?=d).`, 0, \"abad\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `a(?=c|d).`, 0, \"abad\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `a(?:b|c|d)(.)`, 0, \"ace\", \"Pass. Group[0]=(0,3) Group[1]=(2,1)\")\n\trunRegexTrial(t, `a(?:b|c|d)*(.)`, 0, \"ace\", \"Pass. Group[0]=(0,3) Group[1]=(2,1)\")\n\trunRegexTrial(t, `a(?:b|c|d)+?(.)`, 0, \"ace\", \"Pass. Group[0]=(0,3) Group[1]=(2,1)\")\n\trunRegexTrial(t, `a(?:b|c|d)+?(.)`, 0, \"acdbcdbe\", \"Pass. Group[0]=(0,3) Group[1]=(2,1)\")\n\trunRegexTrial(t, `a(?:b|c|d)+(.)`, 0, \"acdbcdbe\", \"Pass. Group[0]=(0,8) Group[1]=(7,1)\")\n\trunRegexTrial(t, `a(?:b|c|d){2}(.)`, 0, \"acdbcdbe\", \"Pass. Group[0]=(0,4) Group[1]=(3,1)\")\n\trunRegexTrial(t, `a(?:b|c|d){4,5}(.)`, 0, \"acdbcdbe\", \"Pass. Group[0]=(0,7) Group[1]=(6,1)\")\n\trunRegexTrial(t, `a(?:b|c|d){4,5}?(.)`, 0, \"acdbcdbe\", \"Pass. Group[0]=(0,6) Group[1]=(5,1)\")\n\trunRegexTrial(t, `((foo)|(bar))*`, 0, \"foobar\", \"Pass. Group[0]=(0,6) Group[1]=(0,3)(3,3) Group[2]=(0,3) Group[3]=(3,3)\")\n\trunRegexTrial(t, `:(?:`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `a(?:b|c|d){6,7}(.)`, 0, \"acdbcdbe\", \"Pass. Group[0]=(0,8) Group[1]=(7,1)\")\n\trunRegexTrial(t, `a(?:b|c|d){6,7}?(.)`, 0, \"acdbcdbe\", \"Pass. Group[0]=(0,8) Group[1]=(7,1)\")\n\trunRegexTrial(t, `a(?:b|c|d){5,6}(.)`, 0, \"acdbcdbe\", \"Pass. Group[0]=(0,8) Group[1]=(7,1)\")\n\trunRegexTrial(t, `a(?:b|c|d){5,6}?(.)`, 0, \"acdbcdbe\", \"Pass. Group[0]=(0,7) Group[1]=(6,1)\")\n\trunRegexTrial(t, `a(?:b|c|d){5,7}(.)`, 0, \"acdbcdbe\", \"Pass. Group[0]=(0,8) Group[1]=(7,1)\")\n\trunRegexTrial(t, `a(?:b|c|d){5,7}?(.)`, 0, \"acdbcdbe\", \"Pass. Group[0]=(0,7) Group[1]=(6,1)\")\n\trunRegexTrial(t, `a(?:b|(c|e){1,2}?|d)+?(.)`, 0, \"ace\", \"Pass. Group[0]=(0,3) Group[1]=(1,1) Group[2]=(2,1)\")\n\trunRegexTrial(t, `^(.+)?B`, 0, \"AB\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `^([^a-z])|(\\^)$`, 0, \".\", \"Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=\")\n\trunRegexTrial(t, `^[<>]&`, 0, \"<&OUT\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `^(a\\1?){4}$`, 0, \"aaaaaaaaaa\", \"Pass. Group[0]=(0,10) Group[1]=(0,1)(1,2)(3,3)(6,4)\")\n\trunRegexTrial(t, `^(a\\1?){4}$`, 0, \"aaaaaaaaa\", \"Fail.\")\n\trunRegexTrial(t, `^(a\\1?){4}$`, 0, \"aaaaaaaaaaa\", \"Fail.\")\n\trunRegexTrial(t, `^(a(?(1)\\1)){4}$`, 0, \"aaaaaaaaaa\", \"Pass. Group[0]=(0,10) Group[1]=(0,1)(1,2)(3,3)(6,4)\")\n\trunRegexTrial(t, `^(a(?(1)\\1)){4}$`, 0, \"aaaaaaaaa\", \"Fail.\")\n\trunRegexTrial(t, `^(a(?(1)\\1)){4}$`, 0, \"aaaaaaaaaaa\", \"Fail.\")\n\trunRegexTrial(t, `((a{4})+)`, 0, \"aaaaaaaaa\", \"Pass. Group[0]=(0,8) Group[1]=(0,8) Group[2]=(0,4)(4,4)\")\n\trunRegexTrial(t, `(((aa){2})+)`, 0, \"aaaaaaaaaa\", \"Pass. Group[0]=(0,8) Group[1]=(0,8) Group[2]=(0,4)(4,4) Group[3]=(0,2)(2,2)(4,2)(6,2)\")\n\trunRegexTrial(t, `(((a{2}){2})+)`, 0, \"aaaaaaaaaa\", \"Pass. Group[0]=(0,8) Group[1]=(0,8) Group[2]=(0,4)(4,4) Group[3]=(0,2)(2,2)(4,2)(6,2)\")\n\trunRegexTrial(t, `(?:(f)(o)(o)|(b)(a)(r))*`, 0, \"foobar\", \"Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(1,1) Group[3]=(2,1) Group[4]=(3,1) Group[5]=(4,1) Group[6]=(5,1)\")\n\trunRegexTrial(t, `(?<=a)b`, 0, \"ab\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `(?<=a)b`, 0, \"cb\", \"Fail.\")\n\trunRegexTrial(t, `(?<=a)b`, 0, \"b\", \"Fail.\")\n\trunRegexTrial(t, `(?<!c)b`, 0, \"ab\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `(?<!c)b`, 0, \"cb\", \"Fail.\")\n\trunRegexTrial(t, `(?<!c)b`, 0, \"b\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `(?<!c)b`, 0, \"b\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `(?<%)b`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `(?:..)*a`, 0, \"aba\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `(?:..)*?a`, 0, \"aba\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `^(?:b|a(?=(.)))*\\1`, 0, \"abc\", \"Pass. Group[0]=(0,2) Group[1]=(1,1)\")\n\trunRegexTrial(t, `^(){3,5}`, 0, \"abc\", \"Pass. Group[0]=(0,0) Group[1]=(0,0)(0,0)(0,0)\")\n\trunRegexTrial(t, `^(a+)*ax`, 0, \"aax\", \"Pass. Group[0]=(0,3) Group[1]=(0,1)\")\n\trunRegexTrial(t, `^((a|b)+)*ax`, 0, \"aax\", \"Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(0,1)\")\n\trunRegexTrial(t, `^((a|bc)+)*ax`, 0, \"aax\", \"Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(0,1)\")\n\trunRegexTrial(t, `(a|x)*ab`, 0, \"cab\", \"Pass. Group[0]=(1,2) Group[1]=\")\n\trunRegexTrial(t, `(a)*ab`, 0, \"cab\", \"Pass. Group[0]=(1,2) Group[1]=\")\n\trunRegexTrial(t, `(?:(?i)a)b`, 0, \"ab\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `((?i)a)b`, 0, \"ab\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(?:(?i)a)b`, 0, \"Ab\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `((?i)a)b`, 0, \"Ab\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(?:(?i)a)b`, 0, \"aB\", \"Fail.\")\n\trunRegexTrial(t, `((?i)a)b`, 0, \"aB\", \"Fail.\")\n\trunRegexTrial(t, `(?i:a)b`, 0, \"ab\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `((?i:a))b`, 0, \"ab\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(?i:a)b`, 0, \"Ab\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `((?i:a))b`, 0, \"Ab\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(?i:a)b`, 0, \"aB\", \"Fail.\")\n\trunRegexTrial(t, `((?i:a))b`, 0, \"aB\", \"Fail.\")\n\trunRegexTrial(t, `(?:(?-i)a)b`, IgnoreCase, \"ab\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `((?-i)a)b`, IgnoreCase, \"ab\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(?:(?-i)a)b`, IgnoreCase, \"aB\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `((?-i)a)b`, IgnoreCase, \"aB\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(?:(?-i)a)b`, IgnoreCase, \"Ab\", \"Fail.\")\n\trunRegexTrial(t, `((?-i)a)b`, IgnoreCase, \"Ab\", \"Fail.\")\n\trunRegexTrial(t, `(?:(?-i)a)b`, IgnoreCase, \"aB\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `((?-i)a)b`, IgnoreCase, \"aB\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(?:(?-i)a)b`, IgnoreCase, \"AB\", \"Fail.\")\n\trunRegexTrial(t, `((?-i)a)b`, IgnoreCase, \"AB\", \"Fail.\")\n\trunRegexTrial(t, `(?-i:a)b`, IgnoreCase, \"ab\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `((?-i:a))b`, IgnoreCase, \"ab\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(?-i:a)b`, IgnoreCase, \"aB\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `((?-i:a))b`, IgnoreCase, \"aB\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(?-i:a)b`, IgnoreCase, \"Ab\", \"Fail.\")\n\trunRegexTrial(t, `((?-i:a))b`, IgnoreCase, \"Ab\", \"Fail.\")\n\trunRegexTrial(t, `(?-i:a)b`, IgnoreCase, \"aB\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `((?-i:a))b`, IgnoreCase, \"aB\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(?-i:a)b`, IgnoreCase, \"AB\", \"Fail.\")\n\trunRegexTrial(t, `((?-i:a))b`, IgnoreCase, \"AB\", \"Fail.\")\n\trunRegexTrial(t, `((?-i:a.))b`, IgnoreCase, \"a\\nB\", \"Fail.\")\n\trunRegexTrial(t, `((?s-i:a.))b`, IgnoreCase, \"a\\nB\", \"Pass. Group[0]=(0,3) Group[1]=(0,2)\")\n\trunRegexTrial(t, `((?s-i:a.))b`, IgnoreCase, \"B\\nB\", \"Fail.\")\n\trunRegexTrial(t, `(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))`, 0, \"cabbbb\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))`, 0, \"caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\", \"Pass. Group[0]=(0,41)\")\n\trunRegexTrial(t, `(ab)\\d\\1`, IgnoreCase, \"Ab4ab\", \"Pass. Group[0]=(0,5) Group[1]=(0,2)\")\n\trunRegexTrial(t, `(ab)\\d\\1`, IgnoreCase, \"ab4Ab\", \"Pass. Group[0]=(0,5) Group[1]=(0,2)\")\n\trunRegexTrial(t, `foo\\w*\\d{4}baz`, 0, \"foobar1234baz\", \"Pass. Group[0]=(0,13)\")\n\trunRegexTrial(t, `x(~~)*(?:(?:F)?)?`, 0, \"x~~\", \"Pass. Group[0]=(0,3) Group[1]=(1,2)\")\n\trunRegexTrial(t, `^a(?#xxx){3}c`, 0, \"aaac\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `(?<![cd])b`, 0, \"dbcb\", \"Fail.\")\n\trunRegexTrial(t, `(?<![cd])[ab]`, 0, \"dbaacb\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `(?<!(c|d))b`, 0, \"dbcb\", \"Fail.\")\n\trunRegexTrial(t, `(?<!(c|d))[ab]`, 0, \"dbaacb\", \"Pass. Group[0]=(2,1) Group[1]=\")\n\trunRegexTrial(t, `(?<!cd)[ab]`, 0, \"cdaccb\", \"Pass. Group[0]=(5,1)\")\n\trunRegexTrial(t, `^(?:a?b?)*$`, 0, \"a--\", \"Fail.\")\n\trunRegexTrial(t, `((?s)^a(.))((?m)^b$)`, 0, \"a\\nb\\nc\\n\", \"Pass. Group[0]=(0,3) Group[1]=(0,2) Group[2]=(1,1) Group[3]=(2,1)\")\n\trunRegexTrial(t, `((?m)^b$)`, 0, \"a\\nb\\nc\\n\", \"Pass. Group[0]=(2,1) Group[1]=(2,1)\")\n\trunRegexTrial(t, `(?m)^b`, 0, \"a\\nb\\n\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `(?m)^(b)`, 0, \"a\\nb\\n\", \"Pass. Group[0]=(2,1) Group[1]=(2,1)\")\n\trunRegexTrial(t, `((?m)^b)`, 0, \"a\\nb\\n\", \"Pass. Group[0]=(2,1) Group[1]=(2,1)\")\n\trunRegexTrial(t, `\\n((?m)^b)`, 0, \"a\\nb\\n\", \"Pass. Group[0]=(1,2) Group[1]=(2,1)\")\n\trunRegexTrial(t, `((?s).)c(?!.)`, 0, \"a\\nb\\nc\\n\", \"Pass. Group[0]=(3,2) Group[1]=(3,1)\")\n\trunRegexTrial(t, `((?s).)c(?!.)`, 0, \"a\\nb\\nc\\n\", \"Pass. Group[0]=(3,2) Group[1]=(3,1)\")\n\trunRegexTrial(t, `((?s)b.)c(?!.)`, 0, \"a\\nb\\nc\\n\", \"Pass. Group[0]=(2,3) Group[1]=(2,2)\")\n\trunRegexTrial(t, `((?s)b.)c(?!.)`, 0, \"a\\nb\\nc\\n\", \"Pass. Group[0]=(2,3) Group[1]=(2,2)\")\n\trunRegexTrial(t, `^b`, 0, \"a\\nb\\nc\\n\", \"Fail.\")\n\trunRegexTrial(t, `()^b`, 0, \"a\\nb\\nc\\n\", \"Fail.\")\n\trunRegexTrial(t, `((?m)^b)`, 0, \"a\\nb\\nc\\n\", \"Pass. Group[0]=(2,1) Group[1]=(2,1)\")\n\trunRegexTrial(t, `(x)?(?(1)a|b)`, 0, \"a\", \"Fail.\")\n\trunRegexTrial(t, `(x)?(?(1)b|a)`, 0, \"a\", \"Pass. Group[0]=(0,1) Group[1]=\")\n\trunRegexTrial(t, `()?(?(1)b|a)`, 0, \"a\", \"Pass. Group[0]=(0,1) Group[1]=\")\n\trunRegexTrial(t, `()(?(1)b|a)`, 0, \"a\", \"Fail.\")\n\trunRegexTrial(t, `()?(?(1)a|b)`, 0, \"a\", \"Pass. Group[0]=(0,1) Group[1]=(0,0)\")\n\trunRegexTrial(t, `^(\\()?blah(?(1)(\\)))$`, 0, \"(blah)\", \"Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(5,1)\")\n\trunRegexTrial(t, `^(\\()?blah(?(1)(\\)))$`, 0, \"blah\", \"Pass. Group[0]=(0,4) Group[1]= Group[2]=\")\n\trunRegexTrial(t, `^(\\()?blah(?(1)(\\)))$`, 0, \"blah)\", \"Fail.\")\n\trunRegexTrial(t, `^(\\()?blah(?(1)(\\)))$`, 0, \"(blah\", \"Fail.\")\n\trunRegexTrial(t, `^(\\(+)?blah(?(1)(\\)))$`, 0, \"(blah)\", \"Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(5,1)\")\n\trunRegexTrial(t, `^(\\(+)?blah(?(1)(\\)))$`, 0, \"blah\", \"Pass. Group[0]=(0,4) Group[1]= Group[2]=\")\n\trunRegexTrial(t, `^(\\(+)?blah(?(1)(\\)))$`, 0, \"blah)\", \"Fail.\")\n\trunRegexTrial(t, `^(\\(+)?blah(?(1)(\\)))$`, 0, \"(blah\", \"Fail.\")\n\trunRegexTrial(t, `(?(1)a|b|c)`, 0, \"a\", \"Error.\")\n\trunRegexTrial(t, `(?(?!a)a|b)`, 0, \"a\", \"Fail.\")\n\trunRegexTrial(t, `(?(?!a)b|a)`, 0, \"a\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `(?(?=a)b|a)`, 0, \"a\", \"Fail.\")\n\trunRegexTrial(t, `(?(?=a)a|b)`, 0, \"a\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `(?=(a+?))(\\1ab)`, 0, \"aaab\", \"Pass. Group[0]=(1,3) Group[1]=(1,1) Group[2]=(1,3)\")\n\trunRegexTrial(t, `^(?=(a+?))\\1ab`, 0, \"aaab\", \"Fail.\")\n\trunRegexTrial(t, `(\\w+:)+`, 0, \"one:\", \"Pass. Group[0]=(0,4) Group[1]=(0,4)\")\n\trunRegexTrial(t, `$(?<=^(a))`, 0, \"a\", \"Pass. Group[0]=(1,0) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(?=(a+?))(\\1ab)`, 0, \"aaab\", \"Pass. Group[0]=(1,3) Group[1]=(1,1) Group[2]=(1,3)\")\n\trunRegexTrial(t, `^(?=(a+?))\\1ab`, 0, \"aaab\", \"Fail.\")\n\trunRegexTrial(t, `([\\w:]+::)?(\\w+)$`, 0, \"abcd:\", \"Fail.\")\n\trunRegexTrial(t, `([\\w:]+::)?(\\w+)$`, 0, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]= Group[2]=(0,4)\")\n\trunRegexTrial(t, `([\\w:]+::)?(\\w+)$`, 0, \"xy:z:::abcd\", \"Pass. Group[0]=(0,11) Group[1]=(0,7) Group[2]=(7,4)\")\n\trunRegexTrial(t, `^[^bcd]*(c+)`, 0, \"aexycd\", \"Pass. Group[0]=(0,5) Group[1]=(4,1)\")\n\trunRegexTrial(t, `(a*)b+`, 0, \"caab\", \"Pass. Group[0]=(1,3) Group[1]=(1,2)\")\n\trunRegexTrial(t, `([\\w:]+::)?(\\w+)$`, 0, \"abcd:\", \"Fail.\")\n\trunRegexTrial(t, `([\\w:]+::)?(\\w+)$`, 0, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]= Group[2]=(0,4)\")\n\trunRegexTrial(t, `([\\w:]+::)?(\\w+)$`, 0, \"xy:z:::abcd\", \"Pass. Group[0]=(0,11) Group[1]=(0,7) Group[2]=(7,4)\")\n\trunRegexTrial(t, `^[^bcd]*(c+)`, 0, \"aexycd\", \"Pass. Group[0]=(0,5) Group[1]=(4,1)\")\n\trunRegexTrial(t, `(>a+)ab`, 0, \"aaab\", \"Fail.\")\n\trunRegexTrial(t, `(?>a+)b`, 0, \"aaab\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `([[:]+)`, 0, \"a:[b]:\", \"Pass. Group[0]=(1,2) Group[1]=(1,2)\")\n\trunRegexTrial(t, `([[=]+)`, 0, \"a=[b]=\", \"Pass. Group[0]=(1,2) Group[1]=(1,2)\")\n\trunRegexTrial(t, `([[.]+)`, 0, \"a.[b].\", \"Pass. Group[0]=(1,2) Group[1]=(1,2)\")\n\trunRegexTrial(t, `[a[:]b[:c]`, 0, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `[a[:]b[:c]`, 0, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `((?>a+)b)`, 0, \"aaab\", \"Pass. Group[0]=(0,4) Group[1]=(0,4)\")\n\trunRegexTrial(t, `(?>(a+))b`, 0, \"aaab\", \"Pass. Group[0]=(0,4) Group[1]=(0,3)\")\n\trunRegexTrial(t, `((?>[^()]+)|\\([^()]*\\))+`, 0, \"((abc(ade)ufh()()x\", \"Pass. Group[0]=(2,16) Group[1]=(2,3)(5,5)(10,3)(13,2)(15,2)(17,1)\")\n\trunRegexTrial(t, `(?<=x+)`, 0, \"xxxxy\", \"Pass. Group[0]=(1,0)\")\n\trunRegexTrial(t, `a{37,17}`, 0, \"-\", \"Error.\")\n\trunRegexTrial(t, `\\Z`, 0, \"a\\nb\\n\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `\\z`, 0, \"a\\nb\\n\", \"Pass. Group[0]=(4,0)\")\n\trunRegexTrial(t, `$`, 0, \"a\\nb\\n\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `\\Z`, 0, \"b\\na\\n\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `\\z`, 0, \"b\\na\\n\", \"Pass. Group[0]=(4,0)\")\n\trunRegexTrial(t, `$`, 0, \"b\\na\\n\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `\\Z`, 0, \"b\\na\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `\\z`, 0, \"b\\na\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `$`, 0, \"b\\na\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `\\Z`, Multiline, \"a\\nb\\n\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `\\z`, Multiline, \"a\\nb\\n\", \"Pass. Group[0]=(4,0)\")\n\trunRegexTrial(t, `$`, Multiline, \"a\\nb\\n\", \"Pass. Group[0]=(1,0)\")\n\trunRegexTrial(t, `\\Z`, Multiline, \"b\\na\\n\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `\\z`, Multiline, \"b\\na\\n\", \"Pass. Group[0]=(4,0)\")\n\trunRegexTrial(t, `$`, Multiline, \"b\\na\\n\", \"Pass. Group[0]=(1,0)\")\n\trunRegexTrial(t, `\\Z`, Multiline, \"b\\na\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `\\z`, Multiline, \"b\\na\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `$`, Multiline, \"b\\na\", \"Pass. Group[0]=(1,0)\")\n\trunRegexTrial(t, `a\\Z`, 0, \"a\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `a\\z`, 0, \"a\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `a$`, 0, \"a\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `a\\Z`, 0, \"b\\na\\n\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `a\\z`, 0, \"b\\na\\n\", \"Fail.\")\n\trunRegexTrial(t, `a$`, 0, \"b\\na\\n\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `a\\Z`, 0, \"b\\na\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `a\\z`, 0, \"b\\na\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `a$`, 0, \"b\\na\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `a\\z`, Multiline, \"a\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `a$`, Multiline, \"a\\nb\\n\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `a\\Z`, Multiline, \"b\\na\\n\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `a\\z`, Multiline, \"b\\na\\n\", \"Fail.\")\n\trunRegexTrial(t, `a$`, Multiline, \"b\\na\\n\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `a\\Z`, Multiline, \"b\\na\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `a\\z`, Multiline, \"b\\na\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `a$`, Multiline, \"b\\na\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `aa\\Z`, 0, \"aa\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\z`, 0, \"aa\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, 0, \"aa\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\Z`, 0, \"b\\naa\\n\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `aa\\z`, 0, \"b\\naa\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, 0, \"b\\naa\\n\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `aa\\Z`, 0, \"b\\naa\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `aa\\z`, 0, \"b\\naa\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `aa$`, 0, \"b\\naa\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `aa\\z`, Multiline, \"aa\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, Multiline, \"aa\\nb\\n\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `aa\\Z`, Multiline, \"b\\naa\\n\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `aa\\z`, Multiline, \"b\\naa\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, Multiline, \"b\\naa\\n\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `aa\\Z`, Multiline, \"b\\naa\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `aa\\z`, Multiline, \"b\\naa\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `aa$`, Multiline, \"b\\naa\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `aa\\Z`, 0, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\z`, 0, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, 0, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\Z`, 0, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\z`, 0, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, 0, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\Z`, 0, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `aa\\z`, 0, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, 0, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `aa\\Z`, Multiline, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\z`, Multiline, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, Multiline, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\Z`, Multiline, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\z`, Multiline, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, Multiline, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\Z`, Multiline, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `aa\\z`, Multiline, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, Multiline, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `aa\\Z`, 0, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\z`, 0, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, 0, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\Z`, 0, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\z`, 0, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, 0, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\Z`, 0, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `aa\\z`, 0, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, 0, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `aa\\Z`, Multiline, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\z`, Multiline, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, Multiline, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\Z`, Multiline, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\z`, Multiline, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, Multiline, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `aa\\Z`, Multiline, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `aa\\z`, Multiline, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `aa$`, Multiline, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `ab\\Z`, 0, \"ab\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\z`, 0, \"ab\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, 0, \"ab\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\Z`, 0, \"b\\nab\\n\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `ab\\z`, 0, \"b\\nab\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, 0, \"b\\nab\\n\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `ab\\Z`, 0, \"b\\nab\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `ab\\z`, 0, \"b\\nab\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `ab$`, 0, \"b\\nab\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `ab\\z`, Multiline, \"ab\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, Multiline, \"ab\\nb\\n\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `ab\\Z`, Multiline, \"b\\nab\\n\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `ab\\z`, Multiline, \"b\\nab\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, Multiline, \"b\\nab\\n\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `ab\\Z`, Multiline, \"b\\nab\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `ab\\z`, Multiline, \"b\\nab\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `ab$`, Multiline, \"b\\nab\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `ab\\Z`, 0, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\z`, 0, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, 0, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\Z`, 0, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\z`, 0, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, 0, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\Z`, 0, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `ab\\z`, 0, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, 0, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `ab\\Z`, Multiline, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\z`, Multiline, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, Multiline, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\Z`, Multiline, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\z`, Multiline, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, Multiline, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\Z`, Multiline, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `ab\\z`, Multiline, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, Multiline, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `ab\\Z`, 0, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\z`, 0, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, 0, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\Z`, 0, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\z`, 0, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, 0, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\Z`, 0, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `ab\\z`, 0, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, 0, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `ab\\Z`, Multiline, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\z`, Multiline, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, Multiline, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\Z`, Multiline, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\z`, Multiline, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, Multiline, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `ab\\Z`, Multiline, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `ab\\z`, Multiline, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `ab$`, Multiline, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `abb\\Z`, 0, \"abb\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\z`, 0, \"abb\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, 0, \"abb\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\Z`, 0, \"b\\nabb\\n\", \"Pass. Group[0]=(2,3)\")\n\trunRegexTrial(t, `abb\\z`, 0, \"b\\nabb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, 0, \"b\\nabb\\n\", \"Pass. Group[0]=(2,3)\")\n\trunRegexTrial(t, `abb\\Z`, 0, \"b\\nabb\", \"Pass. Group[0]=(2,3)\")\n\trunRegexTrial(t, `abb\\z`, 0, \"b\\nabb\", \"Pass. Group[0]=(2,3)\")\n\trunRegexTrial(t, `abb$`, 0, \"b\\nabb\", \"Pass. Group[0]=(2,3)\")\n\trunRegexTrial(t, `abb\\z`, Multiline, \"abb\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, Multiline, \"abb\\nb\\n\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `abb\\Z`, Multiline, \"b\\nabb\\n\", \"Pass. Group[0]=(2,3)\")\n\trunRegexTrial(t, `abb\\z`, Multiline, \"b\\nabb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, Multiline, \"b\\nabb\\n\", \"Pass. Group[0]=(2,3)\")\n\trunRegexTrial(t, `abb\\Z`, Multiline, \"b\\nabb\", \"Pass. Group[0]=(2,3)\")\n\trunRegexTrial(t, `abb\\z`, Multiline, \"b\\nabb\", \"Pass. Group[0]=(2,3)\")\n\trunRegexTrial(t, `abb$`, Multiline, \"b\\nabb\", \"Pass. Group[0]=(2,3)\")\n\trunRegexTrial(t, `abb\\Z`, 0, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\z`, 0, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, 0, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\Z`, 0, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\z`, 0, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, 0, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\Z`, 0, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `abb\\z`, 0, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, 0, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `abb\\Z`, Multiline, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\z`, Multiline, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, Multiline, \"ac\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\Z`, Multiline, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\z`, Multiline, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, Multiline, \"b\\nac\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\Z`, Multiline, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `abb\\z`, Multiline, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, Multiline, \"b\\nac\", \"Fail.\")\n\trunRegexTrial(t, `abb\\Z`, 0, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\z`, 0, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, 0, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\Z`, 0, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\z`, 0, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, 0, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\Z`, 0, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `abb\\z`, 0, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, 0, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `abb\\Z`, Multiline, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\z`, Multiline, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, Multiline, \"ca\\nb\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\Z`, Multiline, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\z`, Multiline, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, Multiline, \"b\\nca\\n\", \"Fail.\")\n\trunRegexTrial(t, `abb\\Z`, Multiline, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `abb\\z`, Multiline, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `abb$`, Multiline, \"b\\nca\", \"Fail.\")\n\trunRegexTrial(t, `(^|x)(c)`, 0, \"ca\", \"Pass. Group[0]=(0,1) Group[1]=(0,0) Group[2]=(0,1)\")\n\trunRegexTrial(t, `a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz`, 0, \"x\", \"Fail.\")\n\trunRegexTrial(t, `round\\(((?>[^()]+))\\)`, 0, \"_I(round(xs * sz),1)\", \"Pass. Group[0]=(3,14) Group[1]=(9,7)\")\n\trunRegexTrial(t, `foo.bart`, 0, \"foo.bart\", \"Pass. Group[0]=(0,8)\")\n\trunRegexTrial(t, `^d[x][x][x]`, Multiline, \"abcd\\ndxxx\", \"Pass. Group[0]=(5,4)\")\n\trunRegexTrial(t, `.X(.+)+X`, 0, \"bbbbXcXaaaaaaaa\", \"Pass. Group[0]=(3,4) Group[1]=(5,1)\")\n\trunRegexTrial(t, `.X(.+)+XX`, 0, \"bbbbXcXXaaaaaaaa\", \"Pass. Group[0]=(3,5) Group[1]=(5,1)\")\n\trunRegexTrial(t, `.XX(.+)+X`, 0, \"bbbbXXcXaaaaaaaa\", \"Pass. Group[0]=(3,5) Group[1]=(6,1)\")\n\trunRegexTrial(t, `.X(.+)+X`, 0, \"bbbbXXaaaaaaaaa\", \"Fail.\")\n\trunRegexTrial(t, `.X(.+)+XX`, 0, \"bbbbXXXaaaaaaaaa\", \"Fail.\")\n\trunRegexTrial(t, `.XX(.+)+X`, 0, \"bbbbXXXaaaaaaaaa\", \"Fail.\")\n\trunRegexTrial(t, `.X(.+)+[X]`, 0, \"bbbbXcXaaaaaaaa\", \"Pass. Group[0]=(3,4) Group[1]=(5,1)\")\n\trunRegexTrial(t, `.X(.+)+[X][X]`, 0, \"bbbbXcXXaaaaaaaa\", \"Pass. Group[0]=(3,5) Group[1]=(5,1)\")\n\trunRegexTrial(t, `.XX(.+)+[X]`, 0, \"bbbbXXcXaaaaaaaa\", \"Pass. Group[0]=(3,5) Group[1]=(6,1)\")\n\trunRegexTrial(t, `.X(.+)+[X]`, 0, \"bbbbXXaaaaaaaaa\", \"Fail.\")\n\trunRegexTrial(t, `.X(.+)+[X][X]`, 0, \"bbbbXXXaaaaaaaaa\", \"Fail.\")\n\trunRegexTrial(t, `.XX(.+)+[X]`, 0, \"bbbbXXXaaaaaaaaa\", \"Fail.\")\n\trunRegexTrial(t, `.[X](.+)+[X]`, 0, \"bbbbXcXaaaaaaaa\", \"Pass. Group[0]=(3,4) Group[1]=(5,1)\")\n\trunRegexTrial(t, `.[X](.+)+[X][X]`, 0, \"bbbbXcXXaaaaaaaa\", \"Pass. Group[0]=(3,5) Group[1]=(5,1)\")\n\trunRegexTrial(t, `.[X][X](.+)+[X]`, 0, \"bbbbXXcXaaaaaaaa\", \"Pass. Group[0]=(3,5) Group[1]=(6,1)\")\n\trunRegexTrial(t, `.[X](.+)+[X]`, 0, \"bbbbXXaaaaaaaaa\", \"Fail.\")\n\trunRegexTrial(t, `.[X](.+)+[X][X]`, 0, \"bbbbXXXaaaaaaaaa\", \"Fail.\")\n\trunRegexTrial(t, `.[X][X](.+)+[X]`, 0, \"bbbbXXXaaaaaaaaa\", \"Fail.\")\n\trunRegexTrial(t, `tt+$`, 0, \"xxxtt\", \"Pass. Group[0]=(3,2)\")\n\trunRegexTrial(t, `([\\d-z]+)`, 0, \"a0-za\", \"Pass. Group[0]=(1,3) Group[1]=(1,3)\")\n\trunRegexTrial(t, `([\\d-\\s]+)`, 0, \"a0- z\", \"Pass. Group[0]=(1,3) Group[1]=(1,3)\")\n\trunRegexTrial(t, `\\GX.*X`, 0, \"aaaXbX\", \"Fail.\")\n\trunRegexTrial(t, `(\\d+\\.\\d+)`, 0, \"3.1415926\", \"Pass. Group[0]=(0,9) Group[1]=(0,9)\")\n\trunRegexTrial(t, `(\\ba.{0,10}br)`, 0, \"have a web browser\", \"Pass. Group[0]=(5,8) Group[1]=(5,8)\")\n\trunRegexTrial(t, `\\.c(pp|xx|c)?$`, IgnoreCase, \"Changes\", \"Fail.\")\n\trunRegexTrial(t, `\\.c(pp|xx|c)?$`, IgnoreCase, \"IO.c\", \"Pass. Group[0]=(2,2) Group[1]=\")\n\trunRegexTrial(t, `(\\.c(pp|xx|c)?$)`, IgnoreCase, \"IO.c\", \"Pass. Group[0]=(2,2) Group[1]=(2,2) Group[2]=\")\n\trunRegexTrial(t, `^([a-z]:)`, 0, \"C:/\", \"Fail.\")\n\trunRegexTrial(t, `^\\S\\s+aa$`, Multiline, \"\\nx aa\", \"Pass. Group[0]=(1,4)\")\n\trunRegexTrial(t, `(^|a)b`, 0, \"ab\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `^([ab]*?)(b)?(c)$`, 0, \"abac\", \"Pass. Group[0]=(0,4) Group[1]=(0,3) Group[2]= Group[3]=(3,1)\")\n\trunRegexTrial(t, `(\\w)?(abc)\\1b`, 0, \"abcab\", \"Fail.\")\n\trunRegexTrial(t, `^(?:.,){2}c`, 0, \"a,b,c\", \"Pass. Group[0]=(0,5)\")\n\trunRegexTrial(t, `^(.,){2}c`, 0, \"a,b,c\", \"Pass. Group[0]=(0,5) Group[1]=(0,2)(2,2)\")\n\trunRegexTrial(t, `^(?:[^,]*,){2}c`, 0, \"a,b,c\", \"Pass. Group[0]=(0,5)\")\n\trunRegexTrial(t, `^([^,]*,){2}c`, 0, \"a,b,c\", \"Pass. Group[0]=(0,5) Group[1]=(0,2)(2,2)\")\n\trunRegexTrial(t, `^([^,]*,){3}d`, 0, \"aaa,b,c,d\", \"Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)\")\n\trunRegexTrial(t, `^([^,]*,){3,}d`, 0, \"aaa,b,c,d\", \"Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)\")\n\trunRegexTrial(t, `^([^,]*,){0,3}d`, 0, \"aaa,b,c,d\", \"Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)\")\n\trunRegexTrial(t, `^([^,]{1,3},){3}d`, 0, \"aaa,b,c,d\", \"Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)\")\n\trunRegexTrial(t, `^([^,]{1,3},){3,}d`, 0, \"aaa,b,c,d\", \"Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)\")\n\trunRegexTrial(t, `^([^,]{1,3},){0,3}d`, 0, \"aaa,b,c,d\", \"Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)\")\n\trunRegexTrial(t, `^([^,]{1,},){3}d`, 0, \"aaa,b,c,d\", \"Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)\")\n\trunRegexTrial(t, `^([^,]{1,},){3,}d`, 0, \"aaa,b,c,d\", \"Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)\")\n\trunRegexTrial(t, `^([^,]{1,},){0,3}d`, 0, \"aaa,b,c,d\", \"Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)\")\n\trunRegexTrial(t, `^([^,]{0,3},){3}d`, 0, \"aaa,b,c,d\", \"Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)\")\n\trunRegexTrial(t, `^([^,]{0,3},){3,}d`, 0, \"aaa,b,c,d\", \"Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)\")\n\trunRegexTrial(t, `^([^,]{0,3},){0,3}d`, 0, \"aaa,b,c,d\", \"Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)\")\n\trunRegexTrial(t, `(?i)`, 0, \"\", \"Pass. Group[0]=(0,0)\")\n\trunRegexTrial(t, `(?!\\A)x`, Multiline, \"a\\nxb\\n\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `^(a(b)?)+$`, 0, \"aba\", \"Pass. Group[0]=(0,3) Group[1]=(0,2)(2,1) Group[2]=(1,1)\")\n\trunRegexTrial(t, `^(aa(bb)?)+$`, 0, \"aabbaa\", \"Pass. Group[0]=(0,6) Group[1]=(0,4)(4,2) Group[2]=(2,2)\")\n\trunRegexTrial(t, `^.{9}abc.*\\n`, Multiline, \"123\\nabcabcabcabc\\n\", \"Pass. Group[0]=(4,13)\")\n\trunRegexTrial(t, `^(a)?a$`, 0, \"a\", \"Pass. Group[0]=(0,1) Group[1]=\")\n\trunRegexTrial(t, `^(a)?(?(1)a|b)+$`, 0, \"a\", \"Fail.\")\n\trunRegexTrial(t, `^(a\\1?)(a\\1?)(a\\2?)(a\\3?)$`, 0, \"aaaaaa\", \"Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(1,2) Group[3]=(3,1) Group[4]=(4,2)\")\n\trunRegexTrial(t, `^(a\\1?){4}$`, 0, \"aaaaaa\", \"Pass. Group[0]=(0,6) Group[1]=(0,1)(1,2)(3,1)(4,2)\")\n\trunRegexTrial(t, `^(0+)?(?:x(1))?`, 0, \"x1\", \"Pass. Group[0]=(0,2) Group[1]= Group[2]=(1,1)\")\n\trunRegexTrial(t, `^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?`, 0, \"012cxx0190\", \"Pass. Group[0]=(0,10) Group[1]=(0,4) Group[2]= Group[3]=(6,4)\")\n\trunRegexTrial(t, `^(b+?|a){1,2}c`, 0, \"bbbac\", \"Pass. Group[0]=(0,5) Group[1]=(0,3)(3,1)\")\n\trunRegexTrial(t, `^(b+?|a){1,2}c`, 0, \"bbbbac\", \"Pass. Group[0]=(0,6) Group[1]=(0,4)(4,1)\")\n\trunRegexTrial(t, `\\((\\w\\. \\w+)\\)`, 0, \"cd. (A. Tw)\", \"Pass. Group[0]=(4,7) Group[1]=(5,5)\")\n\trunRegexTrial(t, `((?:aaaa|bbbb)cccc)?`, 0, \"aaaacccc\", \"Pass. Group[0]=(0,8) Group[1]=(0,8)\")\n\trunRegexTrial(t, `((?:aaaa|bbbb)cccc)?`, 0, \"bbbbcccc\", \"Pass. Group[0]=(0,8) Group[1]=(0,8)\")\n\n\trunRegexTrial(t, `^(foo)|(bar)$`, 0, \"foobar\", \"Pass. Group[0]=(0,3) Group[1]=(0,3) Group[2]=\")\n\trunRegexTrial(t, `^(foo)|(bar)$`, RightToLeft, \"foobar\", \"Pass. Group[0]=(3,3) Group[1]= Group[2]=(3,3)\")\n\n\trunRegexTrial(t, `b`, RightToLeft, \"babaaa\", \"Pass. Group[0]=(2,1)\")\n\trunRegexTrial(t, `bab`, RightToLeft, \"babababaa\", \"Pass. Group[0]=(4,3)\")\n\trunRegexTrial(t, `abb`, RightToLeft, \"abb\", \"Pass. Group[0]=(0,3)\")\n\n\trunRegexTrial(t, `b$`, RightToLeft|Multiline, \"aab\\naab\", \"Pass. Group[0]=(6,1)\")\n\trunRegexTrial(t, `^a`, RightToLeft|Multiline, \"aab\\naab\", \"Pass. Group[0]=(4,1)\")\n\trunRegexTrial(t, `^aaab`, RightToLeft|Multiline, \"aaab\\naab\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `abb{2}`, RightToLeft, \"abbb\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `abb{1,2}`, RightToLeft, \"abbb\", \"Pass. Group[0]=(0,4)\")\n\n\trunRegexTrial(t, `abb{1,2}`, RightToLeft, \"abbbbbaaaa\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `\\Ab`, RightToLeft, \"bab\\naaa\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `\\Abab$`, RightToLeft, \"bab\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `b\\Z`, RightToLeft, \"bab\\naaa\", \"Fail.\")\n\trunRegexTrial(t, `b\\Z`, RightToLeft, \"babaaab\", \"Pass. Group[0]=(6,1)\")\n\trunRegexTrial(t, `b\\z`, RightToLeft, \"babaaa\", \"Fail.\")\n\trunRegexTrial(t, `b\\z`, RightToLeft, \"babaaab\", \"Pass. Group[0]=(6,1)\")\n\trunRegexTrial(t, `a\\G`, RightToLeft, \"babaaa\", \"Pass. Group[0]=(5,1)\")\n\trunRegexTrial(t, `\\Abaaa\\G`, RightToLeft, \"baaa\", \"Pass. Group[0]=(0,4)\")\n\t//\t\t\trunRegexTrial(t, `b`, RightToLeft, \"babaaa\", \"Pass. Group[0]=(2,1)\")\n\t//\t\t\trunRegexTrial(t, `b`, RightToLeft, \"babaaa\", \"Pass. Group[0]=(2,1)\")\n\t//\t\t\trunRegexTrial(t, `b`, RightToLeft, \"babaaa\", \"Pass. Group[0]=(2,1)\")\n\t//\t\t\trunRegexTrial(t, `b`, RightToLeft, \"babaaa\", \"Pass. Group[0]=(2,1)\")\n\n\trunRegexTrial(t, `\\bc`, RightToLeft, \"aaa c aaa c a\", \"Pass. Group[0]=(10,1)\")\n\trunRegexTrial(t, `\\bc`, RightToLeft, \"c aaa c\", \"Pass. Group[0]=(6,1)\")\n\trunRegexTrial(t, `\\bc`, RightToLeft, \"aaa ac\", \"Fail.\")\n\trunRegexTrial(t, `\\bc`, RightToLeft, \"c aaa\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `\\bc`, RightToLeft, \"aaacaaa\", \"Fail.\")\n\trunRegexTrial(t, `\\bc`, RightToLeft, \"aaac aaa\", \"Fail.\")\n\trunRegexTrial(t, `\\bc`, RightToLeft, \"aaa ca caaa\", \"Pass. Group[0]=(7,1)\")\n\n\trunRegexTrial(t, `\\Bc`, RightToLeft, \"ac aaa ac\", \"Pass. Group[0]=(8,1)\")\n\trunRegexTrial(t, `\\Bc`, RightToLeft, \"aaa c\", \"Fail.\")\n\trunRegexTrial(t, `\\Bc`, RightToLeft, \"ca aaa\", \"Fail.\")\n\trunRegexTrial(t, `\\Bc`, RightToLeft, \"aaa c aaa\", \"Fail.\")\n\trunRegexTrial(t, `\\Bc`, RightToLeft, \" acaca \", \"Pass. Group[0]=(4,1)\")\n\trunRegexTrial(t, `\\Bc`, RightToLeft, \"aaac aaac\", \"Pass. Group[0]=(8,1)\")\n\trunRegexTrial(t, `\\Bc`, RightToLeft, \"aaa caaa\", \"Fail.\")\n\n\trunRegexTrial(t, `b(a?)b`, RightToLeft, \"aabababbaaababa\", \"Pass. Group[0]=(11,3) Group[1]=(12,1)\")\n\trunRegexTrial(t, `b{4}`, RightToLeft, \"abbbbaabbbbaabbb\", \"Pass. Group[0]=(7,4)\")\n\trunRegexTrial(t, `b\\1aa(.)`, RightToLeft, \"bBaaB\", \"Pass. Group[0]=(0,5) Group[1]=(4,1)\")\n\trunRegexTrial(t, `b(.)aa\\1`, RightToLeft, \"bBaaB\", \"Fail.\")\n\n\trunRegexTrial(t, `^(a\\1?){4}$`, RightToLeft, \"aaaaaa\", \"Pass. Group[0]=(0,6) Group[1]=(5,1)(3,2)(2,1)(0,2)\")\n\trunRegexTrial(t, `^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?`, RightToLeft, \"012cxx0190\", \"Pass. Group[0]=(0,10) Group[1]=(0,4) Group[2]= Group[3]=(6,4)\")\n\trunRegexTrial(t, `^(b+?|a){1,2}c`, RightToLeft, \"bbbac\", \"Pass. Group[0]=(0,5) Group[1]=(3,1)(0,3)\")\n\trunRegexTrial(t, `\\((\\w\\. \\w+)\\)`, RightToLeft, \"cd. (A. Tw)\", \"Pass. Group[0]=(4,7) Group[1]=(5,5)\")\n\trunRegexTrial(t, `((?:aaaa|bbbb)cccc)?`, RightToLeft, \"aaaacccc\", \"Pass. Group[0]=(0,8) Group[1]=(0,8)\")\n\trunRegexTrial(t, `((?:aaaa|bbbb)cccc)?`, RightToLeft, \"bbbbcccc\", \"Pass. Group[0]=(0,8) Group[1]=(0,8)\")\n\n\trunRegexTrial(t, `(?<=a)b`, RightToLeft, \"ab\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `(?<=a)b`, RightToLeft, \"cb\", \"Fail.\")\n\trunRegexTrial(t, `(?<=a)b`, RightToLeft, \"b\", \"Fail.\")\n\trunRegexTrial(t, `(?<!c)b`, RightToLeft, \"ab\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `(?<!c)b`, RightToLeft, \"cb\", \"Fail.\")\n\trunRegexTrial(t, `(?<!c)b`, RightToLeft, \"b\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `(?<!c)b`, RightToLeft, \"b\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `a(?=d).`, RightToLeft, \"adabad\", \"Pass. Group[0]=(4,2)\")\n\trunRegexTrial(t, `a(?=c|d).`, RightToLeft, \"adabad\", \"Pass. Group[0]=(4,2)\")\n\n\trunRegexTrial(t, `ab*c`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab*bc`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab*bc`, RightToLeft, \"abbc\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `ab*bc`, RightToLeft, \"abbbbc\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `.{1}`, RightToLeft, \"abbbbc\", \"Pass. Group[0]=(5,1)\")\n\trunRegexTrial(t, `.{3,4}`, RightToLeft, \"abbbbc\", \"Pass. Group[0]=(2,4)\")\n\trunRegexTrial(t, `ab{0,}bc`, RightToLeft, \"abbbbc\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab+bc`, RightToLeft, \"abbc\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `ab+bc`, RightToLeft, \"abc\", \"Fail.\")\n\trunRegexTrial(t, `ab+bc`, RightToLeft, \"abq\", \"Fail.\")\n\trunRegexTrial(t, `ab{1,}bc`, RightToLeft, \"abq\", \"Fail.\")\n\trunRegexTrial(t, `ab+bc`, RightToLeft, \"abbbbc\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab{1,}bc`, RightToLeft, \"abbbbc\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab{1,3}bc`, RightToLeft, \"abbbbc\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab{3,4}bc`, RightToLeft, \"abbbbc\", \"Pass. Group[0]=(0,6)\")\n\trunRegexTrial(t, `ab{4,5}bc`, RightToLeft, \"abbbbc\", \"Fail.\")\n\trunRegexTrial(t, `ab?bc`, RightToLeft, \"abbc\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `ab?bc`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab{0,1}bc`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab?bc`, RightToLeft, \"abbbbc\", \"Fail.\")\n\trunRegexTrial(t, `ab?c`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `ab{0,1}c`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `^abc$`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `^abc$`, RightToLeft, \"abcc\", \"Fail.\")\n\trunRegexTrial(t, `^abc`, RightToLeft, \"abcc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `^abc$`, RightToLeft, \"aabc\", \"Fail.\")\n\trunRegexTrial(t, `abc$`, RightToLeft, \"aabc\", \"Pass. Group[0]=(1,3)\")\n\trunRegexTrial(t, `abc$`, RightToLeft, \"aabcd\", \"Fail.\")\n\trunRegexTrial(t, `^`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,0)\")\n\trunRegexTrial(t, `$`, RightToLeft, \"abc\", \"Pass. Group[0]=(3,0)\")\n\trunRegexTrial(t, `a.c`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a.c`, RightToLeft, \"axc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a.*c`, RightToLeft, \"axyzc\", \"Pass. Group[0]=(0,5)\")\n\trunRegexTrial(t, `a.*c`, RightToLeft, \"axyzd\", \"Fail.\")\n\trunRegexTrial(t, `a[bc]d`, RightToLeft, \"abc\", \"Fail.\")\n\trunRegexTrial(t, `a[bc]d`, RightToLeft, \"abd\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[b-d]e`, RightToLeft, \"abd\", \"Fail.\")\n\trunRegexTrial(t, `a[b-d]e`, RightToLeft, \"ace\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[b-d]`, RightToLeft, \"aac\", \"Pass. Group[0]=(1,2)\")\n\trunRegexTrial(t, `a[-b]`, RightToLeft, \"a-\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `a[b-]`, RightToLeft, \"a-\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `a[b-a]`, RightToLeft, \"-\", \"Error.\")\n\trunRegexTrial(t, `a[]b`, RightToLeft, \"-\", \"Error.\")\n\trunRegexTrial(t, `a[`, RightToLeft, \"-\", \"Error.\")\n\trunRegexTrial(t, `a]`, RightToLeft, \"a]\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `a[]]b`, RightToLeft, \"a]b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[^bc]d`, RightToLeft, \"aed\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[^bc]d`, RightToLeft, \"abd\", \"Fail.\")\n\trunRegexTrial(t, `a[^-b]c`, RightToLeft, \"adc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[^-b]c`, RightToLeft, \"a-c\", \"Fail.\")\n\trunRegexTrial(t, `a[^]b]c`, RightToLeft, \"a]c\", \"Fail.\")\n\trunRegexTrial(t, `a[^]b]c`, RightToLeft, \"adc\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `\\ba\\b`, RightToLeft, \"a-\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `\\ba\\b`, RightToLeft, \"-a\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `\\ba\\b`, RightToLeft, \"-a-\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `\\by\\b`, RightToLeft, \"xy\", \"Fail.\")\n\trunRegexTrial(t, `\\by\\b`, RightToLeft, \"yz\", \"Fail.\")\n\trunRegexTrial(t, `\\by\\b`, RightToLeft, \"xyz\", \"Fail.\")\n\trunRegexTrial(t, `\\Ba\\B`, RightToLeft, \"a-\", \"Fail.\")\n\trunRegexTrial(t, `\\Ba\\B`, RightToLeft, \"-a\", \"Fail.\")\n\trunRegexTrial(t, `\\Ba\\B`, RightToLeft, \"-a-\", \"Fail.\")\n\trunRegexTrial(t, `\\By\\b`, RightToLeft, \"xy\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `\\by\\B`, RightToLeft, \"yz\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `\\By\\B`, RightToLeft, \"xyz\", \"Pass. Group[0]=(1,1)\")\n\trunRegexTrial(t, `\\w`, RightToLeft, \"a\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `\\w`, RightToLeft, \"-\", \"Fail.\")\n\trunRegexTrial(t, `\\W`, RightToLeft, \"a\", \"Fail.\")\n\trunRegexTrial(t, `\\W`, RightToLeft, \"-\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `a\\sb`, RightToLeft, \"a b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a\\sb`, RightToLeft, \"a-b\", \"Fail.\")\n\trunRegexTrial(t, `a\\Sb`, RightToLeft, \"a b\", \"Fail.\")\n\trunRegexTrial(t, `a\\Sb`, RightToLeft, \"a-b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `\\d`, RightToLeft, \"1\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `\\d`, RightToLeft, \"-\", \"Fail.\")\n\trunRegexTrial(t, `\\D`, RightToLeft, \"1\", \"Fail.\")\n\trunRegexTrial(t, `\\D`, RightToLeft, \"-\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `[\\w]`, RightToLeft, \"a\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `[\\w]`, RightToLeft, \"-\", \"Fail.\")\n\trunRegexTrial(t, `[\\W]`, RightToLeft, \"a\", \"Fail.\")\n\trunRegexTrial(t, `[\\W]`, RightToLeft, \"-\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `a[\\s]b`, RightToLeft, \"a b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a[\\s]b`, RightToLeft, \"a-b\", \"Fail.\")\n\trunRegexTrial(t, `a[\\S]b`, RightToLeft, \"a b\", \"Fail.\")\n\trunRegexTrial(t, `a[\\S]b`, RightToLeft, \"a-b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `[\\d]`, RightToLeft, \"1\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `[\\d]`, RightToLeft, \"-\", \"Fail.\")\n\trunRegexTrial(t, `[\\D]`, RightToLeft, \"1\", \"Fail.\")\n\trunRegexTrial(t, `[\\D]`, RightToLeft, \"-\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `ab|cd`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `ab|cd`, RightToLeft, \"abcd\", \"Pass. Group[0]=(2,2)\")\n\trunRegexTrial(t, `()ef`, RightToLeft, \"def\", \"Pass. Group[0]=(1,2) Group[1]=(1,0)\")\n\trunRegexTrial(t, `*a`, RightToLeft, \"-\", \"Error.\")\n\trunRegexTrial(t, `(*)b`, RightToLeft, \"-\", \"Error.\")\n\trunRegexTrial(t, `$b`, RightToLeft, \"b\", \"Fail.\")\n\trunRegexTrial(t, `a\\`, RightToLeft, \"-\", \"Error.\")\n\trunRegexTrial(t, `a\\(b`, RightToLeft, \"a(b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `a\\(*b`, RightToLeft, \"ab\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `a\\(*b`, RightToLeft, \"a((b\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `a\\\\b`, RightToLeft, \"a\\\\b\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `abc)`, RightToLeft, \"-\", \"Error.\")\n\trunRegexTrial(t, `(abc`, RightToLeft, \"-\", \"Error.\")\n\trunRegexTrial(t, `((a))`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1)\")\n\trunRegexTrial(t, `(a)b(c)`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(2,1)\")\n\trunRegexTrial(t, `a+b+c`, RightToLeft, \"aabbabc\", \"Pass. Group[0]=(4,3)\")\n\trunRegexTrial(t, `a{1,}b{1,}c`, RightToLeft, \"aabbabc\", \"Pass. Group[0]=(4,3)\")\n\trunRegexTrial(t, `a**`, RightToLeft, \"-\", \"Error.\")\n\trunRegexTrial(t, `a.+?c`, RightToLeft, \"abcabc\", \"Pass. Group[0]=(3,3)\")\n\trunRegexTrial(t, `(a+|b)*`, RightToLeft, \"ab\", \"Pass. Group[0]=(0,2) Group[1]=(1,1)(0,1)\")\n\trunRegexTrial(t, `(a+|b){0,}`, RightToLeft, \"ab\", \"Pass. Group[0]=(0,2) Group[1]=(1,1)(0,1)\")\n\trunRegexTrial(t, `(a+|b)+`, RightToLeft, \"ab\", \"Pass. Group[0]=(0,2) Group[1]=(1,1)(0,1)\")\n\trunRegexTrial(t, `(a+|b){1,}`, RightToLeft, \"ab\", \"Pass. Group[0]=(0,2) Group[1]=(1,1)(0,1)\")\n\trunRegexTrial(t, `(a+|b)?`, RightToLeft, \"ab\", \"Pass. Group[0]=(1,1) Group[1]=(1,1)\")\n\trunRegexTrial(t, `(a+|b){0,1}`, RightToLeft, \"ab\", \"Pass. Group[0]=(1,1) Group[1]=(1,1)\")\n\trunRegexTrial(t, `)(`, RightToLeft, \"-\", \"Error.\")\n\trunRegexTrial(t, `[^ab]*`, RightToLeft, \"cde\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `abc`, RightToLeft, \"\", \"Fail.\")\n\trunRegexTrial(t, `a*`, RightToLeft, \"\", \"Pass. Group[0]=(0,0)\")\n\trunRegexTrial(t, `([abc])*d`, RightToLeft, \"abbbcd\", \"Pass. Group[0]=(0,6) Group[1]=(4,1)(3,1)(2,1)(1,1)(0,1)\")\n\trunRegexTrial(t, `([abc])*bcd`, RightToLeft, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]=(0,1)\")\n\trunRegexTrial(t, `a|b|c|d|e`, RightToLeft, \"e\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `(a|b|c|d|e)f`, RightToLeft, \"ef\", \"Pass. Group[0]=(0,2) Group[1]=(0,1)\")\n\trunRegexTrial(t, `abcd*efg`, RightToLeft, \"abcdefg\", \"Pass. Group[0]=(0,7)\")\n\trunRegexTrial(t, `ab*`, RightToLeft, \"xabyabbbz\", \"Pass. Group[0]=(4,4)\")\n\trunRegexTrial(t, `ab*`, RightToLeft, \"xayabbbz\", \"Pass. Group[0]=(3,4)\")\n\trunRegexTrial(t, `(ab|cd)e`, RightToLeft, \"abcde\", \"Pass. Group[0]=(2,3) Group[1]=(2,2)\")\n\trunRegexTrial(t, `[abhgefdc]ij`, RightToLeft, \"hij\", \"Pass. Group[0]=(0,3)\")\n\trunRegexTrial(t, `^(ab|cd)e`, RightToLeft, \"abcde\", \"Fail.\")\n\trunRegexTrial(t, `(abc|)ef`, RightToLeft, \"abcdef\", \"Pass. Group[0]=(4,2) Group[1]=(4,0)\")\n\trunRegexTrial(t, `(a|b)c*d`, RightToLeft, \"abcd\", \"Pass. Group[0]=(1,3) Group[1]=(1,1)\")\n\trunRegexTrial(t, `(ab|ab*)bc`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,3) Group[1]=(0,1)\")\n\trunRegexTrial(t, `a([bc]*)c*`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,3) Group[1]=(1,1)\")\n\trunRegexTrial(t, `a([bc]*)(c*d)`, RightToLeft, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]=(1,1) Group[2]=(2,2)\")\n\trunRegexTrial(t, `a([bc]+)(c*d)`, RightToLeft, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]=(1,1) Group[2]=(2,2)\")\n\trunRegexTrial(t, `a([bc]*)(c+d)`, RightToLeft, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]=(1,1) Group[2]=(2,2)\")\n\trunRegexTrial(t, `a[bcd]*dcdcde`, RightToLeft, \"adcdcde\", \"Pass. Group[0]=(0,7)\")\n\trunRegexTrial(t, `a[bcd]+dcdcde`, RightToLeft, \"adcdcde\", \"Fail.\")\n\trunRegexTrial(t, `(ab|a)b*c`, RightToLeft, \"abc\", \"Pass. Group[0]=(0,3) Group[1]=(0,1)\")\n\trunRegexTrial(t, `((a)(b)c)(d)`, RightToLeft, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]=(0,3) Group[2]=(0,1) Group[3]=(1,1) Group[4]=(3,1)\")\n\trunRegexTrial(t, `[a-zA-Z_][a-zA-Z0-9_]*`, RightToLeft, \"alpha\", \"Pass. Group[0]=(0,5)\")\n\trunRegexTrial(t, `^a(bc+|b[eh])g|.h$`, RightToLeft, \"abh\", \"Pass. Group[0]=(1,2) Group[1]=\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, RightToLeft, \"effgz\", \"Pass. Group[0]=(0,5) Group[1]=(0,5) Group[2]=\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, RightToLeft, \"ij\", \"Pass. Group[0]=(0,2) Group[1]=(0,2) Group[2]=(1,1)\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, RightToLeft, \"effg\", \"Fail.\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, RightToLeft, \"bcdd\", \"Fail.\")\n\trunRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, RightToLeft, \"reffgz\", \"Pass. Group[0]=(1,5) Group[1]=(1,5) Group[2]=\")\n\trunRegexTrial(t, `((((((((((a))))))))))`, RightToLeft, \"a\", \"Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)\")\n\trunRegexTrial(t, `((((((((((a))))))))))\\10`, RightToLeft, \"aa\", \"Fail.\")\n\trunRegexTrial(t, `\\10((((((((((a))))))))))`, RightToLeft, \"aa\", \"Pass. Group[0]=(0,2) Group[1]=(1,1) Group[2]=(1,1) Group[3]=(1,1) Group[4]=(1,1) Group[5]=(1,1) Group[6]=(1,1) Group[7]=(1,1) Group[8]=(1,1) Group[9]=(1,1) Group[10]=(1,1)\")\n\trunRegexTrial(t, `((((((((((a))))))))))!`, RightToLeft, \"aa\", \"Fail.\")\n\trunRegexTrial(t, `((((((((((a))))))))))!`, RightToLeft, \"a!\", \"Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)\")\n\trunRegexTrial(t, `(((((((((a)))))))))`, RightToLeft, \"a\", \"Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1)\")\n\trunRegexTrial(t, `multiple words of text`, RightToLeft, \"uh-uh\", \"Fail.\")\n\trunRegexTrial(t, `multiple words`, RightToLeft, \"multiple words, yeah\", \"Pass. Group[0]=(0,14)\")\n\trunRegexTrial(t, `(.*)c(.*)`, RightToLeft, \"abcde\", \"Pass. Group[0]=(0,5) Group[1]=(0,2) Group[2]=(3,2)\")\n\trunRegexTrial(t, `\\((.*), (.*)\\)`, RightToLeft, \"(a, b)\", \"Pass. Group[0]=(0,6) Group[1]=(1,1) Group[2]=(4,1)\")\n\trunRegexTrial(t, `[k]`, RightToLeft, \"ab\", \"Fail.\")\n\trunRegexTrial(t, `abcd`, RightToLeft, \"abcd\", \"Pass. Group[0]=(0,4)\")\n\trunRegexTrial(t, `a(bc)d`, RightToLeft, \"abcd\", \"Pass. Group[0]=(0,4) Group[1]=(1,2)\")\n\trunRegexTrial(t, `a[-]?c`, RightToLeft, \"ac\", \"Pass. Group[0]=(0,2)\")\n\trunRegexTrial(t, `(abc)\\1`, RightToLeft, \"abcabc\", \"Fail.\")\n\trunRegexTrial(t, `\\1(abc)`, RightToLeft, \"abcabc\", \"Pass. Group[0]=(0,6) Group[1]=(3,3)\")\n\trunRegexTrial(t, `([a-c]*)\\1`, RightToLeft, \"abcabc\", \"Fail.\")\n\trunRegexTrial(t, `\\1([a-c]*)`, RightToLeft, \"abcabc\", \"Pass. Group[0]=(0,6) Group[1]=(3,3)\")\n\trunRegexTrial(t, `\\1`, RightToLeft, \"-\", \"Error.\")\n\trunRegexTrial(t, `\\2`, RightToLeft, \"-\", \"Error.\")\n\trunRegexTrial(t, `(a)|\\1`, RightToLeft, \"a\", \"Pass. Group[0]=(0,1) Group[1]=(0,1)\")\n\trunRegexTrial(t, `(a)|\\1`, RightToLeft, \"x\", \"Fail.\")\n\trunRegexTrial(t, `(a)|\\2`, RightToLeft, \"-\", \"Error.\")\n\trunRegexTrial(t, `(([a-c])b*?\\2)*`, RightToLeft, \"ababbbcbc\", \"Pass. Group[0]=(9,0) Group[1]= Group[2]=\")\n\trunRegexTrial(t, `(([a-c])b*?\\2){3}`, RightToLeft, \"ababbbcbc\", \"Fail.\")\n\trunRegexTrial(t, `((\\3|b)\\2(a)x)+`, RightToLeft, \"aaxabxbaxbbx\", \"Fail.\")\n\trunRegexTrial(t, `((\\3|b)\\2(a)x)+`, RightToLeft, \"aaaxabaxbaaxbbax\", \"Fail.\")\n\trunRegexTrial(t, `((\\3|b)\\2(a)){2,}`, RightToLeft, \"bbaababbabaaaaabbaaaabba\", \"Fail.\")\n\n\trunRegexTrial(t, `\\((?>[^()]+|\\((?<depth>)|\\)(?<-depth>))*(?(depth)(?!))\\)`, 0, \"((a(b))c)\", \"Pass. Group[0]=(0,9) Group[1]=\")\n\trunRegexTrial(t, `^\\((?>[^()]+|\\((?<depth>)|\\)(?<-depth>))*(?(depth)(?!))\\)$`, 0, \"((a(b))c)\", \"Pass. Group[0]=(0,9) Group[1]=\")\n\trunRegexTrial(t, `^\\((?>[^()]+|\\((?<depth>)|\\)(?<-depth>))*(?(depth)(?!))\\)$`, 0, \"((a(b))c\", \"Fail.\")\n\n\trunRegexTrial(t, `^\\((?>[^()]+|\\((?<depth>)|\\)(?<-depth>))*(?(depth)(?!))\\)$`, 0, \"())\", \"Fail.\")\n\n\trunRegexTrial(t, `(((?<foo>\\()[^()]*)+((?<bar-foo>\\))[^()]*)+)+(?(foo)(?!))`, 0, \"((a(b))c)\",\n\t\t\"Pass. Group[0]=(0,9) Group[1]=(0,9) Group[2]=(0,1)(1,2)(3,2) Group[3]=(5,1)(6,2)(8,1) Group[4]= Group[5]=(4,1)(2,4)(1,7)\")\n\trunRegexTrial(t, `^(((?<foo>\\()[^()]*)+((?<bar-foo>\\))[^()]*)+)+(?(foo)(?!))$`, 0, \"((a(b))c)\",\n\t\t\"Pass. Group[0]=(0,9) Group[1]=(0,9) Group[2]=(0,1)(1,2)(3,2) Group[3]=(5,1)(6,2)(8,1) Group[4]= Group[5]=(4,1)(2,4)(1,7)\")\n\trunRegexTrial(t, `(((?<foo>\\()[^()]*)+((?<bar-foo>\\))[^()]*)+)+(?(foo)(?!))`, 0, \"x(a((b)))b)x\",\n\t\t\"Pass. Group[0]=(1,9) Group[1]=(1,9) Group[2]=(1,2)(3,1)(4,2) Group[3]=(6,1)(7,1)(8,2) Group[4]= Group[5]=(5,1)(4,3)(2,6)\")\n\trunRegexTrial(t, `(((?<foo>\\()[^()]*)+((?<bar-foo>\\))[^()]*)+)+(?(foo)(?!))`, 0, \"x((a((b)))x\",\n\t\t\"Pass. Group[0]=(2,9) Group[1]=(2,9) Group[2]=(2,2)(4,1)(5,2) Group[3]=(7,1)(8,1)(9,2) Group[4]= Group[5]=(6,1)(5,3)(3,6)\")\n\trunRegexTrial(t, `^(((?<foo>\\()[^()]*)+((?<bar-foo>\\))[^()]*)+)+(?(foo)(?!))$`, 0, \"((a(b))c\", \"Fail.\")\n\trunRegexTrial(t, `^(((?<foo>\\()[^()]*)+((?<bar-foo>\\))[^()]*)+)+(?(foo)(?!))$`, 0, \"((a(b))c))\", \"Fail.\")\n\trunRegexTrial(t, `^(((?<foo>\\()[^()]*)+((?<bar-foo>\\))[^()]*)+)+(?(foo)(?!))$`, 0, \")(\", \"Fail.\")\n\trunRegexTrial(t, `^(((?<foo>\\()[^()]*)+((?<bar-foo>\\))[^()]*)+)+(?(foo)(?!))$`, 0, \"((a((b))c)\", \"Fail.\")\n\n\trunRegexTrial(t, `b`, RightToLeft, \"babaaa\", \"Pass. Group[0]=(2,1)\")\n\n\trunRegexTrial(t, `^((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"[n]\", \"Pass. Group[0]=(0,3) Group[1]=(1,1)\")\n\trunRegexTrial(t, `^((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"n\", \"Pass. Group[0]=(0,1) Group[1]=(0,1)\")\n\trunRegexTrial(t, `^((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"n[i]e\", \"Fail.\")\n\trunRegexTrial(t, `^((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"[n\", \"Fail.\")\n\trunRegexTrial(t, `^((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"]n]\", \"Fail.\")\n\trunRegexTrial(t, `^((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, `\\[n\\]`, \"Fail.\")\n\trunRegexTrial(t, `^((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, `[n\\]`, \"Pass. Group[0]=(0,4) Group[1]=(1,2)\")\n\trunRegexTrial(t, `^((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, `[n\\[]`, \"Pass. Group[0]=(0,5) Group[1]=(1,3)\")\n\trunRegexTrial(t, `^((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, `[[n]`, \"Pass. Group[0]=(0,4) Group[1]=(1,2)\")\n\trunRegexTrial(t, `^((\\[(?<SCHEMA>[^\\]]+)\\])|(?<SCHEMA>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"[s] . [n]\", \"Pass. Group[0]=(0,9) Group[1]=(1,1) Group[2]=(7,1)\")\n\trunRegexTrial(t, `^((\\[(?<SCHEMA>[^\\]]+)\\])|(?<SCHEMA>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"[s] . n\", \"Pass. Group[0]=(0,7) Group[1]=(1,1) Group[2]=(6,1)\")\n\trunRegexTrial(t, `^((\\[(?<SCHEMA>[^\\]]+)\\])|(?<SCHEMA>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"s.[ n ]\", \"Pass. Group[0]=(0,7) Group[1]=(0,1) Group[2]=(3,3)\")\n\trunRegexTrial(t, `^((\\[(?<SCHEMA>[^\\]]+)\\])|(?<SCHEMA>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \" . n\", \"Pass. Group[0]=(0,4) Group[1]=(0,1) Group[2]=(3,1)\")\n\trunRegexTrial(t, `^((\\[(?<SCHEMA>[^\\]]+)\\])|(?<SCHEMA>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"s. \", \"Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(2,1)\")\n\trunRegexTrial(t, `^((\\[(?<SCHEMA>[^\\]]+)\\])|(?<SCHEMA>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"[.]. \", \"Pass. Group[0]=(0,5) Group[1]=(1,1) Group[2]=(4,1)\")\n\trunRegexTrial(t, `^((\\[(?<CATALOG>[^\\]]+)\\])|(?<CATALOG>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<SCHEMA>[^\\]]+)\\])|(?<SCHEMA>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"[c].[s].[n]\", \"Pass. Group[0]=(0,11) Group[1]=(1,1) Group[2]=(5,1) Group[3]=(9,1)\")\n\trunRegexTrial(t, `^((\\[(?<CATALOG>[^\\]]+)\\])|(?<CATALOG>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<SCHEMA>[^\\]]+)\\])|(?<SCHEMA>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \" c . s . n \", \"Pass. Group[0]=(0,11) Group[1]=(0,3) Group[2]=(5,2) Group[3]=(9,2)\")\n\trunRegexTrial(t, `^((\\[(?<CATALOG>[^\\]]+)\\])|(?<CATALOG>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<SCHEMA>[^\\]]+)\\])|(?<SCHEMA>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \" . [.] . [ ]\", \"Pass. Group[0]=(0,12) Group[1]=(0,1) Group[2]=(4,1) Group[3]=(10,1)\")\n\trunRegexTrial(t, `^((\\[(?<CATALOG>[^\\]]+)\\])|(?<CATALOG>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"c.n\", \"Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(2,1)\")\n\trunRegexTrial(t, `^((\\[(?<CATALOG>[^\\]]+)\\])|(?<CATALOG>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"[c] .[n]\", \"Pass. Group[0]=(0,8) Group[1]=(1,1) Group[2]=(6,1)\")\n\trunRegexTrial(t, `^((\\[(?<CATALOG>[^\\]]+)\\])|(?<CATALOG>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"c.n.\", \"Fail.\")\n\trunRegexTrial(t, `^((\\[(?<SCHEMA>[^\\]]+)\\])|(?<SCHEMA>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<CATALOG>[^\\]]+)\\])|(?<CATALOG>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"s.c.n\", \"Pass. Group[0]=(0,5) Group[1]=(0,1) Group[2]=(2,1) Group[3]=(4,1)\")\n\trunRegexTrial(t, `^((\\[(?<SCHEMA>[^\\]]+)\\])|(?<SCHEMA>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<CATALOG>[^\\]]+)\\])|(?<CATALOG>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"[s].[c].[n]\", \"Pass. Group[0]=(0,11) Group[1]=(1,1) Group[2]=(5,1) Group[3]=(9,1)\")\n\trunRegexTrial(t, `^((\\[(?<SCHEMA>[^\\]]+)\\])|(?<SCHEMA>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<CATALOG>[^\\]]+)\\])|(?<CATALOG>[^\\.\\[\\]]+))\\s*\\.\\s*((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, \"[s].[c].\", \"Fail.\")\n\trunRegexTrial(t, `^((\\[(?<ColName>.+)\\])|(?<ColName>\\S+))([ ]+(?<Order>ASC|DESC))?$`, IgnoreCase|ExplicitCapture, \"[id]]\", \"Pass. Group[0]=(0,5) Group[1]=(1,3) Group[2]=\")\n\trunRegexTrial(t, `a{1,2147483647}`, 0, \"a\", \"Pass. Group[0]=(0,1)\")\n\trunRegexTrial(t, `^((\\[(?<NAME>[^\\]]+)\\])|(?<NAME>[^\\.\\[\\]]+))$`, 0, \"[a]\", \"Pass. Group[0]=(0,3) Group[1]=(0,3) Group[2]=(0,3) Group[3]=(1,1)\")\n\n}", "title": "" }, { "docid": "88565a7e4582cbba1c3ce3e8f6fb5588", "score": "0.41326427", "text": "func NameMatchedPattern(name string) (match bool) {\n\tmatch, _ = regexp.MatchString(\"^[a-zA-Z0-9_.-]*$\", name)\n\treturn match\n}", "title": "" }, { "docid": "43152cd1e6380a33ca32386a05bc2b76", "score": "0.4127139", "text": "func sane(s string) bool {\n\t// Label and ObjectId can be \"\", we already check that subject and predicate\n\t// shouldn't be empty.\n\tif len(s) == 0 {\n\t\treturn true\n\t}\n\t// s should have atleast one alphanumeric character.\n\tfor _, r := range s {\n\t\tif unicode.IsLetter(r) || unicode.IsDigit(r) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "eb04758930abf33662400d7a9fa7b87d", "score": "0.41162145", "text": "func Capture(regex, s string) string {\n\tre, err := regexp.Compile(regex);\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to compile regex: %s, err: %v\", regex, err)\n\t\treturn \"\"\n\t}\n\tif captured := re.FindStringSubmatch(s); len(captured) > 1 {\n\t\treturn captured[1]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "409a933b0e1f468bb87f2ef9a57e8635", "score": "0.41157734", "text": "func RegularPlural(singular string) string {\n\treturn flect.Pluralize(strings.ToLower(singular))\n}", "title": "" }, { "docid": "0591818d2e9bf8764b58db6e1e456e7e", "score": "0.4113947", "text": "func naiveParseSimpleFilter(filter string) (string, string, error) {\n\tkey, value, colonFilter := strings.Cut(filter, \":\")\n\tif !colonFilter {\n\t\treturn \"\", \"\", errors.New(\"unexpected filter:\" + filter + \", expected = symbol\")\n\t}\n\treturn key, value, nil\n}", "title": "" }, { "docid": "5db3137ea64d5a2e10ffd3d15f250611", "score": "0.4113215", "text": "func (item *Item) Match(text string) int {\n\tstrength := 0\n\twords := strings.Split(text, \" \")\n\tnounWord := words[len(words)-1]\n\tadjectiveWord := \"\"\n\tnounPattern := []byte(item.Form.Noun)\n\tadjPattern := []byte(item.Form.PrimaryAdjective)\n\tif len(words) > 1 {\n\t\tadjectiveWord = words[len(words)-2]\n\t}\n\tif m, _ := regexp.Match(nounWord, nounPattern); m {\n\t\tstrength += len(nounWord)\n\t\tif len(words) > 1 {\n\t\t\tif m, _ := regexp.Match(adjectiveWord, adjPattern); m {\n\t\t\t\tstrength += len(adjectiveWord)\n\t\t\t}\n\t\t}\n\t\treturn strength\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "ae9c47825407eb362179ccde039d80c8", "score": "0.4112125", "text": "func match(conf string, re *regexp.Regexp) string {\n\t//r := regexp.MustCompile(`<pfsense>[\\s\\S]*?<\\/pfsense>`)\n\tresult := re.FindString(conf)\n\treturn (result)\n}", "title": "" }, { "docid": "51ac4f3095f73cea33acd7ad57eb3b2d", "score": "0.41095236", "text": "func TestRecognizeSoyTag(t *testing.T) {\n\tworks(t, \"{sp}\")\n\tworks(t, \"{ sp }\")\n\tworks(t, \"{{sp}}\")\n\n\t// Soy V1 syntax. will not fix.\n\t// works(t, \"{space}\")\n\t// works(t, \"{{space}}\")\n\t// works(t, \"{{ {sp} }}\")\n\n\tfails(t, \"{}\")\n\tfails(t, \"{sp\")\n\tfails(t, \"{sp blah}\")\n\tfails(t, \"{print { }\")\n\tfails(t, \"{print } }\")\n\tfails(t, \"{print }}\")\n\tfails(t, \"{{}}\")\n\tfails(t, \"{{{blah: blah}}}\")\n\tfails(t, \"blah}blah\")\n\tfails(t, \"blah}}blah\")\n\tfails(t, \"{{print {{ }}\")\n\tfails(t, \"{{print {}}\")\n}", "title": "" }, { "docid": "8852ece5c23ad688d34a63a9f5fe97e1", "score": "0.4105557", "text": "func isMatch1(s string, p string) bool {\n\tDP := make([][]bool, len(s) + 1)\n\tfor i := 0; i < len(DP); i++ {\n\t\tDP[i] = make([]bool, len(p) + 1)\n\t}\n\n\tDP[0][0] = true\n\tfor i := 0; i <= len(s); i++ {\n\t\tfor j := 1; j <= len(p); j++ {\n\t\t\tif j >= 2 && p[j-1] == '*' {\n\t\t\t\tDP[i][j] = DP[i][j-2] || (i > 0 && (s[i-1] == p[j-2] || p[j-2] == '.') && DP[i-1][j])\n\t\t\t} else {\n\t\t\t\tDP[i][j] = i > 0 && DP[i-1][j-1] && (s[i-1] == p[j-1] || p[j-1] == '.')\n\t\t\t}\n\t\t}\n\t}\n\n\treturn DP[len(s)][len(p)]\n}", "title": "" }, { "docid": "5ecec7a2dad2057e5ae6c173ef20f5de", "score": "0.41055486", "text": "func dotMatch(got, want string) bool {\n\tif strings.HasPrefix(want, \"...\") {\n\t\treturn strings.HasSuffix(got, want[3:])\n\t} else if strings.HasSuffix(want, \"...\") {\n\t\treturn strings.HasPrefix(got, want[:len(want)-3])\n\t} else if i := strings.Index(want, \"...\"); i != -1 {\n\t\ta, e := want[:i], want[i+3:]\n\t\treturn strings.HasPrefix(got, a) && strings.HasSuffix(got, e)\n\t}\n\treturn got == want\n}", "title": "" }, { "docid": "259ccf730dc4eb49118982aef7901d86", "score": "0.41034928", "text": "func TestExtract(t *testing.T) {\n\t// const replace = `\"Scientific name: Cedrus (CC-CEDICT '雪松'; Wikipedia '雪松')\"`\n\ttestCases := []struct {\n\t\tname string\n\t\textractRe string\n\t\tnote string\n\t\twant []string\n\t}{\n\t\t{\n\t\t\tname: \"Empty\",\n\t\t\textractRe: ``,\n\t\t\tnote: \"\",\n\t\t\twant: []string{},\n\t\t},\n\t\t{\n\t\t\tname: \"Single equivalent\",\n\t\t\textractRe: `\"Scientific name: (.*?)[\\(,\\,,\\;]\"`,\n\t\t\tnote: \"Scientific name: Cedrus (CC-CEDICT '雪松'; Wikipedia '雪松')\",\n\t\t\twant: []string{\"Cedrus\"},\n\t\t},\n\t\t{\n\t\t\tname: \"Eqiuvalent has spaces\",\n\t\t\textractRe: `\"Scientific name: (.*)[\\(,\\,,\\;]\"`,\n\t\t\tnote: \"Scientific name: Cedrus deodara (Wikipedia '喜马拉雅雪松')\",\n\t\t\twant: []string{\"Cedrus deodara\"},\n\t\t},\n\t\t{\n\t\t\tname: \"Two equivalents\",\n\t\t\textractRe: `\"Scientific name: (.*?)[\\(,\\,,\\;]\",\"aka: (.*?)[\\(,\\,,\\;]\"`,\n\t\t\tnote: \"Scientific name: Cedrus deodara, aka: Himalayan cedar; a species of cedar native to the Himalayas (Wikipedia '喜马拉雅雪松')\",\n\t\t\twant: []string{\"Cedrus deodara\", \"Himalayan cedar\"},\n\t\t},\n\t\t{\n\t\t\tname: \"Two regex, one equivalent\",\n\t\t\textractRe: `\"Scientific name: (.*?)[\\(,\\,,\\;]\",\"Species: (.*?)[\\(,\\,,\\;]\"`,\n\t\t\tnote: \"Species: Caprimulgus indicus (Unihan '鷏')\",\n\t\t\twant: []string{\"Caprimulgus indicus\"},\n\t\t},\n\t}\n\tfor _, tc := range testCases {\n\t\textractor, err := NewNotesExtractor(tc.extractRe)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"TestExtract %s: could not create extractor: %v\", tc.name, err)\n\t\t}\n\t\tgot := extractor.Extract(tc.note)\n\t\tif !reflect.DeepEqual(got, tc.want) {\n\t\t\tt.Errorf(\"TestExtract %s: got %s, want %s\", tc.name, got, tc.want)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7865a0c200513209a4797a2cff0780d2", "score": "0.41015127", "text": "func addExtraSpaceIfExist(str string) string {\n\tif str != \"\" {\n\t\treturn \" \" + str\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "7865a0c200513209a4797a2cff0780d2", "score": "0.41015127", "text": "func addExtraSpaceIfExist(str string) string {\n\tif str != \"\" {\n\t\treturn \" \" + str\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e3c7f4b8e63698348c758f1f98159410", "score": "0.40808344", "text": "func splitWordsInitial(p *parser) stateFn {\n\tswitch r := p.next(); {\n\tcase r == runeEOF:\n\t\tbreak\n\n\tcase r == runeEscape:\n\t\tnext := p.peek()\n\t\tif next == runeEscape || isQuote(next) { // possible situations: \\', \\\\, \\\"\n\t\t\tp.next() // since next rune is escaped, treating it as part of string\n\t\t}\n\t\treturn splitWordsInitial\n\n\tcase r == runeComment:\n\t\treturn ignoreLine\n\n\tcase isSpace(r) || isEndOfLine(r):\n\t\tp.ignore()\n\t\treturn splitWordsInitial\n\n\tcase isQuote(r):\n\t\tp.backup() // quote should be part of string\n\t\treturn collectQuotedString\n\n\tcase isStringPart(r):\n\t\treturn collectString\n\n\tdefault:\n\t\treturn p.errorf(\"unexpected char: %#U (%d)\", r, p.pos)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "19c4f3be7e82dd6f0ab89d6e4049a70d", "score": "0.4080276", "text": "func (m Matcher) getOption(text string) string {\n\t// Initialize the regular expression\n\tr := regexp.MustCompile(`\\s\\S+`)\n\n\t// Find the first word\n\toption := r.FindString(text)\n\n\t// Return a trimmed version\n\treturn strings.TrimSpace(option)\n}", "title": "" }, { "docid": "44b1a5844b7e8945e42d3fba56607b73", "score": "0.40770844", "text": "func splitOnce(s, sep string) (string, string) {\n\tpos := strings.Index(s, sep)\n\tif pos == -1 {\n\t\treturn s, \"\"\n\t}\n\treturn s[:pos], s[pos+len(sep):]\n}", "title": "" }, { "docid": "1daf3683cc31ebeead9a1e9705c05f14", "score": "0.40722126", "text": "func prepareMatchValue(matchValue string) (isolatedValue string) {\n\torigMatchValue := matchValue\n\tif len(matchValue) > 0 && shouldStrip(matchValue[0]) {\n\t\tmatchValue = matchValue[1:]\n\t}\n\tif len(matchValue) > 0 && shouldStrip(matchValue[len(matchValue)-1]) {\n\t\tmatchValue = matchValue[:len(matchValue)-1]\n\t}\n\n\t// If the string still contains quotes/ticks, we may not have wanted to strip the leading/trailing quotes/ticks\n\tif stringContainsQuotesTicks(matchValue) {\n\t\treturn origMatchValue\n\t}\n\treturn matchValue\n}", "title": "" }, { "docid": "8c5890e7fbc685836be39d4e391ea449", "score": "0.40700516", "text": "func allSpaceIntoSingleTab(str string) string {\n\t// to take any whitespace characters: single whitespace, doulbe _, ...\n\tvalidID := regexp.MustCompile(`\\s{1,}`)\n\treturn validID.ReplaceAllString(str, \"\t\")\n}", "title": "" }, { "docid": "fbf4dbfe2867b5b77017c5365d2253fd", "score": "0.40683326", "text": "func lexFirstPart(l *lexer) stateFn {\n\tc := l.next()\n\tswitch {\n\tcase c == eof:\n\t\tl.emit(itemEOF)\n\t\treturn nil\n\tcase c == '.':\n\t\tl.emit(itemDot)\n\tcase c == '-':\n\t\tl.emit(itemDash)\n\t\treturn lexSecondPart\n\tcase c == '+':\n\t\tl.emit(itemPlus)\n\t\treturn lexSecondPart\n\tcase '0' <= c && c <= '9':\n\t\treturn lexNumber\n\tdefault:\n\t\tl.emit(itemInvalid)\n\t\treturn nil\n\t}\n\treturn lexFirstPart\n}", "title": "" }, { "docid": "53963aee4d89b5692de873c434b65098", "score": "0.40680143", "text": "func titleFirst(s string) string {\n\tif s == \"\" {\n\t\treturn s\n\t}\n\trunes := []rune(s)\n\treturn string(append([]rune{unicode.ToTitle(runes[0])}, runes[1:]...))\n}", "title": "" }, { "docid": "54d3660283f01d2ce67af8f3c734f7be", "score": "0.40665716", "text": "func TestRegexp(t *testing.T) {\n\treg := regexp.MustCompile(nameRe)\n\tsubmatch := reg.FindAllSubmatch([]byte(\"@阿斯达 @哈哈 @asdlsd@\"), -1)\n\tfor k,cont := range submatch {\n\t\tfmt.Println(k,\"->\",string(cont[1]))\n\t}\n}", "title": "" }, { "docid": "0090638bbe871b847c82e1b3ac14538a", "score": "0.40642306", "text": "func formatTitle(title string, maximumLength int) string {\n\tvar fTitle []string\n\tvar counter int\n\n\tif len(title) <= maximumLength {\n\t\treturn title\n\t}\n\n\ttitle = strings.TrimSpace(title)\n\tfor _, t := range strings.Split(title, \" \") {\n\t\tcounter += len(t)\n\n\t\tif counter > maximumLength {\n\t\t\tcounter = 0\n\t\t\tt = t + \"...\\n\"\n\t\t}\n\t\tfTitle = append(fTitle, t)\n\t}\n\n\treturn strings.Join(fTitle, \" \")\n}", "title": "" }, { "docid": "ac187af869408835ffed84bcc6d49b25", "score": "0.40577933", "text": "func splitUnit(unit string) (string, string) {\n\tvar index int\n\tif len(unit) > 1 {\n\t\tfor i, r := range unit[1:] {\n\t\t\tif unicode.IsUpper(r) {\n\t\t\t\tindex = i + 1\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn unit[:index], unit[index:]\n}", "title": "" }, { "docid": "b46e8932f5152c67e116ad430580b199", "score": "0.40554053", "text": "func parser_package_parse(p []parser_t) int32 {\n\tvar name lex_item_t = parser_skip(p, item_whitespace, 0)\n\tif uint32(int32((name.type_))) != uint32(int32((item_quoted_string))) {\n\t\treturn errorf(p, name, []byte(\"Expecting a quoted string, but got %s\\x00\"), lex_item_to_string(name))\n\t}\n\tvar semicolon lex_item_t = parser_skip(p, item_whitespace, 0)\n\tif uint32(int32((semicolon.type_))) != uint32(int32((item_symbol))) && int32(semicolon.value[0]) != int32(';') {\n\t\treturn errorf(p, semicolon, []byte(\"Expecting ';' got %s\\x00\"), lex_item_to_string(semicolon))\n\t}\n\tlex_item_free(semicolon)\n\t_ = p[0].pkg[0].name\n\tp[0].pkg[0].name = strings_dup(string_parse(name.value))\n\tlex_item_free(name)\n\treturn 1\n}", "title": "" }, { "docid": "f17b5359e36eba106c3c99c1d4aa8f18", "score": "0.40553868", "text": "func countLeadingSpaces(s string) int {\n\tspaces := 0\n\tfor _, c := range s {\n\t\tif c == ' ' {\n\t\t\tspaces++\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn spaces\n}", "title": "" }, { "docid": "f17b5359e36eba106c3c99c1d4aa8f18", "score": "0.40553868", "text": "func countLeadingSpaces(s string) int {\n\tspaces := 0\n\tfor _, c := range s {\n\t\tif c == ' ' {\n\t\t\tspaces++\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn spaces\n}", "title": "" }, { "docid": "6a3de6debf2b530ee087ae5a0dcd9c1f", "score": "0.40552193", "text": "func StringForTodoItems(input string) []int {\n\n\toutput := []int{}\n\t// NB not zero index as file line numbers start from 1\n\tline := 1\n\ttemp := strings.Split(input, \"\\n\")\n\n\tfor _, item := range temp {\n\t\tfindRegex := regexp.MustCompile(`\\- \\[ \\]`)\n\t\tmatches := findRegex.FindAllStringSubmatchIndex(item, -1)\n\t\tif len(matches) > 0 {\n\t\t\toutput = append(output, line)\n\t\t}\n\t\tline++\n\t}\n\n\treturn output\n}", "title": "" }, { "docid": "5ac62a098d1df2257152aa89479c53cd", "score": "0.40543208", "text": "func ExamplePattern() {\n\tp := chimera.NewPattern(`foo.*bar`, chimera.Caseless)\n\tfmt.Println(p)\n\n\tdb, err := chimera.NewBlockDatabase(p)\n\tfmt.Println(err)\n\n\tfound := db.MatchString(\"fooxyzbarbar\")\n\tfmt.Println(found)\n\n\t// Output:\n\t// /foo.*bar/i\n\t// <nil>\n\t// true\n}", "title": "" }, { "docid": "b635c401efdc0a7982f0b1682710a327", "score": "0.40514433", "text": "func writem(pp Pitem) string {\n\tvar i int\n\n\tp := pp.prod\n\tq := chcopy(nontrst[prdptr[pp.prodno][0]-NTBASE].name) + \": \"\n\tnpi := pp.off\n\n\tpi := aryeq(p, prdptr[pp.prodno])\n\n\tfor {\n\t\tc := ' '\n\t\tif pi == npi {\n\t\t\tc = '.'\n\t\t}\n\t\tq += string(c)\n\n\t\ti = p[pi]\n\t\tpi++\n\t\tif i <= 0 {\n\t\t\tbreak\n\t\t}\n\t\tq += chcopy(symnam(i))\n\t}\n\n\t// an item calling for a reduction\n\ti = p[npi]\n\tif i < 0 {\n\t\tq += fmt.Sprintf(\" (%v)\", -i)\n\t}\n\n\treturn q\n}", "title": "" } ]